akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))
#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}



signed main(){
    int n;
    cin >> n;
    cout << lcm(2,n) fin;
  
  return 0;
}



struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;



Measured memory_bytes: 256
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>

int main() {
	double r;
	const double pi = M_PI;
	scanf("%lf", &r);
	printf("%lf %lf\n", pi * r * r, 2.0 * pi * r);

	return 0;
}


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

using namespace std;

#define MOD 1000000007
#define N 302
#define M 30
#define ll long long 
#define ld long double
#define pb push_back
#define ff first
#define ss second

ld dp[N][N][N];
int f[3] = {0};
int n, x;

ld get(int one, int two, int thr){
    ld &ans = dp[one][two][thr]; 
    if(ans != -1) return ans;
    int tot = one + two + thr;
    if(tot == 0) return 0;
    ans = n;
    if(one != 0) ans = ans + get(one-1, two, thr)*one;
    if(two != 0) ans = ans + get(one+1, two-1, thr)*two;
    if(thr != 0) ans = ans + get(one, two+1, thr-1)*thr;
    ans = ans / tot;
    return ans;
} 

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin>>n;
    for(int i=0; i<n; i++){
        cin>>x;
        f[x-1]++;
    }
    for(int i = 0; i < N; i++)
        for(int j = 0; j < N; j++)
            for(int k = 0; k < N; k++)
                dp[i][j][k] = -1;
    cout<<setprecision(20)<<fixed<<get(f[0], f[1], f[2]);
    return 0;
}

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

using ll = long long;
using namespace std;
const int INFint = 2e9+1;
const ll INFll = 2e18+1;
ll MOD=1e9+7;

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> x(M),y(M);
  for(int i(0);i<M;i++){
    cin>>x[i]>>y[i];
  }
  vector<int> ans(N+1,0);
  ans[1] = 1;
  vector<int> cnt(N+1,1);
  for(int i(0);i<M;i++){
    if(ans[x[i]] == 1){
      if(cnt[x[i]] > 1){
        ans[y[i]] = 1;
      }else{
        ans[y[i]] = 1;
        ans[x[i]] = 0;
      }
    }
    cnt[x[i]]--;
    cnt[y[i]]++;
  }
  int cnti(0);
  for(int i(1);i<=N;i++){
    //cout << i << " " << ans[i] << endl;
    if(ans[i]) cnti++;
  }
  cout << cnti << endl;
  return 0;
}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

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

long long totient(long long a) {
	ll ret = a;
	for(int i = 2;i * i <= a;i++){
		if(a % i == 0){
			ret = ret * (i - 1) / i;
			while(a % i == 0)a /= i;
		}
	}
	if(a > 1)ret = ret * (a - 1) / a;
	return ret;
}

// a / b (mod p) b と p は互いに素
// O(sqrt(p))かかるので注意
long long totient_div(long long a, long long b, long long p) {
	long long ret = a;
	long long tp = totient(p) - 1;
	long long c = b;
	for(int i = 0;i <= 60;i++){
		if(tp & (1LL << i))ret = (ret * c) % p;
		c = (c * c) % p;
	}
	return ret;
}

//a^b % MOD
long long mod_pow(ll a,ll b){
	long long ret = 1;
	long long c = a;
	for(int i = 0;i <= 60;i++){
		if(b & (1LL << i))ret = (ret * c) % MOD;
		c = (c * c) % MOD;
	}
	return ret;
}

//ａをbで割る
long long mod_div(long long a,long long b){
	long long tmp = MOD - 2,c = b,ret = 1;
	while(tmp > 0){
		if(tmp & 1){
			ret *= c;ret %= MOD;
		}
		c *= c;c %= MOD;tmp >>= 1;
	}
	return a*ret%MOD;
}

#define MAX_K 333333
vector<long long> fact(MAX_K);
long long combination(long long n, long long r){
    if(n < r || n < 0 || r < 0)
        return 0;
	if(fact[0] != 1){
		fact[0] = 1;
		for(long long i = 1;i < MAX_K;i++)fact[i] = (fact[i-1] * i) % MOD;
	}
    long long ret = fact[n];
	long long tmp = (fact[r] * fact[n-r]) % MOD;
    return mod_div(ret,tmp);
}

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

    ll n, k;
    cin >> n >> k;
    ll ans = (k > 1);
    for(int i = 1;i < min(n, k + 1);i++){
        ll nokori = n - i;
        ll now = combination(n, i) * combination(nokori + i - 1, i) % MOD;
        ans = (ans + now) % MOD;
    }

    cout << ans << endl;

	return 0;
}


Measured memory_bytes: 2944
n, m = [int(s) for s in input().split()]

a_list = [int(s) for s in input().split()]
a_list = list(reversed(sorted(a_list)))

a_all = sum(a_list)

ans = "Yes" if a_list[m - 1] >= a_all / (4 * m) else"No"
print(ans)


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

using namespace std;

int main(){
  
  int N;
  cin >> N;
  
  vector<int> A(N), B(N), C(N);
  int sum = 0;
  
  for(int i = 0; i < N; i++) cin >> A.at(i);
  for(int i = 0; i < N; i++) {
    cin >> B.at(i);
    sum += B.at(i);
  }
  for(int i = 0; i < N - 1; i++) cin >> C.at(i);
  
  for(int i = 0; i < N; i++){
   if(i > 0){
     if(A.at(i-1)+1 == A.at(i)){
       sum += C.at(A.at(i-1)-1) ;
     }
   }
  }
  
  cout << sum;
  
  return 0;
}

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

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    vector<int> M(N, 0);
    for (int i = 0; i < N; ++i) {
        if (i % 2 == 0) M[0] += A[i];
        else M[0] -= A[i];
    }
    for (int i = 0; i < N - 1; ++i) M[i + 1] = 2 * A[i] - M[i];
    for (int i = 0; i < N - 1; ++i) cout << M[i] << " ";
    cout << M[N - 1] << endl;
}

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

int main() {
    int n; cin >> n;
    if (n&1) {
        cout << "No";
        return 0;
    } else {
        string s;
        cin >> s;
        int i = 0, j = n >> 1;
        for (; j < n; ++j, ++i) {
            if (s[i] != s[j]) {
                cout << "No";
                return 0;
            }
        }
    }
    cout << "Yes";

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if ((b % a) == 0)
            System.out.println(a + b);
        else
            System.out.println(b - a);
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <cmath>
#include <climits>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string.h>
#include <iomanip>
#include <ctype.h>

#define ll          long long int
#define ull         unsigned long long int
#define pb          push_back
#define pii         pair<int,int>
#define F           first
#define S           second
#define vi          vector<int>
#define vli          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define M_PI        3.14159265358979323846
#define mp          make_pair
#define sz(x)       (int)x.size()
//#define hell        1000000007
#define matrix      vector<vector<ll>>
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define eps 0.0000000001
#define all(a)      (a).begin(),(a).end()
const long long INF = (long long) 1e7+1;
const long long mod = (long long) 998244353 ;
const long long hell = (long long) 1000000007;

using namespace std;
#include <stdio.h>

ll power(ll x,ll y)
{
  ll res=1;
  while(y>0){
    if(y%2) res=(x%hell*res%hell)%hell;
    x=(x%hell*x%hell)%hell;
    y=y/2;
  }
  return res;
}

ll modinv(ll x){
  return power(x,hell-2);
}

void solve();


void fastIO() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

int main(){
   fastIO();
    solve();
}
//void sieve();
ll pw(ll k,ll x);
ll gcd(ll x,ll y);

/*
  For freq or prime factors

for(auto pri:prime){
  while(k%pri==0){
    pcnt[pri]++;
    k/=pri;
  }
}*/


void solve(){
  int test;
  //cin>>test;
  test=1;
     
  while(test--){
        ll n,k;
        cin>>n>>k;
        int cnt=0;
        
        while(n>0){
            n/=k;
            cnt++;
        }
        cout<<cnt;
    }         
}    

    




///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1

ll gcd(ll a,ll b)
{
    while( b != 0)
	{
		ll  t = b;
		b= a %t;
		a = t;
	}
	return a;
}


ll pw(ll k,ll x){
  if(x==0)
  return 1;
  if(x&1)
  return ((pw(k,x-1))*k);
  else
  return ((pw(k,x/2))*(pw(k,x/2)));
}





Measured memory_bytes: 256
# -*- coding: utf-8 -*-

n,m = map(int, raw_input().split())
cnt = [0]*n
    
for i in range(m):
    a,b = map(int, raw_input().split())
    cnt[a-1] += 1
    cnt[b-1] += 1
for i in range(n):
    print(cnt[i])
    

Measured memory_bytes: 2568
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
using namespace std;

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

int main() {
	int a,b,c;
	cin >> a >> b >> c;
	

	cout << (b-a==c-b?"YES":"NO") << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string s;
string substring(int i, int j){
    if(i > j)return "";
    return s.substr(i, j - i + 1);
}
int main(){
    cin>>s;
    int n = s.length();
    for(int len = 0; len <= n; len ++)
        for(int st = 0; st + len - 1 < n; st++)
            if((substring(0, st - 1) + substring(st + len, n - 1)) == "keyence")
                return cout<<"YES"<<endl, 0;
    cout<<"NO"<<endl;
}


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

int main()
{
	int n;
	cin>>n;
	n=n*2;
	int a[n],temp;
	for(temp=0;temp<n;temp++)
	{
		cin>>a[temp];
	}
	sort(a,a+n);
	int sum=0;
	for(temp=0;temp<n;temp+=2)
	{
		sum+=a[temp];
	}
	cout<<sum<<"\n";
}


Measured memory_bytes: 256
from itertools import combinations
N = int(input())
dic = {}
for _ in range(N):
    x = list(input())[0]
    if x in ("M", "A", "R", "C", "H"):
        if x not in dic:
            dic[x] = 1
        else:
            dic[x] += 1
ans = 0
comb = list(combinations(dic.keys(), 3))
for x, y, z in comb:
    ans += dic[x] * dic[y] * dic[z]
print(ans)

Measured memory_bytes: 9208
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;
inline int toInt(string s){int v;istringstream i(s);i>>v;return v;}
template<class T> inline string toString(T x){ostringstream o;o<<x;return o.str();}
template<class T> void pv(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}
const int INF = 1000000000;
const double PI = acos(-1.0), EPS = 1e-10;

int years[] = {9, 19, 29, 39, 49, 59, INF};
const int CNT = 7;

inline int stamp(int h, int m) {
	return 60 * h + m;
}

inline int wari(int p) {
	int np = p;
	np /= 2;
	if(np % 50 != 0) np = (np - (np % 50)) + 50;
	return np;
}

// cost[a][b] (b > a)
int cost[7][7] = {
	{0, 300, 500, 600, 700, 1350, 1650},
	{0, 0, 350, 450, 600, 1150, 1500},
	{0, 0, 0, 250, 400, 1000, 1350},
	{0, 0, 0, 0, 250, 850, 1300},
	{0, 0, 0, 0, 0, 600, 1150},
	{0, 0, 0, 0, 0, 0, 500},
	{0, 0, 0, 0, 0, 0, 0}
};

// dist[a][b] (a > b)
int dist[7][7] = {
	{0, 0, 0, 0, 0, 0, 0},
	{6, 0, 0, 0, 0, 0, 0},
	{13, 7, 0, 0, 0, 0},
	{18, 12, 5, 0, 0, 0, 0},
	{23, 17, 10, 5, 0, 0, 0},
	{43, 37, 30, 25, 20, 0, 0},
	{58, 52, 45, 40, 35, 15, 0}
};

int main() {
#if 0
	for(int p; cin >> p;)
		cout << wari(p) << endl;
#endif

#if 1
	for(;;) {

		int from, to, from_t, to_t;
		int h, m;

		cin >> from;

		if(from == 0) break;

		cin >> h >> m;
		from_t = stamp(h, m);

		cin >> to;

		cin >> h >> m;
		to_t = stamp(h, m);

		from--, to--;

		int C = cost[min(from, to)][max(from, to)];
		int D = dist[max(from, to)][min(from, to)];

		if(D <= 40 && (stamp(17, 30) <= from_t && from_t <= stamp(19, 30)) ||
				(stamp(17, 30) <= to_t && to_t <= stamp(19, 30))) {
			C = wari(C);
		}
		cout << C << endl;
	}
#endif

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <stack>
using namespace std;

int main()
{
	stack<int> CarEntrance;
	while(true){
		int CarNumber;
		cin >> CarNumber;
		if(cin.eof() == true) break;
		if(CarNumber == 0){
			cout << CarEntrance.top() << endl;
			CarEntrance.pop();
		}else{
			CarEntrance.push(CarNumber);
		}
	}
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  int d = 0;
  for (int i = 0; i < n; i++) {
    if (s.substr(i) == t.substr(0, n - i)) {
      break;
    }
    d++;
   }
  cout << n + d << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,cum=0;
    cin >> n;
    int a_ans=0,b_ans=0;
    vector<int>a(n);
    vector<int>b(n);
    for(int i=0;i<n;i++)cin >> a[i];
    for(int i=0;i<n;i++)cin >> b[i];
    vector<int>c(n);
    for(int i=0;i<n;i++)c[i]=i+1;
    do{
        if(a==c)a_ans=cum;
        if(b==c)b_ans=cum;
        cum++;
    }while(next_permutation(c.begin(),c.end()));
    cout << abs(a_ans-b_ans);
}

Measured memory_bytes: 256
import sys
for x in sys.stdin:
    a, op, b = x.split()
    a = int(a)
    b = int(b)
    if op == '?':
        break
    elif op == '+':
        print(a + b)
    elif op == '-':
        print(a - b)
    elif op == '*':
        print(a * b)
    elif op == '/':
        print(a // b)

Measured memory_bytes: 7604
#/usr/bin/env python3

s = list(input())
Q = int(input())

reverse = False
leading = []
trailing = []

for q in range(Q):
    query = input().split()

    if len(query) == 1:
        reverse = not reverse
    else:
        direction = int(query[1])
        if (direction == 1 and not reverse) or (direction == 2 and reverse):
            leading.append(query[2])
        else:
            trailing.append(query[2])

if reverse:
	print(''.join((leading[::-1] + s + trailing)[::-1]))
else:
	print(''.join(leading[::-1] + s + trailing))

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

using namespace std;
using ll =long long;
using db = double;

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

#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define leftunique(v) SORT(v);(v).erase(unique((v).begin(),(v).end()),(v).end())
//leftuniqueは配列から同じ要素のものを取り除く 例 4 6 2 1 3 4 1 2 なら 1 2 3 4 6 になる
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}
const int mod = 1e9 + 7;
const ll INF = 1LL << 60;

//ここから書き始める
int main()
{
	cout << setprecision(10);
	string s;
	cin >> s;
	rep(i,s.size()){
		if(s[i] == ','){
			cout <<" ";
		}else cout <<s[i];
	}
	cout << endl;
		


}


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

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pii;
typedef priority_queue< int, vector< int >, greater< int > >  minHeap;

#define ones(x) __builtin_popcount(x)
#define onesl(x) __builtin_popcountl(x)
#define onesll(x) __builtin_popcountll(x)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define scn(n) scanf("%d",&n)
#define scnll(n) scanf("%lld",&n)
#define scn2(n,m) scanf("%d%d",&n,&m)
#define scn3(n,m,w) scanf("%d%d%d",&n,&m,&w)
#define scn2ll(n,m) scanf("%lld%lld",&n,&m)
#define atoz(v) v.begin(),v.end()
#define ratoz(v) v.rbegin(),v.rend()
#define Fill(a,v) memset(a,v,sizeof(a))
#define fi first
#define se second
#define inf 1e9
#define pi acos(-1.0)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define mod 1000000007
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define bug(x) cerr << __LINE__ << " says: " << #x << " = " << (x) << "\n"

int Set(int N,int pos)
{
    return N=N | (1<<pos);
}
int reset(int N,int pos)
{
    return N = N & ~(1<<pos);
}
bool check(int N,int pos)
{
    return (bool)(N & (1<<pos));
}

inline int addmod(lli x,lli y)
{
    return (x%mod + y%mod)%mod;
}
inline int submod(lli x,lli y)
{
    return (x%mod - y%mod + mod)%mod;
}
inline int mulmod(lli x,lli y)
{
    return (x%mod * y%mod)%mod;
}


inline int nextSubMask(int i, int mask)
{
    return (i-1)&mask;   /// returns next  submask
}

template<typename T>
void we_r_done(T mssg)
{
    cout<<mssg;
    exit(0);
}

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

    int n;
    while(cin>>n){


        int a[n+1];

        map<int,int>pos;

        for(int i=1; i<=n; i++){
            cin>>a[i];
            pos[a[i]] = i%2;
        }
        int ans = 0;

        sort(a+1,a+n+1);

        for(int i=1; i<=n; i++){
            ans += (pos[a[i]] != i%2);
        }


        cout<<ans/2<<endl;
    }

    return 0;
}

///sin and cos expect input in radians not degrees. so use , sin(degrees * pi / 180)
///using bs = bitset<MX>; // how many distinct number can be form?
///sort(atoz(v), [](const data x, const data y){return (x.a==y.a?x.b>y.b : x.a<y.a);});

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x) cout<<#x<<" = "<<(x)<<endl;
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  int n,m; cin >> n >> m;
  int x[m]; REP(i,m) cin >> x[i];
  sort(x,x+m);

  int ans = 0;
  vector<int> d(m+1,0);

  for(int i=1; i < m; i++) {
    d[i] = abs(x[i] - x[i-1]);
    ans += d[i];
  }

  sort(d.begin(),d.end(),greater<int>());
  REP(i,min(n-1,m)) ans -= d[i];

  COUT(ans);
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
// types
typedef long long ll; 
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
// IO
#define fo(i, n) for (int i = 0; i < n; i++)
#define fo1(i, n) for (int i = 1; i <= n; i++)
#define sc(n) scanf("%d", &n) 
#define sca(a, n) fo(i, n) sc(a[i])
#define pd(a) printf("%d ", a)
#define pld(a) printf("%d\n", a)
#define pda(a, n) fo(i, n) pd(a[i])
#define pl printf("\n")
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b) 
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
// math
const ll mod = 1e9+7;
template<typename T> T gcf(T a, T b) {return (b == 0) ? a : gcf(b, a%b);} 
template<typename T> T lcm(T a, T b) {return (a*b)/gcf(a, b);}
template<typename T> T sumTo(T x) {return x * (x+1) / 2;}
template<typename T> T sumSquaresTo(T x) {return x * (x+1) * (2*x+1) / 6;}
template<typename T> T ceilDiv(T n, T d) {return (n+d-1)/d;}

void solve() {
    string s, t; cin >> s >> t;
    int ans = 0; fo(i , s.size()) if (s[i] == t[i]) ans++;
    pd(ans);
}

int main() {
    int t = 1;
    //scanf("%d", &t);
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using intl = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)(n); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define repid(i, a, b) for(intl i = (intl)(a); i >= (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin,(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define int intl
#define itn intl
#define double ld
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl digit10(intl a){
    if(!a)return 1;
    intl b = 0;
    while(a){
        a /= 10;
        b++;
    }
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl a,b,c,d;
    cin >> a >> b;
    rep(i,b + 2)cout << "#";
    cout << endl;
    rep(i,a){
        cout << "#";
        rep(j,b){
            char c;
            cin >> c;
            cout << c;
        }
        cout << "#" << endl;
    }
    rep(i,b + 2)cout << "#";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;
 
int main(){
	int n;
	cin >> n;
	ll a[n];
	REP(i,n) cin >> a[i];
	ll sum = 0;
	map<ll,ll> mp;
	mp[sum]++;
	REP(i,n){
		sum += a[i];
		mp[sum]++;
	}
	ll ans = 0;
	for(auto i : mp){
		if(i.second > 1) ans += i.second * (i.second - 1) / 2;
	}
	cout << ans << endl;
}

Measured memory_bytes: 14336
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int s = sc.nextInt();
		Set<Integer> set = new HashSet<>();
		for (int i = 0; ; i++) {
			if (set.contains(s)) {
				System.out.println(i + 1);
				return;
			} else {
				set.add(s);
			}
			s = s % 2 == 0 ? s / 2 : s * 3 + 1;
		}
	}
}

Measured memory_bytes: 23764
n = int(input())
l_list = list(map(int,input().split()))
l_list.sort()
import bisect
count = 0
for i in range(1,n):
  for j in range(i+1,n):
    b = l_list[i]
    c = l_list[j]
    a_cand = l_list[:i]
    border = c-b
    count += len(a_cand) - bisect.bisect_right(a_cand,border)
print(count)    
    
    


Measured memory_bytes: 59052
def solve():
    n = int(input())
    s = input()
    reps = ''
    for c in s:
        asc = ord(c) + n
        if asc > 90:
            reps += chr(64 + asc - 90)
        else:
            reps += chr(asc)
    print(reps)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 3060
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>
#include <random>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
random_device rnd;
mt19937 mt(rnd());
uniform_int_distribution<> rand26(1, 26);
int main(void){
    ll d;
    cin >> d;
    rep(i, d){
        cout << rand26(mt) << endl;
    }
    return 0;
}


Measured memory_bytes: 3616
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args)throws IOException{
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader reader = new BufferedReader(isr);
		String string;
		char ch[];
		
		int n, res;
		while(!(string = reader.readLine()).equals("0")){
			n = Integer.valueOf(string);
			
			int map[][] = new int[n][n];
			int sum[][] = new int[n + 1][n + 1];
			ch = reader.readLine().toCharArray();
			for(int i = 0; i < n; i++){
				map[0][i] = (ch[i] == '.' ? 1 : 0);
				
				if(i > 0){
					sum[1][i + 1] = sum[1][i] + map[0][i];
				}else{
					sum[1][i + 1] = map[0][i];
				}
			}
			for(int i = 1; i < n; i++){
				ch = reader.readLine().toCharArray();
				for(int j = 0; j < n; j++){
					map[i][j] = (ch[j] == '.' ? 1 : 0) + map[i - 1][j];
					
					if(j > 0){
						sum[i + 1][j + 1] = sum[i + 1][j] + map[i][j];
					}else{
						sum[i + 1][1] = map[i][0];
					}
				}
			}
			
			if(sum[n][n] == 0){
				System.out.println(0);
				continue;
			}
			res = 1;
			boolean next = false;
			for(int w = n + 1; w > 0; w--){
				for(int i = n; i > 0; i--){
					if(i - w < 0) break;
					for(int j = n; j > 0; j--){
						if(j - w < 0) break;
						
						if(sum[i][j] - sum[i - w][j] - sum[i][j - w] + sum[i - w][j - w] == w * w){
							res = w;
							next = true;
							break;
						}
					}
					if(next) break;
				}
				if(next) break;
			}
			System.out.println(res);
		}
		reader.close();
	}
}

Measured memory_bytes: 66456
fun main(args: Array<String>){
    val s = readLine()!!
    val contain = mutableSetOf<Char>()
    s.forEach {
        contain.add(it)
    }

    for (c in 'a' until 'z' + 1) {
        if (c !in contain) {
            println(s.plus(c))
            return
        }
    }

    val sRev = s.reversed()
    val removed = mutableSetOf<Char>()
    sRev.forEachIndexed {
        i, it ->
            for (c in it + 1 until 'z' + 1) {
                if (c in removed) {
                    println((c.plus(sRev.slice(i + 1 until sRev.length)).reversed()))
                    return
                }
            }
            removed.add(it)
    }
    println(-1)
}


Measured memory_bytes: 37876
import numpy as np
from fractions import gcd

def lcm(x, y):
    return (x*y) // gcd(x, y)
ufunc = np.frompyfunc(lcm,2,1)

n = int(input())
t = np.array([int(input()) for i in range(n)])

ans = ufunc.reduce(t)
print(ans)

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

int main(){
  ll x;
  cin >> x;
  ll ans = 1000*(x/500);
  x -= 500*(x/500);
  ans += 5*(x/5);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;
int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    ll a[n];
    rep(i, n)
    {
        cin >> a[n - 1 - i];
    }
    ll maxans = 2;
    ll minans = 2;
    rep(i, n)
    {
        cerr << i << " " << maxans << " " << a[i] << endl;
        if (maxans < a[i])
        {
            cout << -1 << endl;
            return 0;
        }
        maxans = maxans - (maxans % a[i]) + a[i] - 1;

        minans = a[i] * ((minans + a[i] - 1) / a[i]);
    }
    if (minans > maxans)
    {
        cout << -1 << endl;
        return 0;
    }
    cout << minans << " " << maxans << endl;
    return 0;
}


Measured memory_bytes: 1024
N = int(input())
P = []
Q = [0 for i in range(N+1)]
for i in range(1, N+1):
    Q[int(input())] = i

straight = 1
max_straight = 1
for i in range(1, N):
    if Q[i] < Q[i+1]:
        straight += 1
        max_straight = max(straight, max_straight)
    else:
        straight = 1

print(N - max_straight)

Measured memory_bytes: 11080
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>
 
using namespace std;
const long long MAXN = 200100;
const long long MOD = 1e9 + 7;
vector<long long> v1[MAXN];

long long fenwick[MAXN + 2];
long long arr[MAXN];
long long h[MAXN];
long long n;
void update(long long pos, long long val){
    for(; pos <= n; pos += (pos & (-pos))){
        fenwick[pos] = max(val,fenwick[pos]);
    }
}
long long query(long long pos){
    long long ans = 0;
    for(; pos; pos -= (pos & (-pos))){
        ans = max(ans,fenwick[pos]);
    }
    return ans;
}
long long ans;
int main() {
  
   cin>>n;
   for(long long i=0;i<n;i++){
       cin>>arr[i];
   }
   for(long long i=0;i<n;i++){
       cin>>h[i];
   }
   for(long long i=0;i<n;i++){
       long long temp = query(arr[i])+h[i];
       ans = max(ans,temp);
       update(arr[i],temp);
   }
   cout<<ans<<endl;
}

Measured memory_bytes: 9600
#include <stdio.h>

int main(int argc, const char * argv[]) {
    char ch;
    while((ch = getchar()) != EOF){
        if(ch >= 97 && ch <= 122)
            printf("%c", ch-32);
        else if(ch >= 65 && ch <= 90)
            printf("%c", ch+32);
        else
            printf("%c", ch);
        }
    return 0;
}



Measured memory_bytes: 2504
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));
int main(){
	int N; cin >> N;
	vector<int> v(201);
	for(int i = 1; i <= 200; i+=2){
		for(int j = 1; j <= 200; j+=2){
			if(i % j == 0) ++v[i];
		}
	}

	int sum = 0;
	REP(i, N+1) if(v[i] == 8) ++sum;
	cout << sum << endl;
}


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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

const int N = 3e6 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;



void solve()
{
	int l, r, d;
	cin >> l >> r >> d;;
	int cnt = 0;
	lop(i, l, r + 1)
	{
		if (i % d);
		else cnt++;
	}

	cout << cnt << endl;
}

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

	int test = 1;
	// cin >> test;
	while (test--)solve();


}





















Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;

int main(){
    while(1){
        string n;
        cin >> n;
        if(n=="0") break;
        vector<vector<int>> dp(n.size()+1,vector<int>(11,0));
        rep(i,n.size()){
            int nd = n[i] - '0';
            if(nd!=0) dp[i+1][nd] ++;
            rep(j,11){
                dp[i+1][(10*j+nd)%11] += dp[i][j];
            }
        }
        int ans = 0;
        rep(i,n.size()+1) ans += dp[i][0];
        cout << ans << endl;

        /*
        rep(i,n.size()+1){
            rep(j,11){
                cout << dp[i][j] << " " ;
            }
            cout << endl;
        }
        */
    }
    return 0;
}


Measured memory_bytes: 9896
#include <bits/stdc++.h>
#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 irep(i, a, n) for (int i = a; 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 >= 1; --i)
#define allrep(V, v) for (auto &&V : v)
#define all(x) (x).begin(), (x).end()
const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
using lint = long long;

using namespace std;

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

  int q;
  cin >> q;
  vector<int> t(q), a(q), b(q);
  rep(i, q) {
    cin >> t[i];
    if (t[i] == 1) cin >> a[i] >> b[i];
  }
  multiset<int, greater<int>> l;
  multiset<int> r;
  int lmax = -INF, rmin = INF;
  lint lsum = 0, rsum = 0, bsum = 0;
  int mid;
  bool mid_ava = false;
  rep(i, q) {
    if (t[i] == 1) {
      if (mid_ava) {
        if (a[i] < mid) {
          r.insert(mid);
          rmin = mid;
          rsum += mid;
          l.insert(a[i]);
          lmax = max(lmax, a[i]);
          lsum += a[i];
        } else {
          l.insert(mid);
          lmax = mid;
          lsum += mid;
          r.insert(a[i]);
          rmin = min(rmin, a[i]);
          rsum += a[i];
        }
      } else {
        if (a[i] < lmax) {
          l.erase(l.begin());
          mid = lmax;
          l.insert(a[i]);
          lmax = *l.begin();
          lsum += a[i] - mid;
        } else if (a[i] > rmin) {
          r.erase(r.begin());
          mid = rmin;
          r.insert(a[i]);
          rmin = *r.begin();
          rsum += a[i] - mid;
        } else {
          mid = a[i];
        }
      }
      mid_ava = !mid_ava;
      bsum += b[i];
    } else {
      cout << (mid_ava ? mid : lmax) << " " << rsum - lsum + bsum << "\n";
    }
  }
  return 0;
}

Measured memory_bytes: 12032
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,a,b,c,ans=10000000,num=0,suma=0,sumb=0,sumc=0;
    cin>>n>>a>>b>>c;
    int l[n];
    for(int i=0;i<n;i++){
    	cin>>l[i];
    }
  ll ma=pow(4,n);
    for(int i=0;i<ma;++i){
    	vector<int> v;
        ll maki=i;
    	for(int j=0;j<n;j++){
           v.pb(maki%4);
           maki/=4;
        }
      for(int i=0;i<n;i++){
    			if(v[i]==0){
    				if(suma!=0){
    						num+=10;
    					}
    					suma+=l[i];
                }
    			else if(v[i]==1){
                     if(sumb!=0){
    						num+=10;
    					}
    					sumb+=l[i];         
                }
    			else if(v[i]==2){
    					if(sumc!=0){
    						num+=10;
    					}
    					sumc+=l[i];
    				}
    		}
    		num+=(abs(a-suma)+abs(b-sumb)+abs(c-sumc));
    		if(suma!=0 && sumb!=0 && sumc!=0){
    			ans=min(ans,num);
    		}
    		num=0,suma=0,sumb=0,sumc=0;
    
    	
    }
    cout <<ans<<endl;
    return 0;
}



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

int main() {

	string s;
	cin>>s;
	set<char>p;
	p.insert('A');
	p.insert('C');
	p.insert('T');
	p.insert('G');
	int act=0,ans=0;
	for(auto x: s)
	{
		if(p.count(x))
		{
			ans++;
			act=max(act,ans);
		}
		else
		{
			ans=0;
		}
		
		
		
	}
	cout<<act;


}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define sz(a) (int)(a.size())
#define pb push_back
#define all(c) c.begin(),c.end()
#define tr(it,a,c) for(auto it=c.begin()+a;it!=c.end();it++)
#define fr(i,a,n)	for(int i=a;i<n;i++)
#define present(c,x) (c.find(x)!=c.end()) //for set/map etc.
#define cpresent(c,x) (find(all(c),x)!=c.end())
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
int N=100001;
int mod=1e9+7;


int min(int a,int b){if(a<b) return a; else return b;}
int max(int a,int b){if(a>b) return a; else return b;}
int power(int a,int b){int res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int gcd(int p, int q){if(p%q==0) return q; else{return gcd(q,p%q);}} 
bool comp(int a, int b) 
{ 
    return (a > b); 
}

bool comp1(pi a, pi b)
{
	if(a.first==b.first)return a.second<b.second;
	else return a.first>b.first;
}

template<typename T> 
istream& operator>>(istream& in, vector<T>& v)
{
	for (T& x : v) in >> x; return in;
}

template<typename T> 
ostream& operator<<(ostream& out, vector<T>& v)
{
	for (T& x : v) out << x<<" "; return out;
}

// template<typename T>
int sum1(vector<int>& v)
{
	int sum=0;
	// for(auto x: v)sum+=x;
	fr(i,0,v.size())sum+=v[i];
	return sum;
}





 void solve()
{
	int n,d;
	cin>>n>>d;
	vi x(n),y(n);
	fr(i,0,n)
	{
		cin>>x[i]>>y[i];
	}
	int c=0;
	fr(i,0,n)
	{
		if(x[i]*x[i] + y[i]*y[i]<= d*d)c++;
	}
	cout<<c;

}

signed main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	// int t;
	// cin>>t;
	// while(t--)
	// {
	// 	solve();
	// 	cout<<endl;
	// }
	solve();
	return 0;	
}

Measured memory_bytes: 6408
from collections import Counter
def main():
    S = input()
    A = [0] * ((n := len(S)) + 1)
    A[1] = (a := int(S[-1])) % 2019
    for i in range(2, n + 1):
        a += pow(10, i - 1, 2019) * int(S[-i])
        A[i] = a % 2019
    c = Counter(A)
    ans = 0
    for v in c.values():
        ans += v * (v - 1) // 2
    print(ans)

if __name__ == '__main__':
    main()


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

int main() {
  int N;
  int P[200000];
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> P[i];
  }

  int count = 0;
  int min = 200000;
  for (int i = 0; i < N; i++) {
    if (P[i] <= min) {
      count++;
      min = P[i];
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 1024
#include  <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int main() {
  int s = 0;
  int r=0;
  int l=0;
  //char* ch;
  std::string str;
std::cin >> str;              // single word
char* cstr = new char[str.size() + 1]; // メモリ確保
int* ci = new int[str.size() + 1]; // メモリ確保
  s=str.size();
std::char_traits<char>::copy(cstr, str.c_str(), str.size() + 1);
  bool flg = false;
  int li=0;
  memset(ci, 0, sizeof(ci));
  for(int i=0;i<s;i++){
   if(cstr[i]=='R'){
     if(flg){
       if(l%2 == 1){
       ci[li]+=l/2+1;
       ci[li-1]+=l/2;
       }else{
       ci[li]+=l/2;
       ci[li-1]+=l/2;
       }
       l=0;
       flg=false;
     }
     r++;
   }else{
     if(!flg){
       if(r%2 == 1){
       ci[i]+=r/2;
       ci[i-1]+=r/2+1;
       }else{
       ci[i]+=r/2;
       ci[i-1]+=r/2;
       }
       r=0;
       li = i;
       flg=true;
     }
     l++;
   }
  }
       if(l%2 == 1){
       ci[li]+=l/2+1;
       ci[li-1]+=l/2;
       }else{
       ci[li]+=l/2;
       ci[li-1]+=l/2;
       }
  //std::getline(std::cin, a);  // whole line
  for(int i=0;i<s-1;i++){
    cout << ci[i] << " ";
  }
  cout << ci[s-1];
  return 0;
}

Measured memory_bytes: 1024
#!/usr/bin/env python3

N=int(input())
A=list(map(int,input().split()))

ans=1

for i in range(N):
    if A[i]==0:
        print(0)
        exit()

for i in range(N):
    ans*=A[i]
    if ans > 1000000000000000000:
        print(-1)
        exit()

print(ans)


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

typedef pair<string, int> P;
typedef pair<P, int> PP;

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

    vector<PP> v(N);
    for (int i = 0; i < N; i++) {
        string s; int p;
        cin >> s >> p;
        v[i] = PP(P(s, -p), i);
    }
    sort(v.begin(), v.end());

    for (int i = 0; i < N; i++) {
        cout << v[i].second + 1 << endl;
    }

    return 0;
}

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


void solve(std::string C){
    string S;
    int a = 1;
    S = C[0] + a;
    cout << S << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string C;
    std::cin >> C;
    solve(C);
    return 0;
}


Measured memory_bytes: 256
def solve(brd, bits)
  if bits == (1<<8) - 1
    brd.map{ |bs| puts bs.map{ |b| b ? '.' : 'Q' }.join }
    return true
  end
  (0..7).each do |y|
    if (bits & (1<<y)) == 0
      (0..7).each do |x|
        if brd[y][x] && check(y, x, brd)
          brd[y][x] = false
          bits += 1<<y
          return true if solve(brd, bits)
          bits -= 1<<y
          brd[y][x] = true
        end
      end
    end
  end
  false
end
 
def check(y, x, brd)
  (1..7).each do |i|
    [-1, 1].each do |dy|
      (-1..1).each do |dx|
        ny = y + dy * i
        nx = x + dx * i
        if 0 <= ny && ny < 8 && 0 <= nx && nx < 8
          return false unless brd[ny][nx]
        end
      end
    end
  end
  true
end

brd = 8.times.map{ [true] * 8 }
bit = 0
gets.to_i.times do
  r, c = gets.split.map(&:to_i)
  bit += 1<<r
  brd[r][c] = false
end

solve(brd, bit)

Measured memory_bytes: 8872
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define yn(ans) cout<<(ans?"Yes":"No")<<endl
#define YN(ans) cout<<(ans?"YES":"NO")<<endl
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}

int main(){
    int n,a,b,c,d;
    in(n,a,b,c,d);
    string s;
    cin>>s;
    int ans=1;
    for(int i=a;i<c;i++){
        if(s[i]=='#'&&s[i+1]=='#'){
            ans=0;
            goto skip;
        }
    }
    for(int i=b;i<d;i++){
        if(s[i]=='#'&&s[i+1]=='#'){
            ans=0;
            goto skip;
        }
    }
    if(c>d){
        ans=0;
        for(int i=b-1;i<=d-1;i++){
            if(s[i-1]=='.'&&s[i]=='.'&&s[i+1]=='.'){
                ans=1;
                goto skip;
            }
        }
    }
    skip:
    yn(ans);
}

Measured memory_bytes: 3828
#include <unordered_set>
#include <set>
#include <iostream>
using namespace std;

bool check(long long n, long long d) {
    while (n % d == 0) n /= d;
    return n % d == 1;
}

int main() {
    long long n; cin >> n;
    if (n == 2) { cout << "1\n"; return 0; }
    unordered_set<long long> S;
    for (long long d = 2; d * d <= n-1; d++)
        if ((n-1) % d == 0) {
            S.insert(d);
            S.insert((n-1)/d);
        }
    for (long long d = 2; d * d <= n; d++)
        if (n % d == 0) {
            if (check(n, d)) S.insert(d);
            if (check(n, n/d)) S.insert(n/d);
        }
    cout << S.size() + 2 << endl;
}


Measured memory_bytes: 384
N, M = map(int, input().split())
H_list = list(map(int, input().split()))
ans = [1]*N
for _ in range(M):
    A, B  = map(int, input().split())
    if H_list[A - 1] < H_list[B - 1]:
        ans[A - 1] = 0
    elif H_list[A - 1] == H_list[B - 1]:
        ans[A - 1], ans[B - 1] = 0, 0
    else:
        ans[B - 1] = 0

print(sum(ans))

Measured memory_bytes: 20116