akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

ll mypow(ll p, ll n){
    ll ret = 1;
    while (0 < n){
        if ((n%2) == 0){
            p = p*p%MOD;
            n /= 2;
        } else {
            ret = ret*p%MOD;
            n--;
        }
    }
    return ret;
}

int main() {
    ios::sync_with_stdio(false);
    ll N, K;
    cin >> N >> K;
    //gcd(A1,A2,...,AN)がXの倍数になるパターンの個数はfloor(X)^N
    vector<ll> num(K+1);
    for (ll i=K;i>=1;i--){
        num[i] += mypow(K/i,N);
        num[i] %= MOD;
        int cnt = 2;
        while (i*cnt <= K){
            num[i] -= num[i*cnt];
            if (num[i] < 0) num[i] += MOD;
            cnt++;
        }
    }

    ll ans = 0;
    for (ll i=1;i<=K;i++){
        ans += i*num[i]%MOD;
        ans %= MOD;
    }
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 4028
import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]

n, k = ril()
s = rs()
m = 1
for c0, c1 in zip(s, s[1:]):
    if c0 != c1:
        m += 1
if m <= 2 * k:
    print(n - 1)
else:
    print(n - m + 2 * k)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  int cur = 0;
  rep(i,n){
    if(s.at(i)=='I'){
      cur++;
    }else{
      cur--;
    }
    ans = max(ans,cur);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
 
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdarg.h>
#include<malloc.h>

int main()
{
	double x1, y1, x2, y2, x3, y3, xp, yp, buf;
	char *yesno;

	while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp) != EOF){

		yesno = "NO";

		if(x1>x2){
			buf = x1;	x1 = x2;	x2 = buf;
			buf = y1;	y1 = y2;	y2 = buf;
		}
		if(x2>x3){
			buf = x2;	x2 = x3;	x3 = buf;
			buf = y2;	y2 = y3;	y3 = buf;
		}
		if(x1>x2){
			buf = x1;	x1 = x2;	x2 = buf;
			buf = y1;	y1 = y2;	y2 = buf;
		}

		if(x1==x2){
			if(y1>y2){
				buf = x1;	x1 = x2;	x2 = buf;
				buf = y1;	y1 = y2;	y2 = buf;
			}
		}
		if(x2==x3){
			if(y2<y3){
				buf = x2;	x2 = x3;	x3 = buf;
				buf = y2;	y2 = y3;	y3 = buf;
			}
		}

		if(x1==x2){
			if(x1<xp){
				if(yp > (((xp-x1)*(y3-y1))/(x3-x1)+y1)){
					if(yp < (((xp-x2)*(y3-y2))/(x3-x2)+y2)){
						yesno = "YES";
					}
				}
			}
		} else if(x2==x3){
			if(x2>xp){
				if(yp > (((xp-x1)*(y3-y1))/(x3-x1)+y1)){
					if(yp < (((xp-x1)*(y2-y1))/(x2-x1)+y1)){
						yesno = "YES";
					}
				}
			}
		}

		if(y2 > ((x2-x1)*(y3-y1))/(x3-x1)+y1){
			if(yp < (((xp-x1)*(y2-y1))/(x2-x1)+y1)){
				if(yp < (((xp-x2)*(y3-y2))/(x3-x2)+y2)){
					if(yp > (((xp-x1)*(y3-y1))/(x3-x1)+y1)){
						yesno = "YES";
					}
				}
			}
		} else {
			if(yp < (((xp-x1)*(y3-y1))/(x3-x1)+y1)){
				if(yp > (((xp-x1)*(y2-y1))/(x2-x1)+y1)){
					if(yp > (((xp-x2)*(y3-y2))/(x3-x2)+y2)){
						yesno = "YES";
					}
				}
			}
		}

		printf("%s\n", yesno);

	}
	return 0;
}

Measured memory_bytes: 612
#include <bits/stdc++.h>
#define ll long long
//vector<int> g1;
//g1.push_back(i);

using namespace std;

int main()
{
	int n,x,y;
	cin >> n >> x >> y;
	int dis[n+1];
	int otpt[n+1];
	dis[x]=0;
	dis[y]=1;
	for(int i=1;i<=n;i++)
	{
		otpt[i]=0;
	}
	
	for(int i=1;i<=x-1;i++)
	{
		dis[i] = x-i;
	}
	for(int i=y+1;i<=n;i++)
	{
		dis[i] = i-y+1;
	}
	
	for(int i=x+1;i<y;i++)
	{
		dis[i] = i-x;
	}
	for(int i=y-1;i>x;i--)
	{
		int z = 1+y-i;
		if(z<=dis[i]) dis[i] = z;
		else break;
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			int temp = min(dis[i]+dis[j],j-i);
			otpt[temp]++;
		}
	}
	for(int i=1;i<n;i++)
	{
		cout << otpt[i] << endl;
	}
}



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

#define dump(x) cout << (x) << endl
#define Int int64_t
#define fi first
#define se second
 
Int INF = 1e18;
Int mod = 1e9+7;
//Int mod = 998244353;

Int n, m, p;
vector<pair<Int, Int>> G[3000];
bool visited[3000];
bool visited2[3000];
bool check[3000];
Int d[3000];

bool dfs(Int x) {
    if (check[x]) {
        return false;
    }
    check[x] = true;
    if (x == n) {
        return true;
    }
    bool ch = false;
    for (Int i = 0; i < G[x].size(); i++) {
        Int to = G[x][i].fi;
        if (not check[to]) {
            ch = ch or dfs(to);
        }
    }
    return ch;
}

int main() {
    cin >> n >> m >> p;
    vector<Int> a(m), b(m), c(m);
    for (Int i = 0; i < m; i++) {
        cin >> a[i] >> b[i] >> c[i];
        G[a[i]].emplace_back(b[i], c[i] - p);
    }
    queue<Int> q;
    q.push(1);
    visited2[1] = true;
    while (!q.empty()) {
        Int p = q.front();
        q.pop();
        for (Int i = 0; i < G[p].size(); i++) {
            Int to = G[p][i].fi;
            if (not visited2[to]) {
                visited2[to] = true;
                q.push(to);
            }
        }
    }
    for (Int i = 1; i <= n; i++) {
        if (not visited2[i]) {
            continue;
        }
        for (Int j = 1; j <= n; j++) {
            check[j] = false;
        }
        visited[i] = dfs(i);
        //cout << i << " " << visited[i] << endl;
    }
    for (Int i = 1; i <= n; i++) {
        d[i] = -INF;
    }
    d[1] = 0;
    Int res[2];
    for (Int k = 0; k < 2; k++) {
        for (Int j = 0; j < n; j++) {
            for (Int i = 0; i < m; i++) {
                if (not visited[a[i]]) {
                    continue;
                }
                if (d[b[i]] < d[a[i]] + c[i] - p) {
                    d[b[i]] = d[a[i]] + c[i] - p;
                    if (j == n - 1) {
                        dump(-1);
                        return 0;
                    }
                }
            }
        }
        res[k] = d[n];
    }
    dump(res[0] >= res[1] ? max(res[0], (Int)0) : -1);
    return 0;
}

Measured memory_bytes: 640
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] t = new int[n+1];
        int[] x = new int[n+1];
        int[] y = new int[n+1];
        for(int i = 1; i <= n; i++){
            t[i] = sc.nextInt();
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
        }
        int dist = 0;
        int flag = 1;
        int time = 0;
        for(int i = 1; i <= n; i++){
            time = t[i] - t[i-1];
            dist = Math.abs( Math.abs( (x[i] - x[i-1]) ) + Math.abs( (y[i] - y[i-1]) ) );
            if(time < dist){
                flag = 0;
                break;
            } else if((time-dist)%2 != 0){
                flag = 0;
                break;
            }
        }
        if(flag == 1){
            System.out.print("Yes");
        } else {
            System.out.print("No");
        }
    }
}

Measured memory_bytes: 90760
#include <stdio.h>
#include <limits.h>

int mostmin(int a[],int flg[],int n){
    int i,min=INT_MAX-1,num;
    for(i=0;i<n;i++){
        if(flg[i]==0&&a[i]<min){
            min = a[i]; num=i;
        }
    }
    return num;
}

int main(void){
    int n,i,j,k,v1,v2,d;
    int a[100][100],dist[100],flg[100];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        dist[i]=INT_MAX;
        flg[i]=0;
        for(j=0;j<n;j++){
            a[i][j]=-1;
        }
    }
    for(i=0;i<n;i++){
        scanf("%d",&v1);scanf("%d",&k);
        for(j=0;j<k;j++){
            scanf("%d %d",&v2,&d);
            a[v1][v2]=d;
        }
    }
    dist[0]=0;
    for(i=0;i<n;i++){
        v1 = mostmin(dist,flg,n);
        flg[v1]=1;
        for(j=0;j<n;j++){
            if(a[v1][j]!=-1){
                d = dist[v1]+a[v1][j];
                if(d<dist[j]){
                    dist[j]=d;
                }
            }
        }
    }
    for(i=0;i<n;i++){
        printf("%d %d\n",i,dist[i]);
    }
}


Measured memory_bytes: 2128
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
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;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        D solver = new D();
        solver.solve(1, in, out);
        out.close();
    }

    static class D {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int N = in.Int();
            String S = in.next();
            int[] r = new int[N + 1];
            int[] g = new int[N + 1];
            int[] b = new int[N + 1];
            for (int i = 0; i < N; i++) {
                char c = S.charAt(i);
                r[i + 1] = r[i] + (c == 'R' ? 1 : 0);
                g[i + 1] = g[i] + (c == 'G' ? 1 : 0);
                b[i + 1] = b[i] + (c == 'B' ? 1 : 0);
            }
            long ans = 0;
            for (int i = 0; i < N - 2; i++) {
                for (int j = i + 1; j < N - 1; j++) {
                    char[] cs = new char[]{S.charAt(i), S.charAt(j)};
                    if (cs[0] == cs[1]) continue;
                    Arrays.sort(cs);
                    int[] arr;
                    if (cs[0] == 'B') {
                        if (cs[1] == 'G') {
                            arr = r;
                        } else {
                            arr = g;
                        }
                    } else {
                        arr = b;
                    }
                    if (j - i == 1) {
                        ans += (arr[N] - arr[j + 2]);
                    } else {
                        int idx = Math.min(N, j + (j - i));
                        ans += (arr[idx] - arr[j]);
                        int idx2 = j + 1 + (j - i);
                        if (idx2 <= N)
                            ans += (arr[N] - arr[idx2]);
                    }
                }
            }
            out.println(ans);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int Int() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 51068
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

double PI = acos(-1);

int main() {
    int A, B, H, M;
    cin >> A >> B >> H >> M;
    int time = 60 * H + M;
    // 時針の角度は、time / (6 * 60) * PI;
    // 分針の角度は、(time % 60) / 30 * PI;
    double theta1 = time * PI / (6 * 60);
    double theta2 = (time%60) * PI / 30;
    double x = (A * cos(theta1) - B * cos(theta2));
    double y = (A * sin(theta1) - B * sin(theta2));
    double ans = sqrt(x*x + y*y);
    printf("%.10f\n", ans);
    return 0;
}

Measured memory_bytes: 4040
n = int(input())
ans = 0
def ok(x):
    res = 0
    i = 1
    while i*i <= x:
        if x%i == 0:
            res+=1
            if i!=x//i:res+=1
        i+=1
        
    return res == 8
for i in range(1,n+1,2):
    ans+=ok(i)
print(ans)


Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {

	
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int x,y,z;
		int uriage[] = new int[4];
		for(z=0;z<=3;z++){
			x=sc.nextInt();
			y=sc.nextInt();
			if(x==1){
				x=6000;
			}else if(x==2){
				x=4000;
			}else if(x==3){
				x=3000;
			}else x=2000;
			
			uriage[z]=x*y;
			
			
		}
		for(z=0;z<=3;z++){
			System.out.println(uriage[z]);
		}
	
	
	}

}

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

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

#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<ll, vector<ll>, greater<ll>> PQ_ASK;
const int mod = 1000000007;

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

    cout << (a + b) * h / 2 << endl;

}


Measured memory_bytes: 256
import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;

void main(){
	
	int n, a;
	{
		int[] cs = readln.chomp.split.map!(to!int).array;
		n = cs[0], a = cs[1];
		}
	
	int[] xs = readln.chomp.split.map!(to!int).array;
	int[] ys = xs.map!(x => x - a).array;
	
	long[5001] count;
	count[2500] = 1;
	
	foreach(y; ys){
		long[5001] tmpcount;
		foreach(i; 0 .. 5000){
			tmpcount[i] += count[i];
			if(i + y >= 0 && i + y < 5001) tmpcount[i + y] += count[i];
			}
		foreach(i; 0 .. 5001) count[i] = tmpcount[i];
		}
	
	(count[2500] - 1).writeln;
	
	}

Measured memory_bytes: 380
#include<iostream>
using namespace std;
int main(){
    int N;
    cin >> N;
     for (int i = 1; i < N+1; i++) {
        if(i % 3 ==0)
            cout << " " << i;
        else if(i /1000 == 3)
            cout << " " << i;
        else if(i % 1000 / 100 == 3)
            cout << " " << i;
        else if(i % 1000 % 100 / 10 == 3)
            cout << " " << i;
        else if(i % 1000 % 100 % 10 / 1 == 3)
            cout << " " << i;
     }
     cout << endl;
}


Measured memory_bytes: 3116
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long int n,x,i,ans,a2,op,w=0,r=0;
cin>>n;
string s;
cin>>s;
x=s.length();
long long red[x]={0};
long long white[x]={0};
if(s[0]=='W')
{
white[0]=1;
w++;
}
else
{
red[0]=1;
r++;
}
for(i=1;i<x;i++)
{
if(s[i]=='W')
{
w++;
white[i]=white[i-1]+1;
red[i]=red[i-1];
}
else
{
r++;
red[i]=red[i-1]+1;
white[i]=white[i-1];
}
}
ans=min(w,r),op=INT_MAX;
for(i=0;i<x;i++)
{
op=min(white[i],red[x-1]-red[i]);
a2=white[i]+red[x-1]-red[i]-op;
ans=min(ans,a2);
}
cout<<ans<<"\n";
return 0;
}


Measured memory_bytes: 6872
#include <cstdio>
#include <map>
#define int long long

int n,m,a[3000000];
std::map<int,int> book;
int R(){
	int x=0;char ch;
	do{ch=getchar();}while(ch>57||ch<48);
	do{x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}while(ch>=48&&ch<=57);
	return x;
}
void W(int c){
	if(c>9)W(c/10);
	putchar('0'+c%10);
}
signed main(){
	int ans=0;
	n=R();
	m=R();
	for(int i=1;i<=n;i++){
		a[i]=(a[i-1]+R()-1)%m;
	}
 	if(n>m){
		book[0]=1;
		for(int i=1;i<=m-1;i++){
			ans+=book[a[i]];
			book[a[i]]++;
		}
		for(int i=m;i<=n;i++){
			book[a[i-m]]--;
			ans+=book[a[i]];
			book[a[i]]++;
		}
	}
	else{
		book[0]=1;
		for(int i=1;i<=n;i++){
			ans+=book[a[i]];
			book[a[i]]++;
		}
	}
	W(ans);
}

Measured memory_bytes: 14336
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
//#define s second
using namespace std;


int dfs (int node, set<ll> st[],bool isVisited[]){
    if (isVisited[node])
        return 1;
    isVisited[node] = true;
    int count = 1;
    for(auto x: st[node]){
        if(!isVisited[x]){
            count += dfs(x, st, isVisited);
        }
    }
    return count;
}
int main()
{
    std::ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    set<ll> set1[n + 1];
    ll i,j;

    for(ll k=0;k<m;k++){
        cin>>i>>j;
        set1[i].insert(j);
        set1[j].insert(i);
    }
    ll ans = 0;
    bool isVisited[n+1];
    memset(isVisited, false, sizeof(isVisited));
    for(i=1;i<=n;i++){
        int x = dfs(i,set1, isVisited);
        if(x > ans){
            ans = x;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 41276
#include<bits/stdc++.h>
using namespace std;
string lst,now;
const int N=200010;
char s[N];
int ans;
int main(){
	scanf("%s",s+1);
	int n=strlen(s+1);
	ans=1;lst=s[1];
	for(int i=2;i<=n;i++)
	{
		now+=s[i];
		if(now!=lst)
		{
			ans++;
			lst=now;
			now="";
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

bool nfs(int l,int r){
	l=(l-1)%3+1,r=(r-1)%3+1;
	return l<=r;
}

int solve(string in,bool sr){
	int n=in.size();
	int res=0;
	int l,r;
	bool isr;
	if(sr){
		isr=true;
		r=in[0]-'0';
	}else{
		isr=false;
		l=in[0]-'0';
	}
	for(int i=1;i<n;++i){
		if(isr){
			int nl=in[i]-'0';
			if(nfs(nl,r))
				l=nl,isr=false;
			else
				r=nl,res++;
		}else{
			int nr=in[i]-'0';
			if(nfs(l,nr))
				r=nr,isr=true;
			else
				l=nr,res++;
		}
	}
	return res;
}

int main(void){
	string in;
	while(cin >> in){
		if(in=="#")
			break;
		cout << min(solve(in,false),solve(in,true)) << endl;
	}
	return 0;
}

Measured memory_bytes: 1324
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
#define ll long long

int main()
{
    Hello
    map<string, string> mp;
    mp["Sunny"] = "Cloudy";
    mp["Cloudy"] = "Rainy";
    mp["Rainy"] = "Sunny";
    string s;
    cin >> s;
    cout << mp[s];
    return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define ll long long
#define asort(a) sort(a.begin(),a.end());

using namespace::std;

int jo(ll int jxo, ll int jyo){//累乗
	ll int jhogeo = 1;
	rep(jinto,0,jyo) jhogeo=jhogeo*jxo;
	return jhogeo;
}
char tobig(char toxbig){//char大文字化
  return (toxbig-0x20);
}
char tolow(char toxlow){//char小文字化
  return (toxlow+0x20);
}
int ctoi(char cctoi){//char->int
  if('0' <= cctoi && cctoi <= '9') return (cctoi-'0');
  return -1;
}
int gcd(int gcad, int gcbd) {//最大公約数
  if(gcad < gcbd) return gcd(gcbd, gcad);
  int gcrd;
  while ((gcrd=gcad%gcbd)) {
    gcad = gcbd;
    gcbd = gcrd;
  }
  return gcbd;
}
int lcm(int lcam, int lcbm){//最小公倍数
 return (lcam*lcbm)/gcd(lcam,lcbm);
}


int main(){
  int n;
  cin>>n;
  vector<int> a(n);

  rep(i,0,n) cin>>a[i];
  asort(a);
  cout<<a[n-1]-a[0];
}

// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//


Measured memory_bytes: 256
/*
        |___________________________Arshit Mangukiya_____________________________|
        |_______________________________DA-IICT__________________________________|
        |_____________________________201801173__________________________________|
*/
        /*______________________WRITE  YOUR  CODE  HERE_________________________*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int  ll;            
typedef long double ld;
#define ff first
#define ss second
#define pi acos(-1)
#define mr_ad_0501 ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
#define all(a)      a.begin(),a.end()
//#define F(i,n) for(ll i=0;i<n;i++)
#define MOD 1000000007
#define MAX 200005
#define sz size()
#define p(x) 		cout<< x << " ";
#define pe(x)		cout<< x << endl ;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
		const ll N=1e5;

//ll dp[64];
//ll ans=1;
// vector<ll> v[N+1];
 //vector<ll> l(N+1,0);
 //vector<ll>vis(N+1);
 ll cnt=0,cnt1=0;
 /*void bfs(ll x)
 {
 	queue<ll> q;
	q.push(x);
    while(!q.empty())
    {
        ll k=q.front();
        q.pop();
        for(auto X:v[k])
        {
            if(!vis[X])
            {
            	l[X]=l[k]+1;
                vis[X]=1;
                q.push(X);
            }
        }
    }
 }*/
void solve()
{
	ll r;
	cin>>r;
	double x=2*pi*r;
	cout<<fixed<<setprecision(12)<<x;
}

int32_t main(){
	mr_ad_0501;
	ll t=1;
	//cin >> t;
	while(t--)
	{
		solve();
	}
}

Measured memory_bytes: 3796
N = int(input())

A = list(map(int, input().split()))

Alice = 0
Bob = 0

while len(A) != 0:
    Alice += max(A)
    A.remove(max(A))
    if len(A) == 0:
        break
    Bob += max(A)
    A.remove(max(A))
    if len(A) == 0:
        break

print(Alice-Bob)

Measured memory_bytes: 9120
<?php
 
fscanf(STDIN, '%d', $N);
$line = trim(fgets(STDIN));
$arr = explode(' ', $line);
$cnt = 0;
for ($i = 0, $len = count($arr); $i < $len; $i++) {
    for ($j = $len - 1; $j > $i; $j--) {
        $tmp = $arr[$j];
        if ($arr[$j - 1] > $tmp) {
            $arr[$j] = $arr[$j - 1];
            $arr[$j - 1] = $tmp;
            $cnt++;
        }
    }
}
echo implode(" ", $arr)."\n";
echo $cnt."\n";


Measured memory_bytes: 9264
N, M, C = map(int, input().split())
B = list(map (int, input().split()))
ac = 0
count = 0
         
for _ in range(N):
    A = list(map (int, input().split()))
    for j in range(M):
        ac += B[j] * A[j]
    if ac + C > 0:
         count += 1
    ac = 0
print(count)

Measured memory_bytes: 3060
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("-Ofast")
#include <bits/stdc++.h>
using namespace std;

typedef int in;
#define int long long
#define pb push_back
#define f first
#define s second
#define double long double
const int MAX=2e5+5;
const int MAX2=2e5+4;
const int MAAX=1e10;
const int MOD=1e9+7;
int a[MAX];
in main()
{
  int n,m;
  cin>>m>>n;
  vector<int>v;
  for(int i=1;i<=n;i++)
  {
      cin>>a[i];
     if(i!=1)
     {
         v.pb(a[i]-a[i-1]);
     }
  }
  v.pb(m-a[n]+a[1]);
  sort(v.begin(),v.end());
  int ans=0;
  for(int i=0;i<n-1;i++)
  {
      ans+=v[i];
  }
  cout<<ans<<endl;
 return 0;
}


Measured memory_bytes: 3444
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func solve(s string) int {
	s = "S" + s
	ret := 0
	cnt := 0
	for i := 1; i < len(s); i++ {
		if s[i] == 'R' && s[i-1] == 'R' {
			cnt++
		} else if s[i] == 'R' {
			cnt = 1
		}
		ret = max(ret, cnt)
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	s := getString()
	out(solve(s))
	// for i := 0; i < 8; i++ {
	// 	s := ""
	// 	for j := 0; j < 3; j++ {
	// 		if i&(1<<j) != 0 {
	// 			s = s + "R"
	// 		} else {
	// 			s = s + "S"
	// 		}
	// 	}
	// 	out(s, solve(s))
	// }
}


Measured memory_bytes: 1772
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int M = 1e9+7;
/*

dp on trees : 
dp[currnode][color] = number of ways of coloring currnode as color 0->black,1->white
f(currnode,last) = a function that sets dp[currnode][0] & dp[currnode][1],last is used to not loop for the parent node

dp[cur][0] = prod(dp[j][1] j = adjacent nodes to cur node)
dp[cur][1] = prod(dp[j][0] + dp[j][1])
every parent depends on the values of their children so leaf nodes should be filled first.dp[leaf][0]= dp[leaf][1] = 1

ans is dp[1][0]+dp[1][1] 1->root node;


*/

void f(int currnode,int parent,vector<vector<ll>> &dp,vector<vector<int>> &a){
  dp[currnode][0] = 1;
  dp[currnode][1] = 1;
  for(int x : a[currnode])
  {
    if(x == parent) continue;
    f(x,currnode,dp,a);
    dp[currnode][0] = (dp[currnode][0]*dp[x][1])%M;
    dp[currnode][1] = (dp[currnode][1]*(dp[x][1] + dp[x][0])%M);
  }
} 


int main() {
  int n;
  cin>>n;
  vector< vector<int> > a(n+1,vector<int>() );
  int x,y;
  for(int i=0;i<n-1;i++)
  {
    cin>>x>>y;
    a[x].push_back(y);
    a[y].push_back(x);
  }
  vector<vector<ll>> dp(n+1,vector<ll>(2));
  f(1,-1,dp,a);
  cout<<(dp[1][1] + dp[1][0])%M;
  return 0;
}


Measured memory_bytes: 21008
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def factor(n):
    rt_n = int(math.sqrt(n)) + 2
    for i in range(1, rt_n):
        if n % i == 0:
            yield (i, n//i)

def main():
    N = I()
    ans = inf
    for s1, s2 in factor(N):
        f = max(len(str(s1)), len(str(s2)))
        ans = min(ans, f)
    print(ans)



main()



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

#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define E 2.71828182845905
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define debug(x) cout<<#x<<" is "<<x<<endl;
#define PI 3.14159265
#define mem(x) memset(x,0,sizeof(x));
using namespace std;
  
void sol() {
	int n,K;
	cin>>n>>K;
	int h[n];
	rep(i,0,n)
	cin>>h[i];
	ll dp[n];
	dp[0]=0;
	rep(i,1,n)
	{
		dp[i]=INT_MAX;
		rep(k,1,K+1)
		{
			int j=i-k;
			if(j<0)
				break;
			dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]));
		}
	}	
	cout<<dp[n-1]<<endl;
}

int main() {
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t=1;
 	//cin>>t;
 	while(t--){	
	sol();
 }

}

Measured memory_bytes: 1536
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
using ll = long long int;
using namespace std;

// Binary Indexed Tree
// 0-indexed
template <typename T>
struct BIT {
  vector<T> bit;
  int neutral = 0, n;
  // 更新クエリ, 区間クエリ
  function<T(T,T)> f = [](const T l, const T r) -> T { return l+r; },
                   g = [](const T l, const T r) -> T { return l+r; };

  // 初期化
  BIT(int n_ = 1e5) { init(n_); }
  void init(int n_ = 1e5) { n = n_+1; bit.assign(n_+1, neutral); }
  // iに対する点更新クエリ
  void update(int i, T w) {
    for(int x = i+1; x < n; x += x&-x) bit[x] = f(bit[x], w);
  }
  // [0,i)に対する区間クエリ
  T query(int i) {
    T ret = neutral;
    for(int x = i+1; x > 0; x -= x & -x) ret = g(ret, bit[x]);
    return ret;
  }
  // 合計がw以上の最小の位置 O(log^2 n)
  int lower_bound(T w) {
    int lb = -1, ub = n;
    while(ub-lb>1) {
      int mid = (lb+ub)/2;
      if(query(mid) >= w) ub = mid;
      else lb = mid;
    }
    return ub;
  }
};

ll type[100010], a[100010], b[100010], sc[100010];
signed main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n, c;
  cin >> n >> c;
  vector<pair<ll,ll>> v;
  for(int i=0; i<c; ++i) {
    cin >> type[i];
    if(type[i] == 0) {
      cin >> a[i] >> b[i];
      sc[a[i]] += b[i];
      v.push_back({sc[a[i]], -a[i]});
    } else {
      cin >> a[i];
    }
  }

  // (点数、チーム番号)のpairを番号つける
  for(int i=1; i<=n; ++i) v.push_back({0, -i});
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  reverse(v.begin(), v.end());

  map<pair<ll,ll>,ll> p2n;
  vector<pair<ll,ll>> n2p;
  int idx = 0;
  for(auto i: v) {
    p2n[i] = idx++;
    n2p.push_back(i);
  }

  BIT<ll> bit(n2p.size());
  for(int i=1; i<=n; ++i) bit.update(p2n[{0, -i}], 1);

  memset(sc, 0, sizeof(sc));
  for(int i=0; i<c; ++i) {
    if(type[i] == 0) {
      bit.update(p2n[{sc[a[i]], -a[i]}], -1);
      sc[a[i]] += b[i];
      bit.update(p2n[{sc[a[i]], -a[i]}], 1);
    } else {
      int ret = bit.lower_bound(a[i]);
      cout << -n2p[ret].second << " " << n2p[ret].first << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 26124
lwrd = list()
lcnt = list()

N = int(input())
for i in range(N):
    w = input()
    if w in lwrd:
        lcnt[lwrd.index(w)] += 1
    else:
        lwrd.append(w)
        lcnt.append(1)

M = int(input())
for i in range(M):
    w = input()
    if w in lwrd:
        lcnt[lwrd.index(w)] -= 1
    else:
        lwrd.append(w)
        lcnt.append(-1)

if max(lcnt) >= 0:
    print(max(lcnt))
else:
    print(0)

Measured memory_bytes: 3064
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	m := scanInt()
	s := scanInt()

	g := make([][]train, n)

	for i := 0; i < m; i++ {
		u := scanInt() - 1
		v := scanInt() - 1
		a := scanInt()
		b := scanInt()
		g[u] = append(g[u], train{v, a, b})
		g[v] = append(g[v], train{u, a, b})
	}

	c := make([]int, n)
	d := make([]int, n)
	for i := 0; i < n; i++ {
		c[i] = scanInt()
		d[i] = scanInt()
	}

	es := make([][]edge, 3000*n)
	done := make([]bool, 3000*n)
	var dfs func(co, to int)
	dfs = func(co, to int) {
		v := co + to*3000
		if done[v] {
			return
		}
		done[v] = true
		if co < 2500 {
			nc := min(2500, co+c[to])
			es[v] = append(es[v], edge{nc + to*3000, d[to]})
			dfs(nc, to)
		}
		for _, t := range g[to] {
			if t.a > co {
				continue
			}
			nc := co - t.a
			nt := nc + t.to*3000
			es[v] = append(es[v], edge{nt, t.b})
			dfs(nc, t.to)
		}
	}

	s = min(s, 2500)
	dfs(s, 0)
	dist := dijkstra(es, s)

	for i := 1; i < n; i++ {
		mi := inf
		for j := 0; j < 2501; j++ {
			mi = min(mi, dist[j+i*3000])
		}
		fmt.Fprintln(wr, mi)
	}
}

type train struct{ to, a, b int }

const inf = 1<<60 - 1

type edge struct{ to, co int }
type vert struct{ d, v int }
type pqForDijkstra []vert

func (pq pqForDijkstra) Len() int            { return len(pq) }
func (pq pqForDijkstra) Swap(i, j int)       { pq[i], pq[j] = pq[j], pq[i] }
func (pq pqForDijkstra) Less(i, j int) bool  { return pq[i].d < pq[j].d }
func (pq *pqForDijkstra) Push(x interface{}) { *pq = append(*pq, x.(vert)) }
func (pq *pqForDijkstra) Pop() interface{} {
	x := (*pq)[len(*pq)-1]
	*pq = (*pq)[0 : len(*pq)-1]
	return x
}

func dijkstra(es [][]edge, s int) []int {
	d := make([]int, len(es))
	for i := 0; i < len(es); i++ {
		d[i] = inf
	}
	d[s] = 0
	pq := &pqForDijkstra{vert{0, s}}
	heap.Init(pq)
	for len(*pq) != 0 {
		p := heap.Pop(pq).(vert)
		if p.d > d[p.v] {
			continue
		}
		for _, e := range es[p.v] {
			cost := d[p.v] + e.co
			if cost < d[e.to] {
				d[e.to] = cost
				heap.Push(pq, vert{d[e.to], e.to})
			}
		}
	}
	return d
}


Measured memory_bytes: 64612
#include<iostream>
using namespace std;
int main()
{
  int N;
  cin>>N;
  int H[N];
  for(int i=0;i<N;i++){
    cin>>H[i];
  }
  int sum=0;
  bool flag=true;
  for(int i=0;i<N;i++){
    for(int j=0;j<i;j++){
      if(H[i]<H[j]){
        flag=false;
        break;
      }
    }
    if(flag){
      sum++;
    }
    else{
      flag=true;
    }
  }
      
  cout<<sum;

}


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

int main()
{
  int n,m;
  for(;cin>>n>>m,n;)
    {
      int s1[n],s2[m];
      for(int i=0;i<n;i++)
	  cin>>s1[i];
      for(int i=0;i<m;i++)
	  cin>>s2[i];
      int x=-1,y=-1;
      for(int i=0;i<n;i++)
	for(int j=0;j<m;j++)
	  {
	    swap(s1[i],s2[j]);
	    
	    int sum1=0,sum2=0;
	    for(int z=0;z<n;z++)
	      sum1+=s1[z];
	    for(int z=0;z<m;z++)
	      sum2+=s2[z];
	    if(sum1==sum2)
	      {
		if(x==-1 || x+y>s1[i]+s2[j])
		  y=s1[i],x=s2[j];
	      }
	    swap(s1[i],s2[j]);
	  }
      if(x==-1)
	cout<<"-1"<<endl;
      else
	cout<<x<<" "<<y<<endl;
    }

}

Measured memory_bytes: 1160
a,b,k =map(int,input().split())

def euclid(p,q):
  if q == 0:
    return p
  else:
    return euclid(q,p%q)
  
n = euclid(a,b)
count = 0
for i in range(n):
  if n % (n-i)==0:
    count += 1
  if count == k:
    print(n-i)
    break


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
const lli MOD = 1000000007;

int main() {
    int N; cin >> N;
    vector<lli> A(N);
    for (int i=0; i<N; i++) cin >> A[i];
    vector<lli> cumsum(N, 0); 
    cumsum[N-1] = A[N-1];
    for (int i=N-2; i>0; i--) {
        cumsum[i] = cumsum[i+1] + A[i];
        cumsum[i] %= MOD;
    }
    lli ans = 0;
    for (int i=0; i<N-1; i++) {
        ans += A[i] * cumsum[i+1];
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 6420
#include <stdio.h>

int main() {
 int h1, h2, m1, m2, k;
 scanf("%d %d %d %d %d", &h1, &m1, &h2, &m2, &k);
 printf("%d\n", 60 * (h2 - h1) + m2 - m1 - k);
 
 return 0;
}


Measured memory_bytes: 1716
n=int(input())
t = n
l=[]

while t>0:
 if t%26==0:
  p=26
  l.insert(0,chr(p +96))
 else:
  p=t%26
  l.insert(0,chr(p +96))
 t = (t-p)//26
 
print('' .join(l))

Measured memory_bytes: 9188
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
public class Main{
	public static void main(String[] args) throws NumberFormatException, IOException {
		BinaryTree tree = new BinaryTree();
		//Scanner sc = new Scanner(System.in);
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int count = Integer.parseInt(br.readLine());
		for(int i=0;i<count;i++) {
			String input = br.readLine();
			if(input.charAt(0) == 'i') {
				tree.insert(Long.parseLong(input.substring(7)));
			}else if(input.charAt(0) == 'f'){
				tree.find(Long.parseLong(input.substring(5)));
			}else{
				tree.inOrder(tree.root);
				System.out.println();
				tree.preOrder(tree.root);
				System.out.println();
			}
		}
	}
}

class BinaryTree {
	
	Node root;
	
	class Node{
		Node left;
		Node right;
		long value;
		public Node(long value) {
			super();
			this.value = value;
		}		
		
	}
	
	/*
	 * public void insert(Node node, long value) { if(root == null) { root = new
	 * Node(value); return; } if(node.value>value) { if(node.left == null) {
	 * node.left = new Node(value); }else { insert(node.left,value); } }else {
	 * if(node.right == null) { node.right = new Node(value); }else {
	 * insert(node.right,value); } } }
	 */
	
	public void insert(long value) {
		Node node;
		Node parent = null;
		if(root == null) {
			root = new Node(value);
			return;
		}
		node = root;
		while(node !=null) {
			parent = node;
			if(node.value>value) {
				node = node.left;
			}else {
				node = node.right;
			}
		}
		
		node = new Node(value);
		if(parent.value>node.value) {
			parent.left = node;
		}else {
			parent.right = node;
		}
		
	}
	//t root  x=node y=parent
	
	public void preOrder(Node n) {
		if(n == null) {
			return;
		}
		System.out.print(" "+n.value);
		preOrder(n.left);
		preOrder(n.right);
	}
	
	public void inOrder(Node n) {
		if(n == null) {
			return;
		}
		inOrder(n.left);
		System.out.print(" "+n.value);
		inOrder(n.right);
	}
	
	public void find(long value) {
		Node n = root;
		while(n!=null) {
			if(n.value==value) {
				System.out.println("yes");
				return;
			}
			if(n.value>value) {
				n = n.left;
			}else {
				n = n.right;
			}
		}
		System.out.println("no");
	}
	

}



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

int main(){
    int n, p; string s;
    cin >> n >> p >> s;
    
    vector<int> d(n+1);
    for(int i=0; i<n; i++){
        d[i] = s[i] - '0';
    }
    reverse(d.begin(), d.end());

    if(p == 2 || p == 5){
        long long int ans = 0;
        for(int i=1; i<=n; i++){
            //cout << d[i] << " ";
            if(d[i] % p == 0) ans += (n-i+1);
        }
        cout << ans << endl;
        return 0;
    }

    map<int, long long int> rem;
    rem[0] = 1;
    int pow10 = 1;
    // cumulative sum
    for(int i=1; i<=n; i++){
        d[i] = (d[i] * pow10 + d[i-1]) % p;

        if(rem.find(d[i]) == rem.end()) rem[d[i]] = 1;
        else rem[d[i]] += 1;

        pow10 *= 10;
        pow10 %= p;
    }
    
    long long int ans = 0;
    for(auto r : rem){
        //cout << r.first << " " << r.second << endl;
        ans += r.second * (r.second - 1) / 2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4956
// https://atcoder.jp/contests/abc132/tasks/abc132_c

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

int main()
{
    long n;
    cin >> n;
    vector<long> d(n);
    for (long i = 0; i < n; i++)
    {
        cin >> d[i];
    }
    sort(d.begin(), d.end());
    cout << d[n / 2] - d[(n / 2) - 1] << endl;
}


Measured memory_bytes: 4024
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <map>
#define INF 10000000
using namespace std;
typedef pair<int,int> P;

int senbei[10][10000];
int r,c;
int rowFlag[10];
int Max;

int countSum(){
  int sum=0;
  for(int i=0;i<c;i++){
    int colSum = 0;
    for(int j=0;j<r;j++){
      if(senbei[j][i]==!rowFlag[j]){
        colSum++;
      }
    }
    sum += max(colSum,r-colSum);
  }
  return sum;
}

int main(){
  while(1){
    cin >> r >> c;
    if(r==0&&c==0) return 0;
    for(int i=0;i<r;i++){
      for(int j=0;j<c;j++){
        cin >> senbei[i][j];
      }
    }
    Max = 0;
    for(int i=0;i<1<<10;i++){
      for(int j=0;j<10;j++){
        rowFlag[j] = i >> j & 1;
      }
      int sum = countSum();
      if(Max<sum){
        Max = sum;
      }
    }
    cout << Max << endl;
  }
}

Measured memory_bytes: 1548
import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int n=in.nextInt();
		bTree tree=new bTree(n);
		
		for(int i=0;i<n;i++) {
			int id=Integer.parseInt(in.next()), L=Integer.parseInt(in.next()), R=Integer.parseInt(in.next());
			if(L!=-1) {
				tree.T[id].l=L;
				tree.T[L].p=id;
			}
			if(R!=-1) {
				tree.T[id].r=R;
				tree.T[R].p=id;
			}
		}
		
		PrintWriter out=new PrintWriter(System.out);
		for(int i=0;i<n;i++) {
			out.printf("node %d: parent = %d, ",i,tree.T[i].p);
			out.printf("sibling = %d, degree = %d, ", tree.getSibling(i), tree.getDegree(i));
			out.printf("depth = %d, height = %d, ", tree.getDepth(i, 0), tree.getHeight(i));
			out.println(tree.getCat(i));
		}
		out.flush();
	}

}

class bTreeNode{
	int p=-1,l=-1,r=-1;
}

class bTree{
	static bTreeNode T[];
	
	bTree(int n){
		T=new bTreeNode[n];
		for(int i=0;i<n;i++)T[i]=new bTreeNode();
	}
	
	static int getSibling(int u) {
		if(T[u].p==-1)return -1;
		
		if(T[T[u].p].l==u) return T[T[u].p].r;
		else return T[T[u].p].l;
	}
	
	static int getDegree(int u) {
		int d=0;
		if(T[u].l!=-1)d++;
		if(T[u].r!=-1)d++;
		return d;
	}
	
	static int getDepth(int p, int d) {
		if(T[p].p!=-1)d=getDepth(T[p].p,++d);
		return d;
	}
	
	static int getHeight(int p) {
		int L=0,R=0;
		if(T[p].l==-1 && T[p].r==-1)return 0;
		if(T[p].l!=-1)L=getHeight(T[p].l);
		if(T[p].r!=-1)R=getHeight(T[p].r);
		return Math.max(L, R)+1;
	}
	
	static String getCat(int u) {
		String str;
		if(T[u].p==-1)str="root";
		else if(T[u].l==-1 && T[u].r==-1)str="leaf";
		else str="internal node";
		return str;
	}
}


Measured memory_bytes: 26572
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
	int  h,w; cin >> h >> w;
	int hw[h+4][w+5];
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			char c; cin >> c;
			if(c == '.')hw[i][j] = 0;
			else hw[i][j] = 1;
		}
	}
	
	
	for(int i = 0; i < h; i++){
		bool isline = true;
		for(int j = 0; j < w; j++){
			if(hw[i][j] == 1)isline = false;
		}
		if(isline){
			for(int j = 0; j < w; j++){
				hw[i][j] = -1;
			}
		}
	}

	for(int i = 0; i < w; i++){
		bool isline = true;
		for(int j = 0; j < h; j++){
			if(hw[j][i] == 1)isline = false;
		}
		if(isline){
			for(int j = 0; j < h; j++){
				hw[j][i] = -1;
			}
		}
	}

	for(int i = 0; i < h; i++){
		int minuscnt = 0;
		for(int j = 0; j < w; j++){
			if(hw[i][j] != -1)cout << ((hw[i][j] == 1)? "#":".");
			else minuscnt++;
		}
		if(minuscnt != w)cout << endl;
		
	}

}

Measured memory_bytes: 256
import sys
bbn=1000000007
	
#+++++

		
def main():
	n = int(input())
	l=[0]*(n+1)
	for i in range(n):
		a=int(input())
		l[i]=a

	ret=0
	for i in range(n):
		ret += l[i] // 2
		if l[i]%2==1 and l[i+1]>=1:
			ret+=1
			l[i+1]-=1
	print(ret)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 6900
#include<cstdio>

int comparedice(void);
class dice{
private:
	int a,b,c,d,e,f;
public:
	void setnumber(void);
	void E(void);
	void W(void);
	void S(void);
	void N(void);
	void R(void);
	void V(void);
	int frontside(int x,int y);
	int putme(char me);
};

void dice::setnumber(void){
scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
}


void dice::E(void){
int a1=a,c1=c,d1=d,f1=f;
a=d1;
c=a1;
d=f1;
f=c1;
}

void dice::W(void){
int a1=a,c1=c,d1=d,f1=f;
a=c1;
c=f1;
d=a1;
f=d1;
}

void dice::S(void){
int a1=a,b1=b,e1=e,f1=f;
a=e1;
b=a1;
e=f1;
f=b1;
}

void dice::N(void){
int a1=a,b1=b,e1=e,f1=f;
a=b1;
b=f1;
e=a1;
f=e1;
}

int dice::frontside(int x,int y){
int i=0,a1,b1,c1,d1,e1,f1;
while(1){
	a1=a;
	b1=b;
	c1=c;
	d1=d;
	e1=e;
	f1=f;
	a=b1;
	b=c1;
	c=a1;
	d=f1;
	e=d1;
	f=e1;
	i++;
	if(i==4)break;
}

if (b!=x){
	a=e1;
	b=f1;
	c=d1;
	d=c1;
	e=a1;
	f=b1;
}
//printf("%d %d %d %d %d %d\n",a,b,c,d,e,f);
i=0;
while (b!=x){
	a1=a;
	b1=b;
	c1=c;
	d1=d;
	e1=e;
	f1=f;
	a=b1;
	b=c1;
	c=a1;
	d=f1;
	e=d1;
	f=e1;
	i++;
	if(i==4)break;
}
if(i==4){ return 0;}
i=0;
while(c!=y){
	a1=a;
	c1=c;
	d1=d;
	f1=f;
	a=d1;
	c=a1;
	d=f1;
	f=c1;
	i++;
	if(i==5) break;
}
if(i==5) {return 0;}
return 1;
}

int dice::putme(char me){
if(me=='a'){
return a;
}else if(me=='b'){
return b;
}else if(me=='c'){
return c;
}else if(me=='d'){
return d;
}else if(me=='e'){
return e;
}else {
return f;
}
}
int comparedice(dice,dice);
int main(void){
int n;
scanf("%d",&n);
dice koro[n];
int i,j;
for (i=0;i<n;i++){
	koro[i].setnumber();
}
for (i=0;i<n;i++){
	for(j=0;j<i;j++){
		if (comparedice(koro[i],koro[j])==0){
			printf("No\n");
		}
		if (comparedice(koro[i],koro[j])==0){return 0;}
	}
}
printf("Yes\n");
return 0;
}
int comparedice(dice koro1,dice koro2){
int i,j;
for(i=0;i<3;i++){
	for(j=0;j<4;j++){
		if(
		(koro1.putme('a')==koro2.putme('a'))
		&&(koro1.putme('b')==koro2.putme('b'))
		&&(koro1.putme('c')==koro2.putme('c'))
		&&(koro1.putme('d')==koro2.putme('d'))
		&&(koro1.putme('e')==koro2.putme('e'))
		&&(koro1.putme('f')==koro2.putme('f'))
	){return 0;}
		koro2.E();
	}
koro2.E();
koro2.N();
}
koro2.N();
koro2.E();
koro2.E();
for(i=0;i<3;i++){
	for(j=0;j<4;j++){
		if(
	(koro1.putme('a')==koro2.putme('a'))
	&&(koro1.putme('b')==koro2.putme('b'))
	&&(koro1.putme('c')==koro2.putme('c'))
	&&(koro1.putme('d')==koro2.putme('d'))
	&&(koro1.putme('e')==koro2.putme('e'))
	&&(koro1.putme('f')==koro2.putme('f'))
	){return 0;}
		koro2.E();
	}
koro2.E();
koro2.N();
}
return 1;
}

Measured memory_bytes: 2612
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

for i in range(1,4):
    total = 0
    Dxy = 0   
    for j,k in zip(a,b):
        total += pow(abs(j-k),i)
        Dxy = pow(total,(1/i))
    print(Dxy)

c = []
for j,k in zip(a,b):
    c.append(abs(j-k))
print(max(c))



Measured memory_bytes: 5660