akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#define FREE 0
#define N_FREE 1
#define Q 2
#define N 8
 
int board[N][N];
int row[N],col[N];
int dneg[2 * N-1],dpos[2 * N-1];


void printboard();
void putQueen(int);


int main(){

  
  int i;
  int k,r,c;

  
  scanf("%d",&k);
  
  for(i=0;i<k;i++){
    scanf("%d",&r);
    scanf("%d",&c);
    board[r][c] = N_FREE; 
  }
   
  putQueen(0);
      
  return 0;
  
}

void printboard(){

  int i, j;
  
  for(i = 0; i < N; i++){
    for(j = 0; j < N; j++){
      if(board[i][j] == N_FREE && row[i] != j)
    return;
    }
  }
  
  for(i = 0; i < N; i++){
    for(j = 0; j < N; j++){
      if(row[i] == j){
	printf("Q");
      }
      else{
	printf(".");
      }
    }
    printf("\n");
  }
}

void putQueen(int i){
  
  int j;
   
  if(i == N){
    
    printboard();
    return;

  }
 
  for(j = 0;j < N;j++){
    if(col[j] == N_FREE || dpos[i + j] == N_FREE || dneg[i - j + N - 1] == N_FREE){ 
      continue;
    }
 
    row[i] = j;
    col[j] = dpos[i + j] = dneg[i - j + N - 1] = N_FREE; 
 
    putQueen(i + 1);
     
   
   
    col[j] = dpos[i + j] = dneg[i - j + N - 1] = FREE;
     
 
  }
}

Measured memory_bytes: 572
a = list(input())
b = list(input())
c = list(input())

next = 'a'
while True:
    if next == 'a':
        if a == []:
            print('A')
            break
        else:
            next = a.pop(0)
    elif next == 'b':
        if b == []:
            print('B')
            break
        else:
            next = b.pop(0)
    if next == 'c':
        if c == []:
            print('C')
            break
        else:
            next = c.pop(0)


Measured memory_bytes: 38256
#include <iostream>

using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    int city_count[N];
    for(int i = 0; i < N; i++) city_count[i] = 0;

    int city_a, city_b;
    for(int i = 0; i < M; i++){
        cin >> city_a >> city_b;
        city_count[city_a - 1] += 1;
        city_count[city_b - 1] += 1;
    }
    for(int i = 0; i < N; i++){
        cout << city_count[i] << endl;
    }
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
int mod = 1000000000+7;

int main(){

	ll n,m;
	cin>>n>>m;

	ll ans=0;
	if(n/2>=m)ans=m/2;
	else {
		ans+=min(n,m/2);
		m-=2*n;
		if(m>0)ans+=m/4;
	}

	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;


int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  vector<pair<int, int>> ans;
  rep(i, n) cin >> a.at(i);
  int mx = max_element(ALL(a)) - a.begin() , mn = min_element(ALL(a)) - a.begin();
  cout << n+n-1 << endl;
  if(abs(*max_element(ALL(a))) > abs(*min_element(ALL(a)))){
    rep(i, n){
      cout << mx+1 << " " << i+1 << endl;
    }
    rep(i, n-1){
      cout << i+1 << " " << i+2 << endl;
    }
  }else{
    rep(i, n){
      cout << mn+1 << " " << i+1 << endl;
    }
    rrep(i, n-1){
      cout << i+2 << " " << i+1 << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long hp = sc.nextLong();
		System.out.println(at(hp));
	}

	static long at(long hp) {
		if(hp==1) return 1;
		return 2*at((long)hp/2)+1;
	}
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){

           int x,y;
            cin>>x>>y;

              int c=0;

            for(int i=0;i<=x;i++){

                if((2*i + (x-i)*4)==y)
                 {c++;break;}
            }
             if(c > 0)
             cout<<"Yes";

              else
            cout<<"No";
}


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

const int INF = 10000000;

typedef pair<int, int> P;

char maze[50][50];
int N, M;
int sx, sy;
int gx, gy;

int d[50][50];

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

int bfs() {

	queue<P> que;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) d[i][j] = INF;
	}

	que.push(P(sx, sy));
	d[sx][sy] = 0;

	while (que.size()) {
		P p = que.front(); que.pop();

		if (p.first == gx && p.second == gy)break;

		for (int i = 0; i < 4; i++) {

			int nx = p.first + dx[i], ny = p.second + dy[i];

			if (0 <= nx && nx < N && 0 <= ny && ny < M&&maze[nx][ny] != '#'&&d[nx][ny] == INF) {
				que.push(P(nx, ny));
				d[nx][ny] = d[p.first][p.second] + 1;
			}

		}
	}
	return d[gx][gy];
}


int main() {
	cin >> N >> M;
	int all=N*M-1;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			cin >> maze[i][j];
			if(maze[i][j]=='#')all--;
		}
	}
	
	sx=0;sy=0;
	gx=N-1;gy=M-1;
	int res = all-bfs();
	if(res>=0)cout << res << endl;
	else cout<< -1 <<endl;
}

Measured memory_bytes: 256
l = input().split()
a = int(l[0])
b = int(l[1])
c = int(l[2])

if b <= a <= c :
    print(f"{b} {a} {c}")
elif a <= c <= b:
    print(f"{a} {c} {b}")
elif c <= b <= a:
    print(f"{c} {b} {a}")
elif b <= c <= a :
    print(f"{b} {c} {a}")
else:
    print(f"{a} {b} {c}")


Measured memory_bytes: 5604
# Your code here!
while True:
    H,W = map(int, input().split())
    if H == 0 and W == 0:
        break
    else:
        for i in range(H):
            for j in range(W):
                if j == W-1:
                    print("#")
                else:
                    print("#",end="")
    
        print()


Measured memory_bytes: 7036
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n;
    int y;
    vector<int> ans(3,-1);
    cin>>n>>y;
    for(int i=0;i<=y/10000;i++){
        for(int j=0;j<=(y-10000*i)/5000;j++){
            int k = (y-(10000*i + 5000*j))/1000;
            if(i+j+k == n){
                ans.at(0)=i;
                ans.at(1)=j;
                ans.at(2)=k;
                break;
            }
        }
    }
    cout<<ans.at(0)<<' '<<ans.at(1)<<' '<<ans.at(2);

}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int main()
{
      string n;
      cin >> n;
      string ans;
      for(int i=0; i < 3; i++){
        if(n[i] == '1'){
          ans += '9';
        }else{
          ans += '1';
        }
      }
      cout << ans << endl;
}


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

#define nl '\n'

using namespace std;

typedef long long ll;

void solve() {
  int D, T, S;
  cin >> D >> T >> S;
  
  cout << (S*T >= D ? "Yes" : "No");
}

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

  // int t;
  // cin >> t;
  // while (t--) {
  solve();
  // cout << nl;
  // }

  return 0;
}

Measured memory_bytes: 3612
import math
n,d = map(int,input().split())
a = [list(map(int,input().split())) for hoge in range(n)]
ans = -n
for b in a:
  for c in a:
    k = 0
    s = 0
    while k < d:
      s += (b[k]-c[k])**2
      k += 1
    poge = math.sqrt(s)
    if poge%1 == 0:
      ans += 1
print(ans//2)

Measured memory_bytes: 3064
A,B=map(int,input().split())

mat=[]
for i in range(100):
  array=["."]*50+["#"]*50
  mat.append(array)

for i in range(B-1):
  j=2*(i//25)
  k=2*(i%25)
  mat[j][k]="#"
for i in range(A-1):
  j=2*(i//25)
  k=2*(i%25)+51
  mat[j][k]="."
  
print(100,100)
for i in range(100):
  print("".join(mat[i]))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define forn(i, a, b) for (int i=a; i<(signed)(b); ++i)
#define pb push_back
 
 
// debug templates 
#define debug(x)       cerr<< #x <<" : "<< x << endl;
#define debuga(A,N)    cerr<< #A <<" : [";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
#define debuga2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}
#define debugp(p)      cerr<< #p <<" : "<<"("<<(p).first<<","<<(p).second<<")\n";
#define debugv(v)      cerr<< #v <<" : "<<"[";for(int i = 0; i< (v).size(); i++) cerr<<v[i]<<" "; cerr<<"]\n";
#define debugv2(v)     cerr<< #v << " : \n"; for(int i=0;i<v.size();i++){cerr<<"[";for(int j=0;j<(v[0].size());++j) cerr<<v[i][j]<<" ";cerr<<"]\n";}
#define debugs(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin(); itr!=m.end();itr++) cerr<<*itr<<" "; cerr<<"]\n";
#define debugm(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin();itr!=m.end(); itr++) cerr<<"("<<itr->first<<","<<itr->second<<") ";cerr<<"]\n";
 

void solve(){
	ll n; cin >> n;
	string ans = "";
	while(n){
		ans = (char)(((n%26) - 1 + 26)%26 + 'a') + ans;
		if(ans[0] == 'z') --n;
		n/=26;
	}
	cout << ans;
}
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	solve();
	return 0;
}
 


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

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

using namespace std;

int main(){
  ll n,k;cin>>n>>k;
  ll a[n];rep(i,n){cin>>a[i];}

  ll result=0;
  rep(i,42){
    int d = i-1;
    if( d!=-1 && !(k & (1LL<<d)) )continue;

    ll tmp=0;
    rep(j,41){
      ll e=j;
      ll mask = 1LL<<e;
      ll num=0;
      rep(i,n)if(mask & a[i])num++;

      if(e>d){
        if(k & mask) tmp += mask*(n-num);
        else tmp += mask*num;
      }else if(e==d){
        tmp += mask*num;
      }else{
        tmp += mask*max(num, n-num);
      }
    }
    result = max(result, tmp);
  }

  cout<<result;

  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

using namespace std;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    string S;
    cin >> S;
    int N = S.size();
    ll ans = 0 ;
    for(int i=0;i<(1<<(N-1));i++){
        string t = S;
        int cnt = 0;
        for(int j=0;j<N-1;j++){
            if( (i>>j) & 1){
                // もしも j bit目に1があったら + を入れる
                t.insert(t.begin()+j+1+cnt,'+');
                cnt++;
            }else{
            }
        }
        stack<ll> st;
        rep(a,t.size()){
            if(t[a]!='+')st.push(t[a]-'0');
            else {
                ll digit = 1;
                while(!st.empty()){
                    ans += digit * st.top();
                    st.pop();
                    digit *= 10;
                }
            }
        }
        ll digit = 1;
        while(!st.empty()){
            ans += digit * st.top();
            st.pop();
            digit *= 10;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

struct UnionFind {
    v: Vec<usize>,
}

impl UnionFind {
    fn new(n: usize) -> UnionFind {
        let mut v = vec![];
        for i in 0..n {
            v.push(i);
        }
        UnionFind { v: v }
    }

    fn find(&mut self, i: usize) -> usize {
        if self.v[i] == i {
            i
        } else {
            let ni = self.v[i];
            self.v[i] = self.find(ni);
            self.v[i]
        }
    }

    fn union(&mut self, i: usize, j: usize) {
        let ni = self.find(i);
        let nj = self.find(j);
        self.v[ni] = nj;
    }
}

fn main() {
    input! {
        n: usize,
        m: usize,
        es: [(usize1, usize1); m],
    }

    let mut dpairs = n * (n - 1) / 2;
    let mut ans = vec![];

    let mut uf = UnionFind::new(n);
    let mut sizes = vec![1; n];

    for (u, v) in es.into_iter().rev() {
        ans.push(dpairs);
        if uf.find(u) != uf.find(v) {
            let su = sizes[uf.find(u)];
            let sv = sizes[uf.find(v)];
            uf.union(u, v);
            sizes[uf.find(u)] = su + sv;
            dpairs -= su * sv;
        }
    }

    ans.reverse();

    for a in ans {
        println!("{}", a);
    }
}


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

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

    vector<int> vec;
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int p;
        cin>>p;
        vec.push_back(p);
    }
    sort(vec.begin(),vec.end(),greater<int>());
    
    cout<<abs(vec[n/2]-vec[(n-1)/2])<<endl;
}

Measured memory_bytes: 892
#include <iostream>
using namespace std;
int h, w;
int a[80][80], b[80][80];
bool dp[80][80][80*80*2+1];
int const mx = 80*80*2;
int const hf = 80*80;

int main(void){
    cin >> h >> w;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin >> a[i][j];
        }
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin >> b[i][j];
        }
    }

    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            for(int k=0;k<=mx;k++){
                dp[i][j][k] = false;
            }
        }
    }


    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            int c = abs(a[i][j] - b[i][j]);
            if(i == 0 && j == 0){
                dp[0][0][hf+c] = dp[0][0][hf-c] = true;
                continue;
            }
            for(int k=0;k<=mx;k++){
                if(i>0){
                    if(k-c >= 0 && dp[i-1][j][k-c]){
                        dp[i][j][k] = true;
                    }
                    if(k+c <= mx && dp[i-1][j][k+c]){
                        dp[i][j][k] = true;
                    }
                }
                if(j>0){
                    if(k-c >= 0 && dp[i][j-1][k-c]){
                        dp[i][j][k] = true;
                    }
                    if(k+c <= mx && dp[i][j-1][k+c]){
                        dp[i][j][k] = true;
                    }
                }
            }
        }
    }

    int ans = mx;
    for(int k=0;k<=mx;k++){
        if(dp[h-1][w-1][k]){
            ans = min(ans, abs(k-hf));
        }
    }

    cout << ans << endl;

}


Measured memory_bytes: 80256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
 
int main(){
 long long n,k;
 cin>>n>>k;
 
 long long arr[n];
 long long  sum=0;
 for(int i=0;i<n;i++) {
     cin>>arr[i];
     sum+=arr[i];
 }
 sort(arr,arr+n);
 
 if(k==0) cout<<sum;
 
 else if(k>=n) cout<<"0";
 
 else {
   long long  cnt=0;
     for(int i=0;i<n-k;i++){
         cnt+=arr[i];
     }
     cout<<cnt;
 }
 
 return 0;
}

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

bool pr_check(int x){
    for(int i = 2; i <= sqrt(x);++i){
        if(x%i == 0) return false;
    }
    return true;
}

int main(){
    int n; cin >> n;
    vector<int> a = {11,31,41,61};
    for(int i = 71; i <= 55555; i += 10){
        if(pr_check(i)) a.emplace_back(i);
        if(a.size() == n) break;
    }
    rep(i,n-1) cout << a[i] << " ";
    cout << a[n-1] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
#include <queue>
#include <stack>
#include <deque>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<n;++i)

using namespace std;
using ll = long long;

ll n, m, o, add, ans, A[1010101];
string s, str;
char c[101][101];
int main() {
	cin >> n >> m;
	rep(i, n) {
		rep(j, m) {
			cin >> c[i][j];
			if (c[i][j]=='.') add++;
		}
		if (add == m) rep(j, m) c[i][j] = '0';
		add = 0;
	}
	rep(j, m) {
		rep(i, n) {
			if (c[i][j] == '.' || c[i][j] == '0') add++;
		}
		if (add == n) rep(i, n) c[i][j] = '0';
		add = 0;
	}
	rep(i, n) {
		rep(j, m) {
			if (c[i][j] != '0') cout << c[i][j];
            else add++;
        }
        if(add!=m) cout << endl;
        add=0;
	}
	return 0;
}

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

using namespace std;
using ll = long long;

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int n;
	cin>>n;
	char c;
	string a,b;
	for(int i=0; i<n/2; ++i){cin>>c;a.push_back(c);}
	for(int i=0; i<n/2; ++i){cin>>c;b.push_back(c);}
	if(n&1 || a!=b)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return 0;
}



Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/assoc_container.hpp> 
using namespace std; 
using namespace __gnu_pbds;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
 
template <class T> using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_mset;
 
#define FOR(i,a,b) for(int i = a; i < b; i++)
#define F0R(i,a) for(int i = 0; i < a; i++)
#define F0Rd(i,a) for (int i = a - 1; i >=0 ; i--)
#define FORd(i,a,b) for (int i = b - 1; i >= a; i--)
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) int((x).size())
#define newl '\n'
 
#define FAST ios::sync_with_stdio(0); cin.tie(0);
#define print(x) cout << x << newl;
#define finish(x) return cout << x << "\n", 0;
#define bug(x) cerr << ">>> " << #x << " = " << x << "\n";
#define _ << " " << 
 
const int MXN = 2e5 + 5;
const ll MOD = 998244353;
const ll INF = 1e9 + 7;


int K;
string S;

int main(){ FAST
    //ifstream cin("/Users/konwoo/input.txt");
    //ofstream cout("/Users/konwoo/output.txt");

    cin >> K >> S;
    if (sz(S) <= K) finish(S);
    finish(S.substr(0,K) + "...");


    

 
 
 
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main()
  {double A, B, H, M; cin >> A >> B >> H >> M;
  auto r = 5.5 * (60 * H + M) * acos(-1) / 180;
  cout << fixed << setprecision(20) << sqrt(A * A + B * B - 2 * A * B * cos(r)) << endl;}

Measured memory_bytes: 4196
def segfunc(x, y):
    return max(x, y)
ide_ele = -float('inf')

class SegTree:
    def __init__(self, init_val, segfunc, ide_ele):
        n = len(init_val)
        self.segfunc = segfunc
        self.ide_ele = ide_ele
        self.num = 1 << (n - 1).bit_length()
        self.tree = [ide_ele] * 2 * self.num
        for i in range(n):
            self.tree[self.num + i] = init_val[i]
        for i in range(self.num - 1, 0, -1):
            self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1])

    def update(self, k, x):
        k += self.num
        self.tree[k] = x
        while k > 1:
            self.tree[k >> 1] = self.segfunc(self.tree[k], self.tree[k ^ 1])
            k >>= 1

    def query(self, l, r):
        res = self.ide_ele

        l += self.num
        r += self.num
        while l < r:
            if l & 1:
                res = self.segfunc(res, self.tree[l])
                l += 1
            if r & 1:
                res = self.segfunc(res, self.tree[r - 1])
            l >>= 1
            r >>= 1
        return res

N, K = map(int, input().split())
A = [int(input()) for _ in range(N)]
max_v = max(A)
seg = SegTree([0]*max_v, segfunc, ide_ele)

for i in A:
    f = seg.query(max(0,i-K),min(max_v,i+K)+1)
    seg.update(i,f+1)

print(seg.query(0,max_v+1))

Measured memory_bytes: 148648
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!(
    x: usize,
    y: usize,
    a: usize,
    b: usize,
    c: usize,
    pa: [usize; a],
    pb: [usize; b],
    pc: [usize; c],
    );
    let (mut pa, mut pb, mut pc) = (pa, pb, pc);
    pa.sort();
    pb.sort();
    pc.sort();
    let mut r: Vec<usize> = pa.split_off(a - x);
    let mut g: Vec<usize> = pb.split_off(b - y);
    let mut lc = c - 1;
    let (mut ri, mut gi) = (0, 0);
    let mut cs = 0;
    loop {
        let mut s = Vec::new();
        if ri == x {
            s = vec![1, g[gi]];
        } else if gi == y {
            s = vec![0, r[ri]];
        } else {
            s = if r[ri] < g[gi] { vec![0, r[ri]] } else { vec![1, g[gi]] };
        }
        if s[1] < pc[lc] {
            match s[0] {
                0 => {
                    ri += 1;
                    cs += pc[lc];
                }
                1 => {
                    gi += 1;
                    cs += pc[lc];
                }
                _ => {}
            }
        } else {
            break;
        }
        if lc == 0 { break; } else { lc -= 1; }
        if ri == x && gi == y { break; }
    }
    let ans: usize = r.split_off(ri).iter().sum::<usize>() + g.split_off(gi).iter().sum::<usize>() + cs;
    println!("{}", ans);
}


Measured memory_bytes: 10492
import numpy as np
import numba


i4 = numba.int32


@numba.njit((i4, i4[:], i4[:, :], i4[:]), cache=True)
def solve(dd, c_arr, s_arr, t_arr):
    last_d = np.zeros(26, dtype=np.int32) - 1
    score = 0
    score_arr = np.zeros(dd, dtype=np.int32)
    for d in range(dd):
        score += s_arr[d, t_arr[d] - 1]
        last_d[t_arr[d] - 1] = d
        score -= (c_arr * (d - last_d)).sum()
        score_arr[d] = score
    return score_arr


def main():
    d = np.int32(input())
    c_arr = np.array(list(map(int, input().split()))).astype(np.int32)
    s_arr = np.array([list(map(int, input().split())) for _ in range(d)]).astype(np.int32)
    t_arr = np.array([int(input()) for _ in range(d)]).astype(np.int32)
    res = solve(d, c_arr, s_arr, t_arr)
    for r in res:
        print(r)


if __name__ == "__main__":
    main()


Measured memory_bytes: 106712
#include <stdio.h>
#include <malloc.h>

int main(void)
{
    int N;
    int i;
    int *A;
    double a = 0;

    scanf("%d", &N);
    A = (int *)calloc(N, sizeof(int));

    for (i = 0; i < N; i++)
    {
        scanf("%d", A + i);
    }

    for (i = 0; i < N; i++)
    {
        a += (1000.0 / (double)A[i]);
    }

    printf("%.10f\n", 1000.0 / a);

    free(A);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
 
using namespace std;
 
int main(void)
{
  int n, k, tmp;
  vector <int> blood;
  vector <string> result;
 
  while (true) {
    cin >> n >> k;
    if (n == 0 && k == 0)
      break;
    blood.reserve(k);
    for (int i = 0; i <= n; i++)
      for (int j = 0; j < k; j++) {
        cin >> tmp;
        if (i == 0)
          blood[j] = tmp;
        else
          blood[j] -= tmp;
      }
    tmp = 1;
    for (int i = 0; i < k; i++)
      if (blood[i] < 0) {
        tmp = 0;
        break;
      }
    result.push_back(tmp ? "Yes" : "No");
  }
  for (int i = 0; i < result.size(); i++)
    cout << result[i] << endl;
  return 0;
}

Measured memory_bytes: 1204
<?php
fscanf(STDIN, "%d", $n);
for($i = 0; $i < $n; $i++) {
    fscanf(STDIN, "%d %d", $x[], $y[]);
}

$route = 1;
for($i = 1; $i <= $n; $i++) {
    $route = $route * $i; // 全部の街を通るルートは何通りあるか
}
$pair = 0;
for($i = 1; $i <= $n-1; $i++) {
    $pair = $pair + $i; // ある街からある街への移動は何通りあるか 1-2,2-1は同じでカウント
}
$move = $route * ($n-1) / $pair; // A街からB街への移動は何回するか
$totalLength = 0;
for($i = 0; $i < $n-1; $i++) {
    for($j = $i+1; $j < $n; $j++) {
        $totalLength += $pairLength = sqrt(pow($x[$i] - $x[$j], 2) + (pow($y[$i] - $y[$j], 2)));
    }
}
$totalLength = $totalLength * $move;
$averageLength = $totalLength / $route;
echo $averageLength;
?>

Measured memory_bytes: 4604
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <unordered_map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
using ll = long long;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

template <class T> void swap(T& a, T& b) { T t = std::move(a); a = std::move(b); b = std::move(t); }

int main(void)
{
    ll N, i, p[100001], judge=0, tmp, ans=0;

    cin >> N;

    for(i=1; i<=N; i++){
        cin >> p[i];
    }

    for(i=1; i<=N-1; i++){
        if(p[i] == i){
            ans++;
            tmp = p[i];
            p[i] = p[i+1];
            p[i+1] = tmp;
        }
    }
    if(p[N]==N){
        ans++;
        tmp = p[N-1];
        p[N-1] = p[N];
        p[N] = tmp;
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string str;
	cin >> str;

	int result = 0;

	if (str == "SUN")
		result = 7;
	else if (str == "MON")
		result = 6;
	else if (str == "TUE")
		result = 5;
	else if (str == "WED")
		result = 4;
	else if (str == "THU")
		result = 3;
	else if (str == "FRI")
		result = 2;
	else if (str == "SAT")
		result = 1;
	printf("%d", result);
	return 0;
}

Measured memory_bytes: 256
import math
import math
from functools import reduce
#import itertools
#import statistics
#import numpy as np
#import collections
n = int(input())
#h  = list(map(int, input().split()))
#h, w = list(map(int, input().split()))


def gcd(*numbers):
    return reduce(math.gcd, numbers)

ans = 0
for i in range(1, n+1):
    for j in range(1, n+1):
        for k in range(1, n+1):
            ans += gcd(i, j, k)



#print(gcd(27, 18, 3))
print(ans)


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

#ifdef NON_SUBMIT
#define TEST(n) (n)
#define tout cerr
#else
#define TEST(n) ((void)0)
#define tout cin
#endif

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt","r",stdin));
	TEST(freopen("output.txt","w",stdout));
	TEST(freopen("debug.txt","w",stderr));
	int L, R, D;
	cin>>L>>R>>D;
	cout<<R/D-(L-1)/D<<'\n';
	return 0;
}

Measured memory_bytes: 3608
'use strict';
function main(input) {
  const a = Number(input.trim().split('\n')[0]);
  let sum = 0;

  for (let i = 1; i < (a + 1); i ++) {
    if (i % 3 === 0 || i % 5 === 0) {
      continue;
    }
    sum += i;
  }
  
  console.log(sum);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 35040
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    ll x; cin >> x;
    ll y; cin >> y;
    ll large = max(x, y);
    ll small = min(x, y);
    REP(i, large){
        cout << small;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	int n;
	while (cin >> n) {
		int ans = 0;
		n += 1;
		bool *p = new bool[n];
		fill(p, p + n, true);
		p[0] = p[1] = false;
		for (int i = 2; i * i < n; i++)
			if (p[i] == true)
				for (int j = i * i; j < n; j += i)
					p[j] = false;
		for (int i = 0; i < n; i++)
			if (p[i] == true)
				ans++;
		cout << ans << endl;
		delete[] p;
	}
	return 0;
}

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

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

    long long max = 0;
    long long min = (int)10e8;
    long long k = 0;
    for(int i = 0; i < n; i++){
        cin >> k;
        if(k > max){
            max = k;
        }
        if(k < min){
            min = k;
        }
    }

    cout << max - min << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#define MAXN 610
int n, d[2], vis[2][MAXN][MAXN], col[2][MAXN][MAXN];
std::vector<std::pair<int, int>> V[2];
inline int ok(int x, int y) { return x >= 0 && x < n && y >= 0 && y < n; }
void dfs(int x, int y, int c, int d) {
    col[d][x][y] = c;
    vis[d][x][y] = 1;
    for (auto v : V[d]) {
        int nx = x + v.first;
        int ny = y + v.second;
        if (ok(nx, ny) && !vis[d][nx][ny]) {
            dfs(nx, ny, !c, d);
        }
    }
}

int main() {
    scanf("%d%d%d", &n, &d[0], &d[1]);
    n <<= 1;
    for (int k = 0; k < 2; k++) {
        for (int i = 0; i <= d[k]; i++) {
            int j = (int)sqrt(d[k] - i * i);
            if (i * i + j * j == d[k]) {
                V[k].push_back({i, j});
                V[k].push_back({-i, j});
                V[k].push_back({i, -j});
                V[k].push_back({-i, -j});
            }
        }
        std::sort(V[k].begin(), V[k].end());
        V[k].erase(unique(V[k].begin(), V[k].end()), V[k].end());
    }
    for (int k = 0; k < 2; k++)
        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
                if (!vis[k][i][j]) dfs(i, j, 0, k);
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (col[0][i][j] == 0 && col[1][i][j] == 0) {
                printf("%d %d\n", i, j);
                if (++cnt >= (n * n / 4)) return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 34816
// Karm Karta ja, Phal Ki Chinta na Kar:)
#include <bits/stdc++.h>
using namespace std;
#include<stdio.h>
typedef long long int ll;
#define INF 1e18+3
#define M 1000000007
#define PI 3.14159265358979323846
ll fast(ll n,ll a,ll m)
{
    if(n==0)
        return 1;
    else if(n==1)
        return a;
    else
    {
        ll r=fast(n/2,a,m);
        if(n%2==0)
            return (((r%m)*(r%m))%m);
        else
            return (((((r%m)*a)%m)*r)%m);
    }
}
int main()
{
    int n;
    cin>>n;
    string s,t;
    cin>>s>>t;
    string r;
    int i;
    for(i=0;i<s.length();i++)
    {
        r+=s[i];
        r+=t[i];
    }
    cout<<r;

}


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

const int64_t MOD= 1000000007;
const int Nfac= 100007;
#define MEMORY 1 // 1/0: 階乗を配列に格納をする前処理をする/しない
/* 剰余環 Z_n */
struct mint{ // Z_n に関する演算(n:素数の場合は除算も)をサポートする構造体
  int64_t rep; // 出力すべき代表元 rep \in {0,1,..,MOD- 1}
  mint(int64_t x=0): rep(((x%MOD)+ MOD)% MOD){}
  mint operator-() const { return mint(-rep);}
  mint& operator+=(const mint& x){
    rep+= x.rep; 
    if(rep>= MOD) rep-= MOD;
    return *this;
  }
  mint& operator-=(const mint& x){
    rep-= x.rep;
    if(rep< 0) rep+= MOD;
    return *this;
  }
  mint& operator*=(const mint& x){
    rep*= x.rep; rep%= MOD;
    return *this;
  }
  mint operator+(const mint x) const {
    mint ans(*this);
    ans+= x;
    return ans;
  }
  mint operator-(const mint x) const {
    mint ans(*this);
    ans-= x;
    return ans;
  }
  mint operator*(const mint x) const {
    mint ans(*this);
    ans*= x;
    return ans;
  }

  mint pow(int64_t d) const{ // d \geq 0
    if(d==0) return 1;
    else{
      mint ans= pow(d>>1);
      ans*= ans;
      if(d&1){ ans*= *this; }

      return ans;
    }
  }

  // MOD が素数(<=> Z_n が体)のとき
  mint inv() const{
    return pow(MOD-2);
  }
  mint& operator/=(const mint& x){
    *this *= x.inv();
    return *this;
  }
  mint operator/(const mint x) const {
    mint ans(*this);
    ans/= x;
    return ans;
  }
};

/* 階乗,二項係数 */
#if (MEMORY==1)
// 前処理として,階乗を配列に格納をするver.
vector<mint> mfac(Nfac+1), ifac(Nfac+1);
void fact_modp_init(int N= Nfac){
  mfac.at(0)= 1;
  mint buf;
  for(int i=1; i<=N; i++){
    buf= i;
    mfac.at(i)= mfac.at(i-1)* buf;
  }

  ifac.at(N)= mfac.at(N).inv();
  for(int i=N; i>0; i--){
    buf= i;
    ifac.at(i-1)= ifac.at(i)* buf;
  }
}
#else
// 前処理を回避するver.
void fact_modp_init(int N= Nfac){}
mint mfac(int N){
  mint ans= 1;
  mint buf;
  for(int i=1; i<=N; i++){
    buf= i;
    ans*= buf;
  }

  return ans;
}
#endif

mint binom_modp(int n, int k){
  if(n < 0 || min(k,n-k) < 0) return 0;
  else{
#if (MEMORY==1)
    return mfac.at(n)* ifac.at(k)* ifac.at(n-k);
#else
    return mfac(n)* mfac(k).inv()* mfac(n-k).inv();
#endif
  }
}
// ^^^ テンプレここまで ^^^

int main() { // ダブリのindexをi1,i2とすると長さkの部分列の個数は 
             //  #([0,N+1)からk個選んで構成した部分列)- #(ダブった要素1個と [0,i1)∪[i2+1,N+1)からk-1個選んで構成した部分列)
             // = binom(N+1, k)- binom(N+i1-i2, k-1)
  int N,buf;
  cin >> N;

  int N_edges;
  unordered_map<int, int> map; // key: a_i, value: i
  for(int i=0; i<N+1; i++){
    cin >> buf;
    if(map.count(buf)){
      N_edges= N+ map.at(buf)- i;
      break;
    }
    else{
      map[buf]= i;
    }
  }

  fact_modp_init(Nfac);
  mint ans;
  for(int k=1; k<= N+1; k++){
    ans= binom_modp(N+1,k)- binom_modp(N_edges, k-1);
    cout << ans.rep << endl;
  }
}

Measured memory_bytes: 6948
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

#define REP(i, n) for(int i=0; i<(n); i++)
#define REPS(i, n) for(int i=0; i<=(n); i++)
#define FOR(i, a, b) for(int i=a; i<(b); i++)
#define FORS(i, a, b) for(int i=a; i<=(b); i++)
// for container x
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())
#define LB(v, x) distance((v).begin(), lower_bound(ALL(v), (x)))
#define UB(v, x) distance((v).begin(), upper_bound(ALL(v), (x)))

struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#pragma endregion

int main(){
    int N;
    cin >> N;
    int ans=0;
    FORS(i, 1, 10) if(i*1000>=N) {ans=i; break;};
    cout << ans*1000-N << endl;
    return 0;
}

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

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

int main(void){
    int64_t a, b, c, k; cin >> a >> b >> c >> k;
    int64_t x1 = min(k, a);
    int64_t x2 = min(k - x1, b);
    int64_t x3 = min(k - x1 - x2, c);
    
    cout << x1 - x3 << endl;
        
}


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

def main():
    a, b, c = map(int, input().split())
    reminder = []
    for i in range(a, b*a+1, a):
        reminder.append(i % b)
    if c in reminder:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    main()

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

void solveA(){
  int a,b,c,d,e,k;
  cin >> a >> b >> c >> d >> e >> k;

  if(e-a > k){
    cout << ":(" << endl;
  }
  else{
    cout << "Yay!" << endl;
  }
}
void solveB(){

}
void solveC(){

}

void solveD(){

}

int main(){
  solveA();
}


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

using namespace std;

#define lli long long
#define ld long double
#define mod 1000000007 
#define set(n) cout << fixed << setprecision(n)    
#define fi first
#define se second
#define mp make_pair
#define pll pair<lli, lli>
#define endl '\n'

const double PI = acos(-1);
const double epsilon = 1e-7;  // floating point precision

void Dijkstra(vector<vector<char>>& v, vector<vector<lli>>& ans) {
    set<pair<lli, pll>> s;
    vector<int> dirx = {1, 0, -1, 0};
    vector<int> diry = {0, 1, 0, -1};
    lli n = v.size();
    lli m = v[0].size();
    for(int ii = 0; ii < n; ii++) {
        for(int jj = 0; jj < m; jj++) {
            s.insert({ans[ii][jj], {ii, jj}});
        }
    }
    while(!s.empty()) {
        auto curr = *(s.begin());
        s.erase(curr);
        lli i = curr.se.fi, j = curr.se.se;
        for(int k = 0; k < 4; k++) {
            lli x = i + dirx[k];
            lli y = j + diry[k];
            if(x >= 0 and x < n and y >= 0 and y < m) {
                if(v[x][y] == '.') {
                    if(ans[x][y] > ans[i][j]) {
                        if(s.find({ans[x][y], {x, y}}) != s.end()) {
                            s.erase({ans[x][y], {x, y}});
                        }
                        ans[x][y] = ans[i][j];
                        s.insert({ans[x][y], {x, y}});
                    }
                }
            }        
        }
        for(int ii = max(0ll, i - 2); ii < min(n, i + 3); ii++) {
            for(int jj = max(0ll, j - 2); jj < min(m, j + 3); jj++) {
                int x = ii;
                int y = jj;
                if(v[x][y] == '.') {
                    if(ans[x][y] > ans[i][j] + 1) {
                        if(s.find({ans[x][y], {x, y}}) != s.end()) {
                            s.erase({ans[x][y], {x, y}});
                        }
                        ans[x][y] = 1 + ans[i][j];
                        s.insert({ans[x][y], {x, y}});
                    }              
                }
            }
        }
    }
}

signed main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, m;
    cin >> n >> m;
    int cx, cy, dx, dy;
    cin >> cx >> cy;
    --cx, --cy;
    cin >> dx >> dy;
    --dx, --dy;
    vector<vector<char>> v(n, vector<char>(m));
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) {
            cin >> v[i][j];
        }
    }
    vector<vector<lli>> ans(n, vector<lli>(m, 1e9));
    ans[dx][dy] = 0;
    Dijkstra(v, ans);
    lli dist = ans[cx][cy];
    if(dist >= 1e7) {
        cout << -1 << endl;
    }
    else {
        cout << dist << endl;
    }
    return 0;
}


Measured memory_bytes: 74832
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String ans = "A";
		do{
			String t = sc.nextLine();
			if(t.equals("")) break;
			String[] temp = t.split(",");
			if(temp[0].equals(ans)) ans = new String(temp[1]);
			else if(temp[1].equals(ans)) ans = new String(temp[0]);
		} while(sc.hasNextLine());
		
		System.out.println(ans);
		

	}

}

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

int main()
{
    ll x,y,c=0;
    cin>>x>>y;
    if(x==y)
    {
        cout<<1<<endl;
        return 0;
    }
    while(x<=y)
    {
        x*=2;
        c++;
    }

   cout<<c<<endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#include <iomanip>      // std::setprecision
using namespace std;
#define what_is(x) cerr << #x << " is " << x << endl;
#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n)) //get the highest bit of x, maybe the fastest
#define IN(i,l,r) (l<i&&i<r) //the next for are for checking bound
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define F(i,L,R) for (int i = L; i < R; i++) //next four are for "for loops"
#define FLL(i,L,R) for (long long int i = L; i < R; i++) //next four are for "for loops"
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define FF(i,L,R) for (int i = L; i > R; i--)
#define FFE(i,L,R) for (int i = L; i >= R; i--)
#define char2Int(c) (c-'0')
#define lastEle(vec) vec[vec.size()-1] 
#define SZ(x) ((int)((x).size()))
#define REMAX(a,b) (a)=max((a),(b)) // set a to the maximum of a and b
#define REMIN(a,b) (a)=min((a),(b));
#define FENWICK(k) (k&-k)
#define FOREACH(i,t) for (auto i=t.begin(); i!=t.end(); i++) // traverse an STL data structure
#define ALL(c) (c).begin(),(c).end() //handy for function like "sort()"
#define PRESENT(c,x) ((c).find(x) != (c).end()) 
#define CPRESENT(c,x) (find(ALL(c),x) != (c).end()) 
#define LL long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF 1001001001
#define PI 3.1415926535897932384626
//for map, pair
#define mp make_pair
#define fi first
#define se second
//for vectors
#define pb push_back
typedef int elem_t;
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef pair<int,int> ii; 
// directions
const int fx[4][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}};
const int fxx[8][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}, {1,1}, {1,-1}, {-1,1}, {-1,-1}};
const int rogi[4][2] = { {1,1}, {1,-1}, {-1,1}, {-1,-1} };
double n;

void dane() {
    cin>>n;
    cout<<setprecision(9)<<(2*M_PI*n)<<endl;
}

int main() {
	IOS
	// int t;
	// cin>>t;
	// F(i,0,t)
	    dane();
    return 0;
}

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

int main()
{
    ll N,Y;
    int a=-1,b=-1,c=-1;
    cin>>N>>Y;
    for(int i=0;i<N+1;i++){
      for(int j=0;j<N+1-i;j++){
        int k=N-i-j;
        if((i+j+k==N)&&(i*10000+j*5000+k*1000==Y)){
          a=i;
          b=j;
          c=k;
        }
      }
    }
    cout<<a<<" "<<b<<" "<<c<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	string s; cin >> s;
	int bound = s.l_ength();
	int cnt_0 = 0;
	for( int i = 0; i < bound; ++i ){
		if( i%2 == 0 && s[i] == '0' ) ++cnt_0;
		if( i%2 == 1 && s[i] == '1' ) ++cnt_0;
	}
	int cnt_1 = 0;
	for( int i = 0; i < bound; ++i ){
		if( i%2 == 0 && s[i] == '1' ) ++cnt_1;
		if( i%2 == 1 && s[i] == '0' ) ++cnt_1;
	}
	cout << min(cnt_0, cnt_1) << endl;
	return 0;
}

Measured memory_bytes: 512
<?php
	$A=explode(' ',fgets(STDIN));
	$B=explode(' ',fgets(STDIN));
	$C=explode(' ',fgets(STDIN));
	$c=0;
	for($i=0;$i<2;$i++)
	{
		if($A[$i+1]-$A[$i]==$B[$i+1]-$B[$i]&&$B[$i+1]-$B[$i]==$C[$i+1]-$C[$i])
		{
			$c++;
		}
	}
	echo $c==2?"Yes":"No","\n";


Measured memory_bytes: 3828
from itertools import chain, accumulate


def prime_set(N):
    """
    Nまでの素数のsetを返す
    """
    if N < 4:
        return ({}, {}, {2}, {2, 3})[N]
    Nsq = int(N ** 0.5 + 0.5) + 1
    primes = {2, 3} | set(chain(range(5, N + 1, 6), range(7, N + 1, 6)))
    for i in range(5, Nsq, 2):
        if i in primes:
            primes -= set(range(i * i, N + 1, i * 2))
    return primes


U = 10 ** 5 + 10
primes = prime_set(U)
memo = [0] * U
for i in range(1, U, 2):
    if i in primes and (i + 1) // 2 in primes:
        memo[i] = 1
memo = list(accumulate(memo))

Q = int(input())
ans = []
for _ in range(Q):
    l, r = map(int, input().split())
    ans.append(memo[r] - memo[l - 1])
print(*ans, sep="\n")

Measured memory_bytes: 15172
n,m = map(int,input().split())

tree = [[] for _ in range(n)]

for i in range(m):
    a, b = map(int,input().split())
    a,b = a-1, b-1
    tree[a].append(b)
    tree[b].append(a)

ans = [-1] * n
queue = [0]
visited = [False] * n

############### BFS ##############
while queue:
    x = queue.pop(0)
    # print(x, tree[x])
    for g in tree[x]: # つながっている部屋を1づつ調べる
        if visited[g] == False: # 訪れていなければqueueに追加
            queue.append(g)
            if ans[g] == -1: # 方向をansに追加し、訪れ済みにする
                ans[g] = x
                visited[g] = True

if -1 in ans[1:]:
    print('No')
else:
    print('Yes')
    for a in ans[1:]:
        print(a+1)

Measured memory_bytes: 35216
def examA():
    N = S()
    if N[0]==N[-1]:
        print("Yes")
    else:
        print("No")

import sys
import copy
import bisect
import heapq
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()


Measured memory_bytes: 3444
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int N = int.Parse(input[0]);
            int M = int.Parse(input[1]);
            List<int> town = new List<int>();

            for(int i = 0; i < M; i++)
            {
                int[] road = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);
                town.AddRange(road);
            }

            for(int i = 1; i <= N; i++)
            {
                List<int> search = town.FindAll(x => x ==i);
                Console.WriteLine(search.Count);
            }
            
        }
    }
}


Measured memory_bytes: 11348
using System;
using System.Linq;

class HMDiv
{
    static void Main()
    {
            string str;
            {
                str = Console.ReadLine();
                int a = int.Parse(str.Split(' ')[0]);
                int b = int.Parse(str.Split(' ')[1]);
                int c = int.Parse(str.Split(' ')[2]);
                int d=0;
                for (int i = a; i <= b; i++)
                {
                    if (c % i == 0)
                    {
                        d++;
                    }
                }


                    Console.WriteLine(d);
            }
    }
}

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

int main() {
    int A, B; cin >> A >> B;
    for (int i = 1; i <= 10000; i++) {
        if (i * 8 / 100 == A && i * 10 / 100 == B) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}


Measured memory_bytes: 256