akhauriyash/Code-Regression huggingface dataset:
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod= 1e+9+7;

int main(){
    ll x; cin>>x;
    ll s=100;
    ll ans=0;
    while(1){
        s+=s/100;
        ans++;
        if(s>=x){
            cout<<ans<<endl;
            return 0;
        }
    }
}





Measured memory_bytes: 3596
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
#include<numeric>
using namespace std;
using ll = long long;
int main(){
  int n, l;
  cin >> n >> l;
  int sum = 0;
  int mini = 1001001001;
  for(int i = 0; i < n; i++) {
    mini = min(mini, abs(l + (i + 1) - 1));
  }
  bool flag = true;
  for(int i = 0; i < n; i++) {
    if(flag == true && abs(l+(i+1)-1) == mini){
      flag = false;
      continue;
    }
    sum += l + (i + 1) - 1;
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
package main

import (

"fmt"

)

func main() {
	var x string
	fmt.Scan(&x)
	n := 0
	switch(x) {
	case "MON":
		n = 6
	case "TUE":
		n = 5
	case "WED":
		n = 4
	case "THU":
		n = 3
	case "FRI":
		n = 2
	case "SAT":
		n = 1
	case "SUN":
		n = 7
	}
	fmt.Println(n)
}




Measured memory_bytes: 512
import math
A,B,H,M = [int(i) for i in input().split()]

tmp = (60*H+M)/(60*12) - M/60
# print((60*H+M)/())
rad = math.radians(tmp*360)
c2 = A*A + B*B - 2*A*B*math.cos(rad)
print(math.sqrt(c2))


Measured memory_bytes: 9376
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
using vs = vector<string>; using tll = tuple<ll, ll, ll>; using vtll = vector<tll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define co(i) cout << i << endl;
#define co2(i,j) cout << i << " " << j << endl;
#define co3(i) cout << i << " ";
#define po(i) cout << i.first << " " << i.second << endl;
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop, bitSearch, bitList, nod, digitDP, treeDP//
//gcdlcm, isPrime, eratos, primeFactorize, Npow, combination, divisor, modinv, doubling//
//dfs, bfs, dijkstra, WarshallFloyd, BellmanFord, UnionFind, Kruskal, RMQ, LCA//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007, INF = 1LL << 60, ans = 0, z = 0, o = 1;
vl flag, D; vll path;
//***********//
int main() {
	ll T;
	cin >> T;
	for (k = 0; k < T; k++) {
		ll N;
		cin >> N;
		vpll C, D;
		ll ans = 0;
		for (i = 0; i < N; i++) {
			ll k, l, r;
			cin >> k >> l >> r;
			ans += min(l,r);
			if (l - r >= 0) C.push_back(mp(k, l - r));
			else if(k!=N)D.push_back(mp(N-k, r - l));
		}
		sort(C.begin(), C.end());
		sort(D.begin(), D.end());
		multiset<ll> Q, R;
		for (i = 0; i < C.size(); i++) {
			if (Q.size() < C[i].first) {
				Q.insert(C[i].second);
			}
			else if (*Q.begin() < C[i].second) {
				Q.erase(Q.begin());
				Q.insert(C[i].second);
			}
		}
		for(i=0;i<D.size();i++){
			if (R.size() < D[i].first) {
				R.insert(D[i].second);
			}
			else if (*R.begin() < D[i].second) {
				R.erase(R.begin());
				R.insert(D[i].second);
			}
		}
		for (auto itr = Q.begin(); itr != Q.end(); ++itr) {
			ans += *itr;
		}
		for (auto itr = R.begin(); itr != R.end(); ++itr) {
			ans += *itr;
		}
		co(ans);
	}
}

Measured memory_bytes: 15572
import math


X = int(input())

p = 2
q = 2
tmp = 4

while p < math.sqrt(X):
    q = 2
    while 1:
        if p ** q > X:
            break
        else:
            if tmp < p ** q:
                tmp = p ** q
            q += 1
    p += 1
if X > 3:
    print(tmp)
else:
    print(1)


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){

    int X,Y;cin>>X>>Y;

    int ans=0;
    while(X<=Y){
        ans++;
        X*=2;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

m,k = inm()
if m==0 and k==0:
    print('0 0')
    exit()
if m==0 and k>0:
    print('-1')
    exit()
if m==1 and k==0:
    print('0 0 1 1')
    exit()
if m==1 and k>0:
    print('-1')
    exit()
if k>=2**m:
    print('-1')
    exit()

if k==0:
    printn('0 0')
    for i in range(1,2**m):
        printn(' {} {}'.format(i,i))
    print('')
    exit()

u = [False]*(2**m)
u[k] = True
a = []
cnt = 0
for i in range(1,2**m):
    j = i^k
    if not u[i] and not u[j]:
        a.append(i)
        u[j] = True
        cnt += 1
        if cnt==2**(m-1)-1:
            break

s = [x for x in a]
t = [x for x in a]
t.reverse()
s.extend([0,k,0])
s.extend(t)
v = [x^k for x in a]
t = [x for x in v]
t.reverse()
s.extend(v)
s.append(k)
s.extend(t)

printn(s[0])
for i in range(1,len(s)):
    printn(' ' + str(s[i]))
print("")


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define all(a) begin(a),end(a)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_h(const vector<T>& c, int n=INT_MAX)
{ rep(i, min(n, (int)c.size())) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
#define D1(a) cout<<#a<<":"<<a<<"\n"
#define D2(a,b) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<endl 
#define D3(a,b,c) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c <<endl
#define D4(a,b,c,d) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c<<","<<#d<<":"<<d<<endl 
#define MOD 1000000007

int main()
{
    int N, K;
    string S;
    cin >> N >> K >> S;
    int h = 0;
    int bound = 0;
    rep1(i, N) {
        if (S[i] == S[i-1]) h++;
        else bound++;
    }

    int q = bound / 2;
    int r = bound % 2;

    int ans = h + 2 * min(K, q) + ((K > q) ? r : 0);

    cout << ans << endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>

using namespace std;
using ll = long long;

int main()
{
    ll n;
    cin >> n;
    string ans;
    while(n){
        n--;
        ans += string(1,'a'+n%26);
        n /= 26;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
import sys
S = sys.stdin.buffer.readlines()
A = []
B = []
for s in S:
    A.append(s.split()[0].decode())
    B.append(s.split()[1].decode())

for a, b in zip(A, B):
    if(int(a) == 0 and int(b) == 0):
        break
    if(int(a) >= int(b)):
        print(f"{b} {a}")
    else:
        print(f"{a} {b}")


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

typedef long long ll;

const int mxN = 3010, mod = 1e9 + 7, mxF = 2e5 + 5;
int H, W, N;
vector<pair<int, int>> p;
ll dp[mxN], fac[mxF], inv[mxF];

bool comp(const pair<int, int>& a, const pair<int, int>& b) {
    return (a.first + a.second < b.first + b.second);
}

ll power(ll x, ll y) {
    ll ret = 1;
    while (y) {
        if (y & 1) {
            ret = ret * x % mod;
        }
        x = x * x % mod;
        y = y >> 1;
    }
    return ret;
}

ll inverse(ll x) {
    return power(x, mod - 2);
}

void pre_process() {
    fac[0] = inv[0] = 1;
    for (int i = 1; i < mxF; i++) {
        fac[i] = (fac[i - 1] * i) % mod;
        inv[i] = inverse(fac[i]);
    }
}

ll nCr(ll n, ll r) {
    ll ret = 0;
    if (n >= 0 && r >= 0 && n >= r) {
        ret = fac[n] * inv[n - r] % mod * inv[r] % mod;
    }
    return ret;
}

ll solve(ll x, ll y) {
    return nCr(x + y, x);
}

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

    cin >> H >> W >> N;
    p.push_back({1, 1});
    for (int i = 0; i < N; i++) {
        int r, c;
        cin >> r >> c;
        p.push_back({r, c});
    }
    p.push_back({H, W});
    sort(p.begin(), p.end(), comp);
    N += 2;
    pre_process();
    dp[0] = 1;
    for (int i = 1; i < N; i++) {
        dp[i] = solve(p[i].first - 1, p[i].second - 1);
        for (int j = 1; j < i; j++) {
            if (p[i].first >= p[j].first && p[i].second >= p[j].second) {
                dp[i] = (dp[i] - solve(p[i].first - p[j].first, p[i].second - p[j].second) * dp[j] + mod) % mod;
            }
        }
    }
    dp[N - 1] = (dp[N - 1] + mod) % mod;
    cout << dp[N - 1];

    return 0;
}

Measured memory_bytes: 6888
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <deque>
#include <complex>
#include <string>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <valarray>
#include <iterator>
using namespace std;
typedef long long int lli;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RREP(i,x) for(int i=(x);i>=0;i--)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) container.begin(), container.end()
#define SZ(container) ((int)container.size())

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;


int S, R, a, b, Q;

vector<pii> edges;

void dijkstra(const vector< vector<pii> > &g, int s, int t, vector<int> &ret){
	int n = g.size();
	ret = vector<int>(n, INF);
	vector< vector<int> > prev(S);

	vector<pii> cand;
	priority_queue<pii, vector<pii>, greater<pii> > dp;
	dp.push(pii(0, s));
	ret[s] = 0;
	while(!dp.empty()){
		int s = dp.top().second;
		dp.pop();
		FOR(it, prev[s]) cand.push_back(pii(*it, s));
		FOR(it, g[s]){
			int t = it->first;
			if(ret[t] > ret[s]+it->second){
				ret[t] = ret[s]+it->second;
				prev[t].clear();
				prev[t].push_back(s);
				dp.push(pii(ret[t], t));
			}else if(ret[t] == ret[s]+it->second){
				prev[t].push_back(s);
			}
		}
	}
	queue<int> q;
	vector<int> vis(S, 0);
	q.push(t);
	vis[t] = 1;
	ret = vector<int>(n, 0);
	while(!q.empty()){
		int s = q.front();
		ret[s] = 1;
		q.pop();
		FOR(it, prev[s]){
			if(!vis[*it]){
				vis[*it] = 1;
				q.push(*it);
			}
		}
	}
	FOR(it, cand) if(ret[it->first] && ret[it->second]) edges.push_back(*it);
}

void solve(vector<ull> src, vector<ull> dest){
	vector<ull> f(S, 0);
	REP(i, src.size()) f[src[i]] |= 1ULL << i;
	FOR(it, edges) f[it->second] |= f[it->first];
	REP(i, dest.size()) puts((f[dest[i]] & (1ULL << i)) ? "Yes" : "No");
}

main(){
	scanf("%d%d", &S, &R);
	vector< vector<pii> > g(S);
	REP(i, R){
		int u, v, w;
		scanf("%d%d%d", &u, &v, &w);
		g[u-1].push_back(pii(v-1, w));
		g[v-1].push_back(pii(u-1, w));
	}
	scanf("%d%d%d", &a, &b, &Q);
	vector<int> dis;
	dijkstra(g, a-1, b-1, dis);
	vector<ull> src(64), dest(64);
	REP(i, Q){
		int c, d;
		scanf("%d%d", &c, &d);
		src[i%64] = c-1;
		dest[i%64] = d-1;
		if(i%64 == 63) solve(src, dest);
	}
	if(Q%64){
		src.resize(Q%64);
		dest.resize(Q%64);
		solve(src, dest);
	}
	return 0;
}

Measured memory_bytes: 19636
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
ll MOD = 1e9 + 7;

int main() {
	ll L, R;
	cin >> L >> R;
	if (R - L + 1 >= 2019) {
		cout << 0 << endl;
		return 0;
	}
	ll ans = 1LL << 60;
	for (ll i = L; i <= R; i++) {
		for (ll j = i + 1; j <= R; j++) {
			ans = min(ans, (i*j) % 2019);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

"""
・最小全域木、Union-Find
"""

import sys
def input(): return sys.stdin.readline().strip()
sys.setrecursionlimit(10 ** 9)

from operator import itemgetter

# Union-Find木
class UnionFind:
    def __init__(self, n):
        # 親要素のノード番号を格納。par[x] == xの時そのノードは根
        # 1-indexedのままでOK、その場合は[0]は未使用
        self.par = [i for i in range(n+1)]
        # 木の高さを格納する（初期状態では0）
        self.rank = [0] * (n+1)

    # 検索
    def find(self, x):
        # 根ならその番号を返す
        if self.par[x] == x:
            return x
        else:
            # 走査していく過程で親を書き換える
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        # 根を探す
        x = self.find(x)
        y = self.find(y)
        # 木の高さを比較し、低いほうから高いほうに辺を張る
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            # 木の高さが同じなら片方を1増やす
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same(self, x, y):
        return self.find(x) == self.find(y)

N = int(input())
X = [[0] * 2 for i in range(N)]
Y = [[0] * 2 for i in range(N)]
for i in range(N):
    x, y = map(int, input().split())
    X[i][0] = x
    X[i][1] = i
    Y[i][0] = y
    Y[i][1] = i
# 元indexを保持して座標位置順にソート
X.sort()
Y.sort()

edges = []
for i in range(1, N):
    # 座標上で隣り合う頂点同士で辺集合を作る
    edges.append((X[i-1][1], X[i][1], X[i][0] - X[i-1][0]))
    edges.append((Y[i-1][1], Y[i][1], Y[i][0] - Y[i-1][0]))
# コスト順にソート
edges.sort(key=itemgetter(2))

uf = UnionFind(N)
ans = 0
grp = N
# Union-Findで閉路を作らない確認をして最小全域木を作る
for x, y, w in edges:
    if not uf.same(x, y):
        uf.union(x, y)
        ans += w
        grp -= 1
    # グループが1つになれば、それ以上やる必要ない
    if grp == 1:
        break
print(ans)


Measured memory_bytes: 60004
#include<cstdio>
#include<algorithm>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
const int INF = 1e9 + 7;

using namespace std;

#define MAX_V 100
int d[MAX_V][MAX_V];

int main(){
    int v,e,a[1000],b[1000],c[1000],ans=0;
    scanf("%d",&v);
    REP(i,v) REP(j,v) d[i][j] = INF;
    REP(i,v) d[i][i] = 0;
    scanf("%d",&e);
    REP(i,e) scanf("%d%d%d",a+i,b+i,c+i);
    REP(i,e){
        --a[i];--b[i];
        d[a[i]][b[i]] = d[b[i]][a[i]] = c[i];
    }

    REP(k,v) REP(i,v) REP(j,v) d[i][j] = min(d[i][j],d[i][k] + d[k][j]);

    bool used;
    REP(i,e){
        used = true;
        REP(s,v) if(d[s][a[i]] + c[i] == d[s][b[i]]) used = false;
        if(used) ++ans;
    }

    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;

int dfs(vector<vector<ll> >& e, int node, vector<int> visited, int depth) {
    visited[node] = 1;
    if (depth == e.size() - 1) {
        return 1;
    }

    auto& c = e[node];
    int sum = 0;
    rep(i, c.size()) {
        if (visited[c[i]] <= 0) {
            sum += dfs(e, c[i], visited, depth + 1);
        }
    }

    return sum;
}

void Main()
{
    ll n, m;
    cin >> n >> m;

    vector<ll> a(m), b(m);
    rep(i, m) cin >> a[i] >> b[i];
    
    vector<vector<ll> > e(n + 1, vector<ll>());
    rep(i, m) {
        e[a[i]].push_back(b[i]);
        e[b[i]].push_back(a[i]);
    }

    vector<int> visited(n + 1);
    put(dfs(e, 1, visited, 1));
}
signed main(){ Main();return 0;}

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

int main() {
  int N = 1000000;
  vector<int> table(N, 1);
  table[0] = table[1] = 0;
  for (int i = 2; i * i < N; i++)
    if (table[i])
      for (int j = i * 2; j < N; j += i)
        table[j] = 0;

  int x;
  while(cin >> x) {
    int ans = 0;
    for (int i = 2; i <= x; i++) {
      if (table[i])
        ans++;
    }
    cout << ans << endl;
  }
}



Measured memory_bytes: 6580
/*
		Author : Kaustubh Gangwar
		||S||A||M||R||A||T||
*/
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ld long double
#define pb push_back
#define gcd __gcd
#define mp make_pair
#define vii vector<int>
#define vll vector<long long>
#define all(x) x.begin(),x.end()
#define f(i,a,b) for(int i=a;i<b;i++)
#define fe(i,a,b) for(int i=a;i<=b;i++)
typedef long long  ll;
typedef pair<int,int> pii;

ll bpow(ll a, ll b) {
	a=a;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

int main()
{	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	
	string s,t;
	cin>>s>>t;
	int n=s.size();
	int ans=0;
	f(i,0,n)
	{
		if(s[i]!=t[i])
		ans++;
	}
		cout<<ans;
	
return 0;
}


Measured memory_bytes: 3764
#include <cmath>
#include <iostream>
#include <vector>
#include <tuple>

int main(){
  int K,X,Y;
  std::cin >> K >> X >> Y;
  int init_x = X, init_y = Y;

  auto L = [&](){return std::abs(X)+std::abs(Y);};
  std::vector<std::tuple<int, int>> move_arr;
  auto xy_move1 = [&](){
    if(X <= -K){
      X += K;
    }else if(X >= K){
      X -= K;
    }else{
      if(Y > 0){
        Y -= K-std::abs(X);
      }else{
        Y += K-std::abs(X);
      }
      X = 0;
    }
    move_arr.emplace_back(X,Y);
  };
  auto xy_move2 = [&](){
    int l = L()/2;
    if(std::abs(X) > std::abs(Y)){
      if(X < 0){
        X += l;
      }else{
        X -= l;
      }
      if(Y < 0){
        Y -= K-l;
      }else{
        Y += K-l;
      }
    }else{
      if(Y < 0){
        Y += l;
      }else{
        Y -= l;
      }
      if(X < 0){
        X -= K-l;
      }else{
        X += K-l;
      }
    }
    move_arr.emplace_back(X,Y);
  };

  if(K&1){
    if(L()&1){
      xy_move1();
    }
    while(L() > 2*K){
      xy_move1();
      xy_move1();
    }
    if(L() > 0){
      xy_move2();
      xy_move1();
    }
  }else{
    if(L()&1){
      std::cout << "-1\n";
      return 0;
    }
    while(L() > 2*K){
      xy_move1();
    }
    if(L() == 0){
    }else if(L() == K){
      xy_move1();
    }else{
      xy_move2();
      xy_move1();
    }
  }
  std::cout << move_arr.size() << "\n";
  for(auto&& it: move_arr){
    int x,y;
    std::tie(x,y) = it;
    std::cout << init_x-x << " " << init_y-y << "\n";
  }

  return 0;
}



Measured memory_bytes: 3952
#include <bits/stdc++.h>
using namespace std;
int main() {
	char str;
	int n[3]={},ans=0,x;
	while(cin>>str){
		if(str=='J'&&n[1]==0&&n[2]==0)n[0]++;
		else if(str=='O'&&n[1]<n[0]&&n[2]==0)n[1]++;
		else if(str=='I'&&n[2]<(x=min(n[0],n[1]))){
			n[2]++;
			if(n[2]==min(n[0],n[1]))ans=max(ans,x);
		}
		else{
			for(int i=0;i<3;i++)n[i]=0;
			if(str=='J')n[0]=1;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1144
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(){
    int N;
    cin >> N;
    int r = 0, b = 0;
    for(int i = 0; i < N; i++){
        char c;
        cin >> c;
        if(c=='R')r++;
        else b++;
    }
    if(r > b)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int i = 0;
  while (i < N) {
    string op;
    cin >> op;
    if (op == "P" || op == "W" || op == "G") {
      i++;
    }
    else {
      break;
    }
  }
  if (i == N) {
    cout << "Three" << endl;
  }
  else {
    cout << "Four" << endl;
  }
}
    
  

Measured memory_bytes: 256
n, x, m = map(int, input().split())

ai = x
i = 0

memo = []
d = {}
tmp = 0

while True:
    if ai in d:
        break
    d[ai] = i
    memo.append(ai)

    ai = (ai ** 2) % m
    i += 1

s = d[ai]
e = i
su = sum(memo[s:])

if n <= e+1:
    print(sum(memo[0:n]))
else:
    zan = n - s
    ans = sum(memo[:s]) + (zan // (e-s)) * su
    if zan % (e-s):
        ans += sum(memo[s:s+(zan % (e-s))])
    print(ans)




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

//C++14 (GCC 5.4.1)

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)

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

template<typename T> inline T divrup(T a, T b) { if (a % b) return a/b+1; else return a/b;}

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)

int main() {
    string S;
    int N;
    cin >>S;
    N=S.size();
    bool isOK=true;
    for(int i=0;i<N;i++){
        if(N-i<5){
            isOK=false;
            break;
        }
        if(S[i]=='d' && S[i+1]=='r'&&S[i+2]=='e'&&S[i+3]=='a'&&S[i+4]=='m'){
            i+=4;
            if(i==N-1)break;
            if(i+2>N-1){isOK=false;break;}
            if(S[i+1]=='e' && S[i+2]=='r'){
                if(i+2==N-1)break;
                if(S[i+3]=='d'||S[i+3]=='e'){
                    i+=2;
                    if(i==N-1)break;
                    continue;
                }else if(S[i+3]=='a') continue;
                else{
                    isOK=false;
                    break;
                }
            }
        }else if(S[i]=='e' && S[i+1]=='r'&&S[i+2]=='a'&&S[i+3]=='s'&&S[i+4]=='e'){
            i+=4;
            if(i==N-1)break;
            if(S[i+1]=='r'){
                i++;
            }
            if(i==N-1)break;
            continue;
            
        }else{
            isOK=false;
            break;
        }
    }
    //-----------------------------------

    cout << ((isOK) ? "YES" : "NO") <<endl;
    return (0);
}

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

#define INF (2e9)
#define FOR(i, a, b) for (ll (i) = (a); (i) < (b); ++(i))
#define REP(i, n) FOR(i, 0, n)

using namespace std;

template<class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

using ll = long long;
using ld = long double;

#define ALL(x) (x).begin(), (x).end()
template<class T>
using vc = vector<T>;
using vi = vc<ll>;
using vvi = vc<vi>;

template<class T>
using va = valarray<T>;
using vad = va<ld>;
using vai = va<ll>;

using pii = pair<ll, ll>;

vi Read(ll n) {
    auto      v = vi(n);
    for (auto i = std::size_t(0); i < n; ++i) {
        cin >> v[i];
    }
    return v;
}

template<class T>
void DumpRow(const T& A) {
    for (const auto& value : A)
        cout << value << "\n";
}

template<class T>
void DumpColumn(const T& A) {
    auto isFirst = true;
    for (const auto& value : A) {
        if (isFirst) {
            cout << value;
            isFirst = false;
        } else {
            cout << " " << value;
        }

    }
    cout << endl;
}

ll SmallerThanWeekP(ll a, ll b, ll c) {
    //if (c <= a) return 1;
    if (7 * a < c) return 7;
    else if (c % a != 0) return ll(c / a) + 1;
    else return c / a;
}

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

    ll a, b, c;

    cin >> a >> b >> c;

    const auto week_p = 7 * a + b;

    ll ans = 0;
    if (week_p >= c) {
        ans = SmallerThanWeekP(a, b, c);
    } else {
        ans = ll(c / week_p) * 7;
        const auto rest = c % week_p;
        if (rest != 0) ans += SmallerThanWeekP(a, b, rest);
    }
    cout << ans << endl;
    return 0;
}



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

int main(){
    string u;
  
  	cin >> u;
    for (int i=0; i<u.length(); i++){
        if(u[i] == '1') {u[i] = '9';}
        else
        {
            u[i] = '1';
        }
            
    }  
  
    cout << u << endl;

    return 0; 
}






Measured memory_bytes: 256
#include <cstdint>
#include <iostream>

using namespace std;

int64_t Gcd(int64_t a, int64_t b)
{
    if (b == 0) {
        return a;
    }
    return Gcd(b, a % b);
}

int64_t PrimeFactors(int64_t num)
{
    int64_t count = 0;
    int64_t factor = 2;

    while (factor * factor <= num) {
        count += (num % factor == 0 ? 1 : 0);
        while (num % factor == 0) {
            num /= factor;
        }
        factor += 1;
    }
    count += (num > 1 ? 1 : 0);

    return count;
}

int main()
{
    int64_t a, b;
    cin >> a >> b;

    auto res = PrimeFactors(Gcd(a, b)) + 1;
    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 256
import sys
write = sys.stdout.write

B, W = map(int, sys.stdin.readline().split())
MOD = 10**9 + 7

L = B+W
fact = [1]*(L+1)
rfact = [1]*(L+1)
for i in range(L):
    fact[i+1] = r = fact[i] * (i+1) % MOD
rfact[L] = pow(fact[L], MOD-2, MOD)
for i in range(L, 0, -1):
    rfact[i-1] = rfact[i] * i % MOD

rev2 = pow(2, MOD-2, MOD)

p = q = 0

L = min(B, W)
r2 = "%d\n" % rev2
for i in range(L):
    write(r2)
base = pow(rev2, L-1, MOD)

rB = rfact[B-1]; rW = rfact[W-1]
for i in range(L, B+W):
    base = rev2 * base % MOD
    if i >= B:
        p = (p + (fact[i-1]*rfact[i-B] % MOD) * (rB * base % MOD) % MOD) % MOD
    if i >= W:
        q = (q + (fact[i-1]*rfact[i-W] % MOD) * (rW * base % MOD) % MOD) % MOD
    write("%d\n" % ((1-p+q)*rev2 % MOD))

Measured memory_bytes: 47836
#include "bits/stdc++.h"
using namespace std;

#define ll long long
const int MAX = 1e6 + 5;
int n,a[MAX], cnt = 0;
bool visited[MAX], f = true;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	memset(visited, 0, MAX);
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	int i = 0;
	while(true){
		if(!visited[i]){
			visited[i] = true;
			cnt++;
			i = a[i] - 1;
			if(i == 1)
				break;
		}
		else{
			f = false;
			break;
		}
	}
	if(f)
		cout<<cnt;
	else
		cout<<-1;
	return 0;
}

Measured memory_bytes: 1664
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let k: usize = sc.read();
    let s: usize = sc.read();
    let mut result: Vec<usize> = (0..k).map(|_| s).collect();

    if s != 1e9 as usize {
        while result.len() != n {
            result.push(s + 1);
        }
    } else {
        while result.len() != n {
            result.push(s - 1);
        }
    }
    for x in result.iter() {
        print!("{} ", x);
    }
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 9596
N = int(input())
A_list = list(map(int, input().split()))
A_dict = dict()
for a in A_list:
    if A_dict.get(a) is None:
        A_dict[a] = 1
    else:
        A_dict[a] += 1
ans = 0
for key, val in A_dict.items():
    temp = 0
    if A_dict.get(key - 1) is not None:
        temp += A_dict.get(key - 1)
    if A_dict.get(key) is not None:
        temp += A_dict.get(key)
    if A_dict.get(key + 1) is not None:
        temp += A_dict.get(key + 1)
    ans = max(temp, ans)
print(ans)


Measured memory_bytes: 20580
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pradyumn Agrawal (coderbond007)
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AAirConditioner solver = new AAirConditioner();
        solver.solve(1, in, out);
        out.close();
    }

    static class AAirConditioner {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int a = in.nextInt();
            out.println(a >= 30 ? "Yes" : "No");
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        private int pread() {
            if (pnumChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= pnumChars) {
                curChar = 0;
                try {
                    pnumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (pnumChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = pread();
            while (isSpaceChar(c))
                c = pread();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = pread();
            }
            int res = 0;
            do {
                if (c == ',') {
                    c = pread();
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = pread();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}



Measured memory_bytes: 32448
#ifdef lolipop
#define _GLIBCXX_DEBUG
#endif

/*
    This ain't a milly rock
    This a money dance
    And my D' ain't hard
    That's a '30 in my pants
*/

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <ctime>
#include <map>
#include <random>
#include <iomanip>
#include <cmath>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>
#include <bitset>
#include <deque>
#include <utility>

#define int long long
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define ld long double

using namespace std;

// mt19937 rnd(time(nullptr));

inline void fastio() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}

const int maxN = 500 + 12;
int dp[maxN][maxN];

void solve() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int df = (a + d - 1) / d;
    int ds = (c + b - 1) / b;
    if(df >= ds) {
        cout << "Yes";
    } else {
        cout << "No\n";
    }
}

signed main() {
#ifdef lolipop
    freopen("input.txt", "r", stdin);
#else
    fastio();
#endif

    int T = 1;
//    cin >> T;
    while(T--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3044
#include<iostream>
#include<queue>
using namespace std;
int p[32000];
int main() {
	
	//D
	int n;
	cin >> n;
	long long int a[100000];
	int i;
	int minuscount = 0;
	long long int suma = 0;
	long long int mina = 1000000001;
	for (i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] >= 0) {
			suma = suma + a[i];
			if (a[i] < mina)mina = a[i];
		}
		else {
			minuscount++;
			if (-a[i] < mina)mina = -a[i];
			suma = suma - a[i];
		}
	}
	if (minuscount % 2 == 1)suma = suma - 2 * mina;
	cout << suma << endl;
	return 0;

	//C
	/*int n;
	cin >> n;
	int a[100000];
	int i,j;
	for (i = 0; i < n; i++) {
		cin >> a[i];
	}
	//int p[32000];
	int flag = 0;
	int pp = 0;
	for (i = 2; i < 32000; i++) {
		for (j = 0; j * j <= i; j++) {
			if (i % j == 0) {
				flag = 1;
				break;
			}
		}
		if (flag == 0) {
			p[pp] = i;
			pp++;
		}
	}
	for (i = 0; i < pp; i++) {
		for (j = 0; j < n; j++) {
			if (a[i] % p[pp] == 0) {

			}
		}
	}*/

	//B
	/*int n;
	cin >> n;
	int i;
	int cost = 0, v[20], c[20];
	for (i = 0; i < n; i++) {
		cin >> v[i];
	}
	for (i = 0; i < n; i++) {
		cin >> c[i];
	}
	for (i = 0; i < n; i++) {
		if (v[i] - c[i] > 0) {
			cost = cost + v[i] - c[i];
		}
	}
	cout << cost << endl;
	return 0;
	*/
	//A
	/*
	int a, b, t;
	cin >> a >> b >> t;
	int bb = 0;
	int aa = 0;
	while (aa + a <= t) {
		bb = bb + b;
		aa = aa + a;
	}
	cout << bb << endl;
	return 0;
	*/
}

Measured memory_bytes: 1024
# 初期入力
N = int(input())
S = [tuple(map(str, input().split())) for i in range(2)]

from itertools import permutations
kaijo =[str(i) for i in range(1,N+1)]
junretu = [t for t in permutations(kaijo) ]
nanbannme_1 =junretu.index(S[0])
nanbannme_2 =junretu.index(S[1])
print(abs(nanbannme_1 - nanbannme_2))
"""
print(nanbannme_1)
print(nanbannme_2)
print(junretu)
print(S)
"""

Measured memory_bytes: 7924
n = int(input())
if n > 1:
    A = list(map(int, input().split()))
else:
    A = [int(input())]

right = 0
tot = 0
count = 0

for left in range(n):
    while (right < n) and (tot + A[right] == tot ^ A[right]):
        tot += A[right]
        right += 1
    
    count += right - left
    
    if right == left:
        right += 1
    else:
        tot -= A[left]

print(count)

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

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	for (int &e : A) cin >> e;
	int ans = 1e9;
	for (int i = -100; i <= 100; ++i) {
		int cst = 0;
		for (int e : A) {
			cst += abs(e-i)*abs(e-i);
		}
		ans = min(ans, cst);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
//default
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
typedef pair<int, int> P_i;
typedef pair<double,double> P_d;
#define rep(i,n) for(int i=0;i<(n);++i)
#define alrep(i,j,n) for(int i=0;i<(n);++i)for(int j=i+1;j<(n);++j)
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;int ans=0;
#define answer cout << ans << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int MOD=1e9+7;
const long long INF = 1LL << 60;

signed main(){
  int N;
  cin >> N;
  vector<string> v;
  unordered_map<string,int> mp;
  int res=-1;
  rep(i,N){
    string S;
    cin >> S;
    mp[S]++;
    chmax(res,mp[S]);
  }
  for(auto p:mp){
    if(p.second==res){
      v.push_back(p.first);
    }
  }
  sort(v.begin(),v.end());
  rep(i,v.size()){
    cout << v[i] << endl;
  }
  return 0;
}


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

#define fr(i,n) _back
#define pb	push_back
#define eb	emplace_back
#define mk	make_pair
#define fi	first
#define se	second
#define endl	'\n'

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef tuple<ll,int,int> tl;
typedef vector<tl> vtl;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
const int FULL = 2500 + 3;
const int T = 55;
ll dist[T][FULL+10];
bool vis[T][FULL+10];
vtl g[T];
ii ecg[T];
ll ans[T];
int n,m;
int s;

ll dij() {
    memset(dist, INF, sizeof dist);
    memset(vis, 0, sizeof vis);

    dist[1][min(s,FULL)] = 0;
    priority_queue<tl,vtl,greater<tl>> pq;
    int fdp = min(s,FULL);
    pq.emplace(0ll,fdp,1);
    int falta = n-1;

    while(falta) {
        tl at = pq.top();
        pq.pop();
        ll temp; int tank,u;
        tie(temp,tank,u) = at;

        if(vis[u][tank]) continue;
        vis[u][tank] = 1;
        if(!ans[u] and u > 1) ans[u] = temp, falta--;


        for(auto nxt : g[u]) {
            int v,c; ll t;
            tie(t,c,v) = nxt;
            ll ok = 0;
            for(ll j = 0; ok < FULL; j++) {
                ok = j*ecg[u].fi+tank-c;
                ok = min(ok, (ll)FULL);
                if(ok < 0) continue;
                ll tt = temp + t + j*ecg[u].se;
                if(dist[v][ok] > tt) {
                    dist[v][ok] = tt;
                    pq.emplace(tt,ok,v);
                }
            }
        }
    }
    return 1;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin >> n >> m >> s;

    for(int i = 0; i < m; i++) {
        int u,v,a,b;
        cin >> u >> v >> a >> b;
        g[u].eb(b,a,v);
        g[v].eb(b,a,u);
    }

    for(int i = 1; i <= n; i++) {
        int c,d; cin >> c >> d;
        ecg[i] = mk(c,d);
    }

    dij();
    for(int i = 2; i <= n; i++) cout << ans[i] << endl;


    return 0;
}



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

int main()
{
    ll N, i; cin >> N >> i;
    cout << N - i + 1 << endl;



}


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

int main()
{
  string s; cin >> s;
  vector<char> t(100000,' ');
  
  int j=0;
  for(int i=0;i<s.size();i++){
  	if(i%2 == 0){
      t.at(j) = s.at(i);
      j++;
    }            
  }
  for(int i=0;i<=j;i++){
  	cout << t.at(i);
  }
}

Measured memory_bytes: 512
import java.io.*;
import java.util.*;

class Main{
    final static long MOD = 1000000007;
    FastScanner sc = new FastScanner();

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve(){

        int n = sc.nextInt();

        for(int i = 0; i < n; i++){
            if(Math.floor((i + 1) * 1.08) == n){
                System.out.println(i + 1);
                System.exit(0);
            }
        }

        System.out.println(":(");

    }

    long gcd(long a, long b){ // return aとbの最大公約数
        if(b == 0){
          return a;
        }
        return gcd(b, a % b);
    }

    long pow_mod(long a, long r){ // return a^r (mod MOD)
        long sum = 1;
        while(r > 0){
            if((r & 1) == 1){
                sum *= a;
                sum %= MOD;
            }
            a *= a;
            a %= MOD;
            r >>= 1;
        }
        return sum;
    }

}



class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte(){
        if(ptr < buflen){
            return true;
        }else{
            ptr = 0;
            try{
                buflen = in.read(buffer);
            }catch(IOException e){
                e.printStackTrace();
            }
            if(buflen <= 0){
                return false;
            }
        }
        return true;
    }
    private int readByte(){ if(hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c){ return 33 <= c && c <= 126;}
    public boolean hasNext(){ while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next(){
        if(!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)){
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong(){
        if(!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if(b == '-'){
            minus = true;
            b = readByte();
        }
        if(b < '0' || '9' < b){
            throw new NumberFormatException();
        }
        while(true){
            if('0' <= b && b <= '9'){
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt(){
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble(){ return Double.parseDouble(next());}
}


Measured memory_bytes: 21332
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

#include<bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double d;
typedef long long ll;

const int N=2e5+5;
const int mod=1e9+7;

signed main(){
    FastIO;
    ll a,b,c;
    cin>>a>>b>>c;
    ll x=c-(a+b);
    if(x<0) cout<<"No\n";
    else{
        cout<<(4*a*b<x*x?"Yes\n":"No\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

void solve(long long N, long long M)
{
    ll ansN = 1;
    ll ansM = 1;
    if (abs(N - M) > 1)
    {
        cout << 0 << endl;
        return;
    }

    for (ll i = 1; i <= N; i++)
    {
        ansN = mulMod(ansN, i);
    }

    for (ll i = 1; i <= M; i++)
    {
        ansM = mulMod(ansM, i);
    }

    if (N != M)
    {
        cout << mulMod(ansN, ansM) << endl;
    }
    else
    {
        cout << mulMod(mulMod(ansN, ansM), 2) << endl;
    }
}

int main()
{
    long long N;
    scanf("%lld", &N);
    long long M;
    scanf("%lld", &M);
    solve(N, M);
    return 0;
}


Measured memory_bytes: 256
def print_array(data):
	for i in range(len(data)):
		if i != len(data)-1:
			print("%d" % data[i],end=" ")
		else:
			print("%d" % data[i])

if __name__ == '__main__':
	num = int(input())
	a = [int(i) for i in input().split()]
	for i in range(1,num):
		print_array(a)
		key = a[i]
		j = i - 1
		while j >= 0 and a[j] > key:
			a[j+1] = a[j]
			j -= 1
		a[j+1] = key
	print_array(a)


Measured memory_bytes: 5976
n,k=map(int,input().split())
s=input()
def change(s,k):
  print(s[:k-1],end="")
  if s[k-1]=="A":
      #s[k-1]='a'
      print("a",end="")
  elif s[k-1]=="B":
      #s[k-1]='b'
      print("b",end="")
  else:
      #s[k-1]='c'
      print("c",end="")
  print(s[k:])
change(s,k)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c;
  cin >> a>>b>>c;

int ans =0;
if(a==b&&b!=c)ans=1;
if(b==c&&c!=a)ans=1;
if(c==a&&a!=b)ans=1;

if (ans)  {
  cout << "Yes"<< endl;
} else  {
  cout << "No"<< endl;
}

  return 0;
 }


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef int64_t Int;
typedef pair<Int,Int> P;


Int N;
vector<vector<Int>> G(100010);
map<P,Int> edge_to_num;
vector<Int> color(100010);
Int K = 0;

void dfs(int i, int k = -1, int cng = -1) {
    Int c = 1;
    rep(j, G[i].size()) {
        if (G[i][j] != k) {
            if (c == cng) c++;
            color[edge_to_num[make_pair(i,G[i][j])]] = c;
            dfs(G[i][j], i, c);
            K = max(K, c);
            c++;
        }
    }
    return;
}


int main(){ 
    cin >> N;
    

    vector<Int> a(N-1), b(N-1);
    
    rep(i,N-1) {
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
        G[a[i]].push_back(b[i]);
        G[b[i]].push_back(a[i]);
        edge_to_num[make_pair(a[i],b[i])] = i;
        edge_to_num[make_pair(b[i],a[i])] = i;
    }


    dfs(0);

    cout << K << endl;

    rep(i,N-1) cout << color[i] << endl;
}




Measured memory_bytes: 21376
#include<iostream>
#include<cstdio>
using namespace std;
long double arr[3005],dp[3005][3005];
int main()
{
	int n;
	cin >> n;
	for(int i=0;i<n;i++) {
		cin >> arr[i];
	}
	dp[1][1]=arr[0];
	dp[1][0]=1-arr[0];
	long double sum=0;
	for(int i=2;i<=n;i++) {
		for(int j=0;j<=i;j++) {
			if(j==0) dp[i][j]=(dp[i-1][j]*(1-arr[i-1]));
			else dp[i][j]=(dp[i-1][j-1]*arr[i-1])+(dp[i-1][j]*(1-arr[i-1]));
			//cout <<i<<" "<<j<<" "<<(dp[i-1][j-1]*arr[i-1])<<" "<<(dp[i-1][j]*(1-arr[i-1]))<<" "<<dp[i][j]<<endl;
		}
	}
	/*for(int i=1;i<=n;i++) {
		for(int j=0;j<=n;j++) {
			cout <<dp[i][j]<<" ";
		}
		cout <<endl;
	}*/
	for(int i=n/2+1;i<=n;i++) {
		sum+=dp[n][i];
	}
	printf("%.10Lf",sum);
	return 0;
}


Measured memory_bytes: 139264