akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll mod=1000 * 1000 * 1000 + 7;
ll mul(ll a, ll b)
{
	return ((a%mod)*(b%mod))%mod;
}
ll add(ll a, ll b)
{
	return ((a%mod)+(b%mod))%mod;
}
ll sub(ll a, ll b)
{
	return ((a%mod)-(b%mod)+mod)%mod;
}
ll po[200005];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	cin>>n;
	po[0]=1;
	for(ll i=1;i<200005;i++)
	{
		po[i]=mul(po[i-1],2);
	}
	map<pair<ll,ll>,pair<ll,ll>> m;
	ll a=mod-1;
	while(n--)
	{
		ll x,y;
		cin>>x>>y;
		if(x==0 && y==0)
		{
			a++;
			continue;
		}
		if (make_pair(x, y) < make_pair(0ll, 0ll)) x = -x, y = -y;
		long long g = __gcd(abs(x), abs(y));
		x /= g; y /= g;
		if (y > 0) m[{x, y}].first++;
		else m[{-y, x}].second++;
	}
	ll r=1;
	for(auto it=m.begin();it!=m.end();it++)
	{
		pair<ll,ll> p=it->second;
		
		r=mul(r,add(po[p.first],po[p.second])-1);
	}
	
	r=add(a,r);
	cout<<r;
}


Measured memory_bytes: 20808
#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <climits>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <type_traits>
#include <utility>
#include <vector>

using int32 = std::int_fast32_t;
using int64 = std::int_fast64_t;
using uint32 = std::uint_fast32_t;
using uint64 = std::uint_fast64_t;
using intl32 = std::int_least32_t;
using intl64 = std::int_least64_t;
using uintl32 = std::uint_least32_t;
using uintl64 = std::uint_least64_t;



int main(void) {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	uint32 n, a, b;
	std::cin >> n >> a >> b;
	std::cout << ((b - a) & 1 ? "Borys" : "Alice") << "\n";
	return 0;
}

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

int main() {
    int n;
    string s;
    ll cnt = 0;
    int r[4001] = {};
    int g[4001] = {};
    int b[4001] = {};

    cin >> n;
    cin >> s;

    for (int i = 1;i <= n;i++) {
        r[i] = r[i - 1];
        g[i] = g[i - 1];
        b[i] = b[i - 1];
        if (s[i - 1] == 'R') r[i]++;
        if (s[i - 1] == 'G') g[i]++;
        if (s[i - 1] == 'B') b[i]++;
    }

    for (int i = 0;i < n;i++) {
        for (int j = 1;j < n;j++) {
            if (s[i] != s[i + j]) {
                int not_k = i + 2 * j;
                if (s[i] == 'R') {
                    if (s[i + j] == 'G') {
                        cnt += b[n] - b[i + j];
                        if (not_k < n && s[not_k] == 'B') cnt--;
                    } else if (s[i + j] == 'B') {
                        cnt += g[n] - g[i + j];
                        if (not_k < n && s[not_k] == 'G') cnt--;
                    }
                } else if(s[i] == 'G') {
                    if (s[i + j] == 'R') {
                        cnt += b[n] - b[i + j];
                        if (not_k < n && s[not_k] == 'B') cnt--;
                    } else if (s[i + j] == 'B') {
                        cnt += r[n] - r[i + j];
                        if (not_k < n && s[not_k] == 'R') cnt--;
                    }
                } else if(s[i] == 'B') {
                    if (s[i + j] == 'R') {
                        cnt += g[n] - g[i + j];
                        if (not_k < n && s[not_k] == 'G') cnt--;
                    } else if (s[i + j] == 'G') {
                        cnt += r[n] - r[i + j];            
                        if (not_k < n && s[not_k] == 'R') cnt--;
                    }
                }
            }
        }
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 3676
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<queue>
#include<cstdio>
using namespace std;
int main()
{
    string a;
    cin>>a;
    a.insert(4,1,' ');
    cout<<a<<endl;
	return 0;
}

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

int main()
{
    int N;
    cin >> N;
    vector<int> a(N, 0);
    for (int i = 0; i < N; i++)
        cin >> a[i];
    int s = 0;
    for (int i = 0; i < N; i++)
        s ^= a[i];
    for (int i = 0; i < N; i++)
        a[i] ^= s;
    for (int i = 0; i < N; i++)
        cout << a[i] << endl;
    return 0;
}

Measured memory_bytes: 4028
#include <cmath>
#include <iostream>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

struct Point {
  double x;
  double y;
};

void koch(Point p1, Point p2, int n, int cnt) {
  if (cnt >= n) {
    std::cout << p1.x << ' ' << p1.y << '\n';
    return;
  }

  cnt++;

  Point s{p1.x + (p2.x - p1.x) / 3.0, p1.y + (p2.y - p1.y) / 3.0};
  Point t{p2.x - (p2.x - p1.x) / 3.0, p2.y - (p2.y - p1.y) / 3.0};
  Point v{t.x - s.x, t.y - s.y};
  Point u{s.x + (v.x - sqrt(3) * v.y) / 2.0, s.y + (sqrt(3) * v.x + v.y) / 2.0};

  koch(p1, s, n, cnt);
  koch(s, u, n, cnt);
  koch(u, t, n, cnt);
  koch(t, p2, n, cnt);
}

// s, t, u
void koch2(Point p1, Point p2, int n) {
  if (n < 1) {
    return;
  }

  Point s{p1.x + (p2.x - p1.x) / 3.0, p1.y + (p2.y - p1.y) / 3.0};
  Point t{p2.x - (p2.x - p1.x) / 3.0, p2.y - (p2.y - p1.y) / 3.0};
  Point v{t.x - s.x, t.y - s.y};
  Point u{s.x + (v.x - sqrt(3) * v.y) / 2.0, s.y + (sqrt(3) * v.x + v.y) / 2.0};

  koch2(p1, s, n - 1);
  std::cout << s.x << ' ' << s.y << '\n';

  koch2(s, u, n - 1);
  std::cout << u.x << ' ' << u.y << '\n';

  koch2(u, t, n - 1);
  std::cout << t.x << ' ' << t.y << '\n';

  koch2(t, p2, n - 1);
}

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

  Point p1{0.0, 0.0}, p2{100.0, 0.0};

  std::cout << p1.x << ' ' << p1.y << '\n';
  koch2(p1, p2, n);
  std::cout << p2.x << ' ' << p2.y << '\n';
  return 0;
}



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

using namespace std;

typedef long long ll;

const int maxn=2e5+10;

int a[maxn];
ll sum[maxn];
const int mod=1e9+7;

int main()
{
	int n;
	cin>>n;
	for( int i=1;i<=n;i++ ) cin>>a[i];
	
	for( int i=n;i>=1;i-- ) sum[i]=(sum[i+1]+a[i])%mod;
	
	ll res=0;
	for( int i=1;i<=n;i++ )
	{
		res=(res+ 1ll*a[i]*sum[i+1]%mod )%mod; 
	}
	cout<<res;
}

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

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def gcd_list(a):
  for i in range(n - 1):
    a[i + 1] = gcd(a[i], a[i + 1])
  return a[n - 1]
  
print(gcd_list(a))

Measured memory_bytes: 15020
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

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

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}




int main(){
  ll n,k; cin >> n >> k;
  ll now = 1;
  
  rep(i,n){
    now = min(now+k,now*2);
  }
  
  cout << now << endl;
  
  
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
#define INF 1001001001
#define PI 3.14159265359
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define repX(i, n , x) for (int i = (int)(x); i < (int)(n); ++i)
#define repB(i, n) for (int i = n; i >= 1; --i)
#define repBX(i, n , x) for (int i = (int)(n); i >= int(X); --i)
#define dup(x,y) (((x)+(y)-1)/(y))

int main() {
    int Hf,Hs,Mf,Ms,K;
    cin >> Hf >> Mf >> Hs >> Ms >> K;
    int f = Hf*60+Mf,s = Hs*60+Ms;
    cout << max(0,(s-f)-K) << endl;
    
    return 0;
}

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

template< typename T >
bool isprime(T n) {
    if (n == 2) return true;
    if ((n & 1) == 0) return false;
    for (int i = 3; i <= sqrt(n); i += 2) {
        if (n % i == 0) return false;
    }
    return true;
}

int main() {
    int n;
    int cnt = 0;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int r;
        cin >> r;
        if (isprime(r)) cnt++;
    }
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 3104
N, D = map(int, input().split())

x = [0] * N
y = [0] * N

for i in range(N):
  x[i], y[i] = map(int, input().split())
  
counter = 0

for i in range(N):
  dist = x[i] * x[i] + y[i] * y[i]
  if dist <= D*D:
    counter += 1

print(counter)

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

#define ll long long
typedef pair<ll,ll>pi;
map<pi,ll>mp,vis;
ll val[105],wt[105];
ll n,cap,sub;
ll dp[105][403][105];

//ll call(ll i,ll w,ll k)
//{
//    ll z=w+k*sub;
////    cout<<i<<" "<<z<<" "<<k<<endl;
//    if(z>cap)return -999999;
//    if(z==cap||i==n)return 0;
//    if(dp[i][w][k]!=-1)return dp[i][w][k];
////    cout<<"wt of "<<i<<" "<<wt[i]<<endl;
//    ll inc=val[i]+call(i+1,w+wt[i],k+1);
//    ll exc=call(i+1,w,k);
//    return dp[i][w][k]=max(inc,exc);
////    return dp[i][w][k]=max(call(i+1,w+wt[i],k+1)+val[i],call(i+1,w,k));
//}
ll call(int i,int w)
{
    if(w>cap)return -999999999;
    if(w==cap||i==n)return 0;
    if(mp[{i,w}]>0)return mp[{i,w}];
    return mp[{i,w}]=max(val[i]+call(i+1,w+wt[i]),call(i+1,w));

}
int main()
{
    cin>>n>>cap;
    cin>>wt[0]>>val[0];
    sub=wt[0]-1;
//    wt[0]=1;
    for(ll i=1;i<n;i++)cin>>wt[i]>>val[i];
//    cap-=sub;
//    for(ll i=0;i<n;i++)cout<<wt[i]<<" ";cout<<endl;
//    cout<<"cap = "<<cap<<endl;
//    memset(dp,-1,sizeof dp);
    cout<<call(0,0)<<endl;
}
/*
6 69
11 12
12 30
13 60
14 70
12 30
12 40

*/


Measured memory_bytes: 6272
#include<stdio.h>
int main(void)
{
    int h,m,s,S;
    scanf("%d",&S);
    
    h=S/3600;
    m=S%3600/60;
    s=S%3600%60;
    
    printf("%d:%d:%d\n",h,m,s);
    
    return 0; 
}


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

int N, A[200];

int main()
{
	int dmin = 100;
	scanf("%d", &N);
	for (int i = 0; i < N; ++i) {
		int A;
		scanf("%d", &A);
		int d = 0;
		while (A % 2 == 0) {
			A /= 2;
			++d;
		}
		dmin = min(dmin, d);
	}
	printf("%d\n", dmin);
	return 0;
}


Measured memory_bytes: 1696
# ABC 54, B - template matching
n, m = [int(el) for el in input().split(' ')]
A = [list(input()) for i in range(n)]
B = [list(input()) for i in range(m)]

def compute():

    for i in range(n-m+1):
        for j in range(n-m+1):
            sub_A = [a[j:j+m] for a in A[i:i+m]]
            if sub_A == B:
                return('Yes')
    else:
        return('No')

print(compute())


Measured memory_bytes: 3060
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
#include <memory>
#include <time.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS = 1e-9;
const double PI  = acos(-1.0);


struct programmer{
	int score,presence;
	programmer():score(0),presence(0){}
};
struct evnt{
	int month,date;
	int hour,min;
	char inout;
	int id;
};
int main(){
	int n;
	while(cin>>n,n){
		vector<programmer> programmers(1000);
		int pl=programmers.size();
		vector<evnt> evnts(n);
		REP(i,n){
			char sep;
			cin>>evnts[i].month>>sep>>evnts[i].date>>evnts[i].hour>>sep>>evnts[i].min>>evnts[i].inout>>evnts[i].id;
		}
		//FOR(i,1,evnts.size()){
		//	if(evnts[i].date!=evnts[i-1].date){
		//		evnt e;
		//		e.month=evnts[i-1].month;
		//		e.date=evnts[i-1].date;
		//		e.hour=24;
		//		e.min=0;
		//		e.inout='C';
		//		evnts.insert(evnts.begin()+i,e);
		//		i++;
		//	}
		//}
		//		evnt e;
		//		e.month=evnts[evnts.size()-1].month;
		//		e.date=evnts[evnts.size()-1].date;
		//		e.hour=24;
		//		e.min=0;
		//		e.inout='C';
		//		evnts.push_back(e);

		int prevtime=0;
		int goddess_presence=0;
		REP(i,n){
			int curtime=evnts[i].hour*60+evnts[i].min;
			/*if(evnts[i].inout=='C'){
				REP(j,pl){
					if(programmers[j].presence&&goddess_presence){
						programmers[j].score+=curtime-prevtime;
					}
					programmers[j].presence=0;
				}
				goddess_presence=0;
				prevtime=0;
			}else */if(evnts[i].id==0){
				if(evnts[i].inout=='O'){
					REP(j,pl){
						if(programmers[j].presence){
							programmers[j].score+=curtime-prevtime;
						}
					}
				}
				goddess_presence=evnts[i].inout=='I';
				prevtime=curtime;
			}else{
				if(goddess_presence){
					REP(j,pl){
						if(programmers[j].presence){
							programmers[j].score+=curtime-prevtime;
						}
					}
				}
				programmers[evnts[i].id].presence=evnts[i].inout=='I';
				prevtime=curtime;
			}
			//cerr<<curtime<<"*"<<evnts[i].month<<evnts[i].date<<"-"<<evnts[i].hour<<":"<<evnts[i].min<<"= ";
			//FOR(j,1,5){
			//	cerr<<programmers[j].score<<",";
			//}
			//cerr<<endl;
		}
		int ans=0;
		REP(i,pl){
			ans=max(ans,programmers[i].score);
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 1220
n = input()
s = input()

n = int(n)

if (n % 2) != 0:
  print("No")
else:
  s1 = s[:int(n/2)]
  s2 = s[int(n/2):]
  
  if s1 == s2:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 3060
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] arg) {
		int[] a=new int[3];
		int n=0;
		Scanner scan = new Scanner(System.in);
		n=scan.nextInt();
		for (int j=0;j<n;j++) {
			a[0] = scan.nextInt();
			a[1] = scan.nextInt();
			a[2] = scan.nextInt();
			Arrays.sort(a);
			if(a[0]*a[0]+a[1]*a[1]==a[2]*a[2]){
				System.out.println("YES");
			}else{
				System.out.println("NO");
			}
		}
	}
}

Measured memory_bytes: 23380
#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;
#define lol long long

int main()
{
	char b;
	cin >> b;
	if (b == 'A') {
		cout << "T" << endl;
	}
	else if (b == 'T') {
		cout << "A" << endl;
	}
	else if (b == 'G') {
		cout << "C" << endl;
	}
	else {
		cout << 'G' << endl;
	}
}

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

int main(){
  int H, W, N;
  cin >> H >> W >> N;
  int ans;
  if(H < W){
    if(N % W == 0){
      ans = N / W;
    }
    else{
      ans = N / W + 1;
    }
  }
  
  else{
    if(N % H == 0){
      ans = N / H;
    }
    else{
      ans = N / H + 1;
    }
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
n = int(input())
ans = 0
if 105 <= n < 135:
  ans = 1
elif 135 <= n < 165:
  ans = 2
elif 165 <= n < 189:
   ans = 3
elif 189 <= n < 195:
   ans = 4
elif 195 <= n:
   ans = 5
print(ans)

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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)

int main()
{
    lint n;
    cin >> n;
    lint count=0;

    vector<lint> p(n);
    REP(i, n) { cin >> p[i]; }

    REP(i, n)
    {
        if(p[i]!=i+1){
            count += 1;
        }
    }

    if (count==0||count==2){
        cout << "YES" << "\n";
    }else{
        cout << "NO"
             << "\n";
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
 public static void main(String[] args){
	Scanner stdIn = new Scanner(System.in);
   int a[] = new int[5];
    a[0] = stdIn.nextInt();
    a[1] = stdIn.nextInt();
    a[2] = stdIn.nextInt();
    a[3] = stdIn.nextInt();
    a[4] = stdIn.nextInt();
     if (a[0] == 0) {
       System.out.println("1");
     }
     if (a[1] == 0) {
       System.out.println("2");
     }
     if (a[2] == 0) {
       System.out.println("3");
     }
     if (a[3] == 0) {
       System.out.println("4");
     }
     if (a[4] == 0) {
      System.out.println("5");
     }
 }
}

Measured memory_bytes: 35756
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rng(i,a,b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define repd(i, n) for(ll i = (ll)(n)-1;i>=0;--i)
#define rngd(i,b,a) for(ll i = (ll)(b);i>=a;--i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((ll)(x).size())
#define ctoi(x) ((x)-'0')
#define sq(x) (x)*(x)

int n,q;
vector<int> s,t;
bool solve(int k,int mn,int mx){
  if(mx<mn){
    return 0;
  }
  int mid=mn+(mx-mn)/2;
  if(s[mid]==k){
    return 1;
  }else if(s[mid]<k){
    return solve(k,mid+1,mx);
  }else{
    return solve(k,mn,mid-1);
  }
}
int main() {
  cin>>n;
  s=vector<int>(n);
  rep(i,n){
    cin>>s[i];
  }
  cin>>q;
  t=vector<int>(q);
  rep(i,q){
    cin>>t[i];
  }

  int cnt=0;
  rep(i,q){
    cnt+=solve(t[i],0,n-1);
  }
  cout<<cnt<<endl;
  return 0;
}


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

using namespace std;
using ll = long long;

int N;
ll L;

struct Node {
    int c[2] = {-1, -1};
};
vector<Node> v;

void dump (int node, int depth = 0) {

}

ll grundy(ll depth) {
    if (depth == 0) return 0;
    ll g = 1;
    while (depth != 0 && ((depth & 1) == 0)) {
        g <<= 1;
        depth >>= 1;
    }
    return g;
}

ll dfs(int node, int depth = 0) {
    Node n = v[node];
    ll g = 0;
    if (n.c[0] * n.c[1] < 0) {
        g = grundy(L - depth);
    }

    if (n.c[0] != -1) {
        g ^= dfs(n.c[0], depth + 1);
    }
    if (n.c[1] != -1) {
        g ^= dfs(n.c[1], depth + 1);
    }

    return g;
}

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

    Node root = Node();
    v.push_back(root);

    for (int i = 0; i < N; ++i) {
        string s;
        cin >> s;
        int nodei = 0;
        for (int j = 0; j < s.size(); ++j) {
            int n = s[j] - '0';
            Node node = v[nodei];
            if (node.c[n] != -1) {
                nodei = node.c[n];
            } else {
                Node newnode = Node();
                v.push_back(newnode);
                v[nodei].c[n] = v.size() - 1;
                nodei = v.size() - 1;
            }
        }
    }

    ll g = 0;

    cout << (dfs(0) != 0 ? "Alice" : "Bob") << endl;
}


Measured memory_bytes: 4304
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;

const int N = 1e5;
int ins[N];
int dp[N];
vector<int> conns[N];

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

	int n, m;
	cin >> n >> m;
	for (int j = 0; j < m; ++j) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		conns[a].push_back(b);
		++ins[b];
	}
	vector<int> que;
	for (int i = 0; i < n; ++i) {
		if (ins[i] == 0) que.push_back(i);
	}

	int res = 0;
	for (int j = 0; j < n; ++j) {
		int i = que[j];
		res = max(res, dp[i]);
		for (auto t : conns[i]) {
			dp[t] = max(dp[t], dp[i] + 1);
			--ins[t];
			if (ins[t] == 0) que.push_back(t);
		}
	}
	cout << res << '\n';
}


Measured memory_bytes: 7164
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <stack>
#include <cmath>
#include <queue>
#include <numeric>

typedef struct a {
	int c, s, f;
} A;

int main()
{
	int n;

	std::cin >> n;

	std::vector<A> v(n);

	for (size_t i = 0; i < n - 1; i++)
	{
		std::cin >> v[i].c >> v[i].s >> v[i].f;
	}

	for (size_t i = 0; i < n - 1; i++)
	{
		long long time = 0;
		for (size_t j = i; j < n - 1; j++)
		{
			if (time < v[j].s) {
				time += (v[j].s - time);
			}
			else {
				time += (v[j].f - ((time - v[j].s) % v[j].f)) % v[j].f;
			}
			time += v[j].c;
		}
		std::cout << time << std::endl;
	}

	std::cout << 0 << std::endl;

	return 0;
}


Measured memory_bytes: 256
n=int(input())
s=[-1 for i in range(n+1)]

def fib(n):
  if n==0 or n==1:
    s[n]=1
  if s[n] != -1:
    return s[n]
  s[n] = fib(n-1) + fib(n-2)
  return s[n]

print(fib(n))


Measured memory_bytes: 5604
#include <stdio.h>



int main(void)
{
	int midterm[50], final[50], total[50], makeup[50];
	int numstudent = 0;
	
	for(int i = 0; i < 50; i++){
		scanf("%d %d %d", &midterm[i], &final[i], &makeup[i]);
		if(midterm[i] == -1 && final[i] == -1){
			if(makeup[i] == -1) break;
		}
		if(midterm[i] != -1 || final[i] != -1){	
			total[i] = midterm[i] + final[i];
		}
		else if(midterm[i] == -11){
			total[i] = final[i];
		}
		else if(final[i] == -1){
			total[i] = midterm[i];
		}
		numstudent++;
	}
	
	for(int i = 0; i < numstudent; i++){
		if(midterm[i] == -1 || final[i] == -1){	
			printf("F\n");;
		}
		else if(total[i] >= 80){
			printf("A\n");
		}
		else if(total[i] < 80 && total[i] >= 65){
			printf("B\n");
		}
		else if(total[i] < 65 && total[i] >= 50){
			printf("C\n");
		}
		else if(total[i] < 50 && total[i] >= 30){
			if(makeup[i] >= 50)	printf("C\n");
			else printf("D\n");
		}
		else{
			printf("F\n");
		}
	//	printf("%d\n", total[i]);
	}
}



Measured memory_bytes: 2052
#include <bits/stdc++.h>
using namespace std;
using ulli = unsigned long long int;
const int MOD=1e9+7;
int main()
{
    int n;
    cin>>n;
    int a[n][n];
    for(int i=0;i<n;i++) for(int j=0;j<n;j++) cin>>a[i][j];
    vector<ulli> dp(1<<n,0);
    dp[0]=1;
    for(int mask=0;mask<(1<<n);mask++)
    {
        int j=__builtin_popcount(mask);
        for(int i=0;i<n;i++)
        {
            if(a[j][i]==1 && !(mask&(1<<i)))
            {
                dp[mask|(1<<i)]=(dp[mask|(1<<i)]+dp[mask])%MOD;
            }
        }
    }
    cout<<dp[(1<<n)-1];
}

Measured memory_bytes: 19580
x, y = map(int,input().split())
#li = list(map(int, input().split()))

def pr(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n //= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

print(len(set(pr(x)) & set(pr(y)))+1)

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

using namespace std;

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

    vector<int> vt(n);
    for (int i = 0; i < n; ++i) {
        cin >> vt[i];
    }

    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int c;
        cin >> c;
        if (vt[i] > c) ans += vt[i] - c;
    }

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


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n, m;
  cin >> n >> m;
  if (n % m == 0) {
    cout << -1 << endl;
  } else {
    cout << n << endl;
  }
  return 0;
}


Measured memory_bytes: 256
N = int(input())
v = list(map(int, input().split()))
v.sort()
if N == 2:
  print((v[0] + v[1]) / 2)
else:
  s = (v[0]+v[1])/2
  for i in range(2, N):
    s = (s + v[i])/2
  print(s)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll mod=1e9+7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    // cin>>t;
    while(t--)
    {
        ll n;cin>>n;
        ll arr[n],sum=0;
        for(int i=0;i<n;i++) {cin>>arr[i];sum=(sum+arr[i])%mod;}
        ll ans=0;
        for(int i=0;i<n-1;i++)
        {
            sum=(sum-arr[i]+mod)%mod;
            ans=(ans+ arr[i]*sum)%mod;
        }
        cout<<ans;
    }
}

Measured memory_bytes: 5212
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
#include <string.h>
#include <iomanip>

using namespace std;

int main()
{
	
	vector <pair<int, int> > v;
	
	int n;
	cin >> n;
	int x,y;
	vector <double> sum;
	for (int i = 0; i<n; i++) {
		cin >> x >> y;
		v.push_back(make_pair(x, y));
	}
	
	sort(v.begin(), v.end());
	
	
	do{
		double  res = 0.0; 
		for (int i = 0 ; i<n-1; i++)
		{
			
			
			double a = (v[i].first - v[i+1].first) * (v[i].first - v[i+1].first);
			double b = (v[i].second - v[i+1].second) * (v[i].second - v[i+1].second);
			double c = sqrt(a+b);
				
			
			res = res +  c ;
	
			
		}
		
		sum.push_back(res);
	}while (std::next_permutation(v.begin(), v.end()));
	
	double total = 0.0;
	
	for (int i=0; i<sum.size(); i++)
	{
		total = total + sum[i];
	}
	
	double avg = total/sum.size();
	std::cout<<std::setprecision(11);
	
	std::cout << avg <<endl;
	
	return 0;
}



Measured memory_bytes: 892
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

R=int(input())
if R>=2800:
    print('AGC')
elif R>=1200:
    print('ARC')
else:
    print('ABC')

Measured memory_bytes: 61084
N=int(input())
A=list(map(int,input().split()))
Ans="APPROVED"
for i in range(N):
    if A[i]%2==0:
        if A[i]%3==0 or A[i]%5==0:
            pass
        else:
            Ans="DENIED"
    else:
        pass

print(Ans)

                


Measured memory_bytes: 2940
package main
import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntVec(A *[]int) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func NextFloat(A ...*float64) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.ParseFloat(L[i], 64)
  }
}
func NextFloatVec(A *[]float64) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]float64, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.ParseFloat(l, 64)
  }
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}

func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}
func SumInt(A ...int) int {
  sum := 0
  for _, a := range A {
    sum += a
  }
  return sum
}

func Grundy(a, k int) int {
  if a % k == 0 { return a / k }
  if k * k < a { return Grundy(a - (a / k) - 1, k) }
  x := (a % k - 1) / (a / k + 1) + 1
  return Grundy(a - x * (a / k) - x, k)
}

func Solve() {
  var N int
  NextInt(&N)
  var A, K int
  n := 0
  for i := 0; i < N; i++ {
    NextInt(&A, &K)
    g := Grundy(A, K)
    n ^= g
  }
  ans := "Takahashi"
  if n == 0 { ans = "Aoki" }
  Write(ans)
}

func main() {
  Solve()
  Output()
}

Measured memory_bytes: 4736
# include <bits/stdc++.h>
#define ll long long
#define str string
#define print  cout
#include <set>
using namespace std;
set<int> st;
vector<int> A={1,1},B,C;
ll int  a,b,c,d,e,f,lo,k,cnt,bnt;
str s,t;
bool  S=true,L=true;
int main(){
        cin>>a;
        for(int k=0;k<999999999;k++){
            for(int j=2;j<=sqrt(a);j++){
                if(a%j==0){
                    lo++;
                    break;
                }
            }
            if(lo==0){
                cout<<a;
                return 0;
            }
            else a++;
            lo=0;
        }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
string s;
string si[N];
bool f=0;
bool check(int deep)
{
//	string t=s.substr(l,r-l+1);
//	for (int i=0;i<deep;i++)
//	{
//		if (si[i]==si[deep])
			if (si[deep]!=si[deep-1])
				return 1;
			else 
				return 0;
//	}
//	return 1;
}
void dfs(int n,int deep)
{
	
	if (n==s.size()) 
	{
		cout<<deep-1<<endl;
		f=1;
//		for (int i=1;i<deep;i++)
//		cout<<si[i]<<endl;
		return;
	}
	for (int i=n;i<s.size()&&!f;i++)
	{		
		si[deep]=s.substr(n,i-n+1);
		if (check(deep))
		{						
//			cout<<si[deep]<<endl;
			
			dfs(i+1,deep+1);	
		}
			
	}			
}
int main()
{
	cin>>s;	
//	while (cin>>s)
//	{
//		memset(si,0,sizeof(si));
		dfs(0,1);	
//	}
	
    return 0;
}


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

int main() {
    int N, A, B;
    cin >> N >> A >> B;

    int res = 0;
    for (int i=1; i<=N; i++){
        int sum = 0;
        int x = i;
        while (x != 0){
           sum += x % 10;
           x /= 10;
        }
        if ((A <= sum) and (sum <= B) ) res += i;
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll,ll>;
using vb = vector<bool>;
const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define has(c,i) ((c).find(i) != end(c))
#define FOR(i,a,b) for (int i=(a); i<(b); i++)
#define FORD(i,a,b) for (int i=int(b)-1; i>=(a); i--)

int main() {
	ll n , k;
	cin >> n >> k;
	vl v(n);
	map<ll, ll> m;
	FOR(i,0,n) {
		cin >> v[i];
		m[v[i]]++;
	}
	vl vs;
	for (auto & p : m) {
		vs.pb(p.second);
	}
	sort(all(vs));
	ll count = 0;
	FOR(i, 0, int(vs.size())-k) count+= vs[i];
	cout << count << endl;
}

Measured memory_bytes: 16500
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = String(arg[0].split(" ")[0]);
    
    console.log(N.split("").filter(n=>n==="7").length > 0 ? "Yes" : "No");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29640
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

lis=[a,b,c,d,e]

lis.sort()

if lis[4]-lis[0]>k:
    print(":(")
else:
    print("Yay!")

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

vector<int> u(13, 0);
vector<int> c(13, 0);
vector<vector<int>> a(13, vector<int>(13, 0));

int main(){
    int n,m,x;
    cin >> n >> m >> x;
    rep(i, n){
        cin >> c.at(i);
        rep(j, m){
            cin >> a.at(i).at(j);
        }
    }

    int ans = INF;
    for (int bit = 0; bit < (1<<n); ++bit)
     {
        int cost = 0;
        vector<int> s(m, 0);
        for (int i = 0; i < n; ++i) {
            if (bit & (1<<i)) {
                   cost += c.at(i);
                   rep(j, m) s.at(j)+=a.at(i).at(j);
               }
        }
        bool flg = true;
        rep(j, m) if(s.at(j)<x) flg = false;
        if(flg) ans = min(ans, cost);
     }
    if(ans == INF) cout << -1 << endl;
    else cout << ans << endl;
    return 0;

}

Measured memory_bytes: 3580
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
using namespace std;
//1-indexed
#include<vector>
template<typename T>
struct BIT{
	int n;
	vector<T>bit;
	BIT(int n_=0,T a=0):n(n_),bit(n_+1,a){}
	T sum(int i)
	{
		T ans=0;
		for(;i>0;i-=i&-i)ans+=bit[i];
		return ans;
	}
	void add(int i,T a)
	{
		if(i==0)return;
		for(;i<=n;i+=i&-i)bit[i]+=a;
	}
};
long fuc[1<<17];
main()
{
	fuc[0]=fuc[1]=1;
	for(long i=2;i<1<<17;i++)fuc[i]=fuc[i-1]*i%1000000007LL;
	int N,R;
	while(cin>>N,N)
	{
		vector<int>a(N);
		iota(a.begin(),a.end(),0);
		cin>>R;
		for(;R--;)
		{
			int s,t;cin>>s>>t;
			swap(a[s-1],a[t-1]);
		}
		BIT<int>P(N);
		long ans=0,M=1e9+7;
		for(int i=0;i<N;i++)
		{
			long now=(a[i]-P.sum(a[i]+1))*fuc[N-i-1]%M;
			ans=(ans+now)%M;
			P.add(a[i]+1,1);
		}
		cout<<ans<<endl;
	}
}



Measured memory_bytes: 4592
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int A,B;cin >> A >> B;
  int N = 1;
  int count = 0;
  while(N<B){
    N+=A-1;
    ++count;
  }
  cout << count << endl;
  return 0;
}


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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

static const ll INF = 1e15;

int main(void)
{
	ll k,n;
	cin >> k >> n;
	vector<ll> as(n);
	rep(i, n) cin >> as[i];
	as.push_back(as[0]+k);
	ll m = -1;
	rep(i, n) {
		m = max(as[i + 1] - as[i], m);
	}
	cout << k - m << endl;
	return 0;
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n,m;
  cin >> n >> m;
  vector<long long> a(n+1);
  vector<long long> b(n+1);
  int i,j;
  for(i=1;i<=n;i++) cin >> a[i] >> b[i];
  vector<long long> c(m+1);
  vector<long long> d(m+1);
  for(i=1;i<=m;i++) cin >> c[i] >> d[i];
  int man = 0;
  int p = 0;
  for(i=1;i<=n;i++){
    long long min = 1000000000;
    for(j=1;j<=m;j++){
      man = abs(a[i]-c[j])+abs(b[i]-d[j]);
      if(min>man){
        min = man;
        p = j;
      }
    }
    cout << p << "\n";
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  
  long long N;
  long long max = 1;
  scanf("%lld",&N);

  for(int i=1; i<N; i++){
    if((i*i<=N)){
      max = i*i;
  }else{
      printf("%lld",max);
      return 0;
  }
  }


  printf("%lld",max);

  return 0;

}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <sstream>
 
#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif

int main(int argc, char **argv){
	int n;
#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif


#if INPUT_FROM_FILE
	while(ifs >> n){
#else
	while(std::cin >> n){
#endif
		std::vector<std::vector<int> > dp(4, std::vector<int>(n + 1, 0));
		int result = 0;
		int max_j = std::min(1000, n);

		for(int j = 0; j <= max_j; j++){
			dp[0][j] = 1;
		}

		for(int i = 1; i <= 3; i++){
			for(int j = 0; j <= n; j++){
				int max_k = std::min(1000, j);
				for(int k = 0; k <= max_k; k++){
					dp[i][j] += dp[i - 1][j - k];
				}
			}
		}

		result = dp[3][n];


		std::cout << result << std::endl;
	}

#if INPUT_FROM_FILE
	//fclose(fp);
#endif
    return 0;
}


Measured memory_bytes: 3204
/*
  ∧,,∧
( 'ω' )つ ＜WA,またお前か！！　
（m9 ＼ 　　
　 ＼　 ＼
　 　 ) ) ＼
　 ／／ ＼ ＼
　 (＿） 　 (＿)
*/

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

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

ostringstream oss_global;
string s_global = oss_global.str();

int main()
{
    double W, H, x, y;
    cin >> W >> H >> x >> y;

    int ans;
    if (H == 2*y && W == 2*x) ans = 1;
    else ans = 0;
    double area = H*W/2.0;
    cout << area << " " << ans << endl;
    return 0;
}


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

const int MAXN = 1010;
int n, k, cnt;
ll a[MAXN], b[60][MAXN * MAXN];

int main() {
	scanf("%d%d", &n, &k);
	for(int i = 1; i <= n; ++i) {
		scanf("%lld", &a[i]);
		a[i] += a[i - 1];
	}
	for(int i = 1; i <= n; ++i) {
		for(int j = i; j <= n; ++j) {
			b[51][++cnt] = a[j] - a[i - 1];
		}
	}
	//cout <<" cnt "<<cnt<<endl;
	ll ans = 0LL;
	for(int i = 50; i >= 0; --i) {
		int now = 0;
		for(int j = 1; j <= cnt; ++j) {
			if((b[i + 1][j] >> i) & 1LL) {
				b[i][++now] = b[i + 1][j];
			}
		}
		if(now >= k) {
			ans |= (1LL << i);
			cnt = now;
		}
		else {
			for(int j = 1; j <= cnt; ++j) b[i][j] = b[i + 1][j];
		}
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 168448
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 10;
bitset<maxn> pr; 
void sieve(){
	pr.set();
	pr[0] = pr[1] = 0;
	for(int i = 2; i*i < maxn; ++i){
		if(pr[i])
			for(int j = i*i; j < maxn; j+=i) 
				pr[j] = 0;
	}
}
// veces de P en N!
int veces(long long n , int p){
	int cnt = 0;
	for(int k = p; k <= n; k*= p)
		cnt+= (n/k);
	
	return cnt;
}
const int mod = 1e9 + 7;
int main() {
	sieve();
	int n; cin >> n;
	long long ans = 1;
	for(int i = 2; i <= n; ++i){
		if(!pr[i]) continue;
		ans = ans*( veces(n, i) + 1);
		ans%= mod;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int[] num = new int[3];
		num[0] = scn.nextInt();
		num[1] = scn.nextInt();
		num[2] = scn.nextInt();
		int sum =0;
		for (int i=num[0]; i >= num[0] && i<= num[1] ; i++) {
			if (num[2]%i == 0) {
				sum++;
			}
		}
		System.out.println(sum);
	}
}



Measured memory_bytes: 26216
import heapq

n,m = map(int, input().split())
a=[-int(x) for x in input().split()]
heapq.heapify(a)

#heappopは最小の値（一番上のノードの値を返す)
for _ in range(m):
    tmp = int(heapq.heappop(a)/2)
    #新しい値(2で割った値)を挿入してヒープを保つ)
    heapq.heappush(a,tmp)

print(-sum(a))
    


Measured memory_bytes: 14380
#include <bits/stdc++.h>
#pragma GCC optimize("O2")
#define all(c) c.begin(), c.end()
#define pb push_back
#define ll long long
#define ull unsigned long long
const int MAXN = 1e5 + 5;
const int MOD = 1e9 + 7;
using namespace std;
vector<pair<int,int> > g[MAXN];
int color[MAXN];
int cost[MAXN];
int main()
{

int n;
cin >> n;
for(int i = 0 ; i < n - 1 ; i++)
	 {
	 	int u,v,w;
	 	cin >> u >> v >> w;
	 	g[u].emplace_back(v,w);
	 	g[v].emplace_back(u,w);
	 }

   
   memset(cost,-1,sizeof(cost));
   queue<int> q;
   cost[1] = 0;
   color[1] = 0;
   q.push(1);
   while(!q.empty())
   {
   	int u = q.front();
   	q.pop();
   	for(auto &k : g[u])
   		 {
   		 	if(cost[k.first] == -1)
   		 		 {
   		 		 	cost[k.first] = cost[u] + k.second;
   		 		 	q.push(k.first);
   		 		 }
   		 }
   }

   for(int i = 2 ; i <= n ; i++)
   	 {
   	 	cost[i] = (cost[i] & 1);
   	 }

   	 for(int i = 1 ; i <= n ; i++)
   	 {
   	 	cout << cost[i] << '\n';
   	 }





} 

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

#define int long long
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i,n) for(int i=0; i<(int)n; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define COUT(x) cout << x << endl;
#define PB(x) push_back(x)
#define MP make_pair
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int INF = 1e9;
const int MOD = 1e9+7;

signed main(){
    string s; cin >> s;
    int n=s.size();
    bool can=true;

    rep(i,(n-1)/2){
        if(s[i]!=s[(n-1)/2-1-i]) can=false;
    }
    for(int i=(n+3)/2-1; i<n; i++){
        if(s[i]!=s[n-1-i]) can=false;
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#include <iomanip>
//cout << fixed << setprecision(20) << *** << endl;
#define rep(i,N) for(int i=0;i<(int)N;++i)
typedef long long ll;
using namespace std;
int main()
{
	ll N,ANS=0;
	cin>>N;
	for(double i=1;i<=N;i++){
		if(floor(i*1.08)==N){
			ANS=i;
		}
	}
	if(ANS==0){
		cout<<":("<<endl;
	}
	else{
		cout<<ANS<<endl;
	}
}

Measured memory_bytes: 888
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp37
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] lan = Console.ReadLine().Split(' ');
            string a = lan[0];
            string b = lan[1];
            
            if (a=="H")
            {
                if (b == "H")
                {
                    Console.WriteLine("H");
                }else if (b == "D")
                {
                    Console.WriteLine("D");
                }
            }else if(a=="D"){
                if (b == "H")
                {
                    Console.WriteLine("D");
                }else if (b == "D")
                {
                    Console.WriteLine("H");
                }
            }

        }
    }
}


Measured memory_bytes: 13140
#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>;

void solve() {
    int n;
    cin >> n;
    vector<int> d(n);
    rep(i, n) {
        int d1, d2;
        cin >> d1 >> d2;
        d[i] = d1 == d2;
    }

    rep(i, n-2) {
        if (d[i] == true && d[i] == d[i+1] && d[i] == d[i+2]) {
            cout << "Yes" << endl;
            return;
        }
    }
    cout << "No" << endl;
}

int main() {
    solve();
    return 0;
}


Measured memory_bytes: 3624
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String[] in = s.nextLine().split(" ");
        //int in = Integer.parseInt(s.nextLine());
        int a = Integer.parseInt(in[0]);
        int b = Integer.parseInt(in[1]);
        int c = Integer.parseInt(in[2]);
        System.out.println(a+b >= c ? "Yes":"No");
    }
}

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

int main(){
  int n,k;
  cin >> n >> k;
  cout << n-k+1 << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc;

	static final int INF=1<<28;
	static final double EPS=1e-9;

	void run(){
		sc=new Scanner(System.in);
		int ans=0;
//		Pattern pattern=Pattern.compile("^\\d+|\\d+");
		Pattern pattern=Pattern.compile("\\d+");
		for(; sc.hasNext();){
//		for(int i=0;i<2;i++){
			String s=sc.next();
			Matcher matcher=pattern.matcher(s);
			while(matcher.find()){
				ans+=Integer.parseInt(matcher.group());
//				println(matcher.group());
			}
		}
		println(ans+"");
		sc.close();
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

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

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

using namespace std;
using ll = long long int;

class UF {
public:
    vector<int> p, sz;
    UF(size_t n) : p(n), sz(n) {
        for(size_t i=0; i<n; i++)
            p[i] = i, sz[i] = 1;
    };
    int find(int x) {
        if(p[x] == x) return x;
        return p[x] = find(p[x]);
    };
    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if(x == y) return;
        sz[y] += sz[x];
        p[x] = y;
    };
};


int main(void) {
    constexpr ll MOD = 1e9 + 7;
    cout << fixed << setprecision(16);

    ll n;
    cin >> n;

    ll s = 1e5 + 1;
    UF xs(s), ys(s);

    map<ll, set<ll>> xm, ym;
    for(ll i=0; i<n; i++) {
        ll x, y;
        cin >> x >> y;
        xm[x].insert(y);
        ym[y].insert(x);
    }

    for(auto &t: xm) {
        if(t.second.size() <= 1) continue;
        for(auto &y: t.second) {
            ys.unite(y, *t.second.begin());
        }
    }
    for(auto &t: ym) {
        if(t.second.size() <= 1) continue;
        for(auto &x: t.second) {
            xs.unite(x, *t.second.begin());
        }
    }

    map<ll, set<ll>> rxm;
    for(auto &t: xm) {
        set<ll> &ts = rxm[xs.find(t.first)];
        for(auto &e: t.second)
            ts.insert(e);
    }

    ll res = -n;
    for(auto &t: rxm) {
        res += xs.sz[t.first] * t.second.size();
    }
    cout << res << endl;
}


Measured memory_bytes: 22912
import itertools

N = int(input())
S = []

for _ in range(N):
    S.append(input()[0])
    
num = [S.count(char) for char in ['M', 'A', 'R', 'C', 'H']]

if num.count(0) >= 3:
    print(0)
else:
    nonzero = [n for n in num if n != 0]
    case = list(itertools.combinations(nonzero, 3))
    total = sum([tpl[0]*tpl[1]*tpl[2] for tpl in case])
    
    print(total)

Measured memory_bytes: 3892