akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double lb;
typedef vector<int,vector<int>> vec;
typedef pair<int,int> P;
#define REP(i,j,n) for (int i=j;i<(n);i++)
#define RREP(i,n,j) for (int i = n; j<i;i--)
#define print(out) cout<< out  << "\n";
#define all(vec) vec.begin(),vec.end()
#define mod 1000000007
const int INF = 1e9;

int main(){
  int N;cin>>N;
  vector<P> vec(N);
  vector<int> ans(N);
  REP(i,0,N){
    cin>>vec[i].first;
    vec[i].second=i;
  }
  sort(all(vec));
  int left_mid = vec[N/2-1].first;
  int right_mid = vec[N/2].first;
  REP(i,0,N/2){
    ans[vec[i].second] = right_mid;
  }
  REP(i,N/2,N){
    ans[vec[i].second] = left_mid;
  }
  for_each(all(ans),[](int a){print(a)});

}


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

int main()
{
    int m1, d1;
    cin >> m1 >> d1;
    int m2, d2;
    cin >> m2 >> d2;

    if (m1 != m2) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
}



Measured memory_bytes: 256
#include <cstdio>

int main()
{
    int l, r, d;
    scanf("%d %d %d", &l, &r, &d);
    int counter = 0;
    for (int i = l; i <= r; i++) {
        //printf("here\n");
        if ((i % d) == 0) {
            //printf("here\n");
            counter++;
        }
    }
    printf("%d\n", counter);
    return 0;
}

Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n, k;
	cin >> n >> k;
	int m = n;
	int res = 0;
	while (m > 0) {
		m /= k;
		res++;
	}
	cout << res << endl;


}


Measured memory_bytes: 256
///https://atcoder.jp/contests/nikkei2019-qual/tasks/nikkei2019_qual_d
#include <bits/stdc++.h>
using namespace std;
#define in ({int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;})
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l,int r){return l+rng()%(r-l+1);}
#define fasty ios_base::sync_with_stdio(0),cin.tie(0);
#define forinc(a,b,c) for(int a=b,_c=c;a<=_c;++a)
#define fordec(a,b,c) for(int a=b,_c=c;a>=_c;--a)
#define forv(a,b) for(auto&a:b)
#define fi first
#define se second
#define pb push_back
#define ii pair<int,int>
#define mt make_tuple
#define all(a) a.begin(),a.end()
#define reset(f, x) memset(f, x, sizeof(f))
#define bit(x,i) ((x>>(i-1))&1)
#define on(x,i) (x|(1ll<<(i-1)))
#define off(x,i) (x&~(1<<(i-1)))
#define gg exit(0);

const int N=100010;

int n,m;
int deg[N],fa[N];
vector<int> ad[N];

main(){
    #define task "restore"
    //freopen(task".inp","r",stdin);
    //freopen(task".out","w",stdout);

    n=in,m=in;
    forinc(i,2,n+m){
        int u=in,v=in;
        ad[u].pb(v);
        deg[v]++;
    }
    queue<int> q;
    forinc(i,1,n) if(!deg[i]) q.push(i);
    while(q.size()){
        int u=q.front(); q.pop();
        forv(v,ad[u]){
            deg[v]--;
            if(!deg[v]){
                fa[v]=u;
                q.push(v);
            }
        }
    }
    forinc(i,1,n) cout<<fa[i]<<"\n";
}



Measured memory_bytes: 7040
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


int main()
{
	ll n, p;
	cin >> n >> p;

	vector<ll> a(n);
	ll even = 0;
	ll odd = 0;
	for (ll i = 0; i < n; i++)
	{
		cin >> a[i];

		if (a[i] % 2 == 0)
		{
			even++;
		}
		else
		{
			odd++;
		}
	}

	ull res = 1;
	if (p == 1 && odd == 0)
	{
		res = 0;
	}
	else
	{
		for (ll i = 0; i < even; i++)
		{
			res *= 2;
		}

		for (ll i = 0; i < odd - 1; i++)
		{
			res *= 2;
		}
	}

	println(res);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const ll inf=1e9+7;
const ll INF=1e18;

ll mondiv(ll a,ll m){
    ll b=m;ll u=1;ll v=0;
    while(b){
        ll t=a/b;
        a-=t*b;swap(a,b);
        u-=t*v;swap(u,v);
    }
    u%=m;
    if(u<0)u+=m;
    return u;
}

ll euclid(ll a,ll b,ll m){
    ll c=m;ll u=1;ll v=0;
    while(c){
        ll t=b/c;
        b-=t*c;swap(b,c);
        u-=t*v;swap(u,v);
    }
    u%=m;
    if(u<0)u+=m;
    return (a%m)*u%m;
}

int main(){
    int n;cin>>n;
    ll r=(ll)0,sum=(ll)0;
    vll a(n);
    rep(i,n){
        cin>>a[i];
        r+=a[i]*a[i];
        r%=inf;
        sum+=a[i];
    }
    sum%=inf;
    sum*=sum;
    sum%=inf;
    sum-=r;
    if(sum<0)sum+=inf;
    cout<<euclid(sum,(ll)2,inf)<<endl;
}

Measured memory_bytes: 4732
#include <stdio.h>
int main()
{
	int i[4],n,c;
	while(scanf("%d",&n)!=EOF)
	{
		c=0;
		for(i[0]=0;i[0]<10;i[0]++)
		{
			for(i[1]=0;i[1]<10;i[1]++)
			{
				for(i[2]=0;i[2]<10;i[2]++)
				{
					for(i[3]=0;i[3]<10;i[3]++)
					if(i[0]+i[1]+i[2]+i[3]==n)c++;
	}}}
		printf("%d\n",c);
	}
		
		return 0;
}

Measured memory_bytes: 0
from typing import List, Tuple


def main():
    n, m = map(int, input().split())
    g = []
    for _ in range(m):
        a, b = map(int, input().split())
        g.append((a, b))
    print(br(n, m, g))


def br(n: int, m: int, g: List[Tuple[int, int]]):
    ret = 0
    for i in range(m):
        v = set()
        w = [1]
        while w:
            now = w.pop()
            v.add(now)
            for j, node in enumerate(g):
                if j == i:
                    continue
                if node[0] == now and node[1] not in v:
                    w.append(node[1])
                elif node[1] == now and node[0] not in v:
                    w.append(node[0])
        if len(v) != n:
            ret += 1
    return ret


if __name__ == '__main__':
    main()


Measured memory_bytes: 10272
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

typedef long long ll;

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

// const int C ;
// const int M = 1000000007;

int N;
int a[100010];
int b[100010];

int count(int k) {
  int ans = 0;
  while (k != 0) {
    if ((k & 1) == 1) {
      ans++;
    }
    k = (k >> 1);
  }
  return ans;
}

int main () {
  cin >> N;
  for (auto i = 0; i < N; i++) {
    cin >> a[i];
    b[i] = (a[i] ^ (a[i] - 1));
    // cerr << b[i] << endl;
  }
  int x = 0;
  for (auto i = 0; i < N; i++) {
    x = x ^ a[i];
  }
  vector<int> V;
  while (x != 0) {
    V.push_back(x & 1);
    x = (x >> 1);
  }
  bool visited[100];
  fill(visited, visited+100, true);
  int need = 0;
  for (auto i = 0; i < (int)V.size()-1; i++) {
    if (V[i+1] != V[i]) {
      need++;
      visited[i] = false;
    }
  }
  if (!V.empty()) {
    visited[(int)V.size()-1] = false;
    need++;
  }
  for (auto i = 0; i < N; i++) {
    visited[count(b[i])-1] = true;
  }
  for (auto i = 0; i < 100; i++) {
    if (!visited[i]) {
      cout << "-1" << endl;
      return 0;
    }
  }
  cout << need << endl;
  return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) (int)((x).size())
#define debug(x) cout << #x << ":" << x << ' ';
#define debugg(x) cout << #x << ":" << x << ' ' << "\n";
#define endl "\n"
#define L(X) ((X)<<1)
#define R(X) (((X)<<1)|1)
#define M(X,Y) (((X)+(Y))>>1)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int MAXN = 1e5 + 5;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const long long int LLINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-9;
const double PI = acos(-1);

template<typename T>   T max_self(T& a, T b) { if (a < b) a = b; return a; }
template<typename T>   T min_self(T& a, T b) { if (a > b) a = b; return a; }
template<typename T>   T add(T x, T y) { return ((x % MOD)  + (y % MOD)) % MOD;}
template<typename T>   T mul(T x, T y) { return ((x % MOD) * (long long)(y % MOD)) % MOD;}
template<typename T>   T sub(T x, T y) { return add(x, -y + MOD);}
template<typename T>   T gcd(T a, T b) { return b ? gcd(b, a % b) : a;}
template<typename T>   T lcm(T a, T b) { return a / gcd(a, b) * b;}
template<typename T>   vector<T> read(vector<T>& v, int n) {v.resize(n); for (auto &x : v)cin >> x;}
template<typename T>   void trav(vector<T> &v) {for (int i = 0 ; i < (int)v.size() ; ++i) {cout << v[i]; if (i != (int)v.size() - 1) cout << ' ';}}
int lg2(long long x)   {   return 64 - __builtin_clzll(x) - 1;	}
int lg2(int x)   {   return 32 - __builtin_clzll(x) - 1;	}

struct pair_hash{
	template<class T1, class T2>
	size_t operator() (const pair<T1, T2> &p) const {
		auto h1 = hash<T1>{}(p.first);
		auto h2 = hash<T2>{}(p.second);
		return h1 ^ h2;
	}
};

int n, k, r, s, p, dp[MAXN];
char last[MAXN];
string t;

int getScore(char &c) {
	if(c == 'r') return r;
	if(c == 's') return s;
	if(c == 'p') return p;
	return 0;
}

int getWinner(char &c) {
	if(c == 'r') return 'p';
	if(c == 's') return 'r';
	if(c == 'p') return 's';
	return '0';
}

int solve(int i) {
	if(i == n) return 0;
	if(dp[i] != -1) return dp[i];
	int ans = 0;

	char winner = getWinner(t[i]);

	if(last[i] != winner) {
		if(i + k < n) last[i + k] = winner;
		ans = getScore(winner) + solve(i + 1);
		if(i + k < n) last[i + k] = '0';
	} else {
		ans = solve(i + 1);
	}

	return dp[i] = ans;
}



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

	cin >> n >> k;
	cin >> r >> s >> p;
	cin >> t;

	memset(last, '0', sizeof last);
	memset(dp, -1, sizeof dp);

	cout << solve(0) << endl;

	return 0;
}

Measured memory_bytes: 4048
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>

using namespace std;
using i64=long long int;

int main() {
    int N;
    cin >> N;
    int A, B;
    cin >> A >> B;
    vector<int> pn(3, 0);

    for (int i = 0; i < N; ++i) {
        int t;
        cin >> t;
        if (t <= A) {
            pn[0]++;
        } else if (t > A && t <= B) {
            pn[1]++;
        } else {
            pn[2]++;
        }
    }

    cout << *min_element(pn.begin(), pn.end()) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main() {

#ifndef ONLINE_JUDGE

    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
#endif
    // CODE HERE ::::::::::::::::::::::::::::::::::::::::::
    int l,r,d,cnt(0);
    cin >> l >> r >> d;
    for (int i = l; i <= r; ++i)
    {
        /* code */
        if (i%d == 0){
            cnt++;
        }
    }
    cout << cnt ;
}


Measured memory_bytes: 3448
n=int(input())
A="zabcdefghijklmnopqrstuvwxy"

Z=[0]
for i in range(11):
    Z.append(Z[-1]+26**(i+1))
#print(Z)
    
q=26
C=[]
while n>0:
    if n in Z:
        for i in range(Z.index(n)):
            C.append(0)
        break
    r=n%q
    C.append(r)
    if r==0:
        n-=q
    n//=q
C=list(reversed(C))
ans=""
for c in C:
    ans+=A[c]
print(ans)

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

int main(){
  char str[10];
  cin >> str;
  int ans=0;

  for(int i=0; i<4; i++){
    if(str[i]=='+'){
      ans++;
    }else{
      ans--;
    }
  }

  cout << ans << '\n';

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s,t;cin>>s>>t;
  int n=s.size();
  bool a=0,b;
  for(int i=0;i<n;i++){
    b=1;
    for(int j=0;j<n;j++)
      if(s[(i+j)%n]!=t[j])
        b=0;
    if(b)
      a=1;
  }
  cout<<(a?"Yes":"No")<<endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define repr(i,a,n) for(ll i = n-1;i >= a;i--)
#define LINF (ll)1e17
#define INF 1e9
#define MOD (ll)1e9+7
#define sMOD 1e5
#define fs first
#define sc second
#define setprecision(d) cout << fixed << setprecision(d);

ll gcd(ll a,ll b){
	if(!b) return a;
	return gcd(b,a%b);
	
}

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





signed main(){
	ll n,minn = LINF,cnt = 0;
	cin >> n;
	ll p[n];

	rep(i,0,n) cin >> p[i];

	minn = p[0];

	rep(i,0,n){
		if(minn >= p[i]) cnt++;
		minn = min(minn,p[i]);
	}

	cout << cnt << endl;

    return 0;
}

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

namespace AOJcsharp
{
    class Program
    {
        static void Main(string[] args)
        {
            string str;
            while ((str = Console.ReadLine()) != null)
            {
                if (str == "END OF INPUT") break;
                string[] text = str.Split(' ');
                foreach(string tmp in text){
                    Console.Write(tmp.Length);
                }

                Console.WriteLine();
            }

        }
    }
}

Measured memory_bytes: 5548
#include <cstdio>
#include <string>
using namespace std;

int main()
{
  char s[6];
  
  scanf("%s", s);
  
  if(s[2]==s[3]&&s[4]==s[5])
  {
    printf("Yes");
  	fflush(stdout);
  }
  else
  {
    printf("No");
    fflush(stdout);
  }
  
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int d, t, s;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> d >> t >> s;
	cout << (s * t >= d ? "Yes" : "No");
}

Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T> void DEBUG(string str, T e){if(DEBUG_OUT == false)return;std::cout <<str<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


//CODE
void solve(void)
{  
  int N;
  cin>>N;
  int SUM = 0;
  int MAX = 0;  
  for (int i = 0; i < N; i++)
  {
    int A;
    cin>>A;
    SUM += A;
    chmax(MAX,A);
  }
  if(SUM - MAX > MAX)
  {
    cout<<"Yes"<<endl;
  }
  else
  {
    cout<<"No"<<endl;
  }
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#define ed 200005
#define ll long long
using namespace std;
long long k,n,m,p=1000000007;
long long a[ed],b[ed];
inline ll qpow(ll a,ll b){
    if(b==1) return a;
    ll t=qpow(a,b/2);
    t=t*t%p;
    if(b&1) t=t*a%p;
    return t;
}
inline ll C(ll n,ll m){
    if(n<m) return 0;
    if(m>n-m) m=n-m;
    ll a=1,b=1;
    for(int i=0;i<m;i++){
        a=(a*(n-i))%p;
        b=(b*(i+1))%p;
    }
    return a*qpow(b,p-2)%p;
}
long long abs(long long x){return x>0?x:-x;}
int main()
{
	long long ans=0;
        scanf("%lld%lld",&m,&n);
        ++m;
        for(int i=n;i<=m;i++){
        	ans=(ans+((2*m-1-i)-(i-1))*i/2+1)%p;
		}
        printf("%lld\n",ans%p);

    return 0;
}

Measured memory_bytes: 1736
import sys
from collections import defaultdict
from itertools import accumulate
read = sys.stdin.read

N, K, *A = map(int, read().split())
a = list(accumulate([0] + A))
a = [(a[i] - i) % K for i in range(N + 1)]

answer = 0
dic = defaultdict(int)

for i, x in enumerate(a):
    answer += dic[x]
    dic[x] += 1
    if i >= K - 1:
        dic[a[i - K + 1]] -= 1

print(answer)

Measured memory_bytes: 41760
#include <cstdio>
#include <cstdlib>
#include <limits>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <complex>
using namespace std;

///////////// 未達成 ////////////////

int main() {
	int N;
	int C[500], S[500], F[500], sum = 0;
	cin >> N;
	for (int n = 0; n < N-1; n++) {
		cin >> C[n] >> S[n] >> F[n];
	}
	for (int i = 0; i < N; i++) {
		sum = 0;
		for (int j = i; j < N - 1; j++) {
			if (sum< S[j]) {
				sum = S[j];
			}
			else if (sum % F[j] == 0);
			else
				sum += F[j] - sum % F[j];

			sum += C[j];
		}
		
		cout << sum << endl;
	}
	return 0;
}

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

struct Edge {
    int from, to;
    cost_t cost;
    Edge(int from, int to, cost_t cost) : from(from), to(to), cost(cost) {}
};

using Edges = vector<Edge>;
using Graph = vector<Edges>;
struct LCA{
    static const int LOGN=20;
    array<vector<int>,LOGN+1> par;
    vector<int> dep;
    void dfs(int v,int pre,Graph& g){
        for(auto& e:g[v]){
            if(e.to==pre) continue;
            par[0][e.to]=v;
            dep[e.to]=dep[v]+1;
            dfs(e.to,v,g);
        }
    }

    LCA(Graph& g,int root):dep(g.size()){
        int n=g.size();
        for(int i=0;i<=LOGN;i++) par[i].assign(n,-1);
        dep[root]=0;
        par[0][root]=root;
        dfs(root,-1,g);
        for(int i=0;i<LOGN;i++){
            for(int j=0;j<n;j++){
                par[i+1][j]=par[i][par[i][j]];
            }
        }
    }

    int query(int u,int v){
        if(dep[u]<dep[v]) swap(u,v);
        int d = dep[u]-dep[v];
        for(int i=LOGN;i>=0;i--){
            if((d>>i)&1){
                u = par[i][u];
                d-=(1<<i);
            }
        }
        if(u==v) return u;
        for(int i=LOGN;i>=0;i--){
            if(par[i][u]!=par[i][v]) u=par[i][u],v=par[i][v];
        }
        return par[0][u];
    }
};

int main(){
    int n;
    cin>>n;
    Graph g(n);
    for(int i=0;i<n;i++){
        int k;
        cin>>k;
        while(k--){
            int v; cin>>v;
            g[i].push_back(Edge(i,v,0));
            g[v].push_back(Edge(v,i,0));
        }
    }
    LCA lca(g,0);
    int q;
    cin>>q;
    while(q--){
        int u,v;
        cin>>u>>v;
        cout<<lca.query(u,v)<<endl;
    }
    return 0;
}


Measured memory_bytes: 20168
#include<stdio.h>
int main()
{
    int i,j,n,mul=0;
    scanf("%d",&n);
    int ara[n+1];
    for(i=0;i<n;i++){
        scanf("%d",&ara[i]);
    }
    for(i=0;i<n-1;i++){
        for(j=i+1;j<n;j++){
            mul=mul+(ara[i]*ara[j]);
        }
    }
    printf("%d\n",mul);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define int long long
using namespace std;
double dist(int xi, int yi, int xj, int yj) {
    return (sqrt(pow((xi - xj), 2) + pow(yi - yj, 2)));
}
signed main() {
    int n;
    cin >> n;
    double ans = 0;
    int x[n];
    int y[n];
    int count = 0;
    vector<int> a;
    rep(i, n) a.push_back(i);
    rep(i, n) {
        cin >> x[i] >> y[i];
    }
    do {
        rep(i, n - 1) {
            ans += dist(x[a[i]], y[a[i]], x[a[i + 1]], y[a[i + 1]]);
        }
        count++;
        // ans += dist(x[a[0]], y[a[0]], x[a[1]], y[a[1]]) + dist(x[a[1]], y[a[1]], x[a[2]], y[a[2]]);
    } while(next_permutation(a.begin(), a.end()));
    cout << fixed << setprecision(10) << ans / count << endl;
    return 0;
}

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

#ifdef LOCAL
  #include "debug.h"
#endif

int n;
string s;
long long res;

void solve(int idx, long long sum, long long cur) {
  if (idx == n) {
    if (!cur)
      res += sum;
    return;
  }
  solve(idx + 1, sum, cur * 10 + s[idx] - '0');
  solve(idx + 1, sum + cur * 10 + s[idx] - '0', 0);
}

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  cin >> s;
  n = s.length();
  solve(0, 0, 0);
  cout << res << '\n';
  return 0;
}

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

bool isPrime(int n){
	int m = sqrt(n) + 1;
	for(int i=2; i<m; i++){
		if(n%i == 0) return false;
	}
	return true;
}

int main(){
	int n, ans = 0;
	cin >> n;
	
	for(int i=0; i<n; i++){
		int p;
		cin >> p;
		if(isPrime(p)) ans++;
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main() {
    ll n, m, i, j, k;
    cin >> n >> m;
    vector<ll> A(n),B(m);
    for(i=0;i<n;i++){
        cin >> A[i];
    }
    for(i=0;i<m;i++){
        cin >> B[i];
    }
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    for(i=1;i<n;i++){
        if(A[i]==A[i-1]){
            cout << 0 << endl;
            return 0;
        }
    }
    for(i = 1; i < m; i++) {
        if(B[i] == B[i - 1]) {
            cout << 0 << endl;
            return 0;
        }
    }
    ll ret = 1;
    for(ll x=n*m;x>=1;x--){
        auto ait = lower_bound(A.begin(), A.end(), x);
        auto bit = lower_bound(B.begin(), B.end(), x);
        if(*ait == x && *bit != x){
            ret *= (m - (bit-B.begin()));
            ret %= MOD;
        } else if(*ait != x && *bit == x){
            ret *= (n - (ait - A.begin()));
            ret %= MOD;
        } else if(*ait != x && *bit != x){
            ret *= (((m - (bit - B.begin()))%MOD) * ((n - (ait - A.begin()))%MOD) +MOD - (n*m-x))%MOD;
            ret %=MOD;
        }
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
import math
import itertools
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

n = I()
s = [S() for i in range(n)]
m = I()
t = [S() for i in range(m)]
ans,cnt = 0,0
for i in s:
    cnt = 0
    l = [k for k,x in enumerate(s) if x == i]
    cnt += len(l)
    l = [k for k,x in enumerate(t) if x == i]
    cnt -= len(l)
    ans = max(cnt,ans)
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>

int main(void) {
	int a, b;

	scanf("%d%d", &a, &b);

	if (a < b) {
		printf("a < b\n");
	}
	else if (a > b) {
		printf("a > b\n");
	}
	else if (a == b) {
		printf("a == b\n");
	}
	return 0;
}

Measured memory_bytes: 580
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1<<29;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it:t)cout<<it<<" ";}
inline int powerexp(int a,int b,int m = MOD){int res=1;while(b){if(b&1)res=res*a%m;a=a*a%m,b>>=1;}return res%m;}
inline int modinv(int a){return powerexp(a,MOD-2,MOD);}
inline int lcm(int a,int b){int g=__gcd(a,b);return a/g*b;}

//-------------------< start here >-------------------------// 
void solve(){
   int n, a;
   cin >> n >> a;
   int ret = n * n;
   ret -= a;
   cout << ret << endl;
}
//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
   #endif
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <complex>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <iterator>

using namespace std;

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define iter(c) __typeof__((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define all(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

const int INFTY=1<<29;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

int main()
{
	int tc; cin>>tc;
	rep(_,tc){
		int n; cin>>n;
		vi a(n); rep(i,n) cin>>a[i];
		int up=0,down=0;
		rep(i,n-1) up=max(up,a[i+1]-a[i]),down=max(down,a[i]-a[i+1]);
		cout<<up<<' '<<down<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1196
<>;@a=glob<>;map{$b[$s=@a]=@b=$N=$c=0;$c+=$N+=2*$_>$l+$?-$b[++$s]:$b[$s--],$b[$s]++for@a;$c*4/@a>@a+1?$:$l=$l+$>>1}1..35;print$

Measured memory_bytes: 28296
#include <bits/stdc++.h>
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) x.begin(),x.end()
using namespace std;
const int MOD = 1000000007;

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

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    vector<ll> s(n);
    s[0] = a[0];
    ll ans=0;
    for (int i=1; i< n; ++i) {
        s[i] = s[i-1] + a[i];
        s[i] %= MOD;
    }
    rep (i, n) {
        if (s[n-1] - s[i] < 0) s[n-1] += MOD;
        ans += a[i] * (s[n-1] - s[i]);
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5552
using System;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int A = int.Parse(str[0]);
            int B = int.Parse(str[1]);
            int C = int.Parse(str[2]);
            if (C >= A && C <= B)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
/*
#ifndef ONLINE_JUDGE
    #define cin f
    #define cout g
    ifstream cin("a.in");
    ofstream cout("a.out");
#endif
*/
int n,m,x,y,ans;
int visit[1<<17],son[1<<17];
bool viz[1<<17];
vector <int> G[1<<17];
queue <int> Q;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>m;
    for(int i=1;i<=m;++i)
    {
        cin>>x>>y;
        viz[x]=1;
        son[x]++;
        ///G[x].push_back(y);
        G[y].push_back(x);
    }
    for(int i=1;i<=n;++i)
        if(!viz[i])
        {
            Q.push(i);
            visit[i]=1;
        }
    while(!Q.empty())
    {
        int cur=Q.front();
        Q.pop();
        ///cerr<<cur<<'\n';
        ans=max(ans,visit[cur]-1);
        for(int i=0;i<(int)G[cur].size();++i)
        {
            son[G[cur][i]]--;
            visit[G[cur][i]]=max(visit[G[cur][i]],visit[cur]+1);
            if(!son[G[cur][i]]) Q.push(G[cur][i]);
        }
    }
    cout<<ans;
    return 0;
}


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

int main() {
  string S; cin >> S;
  if (( S.at(0) != S.at(1) ) && (S.at(1)!= S.at(2)) && (S.at(2) != S.at(0))) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


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

#define ll long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) 
#define repi(i,start,end) for(int i=start,temp=(int)(end);i<end;++i)
#define rfor(v,x) for(const auto& x : v) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n)
#define vsort(v) sort(v.begin(), v.end())
#define vfsort(v,lambda) sort(v.begin(),v.end(),lambda)
#define vint vector<int>
#define vvint vector<vector<int>>
#define vin(v) rep(i,v.size()) {cin >> v[i];}
//最終奥義
//#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//(lambda (x y) (< x y)) => [](int x, int y) -> int { return x<y; }


signed main(void){
  int n,a,b;
  cin >> n >> a >> b;
  cout << (n*a>=b?b:n*a) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int a,b;

int main(void){
	scanf("%d%d",&a,&b);
	if(a>b)swap(a,b);
	int diff=abs(b-a);
	if(diff%2==0){
		printf("%d\n",(a+b)/2);
	}else{
		printf("IMPOSSIBLE\n");
	}
	return 0;
}


Measured memory_bytes: 256
# coding: utf-8
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
j = m

aa, bb = [0], [0]
 
for i in range(n):
    aa.append(aa[i] + a[i])

for i in range(m):
    bb.append(bb[i] + b[i])

for i in range(n + 1):
    if aa[i] > k:
        break
    while bb[j] > k - aa[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)

Measured memory_bytes: 47480
#include<stdio.h>
int main()
{
	int cnt=0,max=0,i;
	char a[4];
	scanf("%s",a);
	for(i=0;i<3;i++){
		if(a[i]=='R'){
			cnt++;
			if(max<=cnt){
				max=cnt;
			}
		}
		else {
			cnt=0;
		}
	}
	printf("%d\n",max);
	return 0;
}

Measured memory_bytes: 1736
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>

//#include<bits/stdc++.h>


using namespace std;
int main() {
	int p = 1;
	int a;
	cin >> a;
	int c = a % 10;
	a /= 10;
	while (a) {
		if (c == a % 10)p++;
		else p = 1;
		if (p == 3) {
			
			cout << "Yes" << endl;
			return 0;
		}c = a % 10;
		a /= 10;
		
	}

	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main
{
	public static void main(String [] Args)
	{
		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		double ans=0.0;
		for(int i=0;i<n;i++)
		{
			double q=in.nextDouble();
			ans=ans+1.0/q;
		}
		ans=1.0/ans;
		System.out.println(ans);
	}
}
	

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

using namespace std;

const int maxn = 2e5 + 10;

typedef long long ll;

ll p[maxn];
ll a[maxn],b[maxn];
unordered_map<ll,int> m;
ll lowbit(ll x) {return x & -x;};

ll sum(ll x) {
    ll res = 0;
    while (x > 0) {
        res += p[x];
        x -= lowbit(x);
    }
    return res;
}

void add(ll x) {
    while (x < maxn) {
        p[x]++;
        x += lowbit(x);
    }
}

int main() {
    int n,k; cin>>n>>k;
    for (int i = 1; i <= n; i++) {
        cin>>a[i];
        a[i] += a[i - 1] - k;
        b[i] = a[i];
    }
    sort(b, b + n + 1);
    int len = 1;
    for (int i = 0; i <= n; i++) {
        if (m[b[i]]) continue;
        m[b[i]] = len++;
    }
    ll res = 0;
    for (int i = 0; i <= n; i++) {
        ll t = m[a[i]];
        res += sum(t);
        add(t);
    }
    cout<<res<<endl;


    return 0;
}


Measured memory_bytes: 13256
import math
n = int(input())
ans = 0
k = int(math.sqrt(n)) + 1

for i in range(2,k):
    p = 1
    while n%(i**p)==0:
        ans+=1
        n = n//(i**p)
        p+=1
        
    while n % i == 0:
        n //= i

    if n<i: break

if n!=1: ans+=1
print(ans)



Measured memory_bytes: 9072
import std.algorithm, std.array, std.container, std.range, std.bitmanip;
import std.numeric, std.math, std.bigint, std.random, core.bitop;
import std.string, std.conv, std.stdio, std.typecons;

void main()
{
  int x;
  for (auto i = 1; ; ++i) {
    x = readln.chomp.to!int;
    if (x == 0) break;
    writeln("Case ", i, ": ", x);
  }
}

Measured memory_bytes: 2496
N, M = map(int, input().split())

import math

divisor=[]
for i in range(1, math.ceil(math.sqrt(M))+1):
    if M%i==0:
        divisor.append(i)
#print(divisor)

divisor+=[M//val for val in reversed(divisor)]
#print(divisor)
for val in divisor:
    if val>=N:
        print(M//val)
        break

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

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

	cout << string(S.length(), 'x') << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define eb emplace_back
typedef long double ld;

main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, t = 0;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		if (i % 3 != 0 && i % 5 != 0) t += i;
	}
	cout << t << '\n';
}


Measured memory_bytes: 3652
from math import factorial
n,p = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
x = 0
for i in a:
	if i%2==0: x+=1
y = n-x
if p==0:
	num,fy = 0,factorial(y)
	for i in range(0,y+1,2):
		num += fy//(factorial(i)*factorial(y-i))
	print((2**x)*num)
else:
	num,fy = 0,factorial(y)
	for i in range(1,y+1,2):
		num += fy//(factorial(i)*factorial(y-i))
	print((2**x)*num)

Measured memory_bytes: 3064
def main():
	L, R = map(int, input().split())
	if R - L >= 2019:
		print(0)
		return
	L %= 2019
	R %= 2019
	if R < L:
		print(0)
		return
	ans = 2019
	for i in range(L+1, R+1):
		for j in range(L, i):
			ans = min(ans, i*j%2019)
	print(ans)


if __name__ == '__main__':
	main()

Measured memory_bytes: 3060
using namespace std;
#include<string>
#define ll long long
#define pb push_back

#define fr(i,a,b) for(ll i=a;i<b;i++)
#define ffr(i,a,b) for(ll i=a;i>=b;i--)
#include<bits/stdc++.h>
#include<vector>
#define vl vector<ll>
//const ll N=1e5+5;


// int divi(ll num) {
// 	if (num % 2 == 0) {
// 		num /= 2;
// 		return divi(num);
// 	}
// 	else
// 		return num;
// }

void solve() {
	ll a;
	cin >> a;
	cout << (a + pow(a, 2) + pow(a, 3));
}



int main() {
#ifndef ONLINE_JUDGE
	// for getting input
	freopen("input.txt", "r", stdin);
	//for writing output
	freopen("jout.txt", "w", stdout);
#endif


	ll t = 1;
	//cin >> t;
	while (t--) {
		solve();
		cout << '\n';
	}
	return 0;
}

Measured memory_bytes: 4188
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
#![macro_use]

use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::mem::*;
use std::num::*;
use std::slice::*;

fn main() {
    let (r, w, e) = (stdin(), stdout(), stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    // =============================================== //
    let n: usize = io.read(); //(usize, usize) = (io.read(), io.read());
    let h = io.readn::<isize>(n);
    let k = 2;

    let inf = 3 << 29;
    let mut dp: Vec<isize> = vec![inf; n + k];
    dp[0] = 0;
    for i in 0..n {
        for k in 1..(k + 1) {
            if i + k < n {
                dp[i + k] = min(dp[i + k], dp[i] + (h[i] - h[i + k]).abs());
            }
        }
    }
    io.writeln(dp[n - 1]);
}

// IO
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug ) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug>(&mut self, val1: S, val2: S) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
}


Measured memory_bytes: 6396
px, py = map(int, input().split())
cx, cy, r = map(int, input().split())
dx, dy = px - cx, py - cy
s2 = dx ** 2 + dy ** 2
df = (s2 - r ** 2) ** 0.5
ix1, ix2 = (dx * r + dy * df) * r / s2, (dx * r - dy * df) * r / s2
iy1, iy2 = (dy * r - dx * df) * r / s2, (dy * r + dx * df) * r / s2
if (ix1, iy1) > (ix2, iy2):
    ix1, ix2 = ix2, ix1
    iy1, iy2 = iy2, iy1
print(ix1 + cx, iy1 + cy)
print(ix2 + cx, iy2 + cy)


Measured memory_bytes: 5644
function max() {
    local m=$1
    while [ $# -gt 0 ]
    do
        m=$[$m>$1?$m:$1]
        shift
    done
    echo $m
}

read A B C
echo $(max $(($A$B + $C)) $(($B$A + $C)) $(($A$C + $B)) $(($C$A + $B)) \
           $(($B$C + $A)) $(($C$B + $A)) )


Measured memory_bytes: 632
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
#define NIL -2000000001
#define MAX 2000000000000

int main() {
  int n;
  scanf("%d", &n);
  int a[n];
  for (int i=0; i<n; i++) {
    scanf("%d", &a[i]);
  }
  int sum=0;
  for (int i=0; i<n; i++) {
    sum += a[i]-1;
  }

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

  return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <set> 

using namespace std;

int main()
{
    int N; 
    cin >> N;
    set<int> Set;
    
    for(int i = 0; i < N; ++i)
    {
        int Command; cin >> Command;
        int Val; cin >> Val;
        
        if(Command == 0)
        {
            Set.insert(Val);
            cout << Set.size() << endl;
        }
        else if(Command == 1)
           cout << (Set.find(Val) != Set.end()) << endl;
        else 
           Set.erase(Val);
        
    }
    
    return 0;
}


Measured memory_bytes: 12388
n, k = map(int, input().split())
Dice = list(map(int, input().split()))
Exv = [(n*(n+1)/2)/n for n in Dice]
ExvL = [0]
for i in Exv:ExvL.append(ExvL[-1]+i)
ans=0.0
for i in range(0,n-k+1):
    ans=max(ans,ExvL[i+k]-ExvL[i])
print(ans)


Measured memory_bytes: 25060
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

set<ll> ans;
ll n;

bool flag(ll a)
{
    bool f3, f5, f7, f = false;

    f3 = f5 = f7 = f = false;

    while (a)
    {
        if (a % 10 == 3)
        {
            f3 = true;
        }

        if (a % 10 == 5)
        {
            f5 = true;
        }

        if (a % 10 == 7)
        {
            f7 = true;
        }

        a /= 10;
    }

    if (f3 && f5 && f7)
    {
        f = true;
    }

    return f;
}

void dfs(ll a)
{
    if (a > n)
    {
        return;
    }

    if (flag(a))
    {
        ans.insert(a);
    }

    dfs(3 * pow(10, floor(log10(a)) + 1) + a);
    dfs(5 * pow(10, floor(log10(a)) + 1) + a);
    dfs(7 * pow(10, floor(log10(a)) + 1) + a);
}

int main(void)
{
    cin >> n;

    dfs(7);
    dfs(5);
    dfs(3);

    cout << ans.size() << endl;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
//priority_queue<ll, vector<ll>, std::greater<ll> > q;
#define ull 		unsigned long long
#define ll 			long long
#define M 			1000000007
#define pb 			emplace_back
#define p_q 		priority_queue
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) // gcd((a),(b))
#define ios	    	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp 			make_pair
#define lb 			lower_bound
#define ub			upper_bound
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ini(a,n,b)	for(ll int i=0;i<n;i++) a[i]=0;
#define hell 		(ull)1e9
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl
using namespace std;

void boost()
{
    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
    cout.tie(NULL);
}



int main(void)
{
    boost();
    ll n , k;
    cin>>n>>k;
    vi v(n);
    rep(i,0,n)
        cin>>v[i];
    ll a[n+1];
    a[0] = 0;
    a[1] = 0;
    rep(i,2,n+1)
        a[i] = 1e18;
    rep(i,1,n){
        for (ll j = i-1 ; j >= max((ll)0,i - k); j--){
            //cout<<j<<"\n";
            a[i+1] = min(a[i+1] , a[j+1] + abs(v[i] - v[j]));   
        }
    }
    // rep(i,0,n+1)
    //     cout<<a[i]<<" ";
    // cout<<"\n";
    cout<<a[n];
    
    
   
}   

Measured memory_bytes: 1792
#include<stdio.h>
#include<string.h>
int main(){
  char s[20];
  char t[21];
  int i;
  
  scanf("%s",s);
  scanf("%s",t);
  
  
  t[strlen(s)]='\0';
  
  
  if(strcmp(s,t)==0){
   printf("Yes\n");
    return 0;
  }
  printf("No\n");
  
  
 return 0; 
}



Measured memory_bytes: 1624
N=int(input())
W=[input() for i in range(N)]
s1=""
s2=""
success=1
if not(len(set(W))==len(W)):
    print("No")
else:
    for i in range(N-1):
        s1=W[i]
        s2=W[i+1]
        if not(s1[len(s1)-1]==s2[0]):
            success=0
            break
    if success==1:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 38384
// Math = ♥️

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define ld long double
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
#define pq priority_queue
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define sz(c) ((ll)c.size())
#define ordered_set                            \
    tree<ll, null_type, less<ll>, rb_tree_tag, \
         tree_order_statistics_node_update>

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

    ll n, m;
    cin >> n >> m;

    if (m > n) {
        swap(n, m);
    }

    if (n >= 2 && m >= 2) {
        cout << ((n - 2) * (m - 2)) << "\n";
    } else {
        if (n == 1) {
            cout << "1\n";
        } else {
            cout << n - 2 << "\n";
        }
    }
}


Measured memory_bytes: 256
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define pii pair<ll,ll>
#define vi(x) vector<x>
#define maxn 100005
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace std;
using namespace __gnu_pbds;
ll n,m,x;
ll c[20] , a[20][20];
bool isset(ll n, ll k) 
{ 
    if ((n >> (k)) & 1) 
        return true;
    return false;
}
signed main()
{
    fast;
 
    ll i,j,k,ans=LONG_MAX;
    cin>>n>>m>>x;
    for(i=0;i<n;i++)
    {
    	cin>>c[i];
    	for(j=0;j<m;j++) cin>>a[i][j];
    }
    for(i=0;i<(1<<n);i++)
    {
    	ll temp[m+2] = {0};
    	ll cost=0;
    	bool ok = true;
    	for(j=0;j<n;j++)
    	{
    		if(isset(i,j))
    		{
    			cost += c[j];
    			for(k=0;k<m;k++) temp[k] += a[j][k];
    		}
    	}
    	for(j=0;j<m;j++)
    	{
    		if(temp[j]<x) ok = false;
    	}
    	if(ok) ans = min(ans,cost);
    }
    if(ans==LONG_MAX) ans = -1;
    cout<<ans;
}

Measured memory_bytes: 3656