akhauriyash/Code-Regression huggingface dataset:
import queue

di = [0, 1, 0, -1]
dj = [1, 0, -1, 0]

while True:
    w,h = map(int,input().split())
    if w == 0:
        break
    f, m, o = map(int,input().split())
    c = [list(map(int,input().split())) for _ in range(h)]
    d = [[[1e9]*w for x in range(h)] for y in range(m+1)]

    que = queue.PriorityQueue()
    for j in range(w):
        d[o-1][0][j] = -min(0,c[0][j])
        que.put((-min(0,c[0][j]),o-1,0,j))

    while not que.empty():
        p = que.get()
        ox = p[1]
        i = p[2]
        j = p[3]
        if d[ox][i][j] < p[0] or ox <= 1:
            continue
        for k in range(4):
            ni = i+di[k]
            nj = j+dj[k]
            if ni<0 or ni>=h or nj<0 or nj>=w:
                continue
            if c[ni][nj] < 0:
                if d[ox-1][ni][nj] > d[ox][i][j] - c[ni][nj]:
                    d[ox-1][ni][nj] = d[ox][i][j] - c[ni][nj]
                    que.put((d[ox-1][ni][nj],ox-1,ni,nj))
            else:
                nox = min(ox-1+c[ni][nj],m)
                if d[nox][ni][nj] > d[ox][i][j]:
                    d[nox][ni][nj] = d[ox][i][j]+0
                    que.put((d[nox][ni][nj],nox,ni,nj))
    ans = 1e9
    for j in range(w):
        for ox in range(1,m+1):
            ans = min(ans, d[ox][h-1][j])
    if ans <= f:
        print(ans)
    else:
        print('NA')
    


Measured memory_bytes: 7132
package main

import (
	"fmt"
	"os"
	"sort"
)

// {{{
// source: https://github.com/raahii/algo
func MaxInts(nums ...int) int {
	var maxVal int
	for i, e := range nums {
		if i == 0 || e > maxVal {
			maxVal = e
		}
	}
	return maxVal
}

func MaxIntsWithIdx(nums ...int) (int, int) {
	var maxIdx, maxVal int
	for i, e := range nums {
		if i == 0 || e > maxVal {
			maxIdx = i
			maxVal = e
		}
	}
	return maxVal, maxIdx
}

func MinInts(nums ...int) int {
	var minVal int
	for i, e := range nums {
		if i == 0 || e < minVal {
			minVal = e
		}
	}
	return minVal
}

func MinIntsWithIdx(nums ...int) (int, int) {
	var minIdx, minVal int
	for i, e := range nums {
		if i == 0 || e < minVal {
			minIdx = i
			minVal = e
		}
	}
	return minVal, minIdx
}

func SumInts(nums []int) int {
	s := 0
	for _, v := range nums {
		s += v
	}
	return s
}

func ReverseInts(nums []int) []int {
	rnums := make([]int, len(nums))
	for i := 0; i < len(nums); i++ {
		rnums[len(nums)-1-i] = nums[i]
	}
	return rnums
}

func ExtendInts(nums1 []int, nums2 []int) []int {
	for _, v := range nums2 {
		nums1 = append(nums1, v)
	}
	return nums1
}

func Ints2d(n_rows, n_cols int) [][]int {
	ints := make([][]int, n_rows)
	for i := 0; i < n_rows; i++ {
		ints[i] = make([]int, n_cols)
	}
	return ints
}

func MemsetInts1d(nums []int, val int) {
	for i := range nums {
		nums[i] = val
	}
}

func MemsetInts2d(nums [][]int, val int) {
	for i := range nums {
		for j := range nums[i] {
			nums[i][j] = val
		}
	}
}

func ContainsInt(nums []int, num int) bool {
	sort.Ints(nums)

	s, e := 0, len(nums)
	for {
		if s >= e {
			break
		}

		m := (e + s) / 2
		if nums[m] == num {
			return true
		} else if num > nums[m] {
			s = m + 1
		} else {
			e = m
		}
	}

	return false
}

func ReadInt(f *os.File) int {
	var n int
	fmt.Fscanf(f, "%d", &n)
	return n
}

func ReadInts(f *os.File, n int) []int {
	nums := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(f, "%d", &nums[i])
	}
	return nums
}

func ScanInts(f *os.File, vars ...*int) {
	for i := 0; i < len(vars); i++ {
		fmt.Fscanf(f, "%d", vars[i])
	}
}

func ReadLine(f *os.File) string {
	var str string
	fmt.Fscanf(f, "%s", &str)

	return str
}

func ReadLines(f *os.File, n int) []string {
	lines := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(f, "%s", &lines[i])
	}

	return lines
}

func ReadWords(f *os.File, n int) []string {
	strs := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(f, "%s", &strs[i])
	}
	return strs
}

func Pow(a, n int) int {
	c := 1
	for i := 0; i < n; i++ {
		c *= a
	}
	return c
}

func Abs(n int) int {
	if n < 0 {
		return -n
	}

	return n
}

// }}}

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	cal := b + MinInts(a+b, c)
	if c > a+b {
		cal++
	}
	fmt.Println(cal)
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;

int d[10][10];
int c[101][101];

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

	for(int i=0; i<a; i++)
		for(int j=0; j<b; j++)
			cin >> d[i][j];

	for(int kx=0; kx<=100; kx++){
		for(int ky=0; ky<=100; ky++){
			int res = 0;

			for(int i=1;i<=a;i++){
				for(int j=1;j<=b;j++){
					if(res < d[i-1][j-1] - kx*i - ky*j)
						res = d[i-1][j-1] - kx*i - ky*j;
				}
			}
			c[kx][ky] = res;
		}
	}

	for(int i=1;i<=a;i++)
		for(int j=1;j<=b;j++){
			int res = 100;

			for(int kx=0; kx<=100; kx++)
				for(int ky=0; ky<=100; ky++){
					if(res > kx*i + ky*j + c[kx][ky])
						res = kx*i + ky*j + c[kx][ky];
				}

			if(res != d[i-1][j-1]){
				cout << "Impossible" << endl;
				return 0;
			}

		}


	cout << "Possible" << endl;
	cout << "202 10401" << endl;

	for(int i=1;i<=100;i++){
		cout << i <<"  "<< i+1 <<" X"<<endl;
		cout << i+101 <<" "<< i+102 <<" Y"<<endl;
	}

	for(int kx=0; kx<=100; kx++){
		for(int ky=0; ky<=100; ky++){
			cout << kx+1 <<" "<<202 - ky<<" "<< c[kx][ky] <<endl;
		}
	}

	cout << "1 202" << endl;

	return 0;
}


Measured memory_bytes: 384
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i).sort!

i = 0
while i < n-1
  if a[i+1] < 0 || a[i] + a[i+1] < 0
    a[i] = -a[i]
    a[i+1] = -a[i+1]
  end
  i += 2
end

puts a.inject(:+)


Measured memory_bytes: 10548
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string a;
	cin>>a;
	int n=a.size(),f=1,w=n/2+n%2;
	for(int i=0;i<n;i++) if(a[i]=='0')
	{
		f--;
		break;
	}
	if(f) printf("%d\n",n);
	else
	{
		for(;w<n;w++)
			if(a[w]!=a[w-1]||a[w]!=a[n-w-1])
				break;
		printf("%d",w);
	}
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
const int N=1E5+7;
struct stu{
	double a,b;
	bool friend operator <(const stu &x,const stu &y){
		return atan2(x.b,x.a)<atan2(y.b,y.a);
	}
}arr[N];
int nxt[N];
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>arr[i].a>>arr[i].b;	
	}
	for(int i=1;i<=n;i++) nxt[i]=i+1;
	nxt[n]=1;
	sort(arr+1,arr+1+n);
	double ans=0;
	for(int i=1;i<=n;i++){
		double dx=arr[i].a;
		double dy=arr[i].b;
		ans=max(ans,arr[i].a*arr[i].a+arr[i].b*arr[i].b);
		for(int j=nxt[i];j!=i;j=nxt[j]){
			dx+=arr[j].a;
			dy+=arr[j].b;
			ans=max(ans,dx*dx+dy*dy);
		}
	}
	printf("%.15lf\n",sqrt(ans));
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,i,ans = 1;scanf("%d",&n);
  int a[n];short g = 2;
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=1;i<n;i++){
    if(g == 2 && a[i] != a[i-1]){
      g = a[i]>a[i-1];
    }
    else if(g == 1 && a[i]<a[i-1]){
      ans++;g = 2;
    }
    else if(g == 0 && a[i]>a[i-1]){
      ans++;g = 2;
    }
  }
  printf("%d\n",ans);
}

Measured memory_bytes: 640
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()


def main():
	n=II()
	for i in range(10**10):
		if (i*(i+1))//2>=n:
			print(i)
			exit()




if __name__ == "__main__":
	main()


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

using namespace std;

typedef long long ll;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define P 1000000007

#define N 210
int n, m;
string a[N];

int ff(string a, string b, string c, string d) {
	multiset<string> u;
	u.insert(a);
	u.insert(b);
	u.insert(c);
	u.insert(d);
	a = *u.begin();
	u.erase(u.begin());
	b = *u.begin();
	u.erase(u.begin());
	c = *u.begin();
	u.erase(u.begin());
	d = *u.begin();
	u.erase(u.begin());
	if (a == b && b == c && c == d) return 1;
	if (a == b && b == c || b == c && c == d) return 4;
	if (a == b && c == d) return 6;
	if (a == b || b == c || c == d) return 12;
	return 12;
}

bool gg(string a, string b, string c, string d) {
	multiset<string> u;
	u.insert(a);
	u.insert(b);
	u.insert(c);
	u.insert(d);
	a = *u.begin();
	u.erase(u.begin());
	b = *u.begin();
	u.erase(u.begin());
	c = *u.begin();
	u.erase(u.begin());
	d = *u.begin();
	u.erase(u.begin());
	if (a != b && b != c && c != d) return true;
	return false;
}

bool b[N], c[N];

int main() {
	cin >> n >> m;
	for (int i = 0; i < n; i ++) {
		cin >> a[i];
	}
	ll S = 1;
	for (int i = 0; i*2 < n-1; i ++)
		for (int j = 0; j*2 < m-1; j ++) {
			S = (ll)S*ff(string(1, a[i][j]), string(1, a[n-1-i][j]), string(1, a[n-1-i][m-1-j]), string(1, a[i][m-1-j]))%P;
			if (gg(string(1, a[i][j]), string(1, a[n-1-i][j]), string(1, a[n-1-i][m-1-j]), string(1, a[i][m-1-j]))) b[i] = c[j] = true;
		}
	/*
	for (int i = 0; i*2 < n-1; i ++) {
		int j = 0;
		S = (ll)S*gg(string(1, a[i][j]), string(1, a[n-1-i][j]), string(1, a[n-1-i][m-1-j]), string(1, a[i][m-1-j]))%P;
	}
	for (int j = 1; j*2 < m-1; j ++) {
		int i = 0;
		S = (ll)S*gg(string(1, a[i][j]), string(1, a[n-1-i][j]), string(1, a[n-1-i][m-1-j]), string(1, a[i][m-1-j]))%P;
	}
	*/
	int T = 0;
	for (int i = 0; i*2 < n-1; i ++) if (b[i]) T ++;
	for (int j = 0; j*2 < m-1; j ++) if (c[j]) T ++;
	for (int i = 0; i < T-1; i++) S = (ll)S*2%P;
	if (n&1) {
		bool F = true;
		for (int i = 0; i < m; i++)
			if (a[n/2][i] != a[n/2][m-1-i]) F = false;
		if (!F) S = (ll)S*2%P;
	}
	if (m&1) {
		bool F = true;
		for (int i = 0; i < n; i++)
			if (a[i][m/2] != a[n-1-i][m/2]) F = false;
		if (!F) S = (ll)S*2%P;
	}
	cout << S << endl;
	return 0;
}

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

int main(){
    int n;
    int dp[1000]={1};
    for(int i=1;i<=17;i++){
        int sq=i*i;
        for(int j=sq;j<=300;j++){
            dp[j]+=dp[j-sq];
        }
    }
    while(cin>>n && n) cout<<dp[n]<<endl;
}

Measured memory_bytes: 1164
//   Rishabh Agarwal
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;

typedef long long int ll;
const ll mod = 1e18;
const ll INF= 1e18;
const long double PI=3.1415926;

ll power(ll a,ll b){
    if(b==0){
        return 1;
    }
    ll temp=power(a,b/2)%mod;
    if(b%2==0){
        return (temp*temp)%mod;
    }
    else{
        return ((a*temp)%mod*temp)%mod;
    }
}

ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 

vector<ll>v;
vector<ll>::iterator it;
map<ll,ll>mp;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    #ifndef ONLINE_JUDGE
        freopen("inp.txt", "r", stdin);
        freopen("out.tex", "w", stdout);
    #endif

    ll t;
    //cin>>t;
    t=1;
    //ll c=1;
    while(t--){
        ll n;
        cin>>n;
        for(ll x=0; x<n; x++){
            ll y;
            cin>>y;
            v.push_back(y);
        }
        ll sum[n+1];
        memset(sum,0,sizeof(sum));
        for(ll x=0; x<n; x++){
            sum[x+1]=sum[x]+v[x];
        }
        ll dp[n+1][n+1];
        memset(dp,0,sizeof(dp));
        for(ll x=2; x<=n; x++){
            for(ll l=1; l+x-1<=n; l++){
                ll r=l+x-1;
                dp[l][r]=1e18;
                for(ll m=l; m<r; m++){
                    dp[l][r]=min(dp[l][r],dp[l][m]+dp[m+1][r]);
                }
                dp[l][r]+=sum[r]-sum[l-1];
            }
        }
        cout<<dp[1][n]<<"\n";
        mp.clear();  
        v.clear();
        //cout<<"Case #"<<c<<": "<<ans<<"\n";
        //c++;
    }
    return 0;
}

Measured memory_bytes: 4800
/*
    ZI0N
*/

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

//VARS
#define int               long long
#define ld                long double
#define mod1              1000000007
#define mod2              998244353
#define pi           `    3.14159265358979323846
#define hs                100006

#define pb                push_back
#define mp                make_pair
#define all(x)            (x).begin(),(x).end()
#define fi                first
#define se                second
#define vc                vector
#define pii               pair<int,int>
#define msi               map<string,int>
#define mii               map<int,int>
#define psi               pair<string,int>
#define pis               pair<int,string>
#define endl              "\n"

//INPUT
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define repe(i,a,b)       for(int i=a;i<=b;i++)
#define bac(i,a,b)        for(int i=a;i>b;i--)
#define bace(i,a,b)       for(int i=a;i>=b;i--)

//FAST
#define ios               ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

//FUNCTIONS
#define DECIMAL(n)        std::cout << std::fixed << std::setprecision(n)
#define SORT(v)           sort(all(v))
#define DSORT(v)          sort(all(v),greater<int>())
#define REVERSE(v)        reverse(ALL(v))
#define GCD(m,n)          __gcd(m,n)
#define LCM(m,n)          m*(n/GCD(m,n))
#define init(x,a)         memset(x,a,sizeof(x))
#define trav(a, x)        for(auto& a : x)
#define display(x)        trav(a,x) cout<<a<<" ";cout<<endl

void solve(){
    int n;
    cin>>n;
    vc<int> h(n);
    int maxi,lol=0;
    rep(i,0,n){
        cin>>h[i];
        if(i==0)
            maxi=h[i];
        else{
            if(maxi<=h[i])
                maxi=h[i];
            else{
                if(maxi-h[i]>1)
                {
                    lol=1;
                    break;
                }
            }
        }
    }
    if(lol==1)
        cout<<"No";
    else
        cout<<"Yes";
}


signed main(){
    ios
    int q=1;
    //cin>>q;
    while(q--){
        solve();
    }

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#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--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

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

    int ans = 3*pow(a, 2);
    cout << ans << endl;
}

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

int main() {
  int a , b , c;
  cin >> a >> b >> c;
  
 
   vector<int> vec = {a, b, c};
    sort(vec.begin(), vec.end());
 
    for (int i = 0; i < vec.size(); i++) ;
 
    if (vec.at(0)+vec.at(1)==vec.at(2)){
      cout << "Yes" << endl;
    }
  else {
    cout << "No" << endl;
  }
}
  
  
 

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

using std::cin;
using std::cout;
using std::endl;

int main() {
  int n, k, mid = -1;
  std::vector<long long> x;

  long long ans = (long long)(1e18);

  cin >> n >> k;
  x.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> x[i];   
  }

  for (int i = 0; i < n - 1; ++i) {
    int l = i, r = n, m;

    while (r - l > 1) {
      m = (l + r) / 2;

      if (m - i + 1 > k) {
        r = m;
      }
      else {
        l = m;
      }
    }

    if (l - i + 1 == k) {
      if (x[i] > 0 and x[l] > 0) {
        ans = std::min(ans, x[l]);
      }
      else if (x[i] < 0 and x[l] < 0) {
        ans = std::min(ans, llabs(x[i]));
      }
      else {
        ans = std::min({ans, 2 * llabs(x[i]) + x[l], 2 * x[l] + llabs(x[i])});
      }
    }
  }
  
  if (k == 1) {
    for (int i = 0; i < n; ++i) {
      ans = std::min(ans, llabs(x[i]));
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define sync ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main(){
	sync
	int H,W,h,w;
	cin >> H >> W >> h >> w;
	cout << H*W-h*W-(H-h)*w << "\n";
	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
C=[list(map(int, input().split())) for i in range(M)]

#print(C)

sol = [-1] * N

for i in range(M):
    if N!=1 and (C[i][0]==1 and C[i][1]==0):
        print(-1)
        exit()
    elif sol[C[i][0]-1]==-1:
        sol[C[i][0]-1]=C[i][1]  
    elif sol[C[i][0]-1]!=C[i][1]:
        print(-1)
        exit()

for j in range(N):
    if sol[j]==-1:
        sol[j]=0  

if sol[0]==0 and N!=1:
    sol[0]=1

solstr = [str(s) for s in sol]
print(int("".join(solstr)))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;

class SegmentTree{
public:
	int n = 1;
	vector<P> seg[2];		//0:最大	1:最小
	void init(int N){		//N要素のセグメントツリー作成
		while(n < N)n *= 2;
		rep(i,2)seg[i].resize(2*n);
		fill(all(seg[0]), P(-INF, 0));
		fill(all(seg[1]), P(INF, 0));
	}
	P cmp_min(P x, P y){		//比較関数
		if(x.fi == y.fi)return x.se < y.se ? x : y;
		return min(x, y);
	}
	P cmp_max(P x, P y){		//比較関数
		if(x.fi == y.fi)return x.se < y.se ? x : y;
		return max(x, y);
	}
	void update(int k, int x, bool flag=false){		//kの値をxに変更
		k += n-1;
		seg[0][k] = seg[1][k] = P(x, k-(n-1));
		if(flag){seg[0][k] = P(-INF, -1);seg[1][k] = P(INF, -1);}
		while(k > 0){
			k = (k-1)/2;
			seg[0][k] = cmp_max(seg[0][k*2+1], seg[0][k*2+2]);
			seg[1][k] = cmp_min(seg[1][k*2+1], seg[1][k*2+2]);
		}
	}
	P calc(int a, int b, int k, int l, int r, int f){
		if(b <= l || r <= a)return f ? P(INF, 0) : P(-INF, 0);
		if(a <= l && r <= b)return seg[f][k];
		P vl = calc(a, b, k*2+1, l, (l+r)/2, f);
		P vr = calc(a, b, k*2+2, (l+r)/2, r, f);
		return f ? cmp_min(vl, vr) : cmp_max(vl, vr);
	}
	void erase(int k){update(k, -1, true);}
	P get_max(int a, int b){return calc(a, b, 0, 0, n, 0);}
	P get_min(int a, int b){return calc(a, b, 0, 0, n, 1);}
};

SegmentTree seg;
int a[100000], ans[100000];
signed main(){
	int n, m, l, p = 0, tt = 0;
	scanf("%lld%lld%lld", &n, &m, &l);
	seg.init(n);
	rep(i,m){
		int d, t, x;
		scanf("%lld%lld%lld", &d, &t, &x);d--;
		seg.update(d, a[d]+x);a[d] += x;
		P mx = seg.get_max(0, n);
		ans[p] += t-tt;p = mx.se;tt= t;
	}
	ans[p] += l-tt;
	
	P res = P(-INF, -1);
	drep(i,n-1,0){
		if(res.fi <= ans[i])res = P(ans[i], i);
	}
	printf("%lld\n", res.se+1);
	return 0;
}








Measured memory_bytes: 12572
N = int(input())
H = list(map(int, input().split()))

Count = [0]*(N)
Count[0] = 0
for i in range(1, N):
  if  H[i] - H[i-1] > 0:
    Count[i] = 0
  else:
    Count[i] = Count[i-1] + 1
print(max(Count))

Measured memory_bytes: 15020
#include <bits/stdc++.h>
using namespace std;
#define REP(i,b,e) for(int i=(b);i<(e);++i)
#define RREP(i,b,e) for(int i=(b)-1;i>=e;--i)
#define rep(i,e) for(int i=0;i<(e);++i)

constexpr int MOD = 1000000007;
constexpr int INF = 1LL << 30;
constexpr long long LLINF = 1LL << 62;
constexpr double EPS = 1e-9;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
  }
} initializer;

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

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    if (it != vec.begin()) os << ", ";
    os << *it;
  }
  return os << "]";
}

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

template<typename Tuple, size_t N>
struct TuplePrinter {
  static void print(const Tuple &t) {
    TuplePrinter<Tuple, N-1>::print(t);
    cout << ", " << get<N-1>(t);
  }
};

template<typename Tuple>
struct TuplePrinter<Tuple, 1> {
  static void print(const Tuple &t) {
    cout << get<0>(t);
  }
};

template<typename... T>
ostream &operator<<(ostream &os, const tuple<T...> &tup) {
  os << "(";
  TuplePrinter<decltype(tup), sizeof...(T)>::print(tup);
  return os << ")";
}

template<typename T>
ostream &operator<<(ostream &os, const set<T> &se) {
  os << "{";
  for (auto it = se.begin(); it != se.end(); ++it) {
    if (it != se.begin()) os << ", ";
    os << *it;
  }
  return os << "}";
}

template<typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &ma) {
  os << "{";
  for (auto it = ma.begin(); it != ma.end(); ++it) {
    if (it != ma.begin()) os << ", ";
    os << it->first << ": " << it->second;
  }
  return os << "}";
}

inline void print(void) { cout<<'\n'; }
template<class T> inline void print(const T &x) { cout<<x<<'\n'; }
template<class T, class... U> inline void print(const T &x, const U&... y) { cout<<x<<" "; print(y...); }
#define dump(...) cout<<#__VA_ARGS__<<": [L_"<<__LINE__<<"]"<<'\n'; print(__VA_ARGS__);cout<<'\n';

template<class T, class U>inline bool chmax(T &a, const U &b) { if(a<b){ a=b; return 1; } return 0; }
template<class T, class U>inline bool chmin(T &a, const U &b) { if(b<a){ a=b; return 1; } return 0; }


int main() {
  int h, w; cin>>h>>w;
  vector<string> s(h);
  rep(i, h) cin>>s[i];
  vector<vector<int>> dp(h, vector<int>(w, INF));
  if (s[0][0] == '.') dp[0][0] = 0;
  else dp[0][0] = 1;
  rep(i, h) rep(j, w) {
    if (j != 0) {
      int t = 0;
      if (s[i][j-1] == '.' and s[i][j] == '#') t = 1;
      dp[i][j] = min(dp[i][j], dp[i][j-1] + t);
    }
    if (i != 0) {
      int t = 0;
      if (s[i-1][j] == '.' and s[i][j] == '#') t = 1;
      dp[i][j] = min(dp[i][j], dp[i-1][j] + t);
    }
  }

  print(dp[h-1][w-1]);


  return 0;
}

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

using uli = unsigned long int;
using lli = long long int;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define repa(a,i,x) for(int i=a;i<=x;i++)

int main(){
	int N,M;
	cin >> N >> M;
	int A[M];
	rep(i,M)cin>>A[i];
	
	int sum=0;
	rep(i,M)sum+=A[i];
	if(sum>N)cout << -1 << endl;
	else cout << N-sum << endl;
}

Measured memory_bytes: 3640
def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)

mod=10**9+7
n=int(input())
dic={}
cnt=0
for _ in range(n):
  a,b=map(int,input().split())
  if a!=0 and b!=0:
    g=gcd(abs(a),abs(b))
    if a*b>0:
      if (abs(a)//g,abs(b)//g) not in dic:
        dic[(abs(a)//g,abs(b)//g)]=1
      else:
        dic[(abs(a)//g,abs(b)//g)]+=1
    else:
      if (-abs(a)//g,abs(b)//g) not in dic:
        dic[(-abs(a)//g,abs(b)//g)]=1
      else:
        dic[(-abs(a)//g,abs(b)//g)]+=1
  else:
    if a==0 and b==0:
      cnt+=1
    elif a==0:
      if (1,0) not in dic:
        dic[(1,0)]=1
      else:
        dic[(1,0)]+=1
    elif b==0:
      if (0,1) not in dic:
        dic[(0,1)]=1
      else:
        dic[(0,1)]+=1
ans=1
s=set()
for a,b in dic.keys():
  if (a,b) in s:
    continue
  s.add((a,b))
  if a!=0 and b!=0:
    if a>0:
      if (-b,a) in dic:
        s.add((-b,a))
        cnt1=dic[(a,b)]
        cnt2=dic[(-b,a)]
        ans*=(pow(2,cnt1,mod)+pow(2,cnt2,mod)-1)%mod
        ans%=mod
      else:
        ans*=pow(2,dic[(a,b)])
        ans%=mod
    elif a<0:
      if (b,-a) in dic:
        s.add((b,-a))
        cnt1=dic[(a,b)]
        cnt2=dic[(b,-a)]
        ans*=(pow(2,cnt1,mod)+pow(2,cnt2,mod)-1)%mod
        ans%=mod
      else:
        ans*=pow(2,dic[(a,b)],mod)
        ans%=mod
  else:
    if (b,a) in dic:
      s.add((b,a))
      cnt1=dic[(a,b)]
      cnt2=dic[(b,a)]
      ans*=(pow(2,cnt1,mod)+pow(2,cnt2,mod)-1)%mod
      ans%=mod
    else:
      ans*=pow(2,dic[(a,b)],mod)
      ans%=mod
print((ans+cnt-1)%mod)

Measured memory_bytes: 145188
import sys
import math
input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))

def solve(a,b,c,d):
    angle = abs(0.5 * (60 * c + d) - 6 * d)
    distance = math.sqrt(pow(a,2) + pow(b,2) - (2*a*b*math.cos(math.radians(angle))))
    return distance

def main():
    a,b,c,d = invr()
    print(solve(a,b,c,d))

main()




Measured memory_bytes: 9536
#include<bits/stdc++.h>
#define all(arr) arr.begin(),arr.end()
using namespace std;
typedef long long int lli;
int main() {
    lli n, m, k;
    cin >> n >> m >> k;
    vector<lli> a(n+1, 0), b(m+1, 0);
    for(int i=1; i<=n; i++) {
        cin >> a[i];
        a[i]+=a[i-1];
    }
    
    for(int i=1; i<=m; i++) {
        cin >> b[i];
        b[i]+=b[i-1];
    }

    int ans = 0;
    for(int count=0; count<=min(n, m); count++) {
        lli total = a[count];
        lli left_over = k-total;
        if(left_over>=0) {
            int ind = lower_bound(all(b), left_over) - b.begin();
            if(ind==b.size() or b[ind]>left_over)
                --ind;
                ans = max(ans, count+ind);
        }

        total = b[count];
        left_over = k-total;
        if(left_over>=0) {
            int ind = lower_bound(all(a), left_over) - a.begin();
            if(ind==a.size() or a[ind]>left_over)
                --ind;
            ans = max(ans, count+ind);
        }
    }

    cout << ans << endl;
}

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

int main() {
  int N;
  cin >> N;
  string Ans = "No";
  for (int i = 1; i < 10; i++) {
    if (N / i <= 9 && N % i == 0) {
      Ans = "Yes";
    }
  }
  cout << Ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = "";
		for(int i=0; i<s.length(); i++){
			if(s.charAt(i)=='B'){
				if(t.length()!=0) t = t.substring(0, t.length()-1);
			}
			else t += s.charAt(i);
		}
		System.out.println(t);
	}
}

Measured memory_bytes: 22996
#pragma GCC optimize("Ofast")  
#pragma GCC target("avx,avx2,fma") 
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD=998244353;
template <class Q>
void clearQueue(Q & q) {
    q=Q();
}
void solve(){
	int n,x,m;cin>>n>>x>>m;
	vector<int>hold;
	map<int,int>mp;
	int prev=x;
	mp[x]=1;
	hold.push_back(x);int start=-1;
	int i=-1;
	for(i=2;i<=n;i++){
		int curr=(prev*prev)%m;
		if(mp[curr]!=0) {start=curr;break;}
		prev=curr;
		mp[curr]++;
		hold.push_back(curr);
	}
	// cout<<i<<'\n';
	// for(auto x:hold) cout<<x<<" ";
	vector<int>pre;
	pre.push_back(hold[0]);
	for(int j=1;j<hold.size();j++){
		pre.push_back(pre.back()+hold[j]);
	}
	if(i==n+1){
		cout<<pre[pre.size()-1];return;
	}
	int ans=0;int ind=-1;
	for(int i=0;i<hold.size();i++){
		if(hold[i]==start){ind=i;break;}
	}	
	if(ind>0)
	ans+=pre[ind-1];
	//period length:hold.size()-ind
	//ind,ind+perlen,ind+2*perlen....
	int perlen=hold.size()-ind;
	int firstend=ind+perlen-1;
	int cnt=(n-1-firstend)/perlen;
	cnt++;
	if(ind>0)
	ans+=(cnt)*(pre[firstend]-pre[ind-1]);
	else ans+=(cnt)*(pre[firstend]);
	int lastend=firstend+(cnt-1)*perlen;
	int rem=n-1-lastend;
	if(rem==0) ;
	else{
		if(ind>0)
		ans+=pre[ind+rem-1]-pre[ind-1];
		else ans+=pre[ind+rem-1];
	}
	cout<<ans;
}
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL); 
//#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
//#endif
	int T=1;
	// cin>>T;
	while(T--){
		solve();
	}
}

Measured memory_bytes: 7456
import java.util.Scanner

object Main {
    def main(args: Array[String]) {
        val sc = new Scanner(System.in);
        val a, b = sc.nextInt;
        println(solve(a*b))
    }
    
    def solve(n:Int) : String = {
        if(n%2==0){
            "Even"       
        }else{
            "Odd"
        }
    }
}

Measured memory_bytes: 25928
#include <bits/stdc++.h>
using namespace std;
#define eps 1e-7
#define PI acos(-1)
#define de(x) cout<<#x<<'='<<x<<" , "
#define dee(x) cout<<#x<<'='<<x<<endl
#define sz(x) x.size()
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define mset(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
typedef long long LL;
typedef pair<int,int> pii;
typedef vector<int> vi;

int main(){
    LL a,b;
    cin>>a>>b;
    cout<<(a>b?a-b:0)<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> Pi;
typedef long long ll;
#define pii Pi
#define pll PL
#define Fi first
#define Se second
#define pb(x) push_back(x)
//#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> pll;
typedef long double ldouble;
typedef pair<double, double> pdd;

const double PI = acos(-1);
const double EPS = 1e-9;

const int MX = 105;
const int MM = 998244353;

typedef __int128 LL;

map<LL, ll> D, E, F;

ll solve(LL);
ll solve2(LL);

ll solve3(LL u){
	if( u == 1 ) return 0;
	if( F.find(u) != F.end()) return F[u];
	ll &res = F[u];
	
	int cnt = 1;
	for(LL i = 2; i*2 <= u; i *= 2) cnt++;
	
	LL p = 1;
	for(int i = 1; i < cnt; i++){
		p *= 2;
		if( cnt%i ) continue;
		LL msk = p-1, t = u;
		for(int tt = 0; tt < cnt/i; tt++){
			msk &= t&(p-1);
			t >>= i;
		}
		msk |= p;
		res = (res + solve(msk));
	}
	return res;
}

ll solve2(LL u){
	if( u == 1 ) return 0;
	if( E.find(u) != E.end()) return E[u];
	ll &res = E[u];
	
	int cnt = 1;
	for(LL i = 2; i*2 <= u; i *= 2){
		cnt++;
//		printf("%lld -> %lld %lld\n", (ll)u, (ll)(u&(i-1)|i), (ll)(u/i));
		res = (res + solve3(u&(i-1)|i) * solve2(u/i)) % MM;
	}
//	printf("cnt %lld %d\n", (ll)u, cnt);
	
	res = (res + solve3(u)) % MM;
	return res;
}

ll solve(LL u){
	assert(u);
	if( u == 1 ) return 1;
	if( D.find(u) != D.end()) return D[u];
	ll &res = D[u];

	int cnt = 0;
	for(LL i = 1; i*2 <= u; i *= 2){
		cnt++;
		ll t;
		if( i == 1 ) t = solve(u/2);
		else t = solve2(u&(i-1)|i) * solve(u/i/2) % MM;
		if( u&i ) res = (res + t*2) % MM;
		else res = (res + t) % MM;
	}
	res = (res + solve2(u)) % MM;
//	printf("S1 %lld %lld\n", (ll)u, res);
	return res;
}

int main()
{
	string S;
	cin >> S;
	LL u = 1;
	for(char c : S) u = u * 2 + c-'0';
	printf("%lld\n", solve(u));
}


Measured memory_bytes: 13056
#include <iostream>
#include <string>
#include <math.h>

int main()
{
	int ans = 0;
	std::string S;

	std::cin >> S;
	int L = (int)(S.length());
	for (int i = 0; i < floor(L / 2.0); i++)
	{
		if (S[i] != S[L - 1 - i]){
			ans++;
		}
	}

	std::cout << ans << std::endl;

	return 0;
}

Measured memory_bytes: 256
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const A = input[0].map(Number);

  return Math.max(...A) - Math.min(...A);
};

console.log(main(read()));


Measured memory_bytes: 29680
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int  n,m,x,y;
    cin>>n>>m>>x>>y;
    vector<int>xn(n);
    rep(i,n){
        cin>>xn[i];
    }
    vector<int>ym(m);
    rep(j,m){
        cin>>ym[j];
    }
    xn.push_back(x);
    ym.push_back(y);
    sort(xn.begin(),xn.end());
    sort(ym.begin(),ym.end());
    if(xn[n]<ym[0])cout<<"No War"<<endl;
    else cout<<"War"<<endl;

    return 0;
}

Measured memory_bytes: 3632
#include<iostream>

 using namespace std ;

 int main()

{

 int A,B,C;

 cin>>A;

 cin>>B;

 cin>>C;

 if ((A+B)>=C)

 {

 cout << "Yes"<< endl;

 }

 else {

 cout <<"No" << endl;

 }

 

}

Measured memory_bytes: 3584
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        System.out.println(Math.max(a + a - 1, Math.max(b + b - 1, a + b)));
    }
}


Measured memory_bytes: 21844
n = input()

cnt = 0
flag = False
if n[1] == 'S':
    if 'R' in n:
        print(1)
        flag = True
    else:
        print(0)
        flag = True
if flag == False:
    for i in n:
        if i == 'R':
            cnt += 1
    print(cnt)

Measured memory_bytes: 9104
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=yakusu[i];
  }
  return num;
}

int H,W;
vs s(50);
vi dv ={-1,0,1,0};vi du={0,-1,0,1};
int cnt=1;
int dfs(int u,int v){
  s[u][v]='.';
  
  rep(i,4){
   
      int nu =u +du[i],nv=v+dv[i];
      if(nu<0||nu>=H||nv<0||nv>=W)continue;
      if(s[nu][nv]=='.')continue;
      cnt ++;
      dfs(nu,nv);
    
  }
  return cnt;

}
int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}

//vc alp(26) ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//cout<<""<<endl;
int main(){
  int N;cin>>N;vi C(N-1),S(N-1),F(N-1);rep(i,N-1)cin>>C[i]>>S[i]>>F[i];
  for(int i=0; i<N-1;i++){
    int t=S[i];
    t +=C[i];
    for(int j =i+1; j<N-1;j++){
      if(t>=S[j]&&t%F[j]==0){
        t +=C[j];
      }
      else if(t>=S[j]&&F[j]!=0){
        while(t%F[j]!=0){
          t++;
        }
        t +=C[j];
      }
      else if(t<S[j]){
        t=S[j];
        t+=C[j];
      }
      
    }
    cout<<t<<endl;
  }
  cout<<0<<endl;
}







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

int main() {
	int N, L[26] = { 0 }, R[26] = { 0 }, C[26] = { 0 }, X[99] = { 0 };
	string S;
	cin >> N >> S;
	for (int i = 0; i < N; i++) {
		int x = S[i] - 97;
		if (C[x] == 0) {
			L[x] = i;
		}
		R[x] = i;
		C[x]++;
	}
	for (int i = 0; i < 26; i++) {
		if (C[i] > 0) {
			for (int j = L[i]; j < R[i]; j++) {
				X[j]++;
			}
		}
	}
	sort(X, X + N - 1, greater<int>());
	cout << X[0] << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=1;i<=n;i++)
#define pb push_back
#define pf push_front
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

int main()
{
	ios::sync_with_stdio(false);
	char s[10000];
	cin>>s;
	for (int i=0;i<strlen(s);i++){
		if (s[i]!=s[strlen(s)-i-1]){
			cout<<"No";
			return 0;
		}
	} 
	cout<<"Yes";
}

Measured memory_bytes: 256
def inN():
    return int(input())
def inL():
    return list(map(int,input().split()))
def inNL(n):
    return [list(map(int,input().split())) for i in range(n)]
mod = pow(10,9)+7
#import numpy
s = input()
if s == "ABC":
    print("ARC")
else:
    print("ABC")

Measured memory_bytes: 8928
#include<iostream>
using namespace std;
int main(){
	int N;
	bool prime=true;
	cin>>N;
	for(int i=N;i<1000000;i++){
		prime=true;
		for(int j=2;j*j<i;j++){
			if(i%j==0)prime=false;
		}
		if(prime){cout<<i;return 0;}
	}
	return 0;
}

Measured memory_bytes: 256
$dataset1 = {}
$dataset2 = {}
def set_data(line,dataset)
	id, date = line.split(',').map(&:to_i)
	if dataset.has_key?(id)
		dataset[id] << date
	else
		dataset[id] = [date]
	end
end

def print_data(smaller_data, bigger_data)
	smaller_data.sort.each do |key, value| 
		if bigger_data.has_key?(key)
			size = bigger_data[key].size + smaller_data[key].size
			puts "#{key} #{size}"
		end
	end
end

while line = gets
	break if line.chomp.empty?
	set_data(line.chomp,$dataset1)
end

while line = gets
	set_data(line.chomp,$dataset2)
end
$dataset1.size < $dataset2.size ? print_data($dataset1,$dataset2) : print_data($dataset2,$dataset1)

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

using namespace std;

typedef long long ll;
typedef long double ld;

#define ff 					first
#define ss 					second
#define sz(x) 				(int)(x).size()
#define all(x) 				begin(x), end(x)
#define rall(x) 			(x).rbegin(), (x).rend() 
#define rsz 				resize
#define ins 				insert 
#define ft 					front() 
#define bk 					back()
#define pf 					push_front 
#define pb 					push_back
#define eb 					emplace_back 
#define lb 					lower_bound 
#define ub 					upper_bound 
#define pqmax				priority_queue<int>
#define pqmin				priority_queue<int,vector<int>,greater<int>>
#define transup(x)			transform(x.begin(),x.end(),x.begin(),::toupper)
#define translow(x)			transform(x.begin(),x.end(),x.begin(),::tolower)
#define rep(i,a,b) 			for (int i = (a); i < (b); ++i)
#define per(i,a,b) 			for (int i = (b)-1; i >= (a); --i)
#define trav(a,x) 			for (auto a: x)

#define setbits(x)  		__builtin_popcountll(x)
#define zerobits(x)			__builtin_ctzll(x)

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

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


int main(){

	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
    auto start = std::chrono::high_resolution_clock::now();
    /*start from here*/
    
    double n,d;
    cin>>n>>d;
    ll cnt=0;
    while(n--){
    	double x,y;
    	cin>>x>>y;
    	double ans = sqrt(x*x + y*y);
    	if(ans<=d){
    		cnt++;
    	}
    }

	cout<<cnt<<'\n'
	;

	auto stop = std::chrono::high_resolution_clock::now(); 
    auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(stop - start); 
    
    // cerr << "Time taken : " << ((long double)duration.count())/((long double) 1e9) <<"s "<< endl;     

    return 0;

    /*STUFF TO LOOK:	
	1. Special cases/corner cases(n==0||n==1)
	2. Variables in loops
	3. Input ranges
	*/
}


Measured memory_bytes: 3768
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <bits/stdc++.h>
using namespace std;
using i32 = int; using i64 = long long int; using f64 = double; using str = string;
template <typename T> using vec = vector<T>;
template <typename T> using heap = priority_queue<T>;
void in() {}; template <typename T, typename...TS> void in(T &&x, TS &&...xs) { cin>>x; in(move(xs)...); };
template <typename T> void _out(const char *sep, const char *end, T &&x) { cout<<x<<end; };
template <typename T, typename...TS> void _out(const char *sep, const char *end, T &&x, TS &&...xs) { cout<<x<<sep; _out(sep, end, move(xs)...); }
#define indef(t, ...) t __VA_ARGS__; in(__VA_ARGS__)
#define get(t) []{ t _; cin >> _; return _; }()
#define put(...) _out("", "", __VA_ARGS__)
#define out(...) _out(" ", "\n", __VA_ARGS__)
#define times(n, i) for (i32 i =  0 ; i <  (n); ++i)
#define range(a, b, i) for (i32 i = (a); i <  (b); ++i)
#define upto(a, b, i) for (i32 i = (a); i <= (b); ++i)
#define downto(a, b, i) for (i32 i = (a); i >= (b); --i)
#define all(xs) (xs).begin(), (xs).end()
#define sortall(xs) sort(all(xs))
#define reverseall(xs) reverse(all(xs))
#define even(x) (((x) & 1) == 0)
#define odd(x) (((x) & 1) == 1)
#define append emplace_back
#define findge lower_bound
#define findgt upper_bound
const i64 MOD = 1000000007;
const f64 EPS = 1e-10;

i64 n;
i64 ans[9];

i32 main()
{
    in(n);
    times(n, i) {
        indef(i64, a);
        i32 k = 0;
        if (400 <= a) {
            k++;
        }
        if (800 <= a) {
            k++;
        }
        if (1200 <= a) {
            k++;
        }
        if (1600 <= a) {
            k++;
        }
        if (2000 <= a) {
            k++;
        }
        if (2400 <= a) {
            k++;
        }
        if (2800 <= a) {
            k++;
        }
        if (3200 <= a) {
            k++;
        }
        ans[k]++;
    }
    i64 minc = 0, maxc = 0;
    times(8, i) {
        if (ans[i] > 0) {
            minc++;
            maxc++;
        }
    }
    if (ans[8] > 0) {
        if (minc == 0) {
            minc = 1;
        }
        maxc += ans[8];
    }
    out(minc, maxc);
    return 0;
}

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

using namespace std;
using llint = long long;
using pint = pair<int,int>;

#define LOG(x) cout << "# " << #x <<" => "<< (x) <<endl

const int INF = 1<<28;
const llint LLINF = 1LL<<60;

int n, ans = INF;
vector<int> w;

int main() {
    // Input
    cin >> n;

    w.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> w.at(i);
    }

    // Solve
    for (int i = 0; i < n; ++i)
    {
        int sum1=0, sum2=0;

        for (int j = 0; j < n; ++j)
        {
            if (j <= i)
            {
                sum1 += w.at(j);
            }else {
                sum2 += w.at(j);
            }
        }

        ans = min(ans, abs(sum2-sum1));
    }

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

Measured memory_bytes: 256
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

#include<bits/stdc++.h>
using namespace std;

#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double db;
typedef long long ll;

const int N=4e5+5;
const int mod=998244353;

ll n,k,dp[N];
pii p[15];
signed main(){
    FastIO;
    cin>>n>>k;
    rep(i,1,k) cin>>p[i].F>>p[i].S;
    dp[0]=1;
    rep(i,1,n){
        dp[i]=(dp[i]+dp[i-1]+mod)%mod;
        rep(j,1,k){
            dp[i+p[j].S+1]=(dp[i+p[j].S+1]-dp[i]+mod)%mod;
            dp[i+p[j].F]=(dp[i+p[j].F]+dp[i])%mod;
        }
    }
    cout<<(dp[n]-dp[n-1]+mod)%mod;
    return 0;
}


Measured memory_bytes: 6596
#include <bits/stdc++.h>
#include <string>
using namespace std;
typedef long long int ll;
typedef double ld;
typedef long double lld;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define pb push_back
#define mp make_pair
#define pi pair<int,int>
#define pl pair<ll,ll>
#define ONLINE_JUDGE
template<class T> T umax(T a,T b) {return (a>b?a:b);}
template<class T> T umin(T a,T b) {return (a<b?a:b);}
template<class T,class P> T umax(T a,P b) {return (a>b?a:b);}
template<class T,class P> T umin(T a,P b) {return (a<b?a:b);}

const ll mod = 1e9+7;

int X[] = {0,1,0,-1,-1,-1,1,1};
int Y[] = {1,0,-1,0,-1,1,-1,1};

ll power(ll a,ll b) {
    ll res = 1;
    while(b) {
        if(b&1) res = (res*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return res;
}

const int maxn = 1e6+1;

int main() {
#ifndef ONLINE_JUDGE
    freopen("planetdistancesmall.in","r",stdin);
    freopen("ans.txt","w",stdout);
#endif
    ios::sync_with_stdio(false);
    // logic
    string s;
    cin >> s;
    int cnt = 0;
    for(int i=0;i<s.length();i++) {
        cnt += s[i] == '+' ? 1 : -1;
    }
    cout << cnt << endl;
#ifndef ONLINE_JUDGE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner kb = new Scanner(System.in);
		int x = kb.nextInt();
		while (!isPrime(x)) {
			x++;
		}
		System.out.println(x);
		kb.close();

	}

	public static boolean isPrime(int x) {
		for (int i = 2; i < x; i++) {
			if (x % i == 0)
				return false;
		}
		return true;

	}
}


Measured memory_bytes: 23764
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<chrono>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;
 
template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " <<to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
 
void solve(){
    int a,b;
    cin>>a>>b;
    int sum=6;
    cout<<sum-a-b<<"\n";
}
 
int main(){
	ios::sync_with_stdio(false);
    cin.tie(0);
	cout<<fixed<<setprecision(15);
	solve();
	return 0;
}

Measured memory_bytes: 256