akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define N 1001
using namespace std;
int n,m;
string s1,s2;

int mem[N][N],used[N][N];
int dfs(int I,int J){
  if(I == n) return m-J;
  if(J == m) return n-I;
  if(used[I][J]++) return mem[I][J];
  int res = 1e9;
  res = min(res,1+dfs(I+1,J));//insert
  res = min(res,1+dfs(I,J+1));//erase
  res = min(res,(s1[I]!=s2[J])+dfs(I+1,J+1));//replace or same
  return mem[I][J] = res;  
}


int main(){
  cin>>s1>>s2;
  n = s1.size();
  m = s2.size();
  cout<<dfs(0,0)<<endl;;
  return 0;
}

Measured memory_bytes: 11020
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>

#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()

using namespace std;
typedef long long int ll;
typedef pair<int,int> P;

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 (a>b) { a=b; return 1; } return 0; }

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const int INF = 0x3fffffff;

typedef pair<double,P> PP;

int N;
double px[205], py[205], pz[205];
double vx[205], vy[205], vz[205];
double r[205], vr[205];
double dist(int a, int b, double t){
	double dx = (px[a] - px[b]) + t * (vx[a] - vx[b]);
	double dy = (py[a] - py[b]) + t * (vy[a] - vy[b]);
	double dz = (pz[a] - pz[b]) + t * (vz[a] - vz[b]);
	double dr = r[a] + r[b] - t * (vr[a] + vr[b]);
	return sqrt( dx*dx + dy*dy + dz*dz ) - dr;
}

double alive[205];
priority_queue<PP> que;
void collision(int a, int b){
	// ????????????????????????????±???????
	double l=0, r=min( alive[a], alive[b] );
	rep(i,100){
		double m1 = (l + 2.0*r) / 3.0;
		double m2 = (2.0*l + r) / 3.0;
		if( dist(a, b, m1) > dist(a, b, m2) ){
			r = m1;
		}else{
			l = m2;
		}
	}
	if( dist(a,b,l) > 0.0 ) return;
	// ???????????¶???????????????????±???????
	l = 0.0;
	rep(i,100){
		double m = (l + r) / 2;
		if( dist(a,b,m) > 0.0 ){
			l = m;
		}else{
			r = m;
		}
	}
	que.push( PP(-l, P(a, b)) );
}

void solve(){
	while( !que.empty() ){
		double t = -que.top().first;
		int a = que.top().second.first;
		int b = que.top().second.second;
		que.pop();
		if( alive[a] > t && alive[b] > t ){
			alive[a] = t;
			alive[b] = t;
		}
	}
}

int main(){
	while( cin >> N, N ){
		rep(i,N){
			cin >> px[i] >> py[i] >> pz[i];
			cin >> vx[i] >> vy[i] >> vz[i];
			cin >> r[i] >> vr[i];
			alive[i] = r[i] / vr[i];
		}
		rep(i,N) rep(j,i) collision(i, j);
		solve();
		rep(i,N){
			printf("%.10f\n", alive[i]);
		}
	}

	return 0;
}

Measured memory_bytes: 3180
#include <iostream>
using namespace std;
int main()
{
  int a,b,c,k,ans=0;
  cin>>a>>b>>c>>k;
  if(k>a){
    ans+=a;
    if(k-a>b){
      ans-=k-a-b;
    }
  }
  else ans+=k;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3636
#include<cstdio>

#define ran 505

int n, m, q;
int a[ran][ran], s[ran][ran];

int main() {
	scanf("%d%d%d", &n, &m, &q);
	for(int i=0;i<m;i++) {
		int x, y; scanf("%d%d", &x, &y);
		a[x][y]++;
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			s[i][j] = a[i][j] + s[i-1][j]+s[i][j-1]-s[i-1][j-1];
	for(int i=0;i<q;i++) {
		int l, r; scanf("%d%d", &l, &r);
		printf("%d\n", s[r][r] - s[l-1][r] - s[r][l-1] + s[l-1][l-1]);
	}
	
	return 0;
}

Measured memory_bytes: 2816
import heapq
WHITE = 0
GRAY = 1
BLACK = 2
INFTY = 10**16
def dijkstra(s, VC):
    color = [WHITE for i in range(N+1)]
    d = [INFTY for i in range(N+1)]
    d[s] = 0
    pq = []
    heapq.heappush(pq, (0, s))

    while len(pq) != 0:
        u = heapq.heappop(pq)[1]
        color[u] = BLACK

        for v, c in VC[u]:
            if color[v] != BLACK:
                if d[u] + c < d[v]:
                    d[v] = d[u] + c
                    color[v] = GRAY
                    heapq.heappush(pq, (d[v], v))

    return d

N = int(input())
V = [[] for i in range(N+1)]
for i in range(N-1):
    a, b, c = map(int, input().split())
    V[a].append([b, c])
    V[b].append([a, c])
Q, K = map(int, input().split())
d = dijkstra(K, V)
for i in range(Q):
    x, y = map(int, input().split())
    print(d[x] + d[y])


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

#define MOD ((int)(1e9 + 7))

typedef long long ll;

using namespace std;

int N, M;
vector<pair<int, int>> d;

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

int combination(int n, int r) {
	int delta[100];

	for (int i = 0; i < r; i++) {
		delta[i] = n - i;
	}
	for (int i = 2; i <= r; i++) {
		int j = i, k = 0;
		while (k < r && j > 1) {
			int g = gcd(delta[k], j);
			delta[k] /= g;
			j /= g;
			k++;
		}
	};

	ll res = 1;

	for (int i = 0; i < r; i++) {
		res = (res*delta[i]) % MOD;
	}

	return res;
}

int main() {

	cin >> N >> M;

	d.push_back(make_pair(1, 1));
	int num = M;
	for (int i = 2; i*i <= num; i++) {
		while (num % i == 0) {
			if (d.back().first != i) {
				d.push_back(make_pair(i, 1));
			}
			else {
				d.back().second++;
			}
			num /= i;
		}
	}
	if (num != 1) d.push_back(make_pair(num, 1));

	ll ans = 1;
	for (int i = 1; i < d.size(); i++) {
		ans *= combination(d[i].second + N - 1, d[i].second);
		ans %= MOD;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

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

    int n, m;
    cin >> n >> m;

    vector<P> ans;
    if(n % 2){
        for(int l = 1, r = n - 1; l < r; ++l, --r){
            ans.push_back(P(l, r));
        }
    }
    else{
        bool flag = false;
        for(int l = 1, r = n - 1; l < r; ++l, --r){
            if(!flag && r - l <= n / 2){
                --r;
                flag = true;
            }
            ans.push_back(P(l, r));
        }
    }
    
    for(int i = 0; i < m; ++i){
        cout << ans[i].first << ' ' << ans[i].second << '\n';
    }
}

Measured memory_bytes: 4140
#include <iostream>
#include <algorithm>

#define int long long
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)

using namespace std;

int N;
int A[100001];
int B[100001];
int C[100001];

int bb[100001];

signed main()
{
    cin >> N;
    REP(i, N) cin >> A[i];
    REP(i, N) cin >> B[i];
    REP(i, N) cin >> C[i];

    sort(A, A+N);
    sort(B, B+N);
    sort(C, C+N);

    for (int i = N-1; i >= 0; --i)
    {
        int b = B[i];
        int* cpos = upper_bound(C, C+N, b);
        bb[i] = (C + N - cpos);
        if (i != N-1) bb[i] += bb[i+1];
    }

    int ans = 0;
    REP(i, N)
    {
        int a = A[i];
        int* bpos = upper_bound(B, B+N, a);
        ans += bb[bpos - B];
    }

    cout << ans << endl;

    return 0;
}

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

struct Point {
    int x, y;

    Point() = default;
    Point(int x, int y) : x(x), y(y) {}

    Point operator+(const Point &rhs) const {
        return Point(x + rhs.x, y + rhs.y);
    }

    Point operator-(const Point &rhs) const {
        return Point(x - rhs.x, y - rhs.y);
    }

    long long operator*(const Point &rhs) const {
        return 1ll * x * rhs.x + 1ll * y * rhs.y;
    }

    long long operator%(const Point &rhs) const {
        return 1ll * x * rhs.y - 1ll * y * rhs.x;
    }

    bool operator<(const Point &rhs) const {
        return x == rhs.x ? y < rhs.y : x < rhs.x;
    }
};

vector<Point> convex(vector<Point> p) {
    sort(p.begin(), p.end());
    vector<Point> ch;
    int n = (int)p.size();
    for (int i = 0; i < n; ++i) {
        while (ch.size() >= 2 && (p[i] - ch[ch.size() - 2]) % (ch[ch.size() - 1] - ch[ch.size() - 2]) > 0) ch.pop_back();
        ch.push_back(p[i]);
    }
    int t = ch.size();
    for (int i = n - 2; i >= 0; --i) {
        while (ch.size() > t && (p[i] - ch[ch.size() - 2]) % (ch[ch.size() - 1] - ch[ch.size() - 2]) > 0) ch.pop_back();
        ch.push_back(p[i]);
    }
    ch.pop_back();
    // ch is of clock-wise order.
    return ch;
}

int main() {
    int n; scanf("%d", &n);
    vector<Point> p(n);
    for (int i = 0; i < n; ++i) scanf("%d%d", &p[i].x, &p[i].y);
    vector<Point> ch = convex(p);
    // reverse(ch.begin(), ch.end());
    int s = min_element(ch.begin(), ch.end(), [](Point a, Point b) { return a.y == b.y ? a.x < b.x : a.y < b.y; }) - ch.begin();
    printf("%d\n", (int)ch.size());
    for (int i = s; i < (int)ch.size(); ++i) printf("%d %d\n", ch[i].x, ch[i].y);
    for (int i = 0; i < s; ++i) printf("%d %d\n", ch[i].x, ch[i].y);

}



Measured memory_bytes: 5156
#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

const int MAXN = 1000000;
Int fact[MAXN], inv[MAXN];

Int mod_pow(Int x, Int n) {
    Int res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % MOD; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % MOD;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}

void init_fact() {
    fact[0] = 1;
    for(int i=1; i<MAXN; i++) {
        fact[i] = (fact[i-1] * i) % MOD;
    }

    inv[MAXN - 1] = mod_pow(fact[MAXN - 1], MOD-2);
    for(int i=MAXN - 2; i>=0; i--) {
        inv[i] = (inv[i+1] * (i+1)) % MOD;
    }
}

Int comb(int n, int r) {
    if(r < 0 || n < r) return 0;
    return fact[n] * inv[n-r] % MOD * inv[r] % MOD;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}


int main(){
    cin.tie(0);
    Int a, b, x; cin >> a >> b >> x;
    Int ans = (x%MOD);
    if (a <= x){
        ans += ((((x-a)/(a-b)+1)%MOD) * (b%MOD))%MOD;
        ans %= MOD;
    }
    cout << ans << endl;

}



Measured memory_bytes: 3076
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

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

typedef pair<int, int> pint;
typedef long long ll;

signed main()
{
    int N, M;
    cin >> N >> M;
    int max_n;
    if (100000 > M / N)
    {
        max_n = 100000;
    }
    else
    {
        max_n = M / N;
    }
    int ans = 1;
    for (int i = max_n; i >= 1; i--)
    {
        if (M % i == 0 && i * N <= M)
        {
            ans = i;
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

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

    int N, K;
    cin >> N >> K;

    double ans = 0;
    int n_right = N;
    int i = 0;
    for (int num = K; n_right > 0; num = (num + 1) / 2, ++i) {
        if (n_right - num < 0) continue;
        ans += (n_right - num + 1) * pow(0.5, i);
        n_right = num - 1;
    }

    cout << setprecision(10) <<ans / N << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ft first
#define sd second
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,p=0,m=0,z=0,ans=0;
    cin>>n;
    vector<int> a(n);
    for(auto& i:a){
        cin>>i;
        if(i>0){
            ++p;
            ans+=i;
        }
        if(i==0) ++z;
        if(i<0){
            ++m;
            ans-=i;
        }
    }
    sort(a.begin(),a.end());
    if(z){
        if(p==0&&m==0){
            cout<<0<<endl;
            fr(i,n-1) cout<<0<<" "<<0<<endl;
            return 0;
        }
        if(p){
            cout<<ans<<endl;
            int i=0,c=a[n-1],d=0;
            while(a[i+1]<=0){
                cout<<c<<" "<<a[i]<<endl;
                c-=a[i];
                ++i;
            }
            ++i;
            while(i<n-1){
                cout<<d<<" "<<a[i]<<endl;
                d-=a[i];
                ++i;
            }
            cout<<c<<" "<<d<<endl;
        }
        else{
            cout<<ans<<endl;
            int i=0,c=a[n-1];
            while(i<n-1){
                cout<<c<<" "<<a[i]<<endl;
                c-=a[i];
                ++i;
            }
            return 0;
        }
    }
    else{
        if(p==0){
            ans+=2*a[n-1];
            cout<<ans<<endl;
            int i=0,c=a[n-1];
            while(i<n-1){
                cout<<c<<" "<<a[i]<<endl;
                c-=a[i];
                ++i;
            }
            return 0;
        }
        if(m==0){
            ans-=2*a[0];
            cout<<ans<<endl;
            int i=1,c=a[0];
            while(i<n-1){
                cout<<c<<" "<<a[i]<<endl;
                c-=a[i];
                ++i;
            }
            cout<<a[n-1]<<" "<<c<<endl;
            return 0;
        }
        cout<<ans<<endl;
        int i=1,c=a[0],d=a[n-1];
        while(a[i]<0){
            cout<<d<<" "<<a[i]<<endl;
            d-=a[i];
            ++i;
        }
        while(i<n-1){
            cout<<c<<" "<<a[i]<<endl;
            c-=a[i];
            ++i;
        }
        cout<<d<<" "<<c<<endl;
    }
}

Measured memory_bytes: 2304
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        new Main();
    }

    public Main() {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int K = Integer.parseInt(sc.next());
        if (K >= N) {
            System.out.println(0);
            return;
        }
        Integer[] H = new Integer[N];
        for (int i = 0; i < N; i++) {
            Integer hi = Integer.parseInt(sc.next());
            H[i] = hi;
        }
        Arrays.sort(H, Collections.reverseOrder());
        long sum = 0;
        for (int i = K; i < N; i++) {
            Integer hi = H[i];
            sum += hi;
        }
        System.out.println(sum);
    }
}


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

def cnt_factor(n):
    cnt = 0
    for b in range(1, n + 1):
        if n % b == 0:
            cnt += 1
    return cnt

cnt_list = []
for i in range(1, N + 1, 2):
    cnt_list.append(cnt_factor(i))

print(cnt_list.count(8))

Measured memory_bytes: 2940
import numpy as np
N = int(input())

divisor_lst = []
i = 1
while i+2 <= N//i:
    if N % i == 0:
        divisor_lst.append(N//i)
    i += 1    

arr = np.array(divisor_lst)
arr -= 1
print(int(np.sum(arr)))



Measured memory_bytes: 12424
#!/usr/bin/env python3
N = int(input())

def solve():
    for h in range(1, 3501):
        for w in range(h, 3501):
            a = N * h * w
            b = 4 * h * w - N * h - N * w
            if b < 1:
                continue
            n = a / b
            if n == int(n):
                print(h, int(n), w)
                return

solve()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ld PI=abs(acos(-1));
int a,b,c,d;

int main(){
	cin >> a >> b >> c >> d;
	
	REP(i,0,d-b) cout << 'U';
	REP(i,0,c-a) cout << 'R';
	REP(i,0,d-b) cout << 'D';
	REP(i,0,c-a) cout << 'L';
	cout << 'L';
	REP(i,0,d-b+1) cout << 'U';
	REP(i,0,c-a+1) cout << 'R';
	cout << 'D' << 'R';
	REP(i,0,d-b+1) cout << 'D';
	REP(i,0,c-a+1) cout << 'L';
	cout << 'U';
	
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;
LL p = 1000000007ll;

int main(void)
{
  LL a,p;
  cin >> a >> p;
  cout << (a*3+p)/2 << endl;
  return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

pub fn gcd(a: u64, b: u64) -> u64 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}

fn main() {
    input! {
        n: usize,
        lx: i64,
        xx: [i64;n]
    }
    let xx: Vec<u64> = xx.into_iter()
                         .map(|x| (x-lx).abs() as u64).collect();
    let res = xx.iter().skip(1).fold(xx[0], |a,x| gcd(a,*x));
    println!("{}", res);
}


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

int N;

int H[21];

int cnt;

int ans=1;

int main()
{
    cin >> N;

    rep(i,N)cin >> H[i];

    for(int i=N-1;i>=1;i--)
    {
        for(int j=i-1;j>=0;j--)
        {
            if(H[i]<H[j])
            {
                cnt++;
            }
        }

        if(cnt==0)ans++;

        cnt=0;
    }

    cout << ans << endl;


    return 0;
}

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

#define zton(i,n) for(int i=0;i<=n;i++)
#define oneton(i,n) for(int i=1;i<=n;i++)
#define fo(i,n) for(int i=0;i<n;i++)
#define fab(i,a,b) for(int i=a;i<b;i++)
#define loop(i,b,a) for(int i=a;i>=b;i--)
#define dsort(arr,n) sort(arr, arr + n, greater<int>())
#define vsortd(a) sort(a.begin(), a.end(), greater<double>())
#define vsort(a) sort(a.begin(), a.end())
#define ll long long int
#define test int tc;cin>>tc;while(tc--)
#define dbg(x) cout<<#x<<'='<<(x)<<endl;
#define dbg2(x,y) cout<<#x<<'='<<(x)<<endl<<#y<<'='<<(y)<<endl;
#define dbg3(x,y,z) cout<<#x<<'='<<(x)<<endl<<#y<<'='<<(y)<<endl<<#z<<"="<<(z)<<endl;
#define dbg4(x,y,z,w) cout<<#x<<'='<<(x)<<endl<<#y<<'='<<(y)<<endl<<#z<<"="<<(z)<<endl<<#w<<"="<<(w);
#define minheap priority_queue <int, vector<int>, greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define ff first
#define ss second
#define mpr make_pair
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define mkv vector<int>
#define allzero(dp) memset(dp,0,sizeof(dp))
#define endl "\n"
#define print(x) cout<<x<<endl;

const int mod=1e9+7;
using namespace std;
bool sortcol( const vector<int>& v1,const vector<int>& v2 ) {return v1[1] < v2[1];}

void fastio()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}

bool sortbysecdesc(const pair<ll,ll> &a,const pair<ll,ll> &b){
    if(a.first>b.first)return true;
    if(a.first==b.first)return a.second<b.second;
    return false;
}

ll power(ll x, ll y){
    ll res = 1;x=x%mod;
    while(y>0){
        if(y&1)res=(res*x)%mod;
        y=y>>1;x=(x*x)%mod;}
    return res;
}


void solve()
{
    int l,r,d;cin>>l>>r>>d;
    int cnt=0;
    for(int i=l;i<=r;i++)
    {
        if(i%d==0)cnt++;
    }
    print(cnt)
}

int main()
{
   // fastio();
  //  test
    solve();
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};

const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};

vector< vector<int> > Graph;
vector< int > value;





int main(int argc, const char * argv[]) {
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    
    int n,y; cin >> n >> y;
    
    bool isCan = false;
    
    int yukichi,higuchi,noguchi;
    
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= n-i; j++){
            if(10000*i + 5000*j + 1000*(n-i-j) == y) {
                isCan = true;
                yukichi = i;
                higuchi = j;
                noguchi = n-i-j;
                break;
            }
        }
        if(isCan) break;
    }
    if(isCan) cout << yukichi << " " << higuchi << " " << noguchi << endl;
    else cout << "-1 -1 -1" << endl;
    
    
    
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<iomanip>

#define ll long long

using namespace std;

int main(void) {
	int N, A, B;
	cin >> N >> A >> B;
	cout << min(N * A, B) << endl;
	system("pause");
	return 0;
}

Measured memory_bytes: 888
function Main(arg) {
 
    var N = arg.split("\n")[0]-0;
    var S = arg.split("\n")[1].split(" ")[0];
    var T = arg.split("\n")[1].split(" ")[1];

    var ans = "";
    for (var i = 0; i < N; i++){
        ans += S[i] + T[i];
    }
    console.log(ans);

    return;
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
#include<stdio.h>
#include<string.h>
using namespace std;
#define ll long long
#define pb push_back
#define f(i,p,q) for(int i=p;i<q;i++)
#define vi vector<long long>v;
#define tc int t; cin>>t; while(t--)
//#define an long long n; cin>>n; long long a[n]; for(int i=0;i<n;i++) cin>>a[i];
int main()
{	
	//freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    long long n,i,j,a[5],size; string s; bool flag;
    tc{
    	cout<<"ACL";
    }
    
}


Measured memory_bytes: 3636
import java.io.*;
import java.util.ArrayList;
//password:53VHEnd4
public class Main{
  public static void main(String args[]){
    String str;
    try{
      BufferedReader br=new BufferedReader(new InputStreamReader(System.in,"UTF-8"));
      str=br.readLine();
      int length=Integer.parseInt(str);
            str=br.readLine();
      String[] arraystr = str.split(" ");
      int[] num=new int[length];
      for(int i=0;i<length;i++){
        num[i]=Integer.parseInt(arraystr[i]);
      }
      int ans=check(num);
      if(ans==0){
        System.out.println("NO");
      }else{
      System.out.println("YES");
    }
    }catch(IOException e){
      e.printStackTrace();
    }
  }
public static int check(int[] num){
  int p=0;
  for(int i=1;i<num.length;i++){
    if(num[i-1]!=i){
      p+=1;
    }
  }
  if(p>2){
    return 0;
  }else{
  return 1;
}
}


}


Measured memory_bytes: 22612
#include<iostream>
using namespace std;
int main() {
	int x, y;
	cin >> x >> y;
	int a[13] = { 0,1,3,1,2,1,2,1,1,2,1,2,1};
	if (a[x] == a[y])cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second	
#define db 0
#define EPS (1e-7)    //0.0000001 the value
#define PI (acos(-1))
#define MAXN (300006)
#define ll long long int 
#define ld long double
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for(ll ii = ss; ii < ee; ++ii)
#define space " "
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ((ll)x.size())
#define ph push
#define emp emplace
#define btinpct(x) __builtin_popcountll(x)
#define p2(x) (1LL<<(x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
ll n; ll half;
char A[40];
map<string,ll>mp;
bool palin(string x) {
	string xx=x;
	reverse(all(xx));
	return x==xx;
}
void backdp(ll pos, ll bm) {
	if(pos==n){
		string red="";
		string blue="";
		string put="";
		FOR(i,half,n){
			if(bm&(1ll<<i))red+=A[i];
			else blue+=A[i];
		}
		reverse(all(red));
		reverse(all(blue));
		mp[red+' '+blue]++;
		return;
	}
	backdp(pos+1,bm);
	backdp(pos+1,bm|(1ll<<pos));
	return;
}
ll ans;
int main()
{
	FAST
	cin>>n;n*=2;
	FOR(i,0,n)cin>>A[i];
	half=n/2;
	// first half until < half, second half until rest
	backdp(half,0);
	FOR(bm,0,(1ll<<half)){
		string red="";
		string blue="";
		string put="";
		FOR(i,0,half){
			if(bm&(1ll<<i))red+=A[i];
			else blue+=A[i];
		}
		ans+=mp[red+' '+blue];
	}
	cout<<ans;
}


Measured memory_bytes: 68992
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
N, Y = MAP()

for i in range(N+1):
	for j in range(N+1-i):
		x = i
		y = j
		z = (Y - 10000*x - 5000*y)//1000

		if x+y+z == N:
			print(x, y, z)
			exit()

print(-1, -1, -1)


Measured memory_bytes: 15300
from collections import Counter
import copy

N = int(input())
D = list(map(int, input().split()))
if N == 1:
    print(min(D[0], 24-D[0]))
    exit()

D.append(0)
D.append(24)

c = Counter(D)

times = []
p = []
for num, cnt in c.items():
    if (num == 0 or num == 12) and cnt >= 2:
        # D==24-D になるかつ時差０の組がいるので時差の最小は０で確定
        print(0)
        exit()
    elif cnt >= 3:
        # 時差０の組み合わせがある
        print(0)
        exit()
    elif cnt == 2:
        # Dと24-Dに一人ずつ
        times.append(num)
        times.append(24-num)
    elif cnt == 1:
        # D or 24-D のどちらか一方に一人だけいる状態なので別枠で確保
        p.append((num, 24-num))

num_b = len(p)
ans = 0
# D or 24-Dの可能性があるものについて全パターン試すために、2進表記を利用
for b in range(2**num_b):
    b = bin(b)[2:].zfill(num_b)
    time = copy.deepcopy(times)
    for i in range(num_b):
        if b[i] == "0":
            time.append(p[i][0])
        else:
            time.append(p[i][1])
    tmp = 24
    for i in range(len(time)):
        for j in range(i+1, len(time)):
            tmp = min(tmp, abs(time[i] - time[j]))

    ans = max(ans, tmp)

print(ans)

Measured memory_bytes: 3572
import math

a, b, x = map(int, input().split())
S = x/a

if S > a*b/2:
	P = 2*b - 2*S/a
	theta = math.degrees(math.atan(P/a))
else:
	P = 2*S / b
	theta = math.degrees(math.atan(b/P))

print(theta)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

double dif(double x, double y, double z, double w){
    return sqrt((x-z) * (x-z) + (y-w) * (y-w));
}

int main(){
    int N;
    cin >> N;
    vector<double> x(N), y(N);
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> y[i];
    }
    double s, S, a, b, c, r, X, Y;
    bool check;
    double ans = 100000000000000.0;

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if(i == j) continue;
            check = true;
            X = (x[i] + x[j]) / 2.0;
            Y = (y[i] + y[j]) / 2.0;
            r = dif(x[i], y[i], x[j], y[j]) / 2.0;
            for (int k = 0; k < N; k++) {
                if(k == i) continue;
                if(k == j) continue;
                if(dif(x[k], y[k], X, Y) <= r){
                    continue;
                }
                check = false;
                break;
            }
            if(check){
                ans = min(ans, r);
            }
        }
    }

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if(i == j) continue;
            for (int k = 0; k < N; k++) {
                if(i == k) continue;
                if(j == k) continue;
                a = dif(x[i], y[i], x[j], y[j]);
                b = dif(x[i], y[i], x[k], y[k]);
                c = dif(x[k], y[k], x[j], y[j]);
                s = (a+b+c) / 2.0;
                S = sqrt(s*(s-a)*(s-b)*(s-c));
                r = a*b*c / 4.0 / S;
                Y = x[i]*x[i] + y[i]*y[i] - x[j]*x[j] - y[j]*y[j];
                Y = Y - (x[i]-x[j])*(x[i]*x[i] + y[i]*y[i] - x[k]*x[k] - y[k]*y[k])/(x[i]-x[k]);
                Y = Y / 2.0;
                Y = Y / (y[i]-y[j] - (x[i]-x[j])*(y[i]-y[k])/(x[i]-x[k]));
                X = x[i]*x[i] + y[i]*y[i] - x[j]*x[j] - y[j]*y[j];
                X = X - 2.0 * (y[i] - y[j]) * Y;
                X = X / 2.0 / (x[i] - x[j]);
                check = true;
                for (int l = 0; l < N; l++) {
                    if(l == i) continue;
                    if(l == j) continue;
                    if(l == k) continue;
                    if(dif(x[l], y[l], X, Y) <= r) continue;
                    check = false;
                    break;

                }
                if(check){
                    ans = min(ans, r);
                }
            }
        }
    }

    printf("%32.18f\n", ans);


}

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

#define ll long long
const int mod=1000000007;

int n;
int a[100010],fac[100010],ifac[100010],f[100010],used[100010];

int fpow(int i,int j)
{int ret=1;
 for(;j;i=(ll)i*i%mod,j/=2)
 	if(j&1) ret=(ll)ret*i%mod;
 return ret;
}

int comb(int N,int M)
{if(N<M) return 0;
 return (ll)fac[N]*ifac[M]%mod*ifac[N-M]%mod;
}

int main()
{int i,j,k,p;
 
 scanf("%d",&n);
 fac[0]=1;
 for(i=1;i<=n+1;i++) fac[i]=(ll)fac[i-1]*i%mod;
 ifac[n+1]=fpow(fac[n+1],mod-2);
 for(i=n;i>=0;i--) ifac[i]=(ll)ifac[i+1]*(i+1)%mod;
 
 for(i=1;i<=n+1;i++)
 	scanf("%d",&a[i]);
 for(i=1;i<=n+1;i++)
 	if(used[a[i]])
 	{	k=used[a[i]];
 		p=i;
 		break;
 	}
 	else
 		used[a[i]]=i;
 for(i=1;i<=n+1;i++)
 {	f[i]=comb(n+1,i);
 	f[i]=(f[i]+mod-comb(k-1+n+1-p,i-1))%mod;
 	printf("%d\n",f[i]);
 }
 return 0;
}

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

using namespace std;

bool cmp(int a,int b){
    return a>b;
}

int main()
{
    int n,k;
    cin >> n >> k;
    int a[200005];
    memset(a,0,sizeof(a));
    int m;
    for(int i=0;i<n;i++){
        cin >> m;
        a[m]++;
    }
    int s=0;
    for(int i=1;i<=n;i++){
        if(a[i]!=0){
            s++;
        }
    }
    int sum=0;
    if(s<=k) cout <<"0";
    else{
        sort(a,a+200005,cmp);
        for(int i=s;i>=k;i--){
            sum = sum + a[i];
        }
        cout <<sum;
    }
    return 0;
}


Measured memory_bytes: 1024
/*
ID: seekho
PROG: friday
LANG: C++14                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

//find_by_order gives kth-largest element
//order_of_key gives the number of items in the set that are strictly smaller!!

// OT.find_by_order(k-1)
// 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define db4(x, y, z, w) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << "," << #w << "=" << w << endl
#define ll long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define X first
#define Y second
#define sz(x) (int)((x).size())
#define pii pair<int,int>
#define MOD (ll)(998244353)
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
typedef vector<int> vi;
#define inf (ll)(1e18)
#define double long double
#define int long long

// #define N 50005


int32_t main() {

    ios::sync_with_stdio(false);
    cin.tie(0); 
    cout.tie(0);

    cout.precision(10);
    cout << fixed;

    vector<int> v(3);
    rep(i,3) cin >> v[i];

    sort(all(v));

    cout << (v[0]*v[1])/2 << "\n";
}

Measured memory_bytes: 256
N = int(input())
A = [0 for i in range(N)]
B = [0 for i in range(N)]
sums = [0 for i in range(N)]
sum_dic = {}
for i in range(N):
    A[i], B[i] = map(int, input().split())
    sums[i] = A[i] + B[i]
    if sums[i] in sum_dic.keys():
        sum_dic[sums[i]].append(i)
    else:
        sum_dic[sums[i]] = [i]
    
sums.sort(reverse=True)
ans = 0
for i in range(len(sums)):
    if i % 2 == 0:
        ans += A[sum_dic[sums[i]].pop()]
    else:
        ans -= B[sum_dic[sums[i]].pop()]

#print(diff)
#print(a_dic)
#print(b_dic)
print(ans)

Measured memory_bytes: 34076
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<stack>
using namespace std;



int main() {
	int n;
	cin >> n;
	int ans = 1;
	
	while (ans*2 <= n) {
		ans *= 2;
	}

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




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true; }return false; }
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true; }return false; }
const int INF = 1e18;

const int MOD = 1e9+7;
// const int MOD = 998244353;
const int MAX = 1000001;
int fac[MAX],finv[MAX],inv[MAX];

void COMinit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}

int COM(int n,int k){
    if(n<k)return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

int powMOD(int n,int r){
    if(r==0)return 1;
    if(r%2==0)return powMOD(n,r/2)*powMOD(n,r/2)%MOD;
    if(r%2==1)return powMOD(n,r-1)*n%MOD;
}

void add(int &x, int y){
    x += y;
    x %= MOD;
    return;
}

void sub(int &x, int y){
    x -= y;
    x %= MOD;
    if(x < 0) x += MOD;
    return;
}

void mul(int &x, int y){
    x *= y;
    x %= MOD;
    return;
}

int modinv(int x){
    return powMOD(x,MOD-2);
}

signed main(){
    COMinit();
    int n, a, b, c; cin >> n >> a >> b >> c;
    int ans = 0;
    for(int i = n; i< 2*n ; i++){
        int x= COM(i-1,n-1) * 100 % MOD * (powMOD(a,n)*powMOD(b,i-n)%MOD + powMOD(b,n)*powMOD(a,i-n)%MOD) % MOD * i %MOD;
        int y = modinv(powMOD(100-c,i+1));
        add(ans, x*y%MOD);
    }
    cout << ans << endl;
}

Measured memory_bytes: 23680
#include <stdio.h>

int main(void){
  int n,i,count=0;
  int a[50];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    if (a[i] != i+1){
      count +=1;
    }
  }
  if (count == 0 || count == 2){
    printf("YES");
  }
  else {
    printf("NO");
  }
  return 0;
}


Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int a, b;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> a >> b;
	int ans;
	for (int i = 1; 1; i++) {
		if ((i * 2) / 25 == a && i / 10 == b) {
			ans = i;
			break;
		}
		if (i > 5000) {
			ans = -1;
			break;
		}
	}
	cout << ans << E;
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}
Main();
function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//standard output
function myerr(t){console.error(t);}//standard error
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す
//1:数値へ変換 2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字に分割 7:1文字に分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main() {
  var one = myconv(next(),4);
  var H = one[0];
  var W = one[1];
  var list = new Array(H);
  for(var i = 0; i < H; i++){
    list[i] = myconv(next(),6);
  }
  var count = 0;
  for(var i = 0; i < H; i++){
    for(var j = 0; j < W; j++){
      if(list[i][j] == "#"){
         count++;
      }
    }
  }
  if(count == H + W - 1){
     myout("Possible");
  }else{
     myout("Impossible");
  }
}

Measured memory_bytes: 7372
/*
No matter how long a night, dawn will always break.

Simular saying ... The darkest hour is just before the dawn.
 ***************************************   ************************8   **********************************
*/
#include <bits/stdc++.h>
using namespace std;

 
#define int         long long
#define double      long double
#define pb          push_back
#define pf          push_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define sz(x)	    (int)(x).size()
#define fo(i,l,u)   for(i=l;i<u;i++)
#define rfo(i,l,u)  for(i=l;i>=u;i--)
#define allfo(s)    for(auto it=(s).begin();it!=(s).end();it++)
#define _init(b)     memset(b,-1,sizeof(b))
#define _init0(b)     memset(b,0,sizeof(b))
#define MOD         1000000007
#define hell        998244353
#define output(x) cout << (x ? "YES" : "NO")<<endl;
 
 
 
 
 
int gcd(int a, int b) {if(a>b)swap(a,b) ;  if (a == 0)  return b; return gcd(b % a, a); }  
bool mod(double a,double b) {return a/b - floor(a/b);}
 

 int a,b,c,d;
 map<int,int> mp;

 int f(int n){
 	if(n<0)return 1e17;
 	if(n==1){
 		return d;
 	}
 	if(n==0){return 0;
 	}
 	if(n==2){
 		return min(2*d,a+d);
 	}
 	if(mp[n]!=0)return mp[n];
 	int ans=n*d,x,y,z;
 	x=(n/2)*2;
 	if(n*d<0)ans=1e18;
 	y=abs(x-n)*d+a+f(n/2);
 	ans=min(ans,y);
 	//cout<<x<<" "<<y<<" "<<n<<" "<<ans<<endl;
 	
 	x+=2;
 	z=(n/2)+1;
 	y=abs(x-n)*d+a+f(z);
 	ans=min(ans,y);

 	
 	x=(n/3)*3;
 	y=abs(x-n)*d+b+f(n/3);
 	ans=min(ans,y);
 	x+=3;
 	y=abs(x-n)*d+b+f(n/3+1);
 	ans=min(ans,y);
 	x=(n/5)*5;
 	y=abs(x-n)*d+c+f(n/5);
 	ans=min(ans,y);
 	x+=5;
 	y=abs(x-n)*d+c+f(n/5+1);
 	ans=min(ans,y);
 	mp[n]=ans;
 	
 //	cout<<n<<" "<<ans<<endl;
 	return ans;

 }



 
signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int i,j,x,t;
   cin>>t;
   while(t--){
   	int n;
   	cin>>n>>a>>b>>c>>d;
   //	cout<<n<<a<<b<<c<<d<<endl;
   	cout<<f(n)<<endl;
   	mp.clear();
   }
   
   
   
   
   
    return 0;
}

Measured memory_bytes: 4764
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include <cctype>
using namespace std;

int main() {
	int n, m, c;
	cin >> n >> m >> c;
	vector<int> b(m);
	for(int i =0;i<m;++i) {
		cin >> b[i];
	}
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		int sum = 0;
		for (int j = 0; j < m; ++j) {
			int a;
			cin >> a;
			sum += a * b[j];
		}
		if (sum + c > 0) {
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)
#define setp(X,Y) cout<<fixed<<setprecision(Y)<<X;
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

signed main(){
	int R;
	cin>>R;
	cout<<3*R*R<<endl;
	return 0;
}


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



int main() {
    int n;
    cin >> n;
    
    vector<int> ans(n+1);
    rep(i,n) {
        int a;
        cin >> a;
        
        ans[a] = i+1;
    }
    
    for(int i = 1; i < n; i++)
        cout << ans[i] << " ";
    
    cout << ans[n] << endl;
    
    
    
    return 0;
}




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

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> A(N);

	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	sort(A.begin(), A.end());

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

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

int solve(string str){
    int num[10];
    for(int i = 0;i < 10;i++)
	num[i] = str[i] - '0';
    for(int i = 8;i >= 0;i--){
	for(int j = 0;j <= i;j++){
	    num[j] += num[j + 1];
	    num[j] %= 10;
	}
    }
    return num[0];
}

int main(){
    string str;
    while(cin >> str){
	cout << solve(str) << endl;
    }
    return 0;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
int main(void)
{
    double R;
    cin >> R;
    cout << 2 * 3.14 * R << endl;
    return 0;
}

Measured memory_bytes: 3784
#include<cstdio>

const int MAXN=2e5+5;
long long a[MAXN];

int main(){
	long long n;
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	long long k=1,ans=0;
//	printf("%d",a[k]);
	for(int i=1;i<=n;i++){
		long long t;
		t=a[i]-a[k];
		if(t<=0)
			ans+=a[k]-a[i];
		else k=i;
//		printf(" %d",a[k]);
	}
//	puts("");
	printf("%lld",ans);
}

Measured memory_bytes: 4732
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
    int n,t=0;
    scanf("%d",&n);
    int x=n;
    while(x) {
        t++;
        x/=10;
    }
    if(t==1) printf("%d\n",n);
    else if(t==2) printf("%d\n",9);
    else if(t==3) printf("%d\n",10+(n/100%10-1)*100+n%100);
    else if(t==4) printf("%d\n",909);
    else if(t==5) printf("%d\n",910+(n/10000%10-1)*10000+n%10000);
    else printf("%d\n",90909);
    return 0;
}

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

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

using namespace std;

int main() {

    int N, M; cin >> N >> M;

    priority_queue<int, vector<int>> que;

    long int A[N]; rep(i,N) { cin >> A[i]; que.push(A[i]);}

    rep(i,M) {
        que.push(que.top()/2);
        que.pop();
    }

    long int sum=0;
    while(!que.empty()) {
        sum += que.top();
        que.pop();
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 1528