akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <vector>
#include <functional>
using namespace std;
#define INF 1e+9
int dat[50][50]={};
int a,b,c;
int main(){
	int N;
	int v;
	while(1){
		v=0;
		cin>>N;
		if(N==0){
			break;
		}
	for(int i=0;i<50;i++){
            for(int j=0;j<50;j++){
                if(i==j){
			dat[i][j]=0;
		}
                else{
			dat[i][j]=INF;
		}
            }
        }
	for(int i=0;i<N;i++){
		cin>>a>>b>>c;
		dat[a][b]=c;
		dat[b][a]=c;
		v=max(max(v,a),b);
	}
	for(int k=0;k<=v;k++){
		for(int i=0;i<=v;i++){
			for(int j=0;j<=v;j++){
				dat[i][j]=min(dat[i][j],dat[i][k]+dat[k][j]);
			}
		}
	}
	int ans=INF,ansp;
	for(int i=0;i<=v;i++){
		int cnt=0;
		for(int j=0;j<=v;j++){
			cnt+=dat[i][j];
		}
		if(ans>cnt){
			ans=cnt;
			ansp=i;
		}
	}
	cout<<ansp<<" "<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1172
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll k = 1;
  ll n;std::cin >> n;
  for(;k*k<=n;k++) ;
  std::cout << (k-1)*(k-1) << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#define MAX 25010

using namespace std;

int k,sz,ia,n;
string s,sa;
string vs[MAX];

int main()
{
    cin>>s>>k;n=s.size();s="!"+s;
    for(int i=1;i<=n;i++){
      sa="";
      for(int sza=1;sza<=5&&i+sza-1<=n;sza++){
        sa+=s[i+sza-1];
        vs[++sz]=sa;
      }
    }
    sort(vs+1,vs+sz+1);
    for(int i=1;i<=sz;i++){
      if(vs[i]!=vs[i-1])ia++;
      if(ia==k){
        cout<<vs[i]<<'\n';
        return 0;
      }
    }
    return 0;
}


Measured memory_bytes: 1664
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    a, va = map(int, input().split())
    b, vb = map(int, input().split())
    T = int(input())
    if vb >= va:
        print("NO")
    else:
        if (va - vb) * T >= abs(a - b):
            print("YES")
        else:
            print("NO")


if __name__ == '__main__':
    main()


Measured memory_bytes: 62128
// This code writed by chtholly_micromaker(MicroMaker)
#include <bits/stdc++.h>
#define reg register
using namespace std;
template <class t> inline void rd(t &s)
{
	s=0;
	reg char c=getchar();
	while(!isdigit(c))
		c=getchar();
	while(isdigit(c))
		s=(s<<3)+(s<<1)+(c^48),c=getchar();
	return;
}
int a[100001];
signed main(void)
{
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=n;++i)
		cin>>a[i];
	reg int ans=0;
	for(int i=1;i<=n;++i)
		if(a[i]>=k)
			++ans;
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 640
package main

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

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 min(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v < ret {
			ret = v
		}
	}
	return ret
}

func max(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v > ret {
			ret = v
		}
	}
	return ret
}

func divFloor(a, b int) int {
	return (a + (b - 1)) / b
}

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

	cost := make([]int, 10001)
	for i := 1; i < len(cost); i++ {
		cost[i] = 1000000000
	}

	h, n := nextInt(), nextInt()

	for i := 0; i < n; i++ {
		a, b := nextInt(), nextInt()
		for j := 1; j <= h; j++ {
			// HPがjのときにダメージaを与えたときの残りHP
			rest := max(0, j-a)
			cost[j] = min(cost[j], cost[rest]+b)
		}
	}

	puts(cost[h])
}


Measured memory_bytes: 768
#include <iostream>
#include <string>
using namespace std;

#define MAX_LEN   10

int main(void) {
	string s;
	int len, pos;
	string ans = string(MAX_LEN, ' ');

	cin >> s;
	len = s.length();

	pos = 0;
	for (int i = 0; i < len; ++i) {
		if (s[i] != 'B') {
			ans[pos] = s[i];
			++pos;
		}
		else {
			if (pos > 0)
				--pos;
		}
	}
	ans.erase(pos);

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
  ll a;
  cin>>a;
  if(a<5)
    cout<<0;
else if(a>5&&a<500)
    cout<<a/5*5;
else {
    ll h=a%500;
    cout<<(a/500*1000)+(h/5*5);
}
return 0;}

Measured memory_bytes: 256
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

k,t = li()
a = list(li())

ans = 0

for ai in a:
    if  k%2 == 1 and ai > k//2 + 1:
        ans = (ai - (k//2+1)) * 2
            
    elif k%2 == 0  and ai > k//2:
        ans = 1 + (ai - (k//2+1)) * 2
        
print(ans)

Measured memory_bytes: 3064
n,k=map(int,input().split())
H=list(map(int,input().split()))

dp=[float('inf') for _ in range(n)]
dp[0]=0
for i,hi in enumerate(H[1:],1):
  s=max(0,i-k)
  dp[i]=min([aj + abs(hi-hj) for hj,aj in zip(H[s:i],dp[s:i])])
print(dp[-1])

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

using ll = long long;
using db = double;
using pll = pair < ll, ll >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std :: endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}
#else
#define trace(...)
#endif

#define pb push_back
#define mp make_pair
#define fastIo() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PI 3.141592653589793238

const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e6 + 10;

bool vis[N];
vector<ll>g[N];
ll depth[N];
ll parent[N];

void bfs(ll node){
	queue<ll>q;
	q.push(node);
	while(!q.empty()) {
		ll node = q.front();
		q.pop();
		vis[node] = 1;
		for(auto v: g[node]) {
			if(vis[v] || depth[v] <= depth[node]+1) continue;
			depth[v] = depth[node]+1;
			parent[v] = node;
			q.push(v);
		}
		vis[node] = 1;
	}
}

int main(){
	ll n, m; cin >> n >> m;
	for(ll i = 0; i < m; i++){
		ll a, b; cin >> a >> b;
		g[a].pb(b);
		g[b].pb(a);
	}
	fill(depth, depth + N, INF);
	depth[1] = 0;
	bfs(1);
	for(ll i = 1; i <= n; i++) {
		if(!vis[i]) {
			cout << "No\n";
			return 0;
		}
	}
	cout << "Yes\n";
	for(ll i = 2; i <= n; i++) {
		cout << parent[i] << endl;
	}
}

Measured memory_bytes: 42116
/*
    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;
ll modpow(ll a, ll b)
{
    if (b == 0)
        return 1;
    else if (b % 2 == 0)
    {
        ll d = modpow(a, b / 2) % MOD;
        return (d * d) % MOD;
    }
    else
    {
        return (a * modpow(a, b - 1)) % MOD;
    }
}

const int MAX_N = 1e6;

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

void calc(int n)
{
    fact[0] = finv[0] = 1;
    for (int i = 1; i <= n; i++)
    {
        fact[i] = (fact[i - 1] * i) % MOD;
        finv[i] = modpow(fact[i], MOD - 2);
    }
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    calc(MAX_N);
    ll h, w,a,b;
    cin>>h>>w>>a>>b;
    ll sum=0;
    rep3(i,b+1,w+1){
        ll temp = 1;
        ll x1 = i-1;
        ll y1 = h - a-1;
        //cout<<comb(1,1)<<endl;
        if(x1!=0&&y1!=0){
            temp *= comb(x1 + y1, x1);
        }
        ll x2 = (w - i);
        ll y2 = a-1;
        if(x2!=0&&y2!=0){
            temp *= comb(x2 + y2, x2);
        }
        temp %= MOD;
        sum+=temp;
      //  cout<<x1<<" "<<y1<<" "<<x2<<" "<<y2<<" "<<temp<<endl;
        sum%=MOD;
    }
    cout << sum << endl;
}


Measured memory_bytes: 15872
#include<stdio.h>
void Merge(int s[],int l,int r);
int temp[1000000];
int c=0;
int main(){
  int n,i,j,l,m,r,q;
  int a[1000000];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  Merge(a,0,n-1);
  for(i=0;i<n-1;i++){
    printf("%d ",a[i]);
  }
  printf("%d\n",a[n-1]);
  printf("%d\n",c);
  return 0;
}
void Merge(int x[],int left,int right){
  int mid,i,j,k;
  if(left>=right){
    return;
  }
  mid=(left+right)/2;
  Merge(x, left, mid);
  Merge(x, mid + 1, right);
  for (i = left; i <= mid; i++){
    temp[i] = x[i];
  }

  for (i = mid + 1, j = right; i <= right; i++, j--){
    temp[i] = x[j];
  }

  i = left;
  j = right;

  for (k = left; k <= right; k++){
    if (temp[i] <= temp[j]){
        x[k] = temp[i++];
        c++;
      }
    else{
        x[k] = temp[j--];
        c++;
      }
    }
}


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

int main() {
    int n, l;
    cin >> n >> l;

    int tot = 0;
    int minv = 1<<30;    
    rep(i,n) {
        tot += i+l;
        if (abs(i+l) < abs(minv)) minv = i+l;    
    }

    cout << tot - minv << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	String nis = sc.next();
	int now;
	int sum = 0;
	for (int i=0; i<nis.length(); i++) {
	    now = Character.getNumericValue(nis.charAt(i));
	    sum += now;
	}
	if (sum % 9 == 0) System.out.print("Yes");
	else { System.out.print("No"); }
    }
}


Measured memory_bytes: 40496
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
int n;
map<string,int>mp;
string st[N];
int main()
{
    cin>>n;
    for(int i=1;i<=n;++i) cin>>st[i],mp[st[i]]++;
    int sur=0;
    for(int i=1;i<=n;++i) sur=max(sur,mp[st[i]]);
    sort(st+1,st+n+1);
    for(int i=1;i<=n;++i) 
    {
        if(mp[st[i]]==sur)
        {
            cout<<st[i]<<endl;
            mp[st[i]]=0;
        }
    }
    return 0;
}

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

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

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2017/12/04  Problem: codefestival2017_team_relay D / Link: __CONTEST_URL__  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,s,t) for(int (i)=(s);(i)<(t);(i)++)



/* Union Find */
struct UnionFind {
	vector<int> data;
	UnionFind(int n) { data.assign(n, -1); }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool same(int x, int y) { return root(x) == root(y); }
	int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
	int size(int x) { return -data[root(x)]; }
};
// UnionFind uf(n); uf.unionSet(i,j); if(uf.same(x,y))



LL N,M;

LL ans = 0LL;


void dfs(int v,int p , VI& used, VVI &G){
	used[v] = 1;
	FOR(i,0,SZ(G[v])){
		if(p!=G[v][i]&&used[G[v][i]]==0)
			dfs(G[v][i],v,used,G);
	}
	
}


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

	cin >> N >> M;
	UnionFind uf(N);
	LL ret = 0;
	vector<vector<int > >G(N,VI());
	FOR(i, 0, M){
		int a, b; cin>> a >> b;
		a--;b--;
		G[a].push_back(b);
		G[b].push_back(a);
		uf.unionSet(a,b);
	}
	
	VI used(N,0);
	priority_queue<PLL>q;
	VI aa(2,0);
	FOR(i,0,N){
		if(used[i]==1)continue;
		LL S = uf.size(i);
		dfs(i,-1,used,G);
		ret += S*(S-1)/2LL;
		if(i>=2)q.push(PII(S,i));
		else aa[i] = S;
		//debug(S);
		//debug(i);
		used[i]=1;
	}
	//debug(aa[0]);
	//debug(aa[1]);
	int id = aa[1]>aa[0];
	q.push(PII(aa[id],id));
	//  ０，１に気をつけながらでっかいものにマージ
	while(q.size()>1){
		PII a = q.top();q.pop();
		PII b = q.top();//q.pop();
		
		int as = a.first;
		int av = a.second;
		int bs = b.first;
		int bv = b.second;
		if((av ==0 && bv==1)||(av ==1 && bv == 0)){
			q.push(a);
		}else {
			q.pop(); // b
	//		cout<<av<<";"<<as<<"--"<<bv<<";"<<bs<<endl;
			ret += as* bs;
			q.push(PII(as+bs,min(av,bv)));
		}
		
	}
	
	// つかったものは使わない
	
	ans = ret - M;
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 12800
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

vector<int> get_primes(int N) {
    vector<int> res;
    for(int i=2; i*i<=N; i++) {
        if(N % i == 0) {
            res.push_back(i);
            while(N % i == 0) N /= i;
        }
    }
    if(N > 1) res.push_back(N);
    return res;
}

bool expr_div(const vector<int> &A, const int &p) {
    int N = A.size();
    vector<int> vec(p);
    for(int i=1; i<N; i++) {
        int mo = (A[i] >= 0 ? A[i] : p - (-A[i] % p));
        (vec[i % (p - 1)] += mo) %= p;
    }

    bool all_zero = true;
    for(int i=0; i<p; i++) {
        // fprintf(stderr, "p = %lld, vec[%lld] = %lld\n", p, i, vec[i]);
        all_zero &= (vec[i] == 0);
    }
    return all_zero;
}

// エラトステネスの篩
// [0,n) の範囲の i について、primes[i] != 0 ⇔ i は素数
vector<int> erat(int n) {
    vector<int> primes(n);
    for (int i = 2; i < n; ++i) primes[i] = i;
    for (int i = 2; i*i < n; ++i)
        if (primes[i])
            for (int j = i*i; j < n; j+=i) primes[j] = 0;
    // 素数のみをvectorに格納する場合は以下の行を追加 (0 である要素を全削除)
    primes.erase(remove(primes.begin(), primes.end(), 0), primes.end());
    return primes;
}

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

    int g = 0;
    set<int> ans;
    vector<int> primes = erat(N+2);
    for(int i=N; i>=0; i--) {
        cin >> A[i];
        g = __gcd(g, abs(A[i]));
    }
    
    vector<int> p0 = get_primes(g);
    for(auto e : p0) ans.insert(e);

    for(auto e : primes) {
        if(A[0] % e != 0) continue;
        if(expr_div(A, e)) ans.insert(e);
    }

    for(auto e : ans) cout << e << endl;
    return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;
int main()
{
	int n; cin>>n;
	double x[6], y[6];
	for(int i=0; i<3; i++){
		x[i]=y[i]=-1e10, x[i+3]=y[i+3]=1e10;
	}
	for(int i=0; i<n; i++){
		char d; double xi, yi; cin>>xi>>yi>>d;
		if(d=='R'){
			x[0]=max(x[0], xi), x[3]=min(x[3], xi), y[2]=max(y[2], yi), y[5]=min(y[5], yi);
		}else if(d=='L'){
			x[1]=max(x[1], xi), x[4]=min(x[4], xi), y[2]=max(y[2], yi), y[5]=min(y[5], yi);
		}else if(d=='U'){
			y[0]=max(y[0], yi), y[3]=min(y[3], yi), x[2]=max(x[2], xi), x[5]=min(x[5], xi);
		}else{
			y[1]=max(y[1], yi), y[4]=min(y[4], yi), x[2]=max(x[2], xi), x[5]=min(x[5], xi);
		}
	}
	double ans=1e18;
	for(int i=0; i<=200000000; i++){
		double t=(double)i/2;
		double xmx=max({x[0]+t, x[1]-t, x[2]}), xmn=min({x[3]+t, x[4]-t, x[5]});
		double ymx=max({y[0]+t, y[1]-t, y[2]}), ymn=min({y[3]+t, y[4]-t, y[5]});
		ans=min(ans, (xmx-xmn)*(ymx-ymn));
	}
	printf("%.10lf\n", ans);
	return 0;
}

Measured memory_bytes: 384
from collections import *
import sys
try: inp = raw_input
except: inp = input
def err(s):
    sys.stderr.write('{}\n'.format(s))

def ni():
    return int(inp())

def nl():
    return [int(_) for _ in inp().split()]

N, K = nl()

MOD = 10**9 + 7
su = 0


sm = 0
muls = [0]*(K+1)
for k in range(K, 0, -1):
    sels = K//k
    pw = pow(sels, N, MOD)
    for mk in range(2*k, K+1, k):
        pw -= muls[mk]
    muls[k] = pw%MOD
    sm += pw*k%MOD

print(sm%MOD)

    



Measured memory_bytes: 72840
import java.util.Scanner;
import java.util.Arrays;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int L = Integer.parseInt(sc.next());
    String[] strs = new String[N];
    int i;
    for(i=0;i<N;i++){
      strs[i] = sc.next();
    }
    Arrays.sort(strs);
    StringBuilder sb = new StringBuilder();
    for(i=0;i<N;i++){
      sb.append(strs[i]);
    }
    System.out.print(sb.toString());
    System.out.flush();
  }
}


Measured memory_bytes: 22612
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int N = 400000;
const int K = 60;
const int mod = 1e9 + 7;
int a[N], used[N];
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
  //  freopen("input.txt", "r", stdin);
    int n;
    cin >> n;
    int tx = 0;
    for (int i = 1; i <= n; i++){
        cin >> a[i];
        tx ^= a[i];
    }
    int ans = 0;
    for (int i = 1; i <= n; i++){
        ans = max(ans, (tx ^ a[i]) + a[i]);
    }
    vector < int > o;
    for (int i = K - 1; i >= 0; i--){
        if ((1LL << i) & tx) continue;
        o.pb(i);
    }
    for (int q = 0; q < o.size(); q++){
        int i = o[q];
       //cout << i << endl;
        for (int j = 1; j <= n; j++){
            if (!used[j] && (a[j] & (1LL << i))){
                for (int l = 1; l <= n; l++){
                    if (a[l] & (1LL << i)){
                        if (j == l) continue;
                        a[l] ^= a[j];
                    }
                }
            //    cout << j << " " << a[j] << endl;
                used[j] = 1;
                break;
            }
        }
    }
    int x = 0;
    int cnt = 0;
    for (int j = 1; j <= n; j++){
        if (used[j]){
          //  cout << a[j] << endl;
            x ^= a[j];
            cnt++;
        }
    }
   // cout << x << endl;
   // cout << tx << endl;
   // cout << (x ^ tx) << endl;
    ans = max(ans, (tx ^ x) + x);
    cout << ans;
}


Measured memory_bytes: 2304
import std.stdio, std.string, std.algorithm, std.range, std.conv;

void main() {
  long H, W;
  readf(" %d %d ", &H, &W);
  
  bool[][] M;
  M.length = H; 
  foreach (ref r; M) {
    r = readln.map!(x => x != '#').array;
  }
  
  long[][] dp;
  dp.length = H;
  foreach (ref x; dp) x.length = W;
  
  foreach (x; 0..W) {
    if (!M[0][x]) break;
    dp[0][x] = 1;
  }
  foreach (y; 0..H) {
    if (!M[y][0]) break;
    dp[y][0] = 1;
  }
  
  foreach (y; 1..H) foreach (x; 1..W) {
    if (M[y][x]) {
      dp[y][x] = (dp[y-1][x] + dp[y][x-1])%1000000007;
    }
  }
  dp[$-1][$-1].writeln;
}

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

inline int read()
{
	int x=0,f=1,c=getchar();
	while(c<48) c=='-'&&(f=-1),c=getchar();
	while(c>47) x=x*10+c-'0',c=getchar();
	return x*f;
}

typedef long long ll;
const int MAXN = 1005;
const char ch[4]= {'L','R','D','U'};
const int dx[4]= {-1,1,0,0},dy[4]= {0,0,-1,1};
std::vector<int> c;
int x[MAXN],y[MAXN],n;

int main(int argc, char const *argv[])
{
	n=read();
	for(int i=1; i<=n; ++i) 
		x[i]=read(),y[i]=read();
	for(int i=2; i<=n; ++i)
		if((abs(x[i]+y[i])&1)!=(abs(x[1]+y[1])&1))
			return puts("-1"),0;
	for(int i=30; ~i; --i) c.push_back(1<<i);
	if(!(abs(x[1]+y[1])&1)) c.push_back(1);
	printf("%lu\n",c.size());
	for(int i:c) printf("%d ",i); puts("");
	for(int i=1; i<=n; ++i)
	{
		ll nx=0,ny=0;
		for(int j:c)
		{
			vector<pair<ll,int>> tmp;
			for(int d=0; d<4; ++d)
			{
				ll tx=nx+dx[d]*j,ty=ny+dy[d]*j;
				tmp.push_back(make_pair(abs(x[i]-tx)+abs(y[i]-ty),d));
			}
			sort(tmp.begin(),tmp.end());
			int d=tmp.begin()->second;
			putchar(ch[d]),nx+=dx[d]*j,ny+=dy[d]*j;
		}
		puts("");
	}
	return 0;
}

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

int main(){
  int z;

  while(cin >> z,z){
    long long ans = -1,z3 = z*z*z,res=9999999;    

    for(long long i = z-1 ; i >= 0 ; i--){
      for(long long j = z-1 ; j >= 0 ; j--){
	ans = max(ans,i*i*i+j*j*j);
	if(ans <= z3){
	  res = min(res,z3-ans);
	}
	else ans = -1;
      }
    }
    cout << res << endl;
  }

  return 0;
}

Measured memory_bytes: 1156
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n;
  scanf("%d", &n);
  vector<ii> a(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i].first);
    a[i].second = i + 1;
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < n; ++i) {
    printf("%d%c", a[i].second, " \n"[i + 1 == n]);
  }
  return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,a,b) for (int i = (a); i < (b); i++ )
typedef pair<int,int> P;
typedef long long ll;
const int INF = 100000000;


int main (){
    ll N;
    cin >> N;
    ll a[N+1];
    ll b[N];
    ll tot = 0;
    rep(i,0,N+1) {
        cin >> a[i];
        tot += a[i];
    }
    rep(i,0,N) {
        cin >> b[i];
    }

    ll tmp;
    ll res = 0;
    rep(i,0,N) {
        a[i]-=res;
        if(a[i]<=0) {
            res = b[i];
            a[i]=0;
        }
        else {
            res = b[i]-a[i];
            a[i]-=b[i];
            if (res<=0) {
                res = 0;
            }
            if (a[i]<=0) {
                a[i]=0;
            }
        }
    }
    a[N]-=res;
    if (a[N]<=0) {
        a[N] = 0;
    }
    ll ans = 0;
    rep(i,0,N+1) {
        ans += a[i];
    }
    ans = tot-ans;
    cout << ans << endl;
}




Measured memory_bytes: 1792
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <limits.h>
#include <cstring>
#include <iostream>
#define REP(i,n) for(int i=0;i<n;++i)
#define pb push_back
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef map<int,int> mii;
typedef pair<int,int> pii;
const int inf=1<<30;
const int INF=INT_MAX;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
const int d[]={0,1,0,-1,0};//int nx=x+d[i],ny=y+d[i+1]

int digit, ans;
string s;
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> s;
  digit = 1;
  ans = 0;
  while(digit < s.length() && s.length() > 1) {
    if(s[digit] != s[digit - 1]) {
        ans += 2;
        s.erase(s.begin() + digit - 1, s.begin() + digit + 1);
        digit = max(1, digit - 1);
    } else {
        ++digit;
    }
  }
    
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int a,b;
  cin>>a>>b;
  a+=b;
  if(a+b%2!=0){
    a++;
  }
  cout<<a/2<<"\n";
  return 0;
  }

Measured memory_bytes: 3540
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1ll << 60;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N;
ll A[int(2e5+5)], I[int(2e5+5)], J[int(2e5+5)];

int main(){
  scanf("%d", &N);
  for (int i = 0; i < N; i++) scanf("%lld", A + i);

  for (ll i = 0; i < N; i++){
    I[i] = A[i] + i;
    J[i] = i - A[i];
  }
  sort(I, I + N);
  sort(J, J + N);

  ll ans = 0;
  for (int i = 0; i < N; i++){
    ans += upper_bound(J, J + N, I[i]) - lower_bound(J, J + N, I[i]);
  }
  cout << ans << endl;

  return 0;
}


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

const int MOD = 1e9 + 7;
int N , arr[100003];

int poww(long long a , int b){
	int times = 1;
	while(b){
		if(b & 1) times = times * a % MOD;
		a = a * a % MOD; b >>= 1;
	}
	return times;
}

int main(){
	cin >> N;
	for(int i = 1 ; i <= N ; ++i) cin >> arr[i];
	int sum = 1 , ans = 0;
	for(int i = 2 ; i <= N ; ++i){
		ans = (ans + 1ll * sum * (arr[i] - arr[i - 1])) % MOD;
		sum = (sum + poww(i , MOD - 2)) % MOD;
	}
	for(int i = 1 ; i < N ; ++i) ans = 1ll * ans * i % MOD;
	cout << ans;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  int a, b, c ,d;
  cin >> a >> b >> c >> d;
  if(a+b > c+d){
    cout << "Left" << endl;
  }else if(a+b == c+d){
    cout << "Balanced" << endl;
  }else{
    cout << "Right" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <array>
#include <map>
using namespace std;
map<int,array<int,1260-540+1>> imos;

int main(){
    int N,M;
    while(cin>>N>>M,N){
        imos.clear();
        int r;
        cin>>r;
        for(int i=0;i<r;i++){
            int t,n,m,s;
            cin>>t>>n>>m>>s;
            t-=540;
            if(imos.find(m)==imos.end()){
                imos[m];
            }
            if(s){
                imos[m][t]++;
            }else{
                imos[m][t]--;
            }
        }

        for(auto &e:imos){
            auto &v=e.second;
            for(int i=1;i<=1260-540;i++){
                v[i]+=v[i-1];
            }
        }

        int q;
        cin>>q;
        for(int i=0;i<q;i++){
            int ts,te,m;
            cin>>ts>>te>>m;
            ts-=540; te-=540;
            int cnt = 0;
            for(int t=ts;t<te;t++) cnt+=!!imos[m][t];
            cout<<cnt<<endl;
        }
    }
}

Measured memory_bytes: 3360
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
 
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
  ll N; cin >> N;
  if(N&1) cout << 2*N << endl;
  else cout << N << endl;
  return 0;
}

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

using namespace std;
using i64 = long long;
const i64 MOD = 1000000007;

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> f(h);
    for(int y=0; y<h; y++) cin >> f[y];
    vector<vector<i64> > dp(h, vector<i64>(w, 0));
    dp[0][0] = 1;
    for(int x=1; x<w; x++) dp[0][x] = (f[0][x]=='#') ? 0 : dp[0][x-1];
    for(int y=1; y<h; y++) dp[y][0] = (f[y][0]=='#') ? 0 : dp[y-1][0];
    for(int y=1; y<h; y++) {
        for(int x=1; x<w; x++) {
            dp[y][x] = (f[y][x]=='#') ? 0 : ((dp[y-1][x] + dp[y][x-1]) % MOD);
        }
    }
    cout << dp[h-1][w-1] << endl;
}

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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

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

    stack<char> st;
    int ans = 0;
    rep(i, s.size()) {
        if (st.size() > 0) {
            char ch = st.top();
            if (ch != s[i]) {
                ans += 2;
                st.pop();
            }
            else {
                st.push(s[i]);
            }
        }
        else {
            st.push(s[i]);
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int main(){
  ll t;
 // cin>>t;
 // while(t--){
  ll a,b=0,c=0,d=0,e=0;
  cin>>a>>b>>c;
    if(a%b!=0){
      d=(a/b)+1;
    }
    else{d=(a/b);}
    cout<<c*d<<endl;
 // }
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    // 無限回テレポートできるので，左から順々に訪ねていって逐一コスト比較するだけ
    ll N, A, B; cin >> N >> A >> B;
    vector<ll> x(N); rep(i, N){cin >> x.at(i);}
    ll cost = 0;
    rep(i, N - 1){
        ll dist = x.at(i + 1) - x.at(i);
        cost += (A * dist >= B) ? B : (A * dist);
    }
    cout << cost << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef pair<int,int> P;
bool sob(P x1,P x2){return x1.second> x2.second;};
bool sox(P x1,P x2){return x1.first< x2.first;};
int main(){
  int n;
  cin >> n;
  int ans=0;
  vector <pair<int,int>> r(n);
  vector <pair <int,int>> b(n);
  int a[n];
  for(int i=0;i<n;i++){
    cin >> r[i].first>> r[i].second;
    a[i]=1;
  }
  for(int i=0;i<n;i++){
    cin >> b[i].first>>b[i].second;
  }
  sort(b.begin(),b.end(),sox);
  sort(r.begin(),r.end(),sob);
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
    if(a[j]==1){
    if(b[i].first>r[j].first&&b[i].second>r[j].second){
      ans++;
      a[j]=0;
      break;
    }
  }
  }
}
  cout <<ans <<endl;
}


Measured memory_bytes: 256
#from math import sqrt
#from heapq import heappush, heappop
#from collections import deque


def cost(X, p):
    c = 0
    for x in X:
        d = x - p
        c += d * d
    return c


def main():
    N = int(input())
    X = list(map(int, input().split()))

    total = sum(X) // N

    c1 = cost(X, total)
    c2 = cost(X, total + 1)

    if c1 > c2:
        print(c2)
    else:
        print(c1)


main()


Measured memory_bytes: 3060
import bisect

n = int(input())
l = list(map(int, input().split()))

l.sort()
ans = 0
for i in range(n - 2):
    a = l[i]
    for j in range(i + 1, n - 1):
        b = l[j]
        ans += bisect.bisect_left(l, a + b) - j -1
print(ans)


Measured memory_bytes: 3188
using System;
using System.Collections.Generic;
using System.Linq;

public class Solution
{
    public static void Main()
    {
        var vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var n = vals[0];
        var m = vals[1];
        var edges = n - 1 + m;
        var upper = Enumerable.Range(0, n + 1).Select(_ => new List<int>()).ToArray();
        var lower = Enumerable.Range(0, n + 1).Select(_ => new List<int>()).ToArray();
        var hasParent = new bool[n + 1];
        for (int i = 0; i < edges; i++)
        {
            vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var a = vals[0];
            var b = vals[1];
            upper[b].Add(a);
            lower[a].Add(b);
        }

        var root = Enumerable.Range(1, n).First(x => upper[x].Count == 0);
        var queue = new Queue<int>();
        queue.Enqueue(root);
        while (queue.Count > 0)
        {
            var p = queue.Dequeue();
            foreach (var child in lower[p])
            {
                if (upper[child].Count == 1)
                {
                    queue.Enqueue(child);
                }
                else
                {
                    upper[child].Remove(p);
                }
            }
        }

        upper[root].Add(0);
        var answer = string.Join(Environment.NewLine, upper.Skip(1).Select(u => u[0]));
        Console.WriteLine(answer);
    }
}

Measured memory_bytes: 41128
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,M,X;
  cin>>N>>M>>X;
  vector<int> a(M);
  for(int i=0;i<M;i++){
    cin>>a.at(i);
  }
  sort(a.begin(),a.end());
  int count=0;
  for(int x:a){
    if(x<X){
      count++;
    
    }
  }
  cout<<min(count,M-count)<<endl;
}

Measured memory_bytes: 3628
import java.util.*;
import java.awt.geom.Point2D.Double;

public class Main {
        static void koch(int n, Double a, Double b) {
            if (n == 0) return;

            Double s = new Double();
            Double t = new Double();
            Double u = new Double();
            double th = Math.PI * 60.0 / 180.0;

            s.setLocation((2.0 * a.getX() + 1.0 * b.getX()) / 3.0,
                        (2.0 * a.getY() + 1.0 * b.getY()) / 3.0);
            t.setLocation((1.0 * a.getX() + 2.0 * b.getX()) / 3.0,
                        (1.0 * a.getY() + 2.0 * b.getY()) / 3.0);
            u.setLocation((t.getX() - s.getX()) * Math.cos(th) - (t.getY() - s.getY()) * Math.sin(th) + s.getX(),
                (t.getX() - s.getX()) * Math.sin(th) + (t.getY() - s.getY()) * Math.cos(th) + s.getY());

            koch(n - 1, a, s);
            System.out.println(String.format("%.8f %.8f", s.getX(), s.getY()));
            koch(n - 1, s, u);
            System.out.println(String.format("%.8f %.8f", u.getX(), u.getY()));
            koch(n - 1, u, t);
            System.out.println(String.format("%.8f %.8f", t.getX(), t.getY()));
            koch(n - 1, t, b);
        }

    public static void main(String[] args) throws Exception {
            Double a = new Double(0, 0);
            Double b = new Double(100, 0);
            int n;

            Scanner sc = new Scanner(System.in);
            n = Integer.parseInt(sc.next());
            sc.close();

            System.out.println(String.format("%.8f %.8f", a.getX(), a.getY()));
            koch(n, a, b);
            System.out.println(String.format("%.8f %.8f", b.getX(), b.getY()));
    }
}



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

int main(void){
    string s, str = "CODEFESTIVAL2016";
    int ans = 0;
    cin >> s;
    for (int i=0; i<16; i++){
        if (s[i] != str[i]){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;

int main() {
	int n;
	double m;
	cin >> n;
	m = 100000;
	for (int i = 0;i < n;i++) {
		m = m*1.05;
		if ((int)m % 1000 != 0)
			m = m - (int)m % 1000 + 1000;
	}
	cout << (long int)m << endl;
}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long min = sc.nextLong();
		long max = sc.nextLong();
		if(n==1&&min==max){
			System.out.println(1);
		}else if(min > max || n < 2) {
			System.out.println(0);
		} else {
			System.out.println((max-min)*(n-1)-max+min+1L);
		}
	}
}

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    string S;
    cin >> S;
    REP(i, S.length()) {
        cout << "x";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int time,abcd,abcd2,hitu;
	while(1){
		int goukei=0;
		cin>>hitu;
		if(hitu==0)break;
		cin>>time;
		for(int abc=0;abc<time;abc++){
			cin>>abcd>>abcd2;
			goukei+=abcd2-abcd;
		}
		if(hitu<=goukei){
			cout<<"OK"<<endl;
		}else{
			cout<<hitu-goukei<<endl;
		}
	}
	return 0;
}

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

int main() {
    ll n, A[5];
    cin >> n;
    rep(i, 5) cin >> A[i];
    ll minMove = *min_element(A, A + 5);
    ll ans = ceil((double)n / minMove) + 4;
    cout << ans << endl;
}

Measured memory_bytes: 764
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"

using namespace std;

const long long  int MOD = 1000000007;
//const int MOD = 998244353;

long long int N, M, K, H, W, L, R;
//int N, M, K, H, W, L, R

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

	string s;
	cin >> s;
	string t = "2019/04/30";
	if (s <= t)cout << "Heisei\n";
	else cout << "TBD\n";
	return 0;
}

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

int main()
{
	int N, K, R, S, P;
	string T;
	cin >> N >> K >> R >> S >> P >> T;
	
	string hands = "";
	for (int i = 0; i < K; ++i)
		hands += T[i];
	
	for (int i = K; i < N; ++i)
	{
		if (T[i] != hands[i - K])
			hands += T[i];
		else
			hands += 'X';
	}
	
	int ans = 0;
	for (int i = 0; i < N; ++i)
	{
		if (hands[i] != 'X')
		{
			if (hands[i] == 'r')
				ans += P;
			else if (hands[i] == 's')
				ans += R;
			else
				ans += S;
		}
	}
	
	cout << ans << '\n';
}


Measured memory_bytes: 512
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String a=scan.next();
		String b=scan.next();
		String c=scan.next();
		if(a.charAt(a.length()-1)==b.charAt(0)&&b.charAt(b.length()-1)==c.charAt(0)) {
			System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}
		}
}

Measured memory_bytes: 21716
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <string>

using namespace std;

int main()
{
    int H, N;
    cin >> H >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

    int sum = 0
        ;
    for (int j = 0; j < N; j++) sum += A[j];

    string ans = "No";
    if (sum >= H) ans = "Yes";


    cout << ans  << endl;
    
}


Measured memory_bytes: 640
s = input()
t = input()

ans = len(t)

for i in range(len(s)-len(t)+1):
  si = s[i:i+len(t)]
  cnt = 0
  if len(si) == len(t):
    for sii, ti in zip(si, t):
      if sii != ti:
        cnt += 1
    ans = min(ans, cnt)
print(ans)
  


Measured memory_bytes: 67744
import bisect
n=int(input())
a = list(map(int,input().split()))	
b = list(map(int,input().split()))	
c = list(map(int,input().split()))

a.sort()
b.sort()
c.sort()

d = []
e = []

for i in range(n):
    k = bisect.bisect_left(a,b[i])
    d.append(k)

for i in range(n):
    k = bisect.bisect_right(c,b[i])
    e.append(n-k)
    
#print(d)
#print(e)

ass = 0
for i in range(n):
    ass += d[i]*e[i]

print(ass)

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

#define FOR(i, j, k) for (int i = j; i < k; i++)
#define REP(i, j) FOR(i, 0, j)
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;

  ll K, A, B;
  cin >> K >> A >> B;

  ll k = K;

  ll res = 0;

  if (A >= B) {
    cout << K + 1 << endl;
    return 0;
  } else {
    K -= A - 1;
    res = A;
    while (K >= 2) {
      res += B - A;
      K -= 2;
    }

    if (K == 2)
      res += B - A;
    else if (K == 1)
      res += 1;

    cout << max(k + 1, res) << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;

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

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
const long long INF = 1LL << 60;
// spring s; cin >> s;
// cout << res << endl;
// --------write my code!!!!!----------//

// I'm trying to ~~~
int main(){
    int A,B; cin >> A >> B;
    cout << A-B+1 << endl;

}


Measured memory_bytes: 256
// std::set を用いた解
#include <bits/stdc++.h>
using namespace std;

int main() {
  string s;
  cin>>s;
  for(char i='a';i<='z';i++){
    bool f=false;
    for(int j=0;j<s.size();j++){
      if(i==s[j]){
        f=true;
      }
    }
    if(!f){
      cout<<i<<endl;
      return 0;
    }
  }
  cout<<"None"<<endl;
}



Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int n,i,j,k,ans=1e9;
int x[101];
int main(){
    cin>>n;
    for(i=1;i<=n;i++)cin>>x[i];
    for(i=1;i<=100;i++){
        for(j=1;j<=n;j++)k+=(x[j]-i)*(x[j]-i);
        ans=min(ans,k);
        k=0;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Scanner;

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

                int N = scan.nextInt();

                HashMap<Integer, Integer> AHash = new HashMap<Integer, Integer>();
                long Asum = 0;

                for (int n = 0; n < N; n++) {
                	int temp = scan.nextInt();
                	if (AHash.containsKey(temp)) {
                		AHash.put(temp, AHash.get(temp) + 1);
                	} else {
                		AHash.put(temp, 1);
                	}
                	Asum += temp;
                }

                int Q = scan.nextInt();

                long[] output = new long[Q];

                for (int q = 0; q < Q; q++) {

                	int B = scan.nextInt();
                	int C = scan.nextInt();

                	if (AHash.containsKey(B)) {
                		Asum += (long)(C - B) * AHash.get(B);
                		if (AHash.containsKey(C)) {
                			AHash.put(C, AHash.get(C) + AHash.get(B));
                		} else {
                			AHash.put(C, AHash.get(B));
                		}
                		AHash.remove(B);
                	}

                	output[q] = Asum;

                }

                for (long asum: output) {
                	System.out.println(asum);
                }

                scan.close();

        }
}

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

main() {
  int X, A, B; cin >> X >> A >> B;
  if (B <= A) {
    cout << "delicious" << endl;
  } else if (B <= A + X) {
    cout << "safe" << endl;
  } else {
    cout << "dangerous" << endl;
  }
}


Measured memory_bytes: 256