akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    ll N; cin >> N;
    string ans = "";

    if(N == 0){
        cout << 0 << endl;
        return;
    }

    while(N != 1){
        if(N % -2 != -1){
            ans = to_string(N%-2) + ans;
            N /= -2;
        }else{
            ans = to_string(1) + ans;
            N = N / -2 + 1;
        }
    }
    cout << "1" + ans << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 4352
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, x; cin >> n;  x = 1;
    for(int i=1;i<=n;i++) x = x % MOD * i;
    cout << x % MOD;
    cout << endl;
    return 0;
}




Measured memory_bytes: 256
#include<string>
#include<vector>
#include<algorithm>
#include<iostream>
using namespace std;
const int latte=300000;
int main(){
    bool flag[latte];
    fill(flag,flag+latte,true);
    flag[0]=flag[1]=false;
    for(int i=2;i*i<latte;i++){
        if(flag[i]){
            for(int j=i*i;j<latte;j+=i)flag[j]=false;
        }
    }

    int n;
    while(cin>>n,n){
        int cnt=0;
        for(int i=n+1;i<=n*2;i++)
            if(flag[i])cnt++;

        cout<<cnt<<endl;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


ll INF = 1e9;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}

//-----------------------------------------
//-----------------------------------------

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  vll cnt(26,0);
  string s;
  while(getline(cin,s)){
  int n = SZ(s);
  REP(i,n){
    int k;
    int a = s[i] - 'a';
    int b = s[i] - 'A';
    if(0 <= a && a < 26) cnt[a]++;
    else if(0 <= b && b <26) cnt[b]++;
  }}
  REP(i,26) cout << (char)(i + 'a') << " : " << cnt[i] <<endl;




  return 0;
}



Measured memory_bytes: 3228
#include <algorithm>
#include <array>
#include <vector>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <queue>

using namespace std;



int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (abs(c - a) <= d) {
		cout << "Yes" << endl;
		return 0;
	}
	if (abs(c - b) <= d && abs(b - a) <= d) {
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
	return 0;
}

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

fn main() {
    input! {
        n:usize,
       mut d:[i64;n],
        m:usize,
        mut t:[i64;m],
    }

    d.sort();
    t.sort();

    let mut mm = BTreeMap::new();
    for &x in t.iter() {
        *mm.entry(x).or_insert(0) += 1;
    }

    for &x in d.iter() {
        *mm.entry(x).or_insert(0) -= 1;
    }
    let mut ans = true;
    dbg!(&mm);
    for (_, v) in mm {
        if v > 0 {
            ans = false;
            break;
        }
    }
    if ans {
        println!("YES");
    } else {
        println!("NO");
    }
}


Measured memory_bytes: 16644
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF ((long long)1e18)
#define MOD ((int)1e9+7)
#define endl "\n"

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

#define MAX

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N;
	int a[10], ans = 0;
	
	cin>>N;
	
	for(int i = 0; i < 5; i++){
		cin>>a[i];
		if(i && a[i] > a[i-1]) a[i] = a[i-1];
		// cout<<i<<" "<<a[i]<<endl;
	}
	
	// ans += 5;
	for(int i = 0; i < 5; i++){
		// ans += (N+a[i]-1)/a[i];
		if(!i) ans = (N+a[i]-1)/a[i];
		else ans = max(ans,(N+a[i]-1)/a[i]+i);
		// cout<<i<<" "<<ans<<endl;
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String args[]) {
       Scanner sc = new Scanner(System.in);
       int x = sc.nextInt();
       int n = sc.nextInt();
       HashMap<Integer, Integer> map = new HashMap<>();
       for(int i = 1; i <= n; i++){
           map.put(sc.nextInt(), 1);
       }
       if(n == 0){
           System.out.println(x);
       }
       else{
           int left = x;
           int right = x;
           while(map.containsKey(left) && map.containsKey(right)){
               left--;
               right++;
           }
           if(!map.containsKey(left)){
               System.out.println(left);
           }
           else{
               System.out.println(right);
           }
       }
    }
}

Measured memory_bytes: 35716
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main() {
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);

	if (a < b && b < c) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
	
return		0;
}

Measured memory_bytes: 580
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

int MOD_BIG = 1000000007;
int MOD_BIG2 = 998244353;
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using std::vector;

#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

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


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

int main() {
    
    int N;
    cin >> N;
    
    ll tot = 1;
    REP(i, N) {
        tot *= 10;
        tot %= MOD_BIG;
    }
    ll non = 2;
    REP(i, N) {
        non *= 9;
        non %= MOD_BIG;
    }
    ll dab = 1;
    REP(i, N) {
        dab *= 8;
        dab %= MOD_BIG;
    }
    
    ll ans = (tot-non+dab+MOD_BIG) % MOD_BIG;
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3632
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

def main():
    A,B,K = LI()
    A_ans = A-K if A>=K else 0
    B_ans = B-(K-A) if K>A else B
    B_ans = B_ans if B_ans>=0 else 0
    print(A_ans,B_ans)

main()



Measured memory_bytes: 27192
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String dishNumStr = sc.nextLine();
		String eatOrderStr = sc.nextLine();
		String[] eatOrderArray = eatOrderStr.split(" ");
		String firstSatisfactionStr = sc.nextLine();
		String[] firstSatisfactionArray = firstSatisfactionStr.split(" ");
		String secondSatisfactionStr = sc.nextLine();
		String[] secondSatisfactionArray = secondSatisfactionStr.split(" ");
		
		int result = 0;
		for(int i = 0; i < Integer.parseInt(dishNumStr); i++) {
			int eatNum = Integer.parseInt(eatOrderArray[i]);
			result += Integer.parseInt(firstSatisfactionArray[eatNum-1]);
			
			if(i != Integer.parseInt(dishNumStr)-1) {
				int eatNumNext = Integer.parseInt(eatOrderArray[i+1]);
				if(eatNum+1 == eatNumNext) {
					result += Integer.parseInt(secondSatisfactionArray[eatNum-1]);
				}	
			}
		}
		
		System.out.println(result);
		sc.close();
	}
}


Measured memory_bytes: 23636
from queue import deque
N,Q = map(int,input().split())
tree = [[] for i in range(N+1)]
for i in range(N-1):
    a,b = map(int,input().split())
    tree[a].append(b)
    tree[b].append(a)

ans = {i+1:0 for i in range(N)}
for i in range(Q):
    p,x = map(int,input().split())
    ans[p] += x

checked = [False for i in range(N+1)]
myq = deque()
myq.append(1)

while myq:
    v = myq.pop()
    checked[v] = True
    for n in tree[v]:
        if not checked[n]:
            ans[n] += ans[v]
            myq.append(n)
print(' '.join(str(ans[i]) for i in range(1,N+1)))

Measured memory_bytes: 84768
a, b, c, k = map(int, input().split())
cnt=0
s=0
if a >= k:
    s = k
    k = 0
else:
    s+=a
    k-=a
    if b >= k:
        s+=0
        k =0
    else:
        s+=0
        k-=b
        if c >= k:
            s-=k
            k =0
        else:
            s-=c
            k=0
print(s)

Measured memory_bytes: 9132
#include<stdio.h>

void judge(int);

int main(){
  int n, i;
  
  scanf("%d",&n);
  for(i=1;i<=n;i++) judge(i);

  printf("\n");
  return 0;
}

void judge(int a){
  int n;
  
  if(a%3==0) printf(" %d",a);
  
  else{
    n=a;
    while(n>0){
      if(n%10==3){
	printf(" %d",a);
	break;
      }
      n/=10;
    }
  }
}



Measured memory_bytes: 2084
N = int(input())
A = list(map(int, input().split()))
X = [0] * N

X[0] = sum(A) - 2 * (sum([A[i] for i in range(N) if i % 2 == 1]))

for i in range(N - 1):
	X[i + 1] = 2 * A[i] - X[i]

print(" ".join(map(str, X)))


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

int n,l1=0,l2=0;
int a[100100];

int main(){
	cin>>n;
	for (int i=1;i<=n;i++) cin>>a[i];
	sort(a+1,a+n+1);
	for (int i=n;i>1;i--){
		if (a[i]==a[i-1]){
			i--;
			if (l1==0) l1=a[i];
			else{
				l2=a[i];
				break;
			}
		}
	}
	cout<<(long long)l1*l2<<endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
long long factor(int n)
{long long count=0;
    for(int i=1;i*i<=n;i++)
    {
        if(n%i==0)
        {
            count+=2;
        }
        if(i*i==n)
        {
            count--;
        }
    }
 //cout<<n<<" "<<count<<endl;
 return count;
}
int main()
{
  int n;
    cin>>n;
    long long ans=1;
    for(int i=2;i<n;i++)
    {
        long long a=factor(i);
        ans+=a;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
using namespace std;

typedef pair<int, int> P;
typedef unsigned long long ll;

const int inf = 999999999;
const int mod = 1000000007;

int dp[110][10010];

int main(){
	int n, w;
	cin >> n >> w;
	int a[n], b[n];
	for(int i = 0; i < n; i++){
		cin >> a[i + 1] >> b[i + 1];
	}
	for(int i = 0; i < n; i++){
		for(int j = 0; j <= w; j++){
			if(j >= b[i + 1]){
				dp[i + 1][j] = max(dp[i][j], dp[i][j - b[i + 1]] + a[i + 1]);
			}else{
				dp[i + 1][j] = dp[i][j];
			}
		}
	}
	cout << dp[n][w] << endl;
	return 0;
}

Measured memory_bytes: 7004
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const int inf = 1e5;
//typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
struct SegmentTree{
  int N;
  vector<int> node;
  public :
    void intit(vector<int>v){
      int sz = v.size();
      N=1;
      while(N<sz) N*=2;
      node.resize(N);
      for(int i=0 ; i<sz ; i++) node[i+N-1] = v[i];
      for(int i=N-2 ; i>=0 ; i--) node[i] = min(node[i*2+1], node[i*2+2]);
    }
    void update(int x, int val){
      x += N-1;
      node[x+N-1] = val;
      while(x>0){
        x = (x-1)/2;
        node[x] = min(node[x*2+1], node[x*2+2]);
      }
    }
    int getmin(int a, int b, int k, int l, int r){
      if(b<=l || r<=a) return inf;
      else if(a<=l && r<=b) return node[k];
      else{
        int vl = getmin(a, b, 2*k+1, l, (l+r)/2);
        int vr = getmin(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
      }
    }
};
ll func(ll k){
  switch(k%4){
    case 0 : return k;
    case 1 : return 1LL;
    case 2 : return k+1;
    case 3 : return 0;
  }
  return 0;
}
int main(){
  ll A, B;  cin>>A>>B;
  if(A!=0) A--;
  ll ans = func(A)^func(B);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
// header {{{
#include <bits/stdc++.h>
using namespace std;
#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y
#define ASSERT(expr...) assert((expr))
using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
// }}}
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

//--------------------------------------------------------------------

signed main() {
    int a,p;
    cin>>a>>p;
    cout<<(a*3+p)/2<<endl;

    // cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import math

def plot(x,y):
    print(f'{x:.8f} {y:.8f}')

def koch(n,x1,y1,x2,y2):
    if n==0:
        plot(x1,y1)
        return

    sx = (2*x1+x2)/3
    sy = (2*y1+y2)/3
    tx = (x1+2*x2)/3
    ty = (y1+2*y2)/3
    ux = (tx-sx)*(1/2)-(ty-sy)*(math.sqrt(3)/2)+sx
    uy = (tx-sx)*(math.sqrt(3)/2)+(ty-sy)*(1/2)+sy
    koch(n-1,x1,y1,sx,sy)
    koch(n-1,sx,sy,ux,uy)
    koch(n-1,ux,uy,tx,ty)    
    koch(n-1,tx,ty,x2,y2)    
    

n=int(input())
koch(n,0,0,100,0)
plot(100,0)



Measured memory_bytes: 5752
#include <bits/stdc++.h>
using namespace std;
int n, a[110];
int main() {
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];
	for(int i = 0; i < n; i++) {
		for(int j = i - 1; j >= 0; j--) {
			if(a[j] > a[j + 1]) swap(a[j], a[j + 1]);
			else break;
		}
		for(int j = 0; j < n; j++) {
			if(j>=1) cout << ' ';
			cout << a[j];
		}
		cout << endl;
	}
	return 0;
}



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

void solve(std::istream& ist, std::ostream& ost)
{
    /* ------- 宣言と入力 ------- */

    int A, B;

    ist >> A >> B;

    /* ------- 計算 ------- */

    int ans_A = ceil((double)A / 0.08);
    int ans_B = ceil((double)B / 0.1);

    int ans_max = max(ans_A, ans_B);

    double tax_max;
    int judge;

    if (ans_A > ans_B)
    {
        tax_max = 0.1;
        judge = B;
    }
    else
    {
        tax_max = 0.08;
        judge = A;
    }

    int tmp = floor((double)ans_max * tax_max);

    if (floor((double)ans_max * tax_max) == judge)
    {
        ost << max(ans_A, ans_B) << endl;
    }
    else
    {
        ost << "-1" << endl;
    }
}

#ifndef WOMAIN
int main()
{
    solve(std::cin, std::cout);
    return 0;
}
#endif



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

int main(){
    int n;
    std::cin >> n;
    std::vector<int> vec(n);
    //std::cout << "size : " << vec.size() << std::endl;
    for(auto& elem : vec){
        std::cin >> elem;
        //std::cout << elem << std::ends;
    }
    //std::cout << std::endl;
    std::sort(vec.begin(), vec.end());
    // for(const auto& elem : vec){
    //     std::cout << elem << std::ends;
    // }
    // std::cout << std::endl;
    // std::cout << std::endl;
    // std::sort(vec.begin(), vec.end());
    float sum = vec[0];
    for(auto itr = vec.begin() + 1; itr != vec.end(); ++itr){
        sum = (sum + static_cast<float>(*itr)) / 2.0;
        //std::cout << sum << std::ends;
    }
    //std::cout << std::endl << "sum : ";
    std::cout << sum << std::endl;
}

Measured memory_bytes: 256
a,b,c=map(int,input().split())
if a >b:
    x = a
    a = b
    b= x
else:
    pass

if b >c:
    y = c
    c=b
    b=y
else:
    pass
if a > b:
    x = a
    a = b
    b = x
else:
    pass

print (a,b,c)

Measured memory_bytes: 7656
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(long long i=0;i<n;++i)
#define REPR(i,n) for(long long i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(v) {for(long long sitr=0;sitr<v.size();++sitr){cin>>v[sitr];}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  string s;
  cin >> s;

  int red = 0, blue = 0;
  REP(i,s.length()){
    if(s[i] == '1'){
      blue++;
    }else{
      red++;
    }
  }
  cout << min(blue, red) * 2 << endl;
  return 0;
}



Measured memory_bytes: 512
n = int(input())
l = list(map(int, input().split()))
L = sorted(l, reverse=True)
a = 0
b = 0
for i in range(n):
  if i % 2 == 0:
    a = L[i] + a
  else:
    b = L[i] + b
print(a-b)

Measured memory_bytes: 9044
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string x,y,z;
	cin>>x>>y>>z;
	for(int i=0;i<100;i++)
	if(65<=(int)y[i]<=90)
	{
		cout<<"A"<<y[0]<<"C"<<endl;
		break;
		}
		return 0;
		
}

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

int main() {
	int n;
	cin >> n;
	vector<int> a(n), b(n, 0);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < n; i++) {
		while (a[i] % 2 == 0) {
			b[i]++;
			a[i] /= 2;
		}
	}
	cout << *min_element(b.begin(), b.end()) << endl;
	return 0;
}

Measured memory_bytes: 256
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let d: Vec<u32> = (0..n).map(|_| read()).collect();

    let mut sum = 0;

    for i in 0..d.len() {
        for j in 0..i {
            sum += d[i] * d[j];
        }
    }

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

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <set>
using namespace std;
#define INF 0x3f3f3f3f
typedef long long LL;
typedef unsigned long long ULL;
typedef double DB;

const int MaxN = 800;
int n, m, k;
int dx[5] = {0, -1, 0, 1, 0}, dy[5] = {0, 0, 1, 0, -1};
int dis[MaxN + 5][MaxN + 5];
char a[MaxN + 5][MaxN + 5];
bool vis[MaxN + 5][MaxN + 5];
struct Node {
	int x, y, t;
}seq[MaxN * MaxN + 5], s;

bool Check(int x, int y) {
	if(x < 1 || x > n) return 0;
	if(y < 1 || y > m) return 0;
	if(vis[x][y]) return 0;
	return 1;
}

void Bfs(Node s) {
	memset(vis, 0, sizeof(vis));
	int head = 1, tail = 0;
	seq[++tail] = s; vis[s.x][s.y] = 1; s.t = 0;
	while(head <= tail) { 
		Node now = seq[head];
		if(now.t == k) break;
		for(int i = 1; i <= 4; i++) {
			Node p; p.x = now.x + dx[i]; p.y = now.y + dy[i];
			p.t = now.t + 1;
			if(Check(p.x, p.y) && a[p.x][p.y] != '#')
				seq[++tail] = p, vis[p.x][p.y] = 1;
		}
		head++;
	}
	memset(dis, 0x3f, sizeof(dis));
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
			if(vis[i][j]) dis[i][j] = 0;
	head = 1;
	while(head <= tail) {
		Node now = seq[head];
		for(int i = 1; i <= 4; i++) {
			Node p; p.x = now.x + dx[i]; p.y = now.y + dy[i];
			if(Check(p.x, p.y)) {
				seq[++tail] = p;
				vis[p.x][p.y] = 1;
				dis[p.x][p.y] = dis[now.x][now.y] + 1;
			}
		}
		head++;
	}
	int ans = INF;
	for(int i = 1; i <= n; i++) {
		ans = min(ans, (dis[i][m] + k - 1) / k + 1);
		ans = min(ans, (dis[i][1] + k - 1) / k + 1);
	}
	for(int j = 1; j <= m; j++) {
		ans = min(ans, (dis[n][j] + k - 1) / k + 1); 
		ans = min(ans, (dis[1][j] + k - 1) / k + 1);
	}
	printf("%d\n", ans);
}

int main()
{
	scanf("%d%d%d", &n, &m, &k);
	for(int i = 1; i <= n; i++) {
		getchar();
		for(int j = 1; j <= m; j++) {
			scanf("%c", &a[i][j]);
			if(a[i][j] == 'S') s.x = i, s.y = j;
		}
	}
	Bfs(s);
}

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

using namespace std;

int main()
{
	int n;
	cin >> n;
	int p[20];
	for (int i = 0; i < n; i++)
		cin >> p[i];

	int answer = 0;

	for (int i = 1; i < n - 1; i++)
	{
		int a = p[i - 1];
		int b = p[i];
		int c = p[i + 1];

		// bが最大
		if (b > a && b > c)
			continue;
		// bが最小
		else if (b < a && b < c)
			continue;
		// それ以外 = 真ん中の大きさの値
		else
			answer += 1;
	}

	cout << answer;

	return 0;
}

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


void solve(std::vector<long long> A)
{
    if(A[0]+A[1]+A[2]>=22)
        cout<<"bust"<<endl;
    else
        cout<<"win"<<endl;
}

int main()
{
    std::vector<long long> A(3);
    for(int i = 0 ; i < 3 ; i++){
        scanf("%lld",&A[i]);
    }
    solve(std::move(A));
    return 0;
}


Measured memory_bytes: 256
N,Q=map(int,input().split())
Ss=[i for i in input()]
counterlist=[0]*N
for s in range(len(Ss)-1):
    if Ss[s]=="A" and Ss[s+1]=="C":
        counterlist[s+1]=1
for c in range(len(counterlist)-1):
    counterlist[c+1]+=counterlist[c]
for i in range(Q):
    l,r = map(int,input().split())
    print(counterlist[r-1]-counterlist[l-1])

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

typedef long long ll;
int N;
const int MAX_N = 200000;
ll A[MAX_N], B[MAX_N];
priority_queue<int> U;

void check_insert(int i)
{
  int i_prev = (i + N - 1) % N, i_next = (i + 1) % N;
  if (B[i] - A[i] >= B[i_prev] + B[i_next])
  {
    U.push(i);
  }
}

ll solve()
{
  ll res = 0;
  for (int i = 0; i < N; ++i)
  {
    check_insert(i);
  }
  while (!U.empty())
  {
    int i = U.top();
    U.pop();
    int i_prev = (i + N - 1) % N, i_next = (i + 1) % N;
    ll k = (B[i] - A[i]) / (B[i_prev] + B[i_next]);
    B[i] -= k * (B[i_prev] + B[i_next]);
    res += k;
    check_insert(i_prev);
    check_insert(i);
    check_insert(i_next);
  }
  for (int i = 0; i < N; ++i)
  {
    if (A[i] != B[i])
    {
      return -1;
    }
  }
  return res;
}

int main()
{
  cin >> N;
  for (int i = 0; i < N; ++i)
  {
    cin >> A[i];
  }
  for (int i = 0; i < N; ++i)
  {
    cin >> B[i];
  }
  cout << solve() << endl;
  return 0;
}


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

int main() {
    int N, M, count, hyou;
    count = 0;
    hyou = 0;
    cin >> N >> M;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        hyou = hyou + A[i];
    }
    double a = 1.0*hyou / (M * 4);
    for (int i = 0; i < N; i++) {
        if (a <= A[i]) {
            count++;
        }
    }
    if (count >= M) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
N,K,Q=map(int,input().split())
points = [0 for i in range(N)]
for i in range(Q):
  a = int(input())
  points[a-1] += 1
  
for i in range(N):
  if K-Q+points[i]<=0:
    print('No')
  else:print('Yes')

Measured memory_bytes: 9928
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1194&lang=jp

#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>
#include<iomanip>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

int r, n;
map<int,map<int,double>> height;

bool judge(double base) {
	REP(x, -r, r) {
		double y = height[x][x+1] - base;
		if(x*x + y*y < r*r) {
			return true;
		}
		if((x+1)*(x+1) + y*y < r*r) {
			return true;
		}
	}
	return false;
}

int main() {
	cout << setprecision(5) << fixed;
	
	while(cin >> r >> n, r != 0) {	
		height.clear();
		double lx, rx, h;
		rep(i, n) {
			cin >> lx >> rx >> h;
			REP(x, lx, rx) {
				height[x][x+1] = max(h, height[x][x+1]);
			}
		}
		
		bool is_dead=false;
		double base = -r;
		double t = 0.0, step=0.0001;
		while(true) {
			base += step; 
			bool is_dead = judge(base);
			if(is_dead) break;
			t += step;
		}

		cout << t << endl;
	}
	return 0;
}

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

#define ll          long long
#define endl        "\n"
#define inf         10000000002
#define pb          push_back
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define MAX         100
#define yes         cout<<"YES"<<endl
#define no          cout<<"NO"<<endl
#define bye         return 0

int main()
{
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      cout.tie(NULL);
      //freopen("inputNew.txt", "r", stdin);

      ll n;
      cin>>n;
      ll ans=0;

      if(n>=1800) ans=1;
      else if(n>=1600) ans=2;
      else if(n>=1400) ans=3;
      else if(n>=1200) ans=4;
      else if(n>=1000) ans=5;
      else if(n>=800) ans=6;
      else if(n>=600) ans=7;
      else if(n>=400) ans=8;

      cout<<ans<<endl;


      bye;
}


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

int main()
{
	int n;
	string s;
	cin>>n;
	cin>>s;
	if(n%2!=0)
	{
		cout<<"No"<<endl;
		return 0;
	} 
	for(int i=0;i<n/2;i++) if(s[i]!=s[n/2+i]) {cout<<"No"<<endl; return 0;}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
#define YMAX 250001
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N,A[200001];
	int flag=1;
	ll count=0;
	scan(N);
	rep(i,N){
		scan(A[i]);
		if(i!=0){
			if(A[i-1]+2<=A[i]) flag=0;
		}
		else if(A[i]!=0) flag=0;
	}
	if(flag){
		rep(i,N){
			if(A[i]!=0){
				if(A[i]==A[i-1]+1) count++;
				else count+=A[i];
			}
		}
		prin(count);
	}
	else{
		prin(-1);
	}
	return 0;
}


Measured memory_bytes: 1024
n = int(input())
p = list(map(int,input().split()))
x = list(map(int,input().split()))
g = [[] for i in range(n)]
for i in range(n-1):
  g[p[i]-1].append(i+1)
kyo = [float("inf")] * n
def dfs(x,y):
  kyo[x] = y
  for i in g[x]:
    dfs(i,y+1)
dfs(0,0)
hukai = []
for i in range(n):
  hukai.append([kyo[i],i])
hukai.sort(key = lambda x:-x[0])
INF = float("inf")
dp = [0]*n
for j,i in hukai:
  if len(g[i]) == 0:
    continue
  tmp = []
  MIN = 0
  MAX= 0
  for k in g[i]:
    tmp.append([dp[k],x[k]])
    MIN += min(dp[k],x[k])
    MAX += max(dp[k],x[k])
  d = {}
  d[MAX] = MIN
  for k in tmp:
    MIN = min(k)
    MAX = max(k)
    co = list(d.keys())
    co.sort(key = lambda x:-x)
    for l in co:
      d[l-MAX+MIN] = min(d.get(l-MAX+MIN, INF),d[l]-MIN+MAX)
  co = list(d.keys())
  co.sort()
  for l in co:
    if d[l] <= x[i]:
      dp[i] = l
      break
  else:
    print("IMPOSSIBLE")
    exit()
print("POSSIBLE")


Measured memory_bytes: 108892
#include <iostream>
#include <string>
#include <set>

void extendPrefix(int prefix[], int n)
{
    for (int i = 1; i <= n; ++i)
        prefix[i] += prefix[i - 1];
}

int main()
{
    char a[4010];
    int n;
    std::cin >> n;

    int rprefix[4010] = { 0 }, gprefix[4010] = { 0 }, bprefix[4010] = { 0 };

    for (int i = 1; i <= n; ++i)
    {
        std::cin >> a[i];
        if (a[i] == 'R')
            ++rprefix[i];
        else if (a[i] == 'G')
            ++gprefix[i];
        else if (a[i] == 'B')
            ++bprefix[i];
    }

    extendPrefix(rprefix, n);
    extendPrefix(bprefix, n);
    extendPrefix(gprefix, n);

    long long int ans = 0;
    for (int j = 2; j <= n; ++j)
    {
        for (int k = j + 1; k <= n; ++k)
        {
            int i = 2*j - k;
            if (a[j] == 'R' && a[k] == 'B')
            {
                if (i >= 1 && a[i] == 'G')
                    --ans;
                ans += gprefix[j-1];
            }
            else if (a[j] == 'R' && a[k] == 'G')
            {
                if (i >= 1 && a[i] == 'B')
                    --ans;
                ans += bprefix[j-1];
            }
            else if (a[j] == 'G' && a[k] == 'R')
            {
                if (i >= 1 && a[i] == 'B')
                    --ans;
                ans += bprefix[j-1];
            }
            else if (a[j] == 'G' && a[k] == 'B')
            {
                if (i >= 1 && a[i] == 'R')
                    --ans;
                ans += rprefix[j-1];
            }
            else if (a[j] == 'B' && a[k] == 'R')
            {
                if (i >= 1 && a[i] == 'G')
                    --ans;
                ans += gprefix[j-1];
            }
            else if (a[j] == 'B' && a[k] == 'G')
            {
                if (i >= 1 && a[i] == 'R')
                    --ans;
                ans += rprefix[j-1];
            }
        }
    }

    std::cout << ans;
}


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

using namespace std;

#define lp(i,n) for(int i = 0; i <n;i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define MP make_pair
#define SZ(v) ((int)((v).size()))
typedef long long ll;

const ll MOD = 1e9 + 7;
const int OO = (int)1e6;
const int N = (int)1e7;

void init(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
int a[N];
int main() {
//	#   ifdef LOCAL_PROJECT
//        freopen("in.txt", "r", stdin);
//    #   endif
    int n;
    scanf("%d",&n);
    int start=0,end=1;
    int ans=0;
    int cnt =0,pre,cur;
    scanf("%d",&pre);
    for(int i=1;i<n;i++){
        scanf("%d",&cur);
        if(pre>=cur){cnt++;ans = max(ans,cnt);}
        else cnt=0;
        pre= cur;
    }
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 256
// Contest: Panasonic Programming Contest 2020 (https://atcoder.jp/contests/panasonic2020)
// Problem: D: String Equivalence (https://atcoder.jp/contests/panasonic2020/tasks/panasonic2020_d)


// region {{{ boilerplate
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <chrono>
#include <cstdint>
#include <deque>
#include <exception>
#include <forward_list>
#include <functional>
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#if __cplusplus >= 201703L
#   include <optional>
#   include <string_view>
#   include <variant>
#endif

using namespace std;

#if __cplusplus >= 201703L
#   define all(a)      begin(a),end(a)
#   define sz(x)       ((int)size(x))
#else
#   define all(a)      (a).begin(),(a).end()
#   define sz(x)       ((int)(x).size())
#endif

#define rep(a, b)      for(int a = 0; a < (b); ++a)
#define reps(a, b, c)  for(int a = (b); a < (c); ++a)
#define trav(a, b)     for(auto& a : b)

using ll = long long;
using ld = long double;
using u64 = uint64_t;
using u32 = uint32_t;

using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vpi = vector<pi>;

#if __cplusplus >= 201703L
#   define MAYBE_UNUSED [[maybe_unused]]
#else
#   define MAYBE_UNUSED
#endif

MAYBE_UNUSED static constexpr int INF = (int)1e9 + 5;
MAYBE_UNUSED static constexpr ll INFL = (ll)1e18 + 5;
MAYBE_UNUSED static mt19937 rng((u32)chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count());
//endregion }}}

void rec(string& s, int u, int n) {
    if (sz(s) == n) {
        cout << s << '\n';
        return;
    }
    rep(i, u) {
        s.push_back('a' + i);
        rec(s, u, n);
        s.pop_back();
    }
    s.push_back('a' + u);
    rec(s, u + 1, n);
    s.pop_back();
}

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

    int n; cin >> n;
    string s;
    rec(s, 0, n);

    return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define pi pair<int,int>
#define pl pair<long long,long long>
#define lg length()
#define sz size()
#define pb push_back
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005

long long n,a,b,c;

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> n; a=2; b=1;
    for(int i=2;i<=n;i++){
        c=a+b;
        a=b;
        b=c;
    }
    cout << b;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

using Pi = pair<int, int>;
using ll = long long;
const int INF = 1 << 28;

string to_string(string s) {
  return s;
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  for (int i = 0; i < v.size() - 1; ++i) {
    ret += to_string(v[i]) + ",";
  }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() {
  cerr << endl;
}

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

void get() {}

template <class Head, class... Tail>
void get(Head& head, Tail&... tail) {
  cin >> head;
  get(tail...);
}

template <class T>
void getv(vector<T>& vec) {
  for (int i = 0; i < vec.size(); ++i)
    cin >> vec[i];
}

struct Union_Find {
  vector<int> data;
  vector<int> dist;
  Union_Find(int size) { data = vector<int>(size, -1);dist=vector<int>(size,0); }
  bool union_set(int x, int y) {
    x = root(x);

    y = root(y);
    if (x != y) {
      if (data[y] < data[x])
        swap(x, y);
      data[x] += data[y];
      data[y] = x;
    }
    return x != y;
  }
  bool find(int x, int y) { return root(x) == root(y); }
  int root(int x) { return data[x] < 0 ? x : root(data[x]); }
  int size(int x) { return -data[root(x)]; }
  int get_dist(int x){
    int dis=0;
    while(data[x]>=0){
      dis+=dist[x];
      x=data[x];
    }
    return dis;
  }
};

int main() {
  int N,M;
  get(N,M);
  Union_Find uf(N);
  FOR(i,M){
    int L,R,D;
    get(L,R,D);
    L--;R--;
    if(uf.find(L,R)){
      if(uf.get_dist(L)+D!=uf.get_dist(R)){
        print("No");
        return 0;
      }
    }else{
      if(uf.data[uf.root(L)]>uf.data[uf.root(R)]){
        swap(L,R);
        D=-D;
      }
      int rt=uf.root(R),dis=uf.get_dist(R);
      uf.dist[rt]=D-dis+uf.get_dist(L);
      uf.union_set(L,R);
    }
  }
  print("Yes");
  return 0;
}


Measured memory_bytes: 1152
# ABC141E - Who Says a Pun?
class RollingHash:
    def __init__(self, source: str, base=1000000007, mod=9007199254740997):
        self.source = source
        self.length = len(source)
        self.base = base
        self.mod = mod
        self.hash = self._get_hash_from_zero()
        self.power = self._get_base_pow()

    def _get_hash_from_zero(self):  # compute hash of interval [0, right)
        cur, hash_from_zero = 0, [0]
        for e in self.source:
            cur = (cur * self.base + ord(e)) % self.mod
            hash_from_zero.append(cur)
        return hash_from_zero

    def _get_base_pow(self):  # computer mod of power of base
        cur, power = 1, [1]
        for i in range(self.length):
            cur *= self.base % self.mod
            power.append(cur)
        return power

    def get_hash(self, l: int, r: int):  # compute hash of interval [left, right)
        return (self.hash[r] - self.hash[l] * self.power[r - l]) % self.mod


def main():
    N = int(input())
    S = input().rstrip()
    rh, ok, ng = RollingHash(S), 0, N // 2 + 1
    while ng - ok > 1:
        mid = (ok + ng) // 2
        flg, memo = 0, set()
        for i in range(N - 2 * mid + 1):
            memo.add(rh.get_hash(i, i + mid))
            if rh.get_hash(i + mid, i + 2 * mid) in memo:
                flg = 1
                break
        if flg:
            ok = mid  # next mid will be longer
        else:
            ng = mid  # next mid will be shorter
    print(ok)  # max length of substrings appeared twice or more


if __name__ == "__main__":
    main()

Measured memory_bytes: 53612
#include<stdio.h>
#include <math.h>

int main(void){
    long long int n,k,r,a;
    scanf("%lld %lld",&n,&k);
    if(k!=0){
        r=n%k;
        if(r<fabs(r-k)){
            a=r;
        }else{
            a=fabs(r-k);
        }
    }else{
        a=n;
    }
    printf("%lld",a);
    return 0;
}

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

#define NIL (Node *)-1

struct Node {
	int key;
	Node *p, *left, *right;
	Node( int k ) { key = k; p = left = right = NIL; }
};
Node *root = NIL;

void insert( Node *z )
{
	Node *y = NIL;
	Node *x = root;
	while( x != NIL ) {
		y = x;
		if( z->key < x->key ) {
			x = x->left;
		}
		else {
			x = x->right;
		}
	}
	z->p = y;
	if( y == NIL ) {
		root = z;
	}
	else if( z->key < y->key ) {
		y->left = z;
	}
	else {
		y->right = z;
	}
}

Node *find( int key )
{
	Node *x = root;
	while( x != NIL ) {
		if( key == x->key ) {
			return x;
		}
		else if( key < x->key ) {
			x = x->left;
		}
		else {
			x = x->right;
		}
	}
	return x;
}

void del( int key )
{
	Node *z = find( key );
	if( z == NIL ) return;
	Node *y;
	if( z->left == NIL || z->right == NIL ) {
		y = z;
	}
	else { // have 2 childs
		if( z->right != NIL ) {
			Node *x = z->right;
			while( x->left != NIL ) {
				x = x->left;
			}
			y = x;
		}
		else {
			Node *x = z;
			y = x->p;
			while( y != NIL && x != y->right ) {
				x = y;
				y = y->p;
			}
		}
	}
	Node *x;
	if( y->left != NIL ) {
		x = y->left;
	}
	else {
		x = y->right;
	}
	if( x != NIL ) {
		x->p = y->p;
	}
	if( y->p == NIL ) {
		root = x;
	}
	else if( y == y->p->left ) {
		y->p->left = x;
	}
	else {
		y->p->right = x;
	}
	if( y != z ) {
		z->key = y->key;
	}
}

void printp( Node *n )
{
	if( n == NIL ) return;
	cout << " " << n->key;
	printp( n->left );
	printp( n->right );
}

void printm( Node *n )
{
	if( n == NIL ) return;
	printm( n->left );
	cout << " " << n->key;
	printm( n->right );
}

int main()
{
	int m;
	cin >> m;
	for( int i = 0; i < m; i++ ) {
		string com;
		cin >> com;
		if( com == "insert" ) {
			int k;
			cin >> k;
			Node *n = new Node( k );
			insert( n );
		}
		else if( com == "print" ) {
			printm( root );
			cout << endl;
			printp( root );
			cout << endl;
		}
		else if( com == "find" ) {
			int k;
			cin >> k;
			string ans = "no";
			if( find( k) != NIL ) ans = "yes";
			cout << ans << endl;
		}
		else {
			int k;
			cin >> k;
			del( k );
		}
	}
}



Measured memory_bytes: 21776
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define each(i,c) for(auto i=(c).begin();i!=(c).end();++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define clr(a) memset((a),0,sizeof(a))
#define nclr(a) memset((a),-1,sizoef(a))
#define sz(s) (int)((s).size())
#define INRANGE(x,s,e) ((s)<=(x) && (x)<(e))
#define pb push_back
#define MP(x,y) make_pair((x),(y))

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	int N; ll L; cin >> N >> L;
	vector<ll> a(N,0LL);
	rep (i, N) cin >> a[i];

	int idx = -1;
	rep (i, N-1){
		if (a[i] + a[i+1] >= L){
			idx = i;
			break;
		} // end if
	} // end rep

	if (idx == -1){
		cout << "Impossible" << endl;
	}else{
		cout << "Possible" << endl;
		++idx;
		vector<int> ans; ans.clear();
		for (int i = idx; i <= N - 1; ++i) ans.push_back(i);
		for (int i = idx - 1; i >= 1; --i) ans.push_back(i);
		reverse(ALL(ans));
		rep (i, ans.size()){
			cout << ans[i] << endl;
		} // end rep
	} // end if
		
	return 0;
}

Measured memory_bytes: 2168