akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

main()
{
	int a,b,c;
	std::cin >> a >> b >> c;
	int eatenNum = 0;
	if(c > 0)
	{
		eatenNum++;
		c--;
	}
	for(int i = 0;i < c;i++)
	{
		if(b > 0)
		{
			eatenNum++;
			b--;
		}
		else if(a > 0)
		{
			a--;
		}
		else 
		{
			break;
		}
		eatenNum++;
	}
	while(b > 0)
	{
		eatenNum++;
		b--;
	}
	std::cout << eatenNum << std::endl;

} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(a) a.begin(), a.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define endl "\n"
typedef long long ll;

const int BIG_NUM = 1e9;

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

    int a, b;
    cin >> a >> b;
    int result = 6 - a - b;
    cout << result;
    return 0;
}



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

int main() {
  int n=0,m=0;
  cin >> n >> m;
  
  vector<int> vec(n);
  
  int a=0,b=0;
  
  for (int i=0; i < m; i++) {
    cin >> a >> b;
    vec.at(a-1) += 1;
    vec.at(b-1) += 1;
  }
  
  for (int i=0; i<n; i++) cout << vec.at(i) << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int A, B, C;
	cin >> A >> B >> C;
	if ((A == B && A != C) || (A == C && A != B) || (B == C && B != A))
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#!/usr/bin/env python3
N, M, K = [int(s) for s in input().split()]
A = [int(s) for s in input().split()]
B = [int(s) for s in input().split()]
i = 0
j = M-1

B_SUM = [0] * M
A_SUM = [0] * N
B_SUM[0] = B[0]
A_SUM[0] = A[0]
max_book = 0

if B_SUM[0] <= K:
    max_book = 1

for i in range(1, M):
    B_SUM[i] = B[i] + B_SUM[i - 1]
    if B_SUM[i] <= K:
        max_book = i + 1

A_SUM = 0
b_index = M - 1

for i in range(N):
    A_SUM += A[i]
    while (b_index >= 0):
        B_SUM[b_index]
        if A_SUM + B_SUM[b_index] <= K:
            max_book = max(max_book, b_index + 1 + i + 1)
            break
        b_index -= 1
    if (A_SUM <= K):
        max_book = max(max_book, i + 1)
print(max_book)

Measured memory_bytes: 41808
#include <bits/stdc++.h> 
using namespace std; 
 
int main() 
{ 

    int n,k;
    cin>>n>>k;

    string s;
    cin>>s;

    s.at(k-1)=tolower(s.at(k-1));
    cout<<s<<endl;

    return 0; 
} 

Measured memory_bytes: 256
def main():
    n = int(input())
    p = list(map(int, input().split()))
    count = 0
    for i in range(n):
        if p[i] != i + 1:
            count += 1
        else:
            continue
    if count == 0 or count == 2:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>

#define _GLIBCXX_DEBUG
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t n,q,l,r,sum=0;
    string s;
    cin >> n >> q >> s;
    vector<int64_t> memo(n);
    memo.at(0) = 0;
    for(int64_t i=0; i<n-1; i++){
        sum += s.at(i) == 'A' && s.at(i+1) == 'C';
        memo.at(i+1) = sum;
    }
    for(int i=0; i<q; i++){
        cin >> l >> r;
        cout << memo.at(r-1) - memo.at(l-1) << endl;
    }
    
}


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

using namespace std;

int main(int argc, char *argv[])
{
   
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    
    for (int i = 1; i <= 5; i++) {
        cin >> n;
        if (n == 0) {
            cout << i << endl;
            break;
        }
    }
    
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
string repeat(const string &s, int n) {
    string ans;
    for (int i = 0; i < n; i++) ans += s;
    return ans;
}
int main()
{
    int L; cin >> L;
    string S, T; cin >> S >> T;
    vector<int> dpS(L+1, -1e9), dpT(L+1, -1e9);
    dpS[0] = dpT[0] = 0;
    for (int i = 1; i < L+1; i++) {
        if (i - (int)S.size() >= 0) {
            dpS[i] = dpS[i - S.size()] + 1;
            dpT[i] = dpT[i - S.size()] + 0;
        }
        if (i - (int)T.size() >= 0) {
            dpS[i] = max(dpS[i], dpS[i - T.size()] + 0);
            dpT[i] = max(dpT[i], dpT[i - T.size()] + 1);
        }
    }
    string s = repeat(S, dpS[L]) + repeat(T, (L - S.size()*dpS[L]) / T.size());
    string t = repeat(T, dpT[L]) + repeat(S, (L - T.size()*dpT[L]) / S.size());
    cout << min(s, t) << endl;
    return 0;
}

Measured memory_bytes: 2952
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,C = inpl()
d = []
c = []
for i in range(C):
    d.append(inpl())
for i in range(n):
    c.append(inpl())
d0 = defaultdict(int)
d1 = defaultdict(int)
d2 = defaultdict(int)
for y in range(n):
    for x in range(n):
        if (x+y+2) % 3 == 0:
            d0[c[x][y]] += 1
        elif (x+y+2) % 3 == 1:
            d1[c[x][y]] += 1
        else:
            d2[c[x][y]] += 1
# print(d0)
# print(d1)
# print(d2)
res0 = []
res1 = []
res2 = []
for i in range(C):
    tmp = 0
    for key in d0.keys():
        tmp += d[key-1][i] * d0[key]
    res0.append([i,tmp])
    tmp = 0
    for key in d1.keys():
        tmp += d[key-1][i] * d1[key]
    res1.append([i,tmp])
    tmp = 0
    for key in d2.keys():
        tmp += d[key-1][i] * d2[key]
    res2.append([i,tmp])
res0.sort(key=lambda x:x[1])
res1.sort(key=lambda x:x[1])
res2.sort(key=lambda x:x[1])
# print(res0)
# print(res1)
# print(res2)
ans = mod
for i in range(3):
    for j in range(3):
        for k in range(3):
            if res0[i][0] == res1[j][0] or res0[i][0] == res2[k][0] or res2[k][0] == res1[j][0]:
                continue
            ans = min(res0[i][1]+res1[j][1]+res2[k][1], ans)
print(ans)            

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

int main() {
    int n;
    vector<int> h;

    cin >> n;
    for (int i = 0; i < n; i++) {
        int x; cin >> x;
        h.push_back(x);
    }

    int ans = 0;
    while (true) {
        int left = 0, right = 0;
        while (left < n && h[left] == 0) left++;
        if (left == n) break;
        while (left < n) {
            while (left < n && h[left] == 0) left++;
            if (left == n) {
                break;
            }
            right = left + 1;
            int mi = h[left];
            while (right < n && h[right]) {
                mi = min(mi, h[right]);
                right++;
            }
            ans += mi;
            for (int i = left; i < right; i++) {
                h[i] -= mi;
            }
            left = right;
        }
    }

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

Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int h, w;
  while (scanf("%d%d", &h, &w), h | w) {
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        if (i != 0 && i != h - 1 && j != 0 && j != w - 1)
          printf(".");
        else
          printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 2072
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8


void mainmain(){
	int n;
	scanf("%d", &n);
	vint a(n + 1);
	for(int i = 1; i <= n; ++i){
		scanf("%d", &a[i]);
	}
	int c = 0;
	for(int i = 1; i <= n; ++i){
		c += a[a[i]] == i;
	}
	cout << c / 2 << endl;
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<cstdio>
#include<cstdlib>
using namespace std;


using ll = long long int;

/// <summary>
/// GCDを計算します
/// </summary>
template <typename NumType>
NumType calcGCD(NumType a, NumType b) {
	if (a < b) {
		NumType tmp = a;
		a = b;
		b = tmp;
	}

	NumType r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}

	return b;
}

/// <summary>
/// 約数を数えます
/// </summary>
template <typename NumType>
NumType cntDivisor(const NumType& num) {
	NumType cnt = 0;
	for (NumType i = 1; i * i <= num; ++i) {
		if (num % i == 0) {
			cnt++;
			if (i * i != num) cnt++;
		}
	}

	return cnt;
}

/// <summary>
/// [beg, end)の範囲を，添え字indexでループするfor文に置換します
/// </summary>
#define FOR_RANGE(index, beg, end)     for (ll index = beg; index < N; ++index)

#define DEBUG(x)     std::cout << #x << " : " << x << "\n"





int main() {
	int A, B, C, D, in;
	cin >> in;
	int tmp = in;
	in /= 1000; A = in; in = tmp;
	in = (in - A * 1000) / 100; B = in; in = tmp;
	in = (in - A * 1000 - B * 100) / 10; C = in; in = tmp;
	D = tmp - (A * 1000 + B * 100 + C * 10);
	

	int ans = A + B + C + D;
	if (ans == 7) {
		cout << A << "+" << B << "+" << C << "+" << D << "=7" << endl;
		return 0;
	}

	ans = A - B + C + D;
	if (ans == 7) {
		cout << A << "-" << B << "+" << C << "+" << D << "=7" << endl;
		return 0;
	}

	ans = A + B - C + D;
	if (ans == 7) {
		cout << A << "+" << B << "-" << C << "+" << D << "=7" << endl;
		return 0;
	}

	ans = A + B + C - D;
	if (ans == 7) {
		cout << A << "+" << B << "+" << C << "-" << D << "=7" << endl;
		return 0;
	}

	ans = A - B - C + D;
	if (ans == 7) {
		cout << A << "-" << B << "-" << C << "+" << D << "=7" << endl;
		return 0;
	}

	ans = A - B + C - D;
	if (ans == 7) {
		cout << A << "-" << B << "+" << C << "-" << D << "=7" << endl;
		return 0;
	}

	ans = A + B - C - D;
	if (ans == 7) {
		cout << A << "+" << B << "-" << C << "-" << D << "=7" << endl;
		return 0;
	}

	ans = A - B - C - D;
	if (ans == 7) {
		cout << A << "-" << B << "-" << C << "-" << D << "=7" << endl;
		return 0;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int Mod=1e9+7,N=1e5+10;
#define pb push_back
#define f first
#define s second
int n,a[N],dp[N],k;
int main()
{
  cin>>n>>k;
  for(int i=1;i<=n;i++) cin>>a[i];
  dp[1]=0,dp[2]=abs(a[2]-a[1]);
  for(int i=3;i<=n;i++)
  {
    dp[i]=INT_MAX;
    for(int j=i-1;j>=(i-k) && j>=1;j--)
    dp[i]=min(dp[j]+abs(a[i]-a[j]),dp[i]);
  }
  cout<<dp[n]<<endl;
  return 0;
}


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

int main(void){
  double ax[4],ay[4], bx[4],by[4];

  while(cin >> ax[0] >> ay[0]>> ax[1] >> ay[1] >> bx[0] >> by[0] >> bx[1] >> by[1]){
    bool in = true;
    
    if(ay[1] < by[0] || ay[0] > by[1]){
      in = false;
    }else if(ax[1] < bx[0] || bx[1] < ax[0]){
      in = false;
    }
    if(in){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
    using namespace std;
    #define REP(i, n) for(int i = 0; i < n; i++)
    #define REPR(i, n) for(int i = n - 1; 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 SORT(v, n) sort(v, v+n);
    #define VSORT(v) sort(v.begin(), v.end());
    #define VSORTR(v) sort(v.rbegin(), v.rend());
    #define ALL(v) (v).begin(),(v).end()
     
    using ll = long long;
    using vll = vector<ll>;
    using vvll = vector<vector<ll>>;
    using P = pair<ll, ll>;
     
    template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
    template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
    template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
     
    const ll mod = 1e9 + 7;
    const ll inf = 1e18;
     
    int main(){
    	cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
     
        ll n, m, s;
        cin >> n >> m >> s;
     
        vector<vector<P>> e(n);
        vll a(m), b(m);
        ll ma = 0;
        REP(i, m) {
            ll u, v;
            cin >> u >> v;
            u--, v--;
            e[u].push_back({v, i});
            e[v].push_back({u, i});
            cin >> a[i] >> b[i];
            ma = max(ma, a[i]);
        }
        vll p(n), q(n);
        REP(i, n) {
            cin >> p[i] >> q[i];
        }
     
        ll ub = (n - 1) * ma + 10;
        vvll d(n, vll(ub + 1, inf));
        ll cur = 0, yen = min(s, ub);
        d[cur][yen] = 0;
     
        queue<P> que;
        que.push({cur, yen});
     
        vll res(n, inf);
        res[0] = 0;
     
        while (!que.empty()) {
            cur = que.front().first, yen = que.front().second;
            que.pop();
            res[cur] = min(res[cur], d[cur][yen]);
            for (auto ee : e[cur]) {
                ll to = ee.first, id = ee.second;
                if (yen < a[id]) continue;
                if (chmin(d[to][yen - a[id]], d[cur][yen] + b[id])) {
                    que.push({to, yen - a[id]});
                }
            }
            ll buy = min(ub, yen + p[cur]);
            if (chmin(d[cur][buy], d[cur][yen] + q[cur])) {
                que.push({cur, buy});
            }
        }
        REP(i, n - 1) {
            cout << res[i + 1] << endl;
        }
        return 0;
    }

Measured memory_bytes: 5284
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<iostream>
#include<algorithm>
#define INF 0x3f3f3f3f
#define LL long long
#define add_edge(u,v) nxt[++cnt]=head[u],head[u]=cnt,to[cnt]=v
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
char ch;bool fs;void re(int& x)
{
	while(ch=getchar(),ch<33);
	if(ch=='-')fs=1,x=0;else fs=0,x=ch-48;
	while(ch=getchar(),ch>33)x=x*10+ch-48;
	if(fs)x=-x;	
}
using namespace std;
int n,sum,last,now;
int main()
{
	re(n);
	while(n--)
	{
		re(now);
		if(last==now)++sum,last=0;
		else last=now;
	}
	printf("%d\n",sum);
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string.h>
using namespace std;
int main()
{
	int n,k=0;
	int ans=0,flag=0;
	int t=1;
	int a[100005],vis[100005];
	scanf("%d",&n);
	memset(vis,1,sizeof(vis));
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	sort(a,a+n);
	for(int i=0;i<n;i++)
	{
		if(a[i]==a[i+1])
		{
			vis[k]++;
		}
		else
		{
			k++;
		}
	}
	for(int i=0;i<k;i++)
	{
		if(vis[i]&1)
		{
			ans++;
		 } 
	}
	 printf("%d\n",ans);
	
	 return 0;
 } 

Measured memory_bytes: 1024
#include<stdio.h>
#include<iostream>
#include<cstdio>
#include<string>
#include<math.h>
#include<vector>
#include<string.h>
#include<algorithm>
#include<regex>
using namespace std;

int main() {
  string S, T;
  cin >> S >> T;
  if (S.size() < T.size()) {
    printf("UNRESTORABLE\n");
    return 0;
  }
  
  vector<string> v;
  for (int i=0 ; i<=S.size() - T.size() ; i++) {
    string str = S;
    int j=0;
    bool flag = true;
    while (j < T.size()){
      if (str[i+j] != '?' && str[i+j] != T[j]) {
        flag = false;
        break;
      }
      j++;
    }
    if (flag) {
      str.replace(i, T.size(), T);
      for (int i=0 ; i<str.size() ; i++) {
        if (str[i] == '?') str[i] = 'a';
      }
      v.push_back(str);
    }
  }
  if (v.size() == 0) {
    printf("UNRESTORABLE\n"); 
    return 0;
  } else if (v.size() == 1){
    cout << v[0] << endl;
    return 0;
  }
  
  string min = v.front();
  for (auto itr = v.begin()+1; itr != v.end(); ++itr) {
    string now = *itr;
    for (int i=0 ; i<S.size() ; i++) {
      if (min[i] > now[i]) {
        min = now;
        break;
      }
    }
  }
  //辞書順比較
  cout << min << endl;
}

Measured memory_bytes: 256
m, n = map(int, input().split())
a, b = map(int, input().split())
for i in range(n-1):
  c, d = map(int, input().split())
  a = max(a,c)
  b = min(b,d)
if b - a >=0 :
  print(b-a +1)
else:
  print(0)

Measured memory_bytes: 3060
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}
string YN(bool v) { return v ? "Yes":"No"; }
void uniq(VI& es) { sort(ALL(es)); es.erase(unique(ALL(es)), es.end()); }

#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,M,W,H,K;
	string s;
	while(cin>>s) {
		string ans=s=="ABC"?"ARC":"ABC";
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 3104
import numpy as np

C = []

for _ in range(3):
    C.append(list(map(int, input().split())))

C = np.array(C)

row = [np.unique(C[i,:] - C[i+1, :]).shape[0] for i in range(2)]
column = [np.unique(C[:,i] - C[:, i+1]).shape[0] for i in range(2)]

if sum(np.concatenate((row, column), axis = 0)) == 4:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 21436
#include<bits/stdc++.h>
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	getchar();
	string s;
	getline(cin,s);
	int ans=0;
	for(int i=0;i<n;i++){
		if(s[i]=='A' && strcmp(s.substr(i,3).c_str(),"ABC")==0){
			ans++;
			i=i+2; 
		}
	}
	cout<<ans<<endl;
	
	return 0;
} 

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

int main()
{
    int a, b;
    cin >> a >> b;
    if(a < b)
    {
        for(int i=0; i<b; i++)
        {
            cout << a;
        }
        cout << endl;
    }
    else
    {
        for(int i=0; i<a; i++)
        {
            cout << b;
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
   int N;
   int a,b,c,d;
   cin >> N;
   for(int i = 0;i<N;i++){
       cin >> a >> b>> c >> d;
       int ans = (a*c)+(b*d);
       ans = min(ans,4*(a*max(c,5)+b*max(d,2))/5);
      cout << ans << endl;
   }
}


Measured memory_bytes: 3096
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <utility>

using namespace std;

int main() {

	int N, W;
	scanf("%d %d", &N, &W);

	pair<int, int> items[N + 1];
	for (int i = 1; i <= N; ++i) {
		int v, w;
		scanf("%d %d", &v, &w);
		items[i] = make_pair(v, w);
	}
	int V[N + 1][W + 1];
	for (int i = 0; i <= W; ++i) {
		V[0][i] = 0;
	}
	for (int i = 0; i <= N; ++i) {
		V[i][0] = 0;
	}

	for (int i = 1; i <= N; ++i) {
		for (int j = 1; j <= W; ++j) {
			if (items[i].second <= j) {
				V[i][j] = max(V[i - 1][j], V[i - 1][j - items[i].second] + items[i].first);
			} else {
				V[i][j] = V[i - 1][j];
			}
		}
	}
	cout << V[N][W] << endl;

	return 0;
}

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

int R;
int main()
{
	cin >> R;
	if (R < 1200)
	{
		cout << "ABC" << endl;
	} else if (R < 2800)
	{
		cout << "ARC" << endl;
	} else
	{
		cout << "AGC" << endl;
	}

	cin.get();
	return 0;
}

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

#define debug(x) cerr << #x << ": " << x << endl;

#define iosbase ios_base::sync_with_stdio(false)
#define tie cin.tie();cout.tie();

#define endl '\n'

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

int n, m;
int main(){
  iosbase;
  tie;

  int t; cin >> t;
  cout << t * t << endl;
}


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

using namespace std;

typedef long long LL;
typedef unsigned long long uLL;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<LL,LL> pLL;

int A[200001];
LL S[200001];
int n;

pLL tersearch(int L, int R)
{
    int l = L+1, r = R-1;
    while(r - l > 3)
    {
        int m1 = (l+l+r) / 3, m2 = (l+r+r) / 3;
        if(abs(S[R]-S[m1]-(S[m1]-S[L])) < abs(S[R]-S[m2]-(S[m2]-S[L])))
            r = m2;
        else
            l = m1;
    }
    pLL ans = {S[R]-S[r],(S[r]-S[L])};
    if(ans.first> ans.second)
        swap(ans.first, ans.second);
    for(int i = l; i <= r; ++i)
    {
        pLL cur = {S[R]-S[i],(S[i]-S[L])};
        if(cur.first> cur.second)
            swap(cur.first, cur.second);
        if(cur.second-cur.first<ans.second-ans.first)
            ans = cur;
    }
    //cerr<<L<<' '<<R<<' '<<ans.first<<' '<<ans.second<<endl;
    //cerr<<l<<' '<<r<<endl;
    return ans;
}

LL f(int mid)
{
    pLL l = tersearch(0, mid), r = tersearch(mid, n);
    return max(l.second, r.second) - min(l.first, r.first);
}

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    cin>>n;
    for(int i = 1; i <= n; ++i)
    {
        cin>>A[i];
        S[i] = A[i] + S[i-1];
    }
    LL ans = 1e18;
    for(int i = 2; i < n-1; ++i)
        ans = min(ans, f(i));
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 2560
/*
    A - Right Triangle
    https://atcoder.jp/contests/abc115/tasks/abc115_b
*/
#include <bits/stdc++.h>
using namespace std;

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

    int ab, bc, ca;
    cin >> ab >> bc >> ca;
    cout << (ab * bc / 2) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<iomanip>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;i++)
typedef long long LL;
inline int read(){
	int x=0;char ch=getchar();
	while(ch<'0'||ch>'9')ch=getchar();
	while(ch>='0'&&ch<='9'){
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x;
}
int main(){
	int a=read(),b=read(),c=read(),d=read();
	int x=min(min(a<<2,b<<1),c),n=read();
	LL ans=(x<<1)<d?(LL)n*x:(LL)(n>>1)*d+(n&1)*x;
	printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <deque>

int main() {
	int n;
	scanf("%d", &n);
	std::deque<int> que;
	for (int i = 0; i < n; i++) {
		int a;
		scanf("%d", &a);
		if (i & 1)
			que.push_front(a);
		else
			que.push_back(a);
	}
	if (n & 1) {
		for (auto it = que.crbegin(); it != que.crend(); ++it) {
			printf("%d ", *it);
		}
	}
	else {
		for (auto it = que.cbegin(); it != que.cend(); ++it) {
			printf("%d ", *it);
		}
	}
	return 0;
}

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

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    
    if ((A <= C && C <= B) || (B <= C && C <= A)) {
        cout << "Yes" << endl;
    }

    else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
/* ****mittal**** */
#include<bits/stdc++.h>
#define ll          long long int 
#define pb          push_back
#define endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define repr(i,a,b)   for(ll int i=a;i>=b;i--)
#define lbnd    lower_bound
#define ubnd        upper_bound
#define mp          make_pair
using namespace std;

#define N  100005
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        string s,t;
        cin>>s>>t;
        cout<<t+s;
    }
    return 0;
}

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

#define abs(a) ((a)>0?(a):-(a))
#define pb push_back
#define fastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PI 3.14159265358979323846
#define endl "\n"
#define int long long int
int gcd(int a,int b){for(int c;b;c=a,a=b,b=c%b);return a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
// int MOD = 1000000000;

signed main(){
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    int T;
    T = 1;
    int k=0;
    while(T>0){
        int N,M;
        cin >> N >> M;
        int arr[M];
        int sum = 0;
        for (int i = 0; i < M; ++i)
        {
            cin >> arr[i];
            sum += arr[i];
        }
        int p = -1;
        cout << max(N-sum,p) << endl;
    T--;
    }
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
const int nmax=100;
vector<int> dep(nmax),par(nmax),high(nmax);
vector<int> des[nmax];

void dep_dfs(int id){
    for(int i=0;i<des[id].size();i++){
        dep[des[id][i]]=dep[id]+1;
        dep_dfs(des[id][i]);
    }
}
void hi_dfs(int id){
    if(par[id]!=-1){
        high[par[id]]=max(high[par[id]],high[id]+1);
        hi_dfs(par[id]);
    }
}
int bro(int id){
    int p=par[id];
    if(p==-1) return -1;
    for(int i=0;i<des[p].size();i++)if(des[p][i]!=id) return des[p][i];
    return -1;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;cin>>n;
  for(int i=0;i<n;i++){
      par[i]=-1;
      high[i]=0;
      dep[i]=0;
  }
  for(int i=0;i<n;i++){
      int id,left,right;cin>>id>>left>>right;
      if(left!=-1){
          des[id].push_back(left);
          par[left]=id;
      }
      if(right!=-1){
          des[id].push_back(right);
          par[right]=id;
      }
  }
  for(int i=0;i<n;i++){
      if(par[i]==-1) dep_dfs(i);
      if(!des[i].size())hi_dfs(i);
  }
  for(int i=0;i<n;i++){
      string type;
      if(par[i]==-1) type="root";
      else if(!des[i].size()) type="leaf";
      else type="internal node";
      cout<<"node"<<" "<<i<<": parent = "<<par[i]<<", sibling = "<<bro(i)<<", degree = "<<des[i].size()<<", depth = "<<dep[i]<<", height = "<<high[i]<<", "<<type<<endl;
  }
}

Measured memory_bytes: 3244
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	cout<<!(b+1==d)<<endl;
}


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

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

using namespace std;

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

  if((n+1)/2>=k)cout<<"YES";
  else cout<<"NO";
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void) {
	int n, c = 0;
	char s[256];
	scanf("%d", &n);
	scanf("%s", s,256);

	for (int i = 0; i < n; i++) {
		if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
			c++;
		
	}printf("%d",c);
		return 0;
	}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(int i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	string t; cin >> t;
	zep(i, 0, t.size()){
		if(t[i] == '?')t[i] = 'D';
	}
	print(t)
	
	return 0;
}

Measured memory_bytes: 3772
#include <algorithm>
#include <cstdio>
#include <vector>
#define MOD 1000000007
typedef long long ll;
inline ll quick_pow(ll a, int n)
{
	ll res = 1;
	while (n)
	{
		if (n & 1)
			res = res * a % MOD;
		a = a * a % MOD;
		n >>= 1;
	}
	return res;
}
std::vector<int> vec[200005], bel[200005];
int idx[200005], col[200005], w[200005], fa[200005], app[200005];
int getfa(int u)
{
	if (u == fa[u])
		return u;
	return fa[u] = getfa(fa[u]);
}
inline void unite(int u, int v)
{
	u = getfa(u);
	v = getfa(v);
	fa[u] = v;
}
int main()
{
	// freopen("AGC012-D.in", "r", stdin);
	int n, a, b, cnt = 0;
	scanf("%d%d%d", &n, &a, &b);
	for (int i = 0; i < n; i++)
	{
		scanf("%d%d", col + i, w + i);
		vec[--col[i]].push_back(i);
		fa[i] = i;
	}
	for (int i = 0; i < n; i++)
	{
		if (vec[i].size())
			idx[cnt++] = i;
		std::sort(vec[i].begin(), vec[i].end(), [&] (const int &x, const int &y)
		{
			return w[x] < w[y];
		});
		for (int j = 1; j < vec[i].size() && w[vec[i][0]] + w[vec[i][j]] <= a; j++)
			unite(vec[i][0], vec[i][j]);
	}
	std::sort(idx, idx + cnt, [&] (const int &x, const int &y)
	{
		return w[vec[x][0]] < w[vec[y][0]];
	});
	for (int i = 0; i < n; i++)
	{
		if (cnt)
		{
			int x = vec[idx[0]][0];
			if (col[i] != col[x] && w[i] + w[x] <= b)
				unite(i, x);
		}
		if (cnt >= 2)
		{
			int x = vec[idx[1]][0];
			if (col[i] != col[x] && w[i] + w[x] <= b)
				unite(i, x);
		}
	}
	for (int i = 0; i < n; i++)
		bel[getfa(i)].push_back(i);
	ll ans = 1;
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < bel[i].size(); j++)
		{
			app[col[bel[i][j]]] = 0;
			ans = ans * (j + 1) % MOD;
		}
		for (int x : bel[i])
			ans = ans * quick_pow(++app[col[x]], MOD - 2) % MOD;
	}
	printf("%lld\n", ans);
	return 0;
}


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

int N, K, X, Y;

int main() {
    cin >> N >> K >> X >> Y;

    if (K <= N) {
        cout << K * X + (N-K) * Y << endl;
    }
    else {
        cout << N * X << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <complex>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;

vector<ll> join(vector<ll> &a, vector<ll> &b, int K) {
  vector<ll> v;
  for (int i = 0; i < a.size(); i++) {
    for (int j = 0; j < b.size(); j++) {
      v.push_back(a[i] + b[j]);
    }
  }
  sort(v.rbegin(), v.rend());
  if (v.size() > K) {
    v = vector<ll>(v.begin(), v.begin() + K);
  }
  return v;
}

int main() {
  ll N[3];
  ll K;

  cin >> N[0] >> N[1] >> N[2];
  cin >> K;

  vector<vector<ll>> vv;
  for (int i = 0; i < 3; i++) {
    vector<ll> v;
    for (int j = 0; j < N[i]; j++) {
      ll x;
      cin >> x;
      v.push_back(x);
    }
    vv.push_back(v);
  }

  vector<ll> vv01 = join(vv[0], vv[1], K);
  vector<ll> vv012 = join(vv01, vv[2], K);
  for (int i = 0; i < K; i++) {
    cout << vv012[i] << endl;
  }
}


Measured memory_bytes: 35232
#include <bits/stdc++.h>
#define rep(i, n) REP(i, 0, n)
#define REP(i, l, r) for (int i = l; i < r; ++i)
#define int long long
#ifdef DEBUG
#define dout cout
#else
std::stringstream dout;
#endif
using namespace std;
typedef pair<int, int> P;
struct edge {
    int to, cost;
};
// other libs
int gcd(int a, int b) {
    if (a % b == 0)
        return b;
    else
        return gcd(b, a % b);
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}

class dijkstra {
  private:
    int V;
    int d[100002];
    priority_queue<P, vector<P>, greater<>> que;

  public:
    dijkstra(int v, int s, vector<edge> G[]) {
        V = v;
        update(s, G);
    }

    void update(int s, vector<edge> G[]) {
        fill(d, d + V + 1, 100000000000ll);
        d[s] = 0;
        que.push(make_pair(0, s));
        while (!que.empty()) {
            P p = que.top();
            que.pop();
            int v = p.second;
            if (d[v] < p.first)
                continue;
            rep(i, G[v].size()) {
                edge e = G[v][i];
                if (d[e.to] > d[v] + e.cost) {
                    d[e.to] = d[v] + e.cost;
                    que.push(make_pair(d[e.to], e.to));
                }
            }
        }
    }

    int find(int e) {
        return d[e];
    }
};
template<typename T>
class Union_Find {
  private:
    vector<T> t, s;

  public:
    Union_Find(T max_length) {
        rep(i, max_length + 1) {
            t.push_back(i);
            s.push_back(1);
        }
    }

    void Union(T x, T y) {
        if (same(x, y))
            return;
        T tx = Find(x), ty = Find(y);
        if (s[tx] < s[ty]) {
            s[ty] += s[tx];
            t[tx] = ty;
        }
        else if (s[tx] > s[ty]) {
            s[tx] += s[ty];
            t[ty] = tx;
        }
        else if (tx > ty) {
            t[tx] = ty;
            s[ty] += s[tx];
        }
        else {
            t[ty] = tx;
            s[tx] += s[ty];
        }
    }
    T Find(T n) {
        if (t[n] == n)
            return n;
        else
            return t[n] = Find(t[n]);
    }

    bool same(T x, T y) {
        return Find(x) == Find(y);
    }

    T get_Size(size_t a) {
        return s[a];
    }
};
bool ifPrime(int n){
    if(n==1)
        return false;
    for (int i = 2; i * i <= n; i++) {
        if (n % i == 0)
            return false;
    }
    return true;
}
vector<int> primeFactorization(int n) {
    vector<int> re;
    int cnt = 2;
    while (n != 1) {
        if (n % cnt != 0) {
            cnt++;
            continue;
        }
        n /= cnt;
        re.push_back(cnt);
    }
    return re;
}
signed main(signed argc, char* argv[]) {
    int n,k,q;
    cin>>n>>k>>q;
    vector<int> vec(n,0);
    rep(i,q){
        int a;
        cin>>a;
        vec[a-1]++;
    }
    rep(i,n){
        if(q-vec[i]>=k)cout<<"No"<<endl;
        else cout<<"Yes"<<endl;
    }
}

Measured memory_bytes: 1408
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
using namespace std;

int main() {
    int N, M, C, ans = 0;
    cin >> N >> M >> C;
    vector<int>B(M);
    for (int i = 0; i < M; i++) {
        cin >> B[i];
    }
    for (int i = 0; i < N; i++) {
        int sum = 0;
        for (int j = 0; j < M; j++) {
            int a;
            cin >> a;
            sum += a*B[j];
        }
        if (sum + C > 0)ans++;
    }

    cout << ans;
    
    return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
done = [0]*n
ans = [0]*n
for i in range(m):
  s,c = map(int,input().split())
  if done[s-1] != 0 and ans[s-1] != c:
    print(-1)
    exit()
  elif n != 1 and s == 1 and c == 0:
    print(-1)
    exit()
  else:
    done[s-1] = 1
    ans[s-1] = c
ans_f = str()
for j in ans:
  ans_f += str(j)
if n>1 and ans_f[0] == "0":
  print("1"+ans_f[1::])
else:
  print(ans_f)

Measured memory_bytes: 9224
n, a, b = map(int, input().split())
mod = pow(10, 9) + 7
all = pow(2, n, mod) - 1

def comb(n, r):
  c = 1
  m = 1
  r = min(n-r, r)
  for i in range(r):
    c = c * (n - i) % mod
    m = m * (i + 1) % mod
  return c * pow(m, mod-2, mod) % mod

nca = comb(n, a)
ncb = comb(n, b)
all -= nca + ncb
print(all%mod)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <iomanip>
#include <bitset>
#include <cassert>
using namespace std;

typedef long long ll;

ll mod = 1e9 + 7;
ll cef[13][4];
ll dp[103][13];

int main() {
	ll h, w, k; cin >> h >> w >> k;
	cef[0][0] = 1;
	for (int i = 1; i <= w - 1; i++) {
		cef[i][0] = (cef[i - 1][0] + cef[i - 1][1]) % mod;
		cef[i][1] = cef[i - 1][0];
	}
	dp[0][1] = 1;
	for (int i = 0; i < h; i++) {
		for (int j = 1; j <= w; j++) {
			dp[i + 1][j] += (cef[j - 1][0] * cef[w - j][0] % mod)*dp[i][j] % mod;
			dp[i + 1][j] %= mod;
			for (int t = -1; t <= 0; t++) {
				if (!(1 <= j + t && j + t <= w)) continue;
				dp[i + 1][j + (t == 0 ? 1 : -1)] += (cef[j + t - 1][0] * cef[w - j - t - 1][0] % mod)*dp[i][j] % mod;
				dp[i + 1][j + (t == 0 ? 1 : -1)] %= mod;
			}
		}
	}
	cout << dp[h][k] << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * 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;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			String S = in.next();
			String ans = "Yes";
			for(int i = 0; i < S.length(); i+=2) {
				if(S.length() % 2 != 0) {
					ans = "No";
					break;
				}
				if(!S.substring(i, i + 2).equals("hi")) {
					ans = "No";
				}
			}
			System.out.println(ans);
		}
	}

	static boolean permutation_2(String s, String t) {
		if (s.length() != t.length()) {
			return false;
		}

		int[] letters = new int[256];

		char[] s_array = s.toCharArray();
		for (char c : s_array) {
			letters[c]++;
		}

		for (int i = 0; i < t.length(); i++) {
			int c = (int) t.charAt(i);
			if (--letters[c] < 0) {
				return false;
			}
		}
		return true;
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public char nextChar() {
			return next().charAt(0);
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

	}
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A,B;
  cin >> N >> A >> B;
  int max = 0, min = 0;
  if(A > B){
  	max = B;
  }else{
  	max = A;
  }
  
  min = - N + A + B;
  if(min < 0){
  	min = 0;
  }
  cout << max << " " << min << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
	    try (Scanner sc = new Scanner(System.in)) {
	        while (true) {
	            int n = sc.nextInt();
	            if (n == 0) { break; }
	            int[] scores = new int[n];
	            for (int i = 0; i < scores.length; i++) {
	                scores[i] = sc.nextInt();
                }
                double average = 0, variance = 0;
	            for (int i = 0; i < scores.length; i++) {
	                average += (double)scores[i] / scores.length;
                }
                for (int i = 0; i < scores.length; i++) {
                    variance += (double)Math. pow(scores[i]-average, 2.0) / scores.length;
                }
                System.out.println(Math.sqrt(variance));
            }
        }
    }
}



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

using namespace std;

int main () {
  int a, b, c;
  long long k;
  cin >> a >> b >> c >> k;
  
  if (k % 2LL == 0)  cout << a - b << endl;
  else cout << b - a << endl;
  return 0;
}

Measured memory_bytes: 256
N, Y = map(int, input().split())

# x:10000円, y;5000円, z:1000円
for x in range(N+1):
    for y in range(N+1):
        z = N - (x + y)
        if (z >= 0) & (10000*x + 5000*y + 1000*z == Y):
            print(x, y, z)
            exit(0)
            
print(-1, -1, -1)

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] > a[i - 1]) a[i]--;
  }
  for (int i = 1; i <= n; i++) {
    if (a[i] < a[i - 1]) {
      cout << "No" << '\n';
      return 0;
    }
  }
  cout << "Yes" << '\n';
}


Measured memory_bytes: 3988
n, a, b = map(int, input().split())

ans = pow(2,n,10**9+7)

bunshi = 1
bunbo = 1

for i in range(a):
    bunshi = (bunshi * (n-i)) % (10**9+7)
    bunbo = (bunbo * (i+1)) % (10**9+7)

ans = (ans - bunshi*pow(bunbo,-1,10**9+7) - 1) % (10**9+7)

for i in range(a,b):
    bunshi = (bunshi * (n-i)) % (10**9+7)
    bunbo = (bunbo * (i+1)) % (10**9+7)


ans = (ans - bunshi*pow(bunbo,-1,10**9+7)) % (10**9+7)

print(ans)

Measured memory_bytes: 9160
import sun.text.resources.cldr.ha.FormatData_ha;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

    static int X, Y;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        X = sc.nextInt();
        Y = sc.nextInt();

        System.out.println(solve());
    }

    static int solve() {
        if( Math.abs(Y) >= Math.abs(X) ) {
            int time = 0;
            if( Y < 0 ) time++;
            if( X < 0 ) time++;
            time += Math.abs(Y) - Math.abs(X);
            return time;

        } else {
            int time = 0;
            if( Y > 0 ) time++;
            if( X > 0 ) time++;
            time += Math.abs(X) - Math.abs(Y);
            return time;
        }
    }

    static int min(int... values) {
        int min = Integer.MAX_VALUE;
        for (int value : values) {
            min = Math.min(value, min);
        }
        return min;
    }

    @SuppressWarnings("unused")
    static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken("\n");
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


Measured memory_bytes: 23124