akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>


/* 
*    coder :: ATUL_PANDEY_2608
*        >>> INDIA <<<
*/	
using namespace std;
using namespace __gnu_pbds;

// #define  part ..
#define pb(a) push_back(a)
#define all(a) a.begin(),a.end() 
#define mod 1000000007
//#define maxx 200006
#define ll long long 
#define quick    ios_base::sync_with_stdio(NULL),cin.tie(0);
#define listll vector< long long > 
#define listi vector< int> 
#define pii   pair<int , int> 
#define pll pair<long long , long long > 
#define minheap priority_queue<long long , vector< long long >, greater<long long > >
#define rep(i,a,b) for(int i=a;i<b;i++)

ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

ll power( ll a, ll n, ll m= 1000000007){
  ll ans = 1;
  while(n){
  if(n&1)
  {
  ans *= a;
  ans%=m;
  }
  a*=a;
  a%=m;
  n/=2;
  }
  return ans ;
} 


vector< int > prm ;
vector < bool > vsp ;

void prime ( int nn = 100000 ) {
	vsp = vector < bool > ( nn+1, 0 );
	int size_prime = nn;
	for( ll i =2; i*i < size_prime ; i++){
		
		if( vsp[i] == 1)
		continue;
		for(ll j = i*i; j < size_prime ;j+=i){
			
			vsp[j] =1;
			
		}
		
		
	}
	
	for( int i= 2; i < size_prime ; i++)
	if (vsp[i] == 0)
	prm.pb(i);
	
	
}


template < class T > using oset = tree< T , null_type, less  < T  > , rb_tree_tag , tree_order_statistics_node_update > ;


// end of #define 

// define globals ...
const int maxx = 2e5+26;

//write function from here ...
// never forget  to recheck your predefined function in template .. 
// already defined ::  prime , power , gcd : ( ll ).. 








int Main(){
  
  
  
  int n;
  
  cin>>n;
  
  ll ans = 0;
  
  for ( ll i = 1 ; i  <n;i++){
	  
	  ll mn = 1;
	  ll mx = n / i ;
	  if( n%i == 0  ){
		  mx -- ;
	  }
	  
	  ans+= ( mx - mn +1 );
	  
	  
	  
  }
  
  cout <<ans <<endl;
  
  
  
  
return 0;

}






int main(){
 quick;
int t =1; 
//cin>>t;
while(t-- )
 Main();

 return 0;
}


  




Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cctype>
#define rep(i,a,b) for(int i=(a);i<b;i++)
#define INF 1000000000
#define MAX_N 100000000
using namespace std;
bool debug=false;

int main(){
  double a,b,c,d;
  cin>>a>>b>>c>>d;
  printf("%.7f\n",sqrt(pow(a-c,2)+pow(b-d,2)));
  return 0;
}

Measured memory_bytes: 3284
fun main(args: Array<String>) {
    abc145d()
}

private const val MOD = (1e9 + 7).toLong()
private fun mod(x: Long): Long = x % MOD

private const val MAX = 1000000
private val fac = LongArray(MAX)
private val fInv = LongArray(MAX)
private val inv = LongArray(MAX)

fun nCkInit() {
    fac[0] = 1
    fac[1] = 1
    fInv[0] = 1
    fInv[1] = 1
    inv[1] = 1
    for (i in 2 until MAX) {
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[(MOD % i).toInt()] * (MOD / i) % MOD
        fInv[i] = fInv[i - 1] * inv[i] % MOD
    }
}

fun nCk(n: Int, k: Int): Long {
    if (n < k) return 0
    if (n < 0 || k < 0) return 0
    return fac[n] * (fInv[k] * fInv[n - k] % MOD) % MOD
}

fun abc145d() {
    val (x, y) = readLine()!!.split(' ').map { it.toInt() }

    if ((x + y) % 3 != 0) return println(0)

    val n = (2 * y - x) / 3
    val m = y - 2 * n

    nCkInit()
    val answer = nCk(n + m, n)

    println(answer)
}


Measured memory_bytes: 62916
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()
ac = 0
wa = 0
tle = 0
re = 0
for _ in range(N):
    t = S()
    if t == 'AC':
        ac += 1
    elif t == 'WA':
        wa += 1
    elif t == 'TLE':
        tle += 1
    elif t == 'RE':
        re += 1
print('AC x {}'.format(ac))
print('WA x {}'.format(wa))
print('TLE x {}'.format(tle))
print('RE x {}'.format(re))

Measured memory_bytes: 73800
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,sum,ans,i,j;
    cin>>n;
    vector<int>v(n);
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
    }
    sort(v.begin(),v.end());
    ans=INT_MAX;
    for(i=v[0];i<=v[n-1];i++)
    {
        sum=0;
        for(j=0;j<n;j++)
        {
             sum+=pow(i-v[j],2);
        }
           ans=min(ans,sum);
    }
    cout<<ans<<endl;
    v.clear();
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>

using namespace std;
#define ll long long
#define ld long double
#define int long long
#define all(a) (a).begin(),(a).end()
#define EPS (1e-13)
#define fs first
#define sc second
#define xx first
#define yy second.first
#define zz second.second
#define P pair<int, int>
#define Q pair<int, pair<int, int>>
#define rep(i,n) for(int (i) = 0 ; (i) < (n) ; (i)++)
#define mkp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define crdcomp(b) sort(all((b)));(b).erase(unique(all((b))),(b).end())
const int Mod = 1e9 + 7;
const int mod = 998244353;
const ll Inf = 3 * 1e18;
const int inf = 15 * 1e8;
ll read() {
	ll u, k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}
ll bcount(ll x) {
	int sum = 0;
	for (int i = 0; i < 20; i++)
		if ((1ll << i) & x) sum++;
	return sum;
}
/*const int fn_ = 2000000;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll mod = Mod) {
	if (!fact_[0]) {
		fact_[0] = 1; comp_[0] = 1;
		for (int i = 1; i < fn_; i++) {
			fact_[i] = fact_[i - 1] * i % mod;
			comp_[i] = mod_pow(fact_[i], mod - 2, mod);
		}
	}
	if (x < y) return 0;
	return fact_[x] * comp_[x - y] % mod * comp_[y] % mod;
}*/
//---------------------------------------------------
int n;
int a[500000];
vector<int>e[500000];
int dp[500000];
signed main() {
	cin >> n;
	for (int i = 1; i < n; i++) {
		int u, v;
		cin >> u >> v;
		e[u].push_back(v);
		e[v].push_back(u);
	}
	fill(a + 2, a + n + 1, inf);
	queue<int>q;
	q.push(1);
	while (!q.empty()) {
		int t = q.front(); q.pop();
		for (auto g : e[t]) {
			if (a[g] > a[t] + 1) {
				a[g] = a[t] + 1;
				q.push(g);
			}
		}
	}
	int mx = 1;
	for (int i = 2; i <= n; i++) {
		if (a[mx] < a[i]) mx = i;
	}
	int r = 1;
	q.push(mx);
	fill(a + 1, a + n + 1, inf);
	a[mx] = 0;
	while (!q.empty()) {
		int t = q.front(); q.pop();
		for (auto g : e[t]) {
			if (a[g] > a[t] + 1) {
				a[g] = a[t] + 1;
				q.push(g);
			}
		}
	}
	mx = 0;
	for (int i = 1; i <= n; i++) {
		mx = max(mx, a[i]);
	}
	//mx=直径
	dp[1] = 1;
	dp[2] = 0;//このタイミングで始まった人が勝つか
	for (int i = 3; i <= mx + 1; i++) {
		if (!dp[i - 2] || !dp[i - 1]) dp[i] = 1;
		else dp[i] = 0;
	}
	if (dp[mx + 1]) cout << "First\n";
	else cout << "Second\n";
}

Measured memory_bytes: 26096
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

vector<int> d[100010];

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    rep(i, 0, n){
        int a, b;
        cin >> a >> b;
        a--;
        d[a].push_back(b);
    }
    priority_queue<int> pq;
    int ans = 0;
    rep(i, 0, m){
        for(auto j : d[i]){
            pq.push(j);
        }
        if(pq.size()){
            int tmp = pq.top();
            pq.pop();
            ans += tmp;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 5760
import math

a,b,x = map(int, input().split())

def over_flag(a,b,x):
    return math.atan( 2*b/a-2*x/a**3 )*180/math.pi
 
def below_flag(a,b,x):
    return 90-math.atan(2*x/(a*b**2))/math.pi*180

def main(a,b,x):
    if x>a**2*b:
        print(0)
        return 0
    if x>a**2*b/2:
        print(over_flag(a,b,x))
    else:
        print(below_flag(a,b,x))
    return 0
main(a,b,x)

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

int main(){
    string s,b="keyence"; cin>>s;
    int n=s.size();
    for(int i=0; i<n; i++) {
        if(s[i]==b[0]){
            bool flag=1;
            int j = 1;
            while(flag && j<7){
                if(s[i+j]==b[j])j++;
                else flag=0;
            }
            if((i==0 && j==7) || (i==n-7 && j==7)){
                cout << "YES" << endl;
                return 0;
            }
            for(int k=i+j+1; k<n; k++){
                if(s.substr(k,7-j)==b.substr(j,7-j) &&(i==0&&k+7-j-1==n-1)){
                    cout << "YES" << endl;
                    return 0;
                }
            }
        i +=j-1;
        }
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
//hinagata.cpp
/*includes*/
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <stdio.h>
#include <numeric>
#include <iomanip>
#include <limits>
/*namespace*/
using namespace std;
using ll= long long;
/*define macro*/
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPi(i,a,b) for(int i=(a);i<(b);i++)
#define REPRi(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(x) (x).begin(),(x).end()

int main(){
    int N;
    cin>>N;
    vector<double> M(N);
    double ans=0;
    vector<string> MON(N);
    REP(i,N){
        cin>>M[i];
        cin>>MON[i];
        }

    REP(i,N){
        if(MON[i]=="JPY"){
            ans+=M[i];
        }else{
            ans+=380000*M[i];
        }
    }
    cout<<setprecision(12)<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod 100000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
ll lcm(ll a, ll b)
{
    return a * b / __gcd(a, b);
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout << fixed << setprecision(15);
    ll A,B,C,D;
    cin >> A >> B >> C >> D;
    while (A > 0 || C > 0)
    {
        C -= B;
        if(C < 1){
            break;
        }
        A -= D;
        if(A < 1){
            break;
        }
    }
    if(C < 1){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3656
from sys import stdin,setrecursionlimit
from itertools import groupby
setrecursionlimit(10**7)
h,w = map(int,stdin.readline().rstrip().split())
li = [["" for i in range(w)]for j in range(h)]
for i in range(h):
    s = stdin.readline().rstrip()
    for j in range(w):
        li[i][j] = s[j]
now = 0
last = 0
for i in range(h):
    flag = True
    for j in range(w):
        lin = []
        for key, value in groupby(li[i]):
            lin.append(key)
        if lin.count("#") >= 2:
            print("Impossible")
            exit()
        if li[i][j] == "#" and flag:
            flag = False
            now = j
        if i >= 1 and flag == False and now != last:
            print("Impossible")
            exit()
        if (flag == False and li[i][j] == "."):
            last = j-1
            break
        if  (not flag and j == w-1):
            last = j
            break
if last == w-1:
    print("Possible")
else:
    print("Impossible")

Measured memory_bytes: 3064
@inputs = split(/ /, <>);
$before1 = $inputs[0];
$before2 = $inputs[2];
$after1 = $inputs[1];
$after2 = $inputs[3];

if ($before1 < $before2) {
    if($after1 < $after2){
        $answer = $after1 - $before2; 
    }else {
        $answer = $after2 - $before2;
    }
}else {
    if($after1<$after2){
        $answer = $after1- $before1;
    }else {
        $answer = $after2 - $before1;
    }
}

if ($answer > 0){
    print ($answer);
}else{
    print (0);
}

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

/* macros */
#define inf 1e9
#define int long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
#define vi vector<int>
#define vc vector<char>
#define vb vector<bool>
#define vt vector
#define pb push_back
#define fi first
#define se second
#define pi pair<int,int>
#define tc int t;cin>>t;while (t--){solve();}
#define gtc int t;cin>>t;int TC=1;while (t--) {cout << "Case #" << TC << ": " << solve() << "\n";TC++;}
#define gvtc int t;cin>>t;int TC=1;while (t--) {cout << "Case #" << TC << ": "; vsolve(); TC++;}
#define notc solve();
#define newline cout << "\n";
#define mod 1000000007
#define ret return 0;
#define sz(x) (int)x.size();
#define rep(i,a,b) for(int i=a;i<b;i++)
#define srt(x) sort(x.begin(), x.end())
#define rsrt(x) sort(x.rbegin(), x.rend())

class WQPC {
    int V;
    vi sz;
    vi id;
public:
    WQPC(int V) {
        this->V = V;
        id.resize(V);
        sz.resize(V,1);
        for (int i=0;i<V;i++) {
            id[i] = i;
        }
    }
    
    int root(int i) {
        while (id[i] != i) {
            id[i] = id[id[i]];
            i = id[i];
        }
        return i;
    }
    
    bool isConnected(int u,int v) {
        return root(u) == root(v);
    }
    
    void unite(int u,int v) {
        int p = root(u);
        int q = root(v);
        if (!isConnected(p, q)) {
            if (sz[p] >= sz[q]) {
                id[q] = p;
                sz[p] += sz[q];
            }else {
                id[p] = q;
                sz[q] += sz[p];
            }
        }
    }
    
    int getSize() {
        int mx = INT_MIN;
        for (int i=0;i<V;i++) {
            mx = max(mx, sz[i]);
        }
        return mx;
    }
    
};

void solve() {
    int n,m;
    cin>>n>>m;
    WQPC w(n+1);
    for (int i=0;i<m;i++) {
        int u,v;
        cin>>u>>v;
        w.unite(u, v);
    }
    int ans = w.getSize();
    cout << ans << "\n";
}

int32_t main(){
    fastio
    notc
    ret
}


Measured memory_bytes: 6356
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	so := nextStr()
	se := nextStr()

	for i := 1; i < len(so)+len(se)+1; i++ {
		if i%2 == 1 {
			fmt.Printf("%c", so[i/2])
		} else {
			fmt.Printf("%c", se[i/2-1])
		}
	}

}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // Default=64
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1788
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {
	int n;
	cin >> n;
	while (n--) {
		set<string>st;
		string s;
		cin >> s;
		for (int i = 1; i < s.size() ; i++) {
			string s1, s2,s1r,s2r;
			s1 = s.substr(0, i);
			s2 = s.substr(i, s.size() - i);
			s1r = s1;
			s2r = s2;
			reverse(s1r.begin(), s1r.end());
			reverse(s2r.begin(), s2r.end());

			st.insert(s1 + s2);
			st.insert(s1 + s2r);
			st.insert(s1r + s2);
			st.insert(s1r + s2r);
			st.insert(s2 + s1);
			st.insert(s2 + s1r);
			st.insert(s2r + s1);
			st.insert(s2r + s1r);

			
		}
		cout << st.size() << endl;

	}
	return 0;
}

Measured memory_bytes: 3220
#include<bits/stdc++.h>
#define    ll   long long int
#define    sz   200010
#define    md   1000000007
#define    py   printf("Yes\n")
#define    pn   printf("No\n")

using namespace std;


ll ara[20][20];


ll tani(ll a,ll b, ll d)
{
    ll i,j,s,p,m,x;

    s=0;

    for(i=1;i<=d;i++)
    {
        s+=(ara[a][i]-ara[b][i])*(ara[a][i]-ara[b][i]);
    }

    m=sqrt(s);

    if(m*m==s)return 1;
    else
        return 0;
}

int main()
{


     ll n,i,j,k,d,p,m,x,y,c,s;

     cin>>n>>d;

     for(i=1;i<=n;i++)
     {
         for(j=1;j<=d;j++)
         {
             cin>>ara[i][j];
         }
     }
     c=0;


     for(i=1;i<=n;i++)
     {
         for(j=i+1;j<=n;j++)
         {
             k=tani(i,j,d);

             if(k==1)c++;
         }
     }

     cout<<c<<endl;


    return 0;
}


Measured memory_bytes: 256
def gcd(a, b):
    while b != 0:
        a, b = b, a%b
    return a
 
N = int(input())
A = [int(input()) for i in range(N)]
 
ans = A[0]
 
for i in A:
    ans = (ans*i)//gcd(ans, i)
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <bitset>
#include <cstring>
#include <map>
#include <math.h>
#include <queue>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> P;
#define rep(i,n) for (int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fir first
#define sec second
#define pb push_back
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; }
const int INF = 1<<30;
const ll LINF = 1LL<<58;
const int mod = 1000000007;

bool check(int a){
	for (int i = 1; i < 130; i++){
		int d = i*i;
		if(a==d) return true;
	}
	return false;
}

int main(){
	ll n, x = 0;
	cin >> n;
	vector<int> A(n);
	rep(i,n){
		int a;
		cin >> a;
		A[i] = a;
		x += a;
	}
	x /= 2;
	for (int i = n-2; i > 0; i-=2) x -= A[i];
	rep(i,n){
		if(i) cout << " ";
		cout << x * 2;
		x = A[i]-x;
	}
	cout << endl;
	return 0;
}


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

using namespace std;

int main(void){
    long long x, y;
    char judgeX, judgeY;
    cin >> x >> y;
    int a[7] = {1,3,5,7,8,10,12};
    int b[4] = {4, 6, 9, 11};
    int c[1] = {2};
    for(int i=0;i<7;i++){
        if(x == a[i]){
            judgeX = 'a';
        }
    }
    for(int i=0;i<4;i++){
        if(x == b[i]){
            judgeX = 'b';
        }
    }
    for(int i=0;i<1;i++){
        if(x == c[i]){
            judgeX = 'c';
        }
    }

    for(int i=0;i<7;i++){
        if(y == a[i]){
            judgeY = 'a';
        }
    }
    for(int i=0;i<4;i++){
        if(y == b[i]){
            judgeY = 'b';
        }
    }
    for(int i=0;i<1;i++){
        if(y == c[i]){
            judgeY = 'c';
        }
    }

    if(judgeX == judgeY){
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }
    return 0;

}

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i=0;i<N;i++){
    int a;
    cin >> a;
    vec.at(i) = a;
  }
  
  int ans = N;
  sort(vec.begin(),vec.end());
  
  for (int i=0;i<N-1;i++){
    if (vec.at(i) == vec.at(i+1)){
      ans--;
    }
  }

  cout << ans << endl;
}



Measured memory_bytes: 3636
using System;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using static System.Math;
using Debug = System.Diagnostics.Debug;

class P
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());

        long res = 0;
        int last = 0;
        for (int i = 0; i < n; i++)
        {
            int now = int.Parse(Console.ReadLine());
            int use = Min(last, now);
            res += use;
            now -= use;
            res += now / 2;
            now %= 2;
            last = now;
        }
        res += last / 2;
        Console.WriteLine(res);
    }
}


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

struct UnionFind{
    vector<int> par;
    UnionFind(int n): par(n){
        rep(i,n) par[i]=i;
    }
    //親さがし
    int root(int x){
        if(par[x]==x) return x;
        return par[x]= root(par[x]);//経路短くしとく
    }
    //くっつける
    void unite(int x, int y){
        int rx = root(x); 
        int ry = root(y);
        if(ry==rx) return;
        par[rx]=ry;
    }
    //同じグループかどうか
    bool same(int x, int y){
        if(root(x)==root(y)) return true;
        else return false;
    }


};

int main() {
    int n, m;
    cin >> n >> m;
    UnionFind tree(n);
    rep(i,m) {
        int a, b, z;
        cin >> a >> b >> z;
        --a, --b;
        tree.unite(a, b);
    }
    set<int> s;
    rep(i,n) {
        s.insert(tree.root(i));
    }
    cout << s.size() << endl;
    return 0;
}

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

int main()
{
  int N, ans=INT_MAX;
  cin >> N;
  vector<ll> A(N);
  rep(i, N) cin >> A[i];
  for(int i:A)
  {
    int cnt=0;
    while(i%2==0)
    {
      i /= 2;
      ++cnt;
      if(cnt > ans) break;
    }
    ans = min(ans, cnt);
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    sort(A.begin(), A.end());

    ll plus = 0;
    ll zero = 0;
    ll minus = 0;
    rep(i, N) {
        if (A[i] > 0) plus++;
        if (A[i] == 0) zero++;
        if (A[i] < 0) minus++;
    }
    ll m = plus * minus;
    ll z = zero * (plus + minus) + (zero * (zero - 1)) / 2;
    if (K <= m) {
        ll ok = 0;
        ll ng = -INF;
        auto f = [&](ll x) {
            ll now = 0;
            rep(i, N) {
                if (A[i] < 0) {
                    ll a = A[i];
                    ll target = (-x - a - 1) / -a;
                    ll cnt = A.end() - lower_bound(A.begin(), A.end(), target);
                    now += cnt;
                }
            }
            return now >= K;
        };
        while (abs(ok - ng) > 1) {
            ll mid = (ok + ng) / 2;
            if (f(mid)) {
                ok = mid;
            } else {
                ng = mid;
            }
        }
        cout << ok << '\n';
    } else if (K <= m + z) {
        cout << 0 << '\n';
    } else {
        ll ok = INF;
        ll ng = 0;
        auto f = [&](ll x) {
            ll now = 0;
            rep(i, N) {
                ll a = A[i];
                if (a < 0) {
                    ll target = x / -a;
                    ll cnt = lower_bound(A.begin(), A.end(), 0) - lower_bound(A.begin(), A.end(), -target);
                    if (a >= -target) cnt--;
                    now += cnt;
                } else if (a > 0) {
                    ll target = x / a;
                    ll cnt = upper_bound(A.begin(), A.end(), target) - upper_bound(A.begin(), A.end(), 0);
                    if (a <= target) {
                        cnt--;
                    }
                    now += cnt;
                }
            }
            return (now / 2 + z + m) >= K;
        };
        while (abs(ok - ng) > 1) {
            ll mid = (ok + ng) / 2;
            if (f(mid)) {
                ok = mid;
            } else {
                ng = mid;
            }
        }
        cout << ok << '\n';
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
typedef long long int ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n, d, cnt(0);
    cin >> n >> d;
    double dc = d * 1.0;
    rep(i, 0, n)
    {
        double x, y, dist;
        cin >> x >> y;
        dist = sqrt(x * x + y * y);
        if (dist <= dc)
            cnt++;
    }
    cout << cnt;
    return 0;
}

Measured memory_bytes: 3824
package main

import (
	"fmt"
)

func main() {
	var n,k int
	fmt.Scan(&n, &k)
	var kosu int
	var kotae int
	if k % 2 == 0 {
		d := k / 2
		kosu = n / d
		kosut := n /k
		kosuw := kosu - kosut
		kotae = kosut * kosut * kosut + kosuw * kosuw * kosuw 
	}else{
		kosu = n / k
		kotae = kosu * kosu * kosu
	}

	fmt.Println(kotae)
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
//int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
//int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
//const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'

signed main() {
    fio();
    string s, t;
    cin >> s >> t;
    bool flag = true;
    if (t.size() != s.size() + 1) {
        flag = false;
    }
    else {
        if (t.substr(0, s.size()) != s) {
            flag = false;
        }
    }

    if (flag) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}
    

Measured memory_bytes: 3644
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<int> cnt(N, 0);
    for (int i = 1; i < N; ++i) {
        int a = 0;
        cin >> a;
        cnt[a - 1]++;
    }
    for (int i = 0; i < N; ++i) {
        cout << cnt[i] << endl;
    }
}


Measured memory_bytes: 4060
#include <stdio.h>
#include <math.h>

int main(void){
    setvbuf(stdout,NULL,_IONBF,0);
    int n;
    long long ans=0;
    scanf("%lli",&n);

    for(int i=1;i<n+1;i++){
    	if(!(i%3==0 || i%5==0)){
    		ans+=i;
    	}
    }

    printf("%lli",ans);

	return 0;
}


Measured memory_bytes: 2116
import java.util.*;
import java.math.RoundingMode;
import java.math.BigDecimal;
 
 
 
public class Main{
	public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] t = new int[n];
		int[] x = new int[n];
		int[] y = new int[n];
		for(int i = 0; i < n; i++) {
			t[i] = sc.nextInt();
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
		}
		boolean able = true;
		if((x[0]+y[0])<=t[0]&&(x[0]+y[0])%2==t[0]%2) {
			for(int i = 1; i < n; i++) {
				long d = Math.abs(x[i]-x[i-1])+Math.abs(y[i]-y[i-1]);
				long time = t[i]-t[i-1];
				if(d<=time&&d%2==time%2) {
					continue;
				}
				else {
					able = false;
					break;
				}
			}
			System.out.println(able ?  "Yes":"No");
		}
		else System.out.println("No");
	}
}

Measured memory_bytes: 60864
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
using namespace std;

typedef int64_t ll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define vll vector<ll>
#define all(v) v.begin(), v.end()



int main() {
	string a, b, c;
	cin >> a >> b >> c;
	if (a.back() == b[0] && b.back() == c[0]) cout << "YES" << endl;
	else cout << "NO" << endl;
}


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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
  string S; cin >> S;
  int p = 0, g = 0, ans = 0;

  for (int i = 0; i < S.length(); i++){
    if (S[i] == 'g'){
      if (p < g) p++, ans++;
      else g++;
    }else{
      if (p < g) p++;
      else g++, ans--;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3764
# ABC113C - ID
import sys
input = sys.stdin.readline

def main():
    N, M = tuple(map(int, input().split()))
    P = [[] for _ in range(N + 1)]  # prefectures
    for num in range(M):  # classify cities by prefectures
        pref, year = tuple(map(int, input().split()))
        P[pref] += [(year, num)]
    ans = [""] * M
    P = [sorted(p) for p in P]  # sort by year
    for pref_idx, pref in enumerate(P):
        for city_idx, (_, num) in enumerate(pref, 1):
            x = "{:06}{:06}".format(pref_idx, city_idx)
            ans[num] = x
    print(*ans, sep="\n")

if __name__ == "__main__":
    main()

Measured memory_bytes: 40524
while True:
    try:
        nums = list(map(int, list(input())))
    except:
        break
    while len(nums) > 1:
        tmp = []
        for i in range(len(nums)-1):
            tmp.append(int(str(nums[i] + nums[i+1])[-1]))
        nums = [] + tmp
    print(nums[0])

Measured memory_bytes: 6724
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=2e5+5;
int n;
ll k;
vector<ll>v1,v2;
bool judge(ll m){
    m++;
    ll ans=0;
    ll s1=v1.size(),s2=v2.size();
    if(m==0){
        for(int i=0;i<s2;i++)
            if(v2[i]==0) ans+=s1;
        ans+=(ll)s1*(s1-1)/2;
        ans+=(ll)s2*(s2-1)/2;
        ans=(ll)n*(n-1)/2-ans;
        return ans>=k;
    }
    if(m>0){
        for(int i=0;i<s1-1;i++)
        {
            ll x=m/v1[i];
            if(m%v1[i]) x++;
            int k=lower_bound(v1.begin()+i+1,v1.end(),x)-v1.begin();
            ans+=s1-k;
        }
        for(int i=0;i<s2-1;i++)
        {
            if(v2[i]==0) continue;
            ll x=m/v2[i];
            if(m%v2[i]) x++;
            int k=lower_bound(v2.begin()+i+1,v2.end(),x)-v2.begin();
            ans+=s2-k;
        }
        ans=(ll)n*(n-1)/2-ans;
        return ans>=k;
    }
    if(m<0){
        m*=-1;
        ans+=(ll)s1*(s1-1)/2;
        ans+=(ll)s2*(s2-1)/2;
        for(int i=0;i<s1;i++)
        {
            ll x=m/v1[i];
            int k=upper_bound(v2.begin(),v2.end(),x)-v2.begin()-1;
            ans+=k+1;
        }
        ans=(ll)n*(n-1)/2-ans;
        return ans>=k;
    }
}
int main(){
    cin>>n>>k;
    for(int i=1;i<=n;i++){
        int x;
        cin>>x;
        if(x<0) v1.push_back(-x);
        else v2.push_back(x);
    }
    sort(v1.begin(),v1.end());
    sort(v2.begin(),v2.end());
    ll l=-1e18,r=1e18,ans;
    while(l<=r){
        ll m=l+r>>1;
        if(judge(m)) ans=m,r=m-1;
        else l=m+1;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 2548
use std::io::prelude::*;
use std::io;
use std::str::FromStr;
#[cfg(local)]
use std::fs::File;
#[cfg(local)]
use std::io::BufReader;

#[cfg(local)]
fn buf_read() -> io::Result<(Vec<String>)> {
    let f = try!(File::open("input.txt"));
    let input_lines: Vec<_> = BufReader::new(f).lines().collect();
    let lines: Vec<String> = input_lines.into_iter().map(|e| e.unwrap()).collect();
    Ok((lines))
}

#[cfg(not(local))]
fn buf_read() -> io::Result<(Vec<String>)> {
    let stdin = io::stdin();
    let input_lines: Vec<_> = stdin.lock().lines().collect();
    let lines: Vec<String> = input_lines.into_iter().map(|e| e.unwrap()).collect();
    Ok((lines))
}

fn main() {
    type Element = i64;
    let input = buf_read().unwrap();
    let mut input_vectors: Vec<Vec<Element>> = vec![];
    for input_line in input {
        let input_str: Vec<String> = input_line.split(' ').map(String::from).collect();
        let mut input_vector: Vec<Element> = vec![];
        for input_elem_str in input_str {
            let elem: Element = Element::from_str(input_elem_str.as_str()).unwrap();
            input_vector.push(elem);
        }
        input_vectors.push(input_vector);
    }
    let max = input_vectors[0][1];
    let a_array = input_vectors[1].clone();
    let mut pre = 0;
    let mut sum = 0;
    for cur in a_array {
        if pre + cur > max {
            sum += (pre + cur - max);
            pre = cur - (pre + cur - max);
            // println!("{:?}", sum);
        } else {
            pre = cur;
            // println!("safe");
        }
    }
    println!("{}", sum);
}


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

class UnionFind:
    def __init__(self, N):
        self.parent = list(range(N))
        self.rank = [0] * N
        self.size = [1] * N

    def find(self, x):
        r = x
        while self.parent[r] != r:
            r = self.parent[r]
        while self.parent[x] != r:
            x, self.parent[x] = self.parent[x], r
        return r

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.rank[x] < self.rank[y]:
            self.parent[x] = y
            self.size[y] += self.size[x]
        else:
            self.parent[y] = x
            self.size[x] += self.size[y]
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def get_size(self, x):
        return self.size[self.find(x)]

N, M = map(int, input().split())
uf = UnionFind(N+1)
for _ in range(M):
    A, B = map(int, input().split())
    uf.unite(A, B)
ans = max(uf.get_size(i) for i in range(N+1))
print(ans)

Measured memory_bytes: 73764
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    int n, m; cin >> n >> m;
    vector<vector<vll>> dp(m + 1, vector<vll>(n + 1, vll(n + 1, 0LL)));
    dp[0][1][1] = 1;

    rep(i, m){
        rep(j, n + 1){
            rep(k, n + 1){
                ll& cur = dp[i][j][k];
                if(cur == 0LL) continue;
                assert(j >= k);

                // nop
                {
                    ll& next = dp[i + 1][j][k];

                    ll cand = j - k;
                    if(j == k) cand = k;
                    next = ADD(next, MUL(cur, cand, mod), mod);
                }

                // fwd
                if(j < n){
                    ll& next = dp[i + 1][j + 1][k];
                    next = ADD(next, cur, mod);
                }
                
                // bwd
                if(j != k){
                    ll& next = dp[i + 1][j][j];
                    next = ADD(next, MUL(cur, k, mod), mod);
                }
            }
        }
    }

    ll res = dp[m][n][n];
    rep(i, 1, n){
        res = MUL(res, i, mod);
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 216832
#include<iostream>
using namespace std;
int main()
{
    int k,s,l,ans=0;
    cin>>k>>s;
    for(int i=0;i<=k;i++)
        for(int j=0;j<=k;j++)
        {
            l=s-i-j;
            if(l<=k&&l>=0)
                ans++;
        }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

ans = 0
for d in make_divisors(M):
    if N*d <= M and d > ans:
        ans = d
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll          long long
#define mp	    make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define MOD        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define rep(i,a,b)  for(int i=a;i<b;i++)
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll multbig(ll a,ll b,ll mod){
    if(a==0 or b==0) return 0;
    if(a==1 or b==1) return (a*b)%mod;
    ll cur=multbig(a,b/2,mod);
    cur=(2*cur)%mod;
    if(b%2) cur=(cur+a)%mod;
    return cur;
}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1LL) {if (k & 1LL) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
ll inv_euclid(ll a, ll m = MOD){ll m0 = m;ll y = 0, x = 1;if (m == 1)return 0;while (a > 1){ll q = a / m;ll t = m;m = a % m, a = t;t = y;y = x - q * y;x = t;}if (x < 0)x += m0;return x;}




int ans , n;
void dfs(ll a, int cnt3, int cnt5 , int cnt7){
	if(a>n) return;
	if(cnt3 && cnt5 && cnt7) ans++;
	dfs(10 * a + 3, cnt3+ 1, cnt5, cnt7);
	dfs(10 * a + 5, cnt3, cnt5 +1, cnt7);
	dfs(10 * a + 7, cnt3, cnt5, cnt7 +1);
}
void solve(){
	cin>>n;
	dfs(0,0,0,0);
	cout<<ans<<endl;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
     t =1;
//     cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int x1 = in.nextInt();
            int y1 = in.nextInt();
            int x2 = in.nextInt();
            int y2 = in.nextInt();
            int x3 = x2 - (y2 - y1);
            int y3 = y2 + (x2 - x1);
            int x4 = x3 - (y3 - y2);
            int y4 = y3 + (x3 - x2);
            out.printf("%d %d %d %d\n", x3, y3, x4, y4);
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public long nextLong() {
            long n = 0;

            int b = readByte();
            while (isSpaceChar(b))
                b = readByte();

            boolean minus = (b == '-');
            if (minus)
                b = readByte();

            while (b >= '0' && b <= '9') {
                n *= 10;
                n += b - '0';
                b = readByte();
            }

            if (!isSpaceChar(b))
                throw new NumberFormatException();

            return minus ? -n : n;
        }

        public int nextInt() {
            long n = nextLong();

            if (n < Integer.MIN_VALUE || n > Integer.MAX_VALUE)
                throw new NumberFormatException();

            return (int) n;
        }

    }
}



Measured memory_bytes: 21076
// https://atcoder.jp/contests/abc132/tasks/abc132_e
//
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! dvec {
    ($t:expr ; $len:expr) => {
        vec![$t; $len]
    };

    ($t:expr ; $len:expr, $($rest:expr),*) => {
        vec![dvec!($t; $($rest),*); $len]
    };
}

#[allow(unused_macros)]
macro_rules! ifv {
    ($t:expr, $a:expr, $b: expr) => {
        if $t { $a } else { $b }
    }
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}


const INF: i64 = 1e18 as i64;

fn main() {
    input! {
        n: usize, m: usize,
        edges: [(usize1, usize1); m],
        s: usize1, t: usize1
    };

    let mut graph = vec![vec![]; 3*n];
    for e in edges {
        for w in 0..3 {
            let from = e.0 * 3 + w;
            let to = e.1 * 3 + (w + 1) % 3;
            graph[from].push(to);
        }
    }

    let mut dp = vec![INF; 3*n];
    dp[s*3] = 0;
    let mut deq = VecDeque::new();
    deq.push_back(s*3);
    while deq.len() >= 1 {
        let v = deq.pop_front().unwrap();
        let time = dp[v];
        for &to in &graph[v] {
            if dp[to] > time+1 {
                dp[to] = time+1;
                deq.push_back(to);
            }
        }
    }
    println!("{}", ifv!(dp[t*3] == INF, -1, dp[t*3]/3));
}


Measured memory_bytes: 28924
using System;
using System.Collections.Generic;
using System.Linq;
public class Pg
{
    public static void Main()
    {
        string line;
        while ((line = Console.ReadLine()) != null)
        {
            var lst = line.Trim().ToCharArray().Select(x => int.Parse(x.ToString())).ToList();
            Console.WriteLine(GetBottom(lst));
        }
    }
    internal static int GetBottom(List<int> a)
    {
        if (a.Count() == 2)
            return a.Sum() % 10;
        else
        {
            var tmp = new List<int>();
            for (int i=1; i < a.Count(); ++i)
                tmp.Add((a[i] + a[i - 1]) % 10);
            return GetBottom(tmp);
        }
    }
}


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

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

#define fr first
#define sc second

int main(){
	int n;
	int a[52];
	scanf("%d",&n);
	for(int i = 1 ; i <= n ; i ++){
		scanf("%d",&a[i]);
	}
	
	int M = 0;
	int id = -1;
	for(int i = 1 ; i <= n ; i ++){
		if(abs(a[i]) > M){
			M = abs(a[i]);
			id = i;
		}
	}
	if(id == -1){
		cout << 0 << endl;
		return 0;
	}
	
	vector<P> ans;
	if(a[id] < 0){
		for(int i = 1 ; i <= n ; i ++){
			if(i == id)continue;
			ans.push_back(P(id,i));
		}
		for(int i = n-1 ; i >= 1 ; i --){
			ans.push_back(P(i+1,i));
		}
	}
	else {
		for(int i = 1 ; i <= n ; i ++){
			if(i == id)continue;
			ans.push_back(P(id,i));
		}
		for(int i = 1 ; i <= n-1 ; i ++){
			ans.push_back(P(i,i+1));
		}
	}
	cout << ans.size() << endl;
	for(int i = 0 ; i < ans.size() ; i ++){
		cout << ans[i].fr << " " << ans[i].sc << endl;
	}
}

Measured memory_bytes: 256