akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
long long n,m,i,j,l[200005],r[200005],mil[200005][19],mir[200005][19],x,y,aa[200005],d,lg[200005],ans;
long long fndl(long long x){if (l[x]==x) return x;return l[x]=fndl(l[x]);}
long long fndr(long long x){if (r[x]==x) return x;return r[x]=fndr(r[x]);}
struct f
{
	long long x,id;
}a[200005];
bool cmp(f x,f y){return x.x<y.x;}
void merge(long long x,long long y)
{
	if (x>y) swap(x,y);
	l[fndl(y)]=fndl(x);
	r[fndr(x)]=fndr(y);
}
long long ql(long long x,long long y)
{
	if (x>y) return 1ll<<60;
	long long k=lg[y-x+1];
	return min(mil[x][k],mil[y-(1<<k)+1][k]);
}
long long qr(long long x,long long y)
{
	if (x>y) return 1ll<<60;
	long long k=lg[y-x+1];
	return min(mir[x][k],mir[y-(1<<k)+1][k]);
}
bool isb(long long x,long long y)
{
	long long f=min(ql(1,fndl(x)-1)+qr(fndl(x),fndr(x)),qr(fndr(x)+1,n)+ql(fndl(x),fndr(x)));
	if (f<y) return 0;
	if (f==y) return 1;
	if (f>y) exit(-1);
}
void solve(long long x)
{
	long long i,j;
	for (i=fndl(x)-1;i>=1;i=fndl(i)-1)
	{
		long long d=ql(fndl(i),fndr(i))+qr(fndl(x),fndr(x));
		if (isb(i,d))
		{
			merge(i,x);
			ans+=d;
		}
		else break;
	}
	for (i=fndr(x)+1;i<=n;i=fndr(i)+1)
	{
		long long d=qr(fndl(i),fndr(i))+ql(fndl(x),fndr(x));
		if (isb(i,d))
		{
			merge(i,x);
			ans+=d;
		}
		else break;
	}
}
int main()
{
	scanf("%lld%lld",&n,&m);
	lg[1]=0;
	for (i=2;i<=n;i++) lg[i]=lg[i/2]+1; 
	for (i=1;i<=n;i++) 
	{
		scanf("%lld",&aa[i]);
		a[i].x=aa[i];
		a[i].id=i;
		mil[i][0]=aa[i]-i*m;
		mir[i][0]=aa[i]+i*m;
	}
	for (j=1;(1<<j)<=n;j++)
	{
		for (i=1;i+(1<<j)-1<=n;i++)
		{
			mil[i][j]=min(mil[i][j-1],mil[i+(1<<(j-1))][j-1]);
			mir[i][j]=min(mir[i][j-1],mir[i+(1<<(j-1))][j-1]);
		}
	}
	sort(a+1,a+n+1,cmp);
	for (i=1;i<=n;i++) l[i]=r[i]=i;
	for (i=1;i<=n;i++) solve(i);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 71680
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

vector<pair<int,string> > team(10);

int main() {
	int n;
	int score;
	while(n=in()){
		int i;
		for(i=0;i<n;i++){
			team[i].first=0;
			cin>>team[i].second;
//cout<<team[i].second<<endl;
			int j;
			for(j=0;j<n-1;j++){
				score=in();
				if(score==0)team[i].first+=100;
				if(score==2)team[i].first++;
//cout<<" "<<score<<endl;
			}
//cout<<team[i].second<<" "<<team[i].first<<endl;
		}
		int a,b;
		for(a=0;a<n;a++){
			for(b=0;b<n-1;b++){
				if(team[b].first<team[b+1].first){
					pair<int,string> buf;
					buf=team[b];
					team[b]=team[b+1];
					team[b+1]=buf;
				}
			}
		}
		for(i=0;i<n;i++){
			cout<<team[i].second<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define BIL ((ll)1e9)
#define MOD ((ll)1e9+7)
#define INF (1LL<<60)           //1LL<<63でオーバーフロー
#define inf (1<<29)             //1<<29でオーバーフロー

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

    int ans=-1;
    for(int i=1;i<=1000;i++){
        int tax8=i*108/100-i;
        int tax10=i*110/100-i;

        if(tax8==a && tax10==b){
            ans=i;
            break;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3644
//It doesn't matter as long as you rise to the top - Katsuki Bakugo
#include<bits/stdc++.h>
using namespace std;
     
     
#define Fast_as_duck ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back 
#define forn(i,st,n) for(int i = st; i < n ; i++)
#define rev(i,st,n) for(int i = st; i >= n ; i--)
#define ss second
#define ff first
#define ll long long 

typedef pair <int , int> pii;

const int N = 1e5 + 10 , mod =  1000000007;

void solve(){

    ll n , d; cin >> n >> d;
    ll x , y;

    ll st  , dis , ans = 0;
    forn(i,0,n){
        cin >> x >> y;
        dis = x*x + y*y ;
        st = sqrt(dis);

        if(st < d)ans++;
        else if(st == d){
            if(st * st == dis)ans++;
        }

    }
    
    cout << ans << "\n";


    
    

    
    
        


}

int main(){
    Fast_as_duck;

/*
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
*/
    int t = 1; 
    
    // cin >> t;
    

    while(t--){
        solve();
    }




    return 0;
}
      
       


Measured memory_bytes: 3708
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>

using namespace std;

int main()
{
  int N;
  cin >> N;
  if (N == 0) {
    cout << "0" << endl;
  }

  else {
    vector<int> v;
    int x = abs(N);
    while (x > 0) {
      v.push_back(x % 2);
      x /= 2;
    }
    v.push_back(0);
    v.push_back(0);
    int n = v.size();
    for (int i = 0; i < n; ++i) {
      if (i % 2 == (N > 0 ? 0 : 1)) {
	if (v[i] == 0 or v[i] == 1) {
	  continue;
	}
	else {  // v[i] == 2
	  v[i] = 0;
	  v[i + 1] += 1;
	}
      }
      else {
	if (v[i] == 0) {
	  continue;
	}
	else if (v[i] == 1) {
	  v[i + 1] += 1;
	}
	else {  // v[i] == 2
	  v[i] = 0;
	  v[i + 1] += 1;
	}
      }
    }      

    stringstream ss;
    for (int i = n - 1; i >= 0; --i) {
      ss << v[i];
    }
    string s = ss.str();
    auto first = find(s.begin(), s.end(), '1');
    for (auto it = first; it != s.end(); ++it) {
      cout << *it;
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; //10^9
const ll inff = 1000000000000000000; //10^18

int main(){
    int n;
    cin >> n;
    int acou = 0, ans = 0;
    for(int i = 1; i <= n; i++) {
        int cou = 0;
        bool t = true;
        int x = i;
        while(t) {
            if(x%2 == 0) {
                cou++;
                x /= 2;
            }
            else {
                t = false;
                break;
            }
        }
        if(acou <= cou) {
            acou = cou;
            ans = i;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 1000000007;

long long div(long long a, long long b, long long c) { return b / c - (a - 1) / c; }

void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}
long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}
void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}
#define REP(i, n) for (long long i = 0; i < (n); i++)
vector<int> h, memo;

// int dp(int n) {
//     if (memo[n] != -1) {
//         return memo[n];
//     }
//     if (n == 0) {
//         return 0;
//     }
//     if (n == 1) {
//         return abs(h[1] - h[0]);
//     }
//     memo[n] = min(dp(n - 1) + abs(h[n] - h[n - 1]), dp(n - 2) + abs(h[n] - h[n - 2]));
//     return min(dp(n - 1) + abs(h[n] - h[n - 1]), dp(n - 2) + abs(h[n] - h[n - 2]));
// }

signed main() {
    int n, ma = 0;
    string s;
    cin >> n >> s;
    REP(i, n) {
        map<char, bool> cnt;
        // cout << i << endl;
        int maxc = 0;
        for (int j = 0; j <= i; j++) {
            cnt[s[j]] = true;
        }
        for (int j = i + 1; j < n; j++) {
            // cout << j << endl;
            if (cnt[s[j]]) {
                maxc++;
                // cout << s[j] << endl;
                cnt[s[j]] = false;
            }
        }
        if (maxc > ma) {
            ma = maxc;
        }
    }
    cout << ma << endl;
}

Measured memory_bytes: 256
D = int(input())
C = [int(i) for i in input().split()]
S = [[int(i) for i in input().split()] for j in range(D)]

total = 0
last = [0] * 26
ans = []
for i in range(1, D+1):
    score = [0] * 26
    for t in range(26):
        score[t] += S[i-1][t-1]
        for j in range(26):
            if j != t:
                score[t] -= C[j] * (i - last[j])
    total += max(score)
    last[score.index(max(score))] = i
    ans.append(score.index(max(score))+1)

for i in range(D):
    print(ans[i])

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

using namespace std;
using ll = long long;
const ll gsc = (1e15)*5;

int main() {
    string S;
    ll K;
    cin >> S >> K;
    int now = 0;
    for(int i = 0; i < S.size(); i++) {
        if(S.at(i) != '1') {
            //cout << i << endl;
            now = i;
            break;
        }
    }
    //cout << now << endl;
    if(now < K) {//1を超える時
        //cout << "##" << endl;
        cout << S.at((now != 0)*(now)*(now < S.size())) << endl;
    } else {//1を超えない時
        cout << 1 << endl;
    }



    return 0;
}

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


long dp(long i,vector<long>& h,vector<long>& arr){
    long n=h.size()-1;
  	if(i==n) return 0;
     if(arr[i]!=-1) return arr[i];
  long ans;
  if(i<n-1){
   ans=min(abs(h[i]-h[i+1])+dp(i+1,h,arr) , abs(h[i]-h[i+2])+dp(i+2,h,arr));
  arr[i]=ans;
  return ans;
  }
  ans=abs(h[i]-h[i+1]+dp(i+1,h,arr));
  arr[i]=ans;
	return ans;
	//memset(array, 0, sizeof(array[0][0]) * m * n);

}
int main(){
   // memset(arr, -1, sizeof(arr[0]) * 100000);
	long n,x;
	vector<long> arr(100000,-1);
  	cin>>n;
  vector<long> v;
  	for(int i=0;i<n;i++){
      cin>>x;
      v.push_back(x);
    }
  long ans=dp(0,v,arr);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 4340
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))



S=one_str()
K=one_int()

before = S[0]
count=1
ranrength = []
for i in S[1:]:
    if before==i:
        count+=1
    else:
        ranrength.append(count)
        count=1
    before=i

ranrength.append(count)

output_count=0
for r in ranrength:
    if r>1:
        output_count += r//2
output_count *= K

if S[0]==S[-1]:
    head=ranrength[0]
    tail=ranrength[-1]
    
    if head>1 and head%2==1 and tail>1 and tail%2==1:
        output_count += (K-1)

if len(ranrength)==1:
    print(ranrength[0]*K//2)
else:
    print(output_count)

Measured memory_bytes: 3064
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
  return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

N = I()
u,v,w = Line(N-1)

c = [[] for _ in range(N)]
for i in range(N-1):
  c[u[i]-1].append([v[i]-1, w[i]])
  c[v[i]-1].append([u[i]-1, w[i]])

d=[-1]*N
v=0
check_visited = [False]*N
check_visited[v] = True
S = [v]
d[v]=0
while S:
  v1 = S.pop()
  for i in c[v1]:
    if check_visited[i[0]] == False:
      check_visited[i[0]] = True
      d[i[0]] = d[v1] + i[1]
      S.append(i[0])

for i in range(N):
  if d[i]%2==0:
    print('0')
  else:
    print('1')

Measured memory_bytes: 98268
N = int(input())
a = list(map(int,input().split()))
pre_len = len(a) # 最初の長さ
ans = list()

target = 1
for i in range(N):
	if a[i] == target:
		ans.append(i+1)
		target += 1


if len(ans) == 0:
	print(-1)
else:
	print(pre_len-len(ans))

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

int main() {
  int N;
  cin >> N;
  bool can = false;
  for (int i = 1; i < 10; i++) {
    for (int j = 1; j < 10; j++) {
      if (N == i*j) {
        can = true;
        break;
      }
    }
  }
  if (can) cout << "Yes";
  else cout << "No";
}


Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,dp[50],L,cnt,ok;
bool ch(void){
    for(int i=0;i<n;i++){
        if(dp[i]>=n)return false;
    }
    return true;
}
void act1(void){
    sort(dp,dp+n);
    L=min(dp[0],dp[n-1]-n+1);
    //cout<<'1'<<" "<<dp[n-1]<<" "<<L<<endl;
    cnt+=n*L;
    for(int i=0;i<n;i++)dp[i]-=L;
    return ;
}
void act2(void){
    sort(dp,dp+n);
    L=dp[n-1]/n;
    if(L==0)ok=0;
    //cout<<'2'<<" "<<dp[n-1]<<" "<<L<<endl;
    cnt+=L;
    dp[n-1]=dp[n-1]%n;
    for(int i=0;i<n-1;i++)dp[i]+=L;
    return ;
}
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>dp[i];
        //cout<<dp[i]<<endl;
    }
    while(1){
        if(ch())break;
        act1();
        ok=1;
        while(ok==1){
        if(ch())break;
        act2();
        }
    }
    cout<<cnt<<endl;
    //for(int i=0;i<n;i++)cout<<dp[i]<<endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<functional>

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;


int main(void)
{
	int y, m, d;

	while(scanf("%d/%d/%d", &y, &m, &d)==3)
	{
		int x=y*10000+m*100+d;
		char *ans="TBD";

		if(x<=20190430) ans="Heisei";

		printf("%s\n", ans);
	}

	return 0;
}


Measured memory_bytes: 128
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30)+(1<<29);
const ll nmax=2e5+50;
const int mod=1e9+7;
using namespace std;
int n,q,i,x,rs[nmax];
pair<int,pair<int,int> >a[nmax];
set<pair<int,int> >s;
set<pair<int,int> >::iterator it;
pair<int,int>p;
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>n>>q;
	for(i=1;i<=n;i++)
	{
		cin>>a[i].sc.fr>>a[i].sc.sc>>a[i].fr;
		a[i].sc.sc--;
		a[i].sc.fr-=a[i].fr;
		a[i].sc.sc-=a[i].fr;
	}
	for(i=1;i<=q;i++)
	{
		cin>>x;
		s.in({x,i});
	}
	sort(a+1,a+n+1);
	for(i=1;i<=n;i++)
	{
		while(1)
		{
			if(s.empty())break;
			it=s.lower_bound({a[i].sc.fr,-1});
			if(it==s.end())break;
			p=(*it);
			if(p.fr>a[i].sc.sc)break;
			rs[p.sc]=a[i].fr;
			s.er(it);
		}
	}
	for(i=1;i<=q;i++)
	{
		if(!rs[i])rs[i]=-1;
		cout<<rs[i]<<endl;
	}
    return 0;
}

Measured memory_bytes: 14464
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() /4;
const ll linf = numeric_limits<ll>::max() /4;
const ull ulinf = numeric_limits<ull>::max()/4;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

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

int n,m,a,b,c;
int d[100005] = {};
string s;

int main(){

    cin >> m;

    P(24-m + 24);
	
	return  0;
}

Measured memory_bytes: 256
#include <stdio.h>

static const int MAX = 100;

void Print(int A[], int N)
{
    for (int i = 0; i < N; i++) {
        if (i > 0)
            printf(" ");
        printf("%d", A[i]);
    }
    printf("\n");   
}

int main()
{
    int N;
    int A[MAX];

    scanf("%d", &N);

    for (int i = 0; i < N; i++) {
        scanf("%d", &A[i]);
    }

    for (int i = 0; i < N; i++) {
        int v = A[i];
        int j = i - 1;

        while (j >= 0 && A[j] > v) {
            A[j + 1] = A[j];
            j--;
        }

        A[j + 1] = v;
        Print(A, N);
    }

    return 0;
}


Measured memory_bytes: 2104
/*
 * author :Sadik Hassan(_sad_)
 *
*/
#include "bits/stdc++.h"
using namespace std;
using   ll       =    long long;
using   ld       =    long double;
#define nl            "\n"
#define pb            push_back
#define fi            first
#define se            second
#define MP            make_pair
#define PI            (acos(-1.0))
#define rep1(i,n)     for(int i=1;i<=n;i++)
#define rep(i,n)      for(int i=0;i<n;i++)
#define SZ(s)         (int)s.size()
#define all(x)        (x).begin(), (x).end()
#define rall(x)       (x).rbegin(), (x).rend()
#define w(t)          int t;cin>>t;while(t--)
#define TSU(s)        transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSL(s)        transform(s.begin(),s.end(),s.begin(),::tolower);
#define _SAD()     	  ios::sync_with_stdio(0),cin.tie(0),cout.tie(0),cout<<fixed<<setprecision(15);

typedef vector<int>vi;
typedef vector<ll>vii;
typedef set<int>si;
typedef set<ll>sii;
/*---------------------------------------------------------------------*/

const int N = (int)1e6+1;
const ll MOD =(ll)1e9+1147483647;
const ll INF = (ll)1e18+5;

int main()
{
    _SAD()
    int n,cnt=0;
    cin>>n;
    ld d;
    cin>>d;
    while(n--)
    {
        ld x,y,z;cin>>x>>y;
        z=sqrt((x*x)+(y*y));
        if(z<=d)cnt++;
    }
    cout<<cnt<<nl;
    return 0;
}


Measured memory_bytes: 3832
from itertools import permutations
from math import sqrt

N = int(input())
pos = {i: tuple(map(int, input().split())) for i in range(1, N + 1)}


total = 0
for i, permutation in enumerate(permutations([i for i in range(1, N + 1)]), 1):
    for j in range(N - 1):
        x_i, y_i = pos[permutation[j]]
        x_j, y_j = pos[permutation[j + 1]]
        dis = sqrt((x_i - x_j) ** 2 + (y_i - y_j) ** 2)
        total += dis

print(total / i)

Measured memory_bytes: 9044
#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(){
	ll a,b,c,k;
	cin >> a >> b >> c >> k;
	ll ans = 0;
	if(k <= a){
	 rep(i,k) ans++;
	 cout << ans << endl;
	 return 0;
	}
	else if(k > a && k <= b){
		rep(i,a) ans++;
		cout << ans << endl;
		return 0;
	}
	else{
		rep(i,a) ans++;
		rep(i,k-b-a) ans--;
		cout << ans << endl;
		return 0;
	}
}

Measured memory_bytes: 3640
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll = long long; 
using ld = long double;
#define endl "\n"
//#define int long long
#define ALL(x) sort(x.begin(),x.end())
#define RALL(x) sort(x.rbegin(),x.end())
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
const int MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const int inf = 1 << 25;
constexpr long double pi = 3.141592653589793238462643383279;
int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
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;
}
ll fact_mod(ll n, ll mod) {
    ll f = 1; for (int i = 2; i <= n; i++) f = f * (i % mod) % mod;
    return f;
}
ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}
ll keta(ll n) {
    if (n == 0) return 1;
    ll count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {
    ll sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
ll mch(ll n) {
    if (n == 1) return 1;
    else return n * mch(n - 1);
}
ll pow_mod(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = (res * x) % mod; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % mod;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}
ll inv_mod(ll a, ll mod) {
    ll b = mod, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= mod;
    if (u < 0) u += mod;
    return u;
}
bool is_prime(const unsigned n) {
    switch (n) {
    case 0: // fall-through
    case 1: return false;
    case 2: // fall-through
    case 3: return true;
    } // n > 3 が保証された
    if (n % 2 == 0 || n % 3 == 0) return false;
    for (unsigned i = 5; i * i <= n; i += 6) {
        if (n % i == 0) return false; // (6の倍数)-1
        if (n % (i + 2) == 0) return false; // (6の倍数)+1
    }
    return true;
}
//関数とか

//宣言とか
ll n;
ll ans;
/*signed*/int main(void) {
    cin >> n;
    if (n % 2) ans = 0;
    else {
        n /= 2;
        while (n) ans += n /= 5;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3596
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

prime_lst = primes(55555)

n = int(input())
count = 0
for i in primes(55555):
    if i % 10 == 7:
        print(i)
        count += 1
    if count == n:
        break

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#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;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    ll n,a,b;
    cin>>n>>a>>b;
    Vec p(n);
    rep(i,n)cin>>p[i];
    ll x=0;
    ll y=0;
    ll z=0;
    rep(i,n){
        if(p[i]<=a){
            x++;
        }else if(p[i]<=b){
            y++;
        }else{
            z++;
        }
    }

    ll ans=INF;
    chmin(ans,x);
    chmin(ans,y);
    chmin(ans,z);
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  int sum = 0;
  vector<int> vec(N);
  for(int i=0; i<N; i++){
    cin >> vec.at(i);
    sum += vec.at(i);
  }
  vector<int> div(0);
  //約数列挙
  for(int n=1; n*n<=sum; n++){
    if(sum %n == 0){
      div.push_back(n);
      if(sum /n != n){
        div.push_back(sum /n);
      }
    }
  }
  sort(div.rbegin(),div.rend());
  for(int i=0; i<div.size(); i++){
    bool flag = true;
    vector<int> amari(0);
    int sum_a = 0;
    int d = div.at(i);
    for(int j=0; j<N; j++){
      if(vec.at(j) %d == 0){
        continue;
      }
      else{
        amari.push_back(vec.at(j) % d);
        sum_a += vec.at(j) % d;
      }
    }
    if(sum_a %d != 0){
      flag = false;
    }
    else{
      int x = sum_a / d;
      int cnt = 0;
      sort(amari.rbegin(),amari.rend());
      for(int j=0; j<x; j++){
        cnt += amari.at(j);
      }
      if(sum_a - cnt > K){
        flag = false;
      }
    }
    if(flag){
      cout << d << endl;
      break;
    }
  }
}

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

using ll = long long;
#define repi(n) for (int i = 0; i < (n); i++)
#define repj(n) for (int j = 0; j < (n); j++)
#define repk(n) for (int k = 0; k < (n); k++)
#define repl(n) for (int l = 0; l < (n); l++)
#define rep(i, n) for (int i = 0; (i) < (n); i++)
#define repr(i, a, b) for (auto i = (a); i < (b); i++)
#define repv(itr) for (auto&& v : (itr))
#define updatemax(t, v) (t = max((t), (v)))
#define updatemin(t, v) (t = min((t), (v)))
const int dx[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, -1, 1, -1, 1};
template <typename T>
T minptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i < *re) re = i;
  }
  return re;
}
template <typename T>
T maxptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i > *re) re = i;
  }
  return re;
}
int __vmax(int x) {
  return INT_MAX;
}
double __vmax(double x) {
  return 1e+300;
}
ll __vmax(ll x) {
  return LLONG_MAX;
}
int __vmin(int x) {
  return INT_MIN;
}
double __vmin(double x) {
  return -1e+300;
}
ll __vmin(ll x) {
  return LLONG_MIN;
}
ll modpow(ll a, ll b, ll m) {
  ll re = 1, k = 1;
  while (k <= b) {
    if (b & k) {
      re *= a;
      re %= m;
    }
    k = k << 1;
    a *= a;
    a %= m;
  }
  return re;
}
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
template <typename T>
vector<T> lis(T begin, T end, bool allowequal = false, bool lds = false) {
  using V = typename iterator_traits<T>::value_type;
  int n = end - begin;
  vector<V> a(n, lds ? __vmin(*begin) : __vmax(*begin));
  vector<int> id(n);
  if (lds && allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (lower_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (lds) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (upper_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = upper_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  } else {
    for (int i = 0; i < n; i++) {
      id[i] = lower_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  }
  int m = *maxptr(id.begin(), id.end());
  vector<T> re(m + 1);
  for (int i = n - 1; i >= 0; i--) {
    if (id[i] == m) re[m--] = begin + i;
  }
  return re;
}

int b[100100];
int main() {
  int n;
  cin >> n;
  b[0] = b[n] = INT_MAX;
  repi(n - 1) cin >> b[i + 1];
  ll re = 0;
  repi(n) re += min(b[i], b[i + 1]);
  cout << re << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <map>

using namespace std;

typedef pair<long, long> P;

int main() {
    size_t n;
    cin >> n;
    vector<P> balls;
    map<P, long> pqs;
    for (size_t i=0; i<n; i++) {
        long x, y; cin >> x >> y;
        for (size_t j=0; j<i; j++) {
            P ball = balls[j];
            long a = ball.first - x,
                 b = ball.second - y;
            if (a == 0 && b == 0) continue;
            if (a < 0) {
                a = -a;
                b = -b;
            }
            if (a == 0 && b < 0) b = -b;
            P ab = {a, b};
            if (pqs.find(ab) != pqs.end())
                pqs[ab]++;
            else
                pqs[ab] = 1;
        }
        balls.push_back({x, y});
    }
    long best = 0;
    for (auto pq:pqs) {
        best = max(best, pq.second);
    }
    cout << n - best << '\n';
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
using ll = long long;

int main(){
    int n;
    cin >> n;
    map<int,int> mp;
    for (int i=1;i<n;i++){
        int a;
        cin >> a;a--;
        mp[a] ++;
    }
    for (int i=0;i<n;i++){
        cout << mp[i] << endl;;
    }


    return 0;
}

Measured memory_bytes: 12976
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const int MOD = 998244353;
const ll INF = 1000000000000000000;

vector<int> G[200010];
int d[200010];
void dfs(int v, int parent) {
	for (int to : G[v]) {
		if (to == parent) continue;
		d[to] += d[v];
		dfs(to, v);
	}
}
int main()
{
	int N, Q;
	cin >> N >> Q;
	for (int i = 0; i < N - 1; i++) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	while (Q--) {
		int p, x;
		cin >> p >> x;
		p--;
		d[p] += x;
	}
	dfs(0, -1);
	for (int i = 0; i < N; i++) {
		if (i != 0) cout << " ";
		cout << d[i];
	}
	cout << endl;
}

Measured memory_bytes: 27824
import collections

mod=10**9+7
n=int(input())
arr=list(map(int,input().split()))
dic=collections.defaultdict(int)
dic[-1]=3
ans=1
for i in range(n):
  dic[arr[i]]+=1
  ans*=dic[arr[i]-1]
  ans%=mod
  dic[arr[i]-1]-=1
print(ans)    

Measured memory_bytes: 18648
#include <iostream>
#include <string>
#include <cstdio>
#include <cmath>

using namespace std;

int main (void) {
	int n, MAX = 9, count;
	
	while (scanf("%d", &n) != EOF) {
		count = 0;
		
		for (int a = 0; a <= MAX; a ++) {
			for (int b = 0; b <= MAX; b ++) {
				for (int c = 0; c <= MAX; c ++) {
					for (int d = 0; d <= MAX; d ++) {
						if (a + b + c + d == n) {
							count ++;
						}
					}
				}
			}
		}
		
		cout << count << endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
n, q = map(int, input().split())
g = [[] for _ in range(n)]
for _ in range(n - 1):
    ai, bi = map(int, input().split())
    g[ai - 1].append(bi - 1)
    g[bi - 1].append(ai - 1)

ans = [0] * n
for _ in range(q):
    pi, xi = map(int, input().split())
    ans[pi - 1] += xi


def dfs(v, p=-1):
    for u in g[v]:
        if u == p:
            continue
        ans[u] += ans[v]
        dfs(u, v)


dfs(0)
print(*ans)

Measured memory_bytes: 268464
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){
  int W,H,N;
  int p;
  int cunt=0,in=1,out=1;

  cin>>W>>H;
  cin>>N;
  
  for(int i=0;i<N;i++){
    cin>>p;
    if(p==1)
      in++;
    else
      out++;
    
    if(in<=W-1 && out<=W-1){
      if(in==out)
        cunt++;
    }
    else if(W-1<=in && in<=W+H-4 && W+1<=out && out<=W+H-2){
      if(out==in+2)
        cunt++;
    }
    else if(W+H-4<=in && W+H-2<=out){
      if(out==in+4)
        cunt++;
    }
  }

  cout<<cunt<<endl;
  return 0;
}



Measured memory_bytes: 3104
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

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; }

using ll = long long;

ll N;
ll A[100010], B[100010];
std::vector<ll> vs;
ll sum = 0, ans = 0;

int main()
{
  std::cin >> N;

  rep( i, N )
    std::cin >> A[i];

  rep( i, N )
    std::cin >> B[i];

  rep( i, N )
  {
    if( A[i] >= B[i] )
      vs.emplace_back( A[i]-B[i] );
  }

  std::sort( rall(vs) );

  rep( i, N )
  {
    if( A[i] < B[i] )
      sum += B[i]-A[i], ++ans;
  }

  bool fl = false;

  rep( i, vs.size() )
  {
    if( sum <= 0 )
    {
      fl = true;

      break;
    }

    sum -= vs[i];

    ++ans;
  }

  if( sum <= 0 )
    fl = true;

  std::cout << (fl?ans:-1) << std::endl;

  return 0;
}

Measured memory_bytes: 2936
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;


public class Main {
    static final int UNCALC = -1;
    static final long INF = (long) 1e18;
    static final int mod = (int) (1e9 + 7);
    static int n, m;
    static char[] s, t;
    static int memo[][];
    static StringBuilder ans;

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        s = sc.next().toCharArray();
        t = sc.next().toCharArray();
        n = s.length;
        m = t.length;
        memo = new int[n][m];
        for (int[] a : memo)
            Arrays.fill(a, UNCALC);
        dp(0, 0);
        ans = new StringBuilder();
        trace(0, 0);
        out.println(ans);
        out.flush();
        out.close();

    }

    static int dp(int i, int j) {
        if (i == n || j == m) return 0;
        if (memo[i][j] != UNCALC) return memo[i][j];
        int max = Math.max(dp(i + 1, j), dp(i, j + 1));
        max = Math.max(max, (s[i] == t[j] ? 1 : 0) + dp(i + 1, j + 1));
        return memo[i][j] = max;
    }

    static void trace(int i, int j) {
        if (i == n || j == m) return;
        int opt = memo[i][j];
        if (s[i] == t[j] && dp(i + 1, j + 1) == opt - 1) {
            ans.append(s[i]);
            trace(i + 1, j + 1);
            return;
        }
        if (opt == dp(i + 1, j)) {
            trace(i + 1, j);
            return;
        }
        if (opt == dp(i, j + 1)) trace(i, j + 1);
    }


    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        Scanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

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

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

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


    }

}

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

#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

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

const int N = 1e5 + 5;

int main() {

	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	int n; cin >> n;
	string s, t; cin >> s >> t;
	for (int i = 0; i < n; i++) cout << s[i] << t[i];
	cout << endl;

	return 0;
}


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

using namespace std;

#define ll long long
#define ld long double
#define ff first
#define ss second
#define rsz resize
#define ins insert 
#define mp make_pair
#define pf push_front 
#define pb push_back
#define eb emplace_back 
#define ft front() 
#define bk back()
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define deb(x) cout<<#x<<" "<<x<<'\n';
#define rep(i,a,b) for (int i = (a); i < (b); ++i)

const ll mod = 1e9+7; // 998244353;
const ll inf = 1e18; 
const ld pie = acos((ld)-1);

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



int main(){
    
	int a[3];
	scanf("%d%d%d",&a[0],&a[1],&a[2]);
	sort(a,a+3);
	if(a[0]==5&&a[1]==5&&a[2]==7){
		printf("YES\n");
	}else{
		printf("NO\n");
	}


	return 0;

	/*STUFF TO LOOK:	
		1. Check the constraints
		2. Corner cases(n==0||n==1)
		3. Variables in loops
		4. Make sure two ints aren’t multiplied to get a long long
		5. Don't use scanf or printf while using ios_base
		6. using the local variable of the same name when global variable was required to be used
	*/
}


Measured memory_bytes: 3684
#include <iostream>
#include <algorithm>
#include <map>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <iomanip>
using namespace std;

using int64 = long long;
using uint64 = unsigned long long;

#define repeat(i, x) for (int64 i = 0; (i) < (x); (i)++)
#define rev_repeat(i, x) for (int64 i = (x) - 1; (i) >= 0; (i)--)
#define countup(i, n) for (int64 i = 0; (i) <= (n); (i)++)
#define countdown(i, n) for (int64 i = (n); (i) >= 0; (i)--)
#define range(i, a, b) for (int64 i = (a); (i) < (b); (i)++)
#define traverse(it, ctn) for (auto it = begin(ctn); (it) != end(ctn); (it)++)
#define rev_traverse(it, ctn) for (auto it = rbegin(ctn); (it) != rend(ctn); (it)++)

template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec)
{
    os << "[";
    repeat (i, vec.size())
    {
        os << (i == 0 ? "" : ", ") << vec[i];
    }
    os << "]";
    return os;
}

template<typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& p)
{
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template<typename T>
ostream& operator<<(ostream& os, set<T>& s)
{
    os << "{";
    traverse (it, s)
    {
        if (it != s.begin()) os << ", ";
        os << *it;
    }
    os << "}";
    return os;
}

template<typename K, typename V>
ostream& operator<<(ostream& os, map<K, V>& m) 
{
    os << "{";
    traverse (it, m)
    {
        if (it != m.begin()) os << ", ";
        os << it->first << ": " << it->second;
    }
    os << "}";
    return os;
}

//
// _______  _____  _______  _____  _______ _______ _____ _______ _____ _    _ _______ 
// |       |     | |  |  | |_____] |______    |      |      |      |    \  /  |______ 
// |_____  |_____| |  |  | |       |______    |    __|__    |    __|__   \/   |______ 
//
//  _____   ______  _____   ______  ______ _______ _______ _______ _____ __   _  ______   /
// |_____] |_____/ |     | |  ____ |_____/ |_____| |  |  | |  |  |   |   | \  | |  ____  / 
// |       |    \_ |_____| |_____| |    \_ |     | |  |  | |  |  | __|__ |  \_| |_____| .  
//

map<int64, int64> factorize(int64 n)
{
    map<int64, int64> res;
    for (int64 m = 2; m * m <= n; m++)
    {
        while (n % m == 0)
        {
            res[m]++;
            n /= m;
        }
    }
    if (n != 1) res[n]++;
    return res;
}

int64 myPow(int64 a, int64 b)
{
    int64 res = 1;
    repeat (i, b)
    {
        res *= a;
    }
    return res;
}

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

    int64 n, p;
    cin >> n >> p;

    auto factors = factorize(p);

    int64 ans = 1;
    for (auto& mp : factors)
    {
        if (mp.second >= n)
        {
            ans *= myPow(mp.first, mp.second / n);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int w, h;
char s[55][55] = {};
int dy[8] = { 1, 1, 1, 0, 0, -1, -1, -1 };
int dx[8] = { -1, 0, 1, -1, 1, -1, 0, 1 };
int f[55][55] = {};

void dfs(int y, int x){
	if (y < 0 || h <= y || x < 0 || w <= x || f[y][x] || s[y][x] == '0') return;
	f[y][x] = 1;
	rep(i, 0, 8){
		int ny = y + dy[i], nx = x + dx[i];
		dfs(ny, nx);
	}
	return;
}

int main(){
	while (1){
		cin >> w >> h;
		if (w == 0 && h == 0) break;
		rep(i, 0, h){
			rep(j, 0, w){
				cin >> s[i][j];
			}
		}
		rep(i, 0, 55){
			rep(j, 0, 55){
				f[i][j] = 0;
			}
		}
		int c = 0;
		rep(i, 0, h){
			rep(j, 0, w){
				if (s[i][j] == '1' && f[i][j]==0){
					dfs(i, j);
					c++;
				}
			}
		}
		o(c);
	}
}

Measured memory_bytes: 1248
from collections import defaultdict
import sys

input = sys.stdin.buffer.readline

def scc(V, E):
    # g = defaultdict(list)
    g = [list() for _ in range(len(V))]
    # rg = defaultdict(list)
    rg = [list() for _ in range(len(V))]
    for u, v in E:
        g[u].append(v)
        rg[v].append(u)


    o = []
    done = set()
    for u in V:
        if u in done:
            continue

        s = [(u, True)]
        while s:
            u, f = s.pop()
            if f:
                if u in done:
                    continue
                done.add(u)
                s.append((u, False))
                for v in g[u]:
                    if v in done:
                        continue
                    s.append((v, True))
            else:
                o.append(u)

    done = set()
    ans = []
    while o:
        u = o.pop()
        if u in done:
            continue

        s = [u]
        vv = [u]
        done.add(u)
        while s:
            u = s.pop()
            for v in rg[u]:
                if v in done:
                    continue
                vv.append(v)
                s.append(v)
                done.add(v)
        ans.append(vv)


    return ans


def atcoder_practice2_g():
    N, M = map(int, input().split())

    E = []
    for _ in range(M):
        a, b = map(int, input().split())
        E.append((a, b))
    V = list(range(N))
    vv = scc(V, E)
    print(len(vv))
    for r in vv:
        print(len(r), *r)


def test():
    g = {
        1: [2],
        5: [2],
        2: [4, 3],
        3: [4, 7, 6],
        4: [5, 8],
        6: [9],
        7: [8],
        8: [9],
        9: [7, 10],
        10: []
    }

    V = list(range(1, 11))
    E = []
    for u, e in g.items():
        for v in e:
            E.append((u, v))

    vv = scc(V, E)
    for r in vv:
        print(r)


if __name__ == "__main__":
    # test()
    atcoder_practice2_g()


Measured memory_bytes: 317960
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>
#include<complex>
#include<queue>
#include<stdlib.h>
#include<map>
#include<cmath>
#include<stdio.h>
#include<stdlib.h>
#include<set>

#define ll long long
#define MOD 1000000007

using namespace std;

int main(){
    double A,B,C,D,E,F;
    cin>>A>>B>>C>>D>>E>>F;
    vector<double> eau;
    for(double i=0;i<(F/(100*A))+1;i++){
        for(double j=0;j<(F/(100*B))+1;j++){
            if(100*i+100*j<=F){
                eau.push_back(double(100*A*i+100*B*j));
            }else{
                break;
            }
        }
    }
    /*for(int i=0;i<eau.size();i++){
        cout << eau[i] << " ";
    }
    cout << endl;*/
    vector<double> sato;
    pair<double,double> p;
    double node=0.0;
    p=make_pair(0,0);
    for(double i=0;i<((F*E)/(100.0*C))+1;i++){
        for(double j=0;j<((F*E)/(D*100.0))+1;j++){
            sato.push_back(double(C*i+D*j));
        }
    }
    /*for(int i=0;i<sato.size();i++){
        cout << sato[i] << " ";
    }
    cout << endl;*/
    for(double i=0;i<eau.size();i++){
        for(double j=0;j<sato.size();j++){
            if(eau[i]+sato[j]<=F){
                if((eau[i]*E/100.0)>=sato[j]){
                    if(node<=sato[j]/(eau[i]+sato[j])){
                        //cout << eau[i] << " " << sato[j] << endl;
                        node=sato[j]/(eau[i]+sato[j]);
                        p=make_pair(eau[i],sato[j]);
                    }
                }
            }
        }
    }
    cout << p.first+p.second << " " << p.second << endl;
    return 0;
}


Measured memory_bytes: 5744