akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>    //C++の標準ライブラリのヘッダを全て読み込む

#define _GLIBCXX_DEBUG

int main() {
    using std::cout;
    using std::endl;
    using std::cin;
    using std::string;
    using std::vector;

    int n,m;
    cin >> n >> m;
    vector<vector<int>> town(2, vector<int>(n, 0));

    for(int i=0; i < m; i++){
        int a, b;
        cin >> a >> b;
        town.at(0).at(a-1) += 1;
        town.at(1).at(b-1) += 1;
    }

    for(int i=0; i < n; i++){
        cout << town.at(0).at(i) + town.at(1).at(i) << endl;
    }
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(int)n;i++)

typedef struct Cond{
  int kind;
  int arrow;
  int bound;
}cond;

bool sr(const cond& l, const cond& r){
  return l.kind==r.kind ? l.arrow < r.arrow : l.kind < r.kind;
}

class Graph{
public:
  int v;
  vector<int> visited,visiting;
  vector<int> e[100];
  Graph(int m){
    v = m;
    visited = vector<int>(v);
    visiting = vector<int>(v);
  }
  void addEdge(int e1,int e2){
    if (find(e[e1].begin(),e[e1].end(),e2)==e[e1].end()){
      e[e1].push_back(e2);
    }
  }
  int dfs(int vv){
    int ret = 0;
    visited[vv] = 1;
    visiting[vv] = 1;
    rep(i,e[vv].size()){
      if(!visited[e[vv][i]]){
        ret += dfs(e[vv][i]);
      } else if (visiting[e[vv][i]]==1){
        return 1;
      }
    }
    visiting[vv] = 0;
    return ret;
  }

  int isDAG(){
    rep(i,v){
      int m = dfs(i);
      if (m>0){
        return 0;
      }
    }
    return 1;
  }

};


int main(){

  int m,n;
  cin >> m >> n;
  vector<int> k(m);
  vector<cond> conditions[100];
  pair<int,int> sections[100][100];

  rep(i,m){
    cin >> k[i];
    conditions[i] = vector<cond>(k[i]);
    rep(j,k[i]){
      string c;
      cin >> conditions[i][j].kind >> c >> conditions[i][j].bound;
      conditions[i][j].kind--;
      if (c==">="){
        conditions[i][j].arrow = 0;
      } else {
        conditions[i][j].arrow = 1;
      }
    }
    sort(conditions[i].begin(),conditions[i].end(),sr);
    //commandの条件内で矛盾を探す
    rep(j,100){sections[i][j].first=0;sections[i][j].second=101;}
    rep(j,conditions[i].size()){
      int k = conditions[i][j].kind;
      if (conditions[i][j].arrow == 0){
        sections[i][k].first = max(sections[i][k].first,conditions[i][j].bound);
      } else {
        sections[i][k].second = min(sections[i][k].second,conditions[i][j].bound);
      }
    }
    rep(j,n){
      if(sections[i][j].first>sections[i][j].second){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  //sections[i][j]: i番目のcommand,j番目のskillポイントがfirst以上second以下
  //skillポイントを固定して条件を見ていって，区間に交わりがない場合は小→大へ辺を張る
  Graph g(m);
  rep(skill,n){
    rep(com1,m){
      rep(com2,m){
        if (com1!=com2){
          int com1l = sections[com1][skill].first;
          int com1r = sections[com1][skill].second;
          int com2l = sections[com2][skill].first;
          int com2r = sections[com2][skill].second;
          if (com2r < com1l){
            g.addEdge(com2,com1);
          } else if (com1r < com2l){
            g.addEdge(com1,com2);
          }
        }
      }
    }
  }
  //閉路判定
  int result = g.isDAG();
  if (result == 1){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}



Measured memory_bytes: 3396
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>

using namespace std;
typedef long long int LL;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int xcomp(vector<LL>& a, vector<LL>& b) {
	return a[0] < b[0];
}

#define XSORT(c) sort((c).begin(),(c).end(),xcomp)

#define ALL(x) (x).begin(),(x).end()
LL mod = 1000000007;

vector<vector<LL>> ko(100001, vector<LL>(0));
LL hoge(LL a) {
	if (ko[a].size() == 0) {
		return 0;
	}
	else {

		vector<LL> b(0);

		REP(i, ko[a].size()) {
			b.push_back(hoge(ko[a][i]));
		}
		SORT(b);
		LL max = -1;
		REP(i, b.size()) {
			b[i] += b.size() - i;
			if (b[i] > max) { max = b[i]; }
		}
		return max;
	}
}

int main() {
	LL N;
	cin >> N;
	FOR(i, 2, N + 1) {
		LL a;
		cin >> a;
		ko[a].push_back(i);
	}
	cout << hoge(1) << endl;
}


Measured memory_bytes: 13568
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;

int main(){
	char s[110], c;
	int l = 0;
	while((c=getchar()) != '\n') s[l++] = c;

	int dp[l+1][4][2] = {0};
	dp[0][0][0] = 1;
	for(int i=0; i<l; i++) for(int j=0; j<4; j++) for(int k=0; k<2; k++){
		int d = s[i] - '0';
		for(int nd=0; nd<10; nd++){
			int nonz = j + (nd>0);
			if(nonz>3) continue;
			if(k==0){
				if(nd<d) dp[i+1][nonz][1] += dp[i][j][k];
				else if(nd==d) dp[i+1][nonz][0] += dp[i][j][k];
				else continue;
			}else dp[i+1][nonz][1] += dp[i][j][k];
		}	
	}

	int k; scanf("%d", &k);
	printf("%d\n", dp[l][k][0]+dp[l][k][1]);
	return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  string s;cin>>s;
  if(s.size()<26){
    rep(i,26){
      bool exist=false;
      rep(j,s.size()){
        if(s[j]==abc[i])exist=true;
      }
      if(!exist){
        cout<<s<<abc[i]<<endl;
        return 0;
      }
    }
  }
  ll k=-1;
  for(ll i=24;i>=0;i--){
    if(s[i]<s[i+1]){
      k=i;
      break;
    }
  }
  if(k==-1){
    cout<<k<<endl;
    return 0;
  }
  rep(i,k)cout<<s[i];
  char MIN='z';
  for(ll i=k+1;i<26;i++){
    if(s[i]>s[k])MIN=min(MIN,s[i]);
  }
  cout<<MIN<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

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

Measured memory_bytes: 3576
h,w = map(int, input().split())
s = []
for _ in range(h):
	s.append(list(input()))
    
if (h == 1)&(w==1):
    if s[0][0] == ".":
        s[0][0] = "0"

elif (h == 1)&(w!=1):
    for j in range(w):
        if j == 0:
            s[0][j] = s[0][j].replace(".",str(s[0][j+1].count("#")))
        elif j == w-1:
            s[0][j] = s[0][j].replace(".",str(s[0][j-1].count("#")))
        else:
            s[0][j] = s[0][j].replace(".",str([s[0][j-1],s[0][j+1]].count("#")))

elif (h != 1)&(w==1):
    for i in range(h):
        if i == 0:
            s[i][0] = s[i][0].replace(".",str(s[i+1][0].count("#")))
        elif i == h-1:
            s[i][0] = s[i][0].replace(".",str(s[i-1][0].count("#")))
        else:
            s[i][0] = s[i][0].replace(".",str([s[i-1][0],s[i+1][0]].count("#")))
else:
    for i in range(len(s)):
        if i == 0:
            for j in range(w):
                if j == 0:
                    s[i][j] = s[i][j].replace(".",str([s[i][j+1],s[i+1][j],s[i+1][j+1]].count("#")))
                elif j == w-1:
                    s[i][j] = s[i][j].replace(".",str([s[i][j-1],s[i+1][j],s[i+1][j-1]].count("#")))
                else:
                    s[i][j] = s[i][j].replace(".",str([s[i][j-1],s[i][j+1],s[i+1][j],s[i+1][j+1],s[i+1][j-1]].count("#")))
        elif i == h-1:
            for j in range(w):
                if j == 0:
                    s[i][j] = s[i][j].replace(".",str([s[i][j+1],s[i-1][j],s[i-1][j+1]].count("#")))
                elif j == w-1:
                    s[i][j] = s[i][j].replace(".",str([s[i][j-1],s[i-1][j],s[i-1][j-1]].count("#")))
                else:
                    s[i][j] = s[i][j].replace(".",str([s[i][j-1],s[i][j+1],s[i-1][j],s[i-1][j+1],s[i-1][j-1]].count("#")))
        else:
            for j in range(w):
                if j == 0:
                    s[i][j] = s[i][j].replace(".",str([s[i][j+1],s[i-1][j],s[i-1][j+1],s[i+1][j],s[i+1][j+1]].count("#")))
                elif j == w-1:
                    s[i][j] = s[i][j].replace(".",str([s[i][j-1],s[i-1][j],s[i-1][j-1],s[i+1][j],s[i+1][j-1]].count("#")))
                else:
                    s[i][j] = s[i][j].replace(".",str([s[i][j-1],s[i][j+1],s[i-1][j],s[i-1][j+1],s[i-1][j-1],s[i+1][j],s[i+1][j+1],s[i+1][j-1]].count("#")))

for k in s:
    print("".join(k))

Measured memory_bytes: 9328
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <utility>
#include <functional>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <numeric>
#include <complex>

using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const int INF = (1<<30);
const ll INFL = (1LL<<62);
const int MOD = 1000000007;
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> ll mod_pow(ll a, ll n, T mod) { mod=(ll)mod; ll res=1, p=a%mod; while(n){ if(n&1) res=res*p%mod; p=p*p%mod; n>>=1; } return res; }

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(auto &ai : a) cin >> ai;
    sort(all(a));
    int ans = 0;
    int max = a[n-1];
    int diff = INF;
    rep(i, n){
        if(max == a[i]) continue;
        int d = abs(max/2 - a[i]);
        if(d < diff) diff = d, ans = i;
    }
    sort(all(a), greater<int>());
    diff = INF;
    rep(i, n){
        if(max == a[i]) continue;
        int d = abs(max/2 - a[i]);
        if(d < diff) diff = d, ans = i;
    }
    printf("%d %d\n", max, a[ans]);

    return 0;
}


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

#define pb push_back
#define rb  pop_back
#define rf  pop_front
#define ins insert
#define f   first
#define s   second
#define um  unordered_map
#define us  unordered_set
#define pq  priority_queue

typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
typedef pair< long long int ,long long int > iil;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector< ll > vl;
typedef vector< vl > vvl;
typedef vector<double> vd;
typedef pair<double,double> pd;
typedef queue<int> qi;
typedef queue<double> qd;
typedef queue<ll> qll;
typedef us<int> si;
typedef us<double> sd;
typedef us<ll> sll;
typedef vector<vd> md;


const int MAX = 1e6;
const int N = 200043;
const int MOD = 998244353;

#define IO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define sz(a) int((a).size())
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for( auto i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define EE endl
#define PI 3.14159265
#define g(a,b) a>b?a:b
#define l(a,b) a<b?a:b
#define SOT(A) sort(A.begin(),A.end())
#define SOTR(A) sort(A.rbegin(),A.rend())
#define REV(a) reverse(ALL(a))

// LOOP Control Statements
#define forn(i,j,n) for ( auto i=j ; i<n ; i++ )
#define fornd(i,j,n) for ( auto i=j ; i>n ; i-- )
#define FORE(i, b) for(auto &i:b)


#define SQ(i) (i*i)
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define IN(a, b) (a.find(b) != a.end())
#define BACK(a) a.back(); a.RB()
#define QBACK(a) a.top(); a.pop()
#define PRINT(a) FORE(i, a) cout << i << " "; cout << endl
#define take(V,f,n) for(int i=f;i<f+n;i++) cin>>V[i]
#define tcase(term) int tc;cin>>tc;for(int term=0; cout<<"CASE "<<term+1<<EE,term<tc;term++)





int main()
{
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	// tcase(terms)
	{
		ll n;
		cin>>n;
		vl A(n+1,2);
		A[1]=1;
		for(int i=2;i<n+1;i++){
			for(int j=i+i;j<=n;j+=i){
				A[j]++;
			}
		}
		ll  s=0;
		for(int i=0;i<=n;i++){
			s+=(i*A[i]);
		}
		cout<<s;
	}
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
#define MOD ((ll)1e9+7)
ll N,M,S[2020],T[2020];

ll mk[2020],mk2[2020];
ll i, j, k,ans;
ll dp[2020][2020];

int main(){
    scanf("%lld%lld", &N, &M);
    fornum(i,0,N){
        scanf("%lld", S+i);
    }
    fornum(i,0,M){
        scanf("%lld", T+i);
    }
    fornum(i,0,N){
        ll a = 1;
        fornum(j,0,M){
            dp[i + 1][j] = dp[i][j];
            if(S[i]==T[j]){
                dp[i + 1][j] = (dp[i + 1][j] + a) % MOD;
            }
            a = (a + dp[i][j]) % MOD;
        }
    }
    ans = 1;
    fornum(i,0,M){
        ans = (ans + dp[N][i])%MOD;
    }
    printf("%lld", ans);

    return 0;
}

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

int main(){
  int A, B;

  cin >> A >> B;

  if(A == B){
    cout << "Draw" << endl;
  }else if(A == 1){
    cout << "Alice" << endl;
  }else if(B == 1){
    cout << "Bob" << endl;
  }else if(A > B){
    cout << "Alice" << endl;
  }else if(B > A){
    cout << "Bob" << endl;
  }

  return 0;

}

Measured memory_bytes: 256
class card:
    def __init__(self, suit, value, no):
        self.suit = suit
        self.value = value
        self.no = no
def partition(A, p, r):
    piv = A[r].value
    i = p - 1
    for j in range(p, r):
        if A[j].value <= piv:
            i += 1
            temp = A[j]
            A[j] = A[i]
            A[i] = temp
    temp = A[i+1]
    A[i+1] = A[r]
    A[r] = temp
    return i + 1


def quicksort(A, p, r):
    if p < r:
        q = partition(A, p, r)
        quicksort(A, p, q-1)
        quicksort(A, q, r)

def isstable(A, n):
    for i in range(n-1):
        if A[i].value == A[i+1].value and A[i].no > A[i+1].no:
            print("Not stable")
            return
    print("Stable")


n = int(input())
cards=[]

for i in range(n):
    temp = list(input().split())
    ob = card(temp[0], int(temp[1]), i)
    cards.append(ob)
quicksort(cards, 0, n-1)
isstable(cards, n)
for i in range(n):
    print(cards[i].suit + " " + str(cards[i].value))


Measured memory_bytes: 29652
#include<iostream>
using namespace std;
int main(){
	int n,s[10000],a;
	cin>>n>>s[0];
	for(int i=1;i<=n;i++){
		cin>>s[i]>>a;
		s[i]=s[i-1]+s[i]-a;
	}
	for(int j=1;j<=n;j++){
		if(s[0]<s[j])s[0]=s[j];
		if(s[j]<0){
			s[0]=0;
			break;
		}
	}
	cout<<s[0]<<endl;
	return 0;
}


Measured memory_bytes: 3136
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
ll i, temp,t, j, b, n, X, Y, dp[3005][3005];
vector<ll>V;
bool vis[3005][3005];
ll solve(int l, int r)
{
    if(l>r)
        return 0;
    if(vis[l][r])
        return dp[l][r];

    ll score1 = V[l]-solve(l+1,r);
    ll score2 = V[r]-solve(l,r-1);
    vis[l][r] = true;
    return dp[l][r] = max(score1, score2);
}
int main()
{
    //I am Monim, a tiny creature of Allah
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for(i=0;i<n;i++)
    {
        cin >> temp;
        V.push_back(temp);
    }
    cout << solve(0,n-1) << endl;
    return 0;
}



Measured memory_bytes: 58812
#include <stdio.h>

int main(void){
  int s;
  scanf("%d",&s);

  if(s == 1 || s == 2){
    printf("4\n");
    return 0;
  }
  int counter = 1;
  while(s != 1){
    if(s%2 == 0){
      s /= 2;
    }else{
      s = 3*s+1;
    }
    counter++;
  }
  printf("%d\n",counter+1);

  return 0;
}

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

int main() {
	// your code goes here
	long long N;
	cin >> N;
	long long n = N;
	int m = 0;
	vector <int> vect;
	int res = 0;
	while (n != 0)
	{
		m = n % 10;
		n = n / 10;
		vect.push_back(m);
	}
	for (int i = vect.size() - 2; i >= 0; i--)
	{
		if (vect[i] != 9)
		{
			vect[vect.size() - 1]--;
			break;
		}
	}
	res = (vect.size() - 1) * 9 + vect[vect.size() - 1];
	cout << res;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
int n, dp[100]; char s1[100], s2[100];
int main(){
	scanf("%d%s%s", &n, s1, s2);
	int st;
	if (s1[0] == s2[0]) dp[0] = 3, st = 1;
	else dp[0] = dp[1] = 6, st = 2;

	for (int i = st; i < n; i++) {
		if (s1[i - 1] == s2[i - 1]) {
			dp[i] = dp[i-1] * 2 % MOD;
			if (s1[i] != s2[i]) dp[i + 1] = dp[i], i++;
		}
		else {
			if (s1[i] == s2[i])
				dp[i] = dp[i - 1];
			else
				dp[i] = (ll)dp[i - 1] * 3 % MOD, dp[i + 1] = dp[i], i++;
		}
	}
	printf("%d\n", dp[n - 1]);
	return 0;
}

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

bool check(string s){
 string curr = s;
 reverse(curr.begin(), curr.end());
 return curr == s;
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  string s1 =  "", s2 = "", s;
  cin >> s; int len = s.size();
  if (check(s) && (len & 1)){
  for (int i = 0; i < (len - 1) / 2; i++) s1 += s[i];
  for (int i = (len + 3) / 2 - 1; i < len; i++) s2 += s[i];
  if (check(s1) && check(s2)) cout << "Yes" << endl;
  else cout << "No" << endl; 
  }
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int i,j,n,m,k,l,a[200005];
bool check(int &k)
{
    if((a[n-1]<=k&&a[n]<=k)||(a[n]<=k&&a[n+1]<=k))return 1;
    if((a[n-1]>k&&a[n]>k)||(a[n]>k&&a[n+1]>k))return 0;
    for(int i=1;i<n-1;i++)
	{
        if((a[n+i]<=k&&a[n+i+1]<=k)||(a[n-i]<=k&&a[n-i-1]<=k))return 1;
        if((a[n+i]>k&&a[n+i+1]>k)||(a[n-i]>k&&a[n-i-1]>k))return 0;
    }
    return a[1]<=k;
}

int main(){
    scanf("%d",&n);
    for (int i=1;i<=n<<1;i++) scanf("%d",a+i);
    int l=1,r=(n<<1)-1;
    while(l<r){
        int mid=l+r>>1;
        if(check(mid))r=mid;
        else l=mid+1;
    }
    printf("%d",l);
}

Measured memory_bytes: 1024
#include<cstdio>
long long a[200005],k,i,m,n,s,t,d,sum;
int main()
{
	scanf("%d %d",&n ,&t);
	m = 0;
	d = 0;
	for(i = 1;i <= n;i++)
	{
		scanf("%d",&a[i]);
		m = a[i] - a[i - 1]; 
		if(m > t)
		{
			d = m - t;
			sum += d;
		}
	}
	k = a[n] - sum + t;
	printf("%d\n",k);
	return 0;
}

Measured memory_bytes: 1664
import java.util.Scanner;

//Treasure Hunt II
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if(n==-1)break;
			double x = 1;
			double y = 0;
			for(int i=2;i<=n;i++){
				double d = Math.sqrt(x*x+y*y);
				double dx = -y/d;
				double dy = x/d;
				x+=dx;
				y+=dy;
			}
			System.out.printf("%.2f\n%.2f\n", x, y);
		}
	}
}

Measured memory_bytes: 26212
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

res = []
x, y, z, K = na()
a_li = na()
b_li = na()
c_li = na()
list.sort(a_li, reverse=True)
list.sort(b_li, reverse=True)
list.sort(c_li, reverse=True)
for i in range(x):
    for j in range(y):
        for k in range(z):
            if (i + 1) * (j + 1) * (k + 1) <= K:
                res.append(a_li[i] + b_li[j] + c_li[k])
            else:
                break
list.sort(res, reverse=True)
for i in range(K):
    print(res[i])

Measured memory_bytes: 47584
import itertools

N = int(input())
F = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]

ans = -float('inf')
for x in list(itertools.product([0, 1], repeat=10)):
    if x.count(0) == 10:
        continue
    total = 0
    for i in range(N):
        count = 0
        for j in range(10):
            count += x[j] & F[i][j]
        total += P[i][count]
    ans = max(ans, total)
print(ans)


Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

typedef pair<ll,ll> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    rep(i,26){
      char x=(char)('a'+i);
      if(count(begin(s),end(s),x)==0){
        cout<<x<<endl;
        return 0;
      }
    }
    cout<<"None"<<endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
using namespace std;
typedef long long LL;
int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}
int d[100001];
int main()
{
	int n=gi(),m=gi(),i;
	while (m--)
		d[gi()]^=1,d[gi()]^=1;
	for (i=2;i<=n;i++) if (d[i]) return puts("NO"),0;
	puts("YES");
	return 0;
}


Measured memory_bytes: 640
N, K = map(int, input().split())
A = list(map(int, input().split()))
"""
if A == [1, 1] and K==2:
    print(1)
    exit()
"""
cumA = [0]
for a in A:
    cumA.append(a+cumA[-1])
from itertools import combinations
AA = []
for l, r in combinations(range(N+1), 2):
    AA.append(cumA[r] - cumA[l])

AA.sort(reverse=True)
ans = 0
d = len(bin(AA[0])) - 2
from bisect import bisect_right
while d>=0:
    #print(d, 1<<d, AA[K-1], AA)
    if AA[K-1] >= 1<<d:
        ans |= 1<<d
        #iaa = bisect_right(AA, 1<<d)
        #print(iaa, "iaa", 1<<d)
        #AA = AA[:iaa]
        i= 0
        while i < len(AA) and AA[i] & 1<<d:
            AA[i] ^= 1 << d
            i += 1
            if i==len(AA):
                break
        AA = AA[:i]

        d -= 1
        #print(AA)
    else:
        i=0
        #print("aaa")
        while i < len(AA) and AA[i] & 1<<d:
            AA[i] ^= 1<<d
            i += 1
        d -= 1
    AA.sort(reverse=True)
print(ans)
#print(AA)


Measured memory_bytes: 56168
#include<bits/stdc++.h>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
typedef long long ll;
////////////////////////////////////////////////////////////

int main(){
	int h,w,n;
	cin >> h >> w >> n;

	int a[n];
	rep(i,0,n) cin >> a[i];

	int f[h][w];
	int num = 1;
	
	rep(i,0,h){
		if( i % 2){
			rep(j,0,w){
				f[i][j] = num;
				//cout << "num:" << num << endl;
				a[num-1]--;
				if(a[num-1] == 0 ) num++;
			}
		}
		else{
			rrep(j,w-1,0){
				f[i][j] = num;
				//cout << "num:" << num << endl;
				a[num-1]--;
				if(a[num-1] == 0 ) num++;
			}
		}
	}

	rep(i,0,h){
		rep(j,0,w) {
			cout << f[i][j];
			if( j < w-1 ) cout << " ";
			else cout << endl;
		}
	}

	ret 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long ll;

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

int main(){
	ll a,b;
	std::cin >> a >> b;
	if(a*b % 2){
		std::cout << "Odd" << std::endl;
	} else {
		std::cout << "Even" << std::endl;
	}
	return 0;
}


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

int main() {
	string s, t;
	bool check = false;
	cin >> s >> t;
	int S[100], T[100];
	for (int i = 0; i < s.size(); i++) {
		S[i] = s[i];
	}
	for (int i = 0; i < t.size(); i++) {
		T[i] = t[i];
	}
	sort(S, S + s.size());
	sort(T, T + t.size(), greater<int>());
	for (int i = 0; i < min(s.size(), t.size()); i++) {
		if (S[i] < T[i]) check = true;
		if (S[i] != T[i]) break;
	}
	if (s.size() < t.size()) {
		if (t.substr(0, s.size()) == s) check = true;
	}
	if (check) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

int main(){
	
	string s;cin>>s;
	
	if(s[0]=='9'||s[1]=='9') cout << "Yes"<<endl;
	else cout << "No" << endl; 
	
	return 0;
}

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

int main()
{
    int n,day,x,a[110],i,sum,j;
    cin>>n;
    cin>>day>>x;
    sum=0;
    for(i=1;i<=n;i++){
        cin>>a[i];
        j=1;
        while(a[i]*j+1<=day){
            sum=sum+1;j++;
        }
    }
    cout<<sum+n+x<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
      
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); i++)
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())

#define pb emplace_back
#define fi first
#define se second

using namespace std;

using ld = long double;
using ll = long long int;

const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ll MOD = 1e9+7;
     
template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> void UNIQUE(vector<T> &a){ a.erase(unique(a.begin(), a.end()), a.end()); }

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

ll in(){long long int x; scanf("%lld", &x); return x;}
ld fin(){double x; scanf("%lf", &x); return x;}
char yuyushiki[1000010]; string stin(){scanf( "%s", yuyushiki ); return yuyushiki;}

// head

ll dp[200010][4][3];

int main(){

  ll n = in();
  vector<ll> a(n);
  REP(i, n){
    a[i] = in();
  }

  REP(i, n+1){
    REP(j, 4){
      REP(k, 3){
        dp[i][j][k] = INFLL;
      }
    }
  }
  
  dp[0][0][0] = 0;
  
  REP(i, n){
    REP(j, 4){
      REP(k, 3){
        if(j == 3){
          chmin(dp[i+1][3][k], dp[i][j][k] + a[i]);
        } else {
          vector<ll> v = {0, a[i], a[i]+1, a[i]+2};
          YYS(l, v){
            if(l == 0){
              if(j == 0){
                chmin(dp[i+1][0][k], dp[i][j][k] + a[i]);
              } else {
                chmin(dp[i+1][3][k], dp[i][j][k] + a[i]);
              }
            } else {
              ll nj = l % 2;
              if(nj == 0){
                nj = 2;
              }
              ll nk = k + (j + l) % 2;
              if(nk <= 2){
                chmin(dp[i+1][nj][nk], dp[i][j][k] + abs(l - a[i]));
              }
            }
          }
        }
      }
    }
  }

  ll ans = INFLL;
  REP(j, 4){
    REP(k, 3){
      chmin(ans, dp[n][j][k]);
    }
  }


  cout << ans << endl;
  
  return 0;
}


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

int conv(int p, int h, int w){
	h %= 2*w;
	if(h==0) h=2*w;
	while(1){
		if((h+p)%2 == 0){
			if(h <= w-p){
				return p+h-1;
			}
			h -= w-p;
			p = w-1;
		}else{
			if(h <= p+1){
				return p-h+1;
			}
			h -= p+1;
			p = 0;
		}
	}
}

int main(){
	int h,w,n;
	cin >> h >> w >> n;
	vector<int> p(w),r(w),c(w);
	for(int i=0; i<w; i++){
		p[i] = conv(i, h+1, w);
		r[p[i]] = i;
		c[i] = i;
	}
	vector<pair<int, int> > s(n);
	for(int i=0; i<n; i++){
		int a,b;
		cin >> a >> b;
		s[i] = make_pair(a, b);
	}
	sort(s.begin(), s.end());
	for(int i=0; i<n; i++){
		int a = s[i].first;
		int b = s[i].second;
		int p1 = conv(b-1, a, w);
		int p2 = conv(b, a, w);
		swap(p[r[c[p1]]], p[r[c[p2]]]);
		swap(r[c[p1]], r[c[p2]]);
		swap(c[p1], c[p2]);
	}
	for(int i=0; i<w; i++){
		cout << r[i]+1 << endl;
	}
	return 0;
}


Measured memory_bytes: 6716
// "include" {{{
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <tuple>
// }}}
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int> 
#define int long long
#define setout(n,x) setw(n) << setfill(x)
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1000000007;

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,x;
	cin >> n >> x;
	vector<int> a(n);
	rep(i,n){
		cin >> a[i];
	}
	int sum = 0;
	rep(i,n-1){
		if(a[i] + a[i+1] <= x) continue;
		if(a[i] <= x){
			sum += (a[i] + a[i+1]) - x;
			a[i+1] -= (a[i] + a[i+1]) - x;
		}
		else {
			sum += a[i+1];
			a[i+1] = 0;
			sum += a[i] - x;
			a[i] -= a[i] - x;
		}
	}
	cout << sum << '\n';
	return 0;
}


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

using namespace std;

const int max_n = 222, inf = 1000111222;
const bool debug = false;

//string hid = "RRBBRB";//"RRRRRBBBBB"
string hid = "RRBBBRBRRB";
int n, Q;
char ans[max_n];

char query(const vector<int> &v) {
    ++Q;
    cout << "? ";
    for (int pos : v) {
        cout << pos + 1 << " ";
    }
    cout << endl;
    string res;
    if (debug) {
        int r = 0, b = 0;
        for (int pos : v) {
            r += hid[pos] == 'R';
            b += hid[pos] == 'B';
        }
        if (r > b) {
            res = "Red";
        } else {
            res = "Blue";
        }
        cout << res << endl;
    } else {
        cin >> res;
    }
    return res[0];
}

char query(int pos) {
    vector<int> v;
    for (int i = 0; i < n; ++i) {
        v.push_back(pos + i);
    }
    return query(v);
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    if (debug) {
        n = hid.length() / 2;
    } else {
        cin >> n;
    }
    char c = query(0);
    char rc = 'B';
    if (c == 'B') {
        rc = 'R';
    }
    int l = 0, r = n;
    while (r - l > 1) {
        int mid = (l + r) / 2;
        if (query(mid) == c) {
            l = mid;
        } else {
            r = mid;
        }
    }
    ans[l] = c;
    for (int i = 0; i < 2 * n; ++i) {
        vector<int> v;
        if (l <= i && i < l + n) {
            for (int j = 0; j < 2 * n; ++j) {
                if (l <= j && j <= l + n) {
                    continue;
                }
                v.push_back(j);
            }
            v.push_back(i);
            ans[i] = query(v);
        } else {
            for (int j = l + 1; j < l + n; ++j) {
                v.push_back(j);
            }
            v.push_back(i);
            ans[i] = query(v);
        }
    }
    string s = ans;
    cout << "! " << s << endl;
    if (debug) {
        cout << Q << endl;
        cout << (s == hid) << endl;
    }
    return 0;
}


Measured memory_bytes: 724
s = [int(i) for i in input().split(' ')]

n = [0] * 5

for i in s:
    if i == 5:
        n[0] += 1
    elif i == 7:
        n[1] += 1

if n[0] == 2 and n[1] == 1:
    print('YES')
else:
    print('NO')

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

using namespace std;

#define INF 1e9

int MOD=1e9+7;

long long func(int i,pair<pair<long long,long long>,long long> p){
    long long res;
    long long p1=p.first.first,p2=p.first.second,p3=p.second;

    if(i==0)res=p1+p2+p3;
    if(i==1)res=p1+p2-p3;
    if(i==2)res=p1-p2+p3;
    if(i==3)res=p1-p2-p3;
    if(i==4)res=-p1+p2+p3;
    if(i==5)res=-p1+p2-p3;
    if(i==6)res=-p1-p2+p3;
    if(i==7)res=-p1-p2-p3;

    return res;
}

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

    int n,m;

    cin>>n>>m;

    vector<pair<pair<long long,long long>,long long>> v(n);

    for(int i=0;i<n;i++){
        cin>>v[i].first.first>>v[i].first.second>>v[i].second;
    }

    long long ans=0;

    for(int i=0;i<8;i++){
        for(int j=0;j<n;j++){
            for(int k=0;k<n-j-1;k++){
                long long tmp1=func(i,v[k]),tmp2=func(i,v[k+1]);
                if(tmp1<tmp2){
                    pair<pair<long long,long long>,long long> tmp=v[k+1];
                    v[k+1]=v[k];
                    v[k]=tmp;
                }
            }
        }
        long long sum1=0,sum2=0,sum3=0;
        for(int j=0;j<m;j++){
            sum1+=v[j].first.first;
            sum2+=v[j].first.second;
            sum3+=v[j].second;
        }
        long long tmp=abs(sum1)+abs(sum2)+abs(sum3);
        ans=max(ans,tmp);
    }

    cout<<ans<<endl;
    
}

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

int main(){
  vector<int> N(3);
  int K;
  cin >> N.at(0) >> N.at(1) >> N.at(2) >> K;
  sort(N.begin(),N.end());
  for(int i=0; i<K; i++){
    N.at(2)*=2;
  }
  cout << N.at(0)+N.at(1)+N.at(2) << endl;
}

Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

ll gcd(ll a, ll b) {
    while (b) {
        ll c = a % b;
        a = b;
        b = c;
    }
    return a;
}

ll po(ll a, ll b) {
    ll c = 1;
    while (b) {
        if (b % 2) c = c * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return c;
}

ll f[2000006], g[2000006];

void comb() {
    f[0] = 1;
    for (int i = 1; i <= 2000000; i++) f[i] = f[i - 1] * i % mod;
    g[2000000] = 407182070;
    for (int i = 1999999; i >= 0; i--) g[i] = g[i + 1] * (i + 1) % mod;
}

int p[200005];

int root(int x) {return p[x] < 0 ? x : p[x] = root(p[x]);}

void mer(int x, int y) {
    if ((x = root(x)) == (y = root(y))) return;
    if (p[x] > p[y]) swap(x, y);
    p[x] += p[y];
    p[y] = x;
}

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    cout << n * n * n;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
struct edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int>>;
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define res resize
#define as assign
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));

typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 9223372036854775806ll;
const int mod = 1000000007ll;
const ll  MOD = 1000000007LL;
//-0.4620981203755741
int main(){
    std::vector<ll> a(3);
    rep(i,3)std::cin >> a[i];
    if((a[1]*a[0]*a[2])%2ll==1ll){
        sort(all(a));
        std::cout << a[0]*a[1] << std::endl;
    }
    else std::cout << 0 << std::endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

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

	int s1 = a * b;
	int s2 = c * d;
	cout << (s1 > s2 ? s1 : s2) << endl;
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

#define REP(k, n) for (ll k = 0; k < (ll)(n); ++k)
#define REPREV(k, n) for (ll k = (ll)(n)-1; k >= 0; --k)
#define FOR(k, a, b) for (ll k = (ll)(a); k < (ll)(b); ++k)
#define FORREV(k, a, b) for (ll k = (ll)(b)-1; k >= (ll)(a); --k)
#define FOREACH(e, v) for (auto& e : v)

#define TGET(t, i) get<i>(t)
#define TSET(t, i, a) get<i>(t) = a
// MinHeap - priority_queue<ll, vll, greater<ll>> pq;

#define EVEN(n) ((n)&1) == 0
#define ODD(n) ((n)&1) == 1

#define SORT(v) sort(v.begin(), v.end())
#define SORTREV(v) sort(v.rbegin(), v.rend())
#define SHUFFLE(v) random_shuffle(v.begin(), v.end())
//srand(unsigned(time(0)));

#define REMOVEAT(v, i) v.erase(v.begin() + i)
#define REVERSE(v) reverse(v.begin(), v.end())

ostream& operator<<(ostream& str, const pll& p) {
    str << p.first << " " << p.second;
    return str;
}

template <typename T>
void join(T& arr, string sep) {
    bool first = true;
    for (auto t : arr) {
        if (first) {
            first = false;
            cout << t;
        } else {
            cout << sep << t;
        }
    }
    cout << "\n";
}

const ll md = 1e9 + 7;
ll MOD(ll x) {
    ll r = x % md;
    if (r < 0) {
        r += md;
    }
    return r;
}

#define POS "POSSIBLE"
#define IMPOS "IMPOSSIBLE"

// #define INF LLONG_MAX
// #define MINF LLONG_MIN
#define INF 1e18
#define MINF -INF

void solve() {
    ll n, d;
    cin >> n >> d;
    d *= d;
    ll res = 0;
    REP(i, n) {
        ll x, y;
        cin >> x >> y;
        ll d2 = x*x + y*y;
        if (d2 <= d) {
            res++;
        }
    }

    // cout << fixed << setprecision(6);
    cout << res << "\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int tt = 1;
    // cin >> tt;
    for (int t = 1; t <= tt; t++) {
        // cout << "Case #" << t << ": ";
        solve();
    }
    //cin.rdbuf()->in_avail()
    return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
#include <iostream> 
#include <algorithm> 
#include<string>
#include<queue>
#include<utility>
#include<fstream>
#include<queue>
#include<set>
#include<stack>
//#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d",&a,&b)
#define I3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define L(a) scanf("%lld",&a)
#define L2(a,b) scanf("%lld%lld",&a,&b)
#define L3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define PI(a) printf("%d",a)
#define PL(a) printf("%lld",a)
#define PT(t) printf("Case %d: ",t)
#define PB push_back
#define x first
#define y second
#define xx first.first
#define xy first.second
#define yx second.first
#define yy second.second
#define SC scanf
#define PC printf
#define NL printf("\n")
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define SZ(a) ((int)a.size())-1
#define f(i,a,b) for(int i=a;i<=b; i++)
#define fr(i,a,b) for(int i=a;i<=b; i++)
#define frr(i,a,b) for(int i=a;i>=b; i--)
#define frv(i,a)  for(int i=0;i<a.size();i++)
#define pi 2.0*acos(0.0)
#define R(a) freopen(a, "r", stdin);
#define W(a) freopen(a, "w", stdout);
#define CB(x) __builtin_popcount(x)
#define STN(a) stringtonumber<ll>(a)
#define lol printf("BUG\n")
#define Endl "\n"
#define mk make_pair
using namespace std;
template <class T> inline T BM(T p, T e, T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
 
 
template <class T>bool ISLEFT(T a, T b, T c)
{
    if(((a.xx - b.xx) * (b.yy - c.yy) - (b.xx - c.xx) * (a.yy - b.yy)) < 0.0)return 1;  //Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}
 
 
typedef pair<int,int >P;
//////////////////////////
/////////////////////////

int main(){

    ll n,k;
    L2(n,k);
    cout<<((n+k-1)/k)<<endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace A
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var AB = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            Console.WriteLine(Math.Ceiling(((double)AB[0] + AB[1]) / 2));
        }
    }
}


Measured memory_bytes: 28168
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;

int main(){
    int l,r;cin>>l>>r;
    int m=2019;
    for(int i=l;i<r&&i<2019+l;i++){
        for(int j=i+1;j<=r&&j<2020+i;j++){
            m=min(m,((i%2019)*(j%2019))%2019);
        }
    }
    cout<<m<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <cmath>

using namespace std;
typedef tuple<int, int> tii;

inline int pow2(int x){ return x * x; }

int main(){
	ios_base::sync_with_stdio(false);
	cout << setiosflags(ios::fixed) << setprecision(10);
	int n;
	cin >> n;
	vector<int> f(n), a(n), t(n), x(n), y(n);
	for(int i = 0; i < n; ++i){
		cin >> f[i] >> a[i] >> t[i] >> x[i] >> y[i];
	}
	tii answer[2];
	answer[0] = answer[1] = tii(-1, -1);
	for(int i = 1; i < n; ++i){
		if(t[i - 1] != t[i] || a[i - 1] == a[i]){ continue; }
		tii tt(pow2(x[i] - x[i - 1]) + pow2(y[i] - y[i - 1]), f[i - 1] - f[i]);
		answer[t[i]] = max(answer[t[i]], tt);
	}
	for(int i = 0; i < 2; ++i){
		if(get<0>(answer[i]) < 0){
			cout << "-1 -1" << endl;
		}else{
			cout << sqrt(get<0>(answer[i])) << " " << get<1>(answer[i]) / -60.0 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1280
#include<stdio.h>

int main(void){
    int r,D,a,b;
    int i;
    scanf("%d %d %d",&r,&D,&a);
    for(i = 0;i < 10;i++){
        b = r*a - D;
        printf("%d\n",b);
        a = b;
    }
    return 0;
}

Measured memory_bytes: 128
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))

min = abs((t - h[0] * 0.006) - a)
mini = 0

for i in range(1,len(h)):
    tmp = abs((t - h[i] * 0.006) - a)

    if tmp < min :
        min = tmp
        mini = i     
        
print(mini+1)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long int
#define __ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi acos(-1)
using namespace std;


int main()
{
__

int n,ans=0;

cin >> n;

int b[n];

for(int i=0;i<n-1;i++) cin >> b[i];

ans+= b[0]+b[n-2];

for(int i=0;i<n-2;i++)
{
ans+= min(b[i],b[i+1]);
}

cout << ans << '\n';

return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <math.h>
#include<algorithm>
#include <utility>
using namespace std;
int main() {//Thursda,Friday...0,1,2,3,4,5,6
	int month,day, today;//31%7=3
	int add=0;
	while (1) {
		cin >> month >> today;
		if (month == 0) {
			break;
		}
		if (month == 1) {
			add = 0;
		}
		else {
			for (int i = 1; i < month; i++) {
				if (i == 2) {
					add+=1;
				}
				else if ((i % 2 == 0 && i < 8) ||i==9|| i == 11 ) {
					add += 2;
				}
				else {//31??\
					add += 3;
				}
			}
		}
		today += add;
		day = today%7;
		switch (day) {
		case 1:cout << "Thursday" << endl; break;
		case 2:cout << "Friday" << endl; break;
		case 3:cout << "Saturday" << endl; break;
		case 4:cout << "Sunday" << endl; break;
		case 5:cout << "Monday" << endl; break;
		case 6:cout << "Tuesday" << endl; break;
		case 0:cout << "Wednesday" << endl; break;
		}
		add = 0;
	}
	return 0;
}

Measured memory_bytes: 3068
N = int(input())
sdic={}
for i in range(N):
  s = input()
  if s in sdic:
    sdic[s] += 1
  else:
    sdic[s] = 1
maxi = max(sdic.values())
anslist = [k for k, v in sdic.items() if v == maxi]
anslist.sort()
for ans in anslist:
  print(ans)

Measured memory_bytes: 32096
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

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

Measured memory_bytes: 3684
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long int i,n,k;
cin>>n;
long long int a[n];
cin>>a[0];
k=a[0];
for(i=1;i<n;i++)
{
cin>>a[i];
k=(k^a[i]);
}
for(i=0;i<n;i++)
{
cout<<(k^a[i])<<" ";
}
cout<<endl;

}


Measured memory_bytes: 5160
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    in_arr(int, a, n);
    cout << accumulate(a.begin(), a.end(), 0, [](int i, int j){ return i + j - 1;}) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c;cin>>a>>b>>c;
  	int q = b+c;
	int ans = 0;
  	ans += 2*min(b,c);
  	//cout<<ans<<"\n";
  	int m = min(b,c);
  	c-=m;
  	b-=m;
  	ans += min(a,c);
  	//cout<<ans<<"\n";
  	if(c>a) ans++;
  	//cout<<ans<<"\n";
  	ans += b;
  	//cout<<b<<" "<<ans<<"\n";
  	cout<<ans;
}

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

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int N, K;
  cin >> N >> K;
  if (N % K) cout << 1 << endl;
  else cout << 0 << endl;
  
  return 0;
}


Measured memory_bytes: 256