akhauriyash/Code-Regression huggingface dataset:
//Problem:
//Date:
//Skill:

#define CLR(a) memset((a),0,sizeof(a))
#define MAX 2140000000;
#define RE(i,n)  for(i=0;i<n;i++)
#define RE2(i,n) for(i=1;i<=n;i++)
#include<algorithm>
#include<iostream>
#include<time.h>
#include<string.h>

using namespace std;
int ans;

char map[110][110];
const int shift[4][2] = { 1,0,-1,0,0,1,0,-1 };
int dfs(int x, int y, char color)
{
	if (map[x][y] == 0)return 0;//碰壁

	if (color == 0)//初始
	{
		color = map[x][y];
		ans++;
	}

	if (map[x][y] != color)return 0;//边界

	//延展涂色
	map[x][y] = 0;

	int i;
	RE(i, 4)
	{
		dfs(x + shift[i][0], y + shift[i][1], color);
	}
	return 0;
}

//#define LOCAL
int main()
{
#ifdef LOCAL

	freopen("C:\\Users\\VULCAN\\Desktop\\data.in", "r", stdin);
	//	freopen("C:\\Users\\VULCAN\\Desktop\\data.out", "w", stdout);
#endif
	//这是一条帅气的分界线，写程序从这里开始吧

	int m, n;
	while (cin >> m >> n, m)
	{
		CLR(map);
		int i, j, k;

		RE2(i,m)//输入
			RE2(j,n)
		{
			cin >> map[i][j];
//			cout << map[i][j];
		}
		
		ans = 0;//开始条件
		RE2(i, m)
			RE2(j, n)
			dfs(i, j,0);//dfs开始

		cout << ans << endl;
	}


	








	//这是一条可爱的分界线
#ifdef LOCAL
	printf("用时%.3f秒\n", (double)clock() / CLOCKS_PER_SEC);
#endif
	return 0;
}







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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);


using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using mint = map<int, int>;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

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; }
template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    };
}fastio;

int main(){


    string s, t;
    cin >> s >> t;

    if(s.size() < t.size()){
        ppp("UNRESTORABLE");
        return 0;
    }
    int start = -1;
    for(int i = s.size()-t.size()+1; i >= 0; --i){
        bool ok = true;
        rep(j, t.size()){
            if(s[i+j] != t[j] and s[i+j] != '?') ok = (ok && false);
        }
        if(ok){
            start = i;
            break;
        }

    }
    if(start >= 0){
        rep(i, t.size()){
            s[i+start] = t[i];
        }
        rep(i, s.size()){
            if(s[i] == '?') s[i] = 'a';
        }
        ppp(s);
    }
    else{
        ppp("UNRESTORABLE");
    }

    return 0;
}


Measured memory_bytes: 256
d = tuple([1] + [6**i for i in range(1, 7)] + [9**i for i in range(1, 6)])
M = 10**6+1
B = [float("inf")]*M
B[0] = 0
for i in range(M):
  for j in d:
    if i+j < M:
      B[i+j] = min(B[i+j], B[i]+1)
n = int(input())
print(B[n])

Measured memory_bytes: 106460
def main():
    import sys
    def input():
        return sys.stdin.readline()[:-1]
    X=list(map(int,input().split()))
    A=X[0]
    B=X[1]
    C=X[2]
    K=int(input())
    for i in range(K):
        if A<B and B<C:
            print("Yes")
            sys.exit()
        if C<=A or C<=B:
            C=2*C
        else:
            B=2*B
    if A<B and B<C:
        print("Yes")
        sys.exit()                
    print("No")
if __name__ == '__main__':
    main()


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

int main(){
    bool f=false;
    int s,t;
    string S;
    cin>>S;
    int n = S.size();
    for(int i=0;i<n-1;i++){
        if(S[i]==S[i+1]){  
            f=true;
            s=i; t=s+1;
        }
    }
    for(int i=0;i<n-2;i++){
         if(S[i]==S[i+2]){
             f=true;
             s=i; t=s+2;
         }
    }
    if(f) cout<<s+1<<' '<<t+1<<endl;
    else cout<<-1<<' '<<-1<<endl;
    return 0;
}

Measured memory_bytes: 512
N = int(input())
l = [list(map(int, input().split())) for _ in range(N)]

diff = [0] * 100002
for k in l :
    diff[k[0] - 1] += 1
    diff[k[1]] -= 1

hist = [0,0]
for i in range(2, N + 2) :
    hist.append(hist[-1] + diff[i-1])

print(max([0] + [y - 1 for (x,y) in zip(hist, range(N + 2)) if x + 1 >= y]))

Measured memory_bytes: 38964
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define res(n) resize(n)
#define rev(v) reverse(v.begin(),v.end())
#define sor(v) sort(v.begin(),v.end())
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define ve vector
#define pq priority_queue
#define vi vector<int>
#define vl vector<long long>
#define vii vector<vector<int>>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1000000007;



int main()
{
    int N,M;
    cin >> N >> M;
    vl S(N);in(N,S);
    vl T(M);in(M,T);
    
    ve<ve<ll>> dp(N,ve<ll>(M,0));
    rep(i,M){
        if(i == 0){
            if(S[0] == T[0]) dp[0][0] = 1;
            continue;
        }
        
        if(S[0] == T[i]) dp[0][i] = dp[0][i-1]+1;
        else dp[0][i] = dp[0][i-1];
    }
    
    reps(i,1,N){
        if(S[i] == T[0]) dp[i][0] = dp[i-1][0] + 1;
        else dp[i][0] = dp[i-1][0];
        dp[i][0] %= mod;
        reps(j,1,M){
            if(S[i] == T[j]) dp[i][j] = dp[i-1][j] + dp[i][j-1] + 1;
            else dp[i][j] = (dp[i-1][j] + dp[i][j-1])%mod + mod - dp[i-1][j-1];
            dp[i][j] %= mod;
        }
        
    }

    out((dp[N-1][M-1]+1)%mod);

    /*
    rep(i,N){
        rep(j,M) cout << dp[i][j] << " ";
        cout << endl;
    }
     */

    return 0;
}


Measured memory_bytes: 31616
import scala.annotation.tailrec
object Main extends App {
  import scala.io.StdIn._
  val n = readInt()
  val interval = readLine.trim.split(' ').map(_.toLong)
  println((1 until 1 << n).count{pattern ⇒
    val (present, absent) = (0 until n).partition(i ⇒ (pattern & (1 << i)) != 0)
    val minSpan = present.map(interval).reduce(lcm)
    absent.forall(i ⇒ minSpan % interval(i) != 0)
  })
  @tailrec def gcd(a: Long, b: Long): Long = {
    b match {
      case 0 ⇒ a
      case _ ⇒ gcd(b, a % b)
    }
  }
  def lcm(a: Long, b: Long): Long = {
    a / gcd(a, b) * b
  }
}



Measured memory_bytes: 452328
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;

int main(){

    int n;
    cin >> n;

    vector<int> a(n);

    for(int i = 0;i < n; ++i){

        cin >> a[i];
        
    }

    sort(a.begin(),a.end());
    reverse(a.begin(), a.end());

    int al = 0,bo = 0;

    for(int i = 0; i < n;++i){

        if(i%2 == 0)al += a[i];
        else bo += a[i];

    }

    cout << al-bo << endl;

    return 0;
}

Measured memory_bytes: 256
#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 s, t;
	cin >> s >> t;
	bool ans = true;
	
	if(s.size() +1 != t.size())ans - false;
	
	zep(i, 0, s.size()){
		if(s[i] != t[i])ans = false;
	}
	
	print(ans? "Yes" : "No")
	
	return 0;
}

Measured memory_bytes: 3652
//By TheOneYouWant
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define leadzero(a) __builtin_clz(a) // count leading zeroes
#define trailzero(a) __builtin_ctz(a) // count trailing zeroes
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
#define ln endl
#define dbg(x) cerr<<#x<<" = "<<x<<endl
#define dbg2(x,y) cerr<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<endl;
#define dbgstl32(v) cerr<<#v<<" = \n"; { int c=0; forstl(it,v) \
cerr<<"    Term "<< ++c <<" = "<<it<<ln;} cerr<<endl
#define dbgstlp32(v) cerr<<#v<<" = \n"; { int c=0; forstl(it,v) \
cerr<<"    Term "<< ++c <<" = "<<it.fi<<" , "<<it.se<<ln;} cerr<<endl
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inp freopen("input.txt", "r", stdin)
#define outp freopen("output.txt", "w", stdout)
#define dbgm(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
typedef long long int  ll;
typedef long double  ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef vector<ll> v64;
typedef vector<int> v32; 
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM = 2e5+5, MOD = 1e9+7, EPS = 1e-9;
int t,n,m,k,x,y;
int main(){
	fastio;
	int n;
	cin>>n;
	ll dp[n]= {0};
	ll h[n] = {0};
	forn(i,n) cin>>h[i];
	dp[1] = abs(h[1]-h[0]);
	forsn(i,2,n){
		dp[i] = min(abs(h[i]-h[i-2])+dp[i-2],abs(h[i]-h[i-1])+dp[i-1]);
	}
	cout<<dp[n-1]<<ln;
	return 0;
}

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

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define fore(i, l, r) for (int i = int(l); i <= int(r); ++i)
#define ford(i, n) for (int i = int(n)-1; i >= 0; --i)
#define pb push_back
#define eb emplace_back
#define ms(a, x) memset(a, x, sizeof(a))
#define F first
#define S second
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#define de(x) cout<<#x<<" = "<<(x)<<endl
#define de2(x,y) cout<<#x<<" = "<<(x) <<' '<< #y<<" = "<<y<<endl;

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());
ll nxt(){ll x;cin>>x;return x;}

const int N=3e3+5;
int dp[N][N];
const int mod=998244353;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
	int n,s;
	cin>>n>>s;
	ll ans=0;
	for1(i,n){
		int x;
		cin>>x;
		dp[i][x]=i;
		for(int j=0;j<=s;j++){
			(dp[i][j]+=dp[i-1][j])%=mod;
			if(j-x>=0) (dp[i][j]+=dp[i-1][j-x])%=mod;
		}
		ans=(ans+dp[i][s])%mod;
	}
	cout<<ans;
    return 0;
}

Measured memory_bytes: 35456
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define stop char nyaa;cin>>nyaa;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

using P = pair<int, int>;

bool e1[3001], e2[3001];

bool isl(P a, P b) {
	return a.first*b.second < a.second*b.first;
}
void solve() {
	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	e1[0] = true; e2[0] = true;
	rep(i, 3001) {
		if (e1[i]) {
			if (i + a * 100 <= 3000)e1[i + a * 100] = true;
			if (i + b * 100 <= 3000)e1[i + b * 100] = true;
		}
		if (e2[i]) {
			if (i + c <= 3000)e2[i + c] = true;
			if (i + d <= 3000)e2[i + d] = true;
		}
	}
	P ma = { 0,1 };
	int c1 = 100*a, c2 = 0;

	for (int i = 0; i <= f; i += 100) {
		if (!e1[i])continue;
		for (int j = 0; j + i <= f&& j <= (i / 100)*e; j++) {
			if (!e2[j])continue;
			P p = { j,i + j };
			if (isl(ma, p)) {
				ma = p;
				c1 = i+j, c2 = j;
			}
		}
	}
	cout << c1 << " " << c2 << endl;
}


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


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

int main() {
	int N, evacuation,num;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}

	for (int i = 0; i < N; i++) cout << A[i] << ((i == N - 1) ? '\n' : ' '); //出力している

	for (int j = 1; j < N; j++) {
		evacuation = A[j];
		num = j - 1;

		while (num>=0 && A[num] > evacuation)
		{
			swap(A[num], A[num + 1]);
			num--;
		}

		for (int i = 0; i < N; i++) cout << A[i] << ((i == N - 1) ? '\n' : ' '); //出力している
	}

	return 0;
}




Measured memory_bytes: 3120
N, Z, W = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)
 
if N == 1
  puts ( A[0] - W ).abs
  exit
end
 
e = ( A[-1] - W ).abs
b =  ( A[-2] - A[-1] ).abs 
 
puts e > b ? e : b

Measured memory_bytes: 1788
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace abc093_c
{
    class program
    {
        static void Main(string[] args)
        {
            ChangeLocalDebugInput();
            string[] input = Console.ReadLine().Split(' ');

            List<int> l = new List<int>(3);
            l.Add(int.Parse(input[0]));
            l.Add(int.Parse(input[1]));
            l.Add(int.Parse(input[2]));
            l.Sort((int a, int b)=>b-a);

            int count = 0;

            while (l[0] >= l[1])
            {
                l[1] += 2;
                if (l[1] > l[0])
                {
                    l[1] -= 2;
                    break;
                }
                count++;
            }
            while (l[0] >= l[2])
            {
                l[2] += 2;
                if (l[2] > l[0])
                {
                    l[2] -= 2;
                    break;
                }
                count++;

            }
            if (l[0] == l[1] && l[0] == l[2])
            {
            } else if (l[0] != l[1] && l[0] != l[2])
            {
                count++;
            } else
            {
                count += 2;
            }
            Console.WriteLine(count);

            Console.ReadKey();
        }


        [System.Diagnostics.Conditional("LOCAL_DEBUG")]
        static void ChangeLocalDebugInput()
        {
            Console.SetIn(new System.IO.StreamReader("../../stdin.txt"));
        }
    }
}


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

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

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    string s,t;
    cin >> s >> t;
    int n = s.size(),m = t.size();
    vector<vector<int>> dp(n+1,vector<int>(m+1,0));
    for (int i = 0;i < n;++i) for (int j = 0;j < m;++j) {
        if (s[i] == t[j]) dp[i+1][j+1] = max(max(dp[i][j+1],dp[i+1][j]),dp[i][j]+1);
        else dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j]);
    }
    string ans = "";
    int i = n,j = m;
    while (i > 0 || j > 0) {
        if (i && dp[i][j] == dp[i-1][j]) i--;
        else if (j && dp[i][j] == dp[i][j-1]) j--;
        else {
            ans += s[i-1];
            i--;
            j--;
        }
    }
    reverse(ans.begin(),ans.end());
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 35584
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    int D = sc.nextInt();
    int X = sc.nextInt();

    int[] A = new int[N];

    for (int i = 0; i < N; i++) {
      A[i] = sc.nextInt();
    }

    sc.close();

    int count = 0;

    for (int i = 0; i < N; i++) {
      
      int j = 1;
      int k = 2;

      while (j <= D) {

        if (j == 1) {
          count++;
        } else if (((k-1) * A[i] + 1) == j) {
          count++; 
          k++;
        }

        j++;
      }

    }

    System.out.println(count + X);

  }

}

Measured memory_bytes: 20820
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int a[N];
int main()
{
    int n,k;
    cin >> n >> k;
    int ans = 0;
    while(n >= 1)
    {
        n /= k;
        ans++;
    }
    cout << ans;
    return 0;
}

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

/*
*****************code written By**********************
..................Marajul islam.......................
...................BSMRSTU,CSE........................
*/

int sc1() {int x; scanf("%d", &x); return x;}

long long sc2() {long long x; scanf("%lld", &x); return x;}



#define  gcd(a,b)         __gcd(a,b)
#define  lcm(a,b)         (a*b)/gcd(a,b)
#define  Int              sc1()
#define  LL               sc2()
#define  For(n)           for(int i=0;i<n;i++)
#define  Forj(n)          for(int j=0;j<n;j++)
#define  Fork(n)          for(int k=0;k<n;k++)
#define  For1(n)          for(int i=1;i<=n;i++)
#define  ll               long long
#define  vi               std::vector<int>
#define  vll              std::vector<ll>
#define  qui              qu
#define  pb               push_back
#define  mpsi             std::map<string, int>


const int mod           = 1e9 + 7;
const int inf           = (int)2e9 + 5;
const ll  Inf           = (ll)1e18 + 5;
const int N             = 5e6 + 5;

inline int add(int a, int b) {a += b; return a >= mod ? a - mod : a;}
inline int sub(int a, int b) {a -= b; return a < 0 ? a + mod : a;}
inline int mul(int a, int b) {return (ll)a * b % mod;}
int gcdExtended(int a, int b, int *x, int *y);

ll  modInverse(int a, int m)
{
    int x, y;
    int g = gcdExtended(a, m, &x, &y);
    if (g != 1)
        return 0;
    else
    {
        // m is added to handle negative x
        int res = (x%m + m) % m;
        return res;
    }
}

// C function for extended Euclidean Algorithm
int gcdExtended(int a, int b, int *x, int *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    int x1, y1; // To store results of recursive call
    int gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

long long binpow(long long a, long long b) {
	if (b == 0)
		return 1;
	long long res = binpow(a, b / 2);
	if (b % 2)
		return (res % mod * res % mod * a % mod) % mod;
	else
		return (res % mod * res % mod) % mod;
}

ll fact(ll n){
	ll ans=1;
	for(ll i=1;i<=n;i++){
		ans=((ans % mod) * (i%mod))%mod;
	}
	return ans;
}

ll ncr(ll n,ll r,ll m){
	ll pk=n-r;
	if(r>=pk){
		ll fn=1;
		for(int i=r+1;i<=n;i++){
			fn=(fn%mod*i%mod)%mod;
		}
		ll rn=fact(pk);
		ll ppk=modInverse(rn, mod); 
		return (ppk%mod*fn%mod)%mod;
	}
	else{
		ll fn=1;
		for(int i=pk+1;i<=n;i++){
			fn=(fn%mod*i%mod)%mod;
		}
		ll rn=fact(r);
		ll ppk=modInverse(rn, mod); 
		return (ppk%mod*fn%mod)%mod;

	}
}

int solve() {

	ll n = LL, a = LL, b = LL;

	ll ans = binpow(2, n);
	ans = sub(ans, 1);
	// cout<<ans<<endl;

	ll ax=ncr(n,a,mod);
	ll bx=ncr(n,b,mod);
	// cout<<ax<<" "<<bx<<endl;
	ans=sub(ans,ax);
	ans=sub(ans,bx);
	cout<<ans<<endl;


	return 0;
}




int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	int test = 1, tc = 0;
	//scanf("%d", &test);
	//cin >> test;
	while (test--) {
		//printf("Case %d: ", ++tc);
		solve();
	}

	return 0;




}




Measured memory_bytes: 256
import sys
input = sys.stdin.readline

A,B,C=map(int,input().split())
K=int(input())

ANS=0

while B<=A:
    B*=2
    ANS+=1

while C<=B:
    C*=2
    ANS+=1

if ANS<=K:
    print("Yes")
else:
    print("No")


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            
            var imp = int.Parse(Console.ReadLine());

            Console.Write((imp + 1) * imp / 2);

        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector<int> vecA(3);
  for (int i=0; i < 3; i++){
      cin >> vecA.at(i);
  }
  sort(vecA.begin(), vecA.end());
  cout << vecA.at(2)-vecA.at(0) << endl;
}

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

int main(){
    int n;
    string s;
    cin >> n;
    cin >> s;
    for(int i=0;i<s.size();i++){
        int x = s[i] - 'A';
        x = (x+n)%26;
        cout << char('A'+x);
    }
    cout << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	 
	int a = 0;
	int b = 0;
	int c = 0;
	int ris = 0;

	cin >> a;
	cin >> b;
	cin >> c;

	for (int i = a; i <= b; i++) {
	
		if (c % i == 0) {
			ris++;
		}

	}

	cout << ris << endl;

	return 0;
}


Measured memory_bytes: 3088
# 140 B

n = int(input())
s = input()
num = 0

for i in range(len(s)):
    if s[i] == 'A':
        try:
            if s[i + 1] == 'B' and s[i + 2] == 'C':
                num += 1
        except:
            pass

print(num)

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

int main(){
  int n,k,q; cin>>n>>k>>q;
  vector<int> num(n,0);
  for(int i=0;i<q;i++){
    int a; cin>>a;
    a--; num[a]++;
  }
  for(int i=0;i<n;i++){
    if(0<k-q+num[i]){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }
}

Measured memory_bytes: 1024
import java.util.Scanner;
public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		long L=stdIn.nextLong();
		long R=stdIn.nextLong();
		long A[]=new long[2019];
		long min=2019,z=L,y=0;
		int x=0,w=0,v=0;
		while(z<=R){
			if(z==L)
				y=z%2019;
			if(z!=L&&z%2019==y)
				break;
			A[x]=z%2019;
			x++;
			z++;
		}z=L;
		while(w<x){
			v=w+1;
			while(v<x){
				long c=(A[w]*A[v])%2019;
				if(c<min)
					min=c;
				v++;
			}
			w++;
		}
		System.out.println(min);
	}
}

Measured memory_bytes: 23764
#include<iostream>
#include<algorithm>
#include<math.h>
using namespace std;
int main()
{
	long long n, m, ret=0;
	scanf("%lld%lld", &n, &m);
	if(n <= m / 2)
	{
		m -= n * 2;
		ret += n;
		ret += m / 4; 
	}else{
		ret += m / 2;
	}
	printf("%lld", ret);
	return 0;
} 

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

void solve()
{
	string s;
	int res = 0;
	cin >> s;
	for (int i = 0; i < s.length(); i++)
  	{
        int count = 0, j = i;
        while (j < s.length() && s[j] == 'R')
        {
        	j++; count++;
        }
        if (count > res) res = count;
    }
	cout << res;
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	solve();
}

Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(ll i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
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; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll,ll> P;
typedef long double ld;

constexpr int MOD = 1000000007;

// + - * / ^
int mod(int a)
{
	int res = a % MOD;
	if(res < 0) {
		return res + MOD;
	}
	return res;
}
int mul_mod(int a, int b)
{
	ll res = ((ll)a * (ll)b) % MOD;
	return mod((int)res);
}
int pow_mod(int a, int b)
{
	ll res = 1;
	while (b > 0) {
		if(b & 1) {
			res = res * (ll)a % (ll)MOD;
		}
		a = mul_mod(a, a);
		b >>= 1;
	}
	return (int)res;
}
int inv_mod(int a)
{
	return pow_mod(a, MOD - 2);
}
int div_mod(int a, int b)
{
	return mul_mod(a, inv_mod(b));
}

// ! C
constexpr int FAC_MAX = 200000;
ll fac[FAC_MAX], finv[FAC_MAX], inv[FAC_MAX];
void com_init()
{
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < FAC_MAX; i++){
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
ll com_mod(int a, int b){
	if (a < b) return 0;
	if (a < 0 || b < 0) return 0;
	return fac[a] * (finv[b] * finv[a - b] % MOD) % MOD;
}

map<int, int> prime_factor(int n) {
	map<int, int> ret;
	for (int i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	com_init();
	int n, m, ans = 1;
	cin >> n >> m;
	for (auto p : prime_factor(m)) {
		ans = mul_mod(ans, com_mod(p.second + n - 1, n - 1));
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    string S; cin >> S;
    int N = S.size();
    REP(i,N-1) {
        if(S[i] == '?') {
            if(S[i+1] == 'D') S[i] = 'P';
            else if(S[i+1] == '?') {
                S[i] = 'P';
                S[i+1] = 'D';
            } else S[i] = 'D';
        } else if(S[i] == 'P') if(S[i+1] == '?') S[i+1] = 'D';
    }
    if(S[N-1] == '?') S[N-1] = 'D';
    cout << S << endl; 
}


Measured memory_bytes: 3724
L = input()
#dp1[k] := k桁目までを確定させ、その時点でA+BがL以下が確定
#dp2[k] := k桁目までを確定させ、その時点でA+BがL以下が確定していない
dp1 = [0 for i in range(len(L))]
dp2 = [0 for i in range(len(L))]
mod = 10**9 + 7
dp1[0] = 1 # A,Bの最上位bitが(0,0)
dp2[0] = 2 # A,Bの最上位bitが(0,1), (1,0)の二通り
#最上位bitを(1,1)にしてしまうと、Lを超えてしまうのでない
for i in range(1,len(L)):
    #dp1の更新から行う
    if L[i] == '1':
        dp1[i] = dp1[i-1] * 3 + dp2[i-1]
        dp2[i] = dp2[i-1] * 2
    else:
        dp1[i] = dp1[i-1] * 3
        dp2[i] = dp2[i-1]
    dp1[i] %= mod
    dp2[i] %= mod
print((dp1[-1] + dp2[-1]) % mod)


Measured memory_bytes: 46452
#include<stdio.h>

int main(){
        int a,b;
        int s;

        while(scanf("%d",&a) != EOF){
                int count = 0;
                int ab = 0;
                scanf("%d",&b);

                ab = a + b;

                for(s = 1;1 ; s*=10){
                        if(ab / s > 0){
                                count ++;
                        }else{
                                break;
                        }
                }

                printf("%d\n",count);   
        }               

        return 0;
}

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl




typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 1e6 + 5;





int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  
    string s;
    cin>>s;
    for (char c: s) {
	if (c=='7') out("Yes");
    }

    out("No");
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

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

    vector<int> vA(A),vB(B);
    int minA=INT_MAX,minB=INT_MAX;
    rep(a,0,A){
        cin>>vA.at(a);
        minA=min(minA,vA.at(a));
    }
    rep(b,0,B){
        cin>>vB.at(b);
        minB=min(minB,vB.at(b));
    }

    uint64_t minP=minA+minB;
    rep(m,0,M){
        int x,y,c;
        cin>>x>>y>>c;

        uint64_t price=vA.at(x-1)+vB.at(y-1)-c;
        minP=min(minP,price);
    }

    cout<<minP<<endl;
}

Measured memory_bytes: 1024
n = int(input())
A = [int(i) for i in input().split(" ")]

avg=[]
for i in range(len(A)):
    avg.append(A[i]-(i+1))
avg.sort()
b=avg[int(n/2)]

sum = 0
for j in range(len(A)):
    sum += abs(A[j]-(b+j+1))

print(sum)


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

signed main() {
  string s, t;
  cin >> s >> t;

  int n = (int)s.size();
  int m = (int)t.size();

  int ans = n;
  for (int i = 0; i + m <= n; i++) {
    string sub = s.substr(i, m);
    int cnt = 0;
    for (int j = 0; j < m; j++) {
      if(sub[j] != t[j]) cnt++;
    }
    ans = min(ans, cnt);
  }
  cout << ans << '\n';
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
//const long double EPS = 1e-14;
const int INF = (1<<30)-1;
//const ll INF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main () {
  int n, m, x;
  cin >> n >> m >> x;
  vi a(m);
  rep(i,m) cin >> a[i];
  
  int costl = 0;
  int costr = 0;
  rep(i,m) {
    if (a[i] < x) costl++;
    else costr++;
  }
  int ans = min(costl, costr);
  cout << ans << endl;
  return 0;
}

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

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, a, b) for (int i = (int)(a); i >= (int)b; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, r, l) for (int i = (r); i >= (l); i--)
#define ms(x, y) memset(x, y, sizeof(x))
 
using namespace std;
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int a = 0, ab = 0, abc = 0;
int n;
string s;
 
int main() {
	ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("in", "r", stdin);
#endif
	
	cin >> n;
	cin >> s;
	forn(i, n - 2) {
		if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') ++abc;
	}
	cout << abc << '\n';

		
#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<deque>
using namespace std;

deque<int> deq;

void push(int _d, int _x){
    if(_d==0){
        deq.push_front(_x);
    }else if(_d==1){
        deq.push_back(_x);
    }
}

void randomAccess(int _p){
    printf("%d\n", deq[_p]);
}

void pop(int _d){
    if(_d==0){
        deq.pop_front();
    }else if(_d==1){
        deq.pop_back();
    }
}

int main(){

    int q;
    scanf("%d",&q);

    for(int i=0; i<q; i++){
        int a;
        scanf("%d", &a);

        if(a==0){
            int d, x;
            scanf("%d %d", &d, &x);
            push(d, x);
        }else if(a==1){
            int p;
            scanf("%d", &p);
            randomAccess(p);
        }else if(a==2){
            int d;
            scanf("%d", &d);
            pop(d);
        }
    }
    return 0;
}


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

#define rep(i,n) for (decay_t <decltype (n)> i = 0, i ## __len = (n); i < i ## __len; ++ i)

auto main () -> int
{
  cin.tie (nullptr);
  ios::sync_with_stdio (false);

  size_t n;
  cin >> n;

  vector <int> w (n);
  for (auto && elem : w) cin >> elem;

  auto left = 0;
  auto right = accumulate (begin (w), end (w), typename iterator_traits <decltype (begin (w))>::value_type {});

  auto ans = static_cast <int> (1e9);
  ans = min (ans, abs (left - right));

  rep (i, n)
  {
    left += w [i];
    right -= w [i];
    ans = min (ans, abs (left - right));
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <utility>

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)

int main()
{
	int a, b, c, d;
	while (cin >> a >> b)
	{
		int ans;
		c = a + b;
		d = 10;
		FOR(i, 1, 10)
		{
			if (c / d == 0) break;
			d *= 10;
			ans = i;
		}
		cout << ans + 1 << endl;
	}
	return 0;
}

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

#define mod 1000000007
#define maxn 100005

ll n;

int main()
{
    //freopen("monotonic.in", "r", stdin);
    //freopen("monotonic.out", "w", stdout);
    cin >> n;
    ll ans = LLONG_MAX;
    for (ll i = 1; i * i <= n; i++)
    {
        if (n % i != 0)
            continue;
        ans = min(ans, i + n / i - 2);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <queue>
#include <map>

using namespace std;


int n;
int a[16];
int x[20][20];
int y[20][20];
int ans=0;
int per[20];

int fin(int now,int cnt){
    if(now==n){
        for (int i=0;i<n;++i)
        if (per[i]){
            for (int j=0;j<a[i];++j)
                if ( per[x[i][j]]!=y[i][j] )
                    return 0;
        }
        if (cnt>ans) ans=cnt;
        return 0;

    }
    per[now]=0;fin(now+1,cnt);
    per[now]=1;fin(now+1,cnt+1);

}




int main()
{
    scanf("%d",&n);
    for (int i=0;i<n;++i){
        scanf("%d",&a[i]);
        for (int j=0;j<a[i];++j){
            scanf("%d%d",&x[i][j],&y[i][j]);
            x[i][j]--;
        }
    }
    fin(0,0);
    printf("%d\n",ans);

}









Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	string S, L = "zyxwvutsrqponmlkjihgfedcba";
	int len;

	cin >> S;
	len = S.length();

	if (S == L) cout << -1 << endl;
	else if (len < 26) {
		char add = '#';

		for (char c = 'a'; c <= 'z'; c++) {
			rep(i, len) {
				if (S[i] == c) break;
				else if (i == len - 1) add = c;
			}
			if (add != '#') break;
		}

		cout << S << add << endl;
	}
	else {
		string ans;
		char add;
		map<char, bool> mp;

		rrep(i, len) {
			mp[S[i]] = true;
			if (S[i - 1] < S[i]) {
				ans = S.substr(0, i - 1);
				for (char c = S[i - 1] + 1; c <= 'z'; c++) {
					if (mp.count(c) > 0) {
						add = c;
						break;
					}
				}

				break;
			}
		}

		cout << ans << add << endl;
	}

	return 0;
}


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

int main() {
  int N; cin >> N; // 入力数値の数
  map<int,int> M;  // 各数値入力数
  string Ans ="YES";  // 回答：重複すれば NO
  
  int tmp_I;
  rep(i,N){
    cin >> tmp_I;
    M[tmp_I]++;           // 投票数をカウント
    if ( M[tmp_I] > 1 ) {
      cout << "NO" << endl;
      return 0;
    }
  }

  cout << "YES" << endl;

}


Measured memory_bytes: 9600
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
  moves = input().strip()
  moves = moves.replace('RL', 'EE')
  counts = [1] * len(moves)

  for i in range(len(moves) - 2):
    if moves[i] == 'R':
      counts[i + 2] += counts[i]
      counts[i ] = 0

    if moves[len(moves) - i - 1] == 'L':
      counts[len(moves) - i - 3] += counts[len(moves) - i - 1]
      counts[len(moves) - i - 1] = 0

  print(' '.join(map(str, counts)))


if __name__ == '__main__':
  main()


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

void solve()
{
	int n;
	cin >> n;
	vector<int> a(n + 1);

	for(int i = 1; i < n; ++i)
	{
		int in;
		cin >> in;
		a[in]++;
	}

	for(int i = 1; i <= n; ++i)
	{
		cout << a[i] << endl;
	}
}

int main()
{
	solve();

	return 0;
}


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

money = 1000
kabu = 0
for i in range(n-1):
    if a[i] < a[i+1]:
        kabu += money//a[i]
        money %= a[i]
    else:
        money += kabu * a[i]
        kabu = 0

if kabu > 0:
    money += kabu*a[n-1]
print(money)

Measured memory_bytes: 61928
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = (n) - 1; i > -1; i--)
#define rep1(i, n) for(int i = 1; i < (int)(n + 1); i++)
#define rep1R(i, n) for(int i = (n); i > 0; i--)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

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


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define IN_NUM 2000
int main()
{
  char in[IN_NUM];
  
  fgets(in, IN_NUM, stdin);
  char* p1 = strtok(in, " ");
  int N = atoi(p1);
  
  p1 = strtok(NULL, " ");
  int M = atoi(p1);
   
  //printf("%d %d\n", N, M);
  fgets(in, IN_NUM, stdin);
  
  int A[1000] = {0};
  double sum = 0;
  int AN = 0;
  for(char* p = strtok(in, " "); p; p = strtok(NULL, " "), AN++) {
    A[AN] = atoi(p);
    sum += A[AN];
     //printf("%d\n", A[AN]);
  }
  
  int A1 = 0;
  for(int i = 0; i < N; i++) {
     double test = (sum / (4 * M));
     //printf("%d < %lf ? \n", A[i], test);
    if(A[i] < test) { continue; }
     
     A1++;
  }
  //printf("%d\n", A1);
  if(A1 >= M) { printf("Yes"); }
  else        { printf("No");  }
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)


int main(){
  int x,a,b,c;
  int ans = 0;
  cin >> a >> b >> c >> x;
  for (int i = 0;i <= a;i++){
    for (int j = 0; j <= b;j++){
      for (int k = 0; k <= c;k++){
        if (500*i+100*j+50*k == x){
          ans++;
        }
      }
    }
  }
  cout << ans << endl;

  return 0;

}

Measured memory_bytes: 256
N=int(input())
p=list(map(int, input().split()))
#print(N, p)
p.append(N*2)
count=0
i=0
while i<=N-1:
    if i+1==p[i]:
        #print(i, p[i-1])
        if i+2==p[i+1]:
            count+=1
            i+=1
        else:
            count+=1
    i+=1
print(count)




Measured memory_bytes: 14008
#include <vector>
#include <math.h>
#include <iostream>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i;<n i++)
#define rep_s(i, start, n) for(int i= start, i<n, i++)


int main(void){
int X, Y;
  cin >> X>>Y;
  int count = 0;
  if (X == 1){
    count += 3e+5;
  } else if (X == 2){
    count += 2e+5;
  } else if(X==3){
    count += 1e+5;
  }
   if (Y == 1){
    count += 3e+5;
  } else if (Y == 2){
    count += 2e+5;
  } else if(Y==3){
    count += 1e+5;
  }
  if (X==1 && Y==1){
    count += 4e+5;
  }
  cout << count << endl;

}


Measured memory_bytes: 256
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素


vector<ll> divosor(ll n){
  vector<ll> ret;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0){
      ret.push_back(i);
      if(i*i!=n)ret.push_back(n/i);
    }
  }
  return ret;
}


bool IsPrime(ll num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (ll i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

signed main(){
  int N;
  cin>>N;
  vector<ll> num_list(N);
  vector<bool> bool_list(1000001,true);
  for(ll i = 0; i < N;i++){
    cin>>num_list[i];
  }
  sort(num_list.begin(), num_list.end());
  int ans=0;

  for(int i = 0; i < N;i++){
    if(bool_list[num_list[i]]){
      if(i+1<N){
        if(num_list[i]!=num_list[i+1]){
          ans++;
        }
      }else{
        ans++;
      }

    }else{
      continue;
    }
    ll index=1;
    while(index*num_list[i]<1000001){
      bool_list[index*num_list[i]]=false;
      index++;
    }
  }
  cout<<ans<<endl;


}

Measured memory_bytes: 4800
// AUTHOR: ROSHAN SRIVASTAVA
// WEBSITE: https://www.youtube.com/channel/UC6uQdd7kLLOdlHSVklhV7Cw

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007


vector<int> G[200009];
bool vis[200009];

int solve(int x, int par) {
    vis[x] = true;
    int ans = 1;
    for(auto n: G[x]) {
        if(n == par) continue;
        if(vis[n]) continue;
        ans += solve(n, x);
    }
    return ans;
}

int main(){

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    memset(vis, false, sizeof vis);
    int n, m;
   cin >> n >> m;
   for(int i = 0; i < m; i++ ){
    int u, v;
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
   }

   int ma = -1;
   for(int i  = 1; i <= n; i++) {
    if(!vis[i]) {
        ma = max(ma, solve(i , -1));
    }
   }
   cout << ma << endl;

    return 0;
}

Measured memory_bytes: 27148