akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define LOOP(i) while(i--)
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	double d;
	while(cin>>d){
		vector<double> S(10);
		S[0] = d;
		for(int i=1;i<10;i++){
			if((i%2)) S[i] = S[i-1]*2.0;
			else S[i]=S[i-1]/3.0;
		}
		printf("%.10lf\n",accumulate(ALL(S),0.0));
	}

	return 0;
}


Measured memory_bytes: 3200
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace NotFounds
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Program().Solve(new ConsoleInput(Console.In, ' '));
            Console.Out.Flush();
        }

        public void Solve(ConsoleInput cin)
        {
            var sx = cin.ReadInt;
            var sy = cin.ReadInt;
            var tx = cin.ReadInt;
            var ty = cin.ReadInt;

            var dx = tx - sx;
            var dy = ty - sy;

            Write(new string('R', dx) + new string('U', dy));
            Write(new string('L', dx) + new string('D', dy));
            Write('D' + new string('R', dx + 1) + new string('U', dy + 1) + 'L');
            Write('U' + new string('L', dx + 1) + new string('D', dy + 1) + 'R');
            WriteLine();
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
        public void ReadIntArrays(long N, out int[] A, out int[] B) { A = new int[N]; B = new int[N]; for (long i = 0; i < N; ++i) { A[i] = ReadInt; B[i] = ReadInt; }}
    }
}


Measured memory_bytes: 11308
#include<iostream>
#include<string>
#include<cmath>

using std::cout;
using std::cin;
using std::endl;
using std::pow;
using std::string;

int main(){
    long long int a,out,c;
    double b;
    cin >> a >> b;
    c = b*100 + 1e-9;
    out = a*c/100;
    cout << out;
}

Measured memory_bytes: 3684
n = int(input())
lst = []
pair = 0
for i in range(n):
	st = ''.join(sorted(list(input())))
	lst.append(st)
lst = sorted(lst)
lst += ['end']
pre = ''
tmp_cnt = 0
cnt = 0
for i in lst:
	if i == pre:
		tmp_cnt += 1
	else:
		cnt += sum([j for j in range(tmp_cnt + 1)])
		tmp_cnt = 0
	pre = i
print (cnt)

Measured memory_bytes: 13992
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
c = Counter(a)

ans = 0
for i in a:
    if c[i] == 0:
        continue
    c[i] -= 1
    k = 1<<i.bit_length()
    j = k-i
    if j in c and c[j] > 0:
        ans += 1
        c[j] -= 1
print(ans)


Measured memory_bytes: 33344
/* Author VS_CODE */

#include<bits/stdc++.h>
#define int long long
#define TCI int t;cin>>t;while(t--)
#define run(n) for(int i=1;i<=n;i++)
#define cinl(n) for(int i=0;i<n;i++)
#define ln "\n"
#define vpair vector< pair <int , int > >
#define fr first
#define sc second
#define pb emplace_back
#define vll vector<int>
#define inf 0x3f3f3f3f3f3f3f3fLL
#define Point complex<double>
using namespace std;

void online()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
/* CODE STARTS HERE */

template<typename T>
void debug(T x)
{
	cout<<x<<ln;
}

const int N = 1e5;

void solve()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	int cnt=0,cnt1=0;
	for(int i=0;i<n;i++)
	{
		if(s[i]=='W')
			cnt++;
		else
			cnt1++;
	}
	if(cnt==n or cnt1==n)
		cout<<0;
	else
	if(cnt==cnt1)
	{
		int x=0;
		for(int i=0;i<cnt;i++)
		{
			if(s[i]=='W')
				x++;
		}
		cout<<x;
	}
	else
	if(cnt>cnt1)
	{
		int x=0;
		for(int i=0;i<cnt1;i++)
		{
			if(s[i]=='W')
				x++;
		}
		cout<<x;
	}
	else
	{
		int x=0;
		for(int i=n-1;i>=cnt1;i--)
		{
			if(s[i]=='R')
				x++;
		}
		cout<<x;
	}
}


/* CODE ENDS HERE AND MAIN STARTS */

int32_t main()
{

	online();
	//TCI
	solve();
}

Measured memory_bytes: 3764
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>
#include <cstring>

using namespace std;

typedef pair<int, int> P;
#define mp make_pair
#define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i))
#define rep(i, n)  FOR(i,0,n)
#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 all(c) (c).begin(),(c).end()
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define F first
#define S second
#define pb push_back
#define mod 1000000007LL
#define INF 1234567890

const int maxn = 2e5 + 10;


//initialization here
//
ll a[maxn];

//
//initialization finish


// your function is here
//



//
// your function finished



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

	// your code is here
	//
	
	int n; cin >> n;
	ll x; cin >> x;
	ll ans = 0;

	rep(i, n)
	{
		cin >> a[i];
		if (a[i] > x)
		{
			ans += a[i] - x;
			a[i] = x;
		}

		if (i == 0) continue;
		else if (a[i] + a[i - 1] > x)
		{
			ll yozyo = a[i] + a[i - 1] - x;
			ans += yozyo;
			if (yozyo < a[i])
			{
				a[i] = a[i] - yozyo;
			}
			else {
				a[i] = 0;
			}
		}
	}
	
	Print(ans);

	//
	// your code finished

	return 0;
}

Measured memory_bytes: 1024
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h> //STL include
typedef long long ll;// long long int
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;//namespace
 
#define dump(x)  cout << #x << " = " << (x) << endl;// debug cout
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;
 
#define SANKOU(n,a,b) cout << ((n) ? (a) : (b) ) << endl;
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)// for macro
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j]);// warshall-floyd
 
#define CIN(x) int x;cin>>x;
#define CIN2(x,y) int x,y;cin>>x>>y;
#define CIN3(x,y,z) int x,y,z;cin>>x>>y>>z;
#define SCIN(x) string x;cin>>x;
#define SCIN2(x,y) string x,y;cin>>x>>y;
#define COUT(x) cout<<(x)<<endl;
#define SCOUT(x) cout<<(x)<<" ";
#define ENDL cout<<endl;
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_;
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i];
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl;
 
#define ALL(obj) (obj).begin(),(obj).end()// iterator
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
 
 
#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define L list<int>
 
#define pb(a) push_back(a)//push_back
#define mp make_pair// make_pair
 
 
int main(){
 
    CIN(n);V a(n);VECCIN(a);
    map<int,int> map_;
    REP(i,n)map_[a[i]]++;
    ll ans=0;
    FOREACH(x,map_)ans+=(x.second%2==0?0:1);
    COUT(ans);
 
 
    return 0;
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
int A,B,C,D,k;
bool pd(int x){
	if(x==0) return 1;
	if(x%(k+1)==0) x--;
	int cntB=x/(k+1),cntA=x-cntB;
	if((A-cntA+1)*(long long)k>=B-cntB)
		return 1;
	return 0;
}
int main(){
//	freopen("D.in","r",stdin);
	int T;
	scanf("%d",&T);
	while(T--){
		scanf("%d%d%d%d",&A,&B,&C,&D);
		if(A>B) k=(A-1)/(B+1)+1;
		else k=(B-1)/(A+1)+1;
		int l=0,r=A+B,mid;
		while(r-l>1){
			mid=(l+r)>>1;
			if(pd(mid)) l=mid;
			else r=mid;
		}
		if(pd(r)) l=r;
		for(int i=C;i<=D;i++){
			if(i<=l){
				if(i%(k+1)==0) printf("B");
				else printf("A");
			}
			else{
				if((A+B+1-i)%(k+1)==0) printf("A");
				else printf("B");
			}
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define to edge[i].v
#define mp make_pair
#define rint register int
#define debug(x) cerr<<#x<<"="<<x<<endl
#define fgx cerr<<"-------------"<<endl
#define N 3000000
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
int go0[N],go1[N],f[N][25];
char c[2000000];
inline void pr(int x){for(rint i=go1[x]-1;i>=0;i--) cerr<<((x&(1<<i))?"1":"0");}
int main()
{	int n,K,maxn=0,ans=1; scanf("%d%d",&n,&K);
	for(rint s=0;s<(1<<n+1);s++)
	{	go0[s]=go1[s]=-1;
		for(rint i=n,tag=0;i>=0;i--) if(s&(1<<i)) tag=1; else if(tag){go0[s]=i;break;}
		for(rint i=n;i>=0;i--) if(s&(1<<i)){go1[s]=i;break;}
	}
	for(rint i=0;i<=n;i++)
	{	scanf("%s",c);
		for(rint s=0;s<(1<<i);s++) f[s+(1<<i)][i]=(c[s]=='1');
	}
	for(rint i=n;i>0;i--)
	for(rint s=0;s<(1<<n+1);s++)
	if(f[s][i])
	{	int l=s>>i,r=s&((1<<i)-1),R=r|(1<<i); f[l][0]+=f[s][i]; if(!l) debug(s);
		if(go0[R]!=-1) f[(s&((1<<go0[R]+1)-1))|(l<<(go0[R]+1))][go0[R]]+=f[s][i];
		if(go1[r]!=-1) f[(s&((1<<go1[r]+1)-1))|(l<<(go1[r]+1))][go1[r]]+=f[s][i];
	}
	for(rint s=0;s<(1<<n+1);s++) if(f[s][0]>=K&&go1[s]>maxn) maxn=go1[s],ans=s;
	for(rint i=go1[ans]-1;i>=0;i--) printf((ans&(1<<i))?"1":"0");
	return 0;
}

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

int main() {
  int N;
  cin >> N ;
  bool a;
  
  string s;
 
  for (int i=0; i < N; i++){
    cin >> s;
    if (s == "Y"){
     cout << "Four"<<endl;
       a= false;
      break;
    }
    else if (s != "Y"){
      a=true;
  }
  
  
}
  if (a){
     cout << "Three"<<endl;
  }
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void)
{
	char a[11],b[11],c[11],x,y,z;
	scanf("%s %s %s",a,b,c);
	x=strlen(a);
	y=strlen(b);
	z=strlen(c);
	if(a[x-1]==b[0]&&b[y-1]==c[0]) printf("YES\n");
	else printf("NO\n");
	return 0;
}


Measured memory_bytes: 1664
n, m = input().split()
n = int(n)
m = int(m)
results = []
for i in range(m):
    results.append(list(input().split()))

wa = 0
ac = 0

dic = {}
for q, a in results:
    if q not in dic.keys():
        dic[q] = {"ac": False, "wa": 0}
    if dic[q]["ac"] is True:
        pass
    elif dic[q]["ac"] is False and a == "WA":
        dic[q]["wa"] += 1
    elif dic[q]["ac"] is False and a == "AC":
        ac += 1
        dic[q]["ac"] = True
for x in dic.keys():
    if dic[x]["ac"] is True:
        wa += dic[x]["wa"]

print(ac, wa)

Measured memory_bytes: 61796
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n, q; cin >> n >> q;
  V<> a(n); for (int i = 0; i < n; ++i) cin >> a[i];
  V<lint> c(n + 1);
  for (int i = 0; i < n; ++i) c[i + 1] = c[i] + a[i];
  for (int i = 0; i < q; ++i) {
    lint x; cin >> x;
    lint res = 0;
    int r = 0;
    for (int l = 0; l < n; ++l) {
      while (r < n + 1 and c[r] - c[l] <= x) ++r;
      res += max(r - l - 1, 0);
    }
    cout << res << '\n';
  }
}


Measured memory_bytes: 4120
#include <stdio.h>

int main(){

	int k, a, b;
	scanf("%d", &k);
	scanf("%d %d", &a, &b);
	int flag = 0;
	    
	for(int i=a; i<=b; i++){
		
		if ( i % k == 0){
		flag = 1;	
		break;
	
}
}
flag? printf("OK\n") : printf("NG\n");
	

	return 0;
}



Measured memory_bytes: 1656
#include<iostream>
#include<vector>
#define _USE_MATH_DEFINES
#include<math.h>
#include<algorithm>
#include<memory>
#include<string>
#define Rep(i,n) for(int i = 0;i < (n);i++)	
typedef long long ll;

int gcd(int a, int b) { if (b == 0)  return a;  else  return gcd(b, a % b);  }
int lcm(int a, int b) { return a * b / gcd(a, b); }
void swap(int& a, int& b) { int temp = a; a = b; b = temp; return; }
int ncr(int n, int r) { int a = 1; Rep(i, r) a = (a * (n - i)) / (i + 1); return a; }
int npr(int n, int r) { int a = 1; Rep(i, r) a *= n - i; return a; }
int mod(int a, int b) { return a % b; }




int main() {
	long double a, b, x,n;
	std::cin >> a >> b >> n;
	ll ans;
	if (b > n) {
		ans = n / b * a;
	}
	else {
		ans = (b - 1) / b * a;
	}
	std::cout << ans << std::endl;
	return 0;
}

Measured memory_bytes: 3684
a,b,m=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=10**6
for i in range(m):
  x,y,c=map(int,input().split())
  ans=min(ans,a[x-1]+b[y-1]-c)
print(min(ans,min(a)+min(b)))

Measured memory_bytes: 97516
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;

const int N = 1e3 + 5;
const int Inf = 1e9;

int n, m;
pair<int, int> src, dst;
string s[N];
int vis[N][N];
int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, -1, 1};

bool good(int nx, int ny) {
  return nx >= 0 && nx < n && ny >= 0 && ny < m;
}

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

  cin >> n >> m;
  cin >> src.first >> src.second >> dst.first >> dst.second;
  src.first--;
  src.second--;
  dst.first--;
  dst.second--;
  for(int i = 0; i < n; i++)
    cin >> s[i];
  
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < m; j++) {
      vis[i][j] = Inf;
    }
  }

  deque<pair<int, int>> q;
  q.push_back(src);
  vis[src.first][src.second] = 0;

  while(q.empty() == false) {
    int x = q.front().first;
    int y = q.front().second;
    q.pop_front();

    for(int k = 0; k < 4; k++) {
      int nx = x + dx[k];
      int ny = y + dy[k];
      if(good(nx, ny) && s[nx][ny] == '.' && vis[nx][ny] > vis[x][y]) {
        vis[nx][ny] = vis[x][y];
        q.push_front({nx, ny});
      }
    }

    for(int dx = -2; dx <= 2; dx++) {
      for(int dy = -2; dy <= 2; dy++) {
        int nx = dx + x;
        int ny = dy + y;
        if(good(nx, ny) && s[nx][ny] == '.' && vis[nx][ny] > vis[x][y] + 1) {
          vis[nx][ny] = 1 + vis[x][y];
          q.push_back({nx, ny});
        }
      }
    }
  }

  for(int i = 0; i <n ; i++) {
    for(int j = 0; j < m ;j++) {
      if(vis[i][j] == Inf)
        vis[i][j] = -1;
    }
  }

  cout << vis[dst.first][dst.second] << endl;
  return 0;
}


Measured memory_bytes: 8692
#include<bits/stdc++.h>
using namespace std;
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	string a;
	cin>>a;
	cout<<a.substr(0,3)<<"\n";


	


 
	
	
	
	
	return 0;
}

Measured memory_bytes: 3572
import sys

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

K = int(input())
S = list(input())

L = len(S)

if L <= K:
    pass
else:
    S = S[:K]
    S.append("...")

print("".join(S))


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

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

    long long int m;
    cin >> m;

    long long int ans = (long long) (1000*(m/500));
    m = m - 500*(m/500);
    m = m/5;
    ans +=(long long) 5*m;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
N,L = map(int,input().split())
val = []
for i in range(N):
    val.append(L+i)

a  = sum(val)
p = 10**9+7
for i in range(N):
    if abs(val[i]) < p :
        p = abs(val[i])
        q = val[i]
print(a-q)

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

#define ll              long long int
#define pb              push_back
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define fast_io         ios_base::sync_with_stdio(false); cin.tie(NULL);


int main(){
    fast_io;
    
    int n,k;
    cin >> n >> k;

    vector<int> v(n);

    for(int i=0; i<n; i++){
    	cin >> v[i];
    }   
    
    vector<vector<bool>> dp(k+2, vector<bool>(2, false));

    // base case
    dp[0][0] = false;
    dp[0][1] = true;

    for(int i=1; i<=k ;i++){
    	// find for dp[i][0]
    	bool ans = false;
    	for(int j=0; j<n; j++){
    		if((i-v[j] >= 0)){
    			ans = dp[i-v[j]][1];
    			if(ans == true){
    				break;
    			}
    		}
    	}

    	dp[i][0] = ans;
    	dp[i][1] = (!ans);
    }

    // for(int i=0; i<=k ;i++){
    // 	cout<<"K: "<<i<<" -> "<<dp[i][0]<<"  "<<dp[i][1]<<endl;
    // }

    if(dp[k][0] == true){
    	cout<<"First\n";
    }
    else{
    	cout<<"Second\n";
    }
    
	return 0;
}

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

int main ()
{
    int h, w;
    do
    {
        cin >> h >> w;
        for (int i = 0, s = 1;i < h;i++, s = -s)
        {
            for (int j = 0, s2 = s;j < w;j++, s2 = -s2)
            {
                if (s2 < 0) cout << ".";
                else cout << "#";
            }
            cout << endl;
        }
        if (!(h == 0 && w == 0))cout << endl;
    }while(!(h == 0 && w == 0));
    
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;

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

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    int n = s.length();
    if(check(s) and check(s.substr(0, n/2)) and check(s.substr((n+3)/2-1, n/2))){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


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



int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++)
	{
		cin >> a[i];
	}

	for(int i = n-1; i >= 0; i-=2)
	{
		cout << a[i] << ' ';
	}
	for(int i = n%2; i < n; i+=2)
	{
		cout << a[i] << ' ';
	}
	
	

	return 0;
}

Measured memory_bytes: 2944
#[allow(dead_code)]
pub const M: u64 = 1_000_000_007;

fn main() {
    use std::io::Read;
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    
    let h: usize = iter.next().unwrap().parse().unwrap();
    let w: usize = iter.next().unwrap().parse().unwrap();
    let k: usize = iter.next().unwrap().parse::<usize>().unwrap() - 1;
    
    
    // dp[x][k] = x-1までの高さでkに出る通り
    let mut dp = vec![vec![0;w];h+1];
    dp[0][0] = 1u64;
    for y in 0..h {
        for ptn in 0..(1<<(w-1)) {
            let mut incorrect = false;
            if w >= 2 {
                for k in 0..w-2 {
                    if ((ptn >> k) & 1) == 1 && ((ptn >> (k+1)) & 1) == 1 {
                        incorrect = true;
                        break;
                    }
                }
            }
            if incorrect {continue;}

            for x in 0..w {
                let mut x2 = x;
                if ((ptn >> x) & 1) == 1 {
                    x2 += 1;
                } else if x>=1 && ((ptn >> (x-1)) & 1) == 1 {
                    x2 -= 1;
                }
                dp[y+1][x2] += dp[y][x];
                dp[y+1][x2] %= M;
            }
        }
    }
    println!("{}", dp[h][k]);
}


Measured memory_bytes: 4352
import java.util.*;

class Main{
	
    public static void main(String[] args){

	Scanner sc = new Scanner(System.in);

	int X = sc.nextInt();

	int A = sc.nextInt();

	if(X<A){

	System.out.println("0");

   }	

	else{

	System.out.println("10");

   }

  }
 }

Measured memory_bytes: 21844
def ten_baisu(n):
    while n % 10 != 0:
        n += 1
    return n


lst = [int(input()) for i in range(5)]

lst_2 = [i % 10 for i in lst]

num = 10
idx = 0
for i in range(5):
    if lst_2[i] < num and lst_2[i] != 0:
        num = lst_2[i]
        idx = i

ans = 0
for i in range(5):
    if i == idx:
        continue
    ans += ten_baisu(lst[i])

print(ans + lst[idx])

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

int main(void){
  int N;
  cin >> N;
  
  int isOK,isNG,mid;
  string A;
  
  cout << "0" << endl;
  fflush(stdout);
  cin >> A;
  if(A=="Male")
    isOK = 0;
  else if(A=="Female")
    isNG = 0;
  else
    return 0;
  
  cout << N-1 << endl;
  fflush(stdout);
  cin >> A;
  if(A=="Male")
    isOK = N-1;
  else if(A=="Female")
    isNG = N-1;
  else
    return N-1;
  
  while(true){
    mid = (isOK+isNG)/2;
    cout << mid << endl;
    fflush(stdout);
    cin >> A;
    if((A=="Male"&&mid%2==0)||(A=="Female"&&mid%2==1))
      isOK = mid;
    else if((A=="Male"&&mid%2==1)||(A=="Female"&&mid%2==0))
      isNG = mid;
    else
      return mid;
  }
}


Measured memory_bytes: 852
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=998244353;
int main(){
    ll n;cin>>n;
    ll m;cin>>m;
    vector<ll>f(m+1);
    rep(i,m){
        cin>>f[i+1];
    }
    vector<ll>s(n+1);
    rep(i,m){
        ll x=0;
        rep(j,n){
            ll c;
            cin>>c;
            if(c==f[i+1])s[j+1]++;
            if(c!=f[i+1])x++;
        }
        s[f[i+1]]+=x;
    }
    rep(i,n){
        cout<<s[i+1]<<endl;
    }
}


Measured memory_bytes: 3124
#include <stdio.h>
#include <stdlib.h>

int main(void){
    int n, i;
    scanf("%d", &n);
    double x[n], ans = 0;
    char u[n][10];
    for(i=0; i<n; i++) scanf("%lf %s", &x[i], u[i]);
    for(i=0; i<n; i++){
        if(u[i][0] == 'J') ans += x[i];
        if(u[i][0] == 'B') ans += x[i]*380000;
    }
    printf("%lf", ans);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
string s[100005];

char aa[400005];
struct node{
    int sz,ind;
    bool isend;
    node* a[26];
    node(){
        sz=ind=0;
        isend=0;
        for(int i=0;i<26;++i)a[i]=this;
    }
    void insrt(int i,int j=0){
        ++sz;
        ind=j;
        if(s[i].size()==j){
            isend=1;
            return;
        }
        int c=s[i][j]-'a';
        if(a[c]==this)a[c]=new node;
        a[c]->insrt(i,j+1);
    }
    bool need(){
        int x=isend;
        for(int i=0;i<26;++i)x+=(a[i]!=this);
        return x==1;
    }
    node *nxt(){
        if(isend)return this;
        for(int i=0;i<26;++i)if(a[i]!=this)return a[i];
    }
    void reduce()
    {
        for(int i=0;i<26;++i){
            if(a[i]==this)continue;
            a[i]->reduce();
            if(a[i]->need())a[i]=a[i]->nxt();
        }
    }
    void dfs()
    {
        cout<<sz<<" "<<ind<<endl;
        for(int i=0;i<26;++i){
            if(a[i]==this)continue;
            cout<<char('a'+i)<<" ";
            a[i]->dfs();
            cout<<endl<<endl;
        }
    }
    int query(int i){
        if(s[i].size()<=ind)return 1;
        int ret=isend;
        for(int j=0;j<26;++j){
            int c=aa[j]-'a';
            if(aa[j]==s[i][ind])return ret+a[c]->query(i);
            if(a[c]!=this)ret+=a[c]->sz;
        }
        return ret;
    }
}*root;

int main()
{
    int n;
    cin>>n;
    root =new node;
    for(int i=1;i<=n;++i){
        scanf("%s",aa);
        s[i]=aa;
        root->insrt(i,0);
    }
    root->reduce();
    int q;
//    root->dfs();
    cin>>q;
    int x;
    while(q--){
        scanf("%d %s",&x,aa);
        printf("%d\n",root->query(x));
    }
}


Measured memory_bytes: 108928
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
ll MAX(ll a,ll b,ll c){return max(a,max(b,c));}
ll MIN(ll a,ll b,ll c){return min(a,min(b,c));}
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
ll INF = 150000000;
int main(){
    int n;
    cin >> n;
    vector<int> num(n);
    rep(i,n) cin >> num[i];
    sort(num.begin(),num.end());
    ll res = INF;
    for(int i = 0;i <= 100;i++){
        ll sum = 0;
        rep(x,n){
            sum += pow(i - num[x],2);
        }
        chmin(res,sum);
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<unsigned long long int>;

void PrintVec(VI& v) {
    for (Int i = 0; i < v.size(); ++i) {
        cout << v[i] << endl;
    }
    return;
}

int main(void) {
    VI num;
    VI v(100001);
    v[1] = 1;
    num.push_back(1);
    Int six = 6;
    while(six <= 100000) {
        v[six] = 1;
        num.push_back(six);
        six *= 6;
    }
    Int nine = 9;
    while(nine <= 100000) {
        v[nine] = 1;
        num.push_back(nine);
        nine *= 9;
    }
    sort(num.begin(), num.end());
    for (Int i = 2; i <= 100000; ++i) {
        v[i] = INT_MAX;
        bool exist = false;
        for (Int j = 0; j < num.size(); ++j) {
            if (i == num[j]) {
                exist = true;
            }
        }
        if (exist == true) {
            v[i] = 1;
        } else {
            for (Int j = 0; j < num.size(); ++j) {
                if (num[j] < i) {
                    v[i] = min(v[i], v[i - num[j]] + 1);
                }
            }
        }
    }
    Int n;
    cin >> n;
    cout << v[n] << endl;
    return 0;
}



Measured memory_bytes: 3852
#include<iostream>
using namespace std;
int main (void)
{
	long N, A, B;
	cin >> N >> A >> B;
	long loops = N / (A + B);
	long residue = N % (A + B);
	if (residue <= A)
	{
		cout << loops * A + residue << endl;
		return 0;
	}
	cout << (loops + 1) * A << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

//#define DEBUG

int main(void){
  char buf[512] = { 0 };
  int N;
  int A[2][100] = { { 0 } };
  char *tok = NULL;
  
  //N読み込み
  fgets(buf, sizeof(buf), stdin);
  sscanf(buf, "%d", &N);
  
  // 配列読み込み
  for(int i = 0; i < 2; i++){
    memset(buf, 0, sizeof(buf));
    fgets(buf, sizeof(buf), stdin);
    
    tok = strtok(buf, " ");
    for(int j = 0; j < N; j++){
      A[i][j] = atoi(tok);
      tok = strtok(NULL, " ");
    }
  }
 
#ifdef DEBUG
  //配列debug
  for(int i = 0; i < 2; i++){
    for(int j = 0; j < N; j++){
      printf("%d ", A[i][j]);
    }
    printf("\n");
  }
#endif
  
  int max_sum = -1;
  for(int j = 0; j < N; j++){
    int sum_tmp = 0;
    int j_tmp = 0;    
    for(j_tmp = 0; j_tmp <= j; j_tmp++){
      sum_tmp += A[0][j_tmp];
    }
    
    sum_tmp += A[1][j_tmp - 1];
    
    for(; j_tmp < N; j_tmp++){
      sum_tmp += A[1][j_tmp];
    }
    if(max_sum < sum_tmp) max_sum = sum_tmp;
  }
  
  printf("%d\n", max_sum);
  
  return 0;
}

Measured memory_bytes: 1708
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

ll N, K, T, W, H, M, C;

const int MAX = 5100000;
const ll MOD = 1e9 + 7;

const double PI=3.14159265358979323846;


long long fac[MAX], finv[MAX], inv[MAX];

vector<double> cx, cy, c;
 ll MM = 1e12;

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

std::vector<int> Eratosthenes(int n ){
    std::vector<bool> is_prime( n + 1 );
    for( int i = 0; i <= n; i++ ) is_prime[ i ] = true;
    std::vector<int> P;
    for( int i = 2; i <= n; i++ ){
        if( is_prime[ i ] ){
            for( int j = 2 * i; j <= n; j += i ){
                is_prime[ j ] = false;
            }
            P.emplace_back( i );
        }
    }
    return P;
}

ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

ll lcm(ll a, ll b)
{
   return a * b / gcd(a, b);
}

  /*
int main(){
    string str;
    cin >> str;
    N = str.size();
    int sub = 0;
    int p10 = 1;
    vector<int> v(2019, 0);
    for(int i = N-1; i >= 0; --i){
        sub = (sub + (str[i] - '0')*p10) % 2019;
        ++v[sub];
        p10 = (p10 * 10) % 2019;
    }
    ll ans = 0;
    for(auto u:v) ans += u*(u-1)/2;
    if(v[0] == 1) ++ans;
    cout << ans;
    return 0;
}
*/
int main(){
    int a,b;
    cin>> a >> b;
    if(b >= a) cout << "unsafe";
    else cout << "safe";
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ll long long
#define ld long double
#define zeros(x) x^(x-1)&x
#define pii pair<ll,ll>
#define cd complex<double>
#define dbg(x) cerr<<#x<<": "<<x<<endl;ll
#define Nmax 400005
#define OFF 100001
#define MOD 1000000007
using namespace std;

ll n, s, v[Nmax], d[Nmax], x, nr;

int main()
{
    cin >> n;
    for (int i=1;i<=n;i++){
        cin >> x;
        nr += x%2;
    }
    if (nr % 2) cout << "NO\n";
    else cout << "YES\n";

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>
#include<bitset>

#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000

using namespace std;


int main(void) {
	
	string s;
	int count = 0;

	cin >> s;

	FOR(i, 0, 2) {
		if (s[i] == '1') {
			count++;
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
s = list(input())
t = s
S = s+ ['0']
T = t+ ['1']
answ = 0
ansb = 0

for i in range(len(s)):
  if S[i] == '0' and S[i-1] == '0':
    S[i] = '1'
    answ += 1
  elif S[i] == '1' and S[i-1] == '1':
    S[i] = '0'
    answ += 1
    
  if T[i] == '1' and T[i-1] == '1':
    T[i] = '0'
    ansb += 1
  elif T[i] == '0' and T[i-1] == '0':
    T[i] = '1'
    ansb += 1
    
print(min(ansb,answ))

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

using namespace std;
#define BUF (100005)
#define ll long long 

int n;
ll sum;
ll a[BUF];
int main(void){
	cin >> n;
	for(int i=1;i<=n;i++){
		cin >> a[i];
		sum+=abs(a[i]-a[i-1]);
	}
	a[n+1]=0;
	sum+=abs(a[n]-a[n+1]);

	for(int i=1;i<=n;i++){
		ll d,b,c;
		d=abs(a[i]-a[i-1]);
		b=abs(a[i+1]-a[i]);
		c=abs(a[i+1]-a[i-1]);
		cout << sum-d-b+c << "\n";
	}
	return 0;
}


Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int i = 0; i < N; i++)
#define all(v) v.begin(), v.end()
#define eb emplace_back
#define Cout(s) cout << s << endl
string Yes(bool b) {if(b){return "Yes";} else {return "No";}}
string YES(bool b) {if(b){return "YES";} else {return "NO";}}

int main(){
    i64 K;
    cin >> K;

    i64 ans = 0;
    for(int a = 1; a <= K; a++){
        for(int b = 1; b <= K; b++){
            for(int c = 1; c <= K; c++){
                ans += gcd(a, gcd(b, c));
            }
        }
    }

    Cout(ans);
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define int         long long int
#define pb          push_back
#define endl        "\n"
#define hell        1000000007
#define INF         1000000000000000000

using namespace std;
int dp[1000000+10];

  void solve()
  {
 int n;
 cin>>n;
 for(int i=0;i<n+5;i++)
  dp[i]=1;
for(int i=2;i<n+5;i++)
{ 
  dp[i]+=1;
for(int j=2*i;j<n+5;j+=i)
{
  dp[j]+=1;
}
}

dp[1]=1;


int ans=0;
for(int i=1;i<n;i++)
{
  ans+=dp[i];
}
cout<<ans;



  }
  
  

 
  signed main()
  {
    ios::sync_with_stdio(false);
      cin.tie(0);
      cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    #endif
        solve();

return 0;
  }

Measured memory_bytes: 11448
/*
	Author:Bhavya Soriya
*/
#include<bits/stdc++.h>

#define fast ios_base::sync_with_stdio(0);cin.tie(0);
#define MAX 1000000007

using namespace std;
 
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

int main()
{
	fast
	int n,k;
	cin>>n>>k;
	int count=0;
	int temp;
	for(int i=0;i<n;i++)
	{
		cin>>temp;
		if(temp>=k)
		count++;
	}
	cout<<count;
	return 0;
}

Measured memory_bytes: 256
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

func stringifyArray(arr []int) string {
	return strings.TrimRight(fmt.Sprintf("%+v", arr)[1:], "]")
}

func swap(a []int, i, j int) {
	tmp := a[i]
	a[i] = a[j]
	a[j] = tmp
}

func main() {
	scanner.Split(bufio.ScanWords)
	dice := make([]int, 6)
	for i := 0; i < 6; i++ {
		dice[i], _ = nextInt()
	}
	commands := strings.Split(nextString(), "")
	for i := range commands {
		cmd := commands[i]

		// fmt.Println(cmd, dice)

		if cmd == "N" {
			swap(dice, 0, 1)
			swap(dice, 1, 5)
			swap(dice, 5, 4)
		} else if cmd == "W" {
			swap(dice, 0, 2)
			swap(dice, 2, 5)
			swap(dice, 5, 3)
		} else if cmd == "S" {
			swap(dice, 0, 4)
			swap(dice, 4, 5)
			swap(dice, 5, 1)
		} else if cmd == "E" {
			swap(dice, 0, 3)
			swap(dice, 3, 5)
			swap(dice, 5, 2)
		}
		// fmt.Println(dice)
	}
	fmt.Println(dice[0])
}



Measured memory_bytes: 1124
#include <stdio.h>
int main() {
    unsigned long long N, K, p, s;
    scanf("%llu %llu", &N, &K);
    p = N / K;
    s = p * p * p;
    if ((K & 1) == 0) {
        if (K / 2 <= N % K) p++;
        s += p * p * p;
    }
    printf("%llu", s);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<tuple>
#include<utility>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<iomanip>
#include<map>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const int INF = 1e9 + 7;
int dx[8] = { 1,0,-1,0,1,1,-1,-1 };
int dy[8] = { 0,1,0,-1,1,-1,1,-1 };


int main() {

	int n;

	while (cin >> n) {
		if (n == 0)break;

		vector<int> a(n);

		for (int i = 0; i < n; i++)cin >> a[i];

		vector <int> s(n + 1, 0);

		for (int i = 0; i < n; i++) {
			s[i + 1] = s[i] + a[i];
		}

		int maxi = -INF;

		for (int i = n; i > 0; i--) {
			for (int j = i - 1; j >= 0; j--) {
				maxi = max(maxi, s[i] - s[j]);
			}
		}

		cout << maxi << endl;
	}


		return 0;
	}



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

long long int x[15],n,m,i,ans,a[55],b[55],c[55],d[55],q;

void bt(long long int p)
{
	long long int t,s;
	if (p<=n)
	{
		for (t=x[p-1];t<m+1;t++)
		{
			x[p]=t;
			bt(p+1);
		}
		return;
	}
	s=0;
	for (t=1;t<q+1;t++) if (x[b[t]]-x[a[t]]==c[t]) s=s+d[t];
	ans=max(ans,s);
}
	
		

signed main()
{
    ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin>>n>>m>>q;
	for (i=1;i<q+1;i++) cin>>a[i]>>b[i]>>c[i]>>d[i];
	ans=0;x[0]=1;
	bt(1);
	cout<<ans;
}


Measured memory_bytes: 3628
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
using index_t = std::size_t;

namespace lib
{
	using graph_t = std::vector<std::set<index_t>>;
	template<class T>using weighted_graph_t = std::vector<std::map<index_t, T>>;

	struct max_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::max(lhs, rhs);
		}
	};
	struct min_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::min(lhs, rhs);
		}
	};

	constexpr max_t max;
	constexpr min_t min;

	template<class T>auto order_by(T func)
	{
		return [=](auto&& lhs, auto&& rhs)
		{
			return func(lhs) < func(rhs);
		};
	}

	template<class T>constexpr auto max_v = std::numeric_limits<T>::max();
	template<class T>constexpr auto min_v = std::numeric_limits<T>::min();

	template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;
}

void Main()
{
	int N;
	std::int64_t D;
	std::cin >> N >> D;
	D *= D;
	int count = 0;
	for (auto _ : boost::irange(N))
	{
		std::int64_t x, y;
		std::cin >> x >> y;
		count += (x * x + y * y <= D);
	}
	std::cout << count << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

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

vector<pair<ll,int>> v;
ll n;

void factorize (ll n) {
  for (ll i=2; i*i<=n; i++) {
    if (n%i) continue;
    v.emplace_back(i,0);
    while (n%i==0) {
      v.back().second++;
      n/=i;
    }
  }
  if (n!=1) {
    v.emplace_back(n,1);
  }
}

int f(ll x) {
  int ret=1;
  while(x/10) {
    x/=10;
    ret++;
  }
  return ret;
}

int dfs(int i, ll a) {
  if (i==v.size()) {
    return max(f(a),f(n/a));
  }
  int ret=1e9;
  for (int j=0; j<v[i].second+1; j++) {
    ret=min(ret,dfs(i+1,a));
    a*=v[i].first;
  }
  return ret;
}
  
int main() {
  cin>>n;
  factorize(n);
  cout<<dfs(0,1)<<endl;
  
  return 0;
}



Measured memory_bytes: 256
#include<iostream>

using namespace std;

void gcd(int* a,int b){
  int c;
  if(*a<b) swap(*a,b);
  c=*a;*a=b;
  if(c%(*a))gcd(a,c%(*a));
}

int main(int argc,char* argv[]){
  int a,b;
  cin >> a >> b;
  gcd(&a,b);
  cout << a << endl;
}

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

typedef long long ll;

template<class T> inline void chmax(T &a, T b) {if(a < b) a = b;}

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

    int N,W;
    cin >> N >> W;
    ll w[110],v[110];
    for(int i=1;i<=N;i++) cin >> w[i] >> v[i];
    ll dp[110][100100] = {0};
    for(int i=1;i<=N;i++){
        for(int j=1;j<=W;j++){
            chmax(dp[i][j],dp[i-1][j]);
            if(j-w[i]>=0) chmax(dp[i][j],dp[i-1][j-w[i]]+v[i]);
        }
    }
    cout << dp[N][W] << endl;
    return 0;
}

Measured memory_bytes: 86272
#include<iostream>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    sort(A.begin(),A.end());
    bool check=true;
    if(N%2==1){
        int sub=0;
        for(int i=0; i<N; i++){
            if(A[i]!=sub){
                check=false;
            }
            if(i%2==0){
                sub+=2;
            }
            //cout << A[i] << " " << check << endl;
        }
    }else{
        int sub=1;
        for(int i=0; i<N; i++){
            if(A[i]!=sub){
                check=false;
            }
            if(i%2==1){
                sub+=2;
            }
            //cout << A[i] << " " << check << endl;
        }
    }
    if(check){
        int tmp=N/2;
        ll ans=1;
        rep(i,tmp){
            ans*=2;
            ans%=mod;
        } 
        cout << ans << endl;
    }else{
        cout << "0" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const ll MOD = 1e9 + 7;



int main() {
    int h,w,k; cin >> h >> w >> k;
    vector<string> ss(h);
    rep(i, h) {
        cin >> ss[i];
    }
    int c = 1 << h+w;
    int ans = 0;
    rep(i, c) {
        vector<string> ts(ss);
        int ic = i;
        rep(j, h) {
            if (ic&1) {
                rep(k, w) ts[j][k] = '.'; 
            }
            ic /= 2;
        } 
        rep(j, w) {
            if (ic&1) {
                rep(k, h) ts[k][j] = '.'; 
            }
            ic /= 2;
        }
        int cnt = 0;
        rep(j, h) {
            rep(k, w) {
                if (ts[j][k] == '#') ++cnt;
            } 
        }
        if (cnt == k) ++ans;
    } 
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<cstdio>
#include<iostream>
#include<map>
#include<set>
#include<vector>
#include<cstring>
#include<cassert>
#include<sstream>
#include<cmath>
#include<algorithm>
#include<queue>
#include<limits>
#include<ctime>
#include<stack>
#include<bits/stdc++.h>
#include<string>
#include<stdlib.h>
#include<stdio.h>
typedef long long ll;

using namespace std;

int main(){
	ll k,n;
	cin>>k>>n;
	ll a[n]={0},maks=-1;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(a[i]==0){
			a[i]=k;
		}
	}
	sort(a,a+n);
	for(int i=0;i<n-1;i++){
		maks=max(maks,abs(a[i]-a[i+1]));
	}
	maks=max(maks,abs(a[0]+k-a[n-1]));
	cout<<k-maks;
}



Measured memory_bytes: 5164
#include <iostream>
#include <string>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long int LL;

LL min(LL a, LL b) {
  return a < b ? a : b;
}

int main(){
  LL A, B, C, ret = 0;
  cin >> A >> B >> C;
  if(B > C) {
    ret = B + C;
  } else {
    ret = B * 2;
    C -= B;
    LL m = min(A, C);
    ret += m;
    C -= m;
    if(C > 0) ret++;
  }
  cout << ret << endl;
}

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

long modpow(long a, long n, long mod) {
    long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod を計算する
long modinv(long a, long mod) {
    return modpow(a, mod - 2, mod);
}

int main()
{
    int A, B, C;
  	bool flag = true;
 	cin >> A >> B >> C;
  	if(A == B && A != C){
    	cout << "Yes" << endl;
      	flag = false;
    }
  	if(A == C && A != B){
    	cout << "Yes" << endl;
      	flag = false;
    }
 	if(C == B && A != C){
    	cout << "Yes" << endl;
      	flag = false;
    }
  	if(flag)
      	cout << "No" << endl;
 
    return 0;
    
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define PI 3.14159265359
#define MOD 1000000007
typedef long long LL;

template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> void print_vector(vector<T> vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << vec[i] << " ";
	}
	cout << "]" << endl;
}
template<class T> void print_pair_vector(vector<pair<T, T> > vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << "(" << vec[i].first << "," << vec[i].second << ") ";
	}
	cout << "]" << endl;
}

const int INF = 1 << 30;

int main(void) {
	int N, H, W;
	cin >> N >> H >> W;

	cout << (N - W + 1) * (N - H + 1) << endl;

	return 0;
}



Measured memory_bytes: 256
sx,sy,tx,ty=map(int,input().split())
print("R"*(tx-sx)+"U"*(ty-sy+1)+"L"*(tx-sx+1)+"D"*(ty-sy+1)+"R"+"D"+"R"*(tx-sx+1)+"U"*(ty-sy+1)+"L"*(tx-sx+1)+"D"*(ty-sy))

Measured memory_bytes: 61912