akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
template<class T> void puts(T x) { std::cout << x << std::endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n;
ll a[100010], ans[100010];

int main() {
    cin >> n;
    rep(i, n) cin >> a[i];

    ll x = 0;
    rep(i, n) {
        if (i % 2 == 0) x += a[i];
        else x -= a[i];
    }

    rep(i, n) {
        if (i > 0) {
            x = 2 * a[i-1] - x;
        }
        cout << x << ' ';
    }
    cout << endl;
}


Measured memory_bytes: 2048
#include <iostream>
#include <vector>
#include <map>
#include <cmath>

const long long MOD = 1000000007;

long long gcd(long long a, long long b) {
  long long r = a % b;
  return r ? gcd(b, r) : b;
}

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

    long long zero = 0;
    std::vector<long long> A(N), B(N);
    std::map<std::pair<long long, long long>, long long> m;
    for (int i = 0; i < N; i++) {
        long long a, b;
        std::cin >> a >> b;

        if (a == 0 && b == 0) {
            ++zero;
            continue;
        } else if (a == 0) {
            b = 1;
        } else if (b == 0) {
            a = -1;
        } else {
            long long g = gcd(std::abs(a), std::abs(b));
            a /= g;
            b /= g;
            
            if (b < 0) {
                a *= -1;
                b *= -1;
            }
        }

        A[i] = a;
        B[i] = b;

        m[std::make_pair(a, b)] += 1;
    }

    auto pow = [](long long a, int n) {
        long long res = 1;
        for (; n; n >>= 1) {
            if (n & 1) res = res * a % MOD;
            a = a * a % MOD;
        }
        return res;
    };

    long long ans = 1;

    for (int i = 0; i < N; i++) {
        auto p = std::make_pair(A[i], B[i]);
        if (m.count(p) == 0) continue;
        auto q = A[i] < 0 ? std::make_pair(B[i], -A[i]) : std::make_pair(-B[i], A[i]);

        long long x = m[p];
        long long y = m[q];

        long long res = ((pow(2, x) - 1) + (pow(2, y) - 1) + 1) % MOD;
        ans = ans * res % MOD;

        m.erase(p);
        m.erase(q);
    }

    ans = (ans + MOD + zero - 1) % MOD;

    std::cout << ans << "\n";
}

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

char c[1000000];

int main(){

  int n,m;
  scanf("%d",&n);
  while(n != 0){
    scanf("%d",&m);
    scanf("%s",c);
    int ans = 0,flag;
    for(int i=0;i<m-2*n;i++){
      if(c[i] == 'I'){
	flag = 0;
	for(int j=1;j<2*n;j=j+2){
	  if(!(c[i+j]=='O'&&c[i+j+1]=='I')){
	    flag++;
	    break;
	  }
	}
	if(flag == 0) ans++;
      }
    }
    printf("%d\n",ans);
    scanf("%d",&n);
  }

  return (0);
}

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

#define F                   first
#define S                   second
#define int                 long long int
#define pb                  push_back
#define mp                  make_pair
#define pii                 pair<int,int>
#define vi                  vector<int>
#define mii                 map<int,int>
#define pqb                 priority_queue<int>
#define pqs                 priority_queue<int,vi,greater<int> >
#define mod                 1000000007
#define endl                '\n'
#define rep(i,a,b)            for(int i=a;i<b;i++)
void solve() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int i = 0;
    int j = n - 1;
    int ans = 0;
    while (i < j) {
        if (s[i] == 'W' and s[j] == 'R' ) {
            ans++;
            i++;
            j--;
        }
        else if (s[i] == 'W' and s[j] == 'W') {
            j--;
        }
        else if (s[i] == 'R' and s[j] == 'W') {
            i++;
            j--;
        }
        else if (s[i] == 'R' and s[j] == 'R') {

            i++;
        }
    }
    cout << ans << endl;
}
void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int32_t main()
{
    c_p_c();

    int t;
    //cin >> t;
    t = 1;
    while (t--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 3760
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define ins insert
#define sb substr
#define con continue
#define ub upper_bound
#define lb lower_bound
#define sp fixed<<setprecision
#define bp __builtin_popcountll
#define pll pair<ll,ll>
#define pld pair<ld,ld>
using namespace std;

ll power(ll x, ll y);
ll mpower(ll x, ll y, ll p);
ll modInv(ll a, ll m);
ll gcdExtended(ll a, ll b, ll *x, ll *y);
bool isPrime(ll n);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t,i,j,k,l,h,p,q,r,x,y,z,a,b,c,d,f,n,m,M=1000000007;
    char ch,ch2,ch3;
    string s,s1,s2,s3;
    // freopen ("input.txt", "r", stdin);
    // freopen ("output.txt", "w", stdout);
    t=1;
    // cin>>t;
    while(t--){
        vector<ll> v,w;
        unordered_map<ll,ll> N;
        set<ll> S,SS;
        cin>>a>>b>>c>>k;
        x=0;
        while(b<=a){
            x++;
            b*=2;
        }
        while(c<=b){
            x++;
            c*=2;
        }
        if(x<=k){
            cout<<"Yes\n";
        }
        else{
            cout<<"No\n";
        }
    }
    return 0;
}

ll modInv(ll a, ll m){
    ll x, y;
    ll g = gcdExtended(a, m, &x, &y);
    ll res = (x%m + m) % m;
    return res;
}

ll gcdExtended(ll a, ll b, ll *x, ll *y){
    if (a == 0){
        *x = 0, *y = 1;
        return b;
    }
    ll x1, y1;
    ll gcd = gcdExtended(b%a, a, &x1, &y1);
    *x = y1 - (b/a) * x1;
    *y = x1;
    return gcd;
}

ll mpower(ll x, ll y, ll p){
    ll res = 1;
    x = x % p;
    while(y > 0){
        if(y & 1) res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

ll power(ll x, ll y){
    ll res = 1;
    while (y > 0){
        if (y & 1) res = res*x;
        y = y>>1;
        x = x*x;
    }
    return res;
}

bool isPrime(ll n){
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    ll p=sqrt(n);
    for(int i=5;i<=p;i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
            return false;
    return true;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define SORT(v, n) sort(v, v+n)
#define VREV(v,n) reverse(v,v+n)
#define REV(v,n) reverse(v,v+n)
#define vi vector<int>
#define pf push_front
#define pb push_back

template<class T, size_t N> size_t countof(const T (&array)[N]) { return N; }
template <class T> void chmin(T&a,const T&b) { a = min(a,b); }
template <class T> void chmax(T&a,const T&b) { a = max(a,b); }
 
void print(){cout<<"\n";}
template <class Head, class... Tail>
void print(Head&& h,Tail&&... t){ 
	if(sizeof...(t)==0)
		cout<<h;
	else
		cout<<h<<' ';
	print(move(t)...);
}

void mprint(auto *matrix,auto N){
	REP(i,N) cout<<matrix[i]<<(i!=N-1?' ':'\n');
	return;
}

const double EPS =1e-9;
const int INF =2e+9;
const ll INFL =9e+18;
const long MOD =1e+9+7;
#define PI 3.14159265258979

#define P pair<int,int>
#define Pll pair<ll,ll>
#define iP pair<int,P>
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

inline int in(){int x; cin>>x; return x;}

struct UnionFind{
	vector<int> par; //データiが属する親の番号
	vector<int> sizes; //根ノードiの木に含まれるデータの数

	// 最初は全てのデータiがグループiに存在するものとして初期化
	UnionFind(int n):par(n),sizes(n, 1){
		REP(i,n) par[i] = i;
	}

	// 根を張り替えながら再帰的に根ノードを探す
	int find(int x){
		if(x==par[x]) return x;
		return par[x]=find(par[x]);
	}

	// 2つのデータx, yが属する木をマージする
	void unite(int x, int y) {
		// データの根ノードを得る
		x = find(x);
		y = find(y);

		// 既に同じ木に属しているならマージしない
		if (x == y) return;

		// xの木がyの木より大きくなるようにする
		if (sizes[x] < sizes[y]) swap(x, y);

		// xがyの親になるように連結する
		par[y] = x;
		sizes[x] += sizes[y];
		sizes[y] = 0;  // sizes[y]は無意味な値となるため
	}

	// 2つのデータx, yが属する木が同じならtrueを返す
	bool same(int x, int y) {
		return find(x) == find(y);
	}

	// データxが含まれる木の大きさを返す
	int size(int x) {
		return sizes[find(x)];
	}
};

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

	int N,M,x,y,p[100000];
	UnionFind uf(100001);
	set<int> st[100001];

	cin>>N>>M;
	REP(i,N) cin>>p[i];
	REP(j,M){
		cin>>x>>y;
		uf.unite(x,y);
	}
	
	FOR(i,1,N+1) st[uf.find(i)].insert(p[i-1]);
	
	int result=0;
	FOR(i,1,N+1){
		int tem=uf.find(i);
		set<int>::iterator it = st[tem].find(i);
		if(it != st[tem].end()) result++;
	}
	print(result);
	return 0;
}



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

int main() {
  int b1, b2, b3;
  cin >> b1 >> b2 >> b3;

  if (b1 == 1 && b2 == 1 || b3 == 1) {
    cout << "Open" << endl;
  } else {
    cout << "Close" << endl;
  }
  return 0;
}



Measured memory_bytes: 3124
N=int(input())
t=[None]*(N+1)
x=[None]*(N+1)
y=[None]*(N+1)
t[0]=0
x[0]=0
y[0]=0
for i in range(1,N+1):
    t[i],x[i],y[i]=map(int, input().split())

flag=True
for i in range(N):
    if abs(x[i+1]-x[i])+abs(y[i+1]-y[i])>t[i+1]-t[i]:
        flag=False
        break
    if (x[i+1]-x[i]+y[i+1]-y[i])%2!=(t[i+1]-t[i])%2:
        flag=False
        break
        
if flag:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 11636
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
inline long long mod(long long n,long long m){return(n%m+m)%m;}
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    int a[5]; rep(i,5) cin>>a[i];
    int ans=0;
    bool flg=1;
    rep(i,5){
        ans+=((a[i]+9)/10)*10;
        if(a[i]%10) flg=0;
    }
    if(flg){
        cout<<ans<<endl;
        return 0;
    }
    int mi=15;
    rep(i,5)if(a[i]%10) mi=min(mi,a[i]%10);
    cout<<ans-10+mi<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>


using namespace std;
string yn(bool a)
{
  if (a){return "Yes";}
  else{return "No";}
}

bool sosuu(int n)
{
  int i=3;
  if(n==1){return false;}
  if(n==2){return true;}
  if(n%2==0){return false;}
  while(true)
  {
    if(n%i==0&&n!=i){return false;}
    if(i>sqrt(n)+1){break;}
    i+=2;
  }
  return true;

}

int main()
{
  ios::sync_with_stdio(false);
  int q;
  cin >> q;

  int res[100001];
  res[1]=0;
  res[2]=0;
  res[3]=0;
  for(int i=3;i<100000;i++)
  {
    res[i+1]=res[i]+sosuu(i)*sosuu((i+1)/2);
  }
  int l,r;
  for(int i=0;i<q;i++)
  {
    cin>>l>>r;
    cout<<res[r+1]-res[l]<<'\n';
  }


}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define what_is(x) cerr << #x << " is " << x << endl;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define endl '\n'

typedef long long ll;
typedef pair<int,int> pii;
const int N = 20+5;
const int INF = 1e9;
const int MOD = 1e9+7;

int n;
int a[N], b[N], c[N];
int main()
{
	IOS
	// freopen("input.txt", "r", stdin);
	cin >> n;
	for(int i=1; i<=n; i++) cin >> a[i];
	for(int i=1; i<=n; i++) cin >> b[i];
	for(int i=1; i<n; i++) cin >> c[i];
	int ans = 0;
	for(int i=1; i<=n; i++){
		ans += b[a[i]];
		if (i>1 && a[i-1]+1 == a[i]) ans += c[a[i-1]];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return set(a)

import math
mod = 10 ** 9 + 7

n = int(input())
a = [int(i) for i in input().split()]
tmp = a[0]
set_v = a[0]
pairwise = True
prime_list = set([])
for i in range(1, n):
    prime = prime_factorize(a[i])
    set_v = math.gcd(set_v, a[i])
    for p in prime:
        if p in prime_list:
            pairwise = False
        prime_list.add(p)
if pairwise == True:
    ans = 'pairwise coprime'
elif set_v == 1:
    ans = 'setwise coprime'
else:
    ans = 'not coprime'
print(ans)

Measured memory_bytes: 196676
#include <iostream>
#include <vector>
#include <set>

#define rep(i,a) for(int i = 0 ; i < a ; i ++)
#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define vi vector<int>
#define vs vector<string>
#define pii pair<int, int>
#define f first
#define s second
#define pb push_back
using namespace std;

int main(void){
  int b,a,n;
  cin>>n>>a>>b;
  cout<<min(a * n, b)<<endl;
}

Measured memory_bytes: 256
void print(char* s,int a, int b);
void reverse(char* s,int a,int b);
void replace(char* s,int a,int b,char *p);

int main(int argc, const char * argv[]) {
    // insert code here...
    char str[1000];
    scanf("%s",str);
    
    int q;
    scanf("%d",&q);
    
    int i;
    for(i=0;i<q;i++){
        char op[10];
        scanf("%s",op);
        int a,b;
        scanf("%d %d",&a,&b);
        if(strcmp(op, "print") == 0){
            print(str, a, b);
        }
        else if(strcmp(op, "reverse") == 0){
            reverse(str, a, b);
        }
        else if(strcmp(op, "replace") == 0){
            char q[b-a+1];
            scanf("%s",q);
            replace(str, a, b, q);
        }
    }
    
    return 0;
}

void print(char* s,int a, int b){
    char tmp[1000] = {};
    strncpy(tmp, s+a, b-a+1);
    printf("%s\n",tmp);
}

void reverse(char* s,int a,int b){
    char tmp[b-a+1];
    strncpy(tmp, s+a, b-a+1);
    
    int i;
    for(i=a;i<=b;i++){
        s[i] = tmp[b-i];
    }
}

void replace(char* s,int a,int b,char *p){
    int i;
    for(i=a;i<=b;i++){
        s[i] = p[i-a];
    }
}

Measured memory_bytes: 600
//clear adj and visited vector declared globally after each test case
//check for long long overflow
//while adding and subs check if mod becomes -ve
//while using an integer directly in a builtin function add ll
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Dont keep array name as size or any other key word

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007 //998244353
#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) for(int i=0;i<=n;i++){for(int j=0;j<=m;j++)cout<<dp[i][j]<<" ";cout<<"\n";}
typedef std::numeric_limits< double > dbl;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const long long N=1000005, INF=2000000000000000000;
lld pi=3.1415926535897932;
int lcm(int a, int b)
{
    int g=__gcd(a, b);
    return a/g*b;
}
int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }

int32_t main()
{
    IOS;
    int n;
    cin>>n;
    int ar[n];
    for(int i=0;i<n;i++)
    cin>>ar[i];
    bool visit[N];
    fill(visit, false);
    sort(ar, ar+n);
    int ans=0;
    for(int i=0;i<n;i++)
    {
        if(visit[ar[i]])
        continue;
        ans++;
        for(int j=ar[i];j<N;j+=ar[i])
        visit[j]=true;
        if(i<n&&ar[i+1]==ar[i])
        ans--;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 6184
#include<bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
const int MOD=1000000007;

bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int highestPowerof2(unsigned int n) 
{ 
    // Invalid input 
    if (n < 1) 
        return 0; 
  
    int res = 1;
    for (int i=0; i<8*sizeof(unsigned int); i++) 
    { 
        int curr = 1 << i; 
        if (curr > n) 
           break; 
  
        res = curr; 
    } 
  
    return res; 
} 
long long binpow(long long a, long long b) {
    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(NULL);  
  cout.tie(NULL);
  int t=1;
  while(t--)
  {
    int n;
    cin>>n;
    int ans=0;
    int a[n];
    int X=INT32_MAX;
    REP(i,n)
    {
        cin>>a[i];
        if(a[i]<=X)
        ans++;
        X=min(X,a[i]);
    }    
    cout<<ans<<"\n";
  }
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
typedef long long ll;
ll n,t,a,b,L,MIN=1e15;
int main(void){
    cin>>n>>t>>a;
    t-=a;
    t*=1000;
    for(int i=1;i<=n;i++){
        cin>>b;
        b*=6;
        b=abs(t-b);
        if(b<MIN){
            MIN=b;
            L=i;
        }
    }
    cout<<L<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int H,W;
  cin>>H>>W;
  for(int i=0;i<W+2;i++){
    cout<<"#";
  }
  cout<<endl;
  vector<string>str(H);
  for(int i=0;i<H;i++){
    cin>>str.at(i);
  }
  for(int i=0;i<H;i++){
    cout<<"#"<<str.at(i)<<"#"<<endl;
  }
  for(int i=0;i<W+2;i++){
    cout<<"#";
  }
}
  
  

Measured memory_bytes: 256
N = int(input())
a =[]
a = input().split()
flag=[False for i in range(8)]
count = 0

while a:
    tmp = int(a.pop())
    if(tmp<400):
        flag[0] = True
    elif(tmp<800):
        flag[1] = True
    elif(tmp<1200):
        flag[2] = True
    elif(tmp<1600):
        flag[3] = True
    elif(tmp<2000):
        flag[4] = True
    elif(tmp<2400):
        flag[5] = True
    elif(tmp<2800):
        flag[6] = True
    elif(tmp<3200):
        flag[7] = True
    else:
        count += 1

if True in flag:
    print(flag.count(True), flag.count(True)+count)
else:
    print(0 if count <1 else 1,count)
    


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

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
// #define LOG(...)
#define FOR(i, a, b) for(int i = (int)(a); i < (int)(b); ++i)
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define RREP(i, n) for(int i = (int)(n - 1); i >= 0; --i)
#define RFOR(i, a, b) for(int i = (int)(b - 1); i >= (int)(a); --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SQ(n) (n) * (n)
#define BIT(x, i) (((x) >> (i)) & 1)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vc> vvc;
typedef vector<vll> vvll;

int candy[3];

bool check() {
  REP(i, 3) {
    if (candy[i] == candy[(i + 1) % 3] + candy[(i + 2) % 3]) {
      return true;
    }
  }
  return false;
}

int main() {
  REP(i, 3) cin >> candy[i];

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


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
#include <utility>
#include <cstring>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define repll(i,n) for(long long int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
template <typename T_char>
char ToUpper (char cX) { return toupper(cX); }
//g++ -std=c++1z temp.cpp
//./a.exe
ll digit(ll a){
    ll count = 0;
    for (ll i = 0; i < a; i++)
    {   if (a == 0)
        {
            break;
        }else
        {
            a = a/10;
            count++;
        }
    }
    return count;
}
//桁数のカウント
//pow(x,n) == x^n
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a,   b) * b;}



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

ll n,count = 0;
cin >> n;
ll v[n];
rep(i,n) cin >> v[i];

sort(v,v+n);

rep(i,n-1) if(v[i] == v[i+1]) count++;
if(count == 0) cout << "YES" << endl;
else cout << "NO" << endl;

//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cctype>
#define INF 1000000000
using namespace std;
bool debug=false;

int main(){
  int n,k,x,y;
  cin>>n>>k>>x>>y;
  int sum=0;
  for(int i=1;i<=n;i++){
    if(i>k)sum+=y;
    else sum+=x;
  }
  cout<<sum<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <list>
#include <set>
using namespace  std;

#define int long long int

int gcd(int a, int b) {
    if (a == 0) {
        return b;
    }
    return gcd(b % a, a);
}

constexpr int INF = std::numeric_limits<int>::max();

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

    vector<int> A(N);
    for (int &a: A) {
        cin >> a;
    }

    int ans  = A.front();
    for (int &a: A) {
        ans = gcd(ans, a);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>

using namespace std;
int main(){
    string S; cin >> S;
    vector<int> s(4);
    for(int i=0; i<4; i++){
        s.at(i)=S.at(i)-'0';
    }
    if((s.at(0)*10+s.at(1)<=12)&&(s.at(2)*10+s.at(3)<=12)&&(s.at(0)*10+s.at(1)>0)&&(s.at(2)*10+s.at(3)>0)){
        cout << "AMBIGUOUS" << endl;
    }else if(((s.at(0)*10+s.at(1)<=12)&&(s.at(0)*10+s.at(1)>0))||((s.at(2)*10+s.at(3)<=12)&&(s.at(2)*10+s.at(3)>0))){
        if(s.at(0)*10+s.at(1)<=12&&s.at(0)*10+s.at(1)>0){
            cout << "MMYY" << endl;
        }else {
            cout << "YYMM" << endl;
        }
    }else{
        cout << "NA" << endl;
    }
}

Measured memory_bytes: 256
def calculate_cheese_diagonal(cheese_size)
  cheese_size_array = cheese_size.split.map(&:to_i)
  cheese_size_array << cheese_size_array.first
  cheese_diagonals = cheese_size_array.each_cons(2).map{ |(a, b)| Math.sqrt((a * a) + (b * b)) }
  cheese_size_array.each_cons(2).map{ |(a, b)| Math.sqrt((a * a) + (b * b)) }.min
end

results = []
while cheese_size = gets.strip
  break if cheese_size == "0 0 0"
  cheese_digonal = calculate_cheese_diagonal(cheese_size)
  
  num_holes = gets.strip.to_i
  
  results += num_holes.times.map do
    hole_radius = gets.strip.to_i * 2
    if hole_radius <= cheese_digonal
      "NA"
    else
      "OK"
    end
  end
end

puts results.join("\n")

Measured memory_bytes: 6144
# DP(配るDP)
INF = float('inf')

N = int(input())

c = [1]
t = 6
while t <= N:
    c.append(t)
    t *= 6
t = 9
while t <= N:
    c.append(t)
    t *= 9

dp = [INF] * (N + 1)
dp[0] = 0
for i in range(N):
    for j in c:
        t = i + j
        if t <= N and dp[t] > dp[i] + 1:
            dp[t] = dp[i] + 1
        if t == N:
            break
print(dp[N])


Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
int index_compress(int n, pair<int, int> p)
{
	return (p.fi)*n + p.se;
}
bool isCyclicUtil(int v, bool visited[], bool *recStack, vector<vector<int>> &adj) 
{ 
    if(visited[v] == false) 
    { 
        visited[v] = true; 
        recStack[v] = true; 
        for(auto i = adj[v].begin(); i != adj[v].end(); ++i) 
        { 
            if ( !visited[*i] && isCyclicUtil(*i, visited, recStack, adj) ) 
                return true; 
            else if (recStack[*i]) 
                return true; 
        } 
  
    } 
    recStack[v] = false;   
    return false; 
} 
bool isCyclic(int V, vector<vector<int>> &adj) 
{ 
    bool *visited = new bool[V]; 
    bool *recStack = new bool[V]; 
    for(int i = 0; i < V; i++) 
    { 
        visited[i] = false; 
        recStack[i] = false; 
    } 
    
    for(int i = 0; i < V; i++) 
        if (isCyclicUtil(i, visited, recStack,adj)) 
            return true; 
  
    return false; 
}
int longest_path(vector<vector<int>> &adj, int n)
{
	int indegree[n] = {0};
	int l_path[n] = {0};
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < adj[i].size(); ++j)
		{
			indegree[adj[i][j]]++;
		}
	}
	queue<int> q;
	for (int i = 0; i < n; ++i)
	{
		if (indegree[i]==0)
		{
			q.push(i);
		}
	}
	while(!q.empty())
	{
		int u  = q.front();
		q.pop();
		for (int i = 0; i < adj[u].size(); ++i)
		{
			indegree[adj[u][i]]--;
			l_path[adj[u][i]] = max(l_path[adj[u][i]],l_path[u]+1);
			if (indegree[adj[u][i]] == 0)
			{
				q.push(adj[u][i]);
			}

		}
	}
	int answer = INT_MIN;
	for (int i = 0; i < n; ++i)
	{
		answer = max(answer, l_path[i]);
	}
	return answer;
}
int main()
{
	SPEED
	int n, temp;
	cin >> n;
	vector<vector<int>> adj((n*n) + n);
	for (int i = 1; i <= n; ++i)
	{
		cin >> temp;
		pair<int,int> prev = mp(min(i,temp),max(i,temp));
		for (int j = 2; j <= n-1; ++j)
		{
			cin >> temp;
			pair<int, int> next = mp(min(i,temp),max(i,temp));
			adj[index_compress(n,prev)].pb(index_compress(n,next));
			prev = next;
		}

	}
	if (isCyclic((n*n)+n, adj))
	{
		cout << -1;
	}
	else
	{
		cout << longest_path(adj,(n*n)+n) + 1;
	}
	return 0;
}

Measured memory_bytes: 51200
k,n = map(int, input().split())
a = list(map(int, input().split()))

max = 0
for i in range(1,n):
    if(max < a[i]-a[i-1]):
        max = a[i]-a[i-1]

if(max < (a[0] + (k-a[n-1]))):
    max = (a[0] + (k-a[n-1]))

print(k-max)

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

int main() {
        const vector<int> coin{500,100,50,10,5,1};
        while (1) {
                int n, z, c=0;
                cin >> n;
                if (n == 0) break;
                z = 1000 - n;
                rep(i, coin.size()) {
                        c += z / coin.at(i);
                        z =  z % coin.at(i);
                }
                cout << c << endl;
        }
        return 0;
}


Measured memory_bytes: 3092
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;

void run (void) {
  i32 n, k;
  scanf ("%" SCNi32 "%" SCNi32, &n, &k);
  i32 ans = n <= k ? 1 : 0;
  printf ("%" PRIi32 "\n", ans);
}

int main (void) {
  run();
  return 0;
}



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

int main() {
    string s;
    cin >> s;
    int len = s.length();
    for (int i = 0; i < len; i+=2) {
        //if (i % 2 == 0) {
            cout << s[i];
        //}
    }
    cout << endl;
}

Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string>
#include <list>
#include <bitset>
#include <vector>
using namespace std;

#define I64d_OJ

//#ifdef I64d_OJ
//#define LL __int64
//#endif // I64d_OJ
#ifdef I64d_OJ
#define LL long long
#endif // I64d_OJ

typedef unsigned LL ULL;
typedef unsigned uint;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<LL,LL> pLL;
typedef vector<int> vi;

inline int read(){
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-f; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}

#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define ls rt<<1
#define rs rt<<1|1
#define MID(a,b) (((LL)(a)+(LL)(b))>>1)
#define absx(a) ((a)<0?-(a):(a))
#define MK(a,b) make_pair(a,b)
#define PB(a) push_back(a)
#define lowbit(x) ((x)&-(x))

#define lc c[x][0]
#define rc c[x][1]

template< typename T >
inline void Max(T &a,T &b){if(a<b) a=b;}
template< typename T>
inline void Min(T &a,T &b){if(a>b) a=b;}

const double pi=(double)acos(-1.0);
const double eps=(double)1e-8;
const int INF = (int) 0x3f3f3f3f;
const int MOD = (int) 1e9+7;
const int MAXN =(int) 2e5+10;
const int MAXM = (int) 3e6+10;

///--------------------START-------------------------
int N;
int a[MAXN];
LL dp[MAXN][2][2];

void work(){
    scanf("%d",&N);
    for(int i=1;i<=N;i++) scanf("%d",&a[i]);
    LL ans=0;
    for(int i=0;i<=N;i++){
        for(int j=0;j<2;j++){
            for(int k=0;k<2;k++)
                dp[i][j][k]=1LL*(INF)*(INF)*(-1);
        }
    }
//    dp[0][0][0]=0;
//    dp[1][0][1]=a[1];
    dp[0][1][0]=0;
//    dp[0][1][1]=a[1];
    for(int i=1;i<=N;i++){
        if(i&1){
//            if(i==N){
//                dp[i][0][1]=dp[i-1][0][0]
//            }
            dp[i][0][0]=max(dp[i-1][0][1],dp[i-1][0][0]);
            dp[i][1][0]=max(dp[i-1][1][0],dp[i-1][1][1]);
            dp[i][0][1]=dp[i-1][0][0]+a[i];
            dp[i][1][1]=dp[i-1][1][0]+a[i];
        }
        else{
            dp[i][0][0]=max(dp[i-1][0][1],dp[i-1][1][0]);
            dp[i][1][0]=dp[i-1][1][1];
            dp[i][0][1]=dp[i-1][0][0]+a[i];
            dp[i][1][1]=dp[i-1][1][0]+a[i];
        }
    }
//    for(int i=1;i<=N;i++){
//        printf("%lld %lld %lld %lld\n",dp[i][0][0],dp[i][0][1],dp[i][1][0],dp[i][1][1]);
//    }
    if(N&1){
//        if(N==1){
//            printf("%lld\n",0);
//        }
//        else{
        LL ans=max(dp[N][0][1],dp[N][1][0]);
        printf("%lld\n",ans);
//        }
    }
    else{
        LL ans=max(dp[N][1][0],dp[N][1][1]);
        printf("%lld\n",ans);
    }
}
/*
27
-49 57 59 -99 69 -93 -70 24 57 -77 49 -62 -26 35 -71 -74 28 60 -53 23 -45 90 -45 28 18 -28 18
*/
/*
7
1 2 3 4 10 5 8
*/
///--------------------END-------------------------
int main(){
#ifdef NNever
//freopen("data.in","r",stdin);
///freopen("out.txt","w",stdout);
#endif // NNever
    work();
    return 0;
}








Measured memory_bytes: 10848
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(in);
int ans=0;
    int n = Integer.parseInt(sc.next());
    for (int i = 1; i <= n; i++) {
        if(i%2!=0){
        int count=0;
        for (int j = 1; j <= i; j++) {
            if(i%j==0)count++;
        }
        if(count==8)ans++;
        }
    }
    out.println(ans);
}}

Measured memory_bytes: 20820
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		long a = sc.nextLong();
		
		// 計算
		long result = 0;
		int n = Long.toString(a).length()-1;
		for(int i = 0; i < 1<<n; i++){
		    long tmp = 0;
		    for(int j = 0; j < n+1; j++){
		        int b = String.valueOf(a).charAt(j) - '0';
		        if((i>>j&1) == 1){
		            result += tmp*10+b;
		            tmp = 0;
		        }else{
		            tmp = tmp*10+b;
		        }
		    }
		    result += tmp;
		    //System.out.println(result);
		}
		
		// 出力
		System.out.println(result);
	}
	
	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}
}


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

ll calcA(vector<ll> a, int n) {
    ll res = (a[n-1]+a[n-3]) % mod;
    return res;
}

int main(void){
    int s;
    cin >> s;

    vector<ll> a(s+1);
    a[0] = 1;
    a[1] = a[2] = 0;

    for (int i = 3; i <= s; i++) {
        a[i] = calcA(a, i);
    }
    cout << a[s] << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cctype>
#include <vector>
#include <queue>

using namespace std;

inline int read()
{
	int x=0,f=1;
	char ch=getchar();
	while (!isdigit(ch)) f=ch=='-'?-1:f,ch=getchar();
	while (isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*f;
}

const int P=1000000007;
const int N=100005;
const int V=N<<1;
const int E=V<<1;

int last[V],last_[V],nxt_[V],tov_[V],vis[V],fact[V],invf[V],X[V],Y[V],cir[V],eid[V],f[V],size[V],deg[V];
int nxt[E],tov[E],bel[E];
bool mark[E];
vector<int> con;
queue<int> q;
int n,v,tot,tot_,tim,ans,ecnt,sizcnt;

inline void insert(int x,int y){++deg[tov[++tot]=y],nxt[tot]=last[x],last[x]=tot;}
inline void insert_(int x,int y){++deg[tov_[++tot_]=y],nxt_[tot_]=last_[x],last_[x]=tot_;}

int quick_power(int x,int y)
{
	int ret=1;
	for (;y;y>>=1,x=1ll*x*x%P) if (y&1) ret=1ll*ret*x%P;
	return ret;
}

void pre()
{
	fact[0]=1;
	for (int i=1;i<=v;++i) fact[i]=1ll*fact[i-1]*i%P;
	invf[v]=quick_power(fact[v],P-2);
	for (int i=v;i>=1;--i) invf[i-1]=1ll*invf[i]*i%P;
}

void dfs(int x)
{
	vis[x]=++tim,con.push_back(x);
	for (int i=last[x],y;i;i=nxt[i])
		if (!mark[i+1>>1]) if (++ecnt,mark[i+1>>1]=1,!vis[y=tov[i]]) dfs(y);
}

inline int C(int n,int m){return 1ll*fact[n]*invf[m]%P*invf[n-m]%P;}

inline int calc()
{
	for (;tot_;tov_[tot_]=nxt_[tot_]=0,--tot_);
	for (int x:con) last_[x]=0;
	for (int x:con)
	{
		int u=size[x]=0;f[x]=1;
		for (int i=last[x];!u&&i;i=nxt[i]) if (bel[i+1>>1]==x) u=tov[i];
		for (int i=last[x];i;i=nxt[i]) if (tov[i]<u) insert_(tov[i],x);
	}
	for (int x:con) if (!deg[x]) q.push(x);
	int ret=1,siz=0;
	for (int x;!q.empty();q.pop())
	{
		++size[x=q.front()];
		bool found=0;
		for (int i=last_[x],y;i;i=nxt_[i])
		{
			if (!--deg[y=tov_[i]]) q.push(y);
			f[y]=1ll*f[y]*f[x]%P*C(size[y]+=size[x],size[x])%P,found=1;
		}
		if (!found) ret=1ll*ret*f[x]%P*C(siz+=size[x],size[x])%P;
	}
	return ret;
}

inline void solve()
{
	if (ecnt!=(int)con.size())
	{
		ans=0;
		return;
	}
	for (int x:con) if (deg[x]==1) q.push(x);
	for (;!q.empty();q.pop())
	{
		int x=q.front();
		for (int i=last[x],y;i;i=nxt[i])
			if (deg[y=tov[i]]-1)
			{
				bel[i+1>>1]=x;
				if (--deg[y]==1) q.push(y);
			}
	}
	int src=0;
	for (int x:con)
		if (deg[x]-1)
		{
			if (!src) src=x;
			vis[x]=0;
		}
	cir[0]=0;
	for (int x=src,y,tar,i,lste=0,i_;!vis[x];vis[cir[++cir[0]]=x]=tim,eid[cir[0]]=lste=i_+1>>1,x=tar)
		for (i=last[x],tar=0;!tar&&i;i=nxt[i])
			if (lste!=i+1>>1&&deg[y=tov[i]]-1) tar=y,i_=i;
	for (int x:con) deg[x]=0;
	cir[cir[0]+1]=cir[1];
	for (int i=1;i<=cir[0];++i) bel[eid[i]]=cir[i];
	int ret=calc();
	for (int i=1;i<=cir[0];++i) bel[eid[i]]=cir[i+1];
	(ret+=calc())%=P;
	ans=1ll*ans*ret%P*C(sizcnt+=ecnt,ecnt)%P;
	con.clear(),ecnt=0;
}

int main()
{
	//freopen("balls.in","r",stdin),freopen("balls.out","w",stdout);
	n=read(),v=n<<1;
	for (int i=1;i<=v;++i) X[i]=read(),Y[i]=read(),insert(X[i],Y[i]+n),insert(Y[i]+n,X[i]);
	pre(),ans=1;
	for (int x=1;ans&&x<=v;++x)
		if (!vis[x]) ++tim,dfs(x),solve();
	printf("%d\n",ans);
	//fclose(stdin),fclose(stdout);
	return 0;
}

Measured memory_bytes: 18164
# B - Digital Gifts
# https://atcoder.jp/contests/abc119/tasks/abc119_b
ER = 380000.0

N = int(input())

total_yens = 0.0

for i in range(N):
    u_i, x_i = raw_input().split()
    if x_i == 'JPY':
        total_yens += int(u_i)
    else: # x_i == 'BTC'
        total_yens += (float(u_i) * ER)

print '{0:.4f}'.format(total_yens)


Measured memory_bytes: 2568
import sys
A,B,C = [int(n) for n in input().split()]
# N = int(input())
# a = [int(input()) for _ in range(N)]
# S = str(input())
# L = len(S)
# T = str(input())
taka = 0
while (taka != C and B >= A):
    B-=A
    taka+=1
print(taka)


Measured memory_bytes: 2940
#include <cstdio>
#include <math.h>

int N;
double X1,Y1,X2,Y2,X3,Y3;

int main()
{
    scanf("%d",&N);
    while (N--)
    {
        scanf("%lf%lf%lf%lf%lf%lf",&X1,&Y1,&X2,&Y2,&X3,&Y3);
        double a = X1-X2;
        double b = Y1-Y2;
        double c = -(X1*X1+Y1*Y1-X2*X2-Y2*Y2);
        double d = X2-X3;
        double e = Y2-Y3;
        double f = -(X2*X2+Y2*Y2-X3*X3-Y3*Y3);
        double l = (c*e-b*f)/(a*e-b*d);
        double m = (d*c-a*f)/(d*b-e*a);
        double n = -(X1*X1+Y1*Y1+l*X1+m*Y1);
        printf("%.3f %.3f %.3f\n",l*-0.5,m*-0.5,sqrt(l*l+m*m-n*4.0)/2.0);
    }
}

Measured memory_bytes: 1092
(defun taxed-price (tax price)
  (floor (* price tax)))

(defun restore-price (tax price func)
  (funcall func (/ price tax)))

(let* ((n (read))
       (tax 1.08)
       (ceil (restore-price tax n #'ceiling))
       (bottom (restore-price tax n #'floor)))
  (princ
    (cond 
      ((= n (taxed-price tax ceil))
        ceil)
      ((= n (taxed-price tax bottom))
        bottom)
      (t
        ":(") 
         mn)))

Measured memory_bytes: 13544
#include<iostream>
#include<string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdint>
#include <map>
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(){

ll n,k;
cin >> n >> k;

ll ans = 0;

if(k == 0) {cout << n*n << endl; return 0;}

for(int i = 1; i<= n; i++){
if(i > k)
ans += (i-k)*(n/i) + max((ll)0,(n%i) - k + 1);
}

cout << ans << endl;

return 0;
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int g = __gcd(a, b);
  int d = b / g;
  // [0, d)があまりの周期
  // cがこの余りの中に出てくるか判定
  // 0, gcd(a, b), gcd(a, b) * 2 ~ gcd(a, b) * (d - 1)

  if (c % g != 0 || c / g >= d)
    cout << "NO";
  else
    cout << "YES";
  return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vll;
#define INF 0x3f3f3f3f
#define MOD 998244353LL
#define EPSILON 0.00001
#define f first
#define s second
#define pb push_back
#define mp make_pair

#define FOR(i, a, b) for (ll i=(a); i<=(signed)(b); i++)
#define F0R(i, a) for (ll i=0; i<(signed)(a); i++)
#define RFOR(i, a, b) for (int i=(a); i >= b; i--)

#define MN 2005
int n, x, y;
vi e[MN];
int tds[MN];

int dis[MN];
queue<int> ree;
void bfs(int rt){
    //cout << "doing " << rt << "\n";
    memset(dis, -1, sizeof dis);
    while(!ree.empty()) ree.pop();
    ree.push(rt);
    dis[rt] = 0;
    while(!ree.empty()){
        int cn = ree.front();
        ree.pop();
        //cout << cn << " has dist of " << dis[cn] << "\n";
        for(auto nn : e[cn]){
            if(dis[nn] == -1){
                dis[nn] = dis[cn]+1;
                if(nn > rt) tds[dis[nn]]++;
                ree.push(nn);
            }
        }
    }
}

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

    cin >> n >> x >> y;
    FOR(i, 1, n-1){
        e[i].pb(i+1);
        e[i+1].pb(i);
    }
    e[x].pb(y);
    e[y].pb(x);
    FOR(i, 1, n) bfs(i);
    FOR(i, 1, n-1){
        cout << tds[i] << "\n";
    }

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double lb;
#define REP(i,j,n) for (int i=j;i<(n);i++)
#define RREP(i,n) for (int i = n; 0<i;i--)
#define print(out) cout<< out  << "\n";
#define mod 1000000007
const int INF = 1e9;

int main(){
  int N,ans=0;cin>>N;
  string s="";
  REP(i,1,N+1){
    s=to_string(i);
    if(s.size()%2==1)ans++;
  }
  print(ans)
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long i64;
i64 pw10[20];
//i64 _ans;
//char _s1[20],_s2[20];
bool Q(i64 x){
	printf("? %lld\n",x),fflush(stdout);
//	memset(_s1,0,sizeof(_s1));
//	memset(_s2,0,sizeof(_s2));
//	sprintf(_s1,"%lld",x);
//	sprintf(_s2,"%lld",_ans);
//	bool d=(x<=_ans)==(strcmp(_s1,_s2)<=0);
//	puts(d?"Y":"N");
//	return d;
	char c;
	scanf(" %c",&c);
	return c=='Y';
}
void A(i64 x){
	printf("! %lld\n",x),fflush(stdout);
}
int main(){
//	scanf("%lld",&_ans);
	pw10[0]=1;
	for(int i=1;i<=12;++i)pw10[i]=pw10[i-1]*10ll;
	if(Q(pw10[12])){
		int p=9;
		while(p&&Q(pw10[p]-1))--p;
		A(pw10[p]);
	}else{
		int p=0;
		while(Q(pw10[p]))++p;
		i64 L=pw10[p],R=L*10-1,M;
		while(L<R){
			M=L+R>>1;
			if(Q(M))R=M;
			else L=M+1;
		}
		A(L/10);
	}
	return 0;
}

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

int main()
{
  while(true){
    int n,x,z;
    cin >> n >> x;
    if(n==0 && x==0) break;
    z=0;
    
    for(int k=1;k<=n;k++){
      for(int l=k+1;l<=n;l++){
	for(int m=l+1;m<=n;m++){
	  if(k+l+m==x && k!=l && l!=m && k!=m){
	    z++;
	  }
	}
      }
    }
    cout << z <<endl;
  }
  return 0;
}

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

int main(void){
    int h1, h2, k1, k2, x, y, z, w, H, K;
    cin >> h1 >> h2 >> k1 >> k2 >> x >> y >> z >> w;
    H = h1*x + (h1/10)*z + h2*y + (h2/20)*w;
    K = k1*x + (k1/10)*z + k2*y + (k2/20)*w;
    if(H > K){
        cout << "hiroshi" << endl;
    }
    else if(K > H){
        cout << "kenjiro" << endl;
    }
    else{
        cout << "even" << endl;
    }
    return 0;
}



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

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    int maxd = 1;
    for(int i = 1; i <= 100; i++){
        if(a%i == 0 && b%i == 0){
            maxd = i;
        }
    }
    if(c % maxd != 0){
        cout << "NO";
    } else {
        cout << "YES";
    }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int b[] = new int[n];
		int ans = 0;
		
		b[0] = sc.nextInt();
		b[1] = b[0];
		for(int i = 2; i < n; i++) {
			b[i] = sc.nextInt();
		}
		
		for(int i = 0; i < n - 1; i++) {
			if(b[i] > b[i + 1]) {
				b[i] = b[i+ 1];
			}
			ans += b[i];
		}
		ans += b[n - 1];
		
		System.out.print(ans);
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <stdio.h>
#include <math.h>


using namespace std;

typedef long long ll;

typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<ll> vll;

typedef pair<int, int> pii;

typedef queue<int> qi;
typedef queue<string> qs;


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

#define all(v) v.begin(), v.end()
//sort( all(v) )　などと使える


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

	int r = n % 10;

	if (r ==  2 || r == 4 || r == 5 || r == 7 || r == 9) {
		cout << "hon" << endl;
	}
	else if (r == 0 || r == 1 || r == 6 || r == 8) {
		cout << "pon" << endl;
	}
    else{
        cout << "bon" << endl;
    }
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner=new Scanner(System.in);
		int N = scanner.nextInt();
		long ans = 1;
		long max = (long)Math.pow(10, 18);

		for(int i = 0 ; i < N ; i++) {
			long a = scanner.nextLong();
			if(a == 0) {
				ans = 0;
				break;
			}
			if(max / ans >= a) {
				ans *= a;
			}else {
				ans = -1;
			}

		}

		System.out.println(ans);

		scanner.close();

	}

}


Measured memory_bytes: 59704
import java.util.Scanner;

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

	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();

		init(n);

		int p[] = new int[n];
		for(int i=0; i<n; i++) {
			p[i]=sc.nextInt();
			p[i]--;
		}
		for(int i=0; i<m; i++) {
			int x=sc.nextInt();
			int y=sc.nextInt();
			x--;y--;
			unite(x,y);
		}
		int cnt=0;
		for(int i=0; i<n; i++) {
			if(same(p[i], i)) {
				cnt++;
			}
		}
		System.out.println(cnt);
		sc.close();
	}

	int p[];
	int rank[];
	private void init(int n) {
		p = new int[n];
		rank = new int[n];
		for(int i=0; i<n; i++) {
			p[i]=i;
			rank[i]=0;
		}
	}
	private boolean same(int x, int y) {
		return find(x)==find(y);
	}
	private int find(int x) {
		if(p[x]==x) return x;
		return p[x] = find(p[x]);
	}

	private boolean link(int x, int y) {
		if(x==y) return false;
		if(rank[x] < rank[y]) {
			p[x]=y;
		}else {
			p[y]=x;
			if(rank[x]==rank[y]) {
				rank[y]++;
			}
		}
		return true;
	}

	private boolean unite(int x, int y) {
		return link(find(x), find(y));
	}
}


Measured memory_bytes: 91880