akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
struct node{
  int32_t id;
  node* parent;
  int32_t depth;
  vector<node*> child;
  node():id(-1), parent(nullptr), depth(-1), child(0u){}
  void set_depth(const size_t n){
    depth=n;
    for(auto&& c:child) c->set_depth(n+1u);
  }
  auto type() const{
    return (parent==nullptr ? "root":(child.empty() ? "leaf":"internal node"));
  }
};
ostream& operator<<(ostream& os, const node& u){
  os<<"node "<<u.id
    <<": parent = "<<(u.parent==nullptr ? -1:u.parent->id)
    <<", depth = "<<u.depth
    <<", "<<u.type()
    <<", [";
  const char* dlm="";
  for(const auto& c:u.child){
    os<<dlm<<c->id;
    dlm=", ";
  }
  os<<"]\n";
  return os;
}
int32_t main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  size_t n; cin>>n;
  vector<node> tree(n);
  for(auto i=0u; i<n; ++i){
    size_t tmp;
    cin>>tmp; node* u=&tree[tmp]; u->id=tmp;
    cin>>tmp; u->child.resize(tmp);
    for(auto&& c:u->child){
      cin>>tmp; c=&tree[tmp];
    }
    for(auto&& c:u->child) c->parent=u;
  }
  find_if(begin(tree), end(tree), [](const node& x){ return x.parent==nullptr; })->set_depth(0u);
  for(const auto& u:tree) cout<<u;
}


Measured memory_bytes: 8296
N, Y = [int(i) for i in input().split()]

for x in range(N + 1):
  for y in range(N - x + 1):
    z = N - x - y
    if z >= 0 and (Y - x * 10000 - y * 5000 - z * 1000) == 0:
      print(' '.join([str(i) for i in [x, y, z]]))
      exit()

print('-1 -1 -1')

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <complex>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>
#include <iterator>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;

int main() {
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> s(h);
    for (int i = 0; i < h; ++i) cin >> s[i];

    int ans = 1e9;
    for (int t = 0; t < (1 << (h - 1)); ++t) {
        int grp[11] = {};
        int g = 0;
        for (int i = 0; i < h; ++i) {
            grp[i] = g;
            if (t & (1 << i)) ++g;
        }
        int cnt[11] = {};
        int scr = g;
        bool suc = true;
        for (int j = 0; j < w; ++j) {
            int prev[11];
            copy(begin(cnt), end(cnt), begin(prev));
            bool over = false;
            for (int i = 0; i < h; ++i) {
                if (s[i][j] == '1') {
                    cnt[grp[i]]++;
                    if (cnt[grp[i]] > k) over = true;
                }
            }
            if (over) {
                ++scr;
                for (int i = 0; i < h; ++i) {
                    cnt[i] -= prev[i];
                    if (cnt[i] > k) suc = false;
                }
            }
        }
        if (suc) {
            ans = min(ans, scr);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
import collections

n,k = input().split()
n = int(n)
k = int(k)
h =[]
for i in range(n):
    h.append(int(input()))

h.sort(reverse=True)
# c = collections.Counter(h)
# flg = False
# for i in c:
#     if c[i] >= k:
#         print(0)
#         flg = True
#         break

diff=[]
for i in range(0,n-k+1):
    diff.append(abs(h[i] - h[i+k-1]))
print(min(diff))

Measured memory_bytes: 11520
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

int d[200010];

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> p(n);
    rep(i, 0, n) cin >> p[i];
    rep(i, 0, n) d[i]= INF;
    queue<int> q;
    q.push(0);
    d[0] = 0;
    while(!q.empty()){
        int now = q.front(); q.pop();
        rep(i, 1, 7){
            int nxt = now + i;
            if(nxt >= n - 1) nxt = n - 1;
            while(1){
                if(d[nxt] <= d[now] + 1) break;
                d[nxt] = d[now] + 1;
                // cout << nxt << ' ' << d[nxt] << endl;
                if(p[nxt] == 0){
                    q.push(nxt);
                    break;
                }
                nxt = nxt + p[nxt];
                if(nxt >= n - 1) nxt = n - 1;
            }
        }
    }
    cout << d[n - 1] << endl;
}


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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  int sum = 0;
  for (auto&& e : a) {
    cin >> e;
    sum += e;
  }
  sort(a.begin(), a.end(), greater<int>());
  bool ok = a[m - 1] >= (sum + 4 * m - 1) / (4 * m);
  cerr << a[m - 1] << ' ' << 1 / (4 * m) * sum << endl;
  cout << (ok ? "Yes" : "No") << '\n';
  return 0;
}


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

const int mod = 924844033;
int n, k;
int dp[6005][6005][2];
int ways[6005][6005];
int fac[6005];

void add(int &a, int b) {a += b % mod; if (a >= mod) a -= mod;}
int mul(int a, int b) {return 1LL * a * b % mod;}

int main() {
	scanf("%d %d", &n, &k);
	ways[0][0] = 1;
	fac[0] = 1;
	for (int i = 1; i <= n; ++ i) fac[i] = 1LL * fac[i - 1] * i % mod;
	int nw = 0;
	for (int i = 0; i < min(2 * k, n); ++ i) {
		for (int j = i; j - 2 * k < n; j += 2 * k) {
			for (int l = 0; l <= n / (2 * k) + 1; ++ l) {
				dp[j][l][0] = dp[j][l][1] = 0;
			}
		}
		dp[i][0][0] = 1;
		int lst = i;
		for (int j = i; j < n; j += 2 * k, lst = j) {
			for (int l = 0; l <= n / (2 * k) + 1; ++ l) if (dp[j][l][0] || dp[j][l][1]) {
				add(dp[j + 2 * k][l][0], dp[j][l][0] + dp[j][l][1]);
				if (j - k >= 0) add(dp[j + 2 * k][l + 1][0], dp[j][l][0]);
				if (j + k < n) add(dp[j + 2 * k][l + 1][1], dp[j][l][0] + dp[j][l][1]);
			}
		}
		nw += n / (2 * k) + 1;
		for (int j = 0; j <= nw; ++ j) {
			for (int l = 0; l <= n / (2 * k) + 1 && l <= j; ++ l) {
				add(ways[i + 1][j], mul(ways[i][j - l], dp[lst][l][0] + dp[lst][l][1]));
			}
		}
	}
	int ans = 0;
	for (int i = 0; i <= n; ++ i) {
		int cur = mul(ways[min(2 * k, n)][i], fac[n - i]);
		if (i & 1) (ans += mod - cur) %= mod;
		else (ans += cur) %= mod;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 236160
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

struct EdgeM
{
	int to;
	ll cost;
};


ll calcMinSpanningTree(vector<vector<EdgeM>>& G)
{
	auto V = (int)G.size();
	vector<ll> cost(V, LLONG_MAX);
	vector<bool> used(V);
	cost[0] = 0;
	auto res = 0ll;

	priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> q;
	q.push({ 0, 0 });
	while (!q.empty())
	{
		auto p = q.top();
		q.pop();

		auto u = p.second;
		if (used[u])
		{
			continue;
		}
		used[u] = true;
		res += p.first;

		for (auto& e : G[u])
		{
			if (cost[e.to] > e.cost && !used[e.to])
			{
				cost[e.to] = e.cost;
				q.push({ e.cost, e.to });
			}
		}
	}

	return res;
}


int main()
{
	int N;
	cin >> N;
	vector<pair<ll, int>> listX;
	vector<pair<ll, int>> listY;
	for (auto i = 0; i < N; ++i)
	{
		ll x, y;
		cin >> x >> y;
		listX.push_back({ x, i });
		listY.push_back({ y, i });
	}
	sort(listX.begin(), listX.end());
	sort(listY.begin(), listY.end());

	vector<vector<EdgeM>> G(N);
	for (auto i = 0; i < N - 1; ++i)
	{
		auto& p1 = listX[i];
		auto& p2 = listX[i + 1];
		auto diff = p2.first - p1.first;
		G[p2.second].push_back({ p1.second, diff });
		G[p1.second].push_back({ p2.second, diff });

		auto& p3 = listY[i];
		auto& p4 = listY[i + 1];
		diff = p4.first - p3.first;
		G[p3.second].push_back({ p4.second, diff });
		G[p4.second].push_back({ p3.second, diff });
	}

	auto ans = calcMinSpanningTree(G);

	cout << ans << endl;

	return 0;
}

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

int zeller(int y, int m, int d)
{
	if (m <= 2) {
		y--;
		m += 12;
	}
	
	int h;
	int C = y / 100;
	int Y = y % 100;
	int R = 5 * C + (C / 4);
	
	h = d + (26 * ++m / 10) + Y + (Y / 4) + R;
	h %= 7;
	return (h);
}

int main()
{
	int y = 2004;
	int m, d;
	int h;
	
	while (1){
		
		cin >> m >> d;
		if (m == 0){
			break;
		}
		
		h = zeller(y, m, d);
		
		//cout << h << endl;
		switch (h){
		  case 0:
		    cout << "Saturday";
			break;
			
		  case 1:
		    cout << "Sunday";
			break;
			
		  case 2:
		    cout << "Monday";
			break;
			
		  case 3:
		    cout << "Tuesday";
			break;
			
		  case 4:
		    cout << "Wednesday";
			break;
			
		  case 5:
		    cout << "Thursday";
			break;
			
		 case 6:
		   cout << "Friday";
		   break;
		}
		cout << endl;
	}
	
	return (0);
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
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[300010];

int main() {
    cin >> n;
    rep(i, 3*n) cin >> a[i];
    sort(a, a+3*n);

    ll sum = 0;
    rep(i, n) {
        sum += a[n+2*i];
    }
    cout << sum << endl;
}


Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>

#define ll long long int
#define mod 1000000007

using namespace std;


int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    if(a == 0)
    cout << 1;
    else if(b == 0)
    cout << 2;
    else if(c == 0)
    cout << 3;
    else if(d == 0)
    cout << 4;
    else
    cout << 5;
}









Measured memory_bytes: 3644
n=int(input())
hh=list(map(int,input().split()))
max_s = 0
s = 0
for i in range(n-1):
    if hh[i+1] <= hh[i]:
        s+=1
    else:
        if max_s < s:
            max_s = s
        s = 0
if max_s < s:
    max_s = s
print(max_s)

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

int main() {
  int P,Q,R;
  cin >> P >> Q >>R;
  if ( P >= Q && P >= R)
    cout << Q+R << endl;
  else if ( Q >= P && Q >= R )
    cout << P+R << endl;
  else
    cout << Q+P << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define sci(a) scanf("%d", &a)
#define scii(a, b) scanf("%d %d", &a, &b)
#define pri(a) printf("%d ", a)
#define pril(a) printf("%d\n", a)
#define fto(i, a, b) for(int i = a; i <= b; ++i)
#define fdto(i, a, b) for(int i = a; i >= b; --i)
#define pb(a) push_back(a)
#define ll long long
#define oo 1000000007
#define maxN
using namespace std;
string s;

bool isPalin() {
    int l = 0, r = s.size()-1;
    while( l <= r ) {
        if(s[l] != s[r]) return 0;
        ++l; --r;
    }
    return 1;
}

bool Con1() {
    int l = 0, r = (s.size()-1)/2-1;
    while(l <= r) {
        if(s[l] != s[r]) return 0;
        ++l; --r;
    }
    return 1;
}

bool Con2() {
    int l = (s.size()+3) / 2-1;
    int r = s.size()-1;
    while( l <= r ) {
        if(s[l] != s[r]) return 0;
        ++l; --r;
    }
    return 1;
}

int main() {
    //freopen("159B.inp", "r", stdin);
    //freopen("159B.out", "w", stdout);
    cin >> s;
    if(isPalin() && Con1() && Con2()) cout << "Yes";
    else cout << "No";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{    
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b) {
    cout << c << "\n";
  } else if (b == c) {
    cout << a << "\n";
  } else if (a == c) {
    cout << b << "\n";
  }
}

Measured memory_bytes: 256
n=int(input())
L=list(input().split())
t=1
Q=0
while t<n-1:
  if int(L[t-1])<int(L[t])<int(L[t+1]) or int(L[t+1])<int(L[t])<int(L[t-1]):
    Q+=1
  t+=1
print(Q)

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

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

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=3e5+10;
int32_t main()
{
    IOS;
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    if(a>=k)
    {
        cout<<min(a,k)<<endl;
        return 0;
    }
    if(a+b>=k)
    {
        cout<<a<<endl;
        return 0;
    }
    int z=k-(a+b);
    cout<<a-z<<endl;

    
}

Measured memory_bytes: 3652
#include <iostream>
#define rep(i,n) for(int i=0; i<n; i++)

using namespace std;

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

    int x = 0;
    rep(i, n) { x += a[i]-1; }
    cout << x << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

int n, m;
vector<int> G[100010];
bool f[100010];
int ord[100010], low[100010];
vector<P> bridge;

void dfs(int v, int p, int &k){
    ord[v] = k++;
    low[v] = ord[v];
    f[v] = true;
    rep(i, 0, G[v].size()){
        int u = G[v][i];
        if(f[u]){
            if(u != p) low[v] = min(low[v], ord[u]);
        }else{
            dfs(u, v, k);
            if(ord[v] < low[u]) bridge. push_back(P(min(v, u), max(v, u)));
            low[v] = min(low[v], low[u]);
        }
    }
}

signed main(){
    cin >> n >> m;
    rep(i, 0, m){
        int a, b;
        cin >> a >> b;
        G[a]. push_back(b);
        G[b]. push_back(a);
    }
    int k = 0;
    dfs(0, -1, k);
    sort(all(bridge));
    rep(i, 0, bridge.size()){
        cout << bridge[i].fi << " " << bridge[i].se << endl;
    }
}

Measured memory_bytes: 7748
S = input()

if S == "RRR":
    print(3)
elif S == "RRS":
    print(2)
elif S == "SRR":
    print(2)
elif S == "RSR":
    print(1)
elif S == "SRS":
    print(1)
elif S == "SSR":
    print(1)
elif S == "RSS":
    print(1)
else:
    print(0)

Measured memory_bytes: 9048
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;
typedef long long ll;
const int maxn = 100005;

int a[maxn],b[maxn];
int n;

int main() {
 // freopen("in.cpp","r",stdin);
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i]>>b[i];
  ll ret=0,sum=0;
  for(int i=n-1;i>=0;i--){
    ll tmp = a[i] + sum;
    if(tmp%b[i]==0)continue;
    int tt = tmp%b[i];
    tt = b[i] - tt;
    sum+=tt;
  }
  cout<<sum<<endl;
  return 0;
}


Measured memory_bytes: 1024
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define pf printf
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node

using namespace std;
///check n=1;
///check corner case;

int main()
{
    ll n;
    string str,ara;
    cin>>n;
    cin>>str>>ara;
    for(int i=0;i<n;i++)cout<<str[i]<<ara[i];
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
//保留所有权利。
#include<iostream>
#include<stdio.h>//printするよ
#include<vector>
#include<algorithm>//辞書順はnext_permutationだよ
#include<set>
#include<string>
#include<sstream>
#include<string.h>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<utility>//swapで数値交換するよ
//END OF LIBRARIES.
#define rt "\n"//改行を最速化させるよ
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define vcin(v) for (int i = 0; i < (v).size(); i++) { cin >> (v)[i]; }
#define sort(s) sort(s.begin(),s.end())
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define cncn int cnt=0
#define smsm int sum=0
#define str srting
#define v vector
#define please return
#define AC 0//おまじないだよ
#define Rapid cin.tie(0);ios::sync_with_stdio(false)
//END OF DEFINE.
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vcha;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
//printf("%02d:%02d:%02d\n", h, m, s);・・・2文字は埋める・h、m、ｓ
//END OF TYPEDEF.

//最大公約数（GCD）を求めるよ
//最小公倍数（LCM）は＜＜　A × B ÷ GCD　 ＞＞で求まるよ

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

//for A以上B未満でI探索 for (int I = A; i <= B; i++)
//string s = to_string(i);
int a = 0, b = 0, c = 0, x = 0, y = 0, z = 0, n = 0, sum = 0, i = 0;
string s = ""; asas; cncn;

int main(void) {
	cin >> s;
	rep(i, 19) {
		if (s[i] == ',')cout << " ";
		else cout << s[i];
	}
	cout << rt;
	please AC;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {

	var h, w int
	fmt.Scan(&h)
	fmt.Scan(&w)
	ary := make([][]string, h)
	for i := 0; i < h; i++ {
		if sc.Scan() {
			a := sc.Text()
			sa := strings.Split(a, "")
			ary[i] = sa
		}
	}
	ret := "Yes"
	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			left := j - 1
			right := j + 1
			up := i - 1
			down := i + 1
			target := ary[i][j]
			if target == "." {
				continue
			}
			if left >= 0 && ary[i][left] == "#" {
				continue
			}
			if right < w && ary[i][right] == "#" {
				continue
			}
			if up >= 0 && ary[up][j] == "#" {
				continue
			}
			if down < h && ary[down][j] == "#" {
				continue
			}
			ret = "No"
		}
	}
	fmt.Println(ret)
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
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 main(){
	string s;cin>>s;
	int cnt = 0;
	int ans = 0;
	for(int i = 0; i < 3; i++) {
		if (s[i] == 'R')cnt++;
		else {ans = max(ans,cnt);cnt = 0;}
	}
	ans = max(ans,cnt);
	cout << ans << endl;
	return 0;
}

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


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



Measured memory_bytes: 3632
s = gets.chomp.chars.map(&:to_i)
ret = s.size
(s.size - 1).times do |i|
  if s[i] != s[i+1]
    STDERR.puts [ret, i+1, s.size - i - 1].join(" ")
    ret = [ret, [i+1, s.size - i - 1].max].min
  end
end
puts ret


Measured memory_bytes: 11004
#include <stdio.h>
#include <math.h>
#include <string.h>

int main()
{
    int i,j,k,n,m;
    char a[5];
    scanf("%s",a);

    for(i=0;i<3;i++)
    {
        if(a[i]==a[i+1])
        {
            printf("Bad\n");
            return 0;
        }
    }
    printf("Good\n");

}


Measured memory_bytes: 128
#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
#include<cmath>
#include <limits>
using namespace std;
typedef pair<pair<int, int>, int> P;
typedef long long ll;
const int INF = 100000000;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

#define REP(i, a,b) for(i=a;i<b;i++) 
#define REP1(i,b,a) for(i=b-1;i>=a;i--)
#define output(x) cout<<x<<endl;
#define pb(x) push_back(x);
const int MOD = 1000000007;



int main() {
	ll i,j, k, l, m, n, sum, flag, cc, M, X,N,Y, Z, K, x, y, z,A;
	cin >> N>>M;
	vector<vector<ll>>Q(M);
	vector<ll>P(M);
	REP(i, 0, M) {
		cin >> k;
		REP(j, 0, k) {
			cin >> cc;
			Q[i].push_back(cc);
		}
	}
	REP(i, 0, M) {
		cin >> P[i];
	}
	ll bit;
	cc = 0;
	flag = 0;
	ll ans = 0;
	
	for (bit = 0; bit < 1 << N; bit++) {
		flag = 0;
		REP(i, 0, M) {
			cc = 0;
			REP(k, 0, Q[i].size()) {
				if (bit & (1 << (Q[i][k]-1))) {
					cc++;
				}
			}
			//cout << "bit" << bit << "cc" << cc << endl;
			if (cc % 2 != P[i]) {
				flag = 1;
				break;
			}
		}
		if (flag == 0) {
			ans++;
		}
		
	}
	output(ans);
	return 0;
}








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

int main() {
    int n;
    cin >> n;
    vector<int> L(n);
    REP(i, n) cin >> L[i];
    // int n = 2000;
    // vector<int> L(n);
    // random_device rnd;
    // REP(i,n)L[i] = rnd() % 100;


    sort(L.begin(),L.end());
    int ans = 0;
    for(int a = 0; a < n - 2; a++) {
        for(int b = a + 1; b < n - 1; b++) {
            int sum_ab = L[a] + L[b];
            int left = lower_bound(L.begin(),L.end(),sum_ab) - L.begin();
            int right = b + 1;
            ans += left - right; 
        }
    }
    cout << ans << endl;
}



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

int main(void) {
    int a, b, c;
    cin >> a >> b >> c;
	if (a > b) {
		int tmp = a;
		a = b;
		b = tmp;
	}
	if (b > c) {
		int tmp = b;
		b = c;
		c = tmp;
	}
	if (a > b) {
		int tmp = a;
		a = b;
		b = tmp;
	}

	cout << a << " " << b << " " << c << endl;

	return 0;
}


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

using namespace std;

#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define MP make_pair
#define EB emplace_back
#define endl "\n"
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long

typedef long long int64;
typedef vector<int> VI64;
typedef vector<pair<int,int>> VII64;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;

int n;

int dp[2005][2005];

int suri(int idx,int iav,VII64 &v)
{
  if(idx==n)
    return 0;
  
  if(dp[idx][iav]!=-1)
    return dp[idx][iav];
  int ans=(abs(iav-v[idx].S)*v[idx].F)+suri(idx+1,iav+1,v);
  int jav=n-1-(idx-iav);
  ans=max(ans,(abs(jav-v[idx].S)*v[idx].F)+suri(idx+1,iav,v));
  dp[idx][iav]=ans;
  return ans;
}

int32_t main()
{
  IOS;
  int T=1;
  //cin>>T;
  while(T--)
  {
    int i,j;
    cin>>n;
    VII64 v(n);
    for(i=0;i<n;i++)
    {
      cin>>v[i].F;
      v[i].S=i;
    }
    memset(dp,-1,sizeof dp);
    sort(ALL(v),greater<pair<int,int>>());
    cout<<suri(0,0,v)<<endl;
  }

  return 0;
}

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

using namespace std;

template <typename T> T &chmin(T &a, const T &b) {return a = min(a, b);}
template <typename T> T &chmax(T &a, const T &b) {return a = max(a, b);}

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

const int INF = 1e9;
const ld eps = 1e-9, pi = acos(-1.0);


void solve(long long A, long long B){
  REP(i, 10000){
    if(int(i*0.08)==A && int(i*0.1)==B) { cout << i << endl; return; }
  }
  cout << -1 << endl;
}

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


Measured memory_bytes: 256
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

ret = 0
for i in range(1, K+1):
    prev = '?'
    for j in range(len(T) // K + 1):
        if i + K*j - 1 >= len(T):
            continue
        now = T[i + K*j - 1]
        
        if prev == now:
            prev = '?'
        else:
            prev = now
            if now == 'r':  
                ret += P
            elif now == 's':
                ret += R
            else:
                ret += S
            
print(ret)

      

Measured memory_bytes: 3316
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
using lint = long long;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int A, B;
	cin >> A >> B;

	int ans = 0;
	for (int i = A; i <= B; i++) {

		if (i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10) ans++;
	}

	cout << ans << "\n";

	return 0;
}

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

int x, a, b;

int main() {
    cin >> x >> a >> b;

    int xa = abs(x - a);
    int xb = abs(x - b);
    if (xa > xb) {
        cout << "B" << endl;
    } else {
        cout << "A" << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(int argc, char const *argv[]){
    int r,g,b;
    cin >> r >> g >> b;
    int c = r*100+g*10+b;
    if((c%4)==0)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
typedef long long ll;
int n;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    cin>>n;
    ll res=0;
    for(int i=1;i<=n;i++)
        for(int j=i;j<=n;j+=i) res+=j;//相当于乘k
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<string>
#include<cstdio>
#include<queue>
#include<functional>
#include <tuple>
#include<iomanip>
#include<stack>
#include<cmath>
#define ll long long
using namespace std;
int main() {
	int n,flag=1;
	string s,sc; cin >> n>> s;
	if (n % 2 == 1) {
		cout << "No" << endl;
		return 0;
	}
	for (int i = 0; i < n / 2; ++i)
		if (s[i] != s[n / 2 + i]) flag = 0;
	if (flag) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

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

const int INF = 1000000007;

int main(){
	int n;
	cin>>n;
	int a[110]={0};
	for(int i=0;i<n;i++)cin>>a[i];

	int cnt;
	int color[9]={0};
	for(int i=0;i<n;i++){
		color[min(a[i]/400, 8)]++;
	}

	int kind=0;
	for(int i=0;i<8;i++){
		if(color[i] != 0) kind++;
	}

	cout<<max(1, kind)<<" "<<kind + color[8]<<endl;

	return 0;
}

Measured memory_bytes: 256
n = int(input())
s1=input()
s2=input()
mod = 10**9+7

if s1[0]==s2[0]: res = 3
else: res = 6

for i in range(1,n):
    if s1[i-1] != s1[i]:
        if s1[i-1] != s2[i-1]:
            if s1[i] != s2[i]: res *= 3
        else: res *= 2

print(res % mod)

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


int main(void)
{
    int a,b;
    int s,t,u;
    cin >> a >> b;
    s=a+b;
    t=a-b;
    u=a*b;
    if(s>t)
    {
        if(s>u)
        {
            cout << s;
        }
        else
        {
            cout << u;
        }
        
    }

    else
    {
        if(t>u)
        {
            cout << t;
        }
        else
        {
            cout << u;
        }
    }

    return 0;
}

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

#define INF 1000010000
#define nl '\n'
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pdd pair<double,double>
#define all(c) (c).begin(), (c).end()
#define SORT(c) sort(all(c))
#define sz(c) (c).size()
#define rep(i,n) for( int i = 0; i < n; ++i )
#define repi(i,n) for( int i = 1 ; i <= n; ++i )
#define repn(i,n) for( int i = n - 1 ; i >= 0 ; --i )
#define repf(j,i,n) for( int j = i ; j < n ; ++j )
#define die(s) {std::cout << s << nl;}
#define dier(s) {std::cout << s; return 0;}
#define dbg(var) {std::cout << #var << "  = " << var << nl;}
#define vi vector<int>
typedef long long ll;

using namespace std;


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.precision(0); 
	
	int a , b;
	cin >> a >> b;
	
	if(a < 6) dier(0);
	if(a < 13) dier(b / 2);
	dier(b);
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
int x,y;
int main() {
	//freopen("1.txt","r",stdin);
	read(x); read(y);
	printf("%d\n",6-x-y);
	return 0;
}
/*
  REMEMBER:
  1. Think TWICE, Code ONCE!
  Are there any counterexamples to your algo?
    
  2. Be careful about the BOUNDARIES!
  N=1? P=1? Something about 0?
    
  3. Do not make STUPID MISTAKES!
  Array size? Integer overflow? Time complexity? Memory usage? Precision error?
*/

Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<set>
const int N=1<<18;
typedef std::pair<int,int> P;
P dp[N][2];int n,ans[N];
int main() {
    scanf("%d",&n);
    std::set<P,std::greater<P> > g;
    for(int i=0;i<1<<n;i++) scanf("%d",&dp[i][0].first),dp[i][0].second=i,dp[i][1]=P(0,-1);
    for(int j=0;j<n;j++) {
        for(int i=0;i<1<<n;i++) if(i>>j&1) {
            int t=i^(1<<j);
            g.clear();g.insert(dp[i][0]);g.insert(dp[i][1]);
            g.insert(dp[t][0]);g.insert(dp[t][1]);
            auto it=g.begin();
            dp[i][0]=*it;++it;
            dp[i][1]=*it;
        }
    }
    for(int i=1;i<1<<n;i++) {
        ans[i]=dp[i][0].first+dp[i][1].first;
        ans[i]=std::max(ans[i],ans[i-1]);
        printf("%d\n",ans[i]);
    }
    return 0;
}


Measured memory_bytes: 8192
#include<bits/stdc++.h>
using namespace std;
int main(){
	string sa="Atcoder ";
	string sb=" Contest";
	string sc;
	cin>>sa;
	cin>>sc;
	cin>>sb;
	char t;
	t=sc[0];
	cout<<"A"<<t<<"C"<<endl;
	
	return 0;
} 

Measured memory_bytes: 256
N,A,B,C = map(int,input().split())
l = [int(input()) for i in range(N)]
INF = 100000000
def rec(i,a,b,c):
    if(i==N):
        return(abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else INF)
    ret0 = rec(i+1,a,b,c)
    ret1 = rec(i+1,a+l[i],b,c)+10
    ret2 = rec(i+1,a,b+l[i],c)+10
    ret3 = rec(i+1,a,b,c+l[i])+10
    return min(ret0,ret1,ret2,ret3)
print(rec(0,0,0,0))

Measured memory_bytes: 3064
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.NoSuchElementException;
import java.io.InputStream;

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

	static class Task4 {
		public void solve(int testNumber, Scanner sc, PrintWriter out) {

			while (true) {
				int x = sc.nextInt();
				int h = sc.nextInt();
				if (x == 0 && h == 0) break;

				double hh = Math.sqrt(Math.pow(x / 2.0, 2) + Math.pow(h, 2));
				out.println(x * hh / 2.0 * 4 + x * x);
			}

		}

	}

	static class Scanner {
		private final InputStream in;
		private final byte[] buffer;
		private int ptr;
		private int buflen;

		public Scanner(InputStream in) {
			this.in = in;
			this.buffer = new byte[1024];
			this.ptr = 0;
			this.buflen = 0;
		}

		private boolean hasNextByte() {
			if (ptr < buflen) return true;
			else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) return false;
			}
			return true;
		}

		private byte readByte() {
			if (hasNextByte()) return buffer[ptr++];
			return -1;
		}

		private boolean isPrintableChar(byte c) {
			return '!' <= c && c <= '~';
		}

		private void skipUnprintable() {
			while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
				ptr++;
			}
		}

		public boolean hasNext() {
			skipUnprintable();
			return hasNextByte();
		}

		public int nextInt() {
			if (!hasNext()) throw new NoSuchElementException();
			int n = 0;
			boolean minus = false;
			byte b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) throw new NumberFormatException();
			while (true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if (b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}

	}
}




Measured memory_bytes: 24252
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::collections::HashSet;
use std::cmp::min;

fn main() {
    input! {
        n: usize,
        xy: [(i64, i64); n],
    }

    let mut cand = HashSet::new();
    for i in 0..n {
        for j in 0..n {
            if i == j {
                continue;
            }
            cand.insert((xy[i].0 - xy[j].0, xy[i].1 - xy[j].1));
        }
    }

    let xys = xy.iter().collect::<HashSet<_>>();

    let mut ans = n;

    for &(dx, dy) in cand.iter() {
        let mut cur = n;
        for i in 0..n {
            let nx = xy[i].0 + dx;
            let ny = xy[i].1 + dy;

            if xys.contains(&(nx, ny)) {
                cur -= 1;
            }
        }

        // println!("{} {} {}", dx, dy, cur);

        ans = min(ans, cur);
    }

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


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <stdio.h>
#define ff(i,x,y)for(int i=x;i<y+1;i++)
#define fs(i,x,y)for(int i=x;i>y-1;i--)
#define all(x) x.begin(),x.end()
#define Ins(x) inserter(x,x.begin())
//set<int>::iterator set_stater
//typedef pair<int,int> pii;
using namespace std;
typedef long long ll;
int a[4];
int main()
{
    scanf("%d%d%d",&a[0],&a[1],&a[2]);
    sort(a,a+3);
    int ans=0;
    ans+=(a[2]-a[1]);
    a[1]=a[2];
    a[0]+=ans;
    if((a[2]-a[0])%2==0)
        ans+=(a[2]-a[0])/2;
    else
        ans+=((a[2]-a[0])/2+2);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
	int N;
	cin >> N;
	vector<int> A( N );
	for( int i = 0; i < N; i++ ) {
		cin >> A[i];
	}

	int odd = 0;
	for( int i = 0; i < N; i++ ) {
		if( A[i] % 2 ) odd++;
	}
	string ans = "YES";
	if( odd % 2 ) ans = "NO";

	cout << ans << endl;
}


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

using namespace std;

int main(int argc, char* argv[]) {
  int N;
  cin >> N;

  vector<long long> A(N);
  for (int i = 0; i < N; ++i)
    cin >> A[i];
  vector<long long> B(N);
  for (int i = 0; i < N; ++i)
    cin >> B[i];
  vector<long long> C(N);
  for (int i = 0; i < N; ++i)
    cin >> C[i];

  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  sort(C.begin(), C.end());

  long long n_c[N];
  for (int i = 0; i < N; ++i) {
    vector<long long>::iterator iter = upper_bound(C.begin(), C.end(), B[i]);
    n_c[i] = distance(iter, C.end());
  }
  for (int i = N - 2; i >= 0; --i) {
    n_c[i] += n_c[i + 1];
  }

  long long ret = 0;
  for (int i = 0; i < N; ++i) {
    vector<long long>::iterator iter = upper_bound(B.begin(), B.end(), A[i]);
    int index = N - distance(iter, B.end());
    if (index != N)
      ret += n_c[index];
  }

  cout << ret << endl;

  return 0;
}

Measured memory_bytes: 3328
#include <stdio.h>
static int p[13];
int main(void) {
    while ((*p = getchar()) - '\n')
        if (*p - 'B')
            *(p + 2 + (*(p + 1))++) = *p;
        else
            if (*(p + 1))
                --*(p + 1);
    *(p + 1) = *(p + 2 + *(p + 1)) = 0;
    while (*p = *(p + 2 + (*(p + 1))++))
        putchar(*p);
    putchar('\n');
    return 0;
}


Measured memory_bytes: 128
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#solve
def solve():
    a= LI()
    print("Yes" if len(set(a)) == 2 else "No")
    return


#main
if __name__ == '__main__':
    solve()


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

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()

using namespace std;
typedef long long ll;
const ll INF = 1e15;

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

  FOR(h, 1, 3501) FOR(n, 1, 3501) {
    ll p = 4 * h * n - N * n - N * h;
    ll q = N * h * n;

    if (p > 0 && q % p == 0) {
      ll w = q / p;
      cout << h << " " << n << " " << w << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 384
import sys,math,collections
from collections import defaultdict

#from itertools import permutations,combinations
	
def file():
	sys.stdin = open('input.py', 'r')
	sys.stdout = open('output.py', 'w') 
def get_array():
	l=list(map(int, input().split()))
	return l
def get_2_ints():	
	a,b=map(int, input().split())
	return a,b
def get_3_ints():	
	a,b,c=map(int, input().split())
	return a,b,c	
def sod(n):
	n,c=str(n),0
	for i in n:	
		c+=int(i)
	return c	
def isPrime(n):
    if (n <= 1):
        return False
    if (n <= 3):
        return True
    if (n % 2 == 0 or n % 3 == 0):
        return False
    i = 5
    while(i * i <= n):
        if (n % i == 0 or n % (i + 2) == 0):
            return False
        i = i + 6
  
    return True
def getFloor(A, x):

	(left, right) = (0, len(A) - 1)

	floor = -1
	while left <= right:
		mid = (left + right) // 2
		if A[mid] == x:
			return A[mid]
		elif x < A[mid]:
			right = mid - 1
		else:
			floor = A[mid]
			left = mid + 1
			
	return floor
def floorSqrt(x) : 
  
    # Base cases 
    if (x == 0 or x == 1) : 
        return x 
   
    # Do Binary Search for floor(sqrt(x)) 
    start = 1
    end = x    
    while (start <= end) : 
        mid = (start + end) // 2
          
        # If x is a perfect square 
        if (mid*mid == x) : 
            return mid 
              
        # Since we need floor, we update  
        # answer when mid*mid is smaller 
        # than x, and move closer to sqrt(x) 
        if (mid * mid < x) : 
            start = mid + 1
            ans = mid 
              
        else : 
              
            # If mid*mid is greater than x 
            end = mid-1
              
    return ans	
#file()
def main():
	#for tt in range(int(input())):
	n,k=get_2_ints()
	c=0
	for i in range(n):
		p,q=get_2_ints()
		
		d=math.sqrt((p*p)+(q*q))
		if(d<=k):
			c+=1
	print(c)		



	

	
	

		











		
		

		























































				

			







            
			
































		








if __name__ == '__main__':
    main()

Measured memory_bytes: 9508
#include <stdio.h>

int main(void){
    int k[] = {1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51};
    int j;
    scanf("%d",&j);
    printf("%d",k[j-1]);

    return 0;
}

Measured memory_bytes: 128
N, M, X, Y = map(int, input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))

lower_bound = max(X, max(x))
upper_bound = min(Y, min(y))

if upper_bound - lower_bound > 0:
  print('No War')
else:
  print('War')

Measured memory_bytes: 3060
#include <cstdio>
#include <queue>
#include <map>
#include <algorithm>
#define Z(n)get<n>(z)
#define M make_pair
#define F first
#define S second
using namespace std;
typedef pair<int,int> pii;
typedef tuple<pii,pii,int> T;
int t[51][51],dx[]={-1,0,1,0},dy[]={0,-1,0,1},a,b,x,y,X,Y,i,j;
int main(){
	for(;scanf("%d%d",&a,&b),a;){
		map<pair<pii,pii>,int>m;
		scanf("%d%d%d%d",&x,&y,&X,&Y);x--,y--,X--,Y--;
		for(j=0;j<b;j++)for(i=0;i<a;i++)scanf("%d",t[i]+j);
		queue<T>q;
		m[M(M(x,y),M(X,Y))]=1;
		for(q.push(make_tuple(M(x,y),M(X,Y),0));!q.empty();){
			T z=q.front();q.pop();
			if(Z(0)==Z(1)){printf("%d\n",get<2>(z));goto OK;}
			if(Z(2)<100)for(i=0;i<4;i++){
				pii c1=make_pair(Z(0).F+dx[i],Z(0).S+dy[i]);
				if(!(0<=c1.F&&c1.F<a&&0<=c1.S&&c1.S<b&&!t[c1.F][c1.S]))c1=Z(0);
				pii c2=make_pair(Z(1).F+dx[(i+2)%4],Z(1).S+dy[(i+2)%4]);
				if(!(0<=c2.F&&c2.F<a&&0<=c2.S&&c2.S<b&&!t[c2.F][c2.S]))c2=Z(1);
				if((c1!=Z(0)||c2!=Z(1))&&!m[M(c1,c2)]){
					q.push(make_tuple(c1,c2,Z(2)+1));
					m[M(c1,c2)]=1;
				}
			}
		}
		puts("NA");
		OK:;
	}
}

Measured memory_bytes: 12104
let words str =
  let len = String.length str in
  let rec aux start stop =
    if stop >= len || str.[stop] = ' '
    then String.sub str start (stop-start), stop+1
    else aux start (stop+1)
  in
  let rec iter i l =
    if len-i <= 0 then l
    else
      match str.[i] with
        ' ' -> iter (i+1) l
      | _ ->
        let s,j = aux i (i+1) in
        iter j (s::l)
  in iter 0 []

let () =
  let w = read_line () in
  let rec loop count =
    match read_line () with
      "END_OF_TEXT" -> Printf.printf "%d\n" count
    | s -> loop (words s
                 |> List.fold_left
                   (fun acc x ->
                      acc +
                      (if String.lowercase x = String.lowercase w then 1 else 0))
                   0
                 |> (+) count)
  in loop 0

Measured memory_bytes: 2260
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;

#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])

#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl

#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl

#define ALL(obj) (obj).begin(),(obj).end()

#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
cin>>head;
CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision; // cpp_int

#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define L list<int>

#define pb(a) push_back(a)
#define mp make_pair

int main(){
  CIN(n);V a(n);VECCIN(a);
  V vec(n,0);
  bool flag=true;
  REP(i,n){
    if(a[i]%2==n%2){flag=false;break;}
    vec[a[i]]++;
  }
  if(vec[0]!=n%2)flag=false;
  else 
  FOR(i,1,vec.size()){
    if(n%2==0)if(vec[i]!=(i%2==1?2:0)){flag=false;break;}
    if(n%2==1)if(vec[i]!=(i%2==0?2:0)){flag=false;break;}
  }

  if(!flag)COUT(0);
  cpp_int poww=1;
  REP(i,n/2)poww*=2;
  if(flag) COUT(poww%(cpp_int)MOD);

  return 0;
}


Measured memory_bytes: 1024