akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

ll max_diff(ll a, ll b, ll c, ll d) {
    if (a < 1 || b < 1 || c < 1 || d < 1)
        return INF;
    ll maxi = max({a, b, c, d});
    ll mini = min({a, b, c, d});
    return maxi - mini;
}

int main() {
    int n;
    cin >> n;
    vl a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    vl suma(n + 1, 0);
    ;
    for (int i = 0; i < n; ++i) {
        suma[i + 1] += suma[i] + a[i];
    }
    ll ret = INF;
    for (int i = 1; i < n; ++i) {
        auto bit = lower_bound(suma.begin(), suma.end(), (suma[i] + 1) / 2);
        auto dit = lower_bound(suma.begin(), suma.end(), suma[i] + (suma[n] - suma[i] + 1) / 2);
        for (auto &b : {bit, prev(bit), next(bit)}) {
            for (auto &d : {dit, prev(dit), next(dit)}) {
                chmin(ret, max_diff(*b, suma[i] - *b, *d - suma[i], suma[n] - *d));
            }
        }
    }
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
#define SortAsc(c) std::sort(c.begin(), c.end())
#define SortDesc(c) std::sort(c.rbegin(), c.rend())
int dx[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int dy[8] = {1, 0, -1, 0, 1, -1, 1, -1};

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 res = 0;
  for (int i = 0; i < n; i++) {
    int sum = c;

    for (int j = 0; j < m; j++) {
      int a;
      cin >> a;
      sum += a * b[j];
    }

    if (sum > 0) {
      res++;
    }
  }

  cout << res << endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int ma[4][100000];
int main(void){
	int n,a[1000010]={0},i,sum=0;
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>a[i];
      //cout<<sum<<endl;
		sum+=abs(a[i-1]-a[i]);
	}
  
	sum+=abs(0-a[i-1]);
	for(i=1;i<=n;i++){
		cout<<sum-abs(a[i-1]-a[i])-abs(a[i]-a[i+1])+abs(a[i-1]-a[i+1])<<endl;
	}
	return 0;
}

Measured memory_bytes: 5120
n, q = map(int, input().split())
s = input()

dp = [0 for column in range(n)]

for j in range(1, n):
    if s[j-1] == 'A' and s[j] == 'C':
        dp[j] = dp[j-1] + 1
    else:
        dp[j] = dp[j-1]

for _ in range(q):
    i, j =  map(int, input().split())
    print(dp[j-1] - dp[i-1])


Measured memory_bytes: 6180
A,B,Q=map(int,input().split())
S=[-int(1e10)]+[int(input()) for _ in range(A)]+[int(2e10)]
T=[-int(1e10)]+[int(input()) for _ in range(B)]+[int(2e10)]
for _ in range(Q):
    x=int(input())
    seq=False
    teq=False
    su=A+1
    sl=0
    while su-sl>1:
        t=(su+sl)//2
        if S[t]==x:
            seq=True
            break
        if S[t]>x: su=t
        else: sl=t
    tu=B+1
    tl=0
    while tu-tl>1:
        t=(tu+tl)//2
        if T[t]==x:
            teq=True
            break
        if T[t]>x: tu=t
        else: tl=t
    
    if seq and teq:
        print(0)
    elif seq:
        print(min(x-T[tl],T[tu]-x))
    elif teq:
        print(min(x-S[sl],S[su]-x))
    else:
        SU=S[su]-x
        TU=T[tu]-x
        SL=x-S[sl]
        TL=x-T[tl]
        print(min([max(SU,TU), max(SL,TL), SU*2+TL, TL*2+SU, TU*2+SL, SL*2+TU]))

Measured memory_bytes: 74724
#include<stdio.h>
#include<string.h>
void i_sort(char a[],int b){
    int i,j,temp;
    for(i=1;i<b;i++){
        for(j=i;j>0&&a[j]<a[j-1];j--){
            temp=a[j];
            a[j]=a[j-1];
            a[j-1]=temp;
        }
    }
}
void i2_sort(char a[],int b){
    int i,j,temp;
    for(i=1;i<b;i++){
        for(j=i;j>0&&a[j]>a[j-1];j--){
            temp=a[j];
            a[j]=a[j-1];
            a[j-1]=temp;
        }
    }
}
int main()
{
	int i,f=0,l,l2;
	char s[100],t[100];
	scanf("%s\n%s",s,t);
	l=strlen(s);
	l2=strlen(t);
	i_sort(s,l);
	i2_sort(t,l2);
	for(i=0;i<l&&i<l2;i++){
		if(s[i]>t[i]){ 
			f=1;
			break;
		}
		else if(s[i]==t[i]) f=2;
		else {
			f=0;
			break;
		}
	}
	if(f==2&&l2>l) f=0;
	if(f==0) printf("Yes\n");
	else printf("No\n");
	return 0;
}


Measured memory_bytes: 128
# ABC119C
# Synthetic Kadomatsu
Enter = list(map(int, input().split()))
N = Enter[0]
L = [int(input()) for _ in range(N)]

ans = 10 ** 10

# 4 bist search
for i in range(4**N):
    mask = i
    NowCost = 0
    Group = [[] * 4 for _ in range(4)]
    for j in range(N-1, -1, -1):
        Group[mask%4].append(L[j])
        mask //= 4
    if len(Group[0]) == 0 or len(Group[1]) == 0 or len(Group[2]) == 0:
        continue
    for j in range(3):
        NowCost += 10 * (len(Group[j]) - 1)
        NowCost += abs(sum(Group[j]) - Enter[j+1])
    ans = min(ans, NowCost)
print(ans)


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



typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;
typedef vector< vector< vector<ll> > > vvvint;
typedef vector<string> vstring;
typedef vector< vector<string> > vvstring;
typedef vector<char> vchar;
typedef vector< vector<char> > vvchar;
typedef vector<long double> vdouble;
typedef vector< vector<long double> > vvdouble;
typedef vector< vector< vector<long double> > > vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;
typedef vector<bool> vbool;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define ALL(obj) (obj).begin(), (obj).end()
// #define LLONG_MAX 9223372036854775806
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())
#define MOD 1000000007
// #define MOD 998244353
// #define MOD LLONG_MAX
const double PI=3.14159265358979323846;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }




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



void printv(vint &v){
  for(auto e:v) cout<<e<<" ";
  cout<<endl;
}


// 繰り返し二乗法
ll power(ll a, ll b){
  if(a==1)return a;
  // if(a==0)re
  ll res=1;
  while(b>0){
    if(b&1) res=res*a%MOD;
    a=a*a%MOD;
    b>>=1;
  }
  return res;
}

const int MAX=2100000;
 
ll fact[MAX], fact_inv[MAX];
 
void init_fact(ll n){
  fact[0]=1;
  // 階乗の計算
  rep(i, n) fact[i+1]=fact[i]*(i+1)%MOD;
  fact_inv[n]=power(fact[n], MOD-2);
  // 逆元の計算
  for(ll i=n-1;i>=0;i--) fact_inv[i]=fact_inv[i+1]*(i+1)%MOD;
}
 
ll comb(ll n, ll r){
  return (fact[n]*fact_inv[r])%MOD*fact_inv[n-r]%MOD;
}
 
ll perm(ll n, ll r){
  return (fact[n]*fact_inv[n-r])%MOD;
}






int main() {
  cout<<fixed<<setprecision(10);


  ll l; cin>>l;

  long double x = (long double)(l)/3.0;
  cout<<x*x*x<<endl;



}






Measured memory_bytes: 256
N, M, X = map(int, input().split(' '))
price, exp, rst = [], [ [] for i in range(N) ], -1
for i in range(N):
    ls = list(map(int, input().split(' ')))
    price.append(ls[0])
    exp[i] = ls[1:]
for i in range(1 << N):
    price_combi, exp_combi, exp_sum, cnt_ls = [], [], [0] * M, []
    for j in range(N):
        if i >> j & 1:
            price_combi.append(price[j])
            exp_combi.append(exp[j])
    for s in exp_combi:
        for t in range(M):
            exp_sum[t] += s[t]
    [ cnt_ls.append(x) for x in exp_sum if x >= X ]
    if len(cnt_ls) == M:
        if rst == -1:
            rst = sum(price_combi)
        else:
            rst = min(rst, sum(price_combi))
print(rst)

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

using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)

int main(){
    ll H,W,A,B; cin>>H>>W>>A>>B;
    rep(n,B){
        rep(m,A) cout<<1;
        rep(m,W-A) cout<<0;
        cout<<endl;
    }
    rep(n,H-B){
        rep(m,A) cout<<0;
        rep(m,W-A) cout<<1;
        cout<<endl;
    }
}

Measured memory_bytes: 1280
#include <iostream>
#include <fstream>
#include <unistd.h>
#include <sys/stat.h>
#include <stdio.h>
#include <vector>
#include <cmath>
#include <random>
#include <string.h>//文字列の代入に使う
#include <bits/stdc++.h>//piの利用で必要(M_PI)
#include <algorithm>


int main() {
  
  int N;
  
  std::cin >> N;
  std::vector<int> A(N);
  
  for(int i = 0; i < N; i++) {
    std::cin >> A.at(i);
  }

  for(int i = 0; i < N; i++) {
    if(A.at(i) % 2 == 0) {
if(A.at(i) % 3 != 0 && A.at(i) % 5 != 0) {
std::cout << "DENIED" <<std::endl;
return 0;  
}   
    }
  }
std::cout << "APPROVED" <<std::endl;

  return 0;
}

Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
ll factorial[201000];
ll invfactorial[201000];
ll factorial2[201000];
ll invfactorial2[201000];
ll extGCD(ll a, ll b, ll &x, ll &y){
	if (b == 0){
		x = 1;
		y = 0;
		return a;
	}
 
	ll d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

ll nCrM(ll n, ll r){
	ll ret = factorial[n];
	ret *= invfactorial[n - r];
	ret %= MOD;
	ret *= invfactorial[r];
	ret %= MOD; 
	return ret;
}

ll nCrM2(ll n, ll r){
	ll ret = factorial2[n];
	ret *= invfactorial[r];
	ret %= MOD;
	return ret;
}

ll modpow(ll a, ll b){
    ll res = 1;
    while(b > 0){
        if(b & 1){
            res *= a;
            res %= MOD;
        }
        a *= a;
        a %= MOD;
        b >>= 1;
    }
    return res;
}
int main(void){
    ll n, a, b;
    cin >> n >> a >> b;

    factorial[0] = 1;

    for (int i = 1; i < 201000; i++){
        factorial[i] = (factorial[i - 1] * i) % MOD;
    }
    for (int i = 0; i < 201000; i++){
        ll x, y;
        ll g = extGCD(factorial[i], MOD, x, y);
        while (x < 0) x += MOD;
        x %= MOD;
        invfactorial[i] = x;
    }
    factorial2[1] = n;
    for (int i = n - 1; i >= n - max(a, b); i--){
        factorial2[n - i + 1] = (factorial2[n - i] * i) % MOD;
        //cout << i << " " << factorial2[n - i] << endl;
    }
    //cout << endl;
    for (int i = 0; i < 201000; i++){
        ll x, y;
        ll g = extGCD(factorial2[i], MOD, x, y);
        while (x < 0) x += MOD;
        x %= MOD;
        invfactorial2[i] = x;
    }


    ll ans = modpow(2LL, n) % MOD - 1;
    ll usea = nCrM2(a, a) % MOD;
    ll useb = nCrM2(b, b) % MOD;
    ll minus = usea + useb;
    //cout << usea << " " << useb << endl;
    minus %= MOD;
    ans = ans - minus;
    if(ans < 0) ans += MOD;
    cout << ans << endl;
    

}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
int main() {
    int x, y;
    while (true) {
        cin >> x >> y;
        if (x == 0 && y == 0) break;
        else {
            if (x > y) {
                cout << y << ' ' << x << endl;
            }
            else cout << x << ' ' << y << endl;
        }
    }
}



Measured memory_bytes: 3084
import java.util.Scanner;

public class Main {
    public int findCost(int arr[]){
        int temp[][] = new int[arr.length][arr.length];
        int q = 0;
        for(int l=2; l < arr.length; l++){
            for(int i=0; i < arr.length - l; i++){
                int j = i + l;
                temp[i][j] = 1000000;
                for(int k=i+1; k < j; k++){
                    q = temp[i][k] + temp[k][j] + arr[i]*arr[k]*arr[j];
                    if(q < temp[i][j]){
                        temp[i][j] = q;
                    }
                }
            }
        }
        return temp[0][arr.length-1];
    }

    public static void main(String[] args) {
        Main mmc = new Main();
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] arr = new int[N+1];

        for(int i = 1; i < N+1; i++) {
            arr[i-1] = sc.nextInt();
            arr[i] = sc.nextInt();
        }

        int cost = mmc.findCost(arr);
        System.out.println(cost);

    }
}



Measured memory_bytes: 26424
/**
		Author : Avi J Patel
		University : DA-IICT
**/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair 
#define mt make_tuple
#define N 100000
#define ff first
#define ss second
#define si size()
#define MOD 1000000007
#define large 10000000000000001
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));

bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
} 
int main()
{
	int n;
	cin>>n;
	vector<pair<ll,ll>> a;
	for(int i=0;i<n;i++)
	{
		ll a1,b1;
		cin>>a1>>b1;
		a.pb({a1,b1});
	}
	sort(a.begin(),a.end(),sortbysec);
	if(a[0].ff>a[0].ss)
	{
		cout<<"No";
		return 0;
	}
	for(int i=1;i<n;i++)
	{
		a[i].ff=a[i-1].ff+a[i].ff;
		if(a[i].ff>a[i].ss)
		{
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
	return 0;
}








Measured memory_bytes: 6384
W, H, N = map(int, input().split())
X = [-1 for i in range(N)]
Y = [-1 for i in range(N)]
A = [-1 for i in range(N)]
for i in range(N):
	X[i], Y[i], A[i] = map(int, input().split())

result = [[0, 0], [W, H]]
for i in range(N):
	if A[i]==1:
		result[0][0] = max(result[0][0], X[i])
	if A[i]==2:
		result[1][0] = min(result[1][0], X[i])
	if A[i]==3:
		result[0][1] = max(result[0][1], Y[i])
	if A[i]==4:
		result[1][1] = min(result[1][1], Y[i])

if result[0][0]>=result[1][0] or result[0][1]>=result[1][1]:
	print(0)
else:
	print((result[1][0]-result[0][0])*(result[1][1]-result[0][1]))

Measured memory_bytes: 3188
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
int main()
{
    int a, b;
    scanf("%d%d",&a,&b);
    if(a == b) cout << "Draw" << endl;
    else if(a == 1) cout << "Alice" << endl;
    else if(b == 1) cout << "Bob" << endl;
    else if(a > b) cout << "Alice" << endl;
    else if(a < b) cout << "Bob" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string str;
void solve()
{
    int ans=0;
    for (int i=0;i<str.length();i++)
        if (str[i]=='+') ans++;
        else ans--;
    cout<<ans<<endl;
}
int main()
{
    while(cin>>str)
        solve();
}

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

int N, u, v;
vector<vector<int>> adjlist;
vector<int> distance_takahashi;
vector<int> distance_aoki;

void dfs(int from, int to, vector<int> &distance) {
  distance[to] = distance[from] + 1;
  for(auto i : adjlist[to]) {
    if(i == from) continue;
    dfs(to, i, distance);
  }
}

signed main() {
  cin >> N >> u >> v;
  adjlist.resize(N+1);
  distance_takahashi.resize(N+1);
  distance_aoki.resize(N+1);

  distance_takahashi[0] = -1; //dummy vertex
  distance_aoki[0] = -1;      //dummy vertex

  for(int i=0; i<N-1; i++) {
    int a, b;
    cin >> a >> b;
    adjlist[a].push_back(b);
    adjlist[b].push_back(a);
  }

  dfs(0, u, distance_takahashi);
  dfs(0, v, distance_aoki);

  int ans = 0;
  for(int i=1; i<=N; i++) {
    if(distance_takahashi[i] >= distance_aoki[i]) continue;
    ans = max(ans, distance_aoki[i]-1);
  }
  cout << ans << endl;
}


Measured memory_bytes: 10368
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define PI acos(-1)
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;

int compare_base(const void *b, const void *f) {
  return (*(int *)b - *(int *)f);
}

ll find(ll n, ll *num) {
  ll result;
  result = 1;
  for (ll i = 0; i < n; i++) {
    if (num[i] == n) {
      result *= 0;
    } else {
      result *= 1;
    }
  }
  if (result) {
    return (0);
  } else {
    return (1);
  }
}

int main(void) {
  /* 標準入力フラグ */
  int   scan;

  /* 数入力 */
  ll    answer;
  ll    x;
  ll    n; 
  ll    *p;
  ll    *diff;

  answer = 0;
  scan = scanf("%lld", &x);
  scan = scanf("%lld", &n);
  p = (ll *)malloc(sizeof(ll) * (n + 1));
  for (ll i = 0; i < n; i++) {
    scan = scanf("%lld", &p[i]);
  }

  /* プログラムを書く */
  qsort(p, n, sizeof(ll), compare_base);
    
  if (n == 0) {
    answer = x;
    printf("%lld", answer);
    return (0);
  }

  diff = (ll *)malloc(sizeof(ll) * (n + 1));
  for (ll i = 0; i < n; i++) {
    if (x - p[i] > 0) {
      diff[i] = x - p[i];
    } else {
      diff[i] = (-1) * (x - p[i]);
    }
  }
  qsort(diff, n, sizeof(ll), compare_base);
  
  if (diff[0] != 0) {
    answer = x;
    printf("%lld", answer);
    return (0);
  }

  if (n == 1 && x == p[0]) {
    answer = x - 1;
    printf("%lld", answer);
    return (0);
  }


  // -1 と +1 から順番に見て p にないやつを出力
  for (ll i = 0; i < n; i++) {
    answer = x - i;
    if (!find(answer, p)) {
      printf("%lld", answer);
      return (0);
    } 
    answer = x + i;
    if (!find(answer, p)) {
      printf("%lld", answer);
      return (0);
    } 
  }

  return (0);
}



Measured memory_bytes: 1732
n, d = map(int, input().split())
x = [list(map(int, input().split())) for i in range(n)]
ans = 0
for i in range(n-1):
    for j in range(i+1,n):
        dist = 0
        for s in range(d):
            dist += pow(abs(x[i][s] - x[j][s]), 2)
        dist = pow(dist, 1/2)
        if dist.is_integer():
            ans+=1
print(ans)


Measured memory_bytes: 3060
import java.io.FileInputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	
	static int n, p;
	
	static void start()
	{
		int[] have = new int[n];
		for(int i = 0;i < n;i++) have[i] = 0;
		
		int whoturn = 0;
		int owan = p;
		while(true)
		{
			if(owan != 0)
			{
				have[whoturn]++;
				owan--;
				if(have[whoturn] == p) break;
			}
			else
			{
				owan = have[whoturn];
				have[whoturn] = 0;
			}
			
			whoturn++;
			if(whoturn == n) whoturn = 0;
		}
		
		System.out.println(whoturn);
	}
	
	public static void main(String[] args)
	{
		
		Scanner sca = new Scanner(System.in);
		
		while(true)
		{
			n = sca.nextInt();
			p = sca.nextInt();
			if(n == 0) break;
			
			start();
		}
	}
}

Measured memory_bytes: 20248
N = int(input())
A = list(map(int,input().split()))
from collections import Counter
ctr = Counter(A)
B = [k for k,v in ctr.items() if v == 1]
B.sort()
D = {b:i for i,b in enumerate(B)}

ok = [1] * len(B)
MX = 10**6+1
for k in ctr.keys():
    for n in range(2*k,MX,k):
        if n in D:
            ok[D[n]] = 0
print(sum(ok))

Measured memory_bytes: 128940
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n;
int main(){
	cin>>n;
	vector<ll> tmp(n+1,0);
	for(ll i=1;i<=n;i++) for(ll j=i;j<=n;j+=i) tmp[j]++;
	ll ans=0;
	for(int i=1;i<=n;i++) ans+=tmp[i]*i;
	cout<<ans;
	return 0;
}


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

#define INF INT_MAX/2;
#define MOD 1000000007

using namespace std;

using ll = long long;
using ull = unsigned long long ;

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

   int a,b;
   cin>>a>>b;

   int c = b-a;
   int sum=0;
   for(int i=1;i<=c;i++){
      sum+=i;
   }
   cout<<sum-b;
   return 0; 
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vector<ll>>
#define vvi vector<vector<int>>
#define print(n) cout<<n<<endl
const int M=100111;
const int inf=1000000007;
const long long INF=1000000000000000007;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int ddx[8]={1,-1,0,0,1,-1,-1,1},ddy[8]={0,0,1,-1,1,-1,1,-1};

int main(){
	int n,d;
	int ans=0;
	cin>>n;
	int sum[M]={};
	rep(i,0,n)cin>>d,sum[d]++;
	int cnt=0;
	rep(i,1,100001){
		cnt+=sum[i];
		if(cnt==n-cnt)ans++;
	}
	print(ans);
}

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

using namespace std;
using ll =long long;
using db = double;
using vll = vector<long long>;

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; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define leftunique(a) {SORT(a);(a).erase(unique((a).begin(),(a).end()),(a).end());}
//leftuniqueは配列から同じ要素のものを取り除く 例 4 6 2 1 3 4 1 2 なら 1 2 3 4 6 になる
#define debug(x)  cout << #x << " = " << (x) << endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}
const int mod = 1e9 + 7;
const ll INF = 1LL << 60;
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//グラフ用
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};	
//ここから書き始める

ll combination(ll n, ll i){
	ll count = 0;
	ll multi = 1;
	ll div =1;
	int limit = i;
	while(count < limit){
		multi *= n;
		n--;
		multi/= count+1;
		count ++ ;
	}
	return multi / div;
}

int main()
{
	cout <<setprecision(10);
	ll n ; cin >> n;
	vector<ll> D(n);
	rep(i,n){
		cin >> D[i];
	}
	SORT(D);
	ll m ; cin >> m;
	vector<ll> T(m);
	rep(i,m) cin >> T[i];

	SORT(T);
	ll start = 0 ;
	ll count = 0;
	rep(i,m){
		//難易度がT[i]となるものを探す 二分探索
		ll search = T[i];
		For(j,start,n){
			if(D[j] == search){
				//ok
				start = j+1;
				count ++;
				break;
			}
		}
	}
	if(count==m){
		cout<<"YES"<<endl;
	}else cout << "NO"<<endl;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (ll)(1E9+7)
#define PI 3.1415926535897932384

template <class T>ostream &operator<<(std::ostream &o, const vector<T> &v)
{
	rep(i, v.size()) {
		o << (i > 0 ? " " : "") << v[i];
	}
	return o;
}

int main() {
	int n, k, num = 1;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		num = min(num * 2, num + k);
	}
	cout << num << endl;
}


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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define ALL(a) a.begin(),a.end()
#define INIT(a,b) memset(a,b,sizeof(a))
using lint = long long int;

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

    int a = N % 10;
    if (a == 2 or a == 4 or a == 5 or a == 7 or a == 9) puts("hon");
    if (a == 0 or a == 1 or a == 6 or a == 8) puts("pon");
    if (a == 3) puts("bon");
}

Measured memory_bytes: 3636
list = []

while line = STDIN.gets
  a, b, c, d, e, f = line.chomp!.split.map!(&:to_f)
  x = (c * e - f * b)/(a * e - d * b)
  y = (c * d - f * a)/(b * d - e * a)
  puts "#{sprintf( "%.3f", x.nonzero? ? x : 0)} #{sprintf( "%.3f", y.nonzero? ? y : 0)}"
end

Measured memory_bytes: 8716
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    if(n%10==9||n>89){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
  

  
}

Measured memory_bytes: 21844
using System;
using static System.Console;
using static System.Math;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TemplateAlgorithm
{
    class Program
    {
        public const long Inf = (long)1e18;
        public const double eps = 1e-6;
        public const string alfa = "abcdefghijklmnopqrstuvwxyz";
        public const string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        public const int MOD = 1000000007;


        static void Main(string[] args)
        {
            int N = IO.ReadInt();
            var map = new Dictionary<int, Tuple<string, int>>();
            
            for (var i = 1; i <= N; i++)
            {
                var city = IO.ReadStrArr();
                string s;
                int  p;
                s = city[0];
                p = int.Parse(city[1]);
                map.Add(i, new Tuple<string, int>(s, p));
            }
            var result = map.OrderBy(x => x.Value.Item1).ThenByDescending(y => y.Value.Item2).ToArray();
            Array.ForEach(result, res => WriteLine(res.Key));
        }

        static int ToInt(char c) => c - '0';



        #region MIN,MAX

        /// <summary>
        /// 最大値を返す
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="vals"></param>
        /// <returns></returns>
        public static T MaxValue<T>(params T[] vals) => vals.Max();

        /// <summary>
        /// 最小値を返す
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="vals"></param>
        /// <returns></returns>
        public static T MinValue<T>(params T[] vals) => vals.Min();
        #endregion
    }

    #region IO

    /// <summary>
    /// IO
    /// </summary>
    public class IO
    {
        public static string ReadStr(bool isTrim = false) => (isTrim) ? ReadLine().Trim() : ReadLine();
        public static int ReadInt() => int.Parse(ReadStr());

        public static long ReadLong() => long.Parse(ReadStr());

        public static decimal ReadDecimal() => decimal.Parse(ReadStr());
        public static double ReadDouble() => double.Parse(ReadStr());
        public static string[] ReadStrArr(char separator = ' ') => ReadLine().Split(separator);
        public static int[] ReadIntArr() => Array.ConvertAll(ReadStrArr(), int.Parse);
        public static long[] ReadLongArr() => Array.ConvertAll(ReadStrArr(), long.Parse);

        public static decimal[] ReadDecimalArr() => Array.ConvertAll(ReadStrArr(), decimal.Parse);
        public static double[] ReadDoubleArr() => Array.ConvertAll(ReadStrArr(), double.Parse);

        public static void Cout<T>(T value) => WriteLine(value);
        public static void CoutJoin<T>(T[] values, string separator = " ") => Cout(string.Join(separator, values));
    }

    #endregion    
}


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

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main(int argc, char const *argv[]) {
	string str;
	std::cin >> str;
	if (str[0] != 'A') {
		std::cout << "WA" << '\n';
		return 0;
	}
	if (str[1] >= 'A' && str[1] <= 'Z') {
		std::cout << "WA" << '\n';
		return 0;
	}
	if (str[str.size()-1] >= 'A' && str[str.size()-1] <= 'Z') {
		std::cout << "WA" << '\n';
		return 0;
	}
	int flag = 0;
	for (size_t i = 2; i < str.size()-1; i++) {
		if (str[i] == 'C') {
			flag++;
		}
		if (str[i] != 'C' && str[i] >= 'A' && str[i] <= 'Z') {
			std::cout << "WA" << '\n';
			return 0;
		}
	}
	if (flag == 1) {
		std::cout << "AC" << '\n';
	}
	else {
		std::cout << "WA" << '\n';
	}
	return 0;
}


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

int main() {
  int N, count = 0, i = 1;
  cin >> N;
  vector<int> b(N);
  
  for (int i=0; i<N; i++) {
    cin >> b.at(i);
  }
  
  while (count <= N) {
    i = b.at(i-1);
    count++;
    if (i == 2) {
      cout << count << endl;
      break;
    }
  }
  if (i != 2){
  cout << -1 << endl;
  }
}


Measured memory_bytes: 640
#include <stdio.h>
int main (void)
{
    int r,j;
    scanf("%d",&r);
    for(j=0;j<r;j++){
        int a[3],b,i;
        for(i=0;i<3;i++)
        {
            scanf("%d",&a[i]);
        }
      for(i=0;i<3;i++)
        {
        if(a[0]<a[i])
            {
                b=a[0];
                a[0]=a[i];
                a[i]=b;
            }

        }
         for(i=0;i<3;i++)
        {
            a[i]*=a[i];
        }
        b=a[1]+a[2];
        if(a[0]==b)
        {
            printf("YES\n");}
            else
            {
                printf("NO\n");
        }
    }
    return 0;

}

Measured memory_bytes: 576
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        String s = scan.next();
        int a = 0;
        int b = 0;
        for(int i = 0; i < (s.length() - 1) / 2; i++){
            if(s.charAt(i) == s.charAt(s.length() - i - 1)){
                a++;
            } 
        }
        if(a != (s.length() - 1) / 2){
                System.out.println("No");
                System.exit(0);
        }
        for(int i = 0; i < (s.length() - 1) / 4; i++){
            if(s.charAt(i) == s.charAt((s.length() - 1) / 2 - 1 - i)){
                if(s.charAt((s.length() + 3) / 2 - 1 + i) == s.charAt(s.length() - i - 1)){
                    b++; 
                }
            }
        }
        if(b != s.length() / 4){
            System.out.println("No");
            System.exit(0);
        }
        System.out.println("Yes");
    }
}

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

#define INF INT_MAX/2;
#define MOD 1000000007

using namespace std;

using ll = long long;
using ull = unsigned long long ;

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

   ull N;
   cin>>N;
   vector<ull>C(N-1),S(N-1),F(N-1);
   for(int i=0;i<N-1;i++)cin>>C[i]>>S[i]>>F[i];

   vector<ull>ans(N,0);
   for(int i=0;i<N;i++){
      ull time=0;
      for(int j=i;j<N-1;j++){
            if(j==i)time=S[j]+C[j];
            else if(time<=S[j]){
               time=S[j]+C[j];
            }
            else if(time%F[j]) time+=F[j]-time%F[j]+C[j];
            else time+=C[j];
      }
      ans[i]=time;
   }
   for(int i=0;i<N;i++)cout<<ans[i]<<endl;
   return 0; 
}


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

int main(int argc, char **argv)
{
    int n, m;
    scanf("%d %d", &n, &m);

    int *roads = (int *) calloc(sizeof(int), n+1);
    for (int i = 0; i < m; ++i) {
        int c1, c2;
        scanf("%d %d", &c1, &c2);
        roads[c1]++;
        roads[c2]++;
    }
    for (int i = 1; i <= n; ++i) {
        printf("%d\n", roads[i]);
    }
    return 0;
}

Measured memory_bytes: 128
s = gets 
res = 0
#p s
flag = true

i = 0
n = s.size
flag_A = false
sz_A = sz_BC = 0
flag = false

while i < n
	if s[i] == "A"
		flag_A = true
		j = i
		i += 1 while s[i+1] == "A"
#		p s[j-1..i+1], s[j..i].size
#		print sz_A,"->"
		sz_A +=  i - j + 1 
#		print sz_A,"\n"
#		print "A"*sz_A
		i += 1
#		p ["size_A",sz_A]
	elsif s[i,2] == "BC"
	#	p "BC"
		j = i
		i += 2 while s[i,2] == "BC"
		sz_BC = i - j  >> 1
#		print "BC"*sz_BC
		res += sz_A * sz_BC
#		i += 1
#		p ["size_BC,size_A",sz_BC,sz_A]
	else
		i += 1
		sz_A = 0
		flag_A = false
	end
#	p ["i,res,szA,szB",i,res,sz_A,sz_BC]
end
p res

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

int main(){
#ifdef _DEBUG
	//freopen("_in" , "r", stdin );
	//freopen("_out", "w", stdout);
#endif
	ios::sync_with_stdio(0); cin.tie(0);
	string s[3]; cin >> s[0] >> s[1] >> s[2];
	int i = 0;
	for(;;) {
		if (!s[i].size()) break;
		int t;
		if (s[i][0] == 'a') t = 0;
		if (s[i][0] == 'b') t = 1;
		if (s[i][0] == 'c') t = 2;
		s[i].erase(0, 1);
		i = t;
	}
	if (i == 0) cout << 'A';
	if (i == 1) cout << 'B';
	if (i == 2) cout << 'C';
	cout << '\n';
}


Measured memory_bytes: 3616
#include <stdio.h>
#include <string.h>

int main()
{
	int i, n;
	double ans = 0;
	
	scanf("%d", &n);
	
	double x[n];
	char u[n][4];
	
	for(i = 0; i < n; i++){
		scanf("%lf %s", &x[i], u[i]);
	}
	
	for(i = 0; i < n; i++){
		if(strcmp(u[i],"JPY") == 0)
			ans += x[i];
		else
			ans += x[i] * 380000;
	}

	printf("%lf", ans);
	

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
 
int main(){
	int A, B;
  cin >> A >> B;
  
  int pl = A + B;
  int re = A - B;
  int mu = A * B;
  
  int result = 0;
  if (pl >= re) {
    if (pl >= mu) {
      result = pl;
    } else {
      result = mu; 
    }
  } else {
    if (re >= mu) {
      result = re; 
    } else {
      result = mu; 
    }
  }
  
  cout << result << endl;
}


Measured memory_bytes: 256
#if 0
date +%Y.%m.%d

solution will be written here.
#endif
#include <cstdio>
#include <algorithm>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long ll;
struct {
	inline operator int () { int x; return scanf("%d", &x), x; }
	inline operator ll () { ll x; return scanf("%lld", &x), x; }
} read;

const int maxn = 5050, mod = 1000000007;
int deg[maxn];
ll fac[maxn], ifac[maxn];
ll f[2][maxn][2];

ll power(ll x, int k) {
	if(k < 0) k += mod - 1;
	ll res = 1;
	while(k) {
		if(k & 1) (res *= x) %= mod;
		(x *= x) %= mod;
		k >>= 1;
	}
	return res;
}

int main() {
	int n = read;
	for(int i = 1; i <= n; i ++)
		deg[i] = read;

	fac[0] = 1;
	for(int i = 1; i <= n; i ++)
		fac[i] = fac[i - 1] * i % mod;
	ifac[n] = power(fac[n], -1);
	for(int i = n; i; i --)
		ifac[i - 1] = ifac[i] * i % mod;

	f[0][0][0] = 1;
	for(int i = 1; i <= n; i ++) {
		int o = i & 1;
		for(int j = 0; j <= i; j ++)
			f[o][j][0] = f[o][j][1] = 0;
		for(int j = 0; j < i; j ++)
			for(int p = 0; p < 2; p ++) {
				ll x = f[!o][j][p];
				if(deg[i] >= 1)
					f[o][j][p] += x * ifac[deg[i] - 1];
				if(deg[i] >= 2)
					f[o][j + 1][p] += x * ifac[deg[i] - 2];
				if(deg[i] >= 3 and !p)
					f[o][j + 1][1] += x * ifac[deg[i] - 3];
			}
		for(int j = 0; j <= i; j ++)
			f[o][j][0] %= mod, f[o][j][1] %= mod;
	}

	ll ans = f[n & 1][n][0] * fac[n - 1] % mod * ifac[2] % mod;
	for(int k = 3; k < n; k ++)
		(ans += f[n & 1][k][1] * fac[n - k - 1] % mod *
		 fac[k - 1] % mod * ifac[2]) %= mod;
	printf("%lld\n", ans);
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;

int cnt[150];
char ch[200005];

int main() {
	scanf("%s", ch);
	string s = ch;
	for (int i=0 ; i<s.size() ; i++) cnt[s[i]]++;
	ll sol = 1;
	for (int i=0 ; i<s.size() ; i++) {
		sol += s.size()-i-cnt[s[i]];
		cnt[s[i]]--;
	}
	printf("%lld\n", sol);
	return 0;
}

Measured memory_bytes: 640
str = gets.chomp

(0..(str.length-1)).each do |i|
  if i % 2 == 0
    if str[i] == 'L'
      puts 'No'
      exit
    end
  elsif i % 2 == 1
    if str[i] == 'R'
      puts 'No'
      exit
    end
  end
end

puts 'Yes'


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

void solve() {
	int n;
	cin >> n;
	map<int, int> m;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		m[x]++;
	}
	int ans = 0;
	for (auto i : m) {
		if (i.first > i.second) ans += i.second;
		if (i.first < i.second) ans += i.second - i.first;
	}
	cout << ans;
}

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

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

const int N = 50;
int arr[N + 5];

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n;
	cin>>n;
	int posmax = 0, negmax = 0;
	for(int i = 1;i <= n;i++) {
		cin>>arr[i];
		if(arr[i] >= 0) posmax = max(posmax, arr[i]);
		else negmax = max(negmax, -arr[i]);
	}
	int target = posmax;
	if(posmax <= negmax) target = -negmax;
	int idx = 1;
	for(int i = 1;i <= n;i++) {
		if(target == arr[i]) idx = i;
	}
	vector<pair<int,int> > res;
	for(int i = 1;i <= n;i++) {
		arr[i] += arr[idx];
		res.push_back({idx, i});
	}
	if(arr[1] >= 0) {
		for(int i = 2;i <= n;i++) {
			arr[i] += arr[i - 1];
			res.push_back({i - 1, i});
		}
	} else {
		for(int i = n - 1;i >= 1;i--) {
			arr[i] += arr[i + 1];
			res.push_back({i + 1, i});
		}		
	}
	cout<<res.size()<<endl;
	for(int i = 0;i < res.size();i++) cout<<res[i].first<<" "<<res[i].second<<endl;
}

Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include <numeric>
using namespace std;
typedef unsigned long long int ulint;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define RE return 0
//ios::sync_with_stdio(false);
//std::cin.tie(0);
//<< setprecision(20)
const int mod=(int)1e9+7;
const llint big=(llint)(2.19e15+1);
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
template <class T> void soun(T& ar)
{sort(ar.begin(),ar.end());ar.erase(unique(ar.begin(),ar.end()),ar.end());}
llint gcd(llint a,llint b){if(a%b==0){return b;}else{return gcd(b,a%b);}}
llint lcm(llint a,llint b){return a/gcd(a,b) *b;}
template<class T,class U> auto LB(T& ve,U in){return lower_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto UB(T& ve,U in){return upper_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto LBI(T& ve,U in){return LB(ve,in)-ve.begin();}
template<class T,class U> auto UBI(T& ve,U in){return UB(ve,in)-ve.begin();}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
int main(void){
	lldo xa,ya,xb,yb;cin>>xa>>ya>>xb>>yb;
	cout<<setprecision(20);
	cout<<sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb))<<endl;
	RE;
}


Measured memory_bytes: 3292
#include <bits/stdc++.h> 
using namespace std; 
typedef   long long int ll;
int main () {
   ll a[100100],x,t,y,z,count,count1,u,p;
   for (int i=1;i<=9;i++) {
       a[i]=i;
   }
   x=1;t=1,y=10,count=9;
   while (y<=100001) {
      // p=pow(10,t);
     // cout<<t<<"LOL"<<endl;
       for (ll j=x;j<x+count;j++) { 
       for (int i=0;i<=9;i++) {
           u=a[j]%10;
           if (abs(u-i)<=1) {
               a[y]=10*a[j]+i;y++;count1++;
           }
       }
       z=j;
       }
       x=z+1;count=count1;
       t++;
   }
   ll x1;cin>>x1;
   cout<<a[x1]<<endl;
}

    
    
    

Measured memory_bytes: 1024
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

#[fastout]
fn main() {
    input! {//
        n:usize,x:usize,t:usize,
    }
    println!("{}", (n + x - 1) / x * t);
}


Measured memory_bytes: 2176
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



int main(){
	int N,M; cin >> N >> M;
	priority_queue<int> q;
	rep(i,N){
		int A; cin >> A;
		q.push(A);
	}
	while(M){
		int u = q.top();
		q.pop();
		u /= 2;
		q.push(u);
		M--;
	}
	ll ans = 0;
	while(!q.empty()){
		ans += q.top();
		q.pop();
	}
	cout << ans << endl;
}


Measured memory_bytes: 892
#include <stdio.h>

int main(void)
{
	int n, card[4][13] = {0};
	int i, j, c, d;
	char m;


	scanf("%d", &n);

	for(i=0;i<n;i++){
		scanf(" %c %d", &m, &d);

		switch(m){
			case 'S' : card[0][d-1] = 1;
						break;
			case 'H' : card[1][d-1] = 1;
						break;
			case 'C' : card[2][d-1] = 1;
						break;
			case 'D' : card[3][d-1] = 1;
						break;
		}
	}

	for(i=0;i<4;i++){
		for(j=0;j<13;j++){
			if(card[i][j] == 0){
				switch(i){
					case 0 : printf("S %d\n", j+1);
							break;
					case 1 : printf("H %d\n", j+1);
							break;
					case 2 : printf("C %d\n", j+1);
							break;
					case 3 : printf("D %d\n", j+1);
							break;
				}
			}
		}
	}

	return 0;
}

Measured memory_bytes: 596
package main

import (
	"fmt"
)

func max(a ...int) int {
	m := a[0]
	for i, v := range a {
		if i == 0 {
			continue
		}
		if m < v {
			m = v
		}
	}
	return m
}

func main() {
	// Code for A - Painting
	var H, W, N int
	fmt.Scanf("%d\n%d\n%d", &H, &W, &N)

	if N%max(H, W) == 0 {
		fmt.Println(N / max(H, W))
	} else {
		fmt.Println((N / max(H, W)) + 1)
	}

}


Measured memory_bytes: 1832
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    double r;
    cin >> r;
    printf("%.10lf\n", 2 * r * M_PI);
    return 0;
}

Measured memory_bytes: 3784
#include <stdio.h>

int main(void){
  int i,j,k,n,temp;
  int array[100];

  scanf("%d",&n);
  for( i = 0 ; i < n ; i++ ){
    scanf("%d",&array[i]);
  }

  for( i = 0 ; i < n - 1 ; i++){
    printf("%d ",array[i]);
  }

  printf("%d\n",array[i]);

  for( j = 1 ; j < n ; j++ ){
    temp = array[j];
    i = j - 1;
    while( i >= 0 && array[i] > temp ){
      array[i+1] = array[i];
      i = i - 1;
    }
    array[i+1] = temp;

    for( k = 0 ; k < n - 1 ; k++ ){
      printf("%d ",array[k]);
    }
    printf("%d\n",array[k]);
  }
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<string>

using namespace std;

int main()
{
    string deck;   
    cin>>deck;

    while (deck != "-")
    {
        int m,h;
        cin>>m;

        for(int i=0;i<m;i++)
        {
            cin>>h;

            string temp = deck + deck;

            for(int j= 0;j<deck.length();j++)
            {
                deck[j] = temp[j+h];
            }
        }

        cout<<deck<<endl;

        cin>>deck;
    }

    return 0;
}

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

int main(){
	int N;
	cin >> N;
	ll x = 0, y = 1e9;
	for (int i = 0; i < N; i++){
		ll a;
		cin >> a;
		x = max(x, a);
		y = min(y, a);
	}

	cout << x - y << endl;
	return 0;
}


Measured memory_bytes: 256
import Data.List
import Data.Ratio

main = do
  n <- readLn
  print $ phi n

phi :: Int -> Int
phi 1 = 1
phi n = numerator ratio `div` denominator ratio
  where ratio = foldl (\acc x -> acc * (1 - (1 % x)))
                      (n % 1) $ nub (primeFactor n)

factors :: Int -> [Int]
factors n = [d | d <- [1..n], n `mod` d == 0]

isPrime :: Int -> Bool
isPrime x = null [y | y <- [2..(sqr x)], x `mod` y == 0]
  where sqr a = floor $ sqrt $ fromIntegral a

primeFactor :: Int -> [Int]
primeFactor n
  | isPrime n = [n]
  | otherwise = reverse $ go [] n
  where
    go res 1 = res
    go res n = go (d : res) (n `div` d)
      where d = factors n !! 1

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

const int maxn=2e5+5;
int cnt[2200],dp[maxn];
int qp(int a,int b)
{
    int res=1;
    while(b){
        if(b&1) res=res*a%2019;
        a=a*a%2019;
        b>>=1;
    }
    return res;
}
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    string s; cin>>s;
    int n=s.size();
    cnt[0]=1;
    dp[n-1]=s[n-1]-'0'; cnt[dp[n-1]]++;
    ll ans=0;
    for(int i=n-2;i>=0;--i){
        dp[i]=(qp(10,n-i-1)*(s[i]-'0')+dp[i+1])%2019;
        cnt[dp[i]]++;
    }
    for(int i=0;i<2019;++i) ans+=1ll*cnt[i]*(cnt[i]-1)/2;
    cout<<ans<<"\n";
}

Measured memory_bytes: 4496
if __name__ == '__main__':
    n, m = [int(i) for i in input().split(" ")]
    a = [int(i) for i in input().split(" ")]
    count = 0
    for i in a:
        if i/sum(a) >= 1/(4*m):
            count += 1
    print("No") if count < m else print("Yes")
        

        

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

using namespace std;
using ull = unsigned long long;
using ll = long long;
using lli = long long int;
using ld = long double;
using pa = pair<int, int>;
using ppa = pair<pa, int>;
#define SORT(v, n) sort(v, v + n);
#define ALL(v) v.begin(), v.end()
#define VSORT(v) sort(ALL(v))
#define GRESORT(v) sort(ALL(v), greater<ll>())
#define REVERSE(v) reverse(ALL(v))
#define overlap(v) v.erase(unique(ALL(v)), v.end())
#define debug(x) cout << #x << ": " << x << endl
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for (int i = (b - 1); i >= a; i--)
#define rrep(i, n) RFOR(i, 0, n)
#define INF INT_MAX
#define SUP INT_MIN
#define mins(a, b) a = min(a, b)
#define maxs(a, b) a = max(a, b)

// 4近傍
int dy[]={0, 1, 0, -1};
int dx[]={1, 0, -1, 0};

// 8近傍
// int dy[]={0,0,1,-1,1,1,-1,-1};
// int dx[]={1,-1,0,0,1,-1,1,-1};

// const ll MOD = 1000000007;

ll pow_mod(ll a, ll b, ll mod) {
    ll tmp = 1;
    a %= mod;
    if (b > 0) {
        tmp = pow_mod(a, b / 2, mod);
        if (b % 2)
            tmp = (((tmp * tmp) % mod) * a) % mod;
        else
            tmp = (tmp * tmp) % mod;
    }
    return tmp;
}

void solve() {
    int a,b,c;
    cin >> a >> b >> c;
    if(a + b == c || a + c == b || b + c == a) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

    solve();

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include <iterator> 
using namespace std;
int min_mp = 1000000000;
int N, A, B, C;

void dist(vector<int> v,int a, int b, int c,int index,int mp){
  if(index < v.size()){
    dist(v, a+v[index],b,c,index+1,mp+10);
    dist(v, a,b+v[index],c,index+1,mp+10);
    dist(v, a,b,c+v[index],index+1,mp+10);
    dist(v, a,b,c,index+1,mp);    
  }else{
    if( a == 0 || b == 0 || c == 0){

    }else{
      mp += abs(A - a) + abs(B - b) + abs(C -c) -30;
      if(mp < min_mp){
        //cout << abs(A - a) << " " << abs(B - b) <<" "<< abs(C -c) << endl;
        min_mp = mp;
      }
    }
  }
}

int main(){
  
  cin >> N >> A >> B >> C;
  vector<int> l(N);
  for(int i =0; i < N; i++){
    cin >> l[i];
  }
  sort(l.begin(),l.end());
  
  dist(l,0,0,0,0,0);
  cout << min_mp << endl;
  
}


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

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

const long long INF = 1LL << 60;

int main() {
  int N;
  cin >> N;
  
  vector<long long> h(100010);
  for (int i = 0; i < N; i++) {
    cin >> h.at(i);
  }
  
  vector<long long> dp(100010);
  for (int i = 0; i < 100010; i++) {
    dp.at(i) = INF;
  }
  
  dp.at(0) = 0;
  
  for (int i = 1; i < N; i++) {
    chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
    if (i > 1) {
      chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
    }
  }
  
  cout << dp[N-1] << endl;  
}


Measured memory_bytes: 1792