akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/hash_map>
#include <ext/numeric>

using namespace std;
using namespace __gnu_cxx;

#define REP(i,n) for( (i)=0 ; (i)<(n) ; (i)++ )
#define rep(i,x,n) for( (i)=(x) ; (i)<(n) ; (i)++ )
#define REV(i,n) for( (i)=(n) ; (i)>=0 ; (i)-- )
#define FORIT(it,x) for( (it)=(x).begin() ; (it)!=(x).end() ; (it)++ )
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define rforeach(it,c) for(__typeof((c).rbegin()) it=(c).rbegin();it!=(c).rend();++it)
#define foreach2d(i, j, v) foreach(i,v) foreach(j,*i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define SZ(x) ((int)(x).size())
#define MMS(x,n) memset(x,n,sizeof(x))
#define mms(x,n,s) memset(x,n,sizeof(x)*s)
#define pb push_back
#define mp make_pair
#define NX next_permutation
#define UN(x) sort(all(x)),x.erase(unique(all(x)),x.end())
#define CV(x,n) count(all(x),(n))
#define FIND(x,n) find(all(x),(n))-(x).begin()
#define ACC(x) accumulate(all(x),0)
#define PPC(x) __builtin_popcountll(x)
#define LZ(x) __builtin_clz(x)
#define TZ(x) __builtin_ctz(x)
#define mxe(x) *max_element(all(x))
#define mne(x) *min_element(all(x))
#define low(x,i) lower_bound(all(x),i)
#define upp(x,i) upper_bound(all(x),i)
#define NXPOW2(x) (1ll << ((int)log2(x)+1))
#define PR(x) cout << #x << " = " << (x) << endl ;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<int, int> pii;

const int OO = (int) 2e9;
const double eps = 1e-9;

const int N = 102;
const int C = 100005;

int n, W;
int w[N], v[N];
ll dp[N][C];

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
//	freopen("in.txt", "rt", stdin);
//	freopen("out.txt", "wt", stdout);
#endif
	cin >> n >> W;
	for (int i = 0; i < n; i++)
		cin >> w[i] >> v[i];
	for (int i = n - 1; i >= 0; i--) {
		for (int c = W; c >= 0; c--) {
			dp[i][c] = dp[i + 1][c];
			if (c + w[i] <= W)
				dp[i][c] = max(dp[i][c], dp[i + 1][c + w[i]] + v[i]);
		}
	}
	cout << dp[0][0] << endl;
	return 0;
}


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

typedef long long ll;
using namespace std;

using namespace std;
 
int main() {
  int A, B, K;
  cin >> A >> B >> K;
 
  int cnt = 0;
  for (int i = 100; i > 0; --i) {
    if ((A % i == 0) && (B % i == 0)) cnt++;
 
    if (cnt == K) {
      cout << i << endl;
      break;
    }
  }
}

Measured memory_bytes: 256
/* Simplicity and Goodness */

#include <bits/stdc++.h>
using namespace std;
#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define deb(x) cout << #x << " = " << x << ' ';
#define rep(i, a, b) for(int i=(int)(a); i<(int)(b); i++)
#define tc int tt; scn(tt); while(tt --)
#define pb push_back
#define mp make_pair
#define F first
#define S second
using ll = long long;
const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 998244353;
const int N = 2e5+2;


int main()
{
    string s;
    cin >> s;

    rep(i, 0, s.size()) {
        if(s[i] != '?')
            cout << s[i];
        else
            cout << 'D';
    }
    
    return 0;
}

Measured memory_bytes: 3752
#include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int r;

int main() {
  cin >> r;
  cout << r * r << endl;

  return 0;
}


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

int main()
{
    string S, T;
    cin >> S >> T;
    if (S == T.substr(0, T.size() - 1))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3640
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <cmath>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
const ll MOD = 998244353;

#define M 1000000007;

int main() {
    ll n, m;
    cin >> n >> m;
    vector<ll> A(m);
    for (auto & a : A) {
        cin >> a;
    }
    vector<ll> dp(n+1, 0);
    dp[0] = 1;
    dp[1] = 1;
    for (auto & a : A) {
        dp[a] = -1;
    }
    for (ll i = 2; i <= n; ++i) {
        if (dp[i] < 0) continue;
        if (dp[i-1]>0) dp[i] += dp[i-1];
        if (dp[i-2]>0) dp[i] += dp[i-2];
        dp[i] %= M;
    }
    //for (ll i = 0; i <= n; ++i) {
    //    cout << i << ": " << dp[i] << endl;
    //}
    cout << dp[n] << endl;
}


Measured memory_bytes: 1792
def count_ball(n, a, b):
    if n%(a+b) < a:
        print((n//(a+b))*a + n%(a+b))
    else:
        print((n//(a+b))*a + a)

n, a, b = [int(i) for i in input().split()]

count_ball(n, a, b)

Measured memory_bytes: 38384
N,M = map(int, input().split())
*H, = map(int, input().split())

V = []
for node in range(N):
    V.append(set())
for _ in range(M):
    a,b = map(int, input().split())
    V[a-1].add(b-1)
    V[b-1].add(a-1)

ans = 0
for node in range(N):
    Hi = H[node]
    flg = 0
    for next_node in V[node]:
        if Hi>H[next_node]:
            continue
        flg = 1
    if flg==0:
        ans = ans + 1
    elif len(V[node])==0:
        ans = ans + 1
print(ans)

Measured memory_bytes: 45200
import itertools
from collections import Counter
import bisect
N = int(input())

lst = ['3','5','7']
anslst = []
for i in range(1,10):
    for v in itertools.product(lst,repeat=i):
        x = Counter(str(v))
        if x['7'] >= 1 and x['5'] >= 1 and x['3'] >= 1:
            anslst.append(int(''.join(v)))
anslst.sort()
index = bisect.bisect_right(list(anslst), N)
print(index)


Measured memory_bytes: 10600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF = 1e18+18;
const ll MAX = 100005;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;


int main(){
    ll N, K;
    cin>>N>>K;
    vector<ll> D(K);
    for(int i=0; i<K; i++){
        cin>>D[i];
    }
    for(ll i=N; i<=N*10; i++){
        ll II=i;
        bool C=false;
        while(II>0){
            for(int j=0; j<K; j++){
                C=binary_search(D.begin(), D.end(), II%10);
                if(C)break;
            }
            if(C)break;
          	II/=10;
        }
        if(!C){
            cout<<i<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N, A;
    int need_coin;
    
    cin >> N >> A;

    need_coin = N % 500;

    if(need_coin > A){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }





}

Measured memory_bytes: 3568
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<string>
#include<sstream>
using namespace std;
int inf = 1000000000;

int main(){

  int n; cin >> n;
  if( n <= 999 ) cout << "ABC" << endl;
  else cout << "ABD" << endl;

  return 0;
}

//


Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}

int main(){
int n;
cin>>n;
vector<pair<int,int>> v[16];
rep(i,n){
    int x;
    cin>>x;
    rep(j,x){
        int a,b;
        cin>>a>>b;
        v[i].push_back({a,b});
    }
}
int ans = 0;

for(int i=0;i<(1<<n);i++){
    int k=i;
   // cout<<k<<endl;
    vector<int> al(n+1,0);

    for(int j=0;j<n;j++){
        if(1&(k>>j)){
            al[j]=1;
        }else{
            al[j]=0;
        }
    }

    bool ff = true;

    for(int j=0;j<n;j++){
        if(1&(k>>j)){
            for(int l=0;l<v[j].size();l++){
                int f=v[j][l].first;
                int s=v[j][l].second;
                f--;
//                cout<<f<<s<<endl;
//                rep(r,n){
//                    cout<<al[r]<<" ";
//                }
               // cout<<endl;
               //cout<<al[f]<<" "<<s<<endl;

                if(al[f]==s){
                    al[f]=s;
                }else{
                    ff=false;
                    break;
                }

            }

        }

    }
    if(ff){
        int t=0;
        rep(i,al.size()){
            if(al[i]==1){
                t++;
            }
        }
        ans=max(ans,t);
    }


}
cout<<ans<<endl;




return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define se second
#define fi first
#define ll long long
#define ld long double
#define pll pair<ll ,ll >
#define pii pair<int, int> 
#define mod 1000000007
ll power(ll a,ll b){
    ll res=1;
    while(b>0){
        if(b%2!=0) res=(res*a);
        a=(a*a);
        b/=2;
        if(res>INT_MAX){
            return INT_MAX;
        }
    }
    return res;
}
ll ncr(ll n,ll k){
    if(k==0||k==n) return 1ll;
    if(k>n-k) k=n-k;
    ll pro=1;
    for(ll i=0;i<k;i++){
        pro=(pro*(n-i));
        pro/=(i+1);
    }
    return pro;
}
vector<int> prime;
void seive(){
    vector<bool > isprime(101,true);
    for(int i=2;i*i<=100;i++){
        if(isprime[i]){
            for(int j=i*i;j<=100;j+=i){
                isprime[j]=false;
            }
        }
    }
    for(int i=2;i<=100;i++){
        if(isprime[i]) prime.push_back(i);
    }
}
int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll w,h,n,a,b,c;
    cin>>w>>h>>n;
    ll xi=0,xf=w,yi=0,yf=h;
    for(int i=0;i<n;i++){
        cin>>a>>b>>c;
        if(c==1){
            xi=max(xi,a);
        }
        else if(c==2){
            xf=min(xf,a);
        }
        else if(c==3){
            yi=max(yi,b);
        }
        else{
            yf=min(yf,b);
        }
    }
    if(xf>=xi && yf>=yi){
        ll ans=(xf-xi)*(yf-yi);
        cout<<ans;
    }
    else cout<<"0";
    return 0;
}


Measured memory_bytes: 256
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import qualified Data.Array.IO as A
import Debug.Trace
import Data.List
import Control.Monad
import Data.Ord


r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine


main :: IO ()
main = do
    [n,d] <- r'
    let f = fromIntegral $ d*2 + 1
    print $ ceiling $ (fromIntegral n) / f



Measured memory_bytes: 380
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define SZ(x) ((ll)(x).size())
typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

int a,b,c;

template<typename T>
T gcd(T u, T v) {
    T r;
    while (v) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template<typename T>
T gcd(vector<T> a){
    int l = a.size();
    if(l<=0){
        return 0;
    }else if(l==1){
        return a[0];
    }else{
        T res = gcd(a[0],a[1]);
        FOR(i,2,l){
            res = gcd(res,a[i]);
        }
        return res;
    }
}

int main(){
    cin >> a >> b >> c;
    vector<int> d = {a,b,c};
    if(gcd(a,b)==gcd(d)){
        put("YES");
    }else{
        put("NO");
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 1e5 + 7;
const int Inf = 1 << 30;
const ll INF = 1ll << 60;
int n, m;

struct PP {
	int a;
	int b;
} p[maxx];

bool cmp(PP x, PP y) {
	return x.a < y.a;
}

int main() {
	scanf("%d %d", &n, &m);
	for(int i = 1; i <= n; i++) scanf("%d %d", &p[i].a, &p[i].b);
	sort(p + 1, p + n + 1, cmp);
	ll ans = 0;
	for(int i = 1; i <= n; i++) {
		if(!m) break;
		ans += (ll)min(m, p[i].b) * (ll)p[i].a;
		m -= min(m, p[i].b);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <bitset>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
#define FOR(i,a,b)   for(ll i = (a); i < (b); i++ )
#define REP(i, n)    FOR(i,0,n)
typedef pair< ll, ll >   cp2;
typedef pair< string, cp2 >   cp3;
#define fi first
#define se second
#define sec  se.fi
#define thr  se.se
const ll mod = 1000000007;
//              123456789


///////////////////////////////////////////////
//
//
///////////////////////////////////////////////

////////////////////////////////////////////////
////////////////////////////////////////////////

string S;

int main(){

  cin>>S;

  if( S == "RRR" ){
    puts("3");
  }
  else if( S == "RRS" || S == "SRR" ){
    puts("2");
  }
  else if( S[0] == 'R' || S[1] == 'R' || S[2] == 'R' ){
    puts("1");
  }
  else{
    puts("0");
  }
  
  return 0;
}



Measured memory_bytes: 3132
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
	int l;
 	string S;
 	cin >> l >>  S;
 	int loc = 0;
 	int cnt;

 	for(int i=0;i<l;i++){
 		if(S[i]=='('){
 			loc++;
 		}else{
 			loc--;
 		}

 		if(loc<0){
 			cout << '(';
 			loc++;
 		}
 	}

 	cout << S;
 	for(int i=0;i<loc;i++){
 		cout << ')';
 	}
    cout <<endl;

 	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using namespace std;
using ll = long long;
using Edge = pair<int,long long>;
using Graph = vector<vector<Edge>>;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
    string S,T;
    cin >> S >> T;
    bool flag = false;
    rrep(i,sz(S)){
        int ct = 0;
        rep(j,sz(T)) if(i+j < sz(S)) ct += (S[i+j] == T[j] || S[i+j] == '?');
        if(ct == sz(T)){
            flag = true;
            rep(j,sz(T)) S[i+j] = T[j];
            break;
        }
    }
    
    if(flag) rep(i,sz(S)) if(S[i] == '?') S[i] = 'a';
    
    if(flag) pr(S);
    else pr("UNRESTORABLE");
    
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long Int;
Int n;

Int a[216000], b[216000];
Int solve(Int d){
	Int mask = (1 << (d+1)) - 1;
	vector<Int> as, bs;
	for(Int i = 0;i < n;i++){
		as.push_back(a[i] & mask);
		bs.push_back(b[i] & mask);
	}
	sort(as.begin(), as.end());
	sort(bs.begin(), bs.end());
	Int cnt = 0;
	for(Int i = 0;i < n;i++){
		cnt += upper_bound(bs.begin(), bs.end(), mask - as[i]) - upper_bound(bs.begin(), bs.end(), (mask >> 1) - as[i]);
		cnt += upper_bound(bs.begin(), bs.end(), (mask<<1) - as[i]) - upper_bound(bs.begin(), bs.end(), (1 << (d+1)) + (mask>>1) - as[i]);
	}
	return cnt % 2;
}

int main(){
	Int res = 0;
	cin >> n;
	for(Int i = 0;i < n;i++)cin >> a[i];
	for(Int i = 0;i < n;i++)cin >> b[i];

	for(Int i = 0;i < 30;i++){
		res += solve(i) << i;
	}
	cout << res << endl;
	return 0;
}

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

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

Measured memory_bytes: 256
def solve(n):
    dp = [100001] * (n + 1)
    dp[0] = 0
    for i in range(n):
        for j in range(10):
            if i + 6 ** j > n:
                break
            dp[i + 6 ** j] = min(dp[i + 6 ** j], dp[i] + 1)
        for j in range(10):
            if i + 9 ** j > n:
                break
            dp[i + 9 ** j] = min(dp[i + 9 ** j], dp[i] + 1)
    return dp[n]

N = int(input())
print(solve(N))

Measured memory_bytes: 42860
#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN];
int head, tail, n;

void enqueue(P x){
Q[tail] = x;
tail = (tail + 1) % LEN;
}

P dequeue(){
P x = Q[head];
head = (head + 1) % LEN;
return x;
}

int min(int a,int b){
  if(a < b) return a;
  else{
    return b;
  }
}

int main(){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head = 1;
  tail = n + 1;

  for(;head != tail; ){
    u = dequeue();
    c = min(q, u.t);
    u.t -= c;
    elaps += c;
    if(u.t > 0){
      enqueue(u);
    }
    else{
      printf("%s %d\n",u.name,elaps);
    }
  }

  return 0;
}


Measured memory_bytes: 11892
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>; 
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    vector<int> a(3); rep(i, 3)cin >> a[i];
    sort(all(a));
    if(a[0]==5 && a[1]==5 && a[2]==7)cout << "YES" << ln;
    else cout << "NO" << ln;
}
    


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

#define ll long long
#define pb push_back
#define mp make_pair
#define ull unsigned long long
#define rep(n) for(ll i = 0 ; i<n ; i++) 
#define repd(n) for(ll i = n-1 ; i>=0 ; i--)
#define MOD 1000000007
#define sz(a) a.size()
#define pii pair<ll,ll> 
#define nl "\n"
#define ff first
#define ss second
#define c(n) ll n; cin>>n;
#define ca(n) ll a[n]; rep(n) cin>>a[i];
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(a) a.begin(),a.end()
#define sort_stl(a) sort(a.begin(),a.end())
#define srt(a) sort(a,a+n)
#define fl(a,x) memset(a,x,sizeof(a))

typedef vector<ll> vll ;

int main(){
    
    fast;
    ll n; cin>>n;
    ll a[n]; rep(n) cin>>a[i];
    ll h[200005]={};
    rep(n) {
        h[a[i]]++;
    }
    ll s=0;
    bool done[200005]={};
    rep(n) { 
        if(!done[a[i]]) s = s + h[a[i]]*(h[a[i]]-1)/2 ;
        done[a[i]]=1;
    }
    
    // cout <<  s <<nl;
    rep(n) {
        cout << s - h[a[i]]*(h[a[i]]-1)/2 + (h[a[i]]-1)*(h[a[i]]-2)/2 << nl;
    }
	return 0;
}


Measured memory_bytes: 5888
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <functional>
#include <numeric>
#include <cmath>
#include <cstring>
#include <queue>

using namespace std;

const int INF = 1 << 29;
typedef pair<int, int> P;
const int MOD = 10000;
int n, k;

int main(void)
{
	while(cin >> n >> k && n)
	{
		int pre[3][2] = {0};//一日前種類、（連続して行けるor行けない）
		int next[3][2] = {0};//次の日
		map<int, int> sche;//予定
		for (int i = 0; i < k; i++)
		{
			int day;
			cin >> day;
			cin >> sche[day - 1];
		}

		if(sche[0]) pre[sche[0] - 1][0] = 1;
		else
		{
			for (int i = 0; i < 3; i++)
			{
				pre[i][0] = 1;
			}
		}

		for (int d = 1; d < n; d++)
		{
			memset(next, 0, sizeof(next));
			if(sche[d])
			{
				for (int i = 0; i < 3; i++)
				{
					if(i == sche[d]-1)
						next[sche[d] - 1][1] += pre[i][0] % MOD;
					else
						next[sche[d] - 1][0] += (pre[i][0] + pre[i][1]) % MOD;
				}
			}
			else
			{
				for (int i = 0; i < 3; i++)
				{
					for (int j = 0; j < 3; j++)
					{
						if(i == j)
							next[i][1] += pre[j][0] % MOD;
						else
							next[i][0] += (pre[j][0] + pre[j][1]) % MOD;
					}
				}
			}

			for (int i = 0; i < 3; i++)
			{
				for (int j = 0; j < 2; j++)
				{
					pre[i][j] = next[i][j];
				}
			}
		}
		int ans = 0;
		for (int i = 0; i < 3; i++)
		{
			ans += next[i][0] + next[i][1];
		}
		cout << ans % MOD << endl;
	}
	return 0;
}

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

using namespace std;
#define dtype long long

int main() {
    dtype a,b,c,d,x=LLONG_MIN,y=LLONG_MIN;
    cin>>a>>b>>c>>d;
    if(a<0 && b>=0)
        x=0;
    if(c<0 && d>=0)
        y=0;
    cout<<max({x,y,a*c,b*d,a*d,b*c})<<endl;


    return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define endl '\n'
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repab(i,a,b) for(int i=a;i<=b;i++)
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define  printarr(v) for(auto x:v){cout<<x<<" "; }
#define debug1(a) cout<<#a<<" "<<(a)<<endl;
#define debug2(a,b) cout<<#a<<" "<<(a)<<" "<<#b<<" "<<(b)<<endl;
#define debug3(a,b,c) cout<<#a<<" "<<(a)<<" "<<#b<<" "<<(b)<<" "#c<<" "<<(c)<<endl;
typedef long double ld;
void solve()
{
	ll n;
	cin >> n;
	vector<pair<ll, ll>> v;
	for (int i = 0; i < n; i++)
	{
		ll x, y;
		cin >> x >> y;
		v.push_back({x, y});
	}
	for (int i = 0; i <= (n - 3); i++)
	{
		if (v[i].first == v[i].second && v[i + 1].first == v[i + 1].second && v[i + 2].first == v[i + 2].second)
		{
			cout << "Yes" << endl;
			return;
		}

	}
	cout << "No" << endl;



}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	solve();
}


Measured memory_bytes: 3656
program answer
  implicit none

  integer :: i, a
  character(len=100) :: S, T
  character (len=1) :: saigo

  read(*,*) S
  read(*,*) T
  a=len_trim(S)
 
  do i = 1, a
     saigo=S(a:a)
     S(2:a)=S(1:a-1)
     S(1:1)=saigo
     if(S==T) then
        write(*,*) 'Yes'
        stop
     end if
  end do

  write(*,*) 'No'

  stop
 end program answer
     

Measured memory_bytes: 2820
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <climits>

using namespace std;

char s[1007];

int main(){
	long long k;
	cin>>s;	
	cin>>k;
	int len=strlen(s);
	for (int i=0;i<len;i++) {
		if (i==k-1 || s[i]!='1') {
			cout<<s[i]<<endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>
#include <set>
#include <cstdlib>
#include <queue>
#include <map>

using namespace std;

typedef long long llint;
typedef long double ld;
#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint>> que;
//priority_queue<llint> q;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n;
string s;
map<char,int> dic;
void solve(){
  cin >> n;
  for(char c='a';c<='z';c++){
    dic[c]=55;
  }
  for(int i=0;i<n;i++){
    cin >> s;
    for(char c='a';c<='z';c++){
      int cnt=count(s.begin(),s.end(),c);
      dic[c]=min(dic[c],cnt);
    }
  }
  for(char c='a';c<='z';c++){
    if(dic[c]>0){
      for(int i=0;i<dic[c];i++)cout << c;
    }
  }
  cout << endl;

}

int main(int argc, char *argv[]) {
  solve();
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static int gcd(int a, int b) {
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long sum = 0;
        for (int i = 1; i < n + 1; i++) {
            for (int j = 1; j < n + 1; j++) {
                for (int k = 1; k < n + 1; k++) {
                    int a = gcd(j, k);
                    int b = gcd(i, a);
                    sum += b;
                }
            }
        }
        System.out.println(sum);

    }
}


Measured memory_bytes: 35764
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int L = sc.nextInt();
    String[] S = new String[N];
    for(int i=0;i<N;i++){
      S[i] = sc.next();
    }
    Arrays.sort(S);
    for(int i=0;i<N;i++){
      System.out.print(S[i]);
    }
      System.out.println();
  }
}

Measured memory_bytes: 37032
using System;

namespace Tenki
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var t = Console.ReadLine();

            var res = 0;

            for(int i = 0; i < s.Length; i++)
            {
                if (s[i] == t[i]) res++;
            }

            Console.WriteLine(res);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
int a,n,k,i,j,x,s[100];
int main(){
  while(cin>>n>>k,n){
    for(i=0;i<k;a=0)cin>>s[i++];
    for(i=0;i++<n;)
      for(j=0;j<k;s[j++]-=x)cin>>x;
    for(i=0;i<k;)s[i++]<0?(a=1):0;
    cout<<(a?"No\n":"Yes\n");
  }
  return 0;
}

Measured memory_bytes: 2996
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#define MOD 924844033
#define MX 2003

using namespace std;

typedef long long ll;

int N, K;
int LEN[MX], NUM;
ll FAC[MX], FACI[MX];
ll F[MX][MX], G[MX];

ll qpow(ll x, ll t)
{
	ll ans = 1;
	while(t)
	{
		if(t & 1) ans = ans*x%MOD;
		x = x*x%MOD;
		t >>= 1;
	}
	return ans;
}

ll inv(ll x)
{
	return qpow(x, MOD-2);
}

ll C(int n, int m)
{
	if(n<0 || m<0 || n<m) return 0;
	else return FAC[n] * FACI[m]%MOD * FACI[n-m]%MOD;
}

void init()
{
	FAC[0] = 1;
	for(int i=1; i<=N; i++) FAC[i] = FAC[i-1] * i % MOD;
	FACI[N] = inv(FAC[N]);
	for(int i=N-1; i>=0; i--) FACI[i] = FACI[i+1] * (i+1) % MOD;
}

int main()
{
	scanf("%d%d", &N, &K);
	init();
	for(int i=1; i<=K&&i<=N-K; i++)
		LEN[++NUM] = (N-K-i)/K+1,
		LEN[++NUM] = (N-K-i)/K+1;
	F[0][0] = 1;
	for(int i=1; i<=NUM; i++)
		for(int j=0; j<=N; j++)
			for(int k=0; k<=j&&k<=((LEN[i]+1)>>1); k++)
				F[i][j] = (F[i][j] + F[i-1][j-k] * C(LEN[i]-k+1, k))%MOD;
	for(int i=N; i>=0; i--)
	{
		G[i] = F[NUM][i] * FAC[N-i] % MOD;
		G[i] = (G[i] - G[i+1] + MOD) % MOD;
	}
	printf("%lld\n", G[0]);
	return 0;
}

Measured memory_bytes: 26880
#include <functional>
#include <algorithm>
#include <stdexcept>
#include <iostream>
#include <sstream>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <cctype>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <queue>
#include <stdint.h>
#include <stdio.h>
#include <stack>
#include <ctime>
#include <list>
#include <map>
#include <set>
#include <tuple>
#include <unordered_set>
#include <assert.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define TR(i,x) for(__typeof(x.begin()) i=x.begin();i!=x.end();i++)
#define ALL(x) x.begin(),x.end()
#define SORT(x) sort(ALL(x))
#define CLEAR(x) memset(x,0,sizeof(x))
#define FILL(x,c) memset(x,c,sizeof(x))

using namespace std;

#define PB push_back
#define MP make_pair

typedef map<int,int> MII;
typedef map<string,int> MSI;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<long double> VD;
typedef pair<int,int> PII;
typedef long long int64;
typedef long long LL;
typedef unsigned int UI;
typedef long double LD;
typedef unsigned long long ULL;

int main() {
    int n;
    cin >> n;
    vector<PII> a(n);
    vector<PII> b;
    REP(i, n) {
        scanf("%d%d", &a[i].first, &a[i].second);
        b.PB(MP(a[i].first, i));
        b.PB(MP(a[i].second, i));
    }
    SORT(b);
    LL answer = 0x3F3F3F3F3F3F3F3FLL;
    LL delta = b[2 * n - 1].first - b[0].first;

    VI count(n, 0);
    int last = 0;
    int ones = 0;
    REP(i, 2 * n) {
        while (last < 2 * n && ones < n) {
            if (!count[b[last].second]) ++ones;
            ++count[b[last++].second];
        }
        if (ones == n) {
            answer = min(answer, delta * (b[last - 1].first - b[i].first));
        }

        if (!--count[b[i].second]) {
            --ones;
        }
    }

    fill(ALL(count), 0);
    last = 0;
    ones = 0;
    while (ones < n) {
        if (!count[b[last].second]) ++ones;
        ++count[b[last++].second];
    }

    LL len1 = b[last - 1].first - b[0].first;

    fill(ALL(count), 0);
    last = 2 * n - 1;
    ones = 0;
    while (ones < n) {
        if (!count[b[last].second]) ++ones;
        ++count[b[last--].second];
    }
    LL len2 = b[2 * n - 1].first - b[last + 1].first;
    answer = min(answer, len1 * len2);

    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 8048
Scanf.scanf "%d" (fun n ->
    let f = Array.init n (fun _ ->
        Array.init 10 (fun _ -> Scanf.scanf " %d" (fun f -> f)))
    in
    let c = Array.init n (fun _ ->
        Array.init 11 (fun _ -> Scanf.scanf " %d" (fun f -> f)))
    in
    let calc arr bits =
        let rec loop i bits acc =
            if i = 10 then acc else
                let acc = acc + arr.(i) * (bits land 1) in
                loop (i + 1) (bits lsr 1) acc
        in
        loop 0 bits 0
    in
    let rec loop bits acc =
        if bits = 1024 then acc else
            let rec loop2 j acc =
                if j = n then acc else
                    let opens = calc f.(j) bits in
                    let acc = acc + c.(j).(opens) in
                    loop2 (j + 1) acc
            in
            let revenue = loop2 0 0 in
            loop (bits + 1) (max acc revenue)
    in
    loop 1 min_int |> Printf.printf "%d\n"
)

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

int gcd(int p,int q){
    if(p%q == 0){
        return q;
    }
        return gcd(q,p%q);
}

int main() {
double a, b, h, m, rad,x; cin >> a >> b >> h >> m;
x = 60*h+m;
rad = M_PI * (0.5*x-6*m) / 180;

double ans = a * a + b * b - 2 * a * b * cos(rad);

ans = sqrt(ans);

cout << fixed << setprecision(30);
cout << ans << endl;
}


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

int main(){
    int X;
    cin >> X;

    int ure500, ure5;

    ure500 = X / 500;
    ure5 = (X % 500) / 5;

    cout << 1000 * ure500 + 5 * ure5 << endl;

    return 0;
}

Measured memory_bytes: 256
from operator import itemgetter
class BIT:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)

    def sum(self, i):
        s = 0
        i += 1
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        i += 1
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

N = int(input())
xy = [list(map(int,input().split())) for _ in range(N)]
xy.sort(key=itemgetter(1))
for i in range(N):
    xy[i][1] = i
xy.sort(key=itemgetter(0))

mod = 998244353
p2 = [1]*(N+1)
for i in range(N):
    p2[i+1] = p2[i]*2%mod

bit = BIT(N)

ans = 0

for i in range(N):
    y = xy[i][1]
    bit.add(y,1)
    n1 = i+1-bit.sum(y)
    n2 = i-n1
    n3 = N-y-1-n1
    n4 = N-i-1-n3
    ans += 1
    ans += (p2[n1]-1)+(p2[n2]-1)+(p2[n3]-1)+(p2[n4]-1)
    ans += (p2[n1]-1)*(p2[n2]-1)+(p2[n3]-1)*(p2[n4]-1)+(p2[n1]-1)*(p2[n3]-1)+(p2[n2]-1)*(p2[n4]-1)+2*(p2[n1]-1)*(p2[n4]-1)+2*(p2[n2]-1)*(p2[n3]-1)
    ans += 2*((p2[n1]-1)*(p2[n2]-1)*(p2[n3]-1)+(p2[n1]-1)*(p2[n2]-1)*(p2[n4]-1)+(p2[n1]-1)*(p2[n3]-1)*(p2[n4]-1)+(p2[n2]-1)*(p2[n3]-1)*(p2[n4]-1))
    ans += 2*(p2[n1]-1)*(p2[n2]-1)*(p2[n3]-1)*(p2[n4]-1)
    ans %= mod
print(ans)

Measured memory_bytes: 103300
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long N,M;cin>>N>>M;
  vector<float> A(N);
  long wa=0;
  for(int i=0; i<N; i++){
    int a;cin>>a;
    wa+=a;A[i]=a;
  }
  float ch=wa/(4.0*M);
  int cnt=0;
  for(int i=0; i<N; i++){
    if(A[i]>=ch)cnt++;
  }
  cout<<(cnt>=M?"Yes":"No")<<endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int M, K;
    cin >> M >> K;

    // コーナーケース
    // M=0は下とまとめて良い
    if (M == 1) {
        if (K >= 1) {
            cout << -1 << endl;
        } else {
            cout << "0 0 1 1" << endl;
        }
        return 0;
    }

    // 可能性判定
    if (K >= (1 << M)) {
        cout << -1 << endl;
        return 0;
    }

    // 前半の出力
    for (int i = 0; i < (1 << M); ++i) {
        if (i != K) {
            cout << i << " ";
        }
    }
    cout << K << " ";

    // 後半の出力(逆順にするだけ)
    for (int i = (1 << M) - 1; i >= 0; --i) {
        if (i != K) {
            cout << i << " ";
        }
    }
    cout << K << " " << endl;

    return 0;
}


Measured memory_bytes: 1792
class UnionFind():
    # 作りたい要素数nで初期化
    # 使用するインスタンス変数の初期化
    def __init__(self, n):
        self.n = n
        # root[x]<0ならそのノードが根かつその値が木の要素数
        # rootノードでその木の要素数を記録する
        self.root = [-1]*(n+1)
        # 木をくっつける時にアンバランスにならないように調整する
        self.rnk = [0]*(n+1)

    # ノードxのrootノードを見つける
    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            # ここで代入しておくことで、後の繰り返しを避ける
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]
    # 木の併合、入力は併合したい各ノード
    def Unite(self, x, y):
        # 入力ノードのrootノードを見つける
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        # すでに同じ木に属していた場合
        if(x == y):
            return 
        # 違う木に属していた場合rnkを見てくっつける方を決める
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x

        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            # rnkが同じ（深さに差がない場合）は1増やす
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    # xとyが同じグループに属するか判断
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)

    # ノードxが属する木のサイズを返す
    def Count(self, x):
        return -self.root[self.Find_Root(x)]

n,m=map(int,input().split())
UF=UnionFind(n)
for i in range(m):
    a,b,c=map(int,input().split())
    UF.Unite(a-1,b-1)
s=set()
for i in range(n):
    s.add(UF.Find_Root(i))
print(len(s))

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

using ll = long long;
using P = pair<int, int>;
using PP = pair<int, P>;
#define rep1(i,n) for (int i=1; i<=n; i++)
#define rep0(i,n) for (int i=0; i<n; i++)
#define chmin(a,b) if ((a)>(b)) { a=(b); }
#define chmax(a,b) if ((a)<(b)) { a=(b); }
#ifdef _DEBUG
string _format(string args) { string r = "", t; istringstream s(args); while (getline(s, t, ',')) r += t+":%d "; return r + "\n"; }
#define debug(...) printf(_format(#__VA_ARGS__).c_str(), __VA_ARGS__);
#else
#define debug(...) 
#endif

int main() {
    int n;
    cin >> n;
    ll A[n];
    rep0(i,n) { cin >> A[i]; }
    ll s = 0;
    for(int i=2;i<n;i++) {
        s ^= A[i];
    }
    vector<ll> ok;
    ll mask = (1<<20)-1;
    for (ll k=0; k<mask; k++) {
        if ( ( ((A[0]-k)&mask) ^ ((A[1]+k)&mask) ^ (s&mask)) == 0) {
           ok.push_back(k);
        }
    }
    ll ans = INT64_MAX;
    for (ll low : ok) {
        for (ll k=low; k<A[0]; k+=(1<<20)) {
            debug(A[0], A[1], s, k);
            if ( ( ((A[0]-k)>>20) ^ ((A[1]+k)>>20) ^ (s>>20) ) == 0) {
                chmin(ans, k)
                break;
            }
        }
    }
    cout << ((ans != INT64_MAX) ? ans : -1) << endl;
}


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

using namespace std;

#define int  long long int

#define int  long long int
#define mod  1000000007
#define MOD 1000000007
int n;
int handle(int x)
{
    return (x%MOD + MOD)%MOD;
}
int mod_pow(int a,int b,int m)
{
    int res = 1;
    while(b)
    {
        if(b&1)
        {
            res=(res*a) % m;
        }
        a=(a*a) % m;
        b>>=1;
    }
    return res;
}
int myCustPower(int a,int y)
{
    int pw = 1;
    while(y > 0)
    {
        if(y%2)
        {
            pw = handle(pw*a);
        }
        a = handle(a*a);
        y/=2;
    }
    return pw;
}
int modInverse(int a, int m) 
{ 
    int m0 = m; 
    int y = 0, x = 1; 
  
    if (m == 1) 
      return 0; 
  
    while (a > 1) 
    { 
        // q is quotient 
        int q = a / m; 
        int t = m; 
  
        // m is remainder now, process same as 
        // Euclid's algo 
        m = a % m, a = t; 
        t = y; 
  
        // Update y and x 
        y = x - q * y; 
        x = t; 
    } 
  
    // Make x positive 
    if (x < 0) 
       x += m0; 
  
    return x; 
} 
void GO()
{
    cin>>n;
    if(n==1)
    {
        cout<<0<<endl;
        return;
    }
    if(n==2)
    {
        cout<<2<<endl;
        return;
    }

    int p = handle(n*(n-1));

    p = handle(handle(p)*handle(modInverse(2,MOD)));

    int x = handle(p*myCustPower(10,n));
    cout<<p<<endl;
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
     freopen("input.txt","r",stdin);
     freopen("output.txt","w",stdout);
    #endif
    int s;
    
    cin >> s;
    
    if(s < 3) {
        cout << 0 << endl;
        return 0;
    }
    
    int vivek[s+5];
    
    for(int i = 0; i <= s; ++i) {
        vivek[i] = 1;
    }
    
    for(int i = 3; i <= s; ++i) {
        for(int j = i - 3; j >= 3; --j) {
            vivek[i] += vivek[j];
            vivek[i] %= mod;
        }
    }
    
    cout << vivek[s] << endl;
    
    return 0;
}

Measured memory_bytes: 3652
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>
#define FASTIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define rep(i, l, r) for (ll i = (l); i < (r); ++i)
typedef long long ll;
typedef long double ld;
typedef unsigned int  ull;
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int, int>
#define int ll
#define pll pair<ll, ll> 
#define pdd pair<ld, ld> 
#define pb push_back
#define reset(x,v) memset(x,v,sizeof(x))
#define mod 1000000007
using namespace std;

ll power(ll x, ll y){  
	if(x == 1 || y == 0)
		return 1;
    ll res = 1;   
    x = x % mod; 
    if (x == 0) 
		return 0;  
    while (y > 0){  
        if (y & 1)  
	        res = (res * x) % mod;  
        y = y >> 1; 
        x = (x * x) % mod;  
    }  
    return res;  
} 
vi pr;
void sieve(int n){ 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++){ 
        if (prime[p] == true){ 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 

    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          pr.pb(p); 
} 
signed main(){
	FASTIO
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << max(max(a * d, b * c), max(a * c, b * d));
    return 0;
}


Measured memory_bytes: 3640
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;

const string YES = "YES";
const string NO = "NO";

void solve(std::string S){
    string T;
    REP(i, S.length()){
        if(S[i]!= 'A')
            T.push_back(S[i]);
    }
    if(T != "KIHBR"){
        cout << NO << endl;
        return;
    }

    REP(i, S.length()-1){
        if(S.substr(i, 2)== "AA"){
            cout << NO << endl;
            return;
        }
        if(S.substr(i, 2)== "KA"){
            cout << NO << endl;
            return;
        }
        if(S.substr(i, 2)== "IA"){
            cout << NO << endl;
            return;
        }
    }
    cout << YES << endl;

}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pii;
typedef long long ll;
const long long MOD=1000000007;
#define rep(i,n) for(long long i=0;i<(n);i++)
#define rep2(i,m,n) for(long long i=(m);i<(n);i++)
#define ALL(v) v.begin(), v.end()
#define pb push_back




int main(){


    int l,r,d;
    cin>>l>>r>>d;

    cout<<r/d-(l-1)/d<<endl;







    









}








            






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

long long N, D;

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

	long long ans = 0;
	for(long long i = 0; i < N; i++) {
		double x, y;
		cin >> x >> y;
		if(sqrt(x*x + y*y) <= D) {
			ans++;
		}
	}
	cout << ans << endl;

}


Measured memory_bytes: 3840
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
string s;
int main()
{
	ios_base::sync_with_stdio(0);
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin >> s;
	if (s.size()<4) cout << "No";
	else
	if (s.substr(0,4)=="YAKI") cout << "Yes";
	else cout << "No";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
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); }
using P = pair <int, int>;
 
ll MOD = 1000000007;
ll INF =1<<29;
ll dp[100100];
 
int main() {
     ll x;
     cin >>x;
     ll ans =100;
     ll cnt = 0;
     while (ans <x){
         ans += ans/100;
         cnt ++;
     }
     cout <<cnt <<endl;
}
  

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <iomanip>
#include <iostream>
using namespace std;

int main()
{
    int N,rN,temp;

    cin>>N;
    temp=N;

    int x,y,z;
    x=temp/100;
    temp%=100;
    y=temp/10;
    z=temp%10;

    rN=z*100+y*10+x;

    if(N==rN){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }

    return 0;
}


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

using namespace std;

int main(void)
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	vector<int> r, g, b;
	for (int i = 0; i < n; i++) {
		switch (s[i]) {
			case 'R':
				r.push_back(i);
				break;
			case 'G':
				g.push_back(i);
				break;
			case 'B':
				b.push_back(i);
				break;
		}
	}
	long long count = 0;
	for (int i = 0; i < r.size(); i++) {
		for (int j = 0; j < g.size(); j++) {
			int v = b.size();
			int s = min(r[i], g[j]);
			int l = max(r[i], g[j]);
			if (binary_search(b.begin(), b.end(), l + (l-s)))
				v--;
			if (binary_search(b.begin(), b.end(), s - (l-s)))
				v--;
			if ((l-s) % 2 == 0)
				if (binary_search(b.begin(), b.end(), s + (l-s)/2))
					v--;
			count += v;
		}
	}
	cout << count << endl;
	return 0;
}

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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long N = l[0], K = l[1];

            var dict = new Dictionary<int, long>();

            for (var i = 0; i < N; i++)
            {
                var tmp = Console.ReadLine().Split().Select(int.Parse).ToArray();
                if (dict.ContainsKey(tmp[0]))
                    dict[tmp[0]] += tmp[1];
                else
                    dict[tmp[0]] = tmp[1];
            }

            var total = 0L;
            foreach (var d in dict.OrderBy(z => z.Key))
            {
                total += d.Value;
                if (K <= total)
                {
                    Console.WriteLine(d.Key);
                    return;
                }
            }
            
        }
    }
}


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

using namespace std;
#define ll  long long
#define ld  long double
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793238463;
const int MAXN = 20000005;
bool isPrime[MAXN];
vector<int> pr;
vector<pair<int,int>> ans;
void sieve()
{
    memset(isPrime, 1, sizeof isPrime);
    isPrime[0] = isPrime[1] = 0;

    for (int i = 2; i * i <= MAXN; i += 1 + (i & 1))
    {
        if (isPrime[i])
        {

            for (int j = i * i; j < MAXN; j += i)
                isPrime[j] = 0;
        }
    }
    for(int i=0; i<MAXN; i++)
    {
        if(isPrime[i])
        {
            if(!pr.empty())
            {
                if(i-pr.back()==2)
                {
                    ans.push_back({pr.back(),i});
                }
            }
            pr.push_back(i);

        }
    }
}

ld power(ld x, ll y)
{
    ll temp;
    if (y == 0)
        return 1;
    temp = power(x, y / 2);
    if (y % 2 == 0)
        return temp * temp;
    else
        return x * temp * temp;
}

void debug_out()
{
    cerr << endl;
}

template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << " " << H;
    debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

int main()
{
     char a;
     cin>>a;
     if(isupper(a))
        cout<<"A"<<endl;
     else{
        cout<<"a"<<endl;
     }
    
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
   int n;
   cin>>n;
   vector<int> x(n), y(n);
   rep(i, n) cin>>x[i]>>y[i];

   int a=1;
   rep(i, n) a*=(i+1);
   int pat=a;
   int tm=pat*(n-1);
   int am=n*(n-1)/2;
   int m=tm/am;
   double ad=0;
   rep(i, n) for(int j=i+1; j<n; j++){
      ad+= sqrt(pow(x[i]-x[j], 2) + pow(y[i]-y[j], 2));
   }
   double avem=ad/am;
   double avee=avem*(n-1);

   cout << std::fixed << std::setprecision(15) << avee << endl;
   return 0;
}


Measured memory_bytes: 3856