akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef pair<double,double> PD;
typedef pair<int,P> ed;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 998244353;
const double eps = 1e-10;

struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%MOD+MOD)%MOD){}
  mint& fix() { x = (x%MOD+MOD)%MOD; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=MOD) x-=MOD; return *this;}
  mint& operator-=(const mint& a){ if((x+=MOD-a.x)>=MOD) x-=MOD; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=MOD; return *this;}
  mint operator^(int b) {mint res = 1;while(b > 0) {if(b&1) {res = (res*(*this));}*this=(*this)*(*this);b>>=1;} return res;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
typedef vector<mint> vm;
typedef vector<vm> vvm;
  
int main() {
  int N,s;
  cin >> N >> s;
  vi A(N);
  rep(i,N) {
    cin >> A[i];
  }
  vvm dp(s+1,vm(3,0));
  dp[0][0] = 1;
  rep(i,N) {
    vvm dp2(s+1,vm(3,0));
    rep(j,s+1) {
      dp2[j][0]+=dp[j][0];
      dp2[j][1]+=dp[j][0]+dp[j][1];
      dp2[j][2]+=dp[j][0]+dp[j][1]+dp[j][2];
      if (j+A[i] <= s) {
        dp2[j+A[i]][1] += dp[j][0]+dp[j][1];
        dp2[j+A[i]][2] += dp[j][0]+dp[j][1];
      }
    }
    dp = dp2;
  }
  cout << dp[s][2].x << endl;
  return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<string.h>
#include<complex>
using namespace std;
typedef long long int llint;
int main(){
	int a, b, c;
	cin >> a >> b;
	if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0){
		cout << "Possible" << endl;
	}
	else{
		cout << "Impossible" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  long long int n, k, q;
  cin>>n>>k>>q;
  vector<long long int> p(n,0);
  for(long long int i=0;i<q;i++){
    long long int s;
    cin>>s;
    p[s-1]++;
  }
  for(long long int x:p){
    if(k-q+x>0){
      cout<<"Yes"<<endl;
    }
    else{
      cout<<"No"<<endl;
    }
  }
  //cout<< <<endl;
}

Measured memory_bytes: 1408
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
using namespace std;
int dist[13][100005], n, m, q, a, b, c[100005]; vector<int>x[100005];
int main() {
	cin >> n >> m;
	for (int i = 1; i <= n; i++) { for (int j = 0; j < 13; j++)dist[j][i] = 0; }
	for (int i = 0; i < m; i++) { cin >> a >> b; x[a].push_back(b); x[b].push_back(a); }
	cin >> q;
	for (int i = 1; i <= q; i++) { cin >> a >> b >> c[i]; dist[b][a] = max(dist[b][a], i); }
	for (int i = 10; i >= 1; i--) {
		for (int j = 1; j <= n; j++) {
			for (int k = 0; k < x[j].size(); k++) {
				dist[i - 1][x[j][k]] = max(dist[i - 1][x[j][k]], dist[i][j]);
			}
		}
	}
	for (int i = 1; i <= n; i++) {
		int maxn = 0; for (int j = 0; j <= 10; j++)maxn = max(maxn, dist[j][i]);
		cout << c[maxn] << endl;
	}
	return 0;
}

Measured memory_bytes: 12024
#include <iostream>

int divided_by_2_count(int num)
{
  int count = 0;
  while(num % 2 == 0)
  {
    num /= 2;
    count++;
  }
  
  return count;
}

int main()
{
  int N, result = 1, max_count = 0;
  std::cin >> N;
  
  for(int i = 1; i <= N; i++)
  {
    int count = divided_by_2_count(i);
    if(count > max_count)
    {
      max_count = count;
      result = i;
    }
  }
  
  std::cout << result;
  return 0;
}

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

int main() {
#ifdef HOME
	freopen("abc86a.in", "r", stdin);
	freopen("abc86a.out", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	long long a, b;

	cin >> a >> b;
	cout << (a * b % 2 ? "Odd" : "Even") << endl;

	return 0; }


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	var d int

	fmt.Scan(&n)
	fmt.Scan(&d)

	k := 2*d + 1
	var ans int

	if n%k == 0 {
		ans = n / k
	} else {
		ans = n/k + 1
	}

	fmt.Println(ans)
}


Measured memory_bytes: 1764
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int n;
vector<string> s;

int get(int line){
    int res = 0;
    int i = 0;
    while(s[line][i++] == '.') res++;
    return res;
}

int calc(int& line,int depth){
    if(s[line][depth] == '+'){
        int ret = 0;
        line++;
        while(line < n and get(line) == depth+1){
            ret += calc(line,depth+1);
        }
        return ret;
    }else if(s[line][depth] == '*'){
        int ret = 1;
        line++;
        while(line < n and get(line) == depth+1){
            ret *= calc(line,depth+1);
        }
        return ret;
    }else{
        return s[line++][depth] - '0';
    }
}

void solve(){
    int line = 0;
    int ans = calc(line,0);
    cout << ans << endl;
}

int main(){
    while(1){
        cin >> n;
        if(!n) break;
        s.resize(n);
        rep(i,n){
            cin >> s[i];
        }
        solve();
    }
}



Measured memory_bytes: 3192
use std::fmt::Write;

fn main(){
    let mut sc = Scanner::new();
    let n = sc.next();
    let mut x = vec![0i64; n];
    for i in 0..n {
        x[i] = sc.next();
    }
    let mut d = vec![0i64; n-1];
    for i in 0..n-1 {
        d[i] = x[i+1] - x[i];
    }
    let m = sc.next();
    let k = sc.next();
    let mut perm:Vec<_> = (0..n-1).collect();
    for _ in 0..m {
        let a = sc.next::<usize>() - 1;
        perm.swap(a-1, a);
    }
    let perm2 = pow(&perm, k);
    let mut res = vec![0i64; n-1];
    for i in 0..n-1 {
        res[i] = d[perm2[i]];
    }
    
    let mut ans = String::new();
    let mut cur = x[0];
    writeln!(&mut ans, "{}", cur).unwrap();
    for i in 0..n-1 {
        cur += res[i];
        writeln!(&mut ans, "{}", cur).unwrap();
    }
    
    print!("{}", ans);
}

fn pow(perm: &Vec<usize>, k: usize) -> Vec<usize> {
    if k == 0 {
        (0..perm.len()).collect()
    } else if k%2 == 1 {
        let x = pow(perm, k-1);
        prod(&x, &perm)
    } else {
        let x = pow(perm, k/2);
        prod(&x, &x)
    }
}

fn prod(a: &Vec<usize>, b: &Vec<usize>) -> Vec<usize> {
    let n = a.len();
    let mut res = vec![0; n];
    for i in 0..n {
        res[i] = a[b[i]];
    }
    res
}

#[allow(dead_code)]
struct Scanner {
    buf: std::collections::VecDeque<String>,
}

#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner {
        Scanner { buf: std::collections::VecDeque::new() }
    }
    
    fn next<T: std::str::FromStr>(&mut self) -> T {
        self.wrapped::<T>().unwrap()
    }
    
    fn wrapped<T: std::str::FromStr>(&mut self) -> Option<T> {
        self.read();
        self.buf.pop_front().and_then(|s| s.parse::<T>().ok())
    }
    
    fn ok(&mut self) -> bool {
        self.read() && !self.buf.is_empty()
    }
    
    fn eof(&mut self) -> bool {
        !self.ok()
    }
    
    fn read(&mut self) -> bool {
        while self.buf.is_empty() {
            let mut st = String::new();
            while st.trim() == "" {
                match std::io::stdin().read_line(&mut st) {
                    Ok(l) if l > 0 => continue,
                    _ => return false,
                }
            }
            self.buf = st.split_whitespace().map(|x| x.to_string()).collect();
        }
        true
    }
}


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

int main() {
    int sum = 0;
    for (int i = 0; i < 4; i++) {
        int tmp; cin >> tmp;
        sum += tmp;
    }

    const int x = sum / 60;
    const int y = sum - 60 * x;

    cout << x << endl
         << y << endl;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
typedef long long ll;

#define rep(i, a, n) for (ll i = a; i < (ll)n; ++i)
#define INF 10e12
#define MOD 1000000000 + 7
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;
int main(void)
{
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n - 1);
    rep(i, 0, n) cin >> a[i], a[i]--;
    rep(i, 0, n) cin >> b[i];
    rep(i, 0, n - 1) cin >> c[i];
    int ans = 0;
    rep(i, 0, n)
    {
        ans += b[a[i]];
        if (i > 0 && a[i - 1] + 1 == a[i])
            ans += c[a[i - 1]];
    }
    cout << ans << endl;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> v(n);
    for(int i=0; i<n; i++) cin >> v[i];
    
    for(int i=0; i<n; i++){
        int cc=i+1;
        while(cc--){
            if(v[cc-1]>v[cc]){
                swap(v[cc-1],v[cc]);
            }
        }
        for(int j=0; j<n; j++){
            if(j!=n-1)           cout << v[j] << " ";
            else cout << v[j] << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3096
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
const int N=1e5+5;
int main() {
    int n,x,y;std::vector<int> a;
    scanf("%d",&n);a.resize(n);
    long long sum=0;
    for(int i=0;i<n;i++) {
        scanf("%d%d",&x,&y);
        a[i]=x+y;sum-=y;
    }
    std::sort(a.begin(),a.end(),std::greater<int>());
    for(int i=0;i<n;i++) {
        if(i&1);
        else sum+=a[i];
    }printf("%lld\n",sum);
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <cctype>
#include <fstream>

using namespace std;

#define ll long long
#define INF 2000000000
#define LINF 9000000000000000000
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define du(x) cout<<#x<<'='<<x<<endl
#define du2(x,y) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<'\n'<<endl
#define du3(x,y,z) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<' '<<#z<<'='<<z<<'\n'<<endl
#define darr(arr,n) rep(i,(n-arr)){cout<<*(arr+i)<<' ';}cout<<endl
#define ddarr(arr,a,b) rep(i,a){rep(j,b){cout<<*(arr+i*b+j)<<' ';}cout<<endl;}
#define ddd ifstream in("Text.txt");cin.rdbuf(in.rdbuf());

struct Res {
    string Name;
    int po;
    int num;
};

Res Rest[100];

int comp(Res G, Res H) {
    if (G.Name == H.Name)return G.po > H.po;
    return G.Name < H.Name;
}

int main(void) {
    int N;
    cin >> N;
    rep(i, N) {
        string S;
        int P;
        cin >> S >> P;
        Rest[i].Name = S;
        Rest[i].po = P;
        Rest[i].num = i + 1;
    }
    sort(Rest, Rest + N, comp);

    rep(i, N) {
        cout << Rest[i].num << endl;
    }



}



Measured memory_bytes: 256
# Combination
MOD = 998244353
MAX = 2*10**5
fac = [1,1] + [0]*MAX
finv = [1,1] + [0]*MAX
inv = [0,1] + [0]*MAX
for i in range(2,MAX+2):
    fac[i] = fac[i-1] * i % MOD
    inv[i] = -inv[MOD%i] * (MOD // i) % MOD
    finv[i] = finv[i-1] * inv[i] % MOD

def comb(n,r):
    if n < r: return 0
    if n < 0 or r < 0: return 0
    return fac[n] * (finv[r] * finv[n-r] % MOD) % MOD

N, M, K = map(int, input().split())
ans = 0
for i in range(K+1):
    ans += M*pow(M-1, N-1-i, MOD)*comb(N-1, i)
    ans %= MOD
print(ans)


Measured memory_bytes: 34072
#include <iostream>
#include <stdio.h>
#include <vector>
#include <sstream>
#include <algorithm>
#include <iterator>

using namespace std;

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

string getLine(){
    string str;
    getline(cin, str);
    return str;
}

template<typename T, typename R>
vector<R> map(vector<T> xs, R(*fp)(T)){
    vector<R> ys;
    for(T x : xs) ys.push_back(fp(x));
    return ys;   
}

vector<int> getLineNums(){
    return map(split(getLine(), ' '), +[](string x){ return stoi(x); });
}

template<typename T>
bool compareAll(vector<T> xs, bool(*fp)(T, T)){
    if(xs.empty()) return false;
    T x = xs[0];
    for (typename vector<T>::iterator itr = xs.begin() + 1; itr != xs.end(); ++itr){
        if(!fp(x, *itr)) return false;
    }
    return true;
}

string join(const char* delim = 0, const vector<string>& v = {}) {
    string s = "";
    if (!v.empty()) {
        s += v[0];
        for (decltype(v.size()) i = 1, c = v.size(); i < c; ++i) {
            if (delim) s += delim;
            s += v[i];
        }
    }
    return s;
}

template<typename T>
vector<T> cp_sort(vector<T> xs){
    vector<T> ys;
    copy(xs.begin(), xs.end(), back_inserter(ys));
    sort(ys.begin(), ys.end());
    return ys;
}

int main(void){
    cout << join(" ", map(cp_sort(getLineNums()), +[](int x){ return to_string(x); })) << endl;
    return 0;
}

Measured memory_bytes: 3288
#include <iostream>
#include <cmath>

using namespace std;

long long gcd(long long a, long long b) {
    if (b>a) return gcd(b,a);
    if (b==0) {
        return a;
    }
    else return gcd(b, a%b);
}


int main() {
    long long a, b;
    cin >> a >> b;
    long long c = gcd(a, b);
    long long res = 1;
    long long d = sqrt(c);
    for (long long i=2; i<=d; i++) {
        if (c==1) break;
        if (c%i==0) {
            res++;
            while (c%i==0) c/=i;
        }
    }
    if (c!=1) res++;
    cout << res << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
//同じ値3枚だせたらラッキー
//実操作するとしたら。1e5/2*1e5は無理
//重複カードだけよせる。
//3枚とって1枚にする
//残り0枚 終了
//残り1枚 使えるの2枚とって1枚残す。
//残り2枚 1 2 2 3 3  233とるとかで0枚、理想
//残り3枚 1 2 2 2 2 3 は残り1枚にすすむ
//重複カードが2で割り切れるなら重複以外
//そうでないなら使えるカード-1

int main(){
  ll N; cin>>N;
  vector<ll> A(N,0);
  for(int i=0; i<N; i++){
    ll a; cin>>a; A[i]=a;
  }
  sort(A.begin(), A.end());
  ll dup=A.end()-unique(A.begin(), A.end());
  ll ans=N-dup;
  if(dup%2==1) ans--;
  cout<<ans<<endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> v(N);
  vector<int> c(N);
  for (int i = 0; i < N; i++) cin >> v[i];
  for (int i = 0; i < N; i++) cin >> c[i];

  int ans = 0;
  for (int i = 0; i < N; i++) ans += max(v[i] - c[i], 0);
  cout << ans << endl;
}


Measured memory_bytes: 256
# AOJ 2823: JAG Practice Contest
# Python3 2018.7.11 bal4u

while True:
	N, M = map(int, input().split())
	if N == 0: break
	ma = [0]*(M+1)
	for i in range(N):
		d, v = map(int, input().split())
		ma[d] = max(ma[d], v)
	print(sum(ma))



Measured memory_bytes: 5608
#include<iostream>
#include<vector>
#include<queue>

using namespace std;


int main(){
    //def
    int N,X,Y;
    int t,s;
    cin >> N >> X >> Y;
    X-=1;
    Y-=1;
    vector<int> ans(N,0);
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            s = min(j-i,abs(X-i)+abs(Y-j)+1);
            ans[s]+=1;
        }
    }
    for(int i=1;i<N;i++){
        cout << ans[i]<<endl;
    }
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cassert>
#include <string>
#include <set>
#include <map>
#include <random>
#include <bitset>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()

using namespace std;
using ll = long long;
using ld = long double;

const int N = 100001;
int tin[N], tout[N], t;
vector<int> g[N], ord;

void dfs(int v) {
	tin[v] = ++t;
	for (int u : g[v])
		if (!tin[u])
			dfs(u);
	tout[v] = ++t;	
	ord.push_back(v);
}

int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n, m, u, v;
	cin >> n >> m;
	rep(i, n - 1 + m) {
		cin >> u >> v;
		g[u].push_back(v);
	}
	for (int i = 1; i <= n; i++)
		if (!tin[i])
			dfs(i);
	vector<int> p(n + 1, ord.back());
	for (int i = 1; i <= n; i++)
		for (int j : g[i])
			if (tout[p[j]] > tout[i])
				p[j] = i;
	for (int i = 1; i <= n; i++)
		cout << (i == ord.back() ? 0 : p[i]) << '\n';
}


Measured memory_bytes: 11128
r,g,b,n=map(int,input().split())
l=n//min(r,g,b)
ans=0
for i in range(l+1):
  for j in range(l+1):
      if n-(i*r+j*g)>=0 and (n-(i*r+j*g))%b==0:
        ans+=1
print(ans)

Measured memory_bytes: 41196
import java.util.*;
import java.lang.*;

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

		while (true) {
			String s = sc.next();
			
			if(s.equals("0")) break;
			
			int sum = 0;
			for(int i = 0; i<s.length(); i++){
				sum+=Character.getNumericValue(s.charAt(i));
			}
			System.out.println(sum);
		}
	}
}


Measured memory_bytes: 26156
#include<algorithm>
#include<iostream>
#include<cstdio>
#include<vector>
#define ll long long
#define poly vector<ll>
using namespace std;
const int N=5250007;
const int mod=924844033;
int n;
int rev[N],g[N],sz[N];
vector<int> ve[N];
ll fac[N],finv[N];
poly f,h;
inline ll qpow(ll x,int k,ll r=1){
	for(;k;k>>=1,x=x*x%mod) if(k&1) r=r*x%mod;
	return r;
}
inline void ntt(poly &a,int len,int opt){
	a.resize(len);
	for(int i=0;i<len;++i) if(i<rev[i]) swap(a[i],a[rev[i]]);
	for(int i=1;i<len;i<<=1) for(int j=0;j<len;j+=i<<1) for(int k=0;k<i;++k){
		int x=a[j+k],y=a[j+k+i]*g[i+k]%mod;
		a[j+k]=x+y>=mod?x+y-mod:x+y; a[j+k+i]=x-y<0?x-y+mod:x-y;
	}
	if(~opt) return ;
	reverse(a.begin()+1,a.end());
	const int inv=qpow(len,mod-2);
	for(int i=0;i<len;++i) a[i]=a[i]*inv%mod;
}
void dfs(int x,int fa){
	sz[x]=1;
	for(auto to:ve[x]) if(to!=fa) dfs(to,x),sz[x]+=sz[to];
	++f[n]; if(fa) --f[sz[x]],--f[n-sz[x]];
}
int main(){
	scanf("%d",&n); int len=1,bit=0;
	for(;len<=n+n;len<<=1,++bit);
	for(int i=0;i<len;++i) rev[i]=rev[i>>1]>>1|(i&1)<<bit-1;
	for(int i=fac[0]=1;i<=n;++i) fac[i]=fac[i-1]*i%mod;
	finv[n]=qpow(fac[n],mod-2);
	for(int i=n;i;--i) finv[i-1]=finv[i]*i%mod;
	for(int i=1,a,b;i<n;++i) scanf("%d%d",&a,&b),ve[a].push_back(b),ve[b].push_back(a);
	for(int i=len/2,wn=qpow(5,(mod-1)/len),w=1;i<len;++i,w=1ll*w*wn%mod) g[i]=w;
	for(int i=len/2-1;i;--i) g[i]=g[i<<1];
	f.resize(n+1); h.resize(n+1); dfs(1,0);
	for(int i=1;i<=n;++i) f[i]=(f[i]+mod)*fac[i]%mod;
	for(int i=0;i<=n;++i) h[i]=finv[n-i];
	ntt(f,len,1); ntt(h,len,1);
	for(int i=0;i<len;++i) f[i]=f[i]*h[i]%mod;
	ntt(f,len,-1);
	for(int i=1;i<=n;++i) printf("%lld\n",f[i+n]*finv[i]%mod);
	return 0;
}

Measured memory_bytes: 163416
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

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

	int a, b, c;
	cin >> a >> b >> c;
	int k;
	cin >> k;
	for (int f = 0; f <= k; f++) {
		for (int s = 0; s <= k; s++) {
			for (int t = 0; t <= k; t++) {
				if (f + s + t > k) continue;
				if ((c << t) > (b << s) && (b << s) > (a << f)) {
					cout << "Yes\n";
					return 0;
				}
			}
		}
	}	
	cout << "No\n";
	return 0;
}

Measured memory_bytes: 3132
#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

class mint {
public:
    long long x;

    constexpr mint(long long x = 0) : x((x % MOD + MOD) % MOD) {}

    constexpr mint operator-() const {
        return mint(-x);
    }

    constexpr mint &operator+=(const mint &rhs) {
        if ((x += rhs.x) >= MOD) x -= MOD;
        return *this;
    }

    constexpr mint &operator-=(const mint &rhs) {
        if ((x += MOD - rhs.x) >= MOD) x -= MOD;
        return *this;
    }

    constexpr mint &operator*=(const mint &rhs) {
        (x *= rhs.x) %= MOD;
        return *this;
    }

    constexpr mint operator+(const mint &rhs) const {
        mint res(*this);
        return res += rhs;
    }

    constexpr mint operator-(const mint &rhs) const {
        mint res(*this);
        return res -= rhs;
    }

    constexpr mint operator*(const mint &rhs) const {
        mint res(*this);
        return res *= rhs;
    }

    [[nodiscard]] constexpr mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    [[nodiscard]] constexpr mint inv() const {
        return pow(MOD - 2);
    }

    mint &operator/=(mint rhs) {
        return *this *= rhs.inv();
    }

    mint operator/(const mint rhs) const {
        return mint(*this) /= rhs;
    }

    constexpr bool operator==(const mint &rhs) const noexcept {
        return this->x == rhs.x;
    }

    constexpr bool operator!=(const mint &rhs) const noexcept {
        return this->x != rhs.x;
    }

    bool operator<(const mint &rhs) const noexcept {
        return this->x < rhs.x;
    }

    bool operator>(const mint &rhs) const noexcept {
        return this->x > rhs.x;
    }

    bool operator<=(const mint &rhs) const noexcept {
        return this->x <= rhs.x;
    }

    bool operator>=(const mint &rhs) const noexcept {
        return this->x >= rhs.x;
    }

    friend istream &operator>>(istream &is, mint &a) {
        long long t;
        is >> t;
        a = mint(t);
        return is;
    }

    friend ostream &operator<<(ostream &os, const mint &a) {
        return os << a.x;
    }
};

void Main() {
    ll N;
    cin >> N;
    vector<ll> P(N);
    rep(i, N){cin >> P.at(i);}

    ll minimum = INF;
    ll cnt = 0;
    rep(i, N){
        if (P.at(i) < minimum){
            cnt += 1;
            minimum = P.at(i);
        }
    }
    cout << cnt << endl;
}


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


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  string S, T;
  cin >> S >> T;
  int ans = 0;
  rep(i, S.size())
  {
    if (S[i] != T[i])
      ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3924
#include <stdio.h>
int main()
{
int N,i,d=0;
int a[100]={0};
scanf("%d",&N);
for(i=0;i<N;i++)
{
    scanf("%d",&a[i]);
    if((i+1)%2==1&&a[i]%2==1)
    {
        d++;
    }
}
printf("%d",d);
return 0;
}

Measured memory_bytes: 1712
import java.util.Scanner;
import java.lang.Math;

class Main{

    public static void main(String[] args){

	Scanner scan = new Scanner(System.in);
	double r = scan.nextDouble();

	double area = r * r * Math.PI;
	double circumference = 2 * r * Math.PI;

	System.out.printf("%f %f\n", area, circumference);

    }

}

Measured memory_bytes: 18940
import java.util.*;

public class Main {

    static final int MOD=1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String hitachi = "hi";

        for(int i=0;i<s.length()/2+1;i++){
            if(s.equals(hitachi)){
                System.out.println("Yes");
                return;
            }
            hitachi += "hi";
        }
        System.out.println("No");


    }
}




Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <climits>

using namespace std;

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

  int n = 1;
  for (int i = 0; i < N; i++) {
    n = min(2 * n, n + K);
  }

  cout << n << endl;

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
int a[10005];
int main()
{
    int n;scanf("%d",&n);
    for(int i=0;i<10;i++) a[111*i]=1;
    if(a[n/10]||a[n%1000]) printf("Yes\n");
    else printf("No\n");
    return 0;
}

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

int main(){
  ll n,m=0;
  cin >> n;
  vector<ll>a(n+1);
  for(int i=1; i<=n; i++) cin >> a[i];
  vector<ll>b(n+1);
  
  for(int i=n; i>=1; i--){
    ll count = 0;
   for(int j=i; j<=n; j+=i){
     count += b[j];
   }
    if(count%2!=a[i]) b[i]=1;
  }
  
  for(int i=1; i<=n; i++) m+=b[i];
  cout << m << endl;
  for(int i=1; i<=n; i++) {
    if(b[i]==1) cout << i << " " ;
  }
  
}


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

int main(){
  int A ,B , K ; 
  cin >> A >> B >> K ; 
  
  for(int i = A ; i <= B ; i++){
    if(i >= A+K || B < i ){
     
    }
    else{
      cout << i << endl ; 
    }
  }
  
  for(int i = B-K+1 ; i <= B ; i++ ){
        if(i > B || A+K > i  ){
       
    }
    else{
      cout << i << endl ; 
    }
  }
  
}

Measured memory_bytes: 3636
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		double answer;
		Scanner sc = new Scanner(System.in);
		double N = sc.nextDouble();
		if(N%2 == 0) {
			answer = N/(2*N);
		}else {
			answer = (N+1)/(2*N);
		}
		System.out.println(String.format("%.10f", answer));
	}
}

Measured memory_bytes: 24148
/// Kazuki Hoshino


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define f first
#define ss second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple

int n, k;

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

//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);


cin >> n >> k;

if(n%k){
    cout << 1 << endl;
}
else {
    cout << 0 << endl;  
}








return 0;}
///....


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<cmath>
#include<stack>
//#include<stdlib.h>
using namespace std;
int main() {
	int a, b, c,p=0,t=0;
	cin >> a >> b >> c;

	while (true)
	{
		t += a;
		if (t >= c) { t = c; break; }
		t += b;
		if (t > c)
		{
			c += 60; p++;
			if ((60*p) % (a + b) == 0) { t = -1; break; }
		}
	}
	cout << t << endl;
	return 0;
}


Measured memory_bytes: 3108
;; -*- coding: utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (ql:quickload '(:cl-debug-print :fiveam))
  #-swank (set-dispatch-macro-character #\# #\> (lambda (s c p) (declare (ignore c p)) (read s nil (values) t))))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)
#-swank (disable-debugger) ; for CS Academy

;; BEGIN_INSERTED_CONTENTS
(declaim (ftype (function * (values fixnum &optional)) read-fixnum))
(defun read-fixnum (&optional (in *standard-input*))
  (declare #.OPT)
  (macrolet ((%read-byte ()
               `(the (unsigned-byte 8)
                     #+swank (char-code (read-char in nil #\Nul))
                     #-swank (sb-impl::ansi-stream-read-byte in nil #.(char-code #\Nul) nil))))
    (let* ((minus nil)
           (result (loop (let ((byte (%read-byte)))
                           (cond ((<= 48 byte 57)
                                  (return (- byte 48)))
                                 ((zerop byte) ; #\Nul
                                  (error "Read EOF or #\Nul."))
                                 ((= byte #.(char-code #\-))
                                  (setf minus t)))))))
      (declare ((integer 0 #.most-positive-fixnum) result))
      (loop
        (let* ((byte (%read-byte)))
          (if (<= 48 byte 57)
              (setq result (+ (- byte 48) (* 10 (the (integer 0 #.(floor most-positive-fixnum 10)) result))))
              (return (if minus (- result) result))))))))

(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1 (princ obj stream) (terpri stream))))

(defconstant +mod+ 1000000007)

;; Body

(defun main ()
  (declare #.OPT)
  (read)
  (let* ((m (the uint32 (read)))
         (table (make-array 100001 :element-type 'uint32 :initial-element 0)))
    (dotimes (i m)
      (incf (aref table (read-fixnum)))
      (incf (aref table (read-fixnum))))
    (write-line
     (if (every #'evenp table)
         "YES"
         "NO"))))

#-swank (main)


Measured memory_bytes: 22116
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


enum Type{
	OK,
	NOT,
	UNDEFINED,
};

int POW[16];
Type type[15][15];

int main(){

	POW[0] = 1;
	for(int i = 1; i <= 15; i++){

		POW[i] = POW[i-1]*2;
	}

	int N;
	scanf("%d",&N);

	for(int i = 0; i < N; i++){
		for(int k = 0; k < N; k++){
			type[i][k] = UNDEFINED;
		}
	}

	int num,a,b;

	for(int i = 0; i < N; i++){

		scanf("%d",&num);

		for(int k = 0; k < num; k++){
			scanf("%d %d",&a,&b);

			a--;
			if(b == 0){

				type[i][a] = NOT;

			}else{

				type[i][a] = OK;
			}
		}
	}

	int ans = 0;

	for(int state = 1; state < POW[N]; state++){

		bool FLG = true;
		int count = 0;

		//正直者集合が、メンバーにnotと言っていない、かつ非メンバーにOKと言っていない
		for(int loop = 0; loop < N; loop++){
			if(state & POW[loop]){
				count++;
				for(int i = 0; i < N; i++){
					if(type[loop][i] == NOT && (state & POW[i])){
						FLG = false;
						break;
					}
					if(type[loop][i] == OK && !(state & POW[i])){
						FLG = false;
						break;
					}
				}
			}
			if(!FLG)break;
		}
		if(FLG){

			ans = max(ans,count);
		}
	}

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

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int N;
char s[202020];
int main()
{
    cin >> s;
    N = strlen(s);
    int a,z;
    for(int i=0; i<N;++i)
    {
        if(s[i]=='A')
        {
            a=i;
            break;
        }
    }
    for(int i=0; i<N; ++i)
        if(s[i]=='Z')
            z=i;
    cout << z-a+1 << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
typedef long long ll;


ll gcd(ll a, ll b){
    if(a==0) return b;
    if (a < b) swap(a,b);
    if (a % b == 0) return b;
    return gcd(a % b, b);
}
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
ll countNonDivisor(ll x, ll c, ll d){
    return x - x/c -x/d + x/lcm(c, d);
}
int main(){
    ll n, x;
    cin >> n >> x;
    vector<ll>a(n, 0);
    REP(i, n) cin >> a[i];

    // vector<ll>dist(n-1, 0);
    sort(ALL(a));

    ll initDist = INF;
    REP(i, n){
        if (abs(a[i] - x) < initDist) initDist = abs(a[i]-x);
    }
    ll currGcd = initDist;

    ll dist = 0;

    REP(i, n-1){
        dist = a[i+1] - a[i];
        currGcd = gcd(currGcd, dist);
    }

    cout << currGcd << endl;
}


Measured memory_bytes: 3968
import itertools

h, w, k = map(int, input().split(' '))
c = []
for i in range(h):
    instr = input()
    ci = []
    for char in instr:
        if char == '#':
            ci.append(1)
        else:
            ci.append(0)
    c.append(ci)

nanswers = 0
for hnow in range(h+1):
    for vh in itertools.combinations(range(h), hnow):
        for wnow in range(w+1):
            for vw in itertools.combinations(range(w), wnow):
                # print(vh, vw)
                nblacks = 0
                for i in range(h):
                    for j in range(w):
                        if i in vh or j in vw:
                            continue
                        if c[i][j] == 1:
                            nblacks += 1
                if nblacks == k:
                    nanswers += 1

print(nanswers)
                        
                            


Measured memory_bytes: 68984
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<N;i++)
#define INF 1e9;
typedef long long LL;
const LL MOD = 1e9+7;

int main() {
  LL N, A;
  cin >> N >> A;
  N = N % 500;
  string answer = "No";
  if(N <= A) answer = "Yes";
  
  cout << answer << endl;
  return 0;
}


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

#define int long long

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

signed main() {
    int N;
    int A[110000];
    cin >> N;
    for (int i = 1; i <= N; i++) {
        cin >> A[i];
    }
    int sum = 0;
    for (int i = 1; i <= N; i++) {
        sum += abs(A[i] - A[i - 1]);
    }
    sum += abs(A[N]);
    for (int i = 1; i <= N; i++) {
        cout << sum - abs(A[i] - A[i - 1]) - abs(A[i + 1] - A[i]) +
                    abs(A[i + 1] - A[i - 1])
             << endl;
    }
    return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i, n, init) for (ll i = init; i < (n); i++)
#define repd(i, n, init) for (ll i = (n); i >= init; i--)
#define repm(i, m) for (auto i = m.begin(); i != m.end(); i++)
#define repb(bit, n, init) for (ll bit = init; bit < (1 << n); ++bit)


int main()
{
    ll W, H, x, y;
    cin >> W >> H >> x >> y;
    cout << W * H / 2. << " " << (2 * x == W && 2 * y == H )<< endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <iomanip>


using namespace std;

const long double EPS = 1e-8;
const long double INF = 1e12;
typedef complex<long double> P;
namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
long double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
long double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}

struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};

int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > 0)   return +1;       // counter clockwise
  if (cross(b, c) < 0)   return -1;       // clockwise
  if (dot(b, c) < 0)     return +2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;       // a--b--c on line
  return 0;
}

bool intersectSS(const L &s, const L &t) {
  return ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0 &&
         ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1]) <= 0;
}

bool intersectSP(const L &s, const P &p) {
  return abs(s[0]-p)+abs(s[1]-p)-abs(s[1]-s[0]) < EPS; // triangle inequality
}

P projection(const L &l, const P &p) {
  long double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
  return l[0] + t*(l[0]-l[1]);
}

long double distanceSP(const L &s, const P &p) {
  const P r = projection(s, p);
  if (intersectSP(s, r)) return abs(r - p);
  return min(abs(s[0] - p), abs(s[1] - p));
}
long double distanceSS(const L &s, const L &t) {
  if (intersectSS(s, t)) return 0;
  return min(min(distanceSP(s, t[0]), distanceSP(s, t[1])),
             min(distanceSP(t, s[0]), distanceSP(t, s[1])));
}

class Star{
public:
	vector<L> star;
	void add(P p1,P p2){
		star.push_back(L(p1,p2));
	}
	
	long double dist(const Star &s){
		long double res=INF;
		for(int i=0;i<star.size();i++){
			for(int j=0;j<s.star.size();j++){
				res=min(res,distanceSS(star[i],s.star[j]));
			}
		}

		return res;
	}
	
};


int main()
{
	int n,m,l;
	while(cin>>n>>m>>l,n){
		vector<Star> stars(n);
		for(int i=0;i<n;i++){
			int x,y,a,r;
			cin>>x>>y>>a>>r;
			
			long double theta=M_PI/180.0*a;
			long double theta2=M_PI/180.0*72.0;
			
			vector<P> p(5);
			
			for(int j=0;j<5;j++){
				p[j]=P(0,r)*polar((long double)1.0,theta+j*theta2)+P(x,y);
				//cout<<p[j]<<endl;
			}
			
			for(int j=0;j<5;j++){
				stars[i].add(p[(2*j)%5],p[(2+2*j)%5]);
			}
		}
		
		vector<vector<long double> > dist(n,vector<long double>(n));
		for(int i=0;i<n;i++) dist[i][i]=0;
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++) dist[i][j]=dist[j][i]=stars[i].dist(stars[j]);
		}
		
		for(int k=0;k<n;k++){
			for(int i=0;i<n;i++){
				for(int j=0;j<n;j++){
					dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
				}
			}
		}
		
		cout<<setprecision(10)<<dist[m-1][l-1]<<endl;;
		
	}
	
	
	return 0;
}

Measured memory_bytes: 1492
name = []
num = []
money = []

for l in range(9):
    N = input().split()
    name.append(N[0])
    am = int(N[1])
    pm = int(N[2])
    num.append(am+pm)
    money.append(am*200+pm*300)

for l in range(9):
    print(name[l],num[l],money[l])



Measured memory_bytes: 5592
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#include <queue>

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

using namespace std;
using ll = long long;
using P = pair<int, int>;
using TP = tuple<ll, ll, ll>;
ll MOD = 1e9+7;
ll INF = 1LL<<58;

class UnionFind {
public:
    vector<ll> Parent;
    
    UnionFind(ll N){
        Parent = vector<ll>(N, -1);
    }
    
    ll root(ll A){
        if(Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    ll size(ll A){
        return -Parent[root(A)];
    }
    
    bool connect(ll A, ll B){
        A = root(A);
        B = root(B);
        if(A == B){
            return false;
        }
        if(size(A) < size(B)){
            swap(A, B);
        }
        
        Parent[A] += Parent[B];
        Parent[B] = A;
        
        return true;
    }
    
    bool isSameGroup(ll A, ll B){
        return root(A) == root(B);
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll N, M;
    cin >> N>> M;
    vector<ll> A(M), B(M);
    REP(i,M){
        ll a, b;
        cin >> a >> b;
        a--;b--;
        A[i] = a;
        B[i] = b;
    }
    reverse(A.begin(), A.end());
    reverse(B.begin(), B.end());

    UnionFind uf(N+1);
    ll base = N*(N-1)/2;
    vector<ll> ans;
    REP(i,M){
        ans.push_back(base);
        ll sizeA = uf.size(A[i]);
        ll sizeB = uf.size(B[i]);
        
        if(!uf.isSameGroup(A[i], B[i])){
            base -= sizeA*sizeB;
        }
        uf.connect(A[i], B[i]);
    }
    reverse(ans.begin(), ans.end());
    REP(i,M){
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 4596
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

vector<ll> prime;

void setPrime(ll n)
{
    for (ll i=2; i<=n; i++) {
        bool ok = true;
        for (ll e: prime) {
            if (i%e==0) {
                ok = false;
                break;
            }
            if (e*e>i) break;
        }
        if (ok) prime.push_back(i);
    }
}

int main(){
    ll n;
    cin >> n;
    setPrime(1000000);
    map<ll, ll> mp;
    ll temp = n-1;
    for (int p: prime) {
        while(temp%p==0) {
            temp /= p;
            mp[p]++;
        }
        if (temp==1) break;
    }
    if (temp!=1) mp[temp]++;

    ll ans = 1;
    for (auto m:mp) {
        ans *= (m.second+1);
    }
    ans--;


    for (ll i=2; i*i<=n; i++) {
        if (n%i==0) {
            ll v = n;
            while (v%i==0) {
                v/=i;
            }
            if (v%i==1) {
                ans++;
            }
        }
    }
    ans++;
    
    
    cout << ans << endl;
    return 0;
}


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

typedef long long ll;

struct node{
	int t, nxt, flag;
}edge[200050];

int head[100050], cnt, typ[100050];

void add(int u, int v, int flag){
	edge[++cnt] = (node){v, head[u], flag};
	head[u] = cnt;
}

ll getans(int x){
	queue<int> q;
	typ[x] = 0;
	int cnt[3], edget = 0, dcnt = 1, flag1 = 0;
	cnt[0] = 1;
	cnt[1] = cnt[2] = 0;
	q.push(x);
	while(!q.empty()){
		int u = q.front(); q.pop();
		for(int i = head[u]; i; i = edge[i].nxt){
			int v = edge[i].t, ncol;
			if(edge[i].flag) edget++;
			if(typ[v]==-1) dcnt++;
			if(edge[i].flag == 1) ncol = (typ[u]+1) % 3;
			else ncol = (typ[u]+2)%3;
			if(typ[v]==-1){
				typ[v] = ncol;
				cnt[ncol]++;
				q.push(v);
			}
			else if(typ[v] != ncol) flag1 = 1; 
		}
	}
	if(flag1) return 1ll*dcnt * dcnt;
	else if(!cnt[0] || !cnt[1] || !cnt[2]) return edget;
	else {
		return 1ll*cnt[0] * cnt[1] + 1ll*cnt[1] * cnt[2] + 1ll*cnt[2] * cnt[0];
	}
}

int main(){
	ll ans = 0;
	int n, m;
	memset(typ, -1, sizeof(typ));
	scanf("%d %d", &n, &m);
	for(int i = 1; i <= m; i++){
		int u, v;
		scanf("%d %d", &u, &v);
		add(u, v, 1);
		add(v, u, 0);
	}
	for(int i = 1; i <= n; i++) if(typ[i] == -1){
		ans += getans(i);
	}
	printf("%lld", ans);
}

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

#define N 200010
int n;
bool vis[N];

int main()
{
	scanf("%d", &n);
	vector<int> lst;
	int x, ans = 0;
	for (int i = 1; i <= n; ++i)
		scanf("%d", &x), lst.push_back(x);
	
	for (int i = 30; i >= 1; --i)
	{
		vector<int> tmp;
		int need = 1 << i;
		if (lst.size() <= 1) break;
		sort(lst.begin(), lst.end());
		memset(vis, 0, sizeof(vis));
		int l = 0, r = lst.size() - 1;
		while (l < r)
		{
			while (l < r && lst[l] + lst[r] > need) --r;
			if (l < r && lst[l] + lst[r] == need) ++ans, vis[l] = vis[r] = 1, --r;
			l++;
		}
		for (int i = 0; i < lst.size(); ++i)
			if (!vis[i]) tmp.push_back(lst[i]);
		lst.clear();
		lst = tmp;
	}
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
    int n;
    cin >> n;
    double ans;
    if(n%2 == 0){
      ans = (double)1/2;
    }else{
      ans = (double)(n/2+1)/n;
    }
    printf("%.10lf\n",ans);
  }


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int n, j, A[1001], v;
    cin >> n;
    for(int t = 0; t < n; t++){
        cin >> A[t];
        if(t==n-1)cout << A[t];
        else cout << A[t] << " " ;
    }
    cout <<endl;
    for(int i = 1; i <= n-1; i++){
        v = A[i];
        j = i - 1;
        while(j >= 0 && A[j] > v){
            A[j+1] = A[j];
            j--;
            A[j+1] = v;
        }
        for(int t = 0; t < n; t++){
        if(t==n-1)cout << A[t];
        else cout << A[t] << " " ;
        }
        cout <<endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 3076
open System
open System.Collections.Generic

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f

    let readInts() =
        read string
        |> Seq.toArray
        |> Array.map (fun x -> Convert.ToInt32(x.ToString()))

module Util =
    let strRev (s: string): string =
        s
        |> Seq.rev
        |> Seq.map string
        |> String.concat ""

    let inline roundup (x: ^a) (y: ^a): ^a =
        let one = LanguagePrimitives.GenericOne
        (x + y - one) / y

type ModInt(x: int64) =
    static let modulo = (int64 1e9) + 7L

    member __.Value: int64 =
        let y = x % modulo
        match y with
        | _ when y < 0L -> y + modulo
        | _ when y >= modulo -> y - modulo
        | _ -> y

    override __.ToString() = __.Value.ToString()

    static member (+) (lhs: ModInt, rhs: ModInt) = ModInt(lhs.Value + rhs.Value)

    static member (-) (lhs: ModInt, rhs: ModInt) = ModInt(lhs.Value - rhs.Value)

    static member (*) (lhs: ModInt, rhs: ModInt) = ModInt(lhs.Value * rhs.Value)

    /// フェルマーの小定理
    /// a / b = a * b^-1 (mod p)
    /// b * b^p-2 = 1 (mod p) -> 両辺を b^-1 倍して、b^p-2 = b^-1 (mod p)
    static member (/) (lhs: ModInt, rhs: ModInt) = lhs * (rhs ** (modulo - 2L))

    /// **
    /// 繰り返し二乗法
    static member Pow(n: ModInt, m: int64) =
        let mutable res = ModInt(1L)
        let mutable n = n
        let mutable m = m
        while m > 0L do
            if (m &&& 1L) = 1L then res <- res * n
            n <- n * n
            m <- m >>> 1
        res

[<EntryPoint>]
let main _ =
    let n = read int64
    let mutable ans = ModInt(1L)
    for i in 1L..n do
        ans <- ans * ModInt(i)
    printfn "%A" ans
    0 // return an integer exit code


Measured memory_bytes: 18132