akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		long sa = A.Sum();
		long sb = B.Sum();
		if(sa > sb){
			Console.WriteLine("No");
			return;
		}
		
		long nega = 0;
		for(int i=0;i<N;i++){
			if(B[i] < A[i]){
				nega += (A[i] - B[i]);
				B[i] = A[i];
			}
		}
		
		if(nega > sb - sa){
			Console.WriteLine("No");
			return;
		}
		
		nega *= 2;
		for(int i=0;i<N;i++){
			if(B[i] > A[i]){
				long diff = B[i] - A[i];
				long inc = Math.Min(nega, (diff / 2 )* 2);
				nega -= inc;
				A[i] += inc;
			}
		}
		/*
		bool chk = true;
		for(int i=0;i<N;i++){
			chk &= A[i] <= B[i];
		}
		*/
		Console.WriteLine(nega == 0 ? "Yes" : "No");
		
		
	}
	int N;
	long[] A,B;
	public Sol(){
		N = ri();
		A = rla();
		B = rla();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

int main(){
    int n, sum = 0, prev = -1;
    cin >> n;
    int A[n+1], B[n+1], C[n+1 - 1];
    for (int i = 1; i <= n; ++i) {
        cin >> A[i];
    }
    for (int i = 1; i <= n; ++i) {
        cin >> B[i];
    }
    for (int i = 1; i <= n - 1; ++i) {
        cin >> C[i];
    }
    for (int i = 1; i <= n; ++i) {
        sum += B[A[i]];
        if (prev == A[i]-1)
            sum += C[prev];
        prev = A[i];
    }

    cout << sum;


}

Measured memory_bytes: 256
/*
      author  : nishi5451
      created : 14.08.2020 16:47:16
*/

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


int main(){
    set<int> li;
    int n;
    cin >> n;
    rep(i,n){
        int d;
        cin >> d;
        li.insert(d);
    }
    cout << li.size() << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//using ll = long long;
using P = pair<int,int>;

ostream &operator<<(ostream &os,const P &p){ return os << "" << p.first << " " << p.second << ""; }

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	int n;
	cin >> n;
	vector<P> ans;
	for(int i = 1;i <= n;i++){
		for(int j = i + 1;j <= n;j++){
			if((n % 2 && i + j != n) || (n % 2 == 0 && i + j != n + 1)){
				ans.emplace_back(i,j);
			}
		}
	}
	cout << ans.size() << endl;
	for(P p : ans){
		cout << p << endl;
	}
}


Measured memory_bytes: 512
#include<bits/stdc++.h> //ABC 100_c 
using namespace std;
int N,a[100000],ans,i;
int main(){
	cin>>N;
	for(int i=1;i<=N;i++){
		cin>>a[i];
		while(a[i]%2==0){
				a[i]/=2;
				ans++;
		}	
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a.at(i);
	sort(a.begin(),a.end());
	cout << a.at(n - 1) - a.at(0) << endl;
}


Measured memory_bytes: 384
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

pub fn gcd<T: PrimInt>(a: T, b: T) -> T {
    if b == zero()  {
        a
    } else {
        gcd(b, a % b)
    }
}

pub fn lcm<T: PrimInt>(a: T, b: T) -> T {
    a / gcd(a, b) * b
}

#[fastout]
fn main() {
    input!{
        a: usize, b: usize,
    }
    println!("{}", lcm(a, b));
}


Measured memory_bytes: 2128
# coding=utf-8

def solve(i, m):
    global A
    if m == 0:
        return True
    elif i == n:
        return False
    else:
        return (solve(i+1, m) or solve(i+1, m-A[i]))

n = int(input())
A = tuple(map(int, input().split()))
q = int(input())
M = tuple(map(int, input().split()))
sum_A = sum(A)

for m in M:
    if m > sum_A:
        print('no')
    elif solve(0, m):
        print('yes')
    else:
        print('no')

Measured memory_bytes: 7684
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inc(i, l, r) for (int i = l; i <= r; i++)
#define pii pair<double, int>
#define fi first
#define se second
#define pb push_back

const double inf = 1e9;
const int maxv = 1e5 + 5;

struct edge {
    double cost;
    int u, v;
    bool operator<(const edge &o) const { return cost > o.cost; }
};

double x[maxv], y[maxv], tot;
int n, m, a, b;

int par[maxv];
void init() { inc(i, 1, n) par[i] = i; }
int find(int x) {
    if (x == par[x]) return x;
    return par[x] = find(par[x]);
}
void unite(int x, int y) {
    x = find(x), y = find(y);
    if (x != y) par[x] = y;
}
bool same(int x, int y) { return find(x) == find(y); }

int main() {
    scanf("%d %d", &n, &m);
    vector<edge> g(m);
    inc(i, 1, n) scanf("%lf %lf", &x[i], &y[i]);
    inc(i, 0, m - 1) {
        scanf("%d %d", &a, &b);
        double dis =
            sqrt((x[a] - x[b]) * (x[a] - x[b]) + (y[a] - y[b]) * (y[a] - y[b]));
        g[i] = {dis, a, b};
        tot += dis;
    }
    sort(g.begin(), g.end());
    init();
    inc(i, 0, m - 1) {
        int u = g[i].u, v = g[i].v;
        if (!same(u, v)) {
            tot -= g[i].cost;
            unite(u, v);
        }
    }
    printf("%.3f", tot);
}


Measured memory_bytes: 3660
n = int(input())
l = list(map(int, input().split()))

def cumulative_sum(collection):
    result = [0]
    for item in collection:
        result.append(result[-1] + item)
    return result
cm = cumulative_sum(l)

def combination(items_num, pair_num):
    if items_num < pair_num: return 0
    if items_num - pair_num < pair_num: pair_num = items_num - pair_num
    if pair_num == 0: return 1
    if pair_num == 1: return items_num
    numerator   = [items_num - pair_num + k + 1 for k in range(pair_num)]
    denominator = [k + 1 for k in range(pair_num)]
    for p in range(2, pair_num+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (items_num - pair_num) % p
            for k in range(p-1, pair_num, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
    result = 1
    for k in range(pair_num):
        if numerator[k] > 1:
            result *= int(numerator[k])
    return result

from collections import Counter
c = Counter(cm)
ans = 0
from scipy.special import comb
for i in c.keys():
        ans += int(comb(c[i], 2))

print(ans , flush=True)


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

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

    bool kuku = false;

    for(int i = 1; i < 10; i++){
        for(int j = 1; j < 10; j++){
            if (N == i * j)
                kuku = true;
        }
    }
    if (kuku == true) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 3000 + 10;
const int mod = 998244353;
const int inv = (mod + 1) / 2;
void add(ll &x,ll y){
    x += y;
    x %= mod;
}
ll f[N][N];
int main(){
    int n,s; cin>>n>>s;
    f[0][0] = 1;
    for(int i=1;i<=n;i++){
        for(int j=0;j<=s;j++) add(f[i][j],f[i-1][j]);
        ll x; cin>>x;
        for(int j=s-x;j>=0;j--) add(f[i][j+x],f[i-1][j]*inv);
//        for(int j=0;j<=s;j++) cout<<f[i][j]<<' '; cout<<endl;
    }
    ll ans = f[n][s];
    for(int i=1;i<=n;i++) add(ans,ans);
    cout<<ans<<endl;
}


Measured memory_bytes: 74168
#include<iostream>
#include<vector>
#include<set>
#include<cassert>
#include<cmath>
using namespace std;
typedef long long lint;
typedef pair<lint,lint>pll;

// 連分数を使って、基本単数を求める。d は平方数でないことが要請される。
pll fundamental_unit(lint d){
  vector<int> ans;
  lint x=0,z=1;//(x+sqrt(d))/z
  lint sqrtd=floor(sqrt(d));
  set<pll>seen;
  // invariants: x>=0, z|x*x-d
  while(1){
    if(seen.count(pll(x,z)))break;
    seen.insert(pll(x,z));
    lint q=(x+sqrtd)/z;
    ans.push_back(q);
    x=q*z-x;
    lint norm=x*x-d;
    z=-norm/z;
  }
  // recover
  lint num=0,den=1;
  for(int i=(int)ans.size()-2;i>=0;--i){
    lint z=num+ans[i]*den;
    num=den;den=z;
  }
  if(den*den-d*num*num==-1){
    lint x=den*den+d*num*num;
    lint y=2*den*num;
    den=x;num=y;
  }
  assert(den*den-d*num*num==1);
  return pll(den,num);
}

pll solve(lint n){
  for(int i=0;i<=200;++i)
    if(i*i==2*n)
      return pll(i,1);
  return fundamental_unit(2*n);
}

int main(){
  for(int t=1;;++t){
    lint n;
    cin>>n;
    if(n==0)break;
    pll ans=solve(n);
    cout<<"Case "<<t<<": "<<ans.first<<" "<<ans.second<<endl;
  }
}



Measured memory_bytes: 3136
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
minus = 0
plus = 0
for i in range(n):
	if a[i]<b[i]:
		plus += (b[i]-a[i])//2
	else:
		minus += a[i]-b[i]
if plus - minus >= 0:
	print('Yes')
else:
	print('No')

Measured memory_bytes: 4596
#include <cstdio>
#include <cstring>

#include <algorithm>

using namespace std;

#define NMAX 200000

static int H, W, n, x0, y0;
static char S[NMAX + 10], T[NMAX + 10];

int main() {
    scanf("%d%d%d%d%d%s%s", &H, &W, &n, &x0, &y0, S + 1, T + 1);
    bool ok = true;
    int x = x0, y = y0;
    for (int i = 1; i <= n; i++) {
        if (S[i] == 'L') y--;
        if (y < 1 || y > W) ok = false;
        if (y < W && T[i] == 'R') y++;
    }
    x = x0, y = y0;
    for (int i = 1; i <= n; i++) {
        if (S[i] == 'R') y++;
        if (y < 1 || y > W) ok = false;
        if (y > 1 && T[i] == 'L') y--;
    }
    x = x0, y = y0;
    for (int i = 1; i <= n; i++) {
        if (S[i] == 'U') x--;
        if (x < 1 || x > H) ok = false;
        if (x < H && T[i] == 'D') x++;
    }
    x = x0, y = y0;
    for (int i = 1; i <= n; i++) {
        if (S[i] == 'D') x++;
        if (x < 1 || x > H) ok = false;
        if (x > 1 && T[i] == 'U') x--;
    }
    puts(ok ? "YES" : "NO");
    return 0;
}


Measured memory_bytes: 888
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

a_copy = a[::]
a_copy.sort(reverse=True)

for i in range(n):
    if a[i] != a_copy[0]:
        print(a_copy[0])
    else:
        print(a_copy[1])

Measured memory_bytes: 18980
class InputLine
  def self.to_s
    gets.chomp
  end

  def self.to_i
    InputLine.to_s.to_i
  end
  
  def self.to_f
    InputLine.to_s.to_f
  end

  def self.to_sa
    InputLine.to_s.split(' ')
  end

  def self.to_ia
    InputLine.to_sa.map(&:to_i)
  end
  
  def self.to_fa
    InputLine.to_sa.map(&:to_f)
  end
end

def main(argv)
  (a, b, c, d) = InputLine.to_ia

  while ((a > 0) and (c > 0)) do
    c -= b
    if c <= 0 then
      puts 'Yes'
      break
    end
    
    a -= d
    if a <= 0 then
      puts 'No'
      break
    end
  end
end

if self.to_s == 'main' then
  main(ARGV)
end

Measured memory_bytes: 14368
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <vector>

using namespace std;

int main(void) {
	int H, W, N;
	scanf("%d %d", &H, &W);
	scanf("%d", &N);

	vector<vector<int>> field = vector<vector<int>>(H, vector<int>(W, 0));
	int a;
	int x = 0;
	int y = 0;
	for (int i = 0; i < N; i++) {
		scanf("%d", &a);
		for (int k = 0; k < a; k++) {
			field[y][x] = i + 1;
			if (y % 2 == 0) {
				x++;
				if (x >= W) {
					x--;
					y++;
				}
			}
			else {
				x--;
				if (x < 0) {
					x++;
					y++;
				}
			}
		}
	}
	
	for (y = 0; y < H; y++) {
		for (x = 0; x < W-1; x++) {
			printf("%d ", field[y][x]);
		}
		printf("%d\n", field[y][W - 1]);
	}

	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>

using namespace std;

#define sz(a) static_cast<int>((a).size())
#define f first
#define s second
#define els(v) for (auto &el : (v))


#ifdef KIRYA
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) {
    cerr << _s << " = " << _h << "\n";
}

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;

    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;

    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

const int64_t INF = static_cast<int64_t>(1e9) + 7;
const int64_t LINF = INF * INF;
const int MAXN = static_cast<int>(1e6) + 17;

typedef long long ll;

ll was_here[2001][2001];

ll rec(ll n, ll k) {
    if (was_here[n][k]) {
        return was_here[n][k];
    }

    if(n == k || k == 0)
        was_here[n][k] = 1;
    else if(k==1)
        was_here[n][k] = n;
    else
        was_here[n][k] = (rec(n-1, k-1)+rec(n-1, k)) % INF;

    return was_here[n][k];
}
void solve() {
    int n, k;
    cin >> n >> k;
    int m = n - k;
    for (int i = 1; i <= k; ++i) {
        if (m + 1 < i) {
            cout << "0\n";
        } else {
            cout << (rec(m + 1, i) * rec(k - 1, i - 1)) % INF << '\n';
        }
    }
}

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

    int q = 1;

    for (int i = 0; i < q; ++i) {
        solve();
    }
}

Measured memory_bytes: 29696
r,c=map(int,input().split())
lit=[[0 for jjj in range(c)]for lll in range(r)]
for a in range(r):
	tet=list(map(int,input().split()))
	for b in range(c):
		lit[a][b]=tet[b]
for p in range (r):
	for q in range(c):
			print(str(lit[p][q])+' ',end='')
	print(sum(lit[p]))
ddd=0

for qq in range(c):
	unko=0
	for pp in range(r):
		unko+=lit[pp][qq]
	ddd+=unko
	print(str(unko)+' ',end='')
print(ddd)


Measured memory_bytes: 6212
import sys
import numpy as np
input = sys.stdin.readline

def main():
    N, Ma, Mb = map(int, input().split())

    INF = int(1e6)
    MAX = (N+1) * 10 + 1
    dp = np.full((MAX, MAX), INF, dtype=np.int64)
    tmp = np.zeros_like(dp)

    dp[0][0] = 0
    for i in range(N):
        a, b, c = map(int, input().split())
        tmp = dp.copy()
        tmp[a:, b:] = np.minimum(tmp[a:, b:], dp[:-a, :-b] + c)
        dp = tmp
    
    ans = INF
    a, b = Ma, Mb
    while a < MAX and b < MAX:
        ans = min(ans, dp[a][b])
        a += Ma
        b += Mb
    
    if ans == INF:
        ans = -1
    
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 17532
n=int(input())
v=list(map(int,input().split()))
#a,b=map(int,input().split())
#A=[[0 for i in range()] for j in range()]
#l = [int(input()) for i in range(N)]

v.sort()
a=v[0]
for i in range(1,n):
  a=(a+v[i])/2

print(a)

Measured memory_bytes: 2940
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>
using namespace std;

struct Node{
    int key;
    Node *right, *left, *parent;
};

Node *root, *NIL;

Node * find (Node *u, int k){
    while(u!=NIL && k!=u->key){
        if(k < u->key) u = u->left;
        else u = u->right;
    }
    return u;
}

void insert(int k){
    Node *y = NIL;
    Node *x = root;
    Node *z;

    z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;

    while(x!=NIL){
        y=x;
        if(z->key < x->key){
            x = x->left;
        }else{
            x = x->right;
        }
    }
    z->parent = y;
    if(y==NIL){
        root = z;
    } else {
        if(z->key < y->key){
            y->left = z;
        } else {
            y->right = z;
        }
    }
}

void inorder(Node *u){
    if(u==NIL) return;
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
}
void preorder(Node *u){
    if(u==NIL) return;
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
}

int main(){
    int n,i,x;
    string com;

    scanf("%d",&n);

    for(i=0;i<n;i++) {
        cin >> com;

        if (com[0] == 'f')
        {
            scanf("%d",&x);
            Node *t = find(root, x);
            if(t!=NIL) printf("yes\n");
            else printf("no\n");
        } else if (com == "insert") {
            scanf("%d", &x);
            insert(x);
        } else if (com == "print") {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }
    return 0;
}


Measured memory_bytes: 22088
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e9;
const ll MOD = 1e9 + 7;

int main()
{
  double R;
  scanf("%lf", &R);
  printf("%.9lf\n", 2 * R * M_PI);

  return 0;
}


Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
int N,K;
cin >> N >> K;
vector<int> vec(N);
for (int i = 0;i < N;i++) {
    cin >> vec.at(i);
}
sort(vec.begin(),vec.end());
int mini = INF;
for (int i = 0;i + K-1 < N;i++) {
    if (vec.at(i+K-1) - vec.at(i) < mini) {
        mini = vec.at(i+K-1) - vec.at(i);
    }

}
cout << mini << endl;


return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int N;
char c;
int main(){
  cin >> N;
  for(int i=0;i<N;i++){
    if(cin >> c && c=='Y'){
      cout << "Four" << endl;
      return 0;
    }
  }
  cout << "Three" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i >= (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    string s;
    cin >> s;
    fp((s[0] == '7')||(s[1] == '7')||(s[2] == '7'));
    return 0;
}

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

int main() {
    int n;
    vector<int> time;

    while (cin >> n) {
        time.clear();
        for (int i = 0; i < n; i++) {
            int t; cin >> t;
            time.push_back(t);
        }
        sort(time.begin(), time.end());
        int sum = 0;
        for (int i = 0; i < n; i++) {
            sum += time[i] * (n-i);
        }
        cout << sum << endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
#define double long double
#define int long long
#define mii map<int,int>
#define low lower_bound
#define upp upper_bound
#define inf 1000000007 //10^9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define sort(vec) sort(all(vec));
#define rever(vec) reverse(all(vec));
#define bisea binary_search
#define unsort(vec) sort(vec); rever(vec);
#define cend cout<<endl;
#define F first
#define S second
using namespace std;

signed main() {
  int n;
  cin>>n;
  rep(i,100) {
    rep(j,100) {
      if(4*i+7*j==n) {
        cout<<"Yes"<<endl;
        return 0;
      }
    }
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <math.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> P;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REPR(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define FOR(i, n, m) for (ll i = (n); i < (m); ++i)
#define FORR(i, n, m) for (ll i = (m) - 1; i >= (n); --i) 
#define FORE(x, xs) for (auto &x: (xs))
#define ALL(v) v.begin(), v.end()
#define ZERO(a) memset(a,0,sizeof(a))

const int INF = 1000000009;
const int MOD = 998244353;
const int HALF = (MOD + 1) / 2;
const double EPS = 1e-14;
const double PI = acos(-1);

const int MAX = 310;
const int MAX_VAL = MAX*MAX;

int N;
int A[MAX];
ll dp[MAX][MAX_VAL]; // dp[i][x] : i個目まで使ってxをつくるパターン数
ll dp1[MAX_VAL]; // dp1[i] : iをつくるパターン数

ll pw (ll n, ll k) {
    ll r = 1;
    while (k) {
        if (k&1) r = r*n%MOD;
        k >>= 1;
        n = n*n%MOD;
    }
    return r;
}

int main() {
    cin >> N;
    REP (i, N) cin >> A[i];
    ll ans = pw(3, N);
    int sm = A[0];
    dp[0][0] = 2;
    dp[0][A[0]] = 1;
    FOR (i, 1, N) {
        REP (j, sm+1) if (dp[i-1][j] > 0) {
            dp[i][j] = (dp[i][j] + 2*dp[i-1][j]) % MOD;
            dp[i][j+A[i]] = (dp[i][j+A[i]] + dp[i-1][j]) % MOD;
        }
        sm += A[i];
    }
    int half = sm/2;
    if (sm&1) half++;

    FOR (i, half, sm+1) {
        ans = (ans + 3ll * MOD - 3*dp[N-1][i]) % MOD;
    }

    dp1[0] = 1;
    int mx = 0;
    REP (i, N) {
        REPR (j, mx+1) if (dp[j]) {
            dp1[j+A[i]] = (dp1[j+A[i]] + dp1[j]) % MOD;
        }
        mx += A[i];
    }
    if (sm%2 == 0) ans = (ans + 3*dp1[sm/2]) % MOD;

    cout << ans << endl;
}

Measured memory_bytes: 226304
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}
func main() {
	sc.Split(bufio.ScanWords)
	N := nextInt()
	S, T := nextString(), nextString()

	var ans string
	for i := 0; i < N; i++ {
		ans += string(S[i]) + string(T[i])
	}
	fmt.Println(ans)
}


Measured memory_bytes: 640
#include <stdio.h>
#define N 105
#define BLACK -2
#define WHITE 1
#define GRAY 7
#define INF -1

typedef struct {
  int color, discover, id;  
}Record;
 
void bfs(int);
void enqueue(int);
int dequeue();


int adj[N][N], que[N];
int size, n, head, tail;
Record data[N];

int main () {
  int m, i, j, k, l;

  scanf("%d",&n);

  for(i = 1 ; i <= n ; i++) {
    scanf("%d %d",&l,&m);
    data[l].id = l;
    for(j = 1 ; j <= m ; j++) {
      scanf("%d",&k);
      
      adj[l][k] = 1;
    }
  }
  
  

  bfs(1);


  for(i = 1 ; i <= n ; i++) {
    printf("%d %d\n",data[i].id,data[i].discover);
  }

  return 0;
}


void bfs(int s) {
  int i, u;

  for(i = 1 ; i <= n ; i++) {
    data[i].color = WHITE;
    data[i].discover = INF;
  }

  data[s].color = GRAY;
  data[s].discover = 0;

  enqueue(s);

  while(size > 0) {
    u = dequeue();

    for(i = 1 ; i <= n ; i++) {
      if(adj[u][i] == 1 && data[i].color == WHITE) {
	data[i].color = GRAY;
	data[i].discover = data[u].discover + 1;
	enqueue(i);
      }
    }
    data[u].color = BLACK;
    
  }
}



void enqueue(int x) {
  que[tail] = x;
  size++;
  if(tail == N) tail = 0;
  else tail++;
}

int dequeue () {
  int x = 0;
  x = head;
  if(head == N) head = 0;
  else head++;
  size--;
  return que[x];
}



Measured memory_bytes: 2104
#!/usr/bin/env python3
# N,M = map(int,sys.stdin.readline().split())
# A = list(map(int,sys.stdin.readline().split()))
# A = [sys.stdin.readline() for _ in range(N)]
# A = [list(map(int,sys.stdin.readline())) for _ in range(N)]
# A = [int(sys.stdin.readline()) for _ in range(N)]
# S = sys.stdin.readline().rstrip()
# N = int(sys.stdin.readline())
import sys,bisect,math
sys.setrecursionlimit(15000)

N = int(sys.stdin.readline())
ret = []
n = N
for i in range(2,math.floor(pow(N,0.5))+1):
  #print(n,i,n%i)
  while n%i==0:
    ret.append(i)
    n = n//i
if n != 1:
    ret.append(n)
print("{}: {}".format(N," ".join(map(str,ret))))
#print("{}: {}".format(N,str(ret)[1:-1]))


Measured memory_bytes: 5716
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;
int main(){
  ll k;
  cin >> k;
  string s;
  cin >> s;
  
  if(s.size()<=k)
    cout << s;
  else{
    cout << s.substr(0,k) + "...";
  }

  return 0;
}


Measured memory_bytes: 3600
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        int n = sc.nextInt();
        List<Point> points = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            Point p = new Point(sc.nextInt(), sc.nextInt());
            points.add(p);
        }
        Map<Point, Integer> map = new HashMap<>();
        for (Point p : points) {
            // System.out.printf("p : %s %n", p);
            for (int x = 0; x < 3; x++) {
                for (int y = 0; y < 3; y++) {
                    int nx = p.row - x;
                    int ny = p.line - y;
                    if (nx <= 0 || ny <= 0 || nx > w - 2 || ny > h - 2) {
                        continue;
                    }
                    Point point = new Point(nx, ny);
                    if (map.containsKey(point)) {
                        map.put(point, map.get(point) + 1);
                    } else {
                        map.put(point, 1);
                    }
                }
            }
        }

        long[] ans = new long[10];
        ans[0] = (long) (w - 2) * (h - 2);
        map.forEach((c, cnt) -> {
            ans[cnt]++;
            ans[0]--;
        });
        for (int i = 0; i < 10; i++) {
            System.out.println(ans[i]);
        }
    }
}
class Point {
    int line;
    int row;
    public Point(int line, int row) {
        this.line = line;
        this.row = row;
    }
    public boolean equals(Object o) {
        if (o == this) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Point p = (Point) o;
        return this.line == p.line && this.row == p.row;
    }
    public int hashCode() {
        return Objects.hash(line, row);
    }
    public String toString() {
        return String.format("line = %s,row = %s", line, row);
    }
}


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

int main() {
  long Q, H, S, D, N;
  cin >> Q >> H >> S >> D >> N;
  S = min({Q * 4, H * 2, S});
  if (S * 2 <= D) cout << N * S << "\n";
  else cout << N / 2 * D + N % 2 * S << "\n";
}

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

Measured memory_bytes: 600
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long n = sc.NextLong();

        long answer = 1000 - (n % 1000);

        if (answer == 1000)
        {
            answer = 0;
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 27496
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define double long double
#define ll long long
#define INF LLONG_MAX/3
#define P std::pair<int,int>
#define prique priority_queue<int,vector<int>,greater<int>>
using namespace std;
int n,m;
signed main(){
	cin>>n>>m;
	bool b=false;
	if(!b&&n==1){
		if(m>=2)cout<<m-2<<endl;
		else if(m==1)cout<<1<<endl;
		else cout<<0<<endl;
		b=true;
	}
	swap(n,m);
	if(!b&&n==1){
		if(m>=2)cout<<m-2<<endl;
		else if(m==1)cout<<1<<endl;
		else cout<<0<<endl;
		b=true;
	}
	if(!b&&n==2){
		cout<<0<<endl;
		b=true;
	}
	swap(n,m);
	if(!b&&n==2){
		cout<<0<<endl;
		b=true;
	}
	if(!b)cout<<(n-2)*(m-2)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N; cin >> N;
	VI A(N);
	REP(i, N)cin >> A[i];

	int dp[3010][3010];

	FOR(i, 0, N) {
		REP(L, N) {
			int R = L + i;
			if (L == R) {
				if ((N - (R - L + 1)) % 2 == 0) {
					dp[L][R] = A[L];
				}
				else dp[L][R] = -A[L];
				continue;
			}
			if (N - (R - L + 1) < 0)continue;
			if (R > N)continue;

			if ((N - (R - L + 1)) % 2 == 0) {//先手の手番＿最大化しようとする

				dp[L][R] = max(dp[L + 1][R] + A[L], dp[L][R - 1] + A[R]);
			}
			else {
				dp[L][R] = min(dp[L + 1][R] - A[L], dp[L][R - 1] - A[R]);
			}
		}
	}

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

	//REP(i, N)FOR(j, i, N)cout << i << " " << j << " " << dp[i][j] << endl;

	return 0;
}



Measured memory_bytes: 70656
#include <bits/stdc++.h>
using namespace std;
#define ld long long double
#define ll long long
#define mod 1000000007
#define scl(x) scanf("%lld",&x)
#define pb push_back

ll mul(ll a,ll b){
	return ((a%mod)*(b%mod))%mod;
}

ll power(ll a,ll b) {
    ll res=1LL;
    while(b>0){
        if(b&1) res = mul(res,a);
        b/=2;
        a = mul(a,a);
    }
    return res%mod;
}

int main(){
	ll n;
	cin >> n;
	string s;
	cin >> s;
	map<char,ll>mp;
	for(auto i : s)mp[i]++;
	ll cnt=1LL;
	for(auto i : mp){
		cnt = (cnt*(i.second+1))%mod;
	}	
	cnt = (cnt-1+mod)%mod;
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;
 public class Main{

	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int d;
        int r;
        double f;
         d=a/b;
         r=a%b;
         f=1.0*a/b;

        System.out.print(d+" ");
        System.out.print(r+" ");
        System.out.println(String.format("%.5f",f));
	}

 }


Measured memory_bytes: 26464
#include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
long long cmpfunc (const void * a, const void * b) {
   return ( *(long long*)a - *(long long*)b );
}



int main(void){
   
long long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,a,b,count1=0,a2,b2;
float k;
scanf("%lld",&n);
k=(n%2)?(n/2+1*(1.0))/n:(n/2*(1.0))/n;
printf("%.9f",k);
return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=2020,MAX=100005;
const ll INF=1LL<<62;
const long double eps=1e-10;
int K;
long double l,r,p,e,t;

bool ok(long double a){
    if(t-e-eps<=a&&a<=t+e+eps) return 1;
    else return 0;
}

long double DFS(int turn,long double left,long double right){
    if(turn==K){
        if(ok((left+right)/2.0)) return 1.0;
        else return 0.0;
    }else if(t-e-eps<=left&&right<=t+e+eps) return 1.0;
    else if(right<t-e-eps||t+e+eps<left) return 0.0;
    else if((left+right)/2.0>=t){
        return (1.0-p)*DFS(turn+1,left,(left+right)/2.0)+p*DFS(turn+1,(left+right)/2.0,right);
    }else{
        return p*DFS(turn+1,left,(left+right)/2.0)+(1.0-p)*DFS(turn+1,(left+right)/2.0,right);
    }
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>K>>l>>r>>p>>e>>t;
    
    cout<<fixed<<setprecision(25)<<DFS(0,l,r)<<endl;
}




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

int32_t main(){
    ios::sync_with_stdio(0);cin.tie(0);
    
    int a,b;
    cin>>a>>b;

    int g=__gcd(a,b),ans=1;
    for(int i=2;i*i<=g;i++){
        if(g%i==0){
            ans++;
            while(g%i==0){
                g/=i;
            }
        }
    }
    if(g!=1){
        ans++;
    }
    cout<<ans;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
ll inf=1000000000000000000;
ll mod=1000000007;
int main(){
  ll n;cin>>n;
  ll c[n];for(ll i=0;i<n;i++)cin>>c[i];
  ll la[200010];
  fill(la,la+200010,-1);
  ll dp[n];
  dp[0]=1;
  la[c[0]]=0;
  for(ll i=1;i<n;i++){
    dp[i]=dp[i-1];
    if(la[c[i]]==-1){
      la[c[i]]=i;
    }
    else{
      if(la[c[i]]==i-1){
        la[c[i]]=i;
        continue;
      }
      else{
        dp[i]+=dp[la[c[i]]];
        la[c[i]]=i;
      }
      dp[i]%=mod;
    }
  }
  cout<<dp[n-1]%mod<<endl;
  //for(ll i=0;i<n;i++)cout<<dp[i]<<" ";
}

Measured memory_bytes: 4992
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}


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


	int N = getint(), K = getint();

	int A[200001] = {};
	rep(i, N) {
		A[getint()]++;
	}
	int n[200001] = {};
	rep(i, 200001) {
		n[A[i]]++;
	}
	int kotae = N;
	for (int i = 200000; i >= 1; i--) {
		int k = min(K, n[i]);
		kotae -= k * i;
		K -= k;
	}
	printf("%d", kotae);

	Would you please return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner src = new Scanner(System.in);
		
		double r  = src.nextDouble();
		double a = r * r * Math.PI;
		double b = r * 2 * Math.PI;
		
		System.out.println(String.format("%.6f %.6f",a ,b));
		
	}
}


Measured memory_bytes: 28244
unittest
{
	assert( [ "5", "10 4 8 7 3" ].parse.expand.solve == 2 );
	assert( [ "7", "4 4 5 6 6 5 5" ].parse.expand.solve == 3 );
	assert( [ "4", "1 2 3 4" ].parse.expand.solve == 0 );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	input.popFront;
	auto hs = input.front.split.to!( long[] );
	return tuple( hs );
}

auto solve( long[] hs )
{
	auto ans = 0L;
	auto c = 0L;
	auto p = 0L;
	foreach( h; hs )
	{
		if( h <= p ) c++;
		else         c = 0;
		if( ans < c ) ans = c;
		p = h;
	}
	return ans;
}


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

typedef struct Point{
  double x;
  double y;
}P;

void koch(P p1, P p2, int i, int n){ // 今深さi，深さnまで
  if(n == 0){
    // cout << p1.x << " " << p1.y << endl;
    printf("%.8f %.8f\n", p1.x, p1.y);
    return;
  }

  P s, u, t;
  double th = M_PI * 60.0 / 180.0; // 60度をラジアンで
  s.x = (2 * p1.x + 1 * p2.x) / 3;
  s.y = (2 * p1.y + 1 * p2.y) / 3;
  t.x = (1 * p1.x + 2 * p2.x) / 3;
  t.y = (1 * p1.y + 2 * p2.y) / 3;
  u.x = s.x + (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th);
  u.y = s.y + (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th);

  if(i < n-1){
    koch(p1, s, i+1, n);
    koch(s, u, i+1, n);
    koch(u, t, i+1, n);
    koch(t, p2, i+1, n);
  }else{
    // cout << p1.x << " " << p1.y << endl;
    // cout << s.x << " " << s.y << endl;
    // cout << u.x << " " << u.y << endl;
    // cout << t.x << " " << t.y << endl;
    printf("%.8f %.8f\n", p1.x, p1.y);
    printf("%.8f %.8f\n", s.x, s.y);
    printf("%.8f %.8f\n", u.x, u.y);
    printf("%.8f %.8f\n", t.x, t.y);
  }
  return;
}



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

  P pst = {0.0, 0.0};
  P pen = {100.0, 0.0};

  koch(pst, pen, 0, n);

  // cout << pen.x << " " << pen.y << endl;
  printf("%.8f %.8f\n", pen.x, pen.y);

  return 0;
}


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

#define FOR(i,b,e) for(int i=(b); i <= (e); ++i)
#define FORD(i,b,e) for(int i=(b); i >= (e); --i)
#define SIZE(c) (int) (c).size()
#define FORE(i,c) FOR(i,0,SIZE(c)-1)
#define FORDE(i,c) FORD(i,SIZE(c)-1,0)

#define pb push_back
#define mp make_pair
#define st first
#define nd second


using namespace std;

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

typedef vector <int> VI;
typedef vector <bool> VB;
typedef vector <pii> VP;
typedef vector <ll> VL;
typedef vector <pll> VPL;

typedef vector <VI> VVI;
typedef vector <VL> VVL;
typedef vector <VB> VVB;
typedef vector <VP> VVP;

const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000000000000001LL;

void extend(int v, VVI &g, VB &vis, VI &path) {
    vis[v] = true;
    
    for (int u : g[v]) if (!vis[u]) {
        path.pb(u);
        extend(u, g, vis, path);
        
        return ;
    }
}

/*************************************************************************/

int main() {
    ios_base::sync_with_stdio(0);
    
    int n, m;
    cin >> n >> m;
    
    VVI g(n);
    FOR(i,1,m) {
        int u, v;
        cin >> u >> v; u--; v--;
        
        g[u].pb(v);
        g[v].pb(u);
    }
    
    VB vis(n, false);
    VI path = {0};
    
    extend(0, g, vis, path);
    
    reverse(path.begin(), path.end());
    
    extend(0, g, vis, path);
    
    cout << SIZE(path) << '\n';
    for (int v : path) {
        cout << 1 + v << ' ';
    }
    
    return 0;
}

/*************************************************************************/


Measured memory_bytes: 12536
#include<stdio.h>

#define MAX 2000000
#define INF 99999999

int H,A[MAX + 1];

void max(int i){
  int l,r,big;
  int swap;
  l = i * 2;
  r = l + 1;

  if(l <= H && A[l] > A[i]) big = l;
  else big = i;
  if(r <= H && A[r] > A[big]) big = r;

  if(big != i){
    swap = A[i];
    A[i] = A[big];
    A[big] = swap;
    max(big);
  }
}

int extract() {
  int maxv;
  if(H < 1) return -INF;
  maxv = A[1];
  A[1] = A[H--];
  max(1);
  return maxv;
}

void increas(int i, int key){
  int swap;
  if(key < A[i]) return;
  A[i] = key;
  while(i > 1 && A[i / 2] < A[i]){
    swap = A[i];
    A[i] = A[i / 2];
    A[i / 2] = swap;
    i = i / 2;
  }
}

void insert(int key){
  H++;
  A[H] = -INF;
  increas(H,key);
}


int main(){
  int key;
  char o[10];

  while(1){
    scanf("%s",o);
    if(o[0] == 'e' && o[1] == 'n')break;
    if(o[0] == 'i'){
      scanf("%d",&key);
      insert(key);
    }
    else{
      printf("%d\n",extract());
    }
  }
  
  return 0;
}



Measured memory_bytes: 5632
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int, int>;

int func(string s, string t) {
  int ans = 0;

  for (char c = 'a'; c <= 'z'; c++) {
    bool founds = false;
    bool foundt = false;

    for (int i = 0; i < s.size(); i++) {
      if (s[i] == c) {
        founds = true;
      }
    }
    for (int i = 0; i < t.size(); i++) {
      if (t[i] == c) {
        foundt = true;
      }
    }
    if (founds && foundt) ans++;
  }
  return ans;
}

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

  int ans = 0;
  for (int i = 0; i <= n; i++) {
    int tmp = func(s.substr(0, i), s.substr(i));
    ans = max(ans, tmp);
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 3608
import math




perimeter,N = map(int,input().split())
data = list(map(int,input().split()))


biggest_gap = perimeter-(data[-1]-data[0])

for i in range(1,len(data)):
    biggest_gap = max(biggest_gap,data[i]-data[i-1])

shortest_path = perimeter-biggest_gap

print(shortest_path)


                      
                      



Measured memory_bytes: 77388
use std::cmp;

fn main() {
    let mut sc = Scanner::new();
    let s = sc.read::<String>().chars().collect::<Vec<_>>();
    let n = s.len();

    let mut right = 0;
    let mut left = n - 1;
    let mut ans = 0;
    while right < left {
        if s[right] == s[left] {
            right += 1;
            left -= 1;
        } else if s[right] == 'x' {
            ans += 1;
            right += 1;
        } else if s[left] == 'x' {
            ans += 1;
            left -= 1;
        } else {
            println!("-1");
            return;
        }
    }

    println!("{}", ans);
}

struct Scanner {
    ptr: usize,
    length: usize,
    buf: Vec<u8>,
    small_cache: Vec<u8>,
}

impl Scanner {
    fn new() -> Scanner {
        Scanner { ptr: 0, length: 0, buf: vec![0; 1024], small_cache: vec![0; 1024] }
    }

    fn load(&mut self) {
        use std::io::Read;
        let mut s = std::io::stdin();
        self.length = s.read(&mut self.buf).unwrap();
    }

    fn byte(&mut self) -> u8 {
        if self.ptr >= self.length {
            self.ptr = 0;
            self.load();
            if self.length == 0 {
                self.buf[0] = b'\n';
                self.length = 1;
            }
        }

        self.ptr += 1;
        return self.buf[self.ptr - 1];
    }

    fn is_space(b: u8) -> bool { b == b'\n' || b == b'\r' || b == b'\t' || b == b' ' }

    fn read<T>(&mut self) -> T where T: std::str::FromStr, T::Err: std::fmt::Debug, {
        let mut b = self.byte();
        while Scanner::is_space(b) {
            b = self.byte();
        }

        for pos in 0..self.small_cache.len() {
            self.small_cache[pos] = b;
            b = self.byte();
            if Scanner::is_space(b) {
                return String::from_utf8_lossy(&self.small_cache[0..(pos + 1)]).parse().unwrap();
            }
        }

        let mut v = self.small_cache.clone();
        while !Scanner::is_space(b) {
            v.push(b);
            b = self.byte();
        }
        return String::from_utf8_lossy(&v).parse().unwrap();
    }
}



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

#define int long long
typedef vector<int> vint;
typedef pair<int, int> pint;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template<typename T, typename U> inline bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> inline bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
struct Init {
    Init() {
        cout << fixed << setprecision(20);
    };
} init;

int N, M;
int S[2200], T[2200];
int dp[2200][2200];
int mod = 1e9 + 7;
signed main() {
    cin >> N >> M;
    dp[0][0] = 1;
    for (int i = 1; i <= N; i++) { cin >> S[i], dp[i][0] = 1; }
    for (int i = 1; i <= M; i++) { cin >> T[i], dp[0][i] = 1; }
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= M; j++) {
            dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
            if (S[i] != T[j]) { (dp[i][j] += mod - dp[i - 1][j - 1]) %= mod; }
        }
    }
    cout << dp[N][M] << endl;
}

Measured memory_bytes: 35072
fun main(args: Array<String>) {
    val (h, w) = readLine()?.split(" ")?.map(String::toInt) ?: return
    val squares = mutableListOf<MutableList<Char>>()
    repeat(h) {
        val line = readLine() ?: return
        if (line.any { it == '#' }) {
            squares.add(line.toMutableList())
        }
    }
    var j = w - 1
    while (j >= 0) {
        if (squares.all { line ->
                line[j] == '.'
            }) {
            squares.forEach {
                it.removeAt(j)
            }
        }
        j--
    }
    println(squares.joinToString(separator = "\n") { it.joinToString(separator = "") })
}


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

int main() {
  int N ;
  cin >> N ;
  vector <char> c(N) ;
  for ( int i=0 ; i< N ; i++ ) {
    cin >> c.at(i);
    if (c.at(i) == 'Y'){
      cout << "Four"  << endl;
      return 0 ;
  }
  }
    cout << "Three" << endl;
}

Measured memory_bytes: 3576