akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define UNIQUE(c) sort(ALL(c)), c.erase(unique(ALL(c)), c.end())

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  double xs, ys, gx, gy; cin >> xs >> ys >> gx >> gy;
  int N; cin >> N;
  vector<double> X(N), Y(N), R(N); REP(i, N) cin >> X[i] >> Y[i] >> R[i];
  vector<double> dist(N);
  REP(i, N) dist[i] = max(0.0, hypot(xs - X[i], ys - Y[i]) - R[i]);
  priority_queue<pair<double, int>, vector<pair<double, int>>, greater<pair<double, int>>> pque;
  REP(i, N) pque.emplace(dist[i], i);
  vector<bool> used(N, false);
  int rest = N;
  while (rest > 0) {
    int idx; tie(ignore, idx) = pque.top(); pque.pop();
    if (used[idx]) continue;
    used[idx] = true;
    rest--;
    for (int i = 0; i < N; i++) {
      double d = max(0.0, hypot(X[idx] - X[i], Y[idx] - Y[i]) - R[idx] - R[i]);
      if (dist[i] > dist[idx] + d) {
        dist[i] = dist[idx] + d;
        pque.emplace(dist[i], i);
      }
    }
  }
  double ans = hypot(xs - gx, ys - gy);
  REP(i, N) {
    ans = min(ans, dist[i] + max(0.0, hypot(X[i] - gx, Y[i] - gy) - R[i]));
  }
  cout << setprecision(20) << ans << endl;
  return 0;
}


Measured memory_bytes: 6260
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll minmm=pow(10,15)+7;
ll solve(ll prefsum[],ll arr[],vector<vector<ll>>&dp,ll start,ll end){
  if(start>end)return 0;
  if(start==end)return 0;
  if(end-start==1)return arr[start]+arr[end];
  if(dp[start][end]!=-1)return dp[start][end];
  ll minm=minmm;
  for(ll i=start;i<end;i++){
    ll sumf=prefsum[i+1]-prefsum[start];
    ll sums=prefsum[end+1]-prefsum[i+1];
    ll temp=solve(prefsum,arr,dp,start,i)+solve(prefsum,arr,dp,i+1,end)+sumf+sums;
    minm=min(minm,temp);
  }
  dp[start][end]=minm;
  return dp[start][end];
}
int main(){
  ll n;
  cin>>n;
  ll arr[n];
  ll prefsum[n+1];
  prefsum[0]=0;
  for(ll i=0;i<n;i++){
    cin>>arr[i];
    prefsum[i+1]=prefsum[i]+arr[i];
  }
  vector<vector<ll>>dp(n,vector<ll>(n,-1));
  ll start=0;
  ll end=n-1;
  ll ans=solve(prefsum,arr,dp,start,end);
  cout<<ans<<endl;
}

Measured memory_bytes: 4880
import java.util.Scanner;
public class Main {
  public static void main (String[]args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int counter = 0;
    if(s.substring(0,1).equals("1")){counter++;}
    if(s.substring(1,2).equals("1")){counter++;}
    if(s.substring(2,3).equals("1")){counter++;}
    System.out.println(counter);
  }
}


Measured memory_bytes: 23764
#include <stdio.h>
#include <stdlib.h>

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef unsigned long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1'000'000'000ll + 7;
//const i64 smod = 998244353ll;
//const i64 inf = 1'000'000'000'000'000'000ll + 7;
//const i64 inf = 1'000'000'007;

const long double eps = 1e-8;

const i64 MAXN = 3 * 100'000 + 5;

i64 n;
i64 a[MAXN];

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    i64 p = 1;
    cin >> n;

    for (i64 i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
    }



    for (i64 i = 0; i < n; i++) {
        i64 t = a[i];

        double q = (double)t * p;
        if (q > 1e18) {
            cout << -1 << endl;
            return 0;
        }

        const i64 z = 1e18;
        p *= t;

        if (p > (i64)1e18) {
            cout << -1 << endl;
            return 0;
        }
    }

    cout << p << endl;

    return 0;
}

Measured memory_bytes: 4424
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
long long n,r;
int main()
{
	cin>>n>>r;
	if (n>=10)
	{
		cout<<r<<"\n";
	}
	else
	{
		long long a=100*(10-n);
		a+=r;
		cout<<a<<"\n";
	}
	return 0;
}

Measured memory_bytes: 3632
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);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int a = Integer.parseInt(in.next());
            int b = Integer.parseInt(in.next());
            int ans = 0;

            for (int i = a; i <= b; i++) {
                int t = i % 10;
                int u = i / 10000 % 10;
                int s = i / 10 % 10;
                int v = i / 1000 % 10;
                if (t == u && s == v) ans++;

            }

            // 出力
            out.println(ans);

        }

    }
}



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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define int ll
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vvc> vvvc;
typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cerr << (#x) << " = " << (x) << endl;

#ifdef RUS_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);
#define rand shittttty_shit
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1>
inline istream & operator >> (istream &in, pair<T0, T1> &a) {
    return in >> a.first >> a.second;
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}


void smain();



signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
#ifdef RUS_HOME
    freopen("input", "r", stdin);
    //freopen("output.txt", "w", stdout);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef RUS_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
    return 0;
}

const int MOD=1e9+7,N=1e5,M=18,oo=1e9;



void smain() {

    int x;
    cin>>x;
    cout<<1-x;


}



Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <bits/stdc++.h>

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

using namespace std;

int main(){
    int n, k, q;
    cin >>n >>k >>q;
    int consta[n+1];
    for(int i = 1; i <= n; i++){
        consta[i] = 0;
    }
    rep(i, q){
        int a;
        cin >>a;
        consta[a]++;
    }
    for(int i = 1; i <= n; i++){
        if(q - consta[i] < k){
            cout << "Yes"<< endl;
        }else{
            cout <<"No" <<endl;
        }
    }
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }

struct Tmp
{
public:
  Tmp(int N);
};

Tmp::Tmp(int N){}

void solve(void)
{
  int N; cin >> N;
  vector<string> A(N);
  vector<int> B(N);
  map<string, int> m{};
  for (auto& a : A) {
    cin >> a;
    ++m[a];
  }
  for (int i = 0; i < N; ++i) {
    B[i] = m[A[i]];
  }
  auto cnt = *boost::max_element(B);
  set<string> res{};
  for (int i = 0; i < N; ++i) {
    if (B[i] == cnt) {
      res.insert(A[i]);
    }
  }
  vector<string> ans(res.begin(), res.end());
  for (const auto& s : ans) {
    cout << s << CRLF;
  }
  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


Measured memory_bytes: 37120
package main

import "fmt"
//import "math"

func main(){
	var x1, x2, x3, x4 int
	var y1, y2, y3, y4 int
	//var syahen,_ float64

	fmt.Scan(&x1, &y1, &x2, &y2)

	///syahen = math.Sqrt(float64((x1 - x2) * (x1 - x2) + (y1 - y2) + (y1 - y2)))

	x3 = x2 - (y2 - y1)
	y3 = y2 + (x2 - x1)
	x4 = x1 - (y2 - y1)
	y4 = y1 + (x2 - x1)

	fmt.Println(x3, y3, x4, y4)
}

Measured memory_bytes: 512
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#define ll long long
using namespace std;
template <class T>
inline void rd(T &x) {
	x=0; char c=getchar(); int f=1;
	while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }
	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
int main() {
	int x;
	cin>>x;
	cout<<x*x*x;
	return 0;
} 

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

public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        boolean first=true;
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            int i=0;
            while ((line = br.readLine()) != null) {
            	if(line.equals("0 0")){
            		break;
            	}else{
            		String[] str=line.split(" ");
            		int a=Integer.parseInt(str[0]);
            		int b=Integer.parseInt(str[1]);
            		System.out.println(Integer.min(a,b)+" "+Integer.max(a, b));
            	}
            }
        }
    }
}

Measured memory_bytes: 26772
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int N,K;
int a[22];

int main(){
	scanf("%d%d" , &N , &K);
	repp(i,0,N){
		scanf("%d" , a + i);
	}
	LL ans = 1234567890123456;
	repp(i,1,1<<N){
		int x = 0;
		for(int z = i ; z > 0 ; z /= 2) if(z%2==1) ++x;
		if(x < K) continue;
		x = 0;
		LL y = 0;
		int p = i;
		repp(j,0,N){
			if(x < a[j]){
				x = a[j];
			} else if(p%2==1){
				y += x - a[j] + 1;
				++x;
			}
			p /= 2;
		}
		ans = min(ans , y);
	}
	printf("%lld\n" , ans);
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
void foo(vector<vector<long long int>> &vec, long long int n, long long int w) {
  vector<vector<ll int>> dp(n + 1, vector<ll int>(w+1, 0));
  for (ll int i = 1; i < vec.size(); i++) {
    for (ll int j = 1; j <= w; j++) {
      if (j >= vec[i][0]) {
        dp[i][j] = max(vec[i][1] + dp[i-1][j - vec[i][0]], dp[i-1][j]);
      } else {
        dp[i][j] = dp[i - 1][j];
      }
    }
  }
  cout << dp[n][w];
}

int main() {
  long long int n, w;
  cin >> n >> w;
  vector<vector<long long int>> vec(n+1, vector<long long int>(2, 0));
  for (auto i = 1; i < vec.size(); i++) {
    for (auto j = 0; j < 2; j++) {
      cin >> vec[i][j];
    }
  }
  foo(vec, n, w);
  return 0;
}


Measured memory_bytes: 83000
#include <bits/stdc++.h>
using namespace std;
int n, a, b, ans;
int main ()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a>>b;
		for(int j=a;j<=b;j++)
			ans++;
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Vec2(T, n, m, xs) vector<vector<T>> xs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")

// constexpr int MOD = 1e9+7;

class UFT{
public:
    vector<int> par;
    vector<int> siz;
    UFT(int n) : par(vector<int>(n)), siz(vector<int>(n, 1)){ For(i, n) par[i] = i; };
    bool same(int x, int y){ return find(x) == find(y); };
    void unite(int x, int y){ if(!same(x = find(x), y = find(y))){ par[x] = y; siz[y] += siz[x]; } };
    int find(int x){ return (par[x] == x) ? x : (par[x] = find(par[x])); };
    int size(int x){ return siz[find(x)]; };
    void print() const{ Couts(par); };
};

int main(void){
    Cin(int, n);
    Cins2(ll, n, x, y);
    
    int ans = n;
    For(i0, n) for(int j0 = i0+1; j0 < n; j0 ++){
        ll p = x[i0] - x[j0], q = y[i0] - y[j0];
        UFT u(n);
        // Cout(p, " ", q);
        For(i, n) For(j, n){
            if(i == j) continue;
            if(x[i] == x[j] - p && y[i] == y[j] - q) u.unite(i, j);
        }
        For(i, n) u.find(i);
        auto z = u.par;
        // Couts(z);
        Sort(z);
        Unique(z);
        ans = min(ans, (int)z.size());
    }
    Cout(ans);
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

static ll p = 1000000007;

struct Combination{
  int MAX;
  ll MOD;
  vector<ll> fact;
  vector<ll> fact_inv;

  Combination(ll mod, ll max){
    MAX = max;
    MOD = mod;
    fact.resize(MAX);
    fact_inv.resize(MAX);
    fact[0] = 1;
    REP(i,MAX-1) fact[i+1] = fact[i]*(i+1)%MOD;
    fact_inv[MAX-1] = power(fact[MAX-1],MOD-2);
    for(ll i = MAX-2; i>=0; i--) fact_inv[i] = fact_inv[i+1]*(i+1)%MOD;
  }

  ll power(ll a, ll b){
    ll res=1;
  	while(b>0){
  		if(b&1) res=res*a%MOD;
  		a=a*a%MOD;
  		b>>=1;
  	}
  	return res;
  }

  ll comb(ll n, ll r){
	return (fact[n]*fact_inv[r])%MOD*fact_inv[n-r]%MOD;
}
};

int main(){
  ll n,m,k;
  cin >> n >> m >> k;
  Combination com(p,250000);
  ll ans = 0;
  for(ll i=1;i<n;i++){
    ans += i*com.comb(n*m-2,k-2)*(n-i)%p*m%p*m%p;
    ans %= p;
  }
  for(ll i=1;i<m;i++){
    ans += i*com.comb(n*m-2,k-2)*(m-i)%p*n%p*n%p;
    ans %= p;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4096
#include<bits/stdc++.h>
#define I int
#define S(a) scanf("%d",&a)
#define S2(a,b) scanf("%d%d",&a,&b)
#define P(a) printf("%d\n",a)
#define PL(a) printf("%lld\n",a)
#define PT(t) printf("Case %d: ",t)
#define PB(a) push_back(a)
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define ll long long 
using namespace std;
#define mx 500004
#define md 1000000007ll
typedef pair<int, int >P;
typedef vector<ll>V;

////////define value/////
template <class T> inline T BM(T p, T e, T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
 
 
template <class T>bool ISLEFT(T a, T b, T c)
{
    if(((a.xx - b.xx) * (b.yy - c.yy) - (b.xx - c.xx) * (a.yy - b.yy)) < 0.0)return 1;  //Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}

int main(){
int n,m;
    cin>>n>>m;
    double res =0;
    for(int i=1;i<=n;i++){

        int cnt =0;
        int su=0;
        for(int j =i; j< m;j*=2){
            cnt++;
        }
        double am = 1;
        for(int j=1;j<=cnt;j++)am*=.5;
        double sum = (am)/(double)n;
        res+=sum;
    }
    printf("%.10lf\n",res);
   //cout<<res<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define ff first
#define ss second
///////////////////////////////////////////////////////////
const ll mod = 1e9 + 7 ;
ll multiply(ll a, ll b){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
//////////////////////////////////////////////////////////
void solve( ){
    int n ;
    cin >> n ;
    vector < ll > a(n);
    for( int i = 0 ; i < n ; i++) cin >> a[i] ;
    ll sum = 0 ;
    vector < ll > cnt(61);
    for( int i = n-1 ; i >=0 ; i--){
            ll v = a[i] ;
            for( int bit = 0 ; bit < 61 ; bit++){
                int b = (v&(1LL<<bit)?1:0);
                if(b==0)
                    sum = add(sum,multiply(cnt[bit],(1LL<<bit)%mod));
                else{
                    sum = add(sum,multiply(n-i-1-cnt[bit],(1LL<<bit)%mod));
                    cnt[bit]++;
                }
            }
    }
    cout << sum ;
}
int main(){
  // #ifndef ONLINE_JUDGE
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  // #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int test_case=1 ;
    //cin >> test_case ;
    //precal();
    for( int i = 1 ; i <= test_case ; i++){
        solve( );
    }
}
// 011100
//   1010
// 100110


Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5]){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}


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

#pragma GCC target ("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimization ("unroll-loops")

using namespace std;

#define all(x) (x).begin(), (x).end()

typedef long long ll;

void solve(){
	ll x;
	cin >> x;
	ll hap = 0;
	hap += (x / 500) * 1000;
	x -= (x / 500) * 500;
	hap += (x / 5) * 5;
	cout << hap;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    solve();
    
    return 0;
}


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

class Main{
    public static void main(String[] args){
        FastScanner fsc=new FastScanner();
        int n=fsc.nextInt();
        long a[]=new long[n];
        long sum=0;
        for(int i=0;i<n;i++){
            a[i]=fsc.nextLong();
            sum+=a[i];
        }
        fsc.close();
        long tmp=0;
        long s=0, t=0;
        for(int i=0;i<n;i++){
            tmp+=a[i];
            if(2*tmp>sum){
                s=tmp-a[i];
                t=tmp;
                break;
            }
            else if(2*tmp==sum){
                System.out.println(0);
                return;
            }
        }
        long expand=sum-2*s;
        long shrink=2*t-sum;
        long ans=Math.min(expand, shrink);
        System.out.println(ans);
    }
    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte(){
            if(ptr<buflen) return true;
            else{
                ptr = 0;
                try{
                    buflen = in.read(buffer);
                }
                catch(IOException e){
                    e.printStackTrace();
                }
                if(buflen<=0) return false;
            }
        return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) throw new NumberFormatException();
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }
                else if(b == -1 || !isPrintableChar(b)) return minus ? -n : n;
                else throw new NumberFormatException();
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
        public void close(){
            try{in.close();}
            catch(IOException e){e.printStackTrace();}
        }
    }
}

Measured memory_bytes: 24924
#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 rep(i, start, end) for(int i = start; i < (int)(end); ++i)
int h[200010];
int main(){
    int n, k;
    cin >> n >> k;
    rep(i,0,n) cin >> h[i];
    sort(h, h+n);
    long long ans = 0;
    rep(i,0,n-k) ans += h[i];
    cout << ans << endl;
    return 0;
}

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

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

Measured memory_bytes: 256
/*The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/

//PRABHJOT SINGH A.K.A. PRABHI
//~~~~~conquizztador~~~~~


#include<bits/stdc++.h>
using namespace std;
using lli = long long int;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
const int MOD = 1000000007;
const int MOD1 = 998244353;
const int maxn = 100010;
const int lim = (int)1e9;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int r=0;
	cin>>r;
	cout<<3*r*r<<endl;
}

Measured memory_bytes: 3568
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, a, b) for (int i = a; i < (b); i++)
#define FOR(i, n) for (int i = n; i >= 0; i--)
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define ll long long
#define SIZE 100001
#define MOD 1000000007
#define INF 100000000
using namespace std;

int main()
{
    ll a,b,c;
    cin >> a >> b >> c;
    if(a % 2 == 1 || b % 2 == 1 || c % 2 == 1){
        printf("0\n");
        return 0;
    }

    if(a == b && b == c && c == a){
        printf("-1\n");
        return 0;
    }


    int cnt = 0;
    while(true){
        cnt++;
        ll tmp_a = a, tmp_b = b;
        a = tmp_b/2 + c/2;

        b = tmp_a/2 + c/2;

        c = tmp_a/2 + tmp_b/2;

        if(a % 2 == 1 || b % 2 == 1 || c % 2 == 1){
            break;
        }
    }

    printf("%d\n",cnt);

    return 0;
}

Measured memory_bytes: 256
gets
cards = gets.chomp.split(' ').map(&:to_i).group_by { |i| i }
                                                                                                                              

# 1: [x x x x x] -> [x x x] -> [x]                                                                                            
# 2: [x y x y x] -> [y x y] -> [y]                                                                                            
# 3: [x y z x y] -> [x z y]                                                                                                   
# 4: [x y z x a] -> [x y z]                                                                                                   
# 5: [x y z a b]                                                                                                              

if cards.length.odd?
  puts cards.length
else
  puts cards.length - 1
end


Measured memory_bytes: 19332
#include <iostream>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <typeinfo>
#include <queue>
#include <math.h>
using namespace std;

static int n;
int a[101];
void insertionSort(int[],int);

int main(){
	
	cin>>n;
	for (int i = 1; i < n+1; ++i)
	{
		cin>>a[i];
	}
	insertionSort(a,n);


return 0;
}

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

	}


}

Measured memory_bytes: 3044
#define _USE_MATH_DEFINES

#include <cmath>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <numeric>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

const int dx[] = {1, 0, -1, 0, 0};
const int dy[] = {0, 1, 0, -1, 0};

const int Maxn = 100010;

int n;
ll k;
ll a[Maxn];

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

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

    ll digits = 0;
    bool flag = false;
    for (int i = 50; i >= 0; --i) {
        if (flag || (k >> i) & 1) {
            ll mask = (1LL << i);
            int num = 0;
            for (int j = 0; j < n; ++j) {
                num += !(a[j] & mask);
            }
            if (num > n - num) digits += mask;
            else flag = true;
        }
    }

    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        ans += digits ^ a[i];
    }
    cout << ans << endl;
}

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

typedef long long ll;
typedef pair<int,int> p_int;
typedef pair<ll,ll> p_ll;
typedef tuple<ll,ll,ll> t3_ll;
int dx[] = {-1,0,1,0},dy[] = {0,1,0,-1};
int prime[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
const ll inf = 1e9+7;

int main() {
	bool ans=false;
	ll a,b;cin>>a>>b;
	ll x[a];
	int pos;
	for(int i=0;i<a;i++){
		cin>>x[i];
		if(i!=0 && x[i-1]+x[i]>=b){
			ans = true;
			pos = i;
		}
	}
	if(!ans){
		cout<<"Impossible"<<endl;
		return 0;
	}
	cout<<"Possible"<<endl;
	for(int i=1;i<pos;i++){
		cout <<i<<endl;
	}
	for(int i=a-1;i>pos;i--){
		cout<<i<<endl;
	}
	cout<<pos<<endl;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	 double ar[n];
	for(int i=1;i<=n;i++)
		cin>>ar[i];
	 double dp[n+5][n+5];
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=n;j++)
		{
			if(i==0)
				dp[i][j]=0;
			else if(i==1 && j==0)
				dp[i][j]=1.0-ar[i];
			else if(i==1 && j==1)
				dp[i][j]=ar[i];
			else
				dp[i][j]=dp[i-1][j]*(1-ar[i])+dp[i-1][j-1]*(ar[i]);
		}
	}
	double answer=0;
	for(int i=(n+1)/2;i<=n;i++)
		answer+=dp[n][i];
	cout<<setprecision(10)<<answer<<endl;
}


Measured memory_bytes: 70656
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<climits>
#include<map>
#define ll long long
using namespace std;
int main() {
	ll n,sum=0;
	cin >> n;
	vector<ll>a(n);
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	for (ll i = 0; i < n - 1; i++) {
		sum += abs(a[i] - a[i + 1]);
	}
	cout << sum << endl;
}



Measured memory_bytes: 256
def calc(inp):
    if len(inp) == 1:
        return inp
    out = ""
    for i in range(len(inp) - 1):
        out = out + str(int(inp[i]) + int(inp[i + 1]))[-1]
    return calc(out)

while True:
    try:
        s = input()
        print(calc(s))
    except:
        break



Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int long long
#pragma GCC optimize("O2")
#define sz(x) ((long long)(x).size())
#define all(x)  x.begin(),x.end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl "\n"
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define leastsigbit(x)     __builtin_ffs(x)
const int mod = 1e9 + 7;
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define pii pair<ll,ll>
#define vpii vector<pii>
#define tt ll tt;cin >> tt;while(tt--)
#define  fio ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define D1(x) { cerr << " [" << #x << ": " << x << "]\n"; }
#define D2(x) { cerr << " [" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n";}
const double PI = acos(-1);
ll power(ll a,ll b,ll m=mod){ ll ans=1; a=a%m;  while(b>0) {  if(b&1)  ans=(1ll*a*ans)%m; b>>=1;a=(1ll*a*a)%m;}return ans;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm( ll x, ll y) { return (x*y)/gcd(x,y);}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
bool isPowerOfTwo(int x)
{
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));
}
double distform(int x, int y, int z, int w) {//(x1,y1,x2,y2)
    return sqrt(1. * pow(x-z,2) + 1. * pow(y-w,2));
}
const int MAXN = 2e5+ 10;
const ll inf = 1e18;

int intlog(double base, double x) {
    return (int)(log(x) / log(base));
}
void read(vi & a) {
    for (int i = 0; i < sz(a); ++i) {
        cin >> a[i];
    }
}
int32_t main() {
    fio
    int n,m;
    cin >> n >> m;
    vi p(m);
    vector<vector<string>> subs(n,vector<string>(0));
    vector<string> s(m);
    for (int i = 0; i < m; ++i) {
        cin >> p[i] >> s[i];
        subs[p[i] - 1].pb(s[i]);
    }
    int cnt = 0;
    int ans = 0;
    for (int j = 0; j < n; ++j) {
        bool k = 0;int tmp = 0;
        for (int i = 0; i < sz(subs[j]); ++i) {
            if(subs[j][i] == "WA") {
                tmp++;
            }
            else if(subs[j][i] == "AC") {
                ans++;
                k = 1;
                break;
            }
        }
        if(k) {
            cnt+=tmp;
        }
    }
    cout << ans << " " << cnt << endl;

}






Measured memory_bytes: 14208
#include <bits/stdc++.h>
using namespace std;
#define maxn 200003
int P[maxn];
int MIN[maxn];
int main()
{
    int N;
    cin>>N;
    int ans = 0;
    for(int i = 0;i < N;i ++)
    {
        cin>>P[i];
        if(i == 0)
        {
            MIN[i] = P[i];
            ans ++;
            continue;
        }
        if(MIN[i-1] < P[i])
        {
            MIN[i] = MIN[i-1];
        }else
        {
            MIN[i] = P[i];
            ans ++;
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef tuple<int, int, int> tp;
typedef long long LL;
typedef long double LD;
typedef pair<int, int> pii;
typedef pair<int, LL> pil;
typedef pair<LL, int> pli;
typedef pair<LL, LL> pll;
typedef pair<pii, int> piipi;
typedef pair<int, pii> pipii;
typedef pair<pii, pii> piipii;
typedef pair<LL, pii> plpii;
typedef pair<LD, LD> pdd;
typedef pair<LD, int> pdi;
typedef pair<LD, LL> pdl;
typedef pair<int, LD> pid;
typedef pair<LL, LD> pld;
const int mod = 1e9 + 7;
const int hf = 999983;
const int N = 1e6;
LL f[200005], rf[200005];
LL inv(LL a){
    LL b = mod-2, ans = 1;
    while(b){
        if(b&1) ans = (ans*a)%mod;
        a = (a*a)%mod;
        b/=2;
    }
    return ans;
}
LL ncr(int a, int b){
    return f[a]*rf[b]%mod*rf[a-b]%mod;
}
LL dp[3005];
pii s[3005];
int r[3005], c[3005];
int main(){
    f[0] = 1;
    for(int i=1;i<=200000;i++) f[i] = (f[i-1]*i)%mod;
    for(int i=0;i<=200000;i++) rf[i] = inv(f[i]);
    int h, w, n;
    scanf("%d%d%d", &h, &w, &n);

    s[n+1] = pii(h+w, n+1);
    r[n+1] = h, c[n+1] = w;
    for(int i=1;i<=n;i++){
        scanf("%d%d", &r[i], &c[i]);
        s[i] = pii(r[i]+c[i], i);
    }
    sort(s+1, s+2+n);
    for(int i=1;i<=n+1;i++){
        int b = s[i].second;
        dp[b] = ncr(r[b]+c[b]-2, r[b]-1);
        for(int j=1;j<i;j++){
            int a = s[j].second;
            if(r[b] >= r[a] && c[b] >= c[a]){
                LL ways = ncr(r[b]-r[a]+c[b]-c[a], r[b]-r[a]);
                dp[b] = (dp[b] - ways*dp[a]%mod + mod)%mod;
            }
        }
    }
    printf("%lld\n", dp[n+1]);
}


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

int main() {
  int A, B;
  cin >> A >> B;

  int ans = 0;
  for (int i = A; i <= B; i++) {
    string s = to_string(i);
    if (s[0] == s[4] && s[1] == s[3]) ans++;
  }
  cout << ans << endl;
}


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

int main()
{
    int64_t a,b,c,x,ans;
    cin>>a>>b>>c;
    x=(a>b)?((a>c)?a:c) : ((b>c)?b:c);
    ans=((3*x)-(a+b+c))/2;
    if(((3*x)-(a+b+c))%2==0) cout<<ans;
    else cout<<ans+2;

    return 0;
}


Measured memory_bytes: 256
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 W [] = new int [N];
        int min = 0,opt=0,sum=0;
        for(int i=0;i<N;i++) {
            W[i] = sc.nextInt();
            sum += W[i];
            if (min < W[i]) min = W[i];
        }
        while(min<sum){
            int mid = (min+sum)/2;
            int track_num = 1,weight=0;
            if(K==1){
                opt = sum;
                break;
            }
            for(int i:W) {
                if (weight + i <= mid) weight += i;
                else {
                    weight=i;
                    track_num++;
                }
            }
            if(track_num<=K) {
                sum=mid;
                opt = mid;
            }
            else min = mid+1;
        }
        System.out.println(opt);
    }
}


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

ll llmax(ll x, ll y){
	if (x > y) return x;
	return y;
}
ll llmin(ll x, ll y){
	if (x > y) return y;
	return x;
}

int main(){
	ll n, k;
	cin >> n >> k;
	cout << llmin(n%k, llmax(n%k-k, k-n%k)) << endl;
 	return 0;
 }




Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
using namespace std;
string s;
int main(){
	cin>>s;
  	for(register int i=0;i<s.size();i++){
    	if(s[i]=='7'){
        	printf("Yes\n");
         	return 0;
        }
    }
  	printf("No\n");
	return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<functional>
using namespace std;
typedef pair<double,pair<string,int> > mypair;
string re(string a){
	for(int i=0;i<a.size();i++){
		a[i]='a'+('z'-a[i]);
	}
	return a;
	}
	string eq(string a){
		string b;
		for(int i=0;i<20;i++)
         b.push_back('A');
		for(int i=0;i<a.size();i++)
     b[i]=a[i];
		return b;
	}
int main(void){
	int n;
	while(1){
cin>> n;
if(n==0)break;
vector<string> l(n);
vector<int> p(n),a(n),b(n),c(n),d(n),e(n),f(n),s(n),m(n);
for(int i=0;i<n;i++)
cin>>l[i]>>p[i]>>a[i]>>b[i]>>c[i]>>d[i]>>e[i]>>f[i]>>s[i]>>m[i];
vector<mypair> q(n);
for(int i=0;i<n;i++){
	q[i].first=(double)(m[i]*f[i]*s[i]-p[i])/(a[i]+b[i]+c[i]+m[i]*(d[i]+e[i]));
	q[i].second.first=re(eq(l[i]));
	q[i].second.second=i;
}

sort(q.begin(),q.end(),greater<mypair>());

for(int i=0;i<n;i++){
cout<<l[q[i].second.second] <<endl;
}
cout<<'#'<<endl;
	}
	return 0;
}

Measured memory_bytes: 2996
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int mod = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
#define ceil(a, b) a / b + !!(a % b)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
int table[3000001];
int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int tetra[201];
    tetra[0] = 0;
    rrep(i, 1, 201) tetra[i] = i * (i + 1) * (i + 2) / 6;
    int dp[1000001];
    rep(i, 1000001) dp[i] = i;
    int dp2[1000001];
    rep(i, 1000001) dp2[i] = i;
    rep(i, 201) {
        rep(j, 1000001) {
            if (j + tetra[i] < 1000001) {
                chmin(dp[j + tetra[i]], dp[j] + 1);
                if (tetra[i] % 2 != 0) chmin(dp2[j + tetra[i]], dp2[j] + 1);
            }
        }
    }
    int n;
    while (cin >> n && n) {
        cout << dp[n] << " " << dp2[n] << endl;
    }
}



Measured memory_bytes: 10944
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int MOD = 1e9 + 7;

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

  vector<vector<ll>> d(k + 1);
  for (ll i = 1; i <= k; i++) {
    for (ll j = 1; j * j <= i; j++) {
      if (i % j == 0) {
        if (j != i) d[i].push_back(j);
        if (j != 1 && j * j != i) d[i].push_back(i / j);
      }
    }
  }

  vector<ll> p(k + 1), t(k + 1);
  for (ll i = k; i >= 1; i--) {
    ll x = k / i;
    if (!p[x]) {
      // pow(x, n)
      p[x] = 1;
      for (ll j = 0; j < n; j++) (p[x] *= x) %= MOD;
    }
    t[i] += p[x];
    t[i] %= MOD;
    for (auto e : d[i]) {
      t[e] += MOD - t[i];
      t[e] %= MOD;
    }
  }

  ll r = 0;
  for (ll i = 1; i <= k; i++) {
    r += i * t[i];
    r %= MOD;
  }
  cout << r << endl;
}


Measured memory_bytes: 19796
import kotlin.math.pow

fun main() {

    val (d,n) = readLine()!!.split(" ").map(String::toInt)

    val num = 100.0.pow(d.toDouble()).toInt()

    var ans = 0

    if (n<=99){
        ans = num * n
    } else if (n==100){
        ans = 101 * num
    }

    println(ans)

}

Measured memory_bytes: 36396
#import string,itertools,fractions,heapq,re,array,bisect
#from math import *
#from collections import Counter
def rl(s): return xrange(len(s))


INF = 2147483647


import sys
stdin = sys.stdin

N =        int( stdin.readline().strip() )
s = stdin.readline().strip()
t = stdin.readline().strip()

for offset in range(N+1):
    if t.startswith(s[offset:]):
        print N + offset
        break



Measured memory_bytes: 2568
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
typedef tuple<ll,ll,ll> Tu;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

void printb(unsigned int v) {
  unsigned int mask = (int)1 << (sizeof(v) * CHAR_BIT - 1);
  do putchar(mask & v ? '1' : '0');
  while (mask >>= 1);
}

ll n;
ll k;
ll a[100100],b[100100];
ll ans=0;
int main(){
	cin>>n>>k;
	REP(i,n)cin>>a[i]>>b[i];
	ll tans=0;
	for(int i=29;i>=0;i--){
		if(!(k>>i&1))continue;
		ll t1=((k>>(i+1))<<(i+1))+(1<<(i))-1;
		//printb(t1);
		//cout<<endl;
		//cout<<i<<endl;
		tans=0;
		for(int j=0;j<n;j++){
			if(t1>=a[j]&&((t1-a[j])==(t1^a[j]))){
				tans+=b[j];
			}
		}
		//cout<<tans<<endl;
		ans=max(ans,tans);
	}
	tans=0;
	for(int j=0;j<n;j++){
		if(k>=a[j]&&((k-a[j])==(k^a[j]))){
			tans+=b[j];
		}
	}
	//cout<<0<<" "<<tans<<endl;
	ans=max(ans,tans);	
	cout<<ans<<endl;
	return 0;
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/21  Problem: ABC 060 B / Link: http://abc060.contest.atcoder.jp/tasks/abc060_b  ----- */


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

	LL A, B, C; cin >> A >> B >> C;
	LL ans = 0LL;
	FOR(i, 1, 1000) {
		LL ret = i * A;
		ans |= (ret%B == C);
	}

	
	
	cout << (ans?"YES":"NO") << "\n";

	return 0;
}


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

int n, k;

int main(){
  cin >> n >> k;
  n--; k--;
  cout << (n + k - 1) / k << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#include<bitset>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	ll W,H,p[100001],q[100001];
	vpll pq;
	ll ans=0;
	scan(W>>H);
	ll nokori[2]={H+1,W+1};
	rep(i,W) scan(p[i]),pq.push_back({p[i],0});
	rep(i,H) scan(q[i]),pq.push_back({q[i],1});
	sort(ALL(pq));
	rep(i,W+H){
		ans+=pq[i].first*nokori[pq[i].second];
		nokori[!(pq[i].second)]--;
	}
	prin(ans);
	return 0;
}


Measured memory_bytes: 7408