akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep( i, n ) for (long long i = 0; i < ( long long )(n); i++)

using namespace std;
typedef long long ll;
//typedef pair< ll , string > P;

int main(){
	int  n,r;
	cin>>n>>r;

	if(n<=9) cout<<100*(10-n)+r;
	else cout<<r;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <queue>
#include <math.h>
#include <bitset>
#define INF 100000000000
#define N 1000000007
#define ll long long
using namespace std;

int main(){
    ll n; cin>>n;
    ll count=0;
    for(ll i=1; i<n; i++){
        ll p=(n-1)/i;
        count+=p;
    }
    
    cout<<count<<endl;
}

Measured memory_bytes: 3620
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		FastScanner in= new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int n = in.nextInt();
		int [] a = new int[n];
		for (int i = 0; i < a.length; i++) {
			a[i] = in.nextInt();
		}
		int [] dp = new int[n];
		dp[0] = 0;
		if(n ==1) {
			System.out.println(0);
			return;
		}
		dp[1] = Math.abs(a[1]-a[0]);
		for (int i = 2; i < dp.length; i++) {
			dp[i] = Math.min(dp[i-1] + Math.abs(a[i] - a[i-1]), dp[i-2] + Math.abs(a[i] - a[i-2]));
		}
		System.out.println(dp[n-1]);
	}
	
	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
			st = new StringTokenizer("");
		}

		public String next() throws IOException {
			if (!st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
				return next();
			}
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
		public double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
	}
}
/*
6 4
0 3 4 6 10 12

7 4
0 3 4 6 10 14 16

*/

Measured memory_bytes: 30748
using System;

namespace Testcode
{
    class Program
    {
        static void Main(string[] args)
        {
            

            while (true)
            {
                string[] d = Console.ReadLine().Trim().Split();
                int a = int.Parse(d[0]);
                int b = int.Parse(d[1]);
                
                if (a == 0 && b == 0)
                {
                    break;
                }
                Console.WriteLine("{0} {1}", Math.Min(a, b), Math.Max(a, b));
                
            }
            
        }
    }
}


Measured memory_bytes: 13908
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <string>
#include <iostream>
#include <stack>

using namespace std;

long long knapsack(
    long long capacity,
    const vector<long long> weights,
    const vector<long long> values){
    vector<long long> dp(capacity + 1, 0);
    for(int i = 1; i <= capacity; ++i){
        dp.at(i) = dp.at(i - 1);
        for(int j = 0; j < weights.size(); ++j){
            if(weights.at(j) <= i){
                dp.at(i) = max(
                    dp.at(i),
                    dp.at(i - weights.at(j)) + values.at(j)
                );
            }
        }
    }
    return dp.at(capacity);
}

int main(){
    long long n;
    scanf("%lld\n", &n);
    vector<long long> a(3);
    scanf("%lld %lld %lld\n", &a[0], &a[1], &a[2]);
    vector<long long> b(3);
    scanf("%lld %lld %lld", &b[0], &b[1], &b[2]);

    vector<long long> values(3);

    // A -> B
    for(int i = 0; i < 3; ++i){
        values.at(i) = b.at(i) - a.at(i);
    }
    n += knapsack(n, a, values);

    // B -> A
    for(int i = 0; i < 3; ++i){
        values.at(i) = a.at(i) - b.at(i);
    }
    n += knapsack(n, b, values);

    printf("%lld\n", n);
    return 0;
}

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

def main():
    A,V = map(int,input().split())
    B,W = map(int,input().split())
    T = int(input())
    
    if A < B:
        if W >= V:
            print("NO")
            exit()
        Areach = A + V*T
        Breach = B + W*T
        if Areach < Breach:
            print("NO")
        else:
            print("YES")
    else:
        if W >= V:
            print("NO")
            exit()
        Areach = A - V*T
        Breach = B - W*T
        if Breach < Areach:
            print("NO")
        else:
            print("YES")

if __name__ == "__main__":
    main()

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

using namespace std;

const int N = 1e5 + 10;

int n, a[N], b[N];

int main() {
  scanf("%d", &n);
  int res = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    b[i] = a[i];
  }
  sort(b + 1, b + n + 1);
  int m = unique(b + 1, b + n + 1) - b - 1;
  for (int i = 1; i <= n; i++) {
    a[i] = lower_bound(b + 1, b + m + 1, a[i]) - b;
    if (i & 1) {
      if (!(a[i] & 1)) {
        ++res;
      }
    }
  }
  printf("%d\n", res);
  return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void){

  int a, b;
  int i;
  int arr[3]={1,2,3};
  scanf("%d %d",&a,&b);
  for(i=0;i<3;i++){
    if(arr[i]!=a &&arr[i]!=b){
      printf("%d\n",arr[i]);
      
    }
    


  }
    

    
  
  
  

  return 0;
}


Measured memory_bytes: 128
from collections import Counter,defaultdict,deque
import sys
import bisect
import math
import itertools
import string
import queue
import copy
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
 
def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return [list(map(int, input().split())) for _ in range(n)]

def main():
    n=inp()
    a=inpl()
    ans = 0
    pre = 1
    for i in range(n):
        if a[i]==pre:
            pre+=1
            ans+=1
    if ans==0:
        print(-1)
        return
    print(n-ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 80108
#include <iostream>

using namespace std;



long long a,b,ans,aa,bb,r;

int main()
{
    cin>>a>>b;
    aa=a;
    bb=b;
    while(bb)
    {
        r=aa%bb;
        aa=bb;
        bb=r;
    }
    ans=(a*b)/aa;
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int flag=1;
    int arr[10];
    int k;
    for(int i=0;i<5;i++)cin>>arr[i];
    cin>>k;
    for(int i=0;i<4;i++){
        for(int j=i+1;j<5;j++){
            if(abs(arr[i]-arr[j]) <= k){
                    flag=1;
            }
            else {flag=0;break;}
        }
        if(flag==0)break;
    }
    if(flag==0)cout<<":(\n";
    else cout<<"Yay!\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  string s;
  cin >> s;
  int n=s.size();
  int k;
  cin >> k;
  int ans=0;
  if(n>1){
    if(k==1){
      ans=ans+(n-1)*9;
    }
    else if(k==2){
      ans=ans+(n-1)*(n-2)/2*81;
    }
    else{
      ans=ans+(n-1)*(n-2)*(n-3)/6*729;
    }
  }
  if(k==1){
    ans+=(s[0]-'0');
  }
  if(k==2){
    ans+=(s[0]-'1')*(n-1)*9;
    s.erase(0,1);
    n--;
    while(s[0]=='0'){
      s.erase(0,1);
      n--;
    }
    if(n>=1){
      ans=ans+(n-1)*9;
      ans+=(s[0]-'0');
    }  
  }
  if(k==3){
    ans+=(s[0]-'1')*(n-1)*(n-2)/2*81;
    s.erase(0,1);
    n--;
    while(s[0]=='0'){
      s.erase(0,1);
      n--;
    }
    if(n>1){
      ans=ans+(n-1)*(n-2)/2*81;
      ans+=(s[0]-'1')*(n-1)*9;
    s.erase(0,1);
    n--;
    while(s[0]=='0'){
      s.erase(0,1);
      n--;
    }
    if(n>=1){
      ans=ans+(n-1)*9;
      ans+=(s[0]-'0');
    } 
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
#ifndef ONLINE_JUDGE
    scanf("%lld", &a);
#else
    scanf("%I64d", &a);
#endif
    return a;
}

string m() {
    char a[12];
    scanf("%s", a);
    return a;
}

int main() {
    int n = gi();
    set<string> s;
    string last = m();
    s.insert(last);
    for (int i = 1; i < n; i++) {
        string x = m();
        if (s.find(x) != s.end() || last[last.size()-1] != x[0]) {
            printf("No\n");
            return 0;
        }
        s.insert(x);
        last = x;
    }

    printf("Yes\n");

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
const int MAX=12;

int main()
{
	double e[100001];
	for(int i=0;i<=100000;i++)
		e[i]=0.0;

	e[0]=0.0;
	e[1]=1.0;
	e[2]=1.5;
	double pro[MAX+1],imp[MAX+1];
	pro[0]=1.0;
	for(int i=1;i<=MAX;i++){
		double p=1.0/(1<<(i-1));
		pro[i]=pro[i-1]*p;
		imp[i]=pro[i-1]*(1.0-p);
//		cout<<imp[i]<<endl;
	}

	for(int day=3;day<=100000;day++){
		for(int k=2;k<=min(day,MAX);k++){
			e[day]+=imp[k]*(e[day-k]+k-1);
//			cout<<imp[k]<<" "<<(e[day-k]+k-1)<<endl;
		}
		if(day<MAX)
			e[day]+=pro[day]*day;
//		cout<<e[day]<<endl;
	}
	int n;
	while(cin>>n && n!=0)
		printf("%.3lf\n",e[n]);

	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define brep(i,n) for(int i =n-1;i>=0;i--)
int main(void){
    int ans = 0;
    int n;
    cin >> n;
    int a[n];
    rep(i,n)cin >> a[i];
    rep(i,n-1){
        if(a[i+1] == a[i]){
            ans++;
            i++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline
    n, k = list(map(int, input().rstrip('\n').split()))
    a = list(map(int, input().rstrip('\n').split()))
    import collections
    a = collections.Counter(a).most_common()
    if len(a) < k:
        print(0)
    else:
        cnt = 0
        for i in range(k, len(a)):
            cnt += a[i][1]
        print(cnt)


if __name__ == '__main__':
    main()


Measured memory_bytes: 96844
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
const long long INF = 1LL << 60;
//const int INF = 1e9+5;
int dp[100100];//dp[v] := ノード v を始点としたときの,Gの有効パスの長さの最大値
Graph G;
int N,M;
int rec(int v){
    if(dp[v] != -1) return dp[v];//すでに更新済み
    int res = 0;
    for(auto nv:G[v]) {
        chmax(res,rec(nv)+1);
    }
    return dp[v] = res;
}

//メモ化再帰
int main(){
  cin >> N >> M;
  G.assign(N,vector<int>());
  for(int i=0;i<M;i++){
      int x,y; cin >> x >> y;
      --x,--y;
      G[x].push_back(y);
  }
  for (int v = 0; v < N; ++v) dp[v] = -1;
  int res = 0;
  for(int v = 0;v<N;++v) chmax(res,rec(v));
  cout << res << endl;
}

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

int main(){
    int A, B;
    string S, T, U;
    cin >> S >> T >> A >> B >> U;

    if(U == S){
        A--;
    }
    if(U == T){
        B--;
    }
    cout << A << " " << B;
}


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

#define ll long long int
#define MOD 1000000007

int main()
{
    int t = 1 ;
    //cin >> t ;
    while(t--)
    {
        int n ;
        cin >> n ;
        int a[n] ;
        for(int i = 0 ; i < n ; i++)
        {
            cin >> a[i] ;
        }
        int dp[n] ;
        memset(dp, 0, sizeof(dp)) ;
        dp[0] = 0 ; dp[1] = abs(a[0] - a[1]) ;
        for(int i = 2 ; i < n ; i++)
        {
            dp[i] = min(dp[i-2] + abs(a[i] - a[i - 2]), dp[i-1] + abs(a[i-1] - a[i])) ;
            
        }
        cout << dp[n-1] ;
    }
    return 0 ;
}

Measured memory_bytes: 1024
import java.util.Scanner;

/**
 *
 * @author psygn
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        String str = scanner.nextLine();
        StringBuilder sb = new StringBuilder(str);
        String rev = sb.reverse().toString();
        String ans = "NO";
        int i = 0;
        while (true) {
            if (i == rev.length()) {
                ans = "YES";
                break;
            }
            try {
                if ("esare".equals(rev.substring(i, i+5))) {
                    i += 5;
                } else if ("maerd".equals(rev.substring(i, i+5))) {
                    i += 5;
                }  else if ("resare".equals(rev.substring(i, i+6))) {
                    i += 6;
                } else if ("remaerd".equals(rev.substring(i, i+7))) {
                    i += 7;
                } else {
                    break;
                }
            } catch (Exception e) {
                break;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 28460
from heapq import heappush, heappop
from enum import Enum, auto

INFTY = float('inf')

class Color(Enum):
    WHITE = auto()
    GRAY = auto()
    BLACK = auto()

n = int(input())
adj_list = []
for i in range(n):
    u, k, *kv = list(map(int, input().split(' ')))
    adj_list.append(kv)

colors = []
d = []

def dijkstra(s):
    global d
    colors = [Color.WHITE for i in range(n)]
    d = [INFTY for i in range(n)]
    pque = []
    d[s] = 0

    heappush(pque, (0, s))

    while len(pque) >= 1:
        vert_u = heappop(pque)
        u = vert_u[1]
        colors[u] = Color.BLACK
        if d[u] < vert_u[0]: continue
        i = 0
        while i <= len(adj_list[u])-2:
            v = adj_list[u][i]
            if colors[v] != Color.BLACK:
                if d[u] + adj_list[u][i+1] < d[v]:
                    d[v] = d[u] + adj_list[u][i+1]
                    colors[v] = Color.GRAY
                    heappush(pque, (d[v], v))
            i += 2

dijkstra(0)
for i in range(n):
    print(i, d[i])



Measured memory_bytes: 41604
#include<cstdio>
using namespace std;

int main()
{
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);

    int va = 0, vb = 0, vc = 0;

    int i =0;
    while(a%2 == 0 && b%2 == 0 && c%2 == 0 && i < 100000000) {
        int aa = a / 2;
        int bb = b / 2;
        int cc = c / 2;

        a = bb + cc;
        b = aa + cc;
        c = aa + bb;

        i++;
    }

    if(i >= 100000000) {
        i = -1;
    }

    printf("%d", i);


}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define y1 __zzd001
using namespace std;
const int N=105;
int n,m,ax,ay,bx,by;
char s[N][N];
short g[N][N],dp[N][N][N][N];
short Get(int x1,int y1,int x2,int y2){
	return g[x2][y2]-g[x2][y1-1]-g[x1-1][y2]+g[x1-1][y1-1];
}
short max(short a,short b){
	return a>b?a:b;
}
short DP(int x1,int y1,int x2,int y2){
//	printf("DP %d %d %d %d\n",(int)x1,(int)y1,(int)x2,(int)y2);
	short &v=dp[x1][y1][x2][y2];
	if (~v)
		return v;
	if (x1>x2||y1>y2)
		return v=0;
	short xL=max(x2-bx+1,x1),xR=min(x1+ax-1,x2);
	short yL=max(y2-by+1,y1),yR=min(y1+ay-1,y2);
	return v=max(
			max(DP(x1,y1,x2,y2-1)+((yR==y2)?Get(xL,y2,xR,y2):0),
				DP(x1,y1+1,x2,y2)+((yL==y1)?Get(xL,y1,xR,y1):0)),
			max(DP(x1,y1,x2-1,y2)+((xR==x2)?Get(x2,yL,x2,yR):0),
				DP(x1+1,y1,x2,y2)+((xL==x1)?Get(x1,yL,x1,yR):0)));
}
int main(){
	memset(g,0,sizeof g);
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++)
		scanf("%s",s[i]+1);
	for (int i=1;i<=n;i++)
		for (int j=1;j<=m;j++)
			if (s[i][j]=='o')
				g[i][j]++;
			else if (s[i][j]=='E')
				ax=i,bx=n-i+1,ay=j,by=m-j+1;
	for (int i=1;i<=n;i++)
		for (int j=1;j<=m;j++)
			g[i][j]=g[i][j]+g[i][j-1]+g[i-1][j]-g[i-1][j-1];
	memset(dp,-1,sizeof dp);
	printf("%d",(int)DP(1,1,n,m));
	return 0;
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  __MAKE_TIME__  Problem: __PROBLEM__ / Link: __CONTEST_URL__  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

template<typename Monoid>
struct SegmentTreeFastAry {
	using nd = typename Monoid::type;
	const int ARY_SIZE;
	vector<nd> node;
public:
	SegmentTreeFastAry(int n) : ARY_SIZE(n), node(2 * ARY_SIZE, Monoid::id()) {}
	inline void update(int i, const nd val) {
		i += ARY_SIZE; node[i] = Monoid::upd(node[i], val);
		while (i > 1) { i >>= 1;	node[i] = Monoid::op(node[i << 1], node[(i << 1) + 1]); }
	}
	inline nd query(int l, int r) {
		if (l >= r) return Monoid::id(); nd vl = Monoid::id(), vr = Monoid::id();
		for (l += ARY_SIZE, r += ARY_SIZE; l != r; l >>= 1, r >>= 1) {
			if (l & 1) vl = Monoid::op(vl, node[l++]); if (r & 1) vr = Monoid::op(node[--r], vr);
		}	return Monoid::op(vl, vr);
	}
	nd operator[](int i) { return node[i + ARY_SIZE]; }
	void debugShow() { for (int i = ARY_SIZE; i < ARY_SIZE << 1; ++i) cerr << node[i] << " "; cerr << "\n"; }
};

struct Sum {
	using type = LL;
	static type id() { return 0; }
	static type op(const type&l, const type&r) {
		return (l + r);
	}
	static type upd(const type&l, const type&r) {
		return r;
	}
};
int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);

	int N, K; cin >> N >> K;
	vector<int> a(N);
	FOR(i, 0, N) {
		cin >> a[i];
	}
	SegmentTreeFastAry<Sum> seg(N);
	FOR(i, 0, N) {
		seg.update(i, a[i]);
	}
	LL ans = 0;
	vector<LL>subs;
	FOR(l, 0, N) {
		FOR(r, 0, N) {
			subs.push_back(seg.query(l, r + 1));
		}
	}
	N = int(subs.size());
	for (int i = 60; i >= 0; i--) {
		vector<LL> X;
		for (auto&r : subs) {
			if (r&(1LL << i)) {
				X.push_back(r);
				r ^= 1LL << i;
			}
		}

		if (X.size() >= K) subs = X;
	}

	cout << subs[0] << endl;

	return 0;
}


Measured memory_bytes: 10476
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()
janken = ['' for i in range(K)]
for i in range(N):
    amari = i % K
    janken[amari] = janken[amari] + T[i]
#print(janken)
count = 0
for i in range(K):
    lenN = len(janken[i])
    now = 1
    jan = janken[i][0]
    for j in range(1,lenN):
        if janken[i][j-1] == janken[i][j]:
            now += 1
        elif janken[i][j-1] != janken[i][j]:
            sho = (now + 1) // 2
            if jan == 'r':
                count += sho * P
            elif jan == 's':
                count += sho * R
            elif jan == 'p':
                count += sho * S
            now = 1
            jan = janken[i][j]
    sho = (now + 1) // 2
    if jan == 'r':
        count += sho * P
    elif jan == 's':
        count += sho * R
    elif jan == 'p':
        count += sho * S
print(count)

Measured memory_bytes: 6260
n = int(input())
a = []
for _ in range(n):
    a.append(int(input()))

c = [0] * n
d = [0] * n

i = 0
for j in range(n):
    c[j] = i
    i = max(i, a[j])
i = 0
for j in reversed(range(n)):
    d[j] = i
    i = max(i, a[j])

for i in range(n):
    print(max(c[i],d[i]))

Measured memory_bytes: 72664
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// ここまで

fn run() {
    input! {
        n: usize,
        v: [i32; n],
    }
    let mut v = v;
    v.sort();
    let mut ans = (v[0] + v[1]) as f64 * 0.5;;
    for &v in v[2..].iter() {
        ans = (ans + v as f64) * 0.5;
    }
    println!("{:.6}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 4352
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define PI 3.14159265358979323846
#define int64 long long
#define uint64 unsigned long long
#define coutfix(i) cout << fixed << setprecision(i)		//coutの浮動小数出力の桁数設定
using namespace std;

int main()
{
	int64 nn, one = 0, ans = 0, memo = 1;
	cin >> nn;
	vector<int64> aa(nn);
	for(int64 ii = 0;ii < nn;ii++)
	{
		cin >> aa[ii];
		if(aa[ii] == 1)
		{
			one = 1;
		}
	}
	if(one == 0)
	{
		cout << -1 << endl;
		return 0;
	}
	for(int64 ii = 0;ii < nn;ii++)
	{
		if(memo == aa[ii])
		{
			memo++;
		}
		else
		{
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
  int N,M;
  cin>>N>>M;
  vector<pair<int,int>> A(M);
  REP(i,M) cin>>A[i].se>>A[i].fi;
  sort(ALL(A));
  int ans = 0;
  pair<int,int> m;
  REP(i,M) {
    int a = A[i].se;
    int b = A[i].fi;
    if (ans == 0) {
      ans++;
      m = make_pair(b-1,b);
    }
    else {
      if (m.fi >= a && m.se <=b) ;
      else {
        ans++;
        m = make_pair(b-1,b);
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    vector<int> len(n);
    int x = 1;
    rep(i, n){
        len[i] = x++;

        if(a[i] > a[i+1]){
            x = 1;
        }
    }

    set<int> s;
    rep(i, k){
        s.insert(a[i]);
    }

    int ans = 1;
    if(len[k-1] >= k){
        ans--;
    }

    for(int i = k; i < n; i++){
        bool ok = false;
        if(a[i-k] > *s.begin()){
            ok = true;
        }
        s.erase(a[i-k]);

        auto it = s.end();
        it--;
        if(a[i] < *it){
            ok = true;
        }
        s.insert(a[i]);

        if(ok && len[i] < k){
            ans++;
        }
    }

    int eq = 0;
    rep(i, n){
        if(len[i] >= k){
            eq++;
        }
    }

    if(eq > 0){
        ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 12800
#include <iostream>

using namespace std;

int dp[31];

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

    dp[0] = 1;
    for(int i = 1; i <= 30; ++i) {
        for(int j = 1; j <= 3; ++j) {
            if(i-j >= 0) dp[i] += dp[i-j];
        }
    }

    while(true) {
        int N;
        cin >> N;
        if(!N) break;
        cout << (dp[N]+3650-1)/3650 << endl;
    }
    return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
#define M 210
#define N 5100
#define ll long long
const int bnd = 200;
int n,m,top;
int a[N],b[M][N],st[N],L[M][N],R[M][N];
ll sum[N],tr[N][N],ans;
void insert(int x,int y,int v)
{
	for(int i=x;i;i-=i&-i)
		for(int j=y;j;j-=j&-j)
			tr[i][j]+=v;	
}
ll query(int x,int y)
{
	ll ret=0;
	for(int i=x;i<=n;i+=i&-i)
		for(int j=y;j<=n;j+=j&-j)
			ret+=tr[i][j];
	return ret;
}
int main()
{
	//freopen("tt.in","r",stdin);
	scanf("%d%d",&n,&m);
	for(int i=1;i<n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			scanf("%d",&b[j][i]);
	for(int i=1;i<=m;i++)
	{
		top=0;st[top]=0;
		for(int j=1;j<=n;j++)
		{
			while(top&&b[i][j]>b[i][st[top]])top--;
			L[i][j]=st[top]+1;
			st[++top]=j;
		}
		top=0;st[top]=n+1;
		for(int j=n;j>=1;j--)
		{
			while(top&&b[i][j]>=b[i][st[top]])top--;
			R[i][j]=st[top]-1;
			st[++top]=j;
		}
	}
	for(int i=1;i<=m;i++)
		for(int j=1;j<=n;j++)
			if((j-L[i][j]+1)*(R[i][j]-j+1)>=bnd)
			{
				insert(j,R[i][j],b[i][j]);
				insert(L[i][j]-1,j-1,b[i][j]);
				insert(L[i][j]-1,R[i][j],-b[i][j]);
				insert(j,j-1,-b[i][j]);
			}
	for(int i=1;i<=n;i++)
		for(int j=i;j<=n;j++)
			tr[i][j]=query(i,j);
	for(int i=1;i<=m;i++)
		for(int j=1;j<=n;j++)
			if((j-L[i][j]+1)*(R[i][j]-j+1)<bnd)
			{
				for(int k=L[i][j];k<=j;k++)
					for(int w=j;w<=R[i][j];w++)
						tr[k][w]+=b[i][j];
			}
	for(int i=1;i<n;i++)
		sum[i]=sum[i-1]+a[i];
	for(int i=1;i<=n;i++)
		for(int j=i;j<=n;j++)
			ans=max(ans,tr[i][j]-(sum[j-1]-sum[i-1]));
	printf("%lld\n",ans);
	return 0;
}


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

int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { 
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main() {
  int N;
  cin >> N;
  int sum = findSumOfDigits(N);
  if(N % sum == 0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
#ifdef LOCAL_TEST
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i, h) cin >> s[i];
    int cnt = 0;
    rep(i, h) rep(j, w) if(s[i][j] == '#') cnt++;
    string yes = "Possible", no = "Impossible";
    cout << (cnt == h + w - 1 ? yes : no) << endl;
    return 0;
}

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

int digitsum(int N) {
	int res = 0;
	while (N > 0) {
		res += N % 10;
		N /= 10;
	}
	return res;
}

int main(){
	int N;
	cin >> N;
	cout << (N % digitsum(N) == 0 ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
// </> : towhid1zaman

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair< int, int > pii;
typedef vector<pii>vip;
typedef pair< pii, int > ppi;
#define fill(a,b) memset(a,b,sizeof(a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define unq(v) sort(all(v)),(v).erase(unique(all(v)),(v).end())
#define _ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define sqr(a) ((a)*(a))
#define sz(a) int(a.size())
#define ff first
#define ss second
#define pb push_back

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int inf = 0x3f3f3f3f;// (int)3e18;
const int maxn = 2000100;



int main(){
        _
        char s; cin >> s;
        if(s>='A' and s<='Z'){
            cout<<'A'<<endl;
        }
        else cout<<'a'<<endl;

return 0;
}




Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>

#define X first
#define Y second
#define vsort(v) sort((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())

// stoi(s): string to int
// stod(s): string to double

// INT_MAX
// INT_MIN
// LLONG_MAX
// LLONG_MIN
// DBL_MIN
// DBL_MAX
// LDBL_MIN
// LDBL_MAX

// A-Z: 65~90
// a-z: 97~122
// |a-z| = 26

using namespace std;
using ll = long long;

int main(int argc, const char * argv[]) {
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    
    int dp[n];
    dp[0] = 0;
    dp[1] = abs(v[0] - v[1]); 
    
    int a, b;
    for (int i = 2; i < n; i++) {
        a = dp[i-1] + abs(v[i] - v[i-1]);
        b = dp[i-2] + abs(v[i] - v[i-2]);
        if (a < b) {
            dp[i] = a;
        }else{
            dp[i] = b;
        }
    }
//    for (int i = 0; i < n; i++) {
//        cout << dp[i] << " ";
//    }
//    cout << endl;
    cout << dp[n-1] << endl;
}


Measured memory_bytes: 1152
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
typedef unsigned int ui;
struct edge { int from, to, cost; };
int main() {
	int d[100][100];
	int v, e,a,b,c;
	vector<edge> G;
	cin >> v >> e;
	int i, j, k;
	for (i = 0; i < v; i++) {
		for (j = 0; j < v; j++) {
			if (i == j)d[i][j] = 0;
			else d[i][j] = MOD;
		}
	}
	for (i = 0; i < e; i++) {
		cin >> a >> b >> c;
		a--; b--;
		d[a][b] = c; d[b][a] = c;
		G.push_back({ a,b,c });
	}
	for (k = 0; k < v; k++) {
		for (i = 0; i < v; i++) {
			for (j = 0; j < v; j++) {
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
	int sum = 0;
	for (i = 0; i < e; i++) {
		if (G[i].cost > d[G[i].from][G[i].to])sum++;
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <iterator>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)

struct MyStruct {
	int idx, a, b, pl;
};

bool comp(const MyStruct& s, const MyStruct& t) {
	if (s.pl != t.pl)
		return s.pl > t.pl; // 降順
	return s.idx < t.idx;
}


int main() {
	int t, x;
	cin >> t >> x;
	double ans;
	ans = t*1.0 / x;
	ANS(ans);


	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define fir first
#define sec second
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

string S;
ll memo = -2;
ll dist[100001] = {}, num[100001] = {};

int main() {
	cin >> S;
	for (int i = 0; i < S.size(); i++) {
		if (i > 0 && S[i] == 'L' && S[i - 1] == 'R') {
			for (int j = i - 1; j >= memo + 2; j--) {
				if (S[j] == 'R') {
					dist[j] = i - j - 1;
				}
				else {
					break;
				}
			}
			memo = i - 1;
		}
		if (S[i] == 'L')dist[i] = i - memo;
	}
	for (int i = 0; i < S.size(); i++) {
		if (dist[i] % 2 == 0) {
			if (S[i] == 'R') {
				num[i + dist[i]]++;
			}
			else {
				num[i - dist[i]]++;
			}
		}
		else {
			if (S[i] == 'R') {
				num[i + dist[i] + 1]++;
			}
			else {
				num[i - dist[i] + 1]++;
			}
		}
	}
	for (int i = 0; i < S.size(); i++)cout << num[i] << endl;
	return 0;
}

Measured memory_bytes: 2176
from heapq import heappush, heappop

X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
cand = []

for i in range(len(A)):
    for j in range(len(B)):
        if(i * j > K):
            break
        for k in range(len(C)):
            if(i *  j * k > K):
                break
            heappush(cand, A[i]+B[j]+C[k])
            if(len(cand) > K):
                heappop(cand)

ret = []
for i in range(K):
    ret.append(heappop(cand))

for i in reversed(range(K)):
    print(ret[i])
    


Measured memory_bytes: 58204
import operator

class Tree:
    """??¨????????????"""

    def __init__(self, node_num):
        self.node_num = node_num
        self.node_list = list()
        self.root_node = -1

    def set_tree(self):
        for _ in range(self.node_num):
            input_str = [int(i) for i in input().split()]
            node_tmp = Node(input_str[0], input_str[1], input_str[2:])
            self.node_list.append(node_tmp)
        self.node_list.sort(key=operator.attrgetter('id'))

    def set_node_element(self):
        for tn in self.node_list:
            if tn.children is not None:
                for child in tn.children:
                    self.node_list[child].parent = tn.id
                    if self.node_list[child].degree == 0:
                        self.node_list[child].type = 'leaf'
                    else:
                        self.node_list[child].type = 'internal node'
        self.set_root()
        self.set_depth(self.node_list[self.root_node])

    def set_depth(self, node, dep = -1):
        node.depth = dep + 1
        for child in node.children:
            self.set_depth(self.node_list[child], node.depth)

    def set_root(self):
        for tn in self.node_list:
            if tn.type == 'root':
                self.root_node = tn.id
                break

    def show_tree(self):
        for tn in self.node_list:
            print('node {0}: parent = {1}, depth = {2}, {3}, {4}'.format(tn.id, tn.parent, tn.depth, tn.type, tn.children))


class Node:
    """?????????????????????"""

    def __init__(self, id, degree, children):
        self.id = id
        self.degree = degree
        self.children = children
        self.parent = -1
        self.depth = 0
        self.type = 'root'

if __name__ == '__main__':
    n = int(input())
    tree = Tree(n)
    tree.set_tree()
    tree.set_node_element()
    tree.show_tree()

Measured memory_bytes: 49564
use proconio::input;

fn main() {
    input! {
        n: usize,
        k: usize,
        a: [i64; n],
    }

    // let mut points = vec![];
    // let mut now: i64 = 1;
    // for i in 0..n {
    //     now *= a[i];
    //     if
    // }
    //
    for i in 0..(n - k) {
        if a[i] < a[i + k] {
            println!("Yes");
        } else {
            println!("No");
        }
    }
}


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

int main()
{
    int a[10],i,j,k,temp;
    for(i=0;i<10;i++)
      scanf("%d",&a[i]);
    for(i=1;i<10;i++)
    {
        temp=a[i];
        j=i-1;
        while(temp<a[j] && (j>=0))
        {
            a[j+1]=a[j];
            j=j-1;
        }
        a[j+1]=temp;
    }
     for(i=9;i>=7;i--)
      printf("%d\n",a[i]);


    return 0;
}

Measured memory_bytes: 600
N, M = map(int, input().split())

if N >= M:
    print(0)
else:
    X = list(map(int, input().split()))
    X.sort()

    diff = []

    for i in range(1, M):
        diff.append(X[i] - X[i - 1])
    diff.sort(reverse=True)

    print(sum(diff[N-1:]))


Measured memory_bytes: 13968
#include<stdio.h>

int main(){
  int i,N;
  double ans=0.0,tmp;
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%lf",&tmp);
    ans+= (1.0/tmp);
  }
  printf("%lf\n",1/ans);
  return 0;
}

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

int main(){
int count=0;
string S;
cin >> S;

    if(S.at(0)==S.at(1)&&S.at(2)==S.at(3)&&S.at(0)!=S.at(2)){
            count = 1;
    }
    if(S.at(0)==S.at(2)&&S.at(1)==S.at(3)&&S.at(0)!=S.at(1)){
            count = 1;
    }
    if(S.at(0)==S.at(3)&&S.at(1)==S.at(2)&&S.at(0)!=S.at(1)){
            count = 1;
    }
    if(count==1){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

}


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

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

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();

            int[] cnt = new int[n];
            for (int i = 0; i < m; i++) {
                int a = in.nextInt() - 1;
                int b = in.nextInt() - 1;

                cnt[a]++;
                cnt[b]++;
            }

            for (int i = 0; i < n; i++) {
                out.println(cnt[i]);
            }
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 21460
#include <stdio.h>          // printf(), scanf()
#include <stdbool.h>
#include <limits.h>         // INT_MAX

#define min(a, b) ((a) < (b) ? (a) : (b))

int
main(int argc, char **argv)
{
	int i, j, k;

	while (true)
	{
		int amount;
		scanf("%d", &amount);
		if (amount == 0)
			break;

		int min_price = INT_MAX;
		int n2 = amount / 500;
		for (k = 0; k <= n2; ++k)
		{
			int r2 = amount - 500 * k;
			int n1 = r2 / 300;
			for (j = 0; j <= n1; ++j)
			{
				int r1 = r2 - 300 * j;
				i = r1 / 200;
				if (r1 % 200 == 0)
				{
					int price = 2244 * (k / 3) + 850 * (k % 3) + 1870 * (j / 4) + 550 * (j % 4) + 1520 * (i / 5) + 380 * (i % 5);
					min_price = min(min_price, price);
				}
			}
		}

		printf("%d\n", min_price);
	}

	return 0;
}

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

int main(){
  string s;
  cin>>s;
  if(s[0]=='S')cout<<"Cloudy"<<endl;
  if(s[0]=='C')cout<<"Rainy"<<endl;
  if(s[0]=='R')cout<<"Sunny"<<endl;
  
  return 0;
}

Measured memory_bytes: 3608
#pragma GCC Optimize("Ofast")
#pragma GCC Optimize "trapv"
#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> 

using namespace std;
//using namespace boost::multiprecision; 

#define FAST ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define TC int t; cin >> t; while(t--)
#define li long int
#define ll long long
#define ull unsigned long long 
#define Vec(x) vector <x>
#define Pai(x,y) pair <x,y>
#define Map(x,y) map <x,y>
#define UMap(x,y) unordered_map <x,y>
#define Set(x) set <x>
#define Sta(x) stack <x>
#define Qu(x) queue <x>
#define DQ(x) deque(x)
#define PriorQ(x)	priority_queue <x>
#define bg begin()
#define ed end()
#define sz size()
#define ct(x) count(x)
#define len length()
#define F first
#define S second
#define Makep make_pair
#define ins(x) insert(x)
#define ers(x) erase(x)
#define endl "\n";
#define MOD 1000000007
#define PI 2*acos(0.0)
#define clr() clear()
#define fori0(n) for(int i=0;i<n;i++)
#define foriab(a,b) for(int i=a;i<b;i++)
#define mem0(x) memset(x,0,sizeof(x))
#define mem1(x) memset(x,1,sizeof(x))
#define autoit(x) for(auto it=x.beg;it!=x.ed;it++)
#define count0(x) __builtin_popcount(x)
#define ret return 
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());

const ll Inf=1e9+5;

ll a[100005],freq[1000006],mx=INT_MIN;

namespace funset{
bool checkvow(char x){
	return ((0x208222)>>(x&(0x1f)))&1;
	}
ll highpow2(ll x){
	return (x&~(x-1));
	}
bool chk2(ll x){
		return (x&(x-1));
	}	
}

using namespace funset;

ll n, w;
ll wei[101],val[101],dp[1001][10001];


void solve(){
	ll n, d;
	cin >> n >> d;
	ll ans=0;
	while(n--){
		ll x,y;
		cin >> x >> y;
		if((x*x)+(y*y)<=(d*d))
			ans++;
	}
	cout << ans << endl;
}

int main(){
	auto beg=clock();
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif	
	FAST
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    solve();
	auto ted=clock();
	#ifndef ONLINE_JUDGE
	cout << (double)(ted-beg)/CLOCKS_PER_SEC << endl;
	#endif
	ret 0;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

int main()
{
    ll x,y;
    cin>>x>>y;

    ll t=x,v=0;
    for(;t<=y;t*=2){
        v++;
    }
    cout<<v<<endl;
    
	return 0; 
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int A[101][101]={{},{}},r,c,i,j;
  scanf("%d%d",&r,&c);
  for(i=0;i<r;i++)
    {
      for(j=0;j<c;j++)
	{
	  scanf("%d",&A[i][j]);
      A[i][c]+=A[i][j];
      A[r][j]+=A[i][j];
      A[r][c]+=A[i][j];
	}
    }
  
  for(i=0;i<=r;i++)
    {
      for(j=0;j<=c;j++)
	{
	  printf("%d",A[i][j]);
	  if(j!=c){printf(" ");}
	}
      printf("\n");
    }

  return 0;
}

Measured memory_bytes: 652
n, q = map(int, input().split())
A = [set([]) for _ in range(n+1)]
for _ in range(n-1):
    a, b = map(int, input().split())
    A[a].add(b)
C = [0]*(n+1)
for _ in range(q):
    p, x = map(int, input().split())
    C[p] += x
for i in range(1, n+1):
    c = C[i]
    for a in A[i]:
        C[a] += c
print(*C[1:])

Measured memory_bytes: 78112
#include <bits/stdc++.h>
#define int long long
#define mod 1000000007
using namespace std;

int fac[100000+1]; 

void fact()
{
    fac[0] = 1; 
    for (int i=1 ; i<=100000 ; i++) 
        fac[i] = fac[i-1]*i%mod;  
}

int power(int x, int y, int p) 
{ 
    int res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or 
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 

int modInverse(int n, int p) 
{ 
    return power(n, p-2, p); 
} 

int nCrModPFermat(int n, int r, int p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
  
    // Fill factorial array so that we 
    // can find all factorial of r, n 
    // and n-r 
    //int fac[n+1]; 
     
  
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
} 


signed main() {
    int n,k;
    cin>>n>>k;
    int arr[n];
    fact();
    
    for (int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    if (k==1)
    {
        cout<<0<<endl;
        return 0;
    }
    int sum=0;
    sort(arr,arr+n);
    int a=k-1;
    for (int i=0;i<=n-k;i++)
    {
        
            int x=((arr[i])*nCrModPFermat(n-1-i,a,mod))%mod;
            sum=(sum+x)%mod;
            
        
    }
    int sum1=0;
    for (int i=k-1;i<n;i++)
    {
        int x=(arr[i]*nCrModPFermat(i,a,mod))%mod;
        sum1=(sum1+x)%mod;
        
        
    }
    cout<<(sum1-sum+mod)%mod<<endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
    string str1, str2 = "abcdefghijklmnopqrstuvwxyz";
    char ch ;
    vector<int> counter(26);
    
    while(cin >> ch){
        //scanf("%c", &ch);
        //if (ch == '\n'){
         //   break;
        if (ch >= 'A' && ch <= 'Z'){
            ch = ch +32;
        }
        if (ch >= 'a' && ch <= 'z'){
            counter.at(ch - 'a') += 1;
        }
    }for (int i=0; i<str2.size(); i++){
        cout << str2.at(i) << " : " << counter.at(i) << endl;
    }
    return 0;
}


Measured memory_bytes: 3216