akhauriyash/Code-Regression huggingface dataset:
/*
diverta 2019 Programming Contest A
*/
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>

int main()
{
    int R, G, B, n, ans = 0;
    std::cin >> R >> G >> B >> n;
    int r, g, b;
    for (r = 0; r <= n; r += R)
    {
        for (g = 0; r + g <= n; g += G)
        {
            if ((n - r - g) % B == 0)
                ans++;
        }
    }

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

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ft first
#define sd second
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

struct modint{
    ll a;
    const ll MOD=1e9+7;
    modint(ll a_=0){
        a=((a_%MOD)+MOD)%MOD;
    }
    modint inv()const{
        ll n=1,m=MOD-2,A=a;
        while(m){
            if(m&1)(n*=A)%=MOD;
            (A*=A)%=MOD;
            m>>=1;
        }
        modint y(n);
        return y;
    }
    bool operator==(const modint& x){
        return a==x.a;
    }
    bool operator!=(const modint& x){
        return a!=x.a;
    }
    modint& operator=(const modint& x){
        a=x.a;
        return *this;
    }
    modint operator+(const modint& x){
        modint y(a+x.a);
        return y;
    }
    modint operator-(const modint& x){
        modint y(a-x.a);
        return y;
    }
    modint operator*(const modint& x){
        modint y(a*x.a);
        return y;
    }
    modint operator/(const modint& x){
        return *this * x.inv();
    }
    modint& operator+=(const modint& x){
        *this=*this+x;
        return *this;
    }
    modint& operator-=(const modint& x){
        *this=*this-x;
        return *this;
    }
    modint& operator*=(const modint& x){
        *this=*this*x;
        return *this;
    }
    modint& operator/=(const modint& x){
        *this=*this/x;
        return *this;
    }
};
istream& operator>>(istream &in,modint& x){
    ll a_;
    in>>a_;
    modint y(a_);
    x=y;
    return in;
}
ostream& operator<<(ostream &out,const modint& x){
    out<<x.a;
    return out;
}
modint pwr(ll a,ll b){
    modint n(1),A(a);
    while(b){
        if(b&1) n*=A;
        A*=A;
        b>>=1;
    }
    return n;
}

vector<modint> fc;
modint fct(ll x) {
    if(fc.empty()) fc.resize(2010);
    if(x==0) return 1;
    if(fc[x]==0) fc[x]=fct(x - 1)*x;
    return fc[x];
}

vector<modint> ifc;
modint ifct(ll x) {
    if(ifc.empty()) ifc.resize(2010);
    if(x==2010-1) return ifc[x]=fct(x).inv();
    if(ifc[x] == 0) ifc[x]=ifct(x+1)*(x+1);
    return ifc[x];
}

modint comb(ll n, ll r) {
    if (n < 0 || r < 0 || n < r) return 0;
    return fct(n)*ifct(r)*ifct(n-r);
}

class DBlueAndRedBalls {
public:
    void solve(istream& in, ostream& out) {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        int k,n;
        in>>n>>k;
        Fr(i,k) out<<comb(k-1,i-1)*comb(n-k+1,i)<<endl;
    }
};

int main() {
    DBlueAndRedBalls solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
void dfs(int x, vector<int> &G, vector<vector<pair<int, int>>> &path) {
  for(int i = 0; i < path.at(x).size(); i++) {
    int y = path.at(x).at(i).first, d = path.at(x).at(i).second;
    if(G.at(y) == -1) {
      G.at(y) = G.at(x) + d;
      dfs(y, G, path);
    }
  }
}

int main() {
  int N; cin >> N;
  vector<int> G(N, -1);
  vector<vector<pair<int, int>>> path(N, vector<pair<int, int>> (0));
  for(int i = 0; i < N - 1; i++) {
    int u, v, w; cin >> u >> v >> w;
    u--; v--; w %= 2; path.at(u).push_back(make_pair(v, w)), path.at(v).push_back(make_pair(u, w));
  }
  G.at(0) = 0;
  dfs(0, G, path);
  for(int i = 0; i < N; i++) {
    cout << G.at(i) % 2 << endl;
  }
}

Measured memory_bytes: 9728
n=int(input())
a=list(map(int,input().split()))
i=0
ans=0
if n<=2:
    print(1)
    exit()
while i<n-1:
    if a[i]<a[i+1]:
        i+=1
        while i<n-1:
            if a[i]<=a[i+1]:
                i+=1
            else:
                if i==n-2:
                    ans+=1
                break
        #print(i)
        i+=1
        #print(a[:i])
        ans+=1
    elif a[i]>a[i+1]:
        i+=1
        while i<n-1:
            if a[i]>=a[i+1]:
                i+=1
            else:
                if i==n-2:
                    ans+=1
                break
        #print(i)
        i+=1
        #print(a[:i])
        ans+=1
    else:
        i+=1
        #print(a[:i])
        if i==n-1:
            ans+=1
print(ans)

Measured memory_bytes: 14100
#include <iostream>

using namespace std;

int main()
{
  for (int ii=0; ii<3; ++ii) {
    for (int jj=0; jj<3; ++jj) {
      char c;
      cin >> c;
      if (ii==jj)
	cout << c;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define F first
#define S second
#define db double
#define pb push_back
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define all(a) a.begin(),a.end()
using namespace std;
 
 ll mod=1e9 +7;
 
ll expo(ll base,ll exponent,ll mod){
    ll ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%mod;
        base=(1LL*base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}
 
vector<bool>  prime(90000002,true);
void Sieve() 
{ 
   
    for (int p=2; p*p<=90000001; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=90000001; i += p) 
                prime[i] = false; 
        } 
    } 
}

const ll M=200006;
ll f[M],inv[M];

void compute(){
    f[0]=1;
    rep(i,1,M-1){
        f[i]=(1LL*i*f[i-1])%mod;
    }
    inv[M-1]=expo(f[M-1],mod-2,mod);
    for(ll i=M-2;i>=0;i--){
        inv[i]=(1LL*(i+1)*inv[i+1])%mod;
    }
}
ll C(ll n,ll r){
    return (1LL*((1LL*f[n]*inv[r])%mod)*inv[n-r])%mod;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // compute();
    // Sieve();
    ll tests=1;
    // cin>>tests;
    while(tests--)
    {
      ll n;
      cin>>n;
      n%=10LL;
      if(n==3) cout<<"bon";
      else if(n==0 || n==1 || n==6 || n==8) cout<<"pon";
      else cout<<"hon";
    }
    return 0;
   }

Measured memory_bytes: 14116
#include <stdio.h>

void swap(int *x, int *y){ int t = *x; *x = *y; *y = t;}

int main(){
  int n, a[101], min, i, j, c = 0;
  scanf("%d", &n);
  for(i = 0; i < n; ++i) scanf("%d", a + i);

  for(i = 0; i < n; ++i){
    min = i;
    for(j = i + 1; j < n; ++j)
      if(a[j] < a[min]) min = j;
    if(min != i){
      swap(&a[i], &a[min]);
      c++;
    }
  }

  for(i = 0; i < n; ++i) printf(i != 0 ? " %d" : "%d", a[i]);
  printf("\n%d\n", c);
  return 0;
}

Measured memory_bytes: 600
//2020-04-09 13:38:26
//#pragma GCC optimize("-Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
//#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
//#pragma GCC target("avx2")  //Enable AVX
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//order_of_key(x) : number of items less than x
//find_by_order(x) : iterator to x

#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(ll i=a;i<b;i++)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define fastio              ios_base::sync_with_stdio(false);cin.tie(NULL)
#define F                   first
#define S                   second
#define all(v)              (v).begin(),(v).end()

const ld pi=3.14159265359;
ll INF=1e18+10;
ll MOD=998244353;
ll mod=1e9+7;

inline ll add(ll a,ll b,ll m){
    if((a+b)>=m)return (a+b)%m;
    return a+b;
}

inline ll mul(ll a,ll b,ll m){
    if((a*b)<m)return a*b;
    return (a*b)%m;
}

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    fastio;
    ll ans=0;
    ll n;cin>>n;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            ll nc=n;
            if(i!=1){
                while(nc%i==0)nc/=i;
                if((nc-1)%i==0)ans++;
            }
            i=n/i;
            if(i==1 || i==n/i){
                i=n/i;
                continue;
            }
            nc=n;
            while(nc%i==0)nc/=i;
            if((nc-1)%i==0)ans++;
            i=n/i;
        }
    }
    ll n1=n-1;
    for(ll i=1;i*i<=n1;i++){
        if(n1%i==0){
            if(i!=1)ans++;
            if(i!=n1/i)ans++;
        }
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int main() {
  int n;
  cin >> n;
  vector<int> x(n), sx(n);
  rep(i, n) {
    cin >> x[i];
    sx[i] = x[i];
  }
  sort(all(sx));
  int lx = sx[n / 2 - 1];
  int rx = sx[n / 2];
  if(lx == rx) {
    rep(i, n) cout << lx << endl;
    return 0;
  }
  rep(i, n) {
    if(x[i] < rx)
      cout << rx << endl;
    else
      cout << lx << endl;
  }
  return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
using namespace std;

signed main(){
    int n;
    cin>>n;
    int x,y;
    vp r(n),b(n);
    rep(i,n){
        cin>>x>>y;
        r[i]=mp(y,x);
    }
    rep(i,n){
        cin>>x>>y;
        b[i]=mp(x,y);
    }
    sort(all(r),greater<pi>());
    sort(all(b));
    bool used[n]={};
    int ans=0;
    rep(i,n){
        int m=-1;
        rep(j,n){
            if(used[j])continue;
            if(b[i].first>r[j].second&&b[i].second>r[j].first){
                ans++;
                used[j]=true;
                break;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
s = input()

tmp = s[1:].count("E")
ans = min(10**6,tmp)
for i in range(n-1):
  if s[i] == "W":
    tmp += 1
  if s[i+1] == "E":
    tmp -= 1
  ans = min(ans,tmp)
print(ans)

Measured memory_bytes: 3672
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define double long double
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < A[i].size(); j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}
template < typename T, typename U >
ostream &operator<<(ostream &os, const pair< T, U > &p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}

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

struct edge {
	int from, to, d, c, i;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

template < typename A, size_t N, typename T >
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	cin >> N;
	vector< pii > X(N);
	rep(i, N) {
		int x, y;
		cin >> x >> y;
		X[i] = make_pair(x, y);
	}
	int ans = 0;
	vector< pii > A(4, X[0]);
	rep(i, N) {
		int x, y;
		tie(x, y) = X[i];
		if (x - y > A[0].first - A[0].second) {
			A[0] = X[i];
		}
		if (x - y < A[1].first - A[1].second) {
			A[1] = X[i];
		}
		if (x + y > A[2].first + A[2].second) {
			A[2] = X[i];
		}
		if (x + y < A[3].first + A[3].second) {
			A[3] = X[i];
		}
	}
	chmax(ans, abs(A[0].first - A[1].first) + abs(A[0].second - A[1].second));
	chmax(ans, abs(A[2].first - A[3].first) + abs(A[2].second - A[3].second));
	cout << ans << endl;
	//cerr << A;
	return 0;
}

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

#define INFTY (1 << 30);


int main(void) {
  int N;
  long long a[3000];
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }

  sort(a, a+N);
  long long f_m = 0;
  for (int i = 0; i < N; i++) {
    f_m += (a[i]-1);
  }  
  cout << f_m << endl;
  return 0;
}


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

table = [0] * 102
for a in data:
    table[a] = 1

left = None
idx = x
while idx >= 0:
    if table[idx] == 0:
       left = idx
       break
    idx -= 1
idx = x
right = None
while idx < 102:
    if table[idx] == 0:
        right = idx
        break
    idx += 1

lscore = abs(x-left)
rscore = abs(x-right)

if lscore <= rscore:
    print(left)
else:
    print(right)

Measured memory_bytes: 9188
(let ((n (read))
      (res 11))
  (loop for i = 1 then (1+ i) while (<= (* i i) n) do
        (if (zerop (mod n i))
            (setf res (min res
                           (length (write-to-string (truncate n i)))))))
  (format t "~A~%" res))

Measured memory_bytes: 15844
using System;

namespace AtCoder112
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            if (n == 1)
            {
                Console.WriteLine("Hello World");
            }
            else
            {
                var a = int.Parse(Console.ReadLine());
                var b = int.Parse(Console.ReadLine());
                Console.Write(a + b);
            }
        }
    }
}


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

struct Point {
  int i = 0;
  map<int, int> visited;
};

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m), b(m);
  vector<vector<int>> ab(n, vector<int>(m));
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    ab[a].push_back(b);
    ab[b].push_back(a);
  }

  queue<Point> q;
  q.push({});

  int cnt = 0;
  while (!q.empty()) {
    Point p = q.front();
    q.pop();
    if (p.visited[p.i] > 0) continue;
    p.visited[p.i]++;
    if (p.visited.size() == n) {
      cnt++;
      continue;
    }
    for (int i = 0; i < ab[p.i].size(); i++) {
      q.push({i : ab[p.i][i], visited : p.visited});
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 68244
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <tuple>
#include <cassert>
#include <exception>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
#define fprint(NUM,X) cout << fixed << setprecision(NUM) << (X) << endl
#define fprints(NUM,X,Y) cout << fixed << setprecision(NUM) << (X) << " " << (Y) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[200010],dp[550][550];
double w[1000],v[1000];
double box[200010];


int N,Pos;
vector<int> pre,in,post;

void rec(int l,int r){
  if(l >= r)return;
  int root = pre[Pos++];
  int m = distance(in.begin(),find(in.begin(),in.end(),root));
  rec(l,m);
  rec(m + 1,r);
  post.push_back(root);
}

void solve(){
  Pos = 0;
  rec(0,pre.size());
  for(int i = 0;i < N;i++){
    if(i)cout << " ";
    cout << post[i];
  }
  cout << endl;
}

int main(){
  int k;
  cin >> N;
  for(int i = 0;i < N;i++){
    cin >> k;
    pre.push_back(k);
  }
  for(int i = 0;i < N;i++){
    cin >> k;
    in.push_back(k);
  }
  solve();
  return 0;
}


Measured memory_bytes: 3228
n,k=map(int,input().split())
mod=pow(10,9)+7

fact,inv,factinv=[0]*(n+1),[0]*(n+1),[0]*(n+1)
fact[0],fact[1],inv[1]=1,1,1
factinv[0],factinv[1]=1,1

for i in range(2,n+1):
  fact[i]=(fact[i-1]*i)%mod
  inv[i]=mod-(inv[mod%i]*(mod//i))%mod               
  factinv[i]=(factinv[i-1]*inv[i])%mod      
    
def comb(n,r,mod):
  if r<0 or n<r:
    return 0
  r=r if r<=n-r else n-r
  return fact[n]*factinv[r]*factinv[n-r]%mod
  
for i in range(1,k+1):
  ans=comb(n-k+1,i,mod)*comb(k-1,i-1,mod)%mod
  print(ans)

Measured memory_bytes: 3572
N = int(input())
B = list(map(int, input().split()))
A = [0 for _ in range(N)]

for i in range(N):
  if i == 0:
    A[i] = B[0]
  elif i == N-1:
    A[i] = B[N-2]
  else:
    A[i] = min(B[i-1], B[i])
print(sum(A))

Measured memory_bytes: 3064
;; B - Count Balls

(defun solve (n a b)
  "a個の青い玉，b個の赤い玉を交互に並べたときの，
   先頭からn個の玉の中の青い玉の個数"
  (multiple-value-bind (q r) (floor n (+ a b)) ; a+bの反復数と余り
    (+ (* q a) (min r a))))

(let ((n (read))
      (a (read))
      (b (read)))
  (princ (solve n a b)))


Measured memory_bytes: 4832
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    a,b,c=MI()
    print("YNeos"[not(a<=c<=b)::2])
if __name__ == '__main__':
    main()

Measured memory_bytes: 3572
s = [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]
k = int(input())
print(s[k-1])

Measured memory_bytes: 3316
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())

    first = []
    second = []

    for _ in range(N):
        s = input()
        l, r = 0, 0
        cnt = 0
        for char in s:
            if char == "(":
                cnt += 1
            else:
                if cnt > 0:
                    cnt -= 1
                else:
                    l += 1
        r = cnt
        if r >= l:
            first.append((l, r))
        elif l > r:
            second.append((l, r))

    from operator import itemgetter

    first.sort(key=itemgetter(0))
    second.sort(key=itemgetter(1), reverse=True)

    r_cur = 0

    for x, y in first:
        r_cur -= x
        if r_cur < 0:
            return print("No")
        r_cur += y

    for x, y in second:
        r_cur -= x
        if r_cur < 0:
            return print("No")
        r_cur += y

    if r_cur == 0:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 212540
#include <iostream>
#include <cstring>
using namespace std;
int main ()
{
	string s; int n, counter=0;
	cin>>n>>s;
	for (int i=0; i<n; i++)
		if (s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C') counter++;
	cout<<counter;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef vector<int> V;

int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> a(n);
  for (int i = 0; i < n; i++) cin >> a[i].first >> a[i].second;
  sort(a.begin(), a.end());
  int res = a[n-1].first + a[n-1].second;
  dump(res);
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
ll mBit(ll n){
  return (1LL<<n)%mod;
}
int main(){
  ll n,a,i,j,B[61] = {},ans = 0;scanf("%lld",&n);
  for(i=0;i<n;i++){
    scanf("%lld",&a);
    for(j=0;j<=60;j++){
      B[j] += a%2;
      a >>= 1;
    }
  }
  for(i=0;i<=60;i++) ans = (ans+mBit(i)*B[i]%mod*(n-B[i])%mod)%mod;
  printf("%lld\n",ans);
}

Measured memory_bytes: 256
import java.util.Scanner;

public class  Main{

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int x=sc.nextInt();
		int a=sc.nextInt();
		int b=sc.nextInt();
		int ans=(x-a)%b;
		System.out.println(ans);

	}

}


Measured memory_bytes: 20820
//
// Created by yamunaku on 2020/09/20.
//

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

using namespace std;
using namespace atcoder;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main() {
    //CFS;
    int n, m;
    cin >> n >> m;
    vector<string> f(n);
    vector<pair<int, int>> start;
    rep(i, n) {
        cin >> f[i];
        rep(j, m) {
            if (f[i][j] == 'o') {
                start.emplace_back(i, j);
            }
        }
    }
    mcf_graph<int, int> g(n * m + start.size() + 2);
    int s = n * m + start.size(), t = s + 1;
    rep(i, start.size()) g.add_edge(s, n * m + i, 1, 0);
    rep(i, n) rep(j, m) g.add_edge(i * m + j, t, 1, 0);
    int geta = 10000;
    rep(i, start.size()) {
        auto p = start[i];
        queue<pair<int, int>> q;
        mti dist(n, vi(m, IINF));
        q.emplace(p.first, p.second);
        dist[p.first][p.second] = 0;
        while (!q.empty()) {
            auto now = q.front();
            q.pop();
            g.add_edge(n * m + i, now.first * m + now.second, 1, geta - dist[now.first][now.second]);
            int nx = now.first + 1;
            int ny = now.second;
            if (nx < n) {
                if (f[nx][ny] != '#' && dist[nx][ny] == IINF) {
                    dist[nx][ny] = dist[now.first][now.second] + 1;
                    q.emplace(nx, ny);
                }
            }
            nx = now.first;
            ny = now.second + 1;
            if (ny < m) {
                if (f[nx][ny] != '#' && dist[nx][ny] == IINF) {
                    dist[nx][ny] = dist[now.first][now.second] + 1;
                    q.emplace(nx, ny);
                }
            }
        }
    }
    auto ans = g.flow(s,t);
    cout << start.size()*geta - ans.second << endl;
    return 0;
}


Measured memory_bytes: 7236
while True:
    m,f,r = map(int, input().split())

    if m == -1 and f == -1 and r == -1:
        break 

    if m == -1 or f == -1:
        score = 'F'
    elif m + f >= 80:
        score = 'A'
    elif m + f >= 65:
        score = 'B'
    elif m + f >= 50:
        score = 'C'
    elif m + f >= 30:
        score = 'D'
        if r >= 50:
            score = 'C'
    else:
        score = 'F'
    
    print(score)


Measured memory_bytes: 5592
a,b = gets.split.map(&:to_i)
x = y = 0
for i in 1..45
    break if a < (1<<i)
    if (a[i] == 1 && a%2 == 0)
        x ^= (1<<i)
    end
end
for i in 1..45
    break if b < (1<<i)
    if (b[i] == 1 && b%2 == 0)
        y ^= (1<<i)
    end
end
x += 1 if a%4 == 1 || a%4 == 2
y += 1 if b%4 == 1 || b%4 == 2
ans = x^y^a
puts ans

Measured memory_bytes: 1788
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 1e-5
#define LONG_INF 1000000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define seg_size 262144*4
#define REP(a,b) for(long long a = 0;a < b;++a)
long long union_tree[200000];
long long union_find(long long now) {
	if (union_tree[now] == now) return now;
	return union_tree[now] = union_find(union_tree[now]);
}
void union_merge(long long a, long long b) {
	a = union_find(a);
	b = union_find(b);
	union_tree[a] = b;
	return;
}
int main() {
#define int long long
	int n, m, query;
	cin >> n >> m >> query;
	vector<tuple<long long, long long, long long>> inputs;
	REP(i, query) {
		long long a, b, c;
		cin >> a >> b >> c;
		inputs.push_back(make_tuple(c, a, b));
		if (c == 1&&n == m + 1) {
			cout << "No" << endl;
			return 0;
		}
	}
	sort(inputs.begin(), inputs.end());
	REP(i, n) {
		union_tree[i] = i;
	}
	REP(i, query) {
		if (get<0>(inputs[i]) == 0) {
			union_merge(get<1>(inputs[i]), get<2>(inputs[i]));
		}
	}
	REP(i, query) {
		if (get<0>(inputs[i]) == 1) {
			if (union_find(get<1>(inputs[i])) == union_find(get<2>(inputs[i]))) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	long long cnt = 0;
	REP(i, n) {
		if (union_find(i) == i) {
			cnt++;
		}
	}
	long long hoge = cnt * (cnt - 3LL) / 2LL;
	hoge += n;
	if (m <= hoge) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


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

using namespace std;

int main()
{
   string s;
   cin>>s;
   if(s=="Sunny")
   {
       cout<<"Cloudy"<<endl;
   }
   else if(s=="Cloudy")
   {
       cout<<"Rainy"<<endl;
   }
   else if(s=="Rainy")
   {
       cout<<"Sunny"<<endl;
   }


    return 0;
}


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

int main(){
  string s;
  cin>>s;
  int N=s.size();
  int ans=0;
  int i=0;
  int j=N-1;
  int out=0;
  while(i<j&&out==0){
    //cout<<i<<" "<<j<<" "<<ans<<endl;
    if(s[i]==s[j]){
      i++;j--;continue;
    }
    if(s[i]=='x'&&s[j]!='x'){
      ans++;i++;continue;
    }
    if(s[i]!='x'&&s[j]=='x'){
      ans++;j--;continue;
    }
    out++;
  }
  if(out)cout<<-1<<endl;
  else cout<<ans<<endl;
}


Measured memory_bytes: 512
import math
a, b = list(map(int,input().split()))
ao = a / 0.08
ao1 = (a+1) / 0.08
bo = b * 10
bo1 = (b+1) * 10
if bo <= ao < bo1:
    print(math.ceil(ao))
elif ao <= bo < ao1:
    print(bo)
else:
    print(-1)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cmath>
#include <map>
#include <set>
#define ull unsigned long long
#define ll long long
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    for(int i=0;i<s.size();i++){
        if(i==3){cout << s[i] << ' ';}
        else cout << s[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){

    unsigned int n, m, i, j;
    unsigned int matrix[100][100];
    unsigned int vector[100];
    unsigned int answer[100] = {0};

    cin >> n >> m;

    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            cin >> matrix[i][j];
        }
    }

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

    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            answer[i] += matrix[i][j] * vector[j];
        }
    }

    for(i=0;i<n;i++){
        cout << answer[i] << endl;
    }

    return 0;

}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
#define cout16 cout << setprecision(16) 
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using P = std::pair<int,int>;
using vp = std::vector<P>;
using namespace std;
#define INF 1001001001
#define LL_INF 1001001001001001001
#define fi first
#define se second

//Union-Find Tree
class UnionFindTrees{
	public:
		//　_n : ノード数
		UnionFindTrees(int _n){
			n = _n;
			root = vector<int>(_n);
			tree_size = vector<int>(_n,1);
			rep(i,_n) root[i] = i;
		}
		//　xの根っこ（属する木）を見つける
		int find(int x){
			if(root[x]==x) return x;
			else return root[x]=find(root[x]);			
		}
		//　xとyの属する木が同じかどうか判定する
		bool same(int x, int y){
			return find(x)==find(y);
		}
		//　xとyの属する木を統合する
		void merge(int x, int y){
			if(same(x,y)) return;
			x = find(x);
			y = find(y);
			if(tree_size[x]<tree_size[y]) swap(x,y);			
			root[y] = x;
			tree_size[x] += tree_size[y];
			n--;			
		}
		//　xが属する木のサイズを出力する
		int get_tree_size(int x){
			return tree_size[find(x)];
		}
		//　木の数を出力する
		int get_forest_size(){return n;}
	private:
		vector<int> root;
		vector<int> tree_size;
		int n;
};

int main(void) {
	int n,m; cin >> n >> m;
	vp p(m);
	rep(i,m){
		cin >> p[i].fi >> p[i].se;
		p[i].fi--; p[i].se--;
	}
	int ans = 0;
	rep(i,m){
		UnionFindTrees uft(n);		
		rep(j,m){
			if(j==i) continue;
			uft.merge(p[j].fi,p[j].se);
		}
		if(uft.get_forest_size()>1) ans++;
	}
	cout << ans << endl;
}




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

signed main(){
	int N, i;
	string S;
	cin >> S;
	N = S.size();
	for(i = 0; i < N; i++){
		if(S[i] != S[N - 1 - i]){
			printf("No\n");
			return 0;
		}
	}
	for(i = 0; i < (N - 1) / 2; i++){
		if(S[i] != S[(N - 1) / 2 - 1 - i]){
			printf("No\n");
			return 0;
		}
	}
	for(i = 0; (N + 3) / 2 - 1 + i < N; i++){
		if(S[(N + 3) / 2 - 1 + i] != S[N - 1 - i]){
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
//#include  <iostream>
 using namespace std;
 
#define IOS         ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define FOR(i,a,n)  for(int i = (a); i<(n); ++i) 
#define mp(a , b)   make_pair(a , b)
#define pb(a)       push_back(a)
#define si(n)       scanf("%d" , &n)
#define pi(n)       printf("%d", n )
#define sl(n)       scanf("%lld" ,&n)
#define pl(n)       printf("%lld",n)
#define pin(n)      printf("%d\n", n)
#define pis(n)      printf("%d ", n)
#define pln(n)      printf("%lld\n", n)
#define endl "\n"

typedef long long ll;
 
 

int main(){
     
    IOS;
    
  //  freopen("input.in", "r", stdin);
    //freopen("output.in", "w", stdout);
   
   float l;
   scanf("%f",&l);

   // float x = l/3;
    
    printf("%.12f\n",l*l*l/27);
   

  return 0;
    
}


Measured memory_bytes: 384
#22:27
k,x = map(int,input().split())

x_min = -1000000
x_max = 1000000

a_min = x - k + 1
a_max = x + k - 1
if a_min < x_min:
    a_min = x_min
    a_max = x_min + k - 1
if a_max > x_max:
    a_max = x_max
    a_min = x_max - k + 1
ans = str(a_min)
t = 0
while(t != (a_max - a_min)):
    t += 1
    ans += " " + str(a_min+t)

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define PI 3.141592653589793
#define MOD 1000000007
typedef long long ll;
typedef long double ld;

ll calc(ll N){
    ll num = 1;
    while(1){
        if(num * (num + 1) /2 >= N){
            break;
        }
        num++;
    }
    return num;
}

int main() {
    ll N;
    cin >> N;
    vector<ll> ans;
    while(N > 0){
        ans.push_back(calc(N));
        N -=  calc(N);
    }
    
    for(int i = 0; i < ans.size(); i++){
        cout << ans[i] << endl;
    }

}


Measured memory_bytes: 3684
#include <stdio.h>
int main(){
	int Data;
	int n;
	int Factor[1000][3];
	scanf("%d\n",&Data);
	for(n=0;n<Data;n++){
			scanf(" %d %d %d",&Factor[n][0],&Factor[n][1],&Factor[n][2]);
	}
	
	int l,m;
	for(l=0;l<Data;l++){
		int a,b,c;
		a=b=c=0;
		a=Factor[l][0]*Factor[l][0];
		b=Factor[l][1]*Factor[l][1];
		c=Factor[l][2]*Factor[l][2];
		
		if(a==b+c||b==a+c||c==b+a){
			printf("YES\n");
		}
		else{
			printf("NO\n");
		}
	}
	return 0;
}
		


Measured memory_bytes: 2012
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int n,k;
int C[2005][2005];

int main(){
	cin>>n>>k;
	C[0][0]=1;
	for(int i=1;i<=2000;i++){
		C[i][0]=C[i][i]=1;
		for(int j=1;j<i;j++){
			C[i][j]=C[i-1][j-1]+C[i-1][j];
			C[i][j]%=mod;
		}
	}
	for(int i=1;i<=k;i++){
		printf("%d\n",1LL*C[n-k+1][i]*C[k-1][i-1]%mod);
	}
	
	return 0;
}

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

long long Zettaiti(long long a, long long b){
  
  if(a > b){
    
    return (a - b);
  } else {
    
    return (b - a);
  }
  
  return -1;
}

int main(){
  
  //int N, K, Min;
  long long N, K, Min;
  cin >> N >> K;
  
  Min = N % K;
  
  cout << min(Min, Zettaiti(Min, K)) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <cmath>
#include <limits>
#include <numeric>
#include <iomanip>
#include <cstdlib>
#include <iterator>
#include <functional>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef unsigned                    ui;
typedef int                         si;
typedef long                        sl;
typedef long long                   ll;
typedef unsigned long long          ull;

#ifdef LOCALHOST
std::ifstream in("input.txt", std::ifstream::in);
#endif // LOCALHOST

#ifdef LOCALHOST
#define is in
#else
#define is cin
#endif // LOCALHOST

int main(int argc, char *argv[])
{
    std::ios_base::sync_with_stdio(false);

    ll a, b, k;
    cin >> a >> b >> k;

    if (a > 0) {
        ll steps = min(a, k);
        a -= steps;
        k -= steps;
    }

    if (b > 0) {
        ll steps = min(b, k);
        b -= steps;
        k -= steps;
    }

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

    return 0;
}


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

// varibable settings {{{
#define infile "../test/sample-1.in"
#define int long long
const int INF=1e18;
const int MOD=1e9+7;
int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
// }}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;
//}}}

// dump macro {{{
#if defined(PCM) || defined(LOCAL)
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
// }}}

int solve(){
  int n,k;cin>>n>>k;
  string s;cin>>s;
  s[k-1] = tolower(s[k-1]);
  cout << s << endl;
  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 256
import time

n = int(input())
#t1 = time.time()

S = set()
for i in range(0,n):
	lst = list(input().split())
	if lst[0] == 'insert':
		S.add(lst[1])
	elif lst[0] == 'find':
		if lst[1] in S:
			print('yes')
		else:
			print('no')

#S = []
#for i in range(0,n):
#	lst = list(input().split())
#	if lst[0] == 'insert':
#		S.append(lst[1])
#	elif lst[0] == 'find':
#		if S.count(lst[1]) != 0:
#			print('yes')
#		else:
#			print('no')

#t2 = time.time()
#elapsed = t2-t1
#print('経過時間:{0}'.format(elapsed))


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

typedef complex<double> P;
const double EPS = 1e-8;

struct C{P p;double r;};

// 点集合 ps をすべて含む円のうち，半径最小の円を求める
C smallest_circle(const vector<P>& ps) {
    const double init = 1.0;
    const double rate = 0.99; // 1e-9 ~ (0.99^2000)
    if(ps.empty()) return {{0, 0}, 0};
    double T = init;
    P cur;
    while(T > EPS) {
        P to = ps.front();
        for(P p : ps) if(abs(to - cur) < abs(p - cur)) {
            to = p;
        }
        cur += (to - cur) * T;
        T *= rate;
    }
    double r = 0;
    for(P p : ps) {
        r = max(r, abs(p - cur));
    }
    return {cur, r};
}

struct BipartiteMatching{
    typedef vector<int> Node;
    typedef vector<Node> Graph;

    Graph G;
    vector<int> match;
    vector<bool> used;

    BipartiteMatching(int N) : G(N) {}

    void add_edge(int u, int v){
        G[u].push_back(v);
        G[v].push_back(u);
    }

    bool dfs(int u){
        used[u] = true;
        for(int v : G[u]){
            int w = match[v];
            if(w < 0 || (!used[w] && dfs(w))){
                match[u] = v;
                match[v] = u;
                return true;
            }
        }
        return false;
    }

    int matching(){
        int res = 0;
        match.assign(G.size(), -1);
        for(int u = 0; u < G.size(); u++){
            if(match[u] < 0){
                used.assign(G.size(), false);
                if(dfs(u)) res++;
            }
        }
        return res;
    }
};

int main(){
    int n, m;
    while(cin >> n >> m) {
        vector<double> R(n);
        REP(i, n) cin >> R[i];

        vector<double> T(m);
        REP(k, m) {
            int q;
            cin >> q;
            vector<P> ps(q);
            REP(i, q) {
                double x, y;
                cin >> x >> y;
                ps[i] = {x, y};
            }
            auto c = smallest_circle(ps);
            T[k] = c.r;
        }

        // T -> R (m -> n)
        vector<int> res;
        vector<bool> used(n);
        for(int i = 0; i < m; i++) {
            for(int k = 0; k < n; k++) {
                if(used[k]) continue;
                if(!(T[i] <= R[k] + EPS * 1e4)) continue;
                BipartiteMatching bp(m + n);
                for(int j = i + 1; j < m; j++) {
                    for(int l = 0; l < n; l++) {
                        if(used[l]) continue;
                        if(l == k) continue;
                        if(T[j] <= R[l] + EPS * 1e4) {
                            bp.add_edge(j, l + m);
                        }
                    }
                }
                int mc = i + 1 + bp.matching();
                if(mc == m) {
                    res.push_back(k + 1);
                    used[k] = true;
                    break;
                }
            }
            if(res.size() != i + 1) break;
        }

        if(res.size() == m) {
            for(int a : res) {
                cout << a << endl;
            }
        } else {
            cout << "NG" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1364
#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define endl '\n'
#define ff first
#define ss second
#define pi pair<int,int>
using namespace std;
int main(){
	ios_base::sync_with_stdio(0) ; 
	cin.tie(0) ;
     int n ; 
     cin>> n ; 
     string s ;
     cin>> s;
     int a[s.length()+1] ;
     for(int i = 0; i < n; ++i){
		 if(s[i] == 'R')
		     a[i] = 1 ; 
		 else if(s[i] == 'G')
		   a[i] = 2 ;
		   else
		   a[i] = 3 ; 
	   }
	   int co1 = 0 , co2 = 0, co3 = 0;
	   int arr1[n] = {0} , arr2[n] = {0}  , arr3[n] = {0} ; 
	   ll ans =  0 ; 
	   for(int i = 0 ; i < n ; ++i){
		   if(a[i] == 1) co1++ ; 
		   if(a[i] ==2) co2++ ;
		   if(a[i]==3) co3++ ; 
		   
		   arr1[i] = co1 ; 
		   arr2[i] = co2;
		   arr3[i] = co3 ; 
          }
  /* cout<<arr1[n-1]<<endl;
   cout<<arr2[n-1]<<endl;
   cout<<arr3[n-1]<<endl;
   */
   for(int i = 1; i < n -1; ++i){
	    if(a[i] == 1){
		
		  for(int j = i - 1 , count=1; j >=0 && i + count < n ; --j , count++ ) {
			   if((a[j] == 2 &&a[i+count] == 3) ||
			       (a[j] == 3 && a[i + count ]==2)) ans-- ; 
			   }
		int fno2 = arr2[i] ; 
		int sno2 = arr2[n-1]  - arr2[i] ; 
		int sno3 = arr3[n-1] - arr3[i] ; 
		int fno3 = arr3[i] ;
			ans = ans + fno2*sno3+
			        sno2*fno3 ; 
				}
	   else if(a[i] == 2){
		   
		   
		  for(int j = i - 1 , count=1; j >=0 && i + count < n ; --j , count++ ) {
			   if((a[j] == 1 &&a[i+count] == 3 )||
			       (a[j] == 3 && a[i + count] ==1)) ans-- ; 
			   }
		   int sno3 = arr3[n-1] - arr3[i] ; 
           int fno3 = arr3[i] ;
		   int fno1 = arr1[i] ; 
		   int sno1 = arr1[n-1] - arr1[i] ; 
		   ans = ans + fno1*sno3 + 
		              fno3 * sno1 ; 
				  }
	  else{
		  for(int j = i - 1 , count=1; j >=0 && i + count < n ; --j , count++ ) {
			   if((a[j] == 2 &&a[i+count] == 1) ||
			       (a[j] == 1 && a[i + count] ==2)) ans-- ; 
			   }
		  int fno1 = arr1[i] ; 
		   int sno1 = arr1[n-1] - arr1[i] ; 
		   int fno2 = arr2[i] ; 
		int sno2 = arr2[n-1]  - arr2[i] ; 
		
		   
		  ans = ans + fno1*sno2 +
		              fno2*sno1 ;
			  }
		  }
		   
 
  
  
  
  cout<<ans<<endl;
  
  
  
  
  
  
}


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

using namespace std;

#define MAXN 200010
#define PI acos(-1.0)
#define mo 1000000007
#define INF 0x3f3f3f3f
#define eps 1e-8
typedef long long LL;

int n, a[MAXN];
int Log[MAXN], RM[2][MAXN][20];

struct node
{
    int x, y, l, r;
    bool operator < (const node &z) const{
        return a[x] > a[z.x];
    }
};
priority_queue<node> q;

void RMI()
{
    for(int i = 2; i <= n; ++i) Log[i] = Log[i >> 1] + 1;
    for(int j = 1; (1 << j) <= n; ++j)
        for(int i = 1; i + (1 << j) - 1 <= n; ++i){
            RM[0][i][j] = a[RM[0][i][j - 1]] < a[RM[0][i + (1 << (j - 1))][j - 1]] ? RM[0][i][j - 1] : RM[0][i + (1 << (j - 1))][j - 1];
            RM[1][i][j] = a[RM[1][i][j - 1]] < a[RM[1][i + (1 << (j - 1))][j - 1]] ? RM[1][i][j - 1] : RM[1][i + (1 << (j - 1))][j - 1];
        }
}

int RMQ(int l, int r, int k)
{
    int Lg = Log[r - l + 1];
    return a[RM[k][l][Lg]] < a[RM[k][r - (1 << Lg) + 1][Lg]] ? RM[k][l][Lg] : RM[k][r - (1 << Lg) + 1][Lg];
}

void Init()
{
    scanf("%d", &n); a[0] = INF;
    for(int i = 1; i <= n; ++i){
        scanf("%d", a + i);
        if(i & 1) RM[1][i][0] = i, RM[0][i][0] = 0;
        else RM[0][i][0] = i, RM[1][i][0] = 0;
    }
}

void Work()
{
    node u, v;
    u.x = RMQ(1, n, 1); u.y = RMQ(u.x, n, 0); u.l = 1; u.r = n;
    for(q.push(u); !q.empty();){
        u = q.top(); q.pop();
        printf("%d %d ", a[u.x], a[u.y]);
        v.l = u.l; v.r = u.x - 1;
        if(v.l < v.r){
            v.x = RMQ(v.l, v.r, v.l & 1);
            v.y = RMQ(v.x, v.r, (v.l & 1) ^ 1);
            q.push(v);
        }

        v.l = u.x + 1; v.r = u.y - 1;
        if(v.l < v.r){
            v.x = RMQ(v.l, v.r, v.l & 1);
            v.y = RMQ(v.x, v.r, (v.l & 1) ^ 1);
            q.push(v);
        }

        v.l = u.y + 1; v.r = u.r;
        if(v.l < v.r){
            v.x = RMQ(v.l, v.r, v.l & 1);
            v.y = RMQ(v.x, v.r, (v.l & 1) ^ 1);
            q.push(v);
        }
    }
}

int main()
{
    Init();
    RMI();
    Work();
    return 0;
}


Measured memory_bytes: 35064
#include<iostream>
#include<algorithm>
#include<functional>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<deque>
#include<sstream>
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<bitset>
#include<time.h>
#include<cstdlib>
#include<cassert>
#define ll long long
#define fi first
#define se second
using namespace std;
void aho(string s,ll a){
  cout<<s<<"="<<a<<endl;
  return;
}

int n;
int a[200001];
int b[200001];
                   
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout<<fixed;
#ifdef LOCAL_DEFINE
    freopen("in", "r", stdin); 
    freopen("out","w",stdout);
#endif
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
    b[a[i]]=i+1;
  }
  set<int> s;
  s.insert(0);
  s.insert(n+1);
  ll res=0;
  for(int i=1;i<=n;i++){
    int index=b[i];
    auto ite=s.lower_bound(index);
    ll left=(*ite)-index;
    ite--;
    ll right=index-(*ite);
    res+=i*left*right;
    s.insert(index);
    //aho("left",left);
    //aho("right",right);
    //cout<<res<<endl;
  }
  cout<<res<<"\n";
#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}

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

int main(){

  string S;
  int i;
  int n;
  char t;

  cin>>S;

  n=0;

  for(i=0;i<=2;i=i+1){

    t=S.at(i);

    if(t=='o'){
      n=n+1;
    }
  }
  cout<<700+n*100<<endl;
}

Measured memory_bytes: 256