akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

//順列DPの問題だけど使わずにやってしまった

int main(){
	int n, x, y;
	if(scanf("%d", &n)==EOF){return 0;}
	
	double place[2][n];
	//double distance[n][n];
	double sum = 0;
	//int factoral = 1;
	
	for(int i = 0; i < n; i++){
		if(scanf("%d %d", &x, &y)==EOF){return 0;}
		place[0][i] = (double)x;
		place[1][i] = (double)y;
	} 

	for(int i = 0; i < n-1; i++){
		 //factral *= (i+1);
		for(int j = i+1; j < n; j++){
			//distance[i][j] = sqrt((place[0][i] - place[0][j])**2 + (place[1][i] - place[1][j])**2);
			//distance[j][i] = distance[i][j];
			sum += sqrt(pow((place[0][i] - place[0][j]), 2) + pow((place[1][i] - place[1][j]), 2));
		}
	} 
	
	//factral = n!
	printf("%f\n", sum*2/n);
	return 0;

}

Measured memory_bytes: 2204
#include<bits/stdc++.h>
using namespace std;
int n,x;
vector<int> ans;
void solve()
{
	int ct=n/2;queue<int> q;
	for(int i=1;i<n;i++) if(abs(i-x)>1) q.push(i);
	for(int i=1;i<ct-1;i++) ans.push_back(q.front()),q.pop();
	ans.push_back(x-1),ans.push_back(x),ans.push_back(x+1);
	for(int i=ct+2;i<n;i++) ans.push_back(q.front()),q.pop();
}
int main()
{
	cin>>n>>x;n=n*2;
	if(x==1 or x==n-1) 
	{
		puts("No");
		exit(0);
	}
	puts("Yes");
	solve();
	for(int i=0;i<ans.size();i++) printf("%d\n",ans[i]);
	return 0;
}

Measured memory_bytes: 3192
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int L = scan.nextInt();
		int R = scan.nextInt();
		int d = scan.nextInt();
		int cnt = 0;
		for(;L <= R;L++) {
			if(L%d==0) {
				cnt += 1;
			}
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 35860
/*
Minhazul Hayat Khan
minhaz1217.github.io
Website: www.minhazul.com
EWU, Bangladesh
Problem Name:
Problem Link: https://abc107.contest.atcoder.jp/tasks/arc101_a?lang=en
Date : 18 / May / 2019
Comment: sliding minimum / maximum range query problem
*/
#include<bits/stdc++.h>
//#include<iostream>
using namespace std;
#define DEBUG 1
#define check(a) DEBUG==1?(cout << a << endl):null;
#define cc(a) DEBUG==1?(cout << a << endl):cout<<"";
#define msg(a,b) DEBUG==1?(cout << a << " : " << b << endl):cout<<"";
#define msg2(a,b,c) DEBUG==1?(cout << a << " : " << b << " : " << c << endl):cout<<"";
#define msg3(a,b,c,d) DEBUG==1?(cout << a << " : " << b << " : " << c << " : " << d << endl):cout<<"";
#define msg4(a,b,c,d,e) DEBUG==1?(cout << a << " : " << b << " : " << c << " : " << d << " : " << e << endl):cout<<"";
#define _INIT ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

vector<pair< long long int, long long int> > res;
vector<long long int> vec;
void sliding_window(int m){
    int val;
    deque<pair<long long int, long long int> > dqMin, dqMax;
    for(int i=0;i<vec.size();i++){
        val = vec[i];
        while(!dqMin.empty() && dqMin.front().first >= val){
            dqMin.pop_front();
        }
        dqMin.push_front(make_pair(val,i));
        while(!dqMin.empty() && dqMin.back().second <= i-m){
            dqMin.pop_back();
        }


        while(!dqMax.empty() && dqMax.front().first <= val){
            dqMax.pop_front();
        }
        dqMax.push_front(make_pair(val,i));
        while(!dqMax.empty() && dqMax.back().second <= i-m){
            dqMax.pop_back();
        }

        if(i>=m-1){
            res.push_back(make_pair(dqMin.back().first, dqMax.back().first) );
        }
    }
}


int main(){

    long long int n,k,a,ans,mn = INT_MAX,u,v;
    cin >> n >> k;
    for(int i=0;i<n;i++){
        cin >> a;
        vec.push_back(a);
    }
    sliding_window(k);
    for(int i=0;i<res.size();i++){
        u = res[i].first;
        v = res[i].second;

        if( (u <= 0 && v<= 0) || (u>=0 && v>=0)){
            ans = max(abs(u), abs(v));
        }else{
            ans = min( abs(u), abs(v) )*2 + max( abs(u), abs(v) );
        }
        mn = min(ans,mn);
        //msg2(u,v,mn)
    }
    cout << mn << endl;
    return 0;
}


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

int main(){
    int n;ll h; cin >> n >> h;
    vector<int> a(n),b(n);
    rep(i,n) cin >> a[i] >> b[i];
    sort(a.rbegin(),a.rend());
    sort(b.rbegin(),b.rend());
    ll p = 0;
    int i = 0;
    while(p < h){
        if(b[i] < a[0]) break;
        p += b[i];
        ++i;
        if(i == n) break;
    }
    if(p >= h){
        cout << i << endl;
        return 0;
    }
    cout << i + (h-p+a[0]-1)/a[0] << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
typedef long long ll;
long long a[100000], b[100001];
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 1; i < n; i++) {
		b[i] = 0;
	}
	ll sum = 9999999999, sum2 = 0;
	for (int i = 0; i < n; i++) {
		b[i] += a[i];
		if (i > 0) b[i] += b[i - 1];
		if (i % 2 == 0) {
			if (b[i] >= 0) {
				sum2 += (abs(b[i]) + 1);
				b[i] = -1;
			}
		}
		else {
			if (b[i] <= 0) {
				sum2 += (abs(b[i]) + 1);
				b[i] = 1;
			}
		}
	}
	sum = sum2;
	for (int i = 0; i < n; i++)
		b[i] = 0;
	sum2 = 0;
	for (int i = 0; i < n; i++) {
		b[i] += a[i];
		if (i > 0) b[i] += b[i - 1];
		if (i % 2 == 1) {
			if (b[i] >= 0) {
				sum2 += (abs(b[i]) + 1);
				b[i] = -1;
			}
		}
		else {
			if (b[i] <= 0) {
				sum2 += (abs(b[i]) + 1);
				b[i] = 1;
			}
		}
	}
	cout << min(sum, sum2) << endl;
}

Measured memory_bytes: 1792
import sys

antena = [0]*5

for i in range(5):
    antena[i] = int(input())
    
K = int(input())


for i in range(5):
    for j in range(i+1,5):
        if abs(antena[j]-antena[i]) > K:
            print(":(")
            sys.exit(0)

print("Yay!")

Measured memory_bytes: 3060
#べき乗関数powを使った逆元の計算(modinvよりもPythonでは高速、PyPyだと遅い)
def modinv(a,m):
    return pow(a,m-2,m)

#n以下の素数列挙(O(nlog(n))
def primes(n):
    ass = {}
    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2,int(n**0.5)+1):
        if not is_prime[i]:
            continue
        #i**2から始めてOK
        for j in range(i*2,n+1,i):
            is_prime[j] = False
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass[i] = 0
    return ass

#[[素因数,数]]を出力
def fctr1(n): 
    f = []
    c = 0
    for i in range(2,int(n**0.5)+2):
        while n%i == 0:
            c += 1
            n = n//i
        if c !=0:
            f.append([i,c])
            c = 0
    if n != 1:
        f.append([n,1])
    return f

N = int(input())
A = list(map(int,input().split()))

e = primes(10**6+7)
inv = 0
P = 10**9+7

for i in range(N):
    inv = (inv+modinv(A[i],P))%P
    l = fctr1(A[i])
    for j in range(len(l)):
        e[l[j][0]] = max(e[l[j][0]],l[j][1])

ans = 1
for k in e.keys():
    if e[k] != 0:
        for i in range(e[k]):
            ans = ans*k%P
ans = ans*inv%P

print(ans)


Measured memory_bytes: 17448
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
using vl=vector<ll>;
using vb=vector<bool>;
using vs=vector<string>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
const ll oo =0x3f3f3f3f3f3f3f3fLL;
const double eps=1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORD(i,a,b) for(ll i=ll(b)-1;i>=(a);i--)
#define TR(X) ({if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })
int main(){ cin.sync_with_stdio(0);
        ll A, B, C, D, E, F;
        cin >> A >> B >> C >> D >> E >> F;

        ll bestW = 1, bestS = 0;
        for (ll a = 0; a <= F; a += 100 * A) {
                for (ll b = 0; a+b <= F; b += 100 * B) {
                        if (a == 0 && b == 0) continue;

                        ll maxSugar = ((a+b)/100) * E;
                        for (ll c = 0; c <= maxSugar && c + a + b <= F; c += C) {
                                ll d = (min(F-a-b-c, (maxSugar - c)) / D) * D;

                                ll w = a + b;
                                ll s = c + d;

                                if (s * (bestW + bestS) >= bestS * (w + s)) {
                                        bestW = w;
                                        bestS = s;
                                }
                        }
                }
        }

        cout << bestW + bestS << " " << bestS << endl;
} //cin.tie(0) bei schnellem Wechseln


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


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main(void){
	int L,A,B,C,D,kokugo,sugaku,sum = 0,day;
	scanf("%d %d %d %d %d",&L,&A,&B,&C,&D);
	/*L?????¬??????A?????????????????????B?????°???????????????C????????\????????????????????????????????????
	D????????\????????????????????°???????????????*/
	kokugo = ceil((double)A/C);
	sugaku = ceil((double)B/D);
	if(kokugo >= sugaku)sum = kokugo;
	else sum = sugaku;
	day = L - sum;
	printf("%d\n",day);
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
void decimal(int x){cout<<fixed<<setprecision(x);}
//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/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*POW(a,b-1)%mod;ll k=POW(a,b/2);return k*k%mod;}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

void solve(){
  int n,k;
  cin>>n>>k;
  vi p(n);
  rep(i,n) cin>>p[i];
  sort(all(p));
  int ans=0;
  rep(i,k) ans+=p[i];
  out(ans);
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}


Measured memory_bytes: 3640
#include <stdio.h>
int main(void){
  int n;
  int t,a,count;
  double max;
  int maxchiten=0;
  double h[1000];
  scanf("%d",&n);
  scanf("%d",&t);
    scanf("%d",&a);
  for(count=0;count<=n-1;count++){
    scanf("%lf",&h[count]);
    h[count]=t-h[count]*0.006;
    h[count]=a-h[count];
    if(h[count]<0){h[count]=0-h[count];}
  }
  max=h[0];
   for(count=0;count<=n-1;count++){
     if(max>h[count]){max=h[count];maxchiten=count;}
  }
  printf("%d",maxchiten+1);
  return 0;
  
}

Measured memory_bytes: 128
#include"bits/stdc++.h"
using namespace std;
#define ll long long
#define LL long long
#define MOD 1000000007
#define INF 2000000000
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
ll N, M, K,H,W, mi1,mi2,sum;
string s;
double ans;
LL alp[100000][125];
int main() {
	cin >> N;
	vector<double> v(N);
	ans = 0;
	for (int i = 0; i < N; i++) {
		cin >> v[i];
	}
		sort(v.begin(),v.end());
		ans = (v[0] + v[1]) / 2;
		for (int i = 2; i < N; i++) {
			ans = (ans + v[i]) / 2;
		}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
import Foundation

func readArrayDouble() -> [Double] {
    readLine()!.split(separator: " ").map({Double($0)!})
}

let line = readArrayDouble()
let (A, B, H, M) = (line[0], line[1], line[2], line[3])
print((A * A + B * B - 2 * A * B * cos(11 * Double.pi * (H * 60 + M) / 360)).squareRoot())


Measured memory_bytes: 13792
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>

using namespace std;

int main() {
    int n, x;
    cin >> n >> x;
    if (x == 1 || x == 2*n-1) {
       cout << "No\n";
       return 0;
    }
    
    vector<int> a(2*n-1);
    a[n-1] = x;
    a[n-2] = x+1;
    a[n] = x-1;
    int pos = 1;
    for (int i = 0; i < 2*n - 1; ++i)
        if (i < n-2 || i > n) {
           while (pos >= x-1 && pos <= x+1)
                 ++pos;
           a[i] = pos++;
        }
    cout << "Yes\n";
    for (int i = 0; i < 2*n-1; ++i)
        cout << a[i] << "\n";
 //       system("pause");
     return 0;

}


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



int main() {
  string s, t;
  cin >> s >> t;
  int count = 0, maxcount = 0;
  for(int i = 0; i < s.length() - t.length() + 1; i++) {
    string u = s.substr(i, t.length());
    for(int j = 0; j < t.length(); j++) {
      if(u[j] == t[j]){
      count++;
      }
    }
    maxcount = max(maxcount, count);
    count = 0;
  }
  cout << t.length() - maxcount << endl;
}

Measured memory_bytes: 3624
INT_MAX=10**19+7
MOD=10**12+7
def INPUT():return list(int(i) for i in input().split())
def LIST_1D_ARRAY(n):return [0 for _ in range(n)]
def LIST_2D_ARRAY(m,n):return [[0 for _ in range(n)]for _ in range(m)]
#=======================================================================
a,b,c,k=INPUT()
ans=0
if k<=a:
    print(k)
elif k>a and k<=a+b:
    print(a)
else:
    print(a-(k-(a+b)))


Measured memory_bytes: 61944
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define fs first
#define sc second
#define task "tst"
using namespace std;
const ll N = 1e5 + 9;
const ll mod = 1e9 + 7;
typedef pair<ll,ll> LL;
set<ll> s;
ll n,a[N],i,ans[N];
map<ll,LL> mp;
int main(){
    //ios_base::sync_with_stdio(0);
    //cin.tie(0), cout.tie(0);
    if (fopen(task".inp", "r")){
        freopen(task".inp", "r", stdin);
        //freopen(task".out", "w", stdout);
    }
    s.insert(0);
    cin>>n;
    for (i = 1;i <= n;i++){
        cin>>a[i]; s.insert(a[i]);
    }
    for (i = n;i > 0;i--){
        mp[a[i]].fs = i;
        mp[a[i]].sc++;
    }
    mp[0].fs = mp[0].sc = 0;
    while(s.size() > 1){
        //cout<<1;
        ll t = *prev(s.end()); s.erase(t);
        ll p = *prev(s.end()),q = t - p;
        ll pos = mp[t].fs;
        //cout<<t<<" "<<pos<<"\n";
        ans[pos] += q*(mp[t].sc);
        mp[p].fs = min(mp[t].fs,mp[p].fs); mp[p].sc += mp[t].sc;
    }
    for (i = 1;i <= n;i++) cout<<ans[i]<<"\n";
}



Measured memory_bytes: 16096
#include<bits/stdc++.h>
using namespace std;
#define itn int
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) a.begin(),a.end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const long mod=1e9+7;
const int size=1e5;
int main(){
	int N,D;cin>>N>>D;
	cout<<(N+2*D)/(2*D+1)<<endl;
}

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

def solve_odd(n,AB):
    AB.sort()
    median_min=AB[n//2][0]
    AB.sort(key=lambda x: x[1])
    median_max=AB[n//2][1]
    #print(median_max,median_min)
    return max(0,median_max-median_min+1)

def solve_even(n,AB):
    AB.sort()
    median_min=AB[n//2-1][0]+AB[n//2][0]
    AB.sort(key=lambda x: x[1])
    median_max=AB[n//2-1][1]+AB[n//2][1]
    #print(median_max,median_min)
    return max(0,median_max-median_min+1)

def main():
    n=int(input())
    AB=[list(map(int,input().split())) for _ in range(n)]
    if n%2==0:
        ans=solve_even(n,AB)
    else:
        ans=solve_odd(n,AB)
    print(ans)
    
if __name__=='__main__':
    main()

Measured memory_bytes: 109392
import sys
from collections import deque
import bisect
import copy
import heapq
import itertools
import math
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    N = int(input())
    A = read_list()
    S = 0
    for a in A:
        S += a
        S %= mod

    res = (S * S) % mod 
    for a in A:
        res -= a * a
        res %= mod
    
    res *= pow(2, mod - 2, mod)
    res %= mod
    print(res)


if __name__ == "__main__":
    main()



Measured memory_bytes: 93832
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;
long long GCD(long long a, long long b)
{
    if (b == 0)
        return a;
    return GCD(b, a % b);
}
long long LCM(long long a, long long b)
{
    return a * b / GCD(a, b);
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m;
    cin >> n >> m;
    V vec(n);
    ll prev;
    rep(i, n){
        cin >> vec[i];
        if(i==0){
            ll f=vec[i];
            ll res=0;
            while(f%2==0){
                f/=2;
                res++;
            }
            prev=res;
        }else{
            ll f=vec[i];
            ll res=0;
            while(f%2==0){
                f/=2;
                res++;
            }
            if(prev!=res){
              //  cout<<"ha"<<endl;
                cout<<0<<endl;
                return 0;
            }
        }
        //cout<<vec[i]<<" "<<prev<<endl;
    }
    ll reg = 1;
    rep(i,n){
        reg = LCM(reg, vec[i]);
        if(reg>2*m){
            cout<<0<<endl;
            return 0;
        }
    }
    
    ll path=m-(reg/2);
    if(path<0){
        cout<<0<<endl;
        return 0;
    }
    cout<<path/reg+1<<endl;
}


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

double pi = acos(-1);

int main()
{
    int a, b, h, m;
    cin >> a >> b >> h >> m;

    double x1 = a * cos(-(h * 60 + m) / 720.0 * 2 * pi);
    double y1 = a * sin(-(h * 60 + m) / 720.0 * 2 * pi);

    double x2 = b * cos(-m/60.0*2*pi);
    double y2 = b * sin(-m/60.0*2*pi);

    double dx = x1 - x2;
    double dy = y1 - y2;

    cout << setprecision(10) << sqrt(dx * dx + dy * dy) << endl;

    return 0;
}

Measured memory_bytes: 4088
#include<bits/stdc++.h>
		#include <bitset>
		using namespace std;
		#define ll long long 
		#define ld long double
		#define MOD 1000000007
		#define mod9 1000000009
		#define mod 1000003
		#define fast ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
		#define mp make_pair
		#define pb push_back
		#define ct ll t;cin>>t;while(t--)
		#define bi begin()
		#define ei end()
		#define fi first 
		#define se second   	
		bool isPrime(ll n) 
		{ 
			// Corner case 
			if (n <= 1) 
				return false; 
			
			// Check from 2 to n-1 
			for (ll i = 2; i*i <= n; i++) 
				if (n % i == 0) 
					return false; 
			
			return true; 
		}
		long long binpow(long long a, long long b) {
			long long res = 1;
			while (b > 0) {
				if (b & 1)
					res = (res%mod) * (a%mod);
				a = (a%mod) * (a%mod);
				b >>= 1;
			}
			return res%mod;
		}

		bool compare(const pair<ll,ll>&a,const pair<ll,ll>&b)
		{
			return (a.se<b.se);
		}
		ll lcm(ll a,ll b)
		{
			return(a*b)/__gcd(a,b);
		}
		// vector<ll>s;
		void SieveOfEratosthenes() 
		{  
			ll n=10005;
			bool prime[1000005]; 
			memset(prime, true, sizeof(prime)); 
			// s[0]=1;
			// s[1]=1;
			for (int p=2; p*p<=n; p++) 
			{ 
				
				if (prime[p] == true) 
				{   
					for (int i=p*p; i<=n; i += p) {
						prime[i] = false; 
						// s[i]=1;
						}
				} 
			} 
			for(ll i=2;i<10005;i++)
			{
				if(prime[i])
				{
					// s.pb(i);
				}
			}
		} 
		void eea(ll a, ll b, ll & x, ll & y) {
		if (a == 0) {
			x = 0;
			y = 1;
			return ;
		}
		ll x1, y1;
		eea(b % a, a, x1, y1);
		x = y1 - (b / a) * x1;
		y = x1;
		return ;
	}
	ll modinverse(ll a,ll m)
	{
		ll x, y;
		eea(a, m, x, y);
		if (__gcd(a,m) != 1) {
		return -1;
		}
	else {
		x = (x % m + m) % m;
		cout << x << endl;
		return x;
	}
	}
		ll fact[1000007]={0};
		ll expo(ll x, ll y) {ll res=1;x=x%MOD;while(y>0){if(y&1)res=(1ll*res*x)%MOD;
		y=y>>1;x=(1ll*x*x)%MOD;} return res;}
		void facto() {fact[0]=1;fact[1]=1;for(ll i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%MOD;}
		ll npr(ll n,ll r) {facto(); ll res=1; res=fact[n]; res=(res*(expo(fact[n-r],MOD-2)))%MOD; return res; }
		ll ncr(ll n,ll r){ ll res=1; if(r>n-r)r=n-r; for(ll i=0;i<r;i++) {  res*=n-i;  res/=i+1; } return res;}
			
				
		int main()
		{
			fast
			float r;
			cin>>r;
			float ans=2*22*r/7;
			cout<<fixed<<setprecision(10)<<ans<<"\n";
		}

 

Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const ll INF = 1LL<<60;
const int ny[4] = {-1,1,0,0}, nx[4] = {0,0,-1,1};
int sy,sx,gy,gx;


int main(){
  ll a,b,x; cin >> a >> b >> x;
  ll ans = b/x+1;
  ll temp = (a-1)/x+1;
  if(a == 0) temp = 0;
  ans -= temp;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    ll a, b, c, t;
    cin >> a >> b >> c;
    ll cnt = 0;
    if(a == b && b == c && a % 2 == 0){
        cout << -1;
        exit(0);
    }
    while(a % 2 == 0 && b % 2 == 0 && c % 2 == 0){
        cnt++;
        int ba = a, bb = b, bc = c;
        a = (bb+bc)/2;
        b = (ba+bc)/2;
        c = (ba+bb)/2;
    }
    cout << cnt;
}      

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

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;

#define MAX_NUM (1000000000 + 7)

using namespace std;

template <typename T>
static inline void ArrayInput(vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cin >> *itr;
}

template <typename T>
static inline void ArrayPut(const vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cout << *itr << " ";
  cout << endl;
}

template <typename T>
static inline T ArraySum(vector<T>& A) {
  T res = 0;
  for (auto itr = A.begin(); itr < A.end(); ++itr) res += *itr;
  return res;
}

bool Sec_compare(pair<uint64_t, uint64_t> a, pair<uint64_t, uint64_t> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

u64 dec_dig(u64 num) {
  u64 res = 0;
  while (num > 0) {
    num /= 10;
    ++res;
  }
  return res;
}

i64 modinv(i64 a, i64 m) {
  i64 b = m, u = 1, v = 0;
  while (b) {
    i64 t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

u64 gcd(u64 a, u64 b) {
  if (a < b) {
    a ^= b;
    b ^= a;
    a ^= b;
  }

  return b ? gcd(b, a % b) : a;
}

u64 My_Combination(u64 n, u64 k, i64 m) {
  if (n < k) return 0;
  if (k == 0 || n == k) return 1;
  u64 res = 1;
  for (u64 i = 1; i <= k; ++i)
    res = (((res * (n + 1 - i)) % m) * modinv(i, m)) % m;
  return res;
}

int main() {
  cout << setprecision(18);
  i32 X, Y;
  cin >> X >> Y;
  if ((X + Y) % 3 != 0)
    cout << 0 << endl;
  else {
    i64 n = ((2 * Y) - X) / 3;
    i64 m = ((2 * X) - Y) / 3;
    if (n < 0 || m < 0) {
      cout << 0 << endl;
      return 0;
    }
    if (n > m) swap(n, m);
    cout << My_Combination(n + m, n, MAX_NUM) << endl;
  }
  return 0;
}


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

struct Node{
  int s;
  struct Node *ri;
  struct Node *le;
  struct Node *oya;
};

struct Node *root, *NIL;

void Inorder(struct Node *);
void Preorder(struct Node *);
struct Node * Find(struct Node *, int);

void Insert(int n){
struct  Node *p = root;
struct  Node *q = NIL;
struct  Node *r;

r = (struct Node *)malloc(sizeof(struct Node));
r -> s = n;
r -> le = NIL;
r -> ri = NIL;

while(p != NIL){
   q = p;
   if(r->s < p->s){
     p = p -> le;
   }
   else{
     p = p -> ri;
   }
}

r -> oya = q;
  if(q == NIL){
    root = r;
  }
  else{
    if(r->s < q->s){
      q -> le = r;
    }
    else{
      q -> ri = r;
    }
  }
}


int main(){
  int i,n,value,findnum;
  char C1[10];

  scanf("%d",&n);

  for(i = 0 ; i < n ; i++){
    scanf("%s",C1);

    if(strcmp(C1,"insert") == 0){
     scanf("%d",&value);
      Insert(value);
    }
    else if(strcmp(C1,"print") == 0){
      Inorder(root);
      printf("\n");
      Preorder(root);
      printf("\n");
    }
    else if(strcmp(C1,"find") == 0){
      scanf("%d",&findnum);
      struct Node *F = Find(root,findnum);
      if(F != NIL) printf("yes\n");
      else printf("no\n");
    }
  }

    return 0;
}



void Inorder(struct Node *a){
  if(a == NIL) return;
  Inorder(a -> le);
  printf(" %d",a -> s);
  Inorder(a -> ri);
}

void Preorder(struct Node *a){
  if(a == NIL) return;
  printf(" %d",a -> s);
  Preorder(a -> le);
  Preorder(a -> ri);
}

struct Node * Find(struct Node *a, int n){
  while(a != NIL && n != a -> s){
    if(n < a -> s ) a = a -> le;
    else a = a -> ri;
  }
  return a;
}



Measured memory_bytes: 20524
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

def main():
    N = int(input())
    A = input_nums()
    members = {}
    for i in range(1, N+1):
        members[i] = A[i-1]
    members = sorted(members.items(), key=lambda x:x[1])
    res = [str(m[0]) for m in members]
    print(' '.join(res))

if __name__ == '__main__':
    main()

Measured memory_bytes: 26040
#include <iostream>
#include <math.h>
#include<iomanip>
using namespace std;

int main(){
  int A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0;
  cin >> A>>B;
  if(A%B==0){
    cout <<A/B << endl;
  }
  else{
    cout <<A/B+1<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
#define MAX_N 1000000
long long x[MAX_N], a, b, c, n, cnt;
int main() {
	while (1) {
		memset(x, 0, sizeof(x)); cnt = 0;
		cin >> n; if (!n) { break; }
		for (int i = 0; i < n; i++) {
			cin >> a >> b >> c;
			x[a] += b*c;
			if (x[a] >= 1000000) { cout << a << endl; cnt++; }
		}
		if (cnt == 0) { cout << "NA" << endl; }
	}
}

Measured memory_bytes: 8976
def m(L,R):
 T=[]
 for l in L[::-1]:
  while R and R[-1]>l:T+=[R.pop()]
  T+=[l]
 return R+T[::-1]
def d(A):
 l=len(A);global c;c+=l
 s=l//2;return m(d(A[:s]),d(A[s:]))if l>1 else A
c=0
n=int(input())
print(*d(list(map(int,input().split()))))
print(c-n)


Measured memory_bytes: 63692
import itertools
N,m,d = list(map(int,input().split(" ")))
f1 =(2* (N -d)) / (N ** 2)   # d = 1 N = N m = 2のケース
if d == 0:
    print(f1 * (m- 1) /2 )
else:
    print(f1 * (m- 1) )


Measured memory_bytes: 38256
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////

ll n,x[200005] = {},y[200005] = {};

int main(){
    
    IN n;
    inrep(n,x);
    rep(i,0,n)y[i] = x[i];
    
    sort(x,x+n);
    ll l = x[(1+n)/2 - 1];
    ll r = x[(1+n)/2 ];
   
    rep(i,0,n){
      //  cout << abs(y[i] - l) << " " <<  abs(y[i] - r) << endl;
        if(abs(y[i] - l) > abs(y[i] - r))P(l);
        else P(r);
    }
    
    
	return  0;
}

Measured memory_bytes: 5376
import java.util.*;

public class Main{
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);

      int n = Integer.parseInt(sc.next());
      int k = Integer.parseInt(sc.next());

      int ans = 0;

      int[] h = new int[n];
      for(int i=0;i<n;i++){
        h[i] = Integer.parseInt(sc.next());
        if(h[i]>=k){
          ans++;
        }
      }

      
      System.out.println(ans);

    }
}


Measured memory_bytes: 48904
import sys
import math


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()

bt = []
ans = 0

for i in range(n):
    a, b = inintm()
    bt.append([a, b])

for i in range(n)[::-1]:
    if (bt[i][0]+ans) % bt[i][1] != 0:
        ans += bt[i][1] - ((bt[i][0]+ans) % bt[i][1])

print(ans)

Measured memory_bytes: 24196
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> void pr_vec(vector<T> &v, char ep=' '){int n=v.size();REP(ni,n){cout<<v[ni];if(ni!=n-1)cout<<ep;}cout<<endl;};
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int N;
    cin >> N;
    vector<ll> A(N+1);
    for (int i = 0; i < N+1; i++) {
        cin >> A[i];
    }
    vector<pll> p(N+1);
    p[N].fi = p[N].se = A[N];
    RREP(i, N){
        p[i].fi = max(A[i], p[i+1].fi);
        p[i].se = p[i+1].se + A[i];
    }
    vector<ll> q(N+1);
    q[0] = 1;
    Rep(i,1,N+1){
        if(q[i-1]<=A[i-1]){
            pr(-1);
            return 0;
        }
        q[i] = min((q[i-1]-A[i-1])*2, p[i].se);
    }
    if(q[N]!=A[N]){
        pr(-1);
        return 0;
    }  

    ll ans = 0;
    for(auto&& qi:q) ans += qi;
    pr(ans);
}

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

int main() {
  int n;
  cin >> n;
  vector<string> a(n);
  for (int i = 0; i < n; i ++) {
    cin >> a.at(i);
  }

  for (int i = 0; i < n; i ++) {
    for (int j = 0; j < n; j ++) {
      if (i == j) continue;
      if (a.at(i) == a.at(j)) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  for (int i = 1; i < n; i ++) {
    if (a.at(i).at(0) != a.at(i - 1).back()) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	cin>>a;
	cin>>b;
	if(a==1&&b==2||a==2&&b==1)
	{
		cout<<"3";
	}
	if(a==1&&b==3||a==3&&b==1)
	{
		cout<<"2";
	}
	if(a==2&&b==3||a==3&&b==2)
	{
		cout<<"1";
	}
	return 0;
		
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;

int Sort(int A[],int N){
	int min,t,s=0; // s???????????????????????¨??¨??????????????£???
	for(int i=0; i<N-1; i++){
		min = i;
		for(int j=i+1; j<N; j++){ // ????????????i??????????????¨??§????????±??£?????´????????????????????±???????????§????????????
			if( A[j]<A[min] ) min = j;
		}

		// A[i]??¨A[min]???????????\??????????????????
		t = A[i]; // ??????A[i]?????????t????????£?????????
		A[i] = A[min]; // A[i]???????????¢?????\?????´????????????????????????????????§A[min]?????????????????????
		A[min] = t; // A[min]?????¢???A[i]????§????????????§t???????????????A[i]????????????????????\???????????????
		if( i != min ) s++;
	}
	return s;
}


int main(){
	int A[100],N,i,s;

	cin >> N;
	for(int i=0; i<N; i++) cin >> A[i];

	s = Sort(A,N);

	for(int i=0; i<N; i++){
		if( i>0 ) cout << " ";
		cout << A[i];
	}
	cout << "\n";
	cout << s << "\n"; // ?????????????????¨???????????±????????????
	return 0;
}

Measured memory_bytes: 1168
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M; cin >> N >> M;
	vector<int>v(N + 1, 0);
	vector<int>w(v);
	rep(i, 0, M) {
		int a, b; cin >> a >> b;
		if (a == 1)v[b]++;
		else if (b == 1)v[a]++;
		
		if (a == N)w[b]++;
		else if (b == N)w[a]++;
	}
	bool f(false);
	rep(i, 1, N + 1) {
		if (v[i] && w[i])f = true;
	}
	cout << (f ? "POSSIBLE" : "IMPOSSIBLE") << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
static const int INF = 2000000000;

int n, m, q;
vector<int> a, b, c, d;
int ans = 0;

void dfs(vector<int> A){
  if (A.size() == n+1){
    int now = 0;
    rep(i, q){
      if (A[b[i]] - A[a[i]] == c[i]) now += d[i];
    }
    ans = max(ans, now);
    return;
  }

  A.push_back(A.back());
  while (A.back() <= m){
    dfs(A);
    A.back()++;
  }
}

int main(){
  cin >> n >> m >> q;
  a = b = c = d = vector<int>(q);
  rep(i, q) cin >> a[i] >> b[i] >> c[i] >> d[i];
  dfs(vector<int>(1,1));
  cout << ans << endl;
}

Measured memory_bytes: 3612
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		double debt = 100000;

		for(int i = 0; i < n; i++) {
			debt *= 1.05;
			// ?????????????????§????????´??????????????????
			if((long)debt % 1000 != 0) {
				debt /= 1000;
				debt = Math.ceil(debt);
				debt *= 1000;
			}
		}

		System.out.println((long)debt);
	}
}

Measured memory_bytes: 26056
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
int main()
{
   string s;
   cin>>s;
   long long int count=0,ans=0;
   for(long long int i=0;i<s.size();i++)
   {
       if(s[i]=='B')
        count++;
       else
        ans=ans+count;
   }
   cout<<ans<<endl;
}


Measured memory_bytes: 3748
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    int i=0,j=n-1;
    int ct=0;
    while(i<j)
    {
        if(s[i]=='W'&&s[j]=='R')
        {
            ct++;
            i++;
            j--;
        }
        if(s[i]!='W')
        i++;
        if(s[j]!='R')
        j--;
    }
    cout<<ct<<endl;
    
}

Measured memory_bytes: 3684
#include<iostream>

using namespace std;

int main(){
  int P, Q, R;
  int X, Y, Z;
  cin >> P >> Q >> R;
  X = P + Q;
  Y = Q + R;
  Z = R + P;
  if (X <= Y && X <= Z){
    cout << X << endl;
  } else if (Y <= Z && Y <= Z){
    cout << Y << endl;
  } else {
    cout << Z << endl;
  }

  return 0;
}

Measured memory_bytes: 256
/*

This Submission is to determine how many 120/240 min const. delivery point there are.

//info
120 req. steps <= 5
*/
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 998244353
#define MOD 998244353
#define seg_size 262144
#define REP(a,b) for(long long a = 0;a < b;++a)

unsigned long xor128() {
	static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123;
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
int main() {
#define int long long
	int n;
	cin >> n;
	queue<int> next_move;
	vector<int> A, B;
	REP(i, n) {
		long long c;
		cin >> c;
		A.push_back(c);
	}
	REP(i, n) {
		long long c;
		cin >> c;
		B.push_back(c);
	}
	REP(i, n) {
		if (A[i] > B[i]) {
			cout << -1 << endl;
			return 0;
		}
	}
	for (int i = 1; i < B.size()-1; ++i) {
		if (B[i] > B[i - 1] + B[i + 1]) {
			next_move.push(i);
		}
	}
	if (B[0] > B[1] + B[n - 1]) {
		next_move.push(0);
	}
	if (B[n - 1] > B[n - 2] + B[0]) {
		next_move.push(n - 1);
	}
	long long ans = 0;
	while (next_move.empty() == false) {
		int now = next_move.front();
		next_move.pop();
		if (A[now] == B[now]) continue;
		int right = (now + 1)%n;
		int left = (now + n - 1) % n;
		long long hoge = min((B[now] - A[now]) / (B[left] + B[right]), (B[now] - 1LL) / (B[left] + B[right]));
		ans += hoge;
		B[now] -= hoge * (B[left] + B[right]);
		if (B[left] > B[now] + B[(left + n - 1) % n]) {
			next_move.push(left);
		}
		if (B[right] > B[now] + B[(right + 1) % n]) {
			next_move.push(right);
		}
	}
	REP(i, n) {
		if (A[i] != B[i]) {
			cout << -1 << endl;
			return 0;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 4976
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	n, p := nextInt(), nextInt()

	pf := primeFactor(p)

	ans := 1
	for k, v := range pf {
		if v >= n {
			ans *= pow(k, v/n)
		}
	}

	puts(ans)
}

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func primeFactor(n int) map[int]int {
	m := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			m[i]++
			n /= i
		}
	}
	if n != 1 {
		m[n] = 1
	}
	return m
}

func pow(a, n int) int {
	ret := 1
	for n > 0 {
		if n&1 == 1 {
			ret *= a
		}
		a *= a
		n >>= 1
	}
	return ret
}


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

int main() {
	int array[3];

	for(int i=0; i<3; i++) {
		cin >> array[i];
	}
	sort(array, array+3);
	for(int i=0; i<3; i++) {
		cout << array[i];
		if(i == 2) {
			cout << endl;
		}else {
			cout << " ";
		}
	}

	return 0;
}


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

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

  string s;
  cin >> s;
  int ans = 0;
  int tmp = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
      tmp++;
    }
    else {
      ans = max(ans, tmp);
      tmp = 0;
    }
  }
  ans = max(ans, tmp);
  cout << ans << '\n';
}

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

// See debug.cc for usage etc
#define DEBUG 0

template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

#if DEBUG
  #define DLOG(...)        cerr << dbgFormat(__VA_ARGS__) << endl
  #define DCALL(func, ...) func(__VA_ARGS__)
#else
  #define DLOG(...)
  #define DCALL(func, ...)
#endif

enum EVtype { symS, symT, symX };

ll A, B, Q;
vector<ll> s, t, x;
vector<tuple<ll, EVtype, int>> ev;
vector <ll> v_p_s, v_p_t, v_n_s, v_n_t;

int main() {
#if !DEBUG
  ios_base::sync_with_stdio(false);
#endif

  cin >> A >> B >> Q;
  s.resize(A);
  for (int i = 0; i < A; i++) {
    cin >> s.at(i);
    ev.push_back(make_tuple(s.at(i), symS, 0));
  }
  t.resize(B);
  for (int i = 0; i < B; i++) {
    cin >> t.at(i);
    ev.push_back(make_tuple(t.at(i), symT, 0));
  }
  x.resize(Q);
  v_p_s.resize(Q);
  v_p_t.resize(Q);
  v_n_s.resize(Q);
  v_n_t.resize(Q);
  for (int i = 0; i < Q; i++) {
    cin >> x.at(i);
    ev.push_back(make_tuple(x.at(i), symX, i));
  }
  sort(ev.begin(), ev.end());
  ll prev_s = -2e10;
  ll prev_t = -2e10;
  vector <int> x_waiting_s;
  vector <int> x_waiting_t;
  for (auto e : ev) {
    DLOG("EVENT: %lld, %d, %d", get<0>(e), (int)get<1>(e), get<2>(e));
    if (get<1>(e) == symS) {
      for (int i : x_waiting_s)  v_n_s.at(i) = get<0>(e);
      x_waiting_s.resize(0);
      prev_s = get<0>(e);
    }else if (get<1>(e) == symT) {
      for (int i : x_waiting_t)  v_n_t.at(i) = get<0>(e);
      x_waiting_t.resize(0);
      prev_t = get<0>(e);
    }else { // e.second == symX
      int idx = get<2>(e);
      v_p_s.at(idx) = prev_s;
      v_p_t.at(idx) = prev_t;
      x_waiting_s.push_back(idx);
      x_waiting_t.push_back(idx);
    }
  }
  for (int i : x_waiting_s)  v_n_s.at(i) = 3e10;
  for (int i : x_waiting_t)  v_n_t.at(i) = 3e10;
  
  for (int i = 0; i < Q; i++) {
    DLOG("x.at(%d) = %lld, v_p_s = %lld, v_p_t = %lld, v_n_s = %lld, v_n_t = %lld", i, x.at(i), v_p_s.at(i), v_p_t.at(i), v_n_s.at(i), v_n_t.at(i));
    ll tx = x.at(i);
    ll cand1 = max(v_n_s.at(i), v_n_t.at(i)) - tx;
    ll cand2 = tx - min(v_p_s.at(i), v_p_t.at(i));
    ll cand3 = 5e10;
    if (v_n_s.at(i) < v_n_t.at(i) && v_p_s.at(i) < v_p_t.at(i)) {
      cand3 = v_n_s.at(i) - v_p_t.at(i)
	+ min(v_n_s.at(i) - tx, tx - v_p_t.at(i));
    }
    if (v_n_s.at(i) > v_n_t.at(i) && v_p_s.at(i) > v_p_t.at(i)) {
      cand3 = v_n_t.at(i) - v_p_s.at(i)
	+ min(v_n_t.at(i) - tx, tx - v_p_s.at(i));
    }
    DLOG("cand1 = %lld, cand2 = %lld, cand3 = %lld", cand1, cand2, cand3);
    cout << min(cand1, min(cand2, cand3)) << "\n";
  }

  return 0;
}



Measured memory_bytes: 15980
//exchange time
#include<stdio.h>

int main()
{

	int t,h,m,s;
	scanf("%d",&t);
	h=t/3600;
	m=(t%3600)/60;
	s=(t%3600)%60;

	printf("%d:%d:%d\n",h,m,s);
	
	return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <algorithm>
#include <string.h>
#include <cstdio>
#include <string>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
//#include <unordered_map>
#define Fbo friend bool operator < (node a, node b)
#define mem(a, b) memset(a, b, sizeof(a))
#define FOR(a, b, c) for (int a = b; a <= c; a++)
#define RFOR(a, b, c) for (int a = b; a >= c; a--)
#define off ios::sync_with_stdio(0)
#define sc(a) scanf("%lld",&a)
#define pr(a) printf("%d\n",a);
#define SC(n,m) scanf("%d%d",&n,&m)
bool check1(int a) { return (a & (a - 1)) == 0 ? true : false; }

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
const int INF = 0x3f3f3f3f;//1e10
const int mod = 1e9 + 7;
const int Maxn = 1e5 + 5;
const int M = Maxn * 20;
const double pi = acos(-1.0);
const double eps = 1e-8;

int main() {
    ll n, k, s;
    sc(n), sc(k), sc(s);
    for (int i = 1; i <= k; i++) {
        if (i == 1)printf("%d", s);
        else printf(" %d", s);
    }
    ll x = s + 1;
    if (s == 1000000000)x = s - 1;
    for (int i = 1; i <= n - k; i++) {
        if (k == 0) {
            if (i == 1)printf("%d", x);
            else printf(" %d", x);
        }
        else printf(" %d", x);
    }
}

Measured memory_bytes: 1280