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

using namespace std;

int a[110];
int b[110];

int n;

int main(){
    cin>>n;
    for(int i=0;i<n-1;i++)cin>>b[i];
    int run = n-1;

    a[run] = b[run-1];
    a[0] = b[0];

    while(run>=2){
        a[run-1] = min(b[run-1], b[run-2]);
        run--;
    }

    long long ans = 0;
    for(int i=0;i<n;i++) ans+=a[i];
    cout<<ans<<endl;
    return 0;

}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<i64>();
    let (mut a, b, mut c, d) = (v[0], v[1], v[2], v[3]);
    loop {
        c -= b;
        if c <= 0 {
            println!("Yes");
            return;
        }
        a -= d;
        if a <= 0 {
            println!("No");
            return;
        }
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 2072
# -*- coding: utf-8 -*-
import sys


N=input()


a=[[] for i in range(N+1)]

#隣接リスト
for i in range(N-1):
	x,y,z=list(map(int,raw_input().split()))
	a[x].append((y,z))
	a[y].append((x,z))

#print a
	

Q,K=list(map(int,raw_input().split()))


b=[]
for i in range(Q):
	b.append(map(int, raw_input().split()))
#print b



#訪問判別フラグ
F=(N+1)*[0]

#Stack
S=[]

#距離
dist=[0 for i in range(N+1)]

#先頭から深さ優先探索
S.append(K)
former_v=0
v=0
while len(S) != 0:
	v=S.pop()
	
	if F[v]==0:
		F[v]=1

		for u,length in a[v]:
			if F[u]==0:
				S.append(u)
				dist[u]=dist[v]+length
				#print dist

#print dist



for x in range(len(b)):

	print dist[ b[x][0] ]+ dist[ b[x][1] ]


Measured memory_bytes: 61172
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main(){
	int N;
  	int min=100,max=-100;
  	int cost=10000000;
  	vector<int> dataSet;
  	
  	cin >> N;
  	for(int i = 0 ; i < N ; ++i){
     	int input;
      	cin >> input;
    	min = (input < min) ? input : min;
      	max = (input > max) ? input : max;
      	dataSet.push_back(input);
    }
	
  	for(int i = min ; i <= max ; ++i){
    	int tmp=0;
      	for(int j = 0 ; j < N ; ++j){
        	tmp += pow( (dataSet[j] -i ) , 2);
        }
      	cost = (tmp < cost) ? tmp : cost; 
   	}
	cout << cost;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define f(i,a,b) for( ll i = a; i < (ll) b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= (ll) b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < (ll) b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= (ll) b ; i-= k)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define inter ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nuintptr)
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
 
const ll MAX= 2e5+6;
const ll inf =1e9;

ll a[MAX],b[MAX];

int main(){
	ll n,k,x;
	cin>>n>>k;
	f(i,1,n+1) cin>>a[i];
	vi ans;
	ans.push_back(1);
	x=a[1];
	b[1]=1;
	while(b[x]!=1) {
		b[x]=1;
		ans.push_back(x);
		x=a[x];
	}
//	cout<<x<<endl;
	ll l=0,r=0;
	f(i,0,ans.size()){
		if(ans[i]!=x) l++;
		else break;
	}
	r=ans.size()-l;
//	cout<<l<<" "<<r<<endl;
	if(k<l) cout<<ans[k]<<endl;
	else cout<<ans[l  +((k-l)%(r))]<<endl;
}	

Measured memory_bytes: 8420
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    vector<vector<int>> a(3,vector<int>(3));
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin>>a[i][j];
        }
    }
    vector<vector<int>> arr(3,vector<int>(3,0));
    int n;
    cin>>n;
    while(n--){
        int z;
        cin>>z;
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                if(a[i][j]==z)
                    arr[i][j]=1;
            }
        }
    }
    int ok=0;
    for(int i=0;i<3;i++){
        ok=0;
        if((arr[i][0]==1 && arr[i][1]==1 && arr[i][2]==1) || (arr[0][i]==1 && arr[1][i]==1 && arr[2][i]==1)){
            cout<<"Yes";
            return 0;
        }
    }
    if((arr[0][0]==1 && arr[1][1]==1 && arr[2][2]==1)|| (arr[0][2]==1 && arr[1][1]==1 && arr[2][0]==1)){
        cout<<"Yes";
        return 0;
    }
    cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=1e5+5;
int n,a[N],minn[N];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i) scanf("%d",&a[i]);
	for(int i=1;i<=n;++i)
	{
		if(a[i]>a[i-1]) --a[i];
		if(a[i]<a[i-1]) {puts("No");return 0;} 
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

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

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  std::array<int, 13> l = { 0, 1, 2, 1, 3, 1, 3, 1, 1, 3, 1, 3, 1 };
  int x, y; std::cin >> x >> y;
  if ( l[x] == l[y] ) std::cout << "Yes" << std::endl;
  else std::cout << "No" << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  ll r;
  cin >> r;
  cout << 3 * r * r << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;
#define rnt re int
#define re //register
#define I inline int
#define V inline void
#define B inline bool
#define isnum(ch) ('0'<=ch&&ch<='9')
#define FOR(i,a,b) for(rnt i=a;i<=b;i++)
#define ROF(i,a,b) for(rnt i=a;i>=b;i--)
#define REP(a,b) for(rnt _=0;x=a[_],_<b;_++)
#define gc (_op==_ed&&(_ed=(_op=_buf)+fread(_buf,1,100000,stdin),_op==_ed)?EOF:*_op++)
char _buf[100000],*_op(_buf),*_ed(_buf);
I getint(){
	rnt _s=0;re char _ch=gc;
	while(!isnum(_ch))_ch=gc;
	while(isnum(_ch))_s=_s*10+_ch-48,_ch=gc;
	return _s;
}
const int N=2e5+2;
int n,a[N],siz[N];
struct node{
	int p,w;
	B operator<(const node&u)const{
		return p==u.p?w<u.w:p<u.p;
	}
}dp[N][10],tmp[N];
I max(const int&x,const int&y){return x>y?x:y;}
node mk(rnt x,rnt y){return (node){max(0,x),y};}
V input(){n=getint();FOR(i,1,n)a[i]=getint();}
V init(){n=unique(a,a+n+2)-a-1,dp[0][0]=mk(0,0),siz[0]=1;}
V work(){
	rnt d,minn,tot;node x;
	FOR(i,1,n){
		d=a[i]-a[i-1],minn=N,tot=0;
		if(d>0)REP(dp[i-1],siz[i-1])
			tmp[tot++]=mk(0,x.w+2),tmp[tot++]=mk(x.p,x.w+1),tmp[tot++]=mk(x.p+d,x.w);
		else REP(dp[i-1],siz[i-1])
			tmp[tot++]=mk(0,x.w+2),tmp[tot++]=mk(x.p+d,x.w+1),tmp[tot++]=mk(x.p,x.w);
		sort(tmp,tmp+tot);
		REP(tmp,tot)if(minn>x.w&&x.p<=a[i])
			dp[i][siz[i]++]=mk(x.p,x.w),minn=x.w;
		FOR(j,0,tot-1)tmp[j]=mk(0,0);
	}
	minn=N;
	REP(dp[n],siz[n])if(x.w<minn)minn=x.w;
	cout<<minn;
}
int main(){
	input();
	init();
	work();
	return 0;
}

Measured memory_bytes: 17536
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <math.h>
#include <bits/stdc++.h>
#include <queue>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;
typedef pair<ll,ll> P;

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

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

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

// gcd
template<typename T>
T gcd(T a, T b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}

// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm( T m, T n ){
    // 引数に0がある場合は0を返す
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;
    return ((m/gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}


int dx[5]={1,0,-1,0};
int dy[5]={0,1,0,-1};
// v.front() = -BOUND;
// v.back() = BOUND;
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }
    // 素数である
    return true;
}

int N;
struct edge{ll to, cost;};
vector<edge> G[100010];
ll d[100010];

void dijkstra(ll s){
    priority_queue<P, vector<P>, greater<P>>que;
    Fill(d,INF);
    d[s]=0LL;
    que.push(P(0,s));

    while(!que.empty()){
        P p=que.top(); que.pop();
        ll v = p.second;
        if(d[v]<p.first) continue;
        for(int i=0; i<G[v].size(); i++){
            edge e=G[v][i];
            if(d[e.to] > d[v]+e.cost){
                d[e.to]=d[v]+e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}
int main() {
    cin >> N;

    rep(i,N-1){
        ll a,b,c;
        cin >> a >> b >> c;
        a--, b--;
        G[a].push_back(edge{b,c});
        G[b].push_back(edge{a,c});
    }
    ll Q,K;
    cin >> Q >> K;

    K--;
    dijkstra(K);
    rep(i,Q){
        int x,y;
        cin >> x >> y;
        x--, y--;
        cout << d[x]+d[y] << endl;
    }
    return 0;
}


Measured memory_bytes: 11120
X, N = map(int,input().split())
P = list(map(int, input().split()))

P = set(P)
ans = 0
tmp = 1000000
setlist = range(-1,102)
for ele in setlist:
    if ele in P:
        continue
    if abs(ele-X) < tmp:
        ans = ele
        tmp = abs(ele-X)
    

print(ans)



Measured memory_bytes: 9184
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<iomanip>
#include<iostream>
using namespace std;
int lst=0,lstx,lsty,n,f;
int read()
{
	int f=1,x=0;
	char ch=getchar();
	while(isdigit(ch)==0 && ch!='-')ch=getchar();
	if(ch=='-')f=-1,ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return x*f;
}
void write(int x)
{
	char ch[20];
	int f=0;
	if(!x){putchar('0');return;}
	if(x<0){putchar('-');x=-x;}
	while(x)ch[++f]=x%10+'0',x=x/10;
	while(f)putchar(ch[f--]);
	putchar('\n');
}
int main()
{
    int a=read(),b=read();
	if((a*b)&1)printf("Odd");
	else printf("Even"); 
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
#define fi first
#define se second
#define pi pair<ll,ll>
#define pii pair<ll,pi>
#define pb push_back
#define mk make_pair
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);
	ll n;
	cin >> n;
	if (n % 1000 == 0)
		cout << "0" << endl;
	else {
		int got = n / 1000;
		cout << (++got * 1000) - n << endl;
	}
}

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

#define sz(x) int(x.size())
#define pii pair<int, int>
#define All(x) (x).begin(), (x).end()
#define mp make_pair
#define Task "abc"

typedef long long ll;
const int maxn = 2e5 + 10;
const ll mod = 1e9 + 7;

ll a[maxn];
int n;
ll k;

bool ok(ll mid){
  ll cnt = 0;
  for (int i = 1; i < n; ++i){
    if (a[i] == 0){
      if (mid >= 0) cnt += n - i;
      continue;
    }
    ll d = mid / a[i];
    if (a[i] > 0){
      if (abs(mid) % a[i] != 0){
        if ( (d == 0 && mid < 0) || d < 0) --d;
      }
      int pos = upper_bound(a + i + 1, a + n + 1, d) - a;
      --pos;
      cnt += pos - i;
    } else {
      if (abs(mid) % abs(a[i]) != 0){
        if ((d == 0 && mid < 0) || d > 0) d++;
      }
      int pos = lower_bound(a + i + 1, a + n + 1, d) - a;
      cnt += n - pos + 1;
    }
  }
  return cnt >= k;
}

int main(){
  ios_base::sync_with_stdio(0); cin.tie(NULL);
//  freopen(Task".inp", "r", stdin); freopen(Task".out", "w", stdout);
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  sort(a + 1, a + n + 1);
  ll inf = 1e18;
  ll l = -inf, r = inf;
  while (l <= r){
    ll mid = (l + r) / 2;
    if (ok(mid)) r = mid - 1;
    else l = mid + 1;
  }
  cout << r + 1;
return 0;
}




Measured memory_bytes: 5192
N = int(input())
ans = [0]


def solve(n):
    if n == 0:
        return
    if n > 0:
        p, a, k = 1, 1, 0
    else:
        p, a, k = -2, -2, 1
    while abs(n) > abs(a):
        p *= 4
        a += p
        k += 2
    while len(ans) <= k:
        ans.append(0)
    ans[k] = 1
    solve(n - p)


solve(N)
print("".join([str(x) for x in reversed(ans)]))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define REV(v) reverse(v.begin(), v.end());
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, start, stop) for (int i = start; i < stop; i++)
#define FORR(i, start, stop) for (int i = start; i > stop; i--)
#define SORT(v, n) sort(v, v + n);
#define SORTR(v, n) sort(v, v + n,greater<int>());
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.begin(), v.end(),greater<int>());
#define REMOVE(v,n) remove(vector<int> v,v+v.size(),int n)
#define ll long long
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
#define V(v,i,j) vector(v.begin() + i, v.begin() + j)
#define INSERT(va,vb) va.insert(va.end(), vb.begin(), vb.end())
using namespace std;
typedef vector<int> vint;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

//vector< vector<int> > v (size1, vector<int>(size2) );

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w;
    cin>>h>>w;
    FOR(i,0,w+2) cout<<'#';
    cout<<endl;
    FOR(i,0,h){
        string ai;
        cin>>ai;
        cout<<'#';
        cout<<ai;
        cout<<'#';
        cout<<endl;
    }
    FOR(i,0,w+2) cout<<'#';
    cout<<endl;
	
}

Measured memory_bytes: 256
open System
let readInt () = stdin.ReadLine() |> int
let readIntArray () = stdin.ReadLine().Split(' ') |> Array.map int

let N = readInt ()
let A : int [] = Array.zeroCreate N
for i in [0..N-1] do A.[i] <- readInt ()

A
|> Array.distinct
|> Array.length
|> printfn "%d"


Measured memory_bytes: 14940
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.Set;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		HashMap<Integer, Integer> mp = new HashMap<Integer, Integer>();
		Set<Integer> set = new HashSet<Integer>();
		for (int i = 0; i < n; i++) {
			int m = scan.nextInt();
			if(set.contains(m)){
				if(mp.containsKey(m)){
					int value=mp.get(m);
					mp.put(m, value+1);
				}else{
					mp.put(m, 1);//不在广场
				}
			}
			set.add(m);

		}
		int count=0;
		for (Entry<Integer, Integer> entry : mp.entrySet()) {
            Integer key = entry.getKey();
            Integer value = entry.getValue();
            if(value%2==1){
            	count++;
            }
          
        }
		System.out.println(set.size()-count);
	}
}


Measured memory_bytes: 63540
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ifstream f("B.in");
ofstream g("B.out");

unordered_map < string,int > H;

int main()
{
    int N;
    cin>>N;
    for(int i=1;i<=N;i++)
    {
        string S;
        cin>>S;
        H[S]++;
    }
    cout<<"AC x "<<H["AC"]<<'\n';
    cout<<"WA x "<<H["WA"]<<'\n';
    cout<<"TLE x "<<H["TLE"]<<'\n';
    cout<<"RE x "<<H["RE"]<<'\n';

    return 0;
}


Measured memory_bytes: 3640
#include<cstdio>
#include<algorithm>
using namespace std;
int n, K, M[1<<22], rb, rnum = -1;
int D[21][1 << 21];
char p[(1 << 20) + 2];
int Num(int dep, int a, int num, int b) {
	return ((a + 1) << (n - dep + 1)) - (1 << (num + 1)) + b;
}
int main() {
	int i, j;
	scanf("%d%d", &n, &K);
	for (i = 1; i <= (1 << (n+1)); i++) {
		M[i] = M[i - 1];
		while ((1 << M[i]) < i)M[i]++;
	}
	for (i = 0; i <= n; i++) {
		scanf("%s", p);
		for (j = 0; j < (1 << i); j++) {
			if (p[j] == '1') {
				D[i][Num(i, j, 0, 0)]++;
			}
		}
	}

	for (i = n - 1; i >= 0; i--) {
		for (j = 0; j < (1 << (n + 1)); j++) {
			if ((j + 1) % (1 << (n + 1 - i)) == 0)continue;
			int a = j >> (n - i + 1);
			int t = ((a + 1) << (n - i + 1)) - j;
			int num = M[t] - 1;
			if (num < 0) {
				printf("%d %d\n", i, j);
			}
			int b = (1 << (num + 1)) - t;
			int ck = -1;
			if (num) ck = b >> (num - 1);
			for (int k = 0; k < 2; k++) {
				if (ck == k) {
					D[i][j] += D[i+1][Num(i + 1, a * 2 + k, num - 1, b & ((1 << (num - 1)) - 1)  )];
				}
				else if(i+1+num<=n){
					D[i][j] += D[i + 1][Num(i + 1, a * 2 + k, num, b)];
				}
			}
		}
	}
	i = 0;
	for (j = 0; j < (1 << (n + 1)) - 1; j++) {
		if (D[0][j] >= K) {
			int a = j >> (n - i + 1);
			int t = ((a + 1) << (n - i + 1)) - j;
			int num = M[t] - 1;
			int b = (1 << (num + 1)) - t;
			if (rnum < num)rnum = num, rb = b;
		}
	}
	for (i = rnum - 1; i >= 0; i--) {
		printf("%d", (rb >> i) & 1);
	}

	return 0;
}

Measured memory_bytes: 182400
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
#include <cstdio>
#include <complex>
#include <cstring>

using namespace std;

const int N = 100000 + 5;

int n, m;
int par[N];
int a[N];
vector<int> x[N];

int getp(int u)
{
    return u == par[u]? u : par[u] = getp(par[u]);
}

void solve()
{
    cin >> n >> m;
    if (m == n - 1) {
        cout << 0 << endl;
        return;
    }

    for(int i = 0; i < n; ++ i) {
        par[i] = i;
        scanf("%d", a + i);
    }
    for(int i = 0; i < m; ++ i) {
        int u, v;
        scanf("%d%d", &u, &v);
        par[getp(v)] = getp(u);
    }

    for(int i = 0; i < n; ++ i) {
        x[getp(i)].push_back(a[i]);
    }

    vector<int> all;
    long long cost = 0;
    for(int i = 0; i < n; ++ i) {
        if (i == par[i]) {
            sort(x[i].begin(), x[i].end());
            cost += x[i][0];
            for(int j = 1; j < x[i].size(); ++ j) {
                all.push_back(x[i][j]);
            }
        }
    }

    sort(all.begin(), all.end());
    int r = n - m;
    for(int i = 0; i < 2 * (r - 1) - r; ++ i) {
        if (i >= all.size()) {
            cout << "Impossible" << endl;
            return;
        }
        cost += all[i];
    }
    cout << cost << endl;
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 6528
N, M = map(int, input().split())
ab = [[int(i) for i in input().split()] for _ in range(N)]
cd = [[int(i) for i in input().split()] for _ in range(M)]
for a, b in ab:
    n = float('inf')
    ans = 0
    for i, tmp in enumerate(cd):
        c, d = tmp
        m = abs(a-c)+abs(b-d)
        if n > m:
            n = m
            ans = i+1
    print(ans)


Measured memory_bytes: 39408
package main

import "fmt"

func main() {
    var a, b, c int
    var rc string
    fmt.Scanf("%v %v %v", &a, &b, &c)
    mapInt := map[int]bool{a: true, b: true, c: true}
    keys := getKeys(mapInt)

    if mapInt[maxInt(keys)-minInt(keys)] {
        rc = "Yes"
    } else {
        rc = "No"
    }
    fmt.Println(rc)
}

func maxInt(slc []int) (rc int) {
    for i, e := range slc {
        if i == 0 || e >= rc {
            rc = e
        }
    }
    return
}

func minInt(slc []int) (rc int) {
    for i, e := range slc {
        if i == 0 || e < rc {
            rc = e
        }
    }
    return
}

func getKeys(mapInt map[int]bool) (rc []int) {
    for key := range mapInt {
        rc = append(rc, key)
    }
    return
}


Measured memory_bytes: 512
#pragma region cp-helper
#include <bits/stdc++.h>
using namespace std;
#define AC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ii pair<int, int>
#define lll pair<ll, ll>
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define vll vector<lll>
#define vvl vector<vl>
#define vii vector<ii>
#define all(a) a.begin(), a.end()
#define qsort(a) sort(all(a))
#define qsortd(a) sort(all(a), greater<>())
#define qsortf(a, f) sort(all(a), f)
#define pb(n) push_back(n)
#define eb(n) emplace_back(n)
#define pp(a, b) emplace_back(a, b)
#define umap unordered_map
#define uset unordered_set
#define nl '\n'
#define fileio(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)
#define qmod %mod
#define pls int
#define give main()
const int mod = 1000000007;
#pragma endregion
const int N = 200005;

pls give {
    AC;
    int n, m;
    cin >> n >> m;
    if (n%m == 0) cout << n/m;
    else cout << n/m+1;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    // 整数の入力
    string a;
    cin >> a;
    int b=0;
    b = a[0]=='1'?b+1:b;
    b = a[1]=='1'?b+1:b;
    b = a[2]=='1'?b+1:b;
    // 出力
    cout << b << endl;
    return 0;
}


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

template<class T> ostream& operator<<(ostream &os, vector<T> V){
	os << "[ ";
	for(auto v  : V) os << v << " ";
	return os << " ]";
}
template<class T> ostream& operator<<(ostream &os, set<T> V){
	os << "[ ";
	for(auto v  : V) os << v << " ";
	return os << " ]";
}
template<class T , class R > ostream& operator<<(ostream &os, map<T , R> V){
	os << "[ ";
	for(auto v  : V) os << "(" << v.first << ":" << v.second << ")";
	return os << " ]";
}
template<class T , class R > ostream& operator<<(ostream &os, pair<T , R> V){
	return os << "(" << V.first << "," << V.second << ")";
}

#define cerr cout
#define TRACE
#ifdef TRACE
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');
        cerr.write(names, comma - names) << " : " << arg1<<" | ";
        __f(comma+1, args...);
    }
    clock_t clk=clock();
    #define checktime() cout<<"\nTime Elapsed : "<<float(clock()-clk)/CLOCKS_PER_SEC<<endl
#else
    #define trace(...);
    #define checktime();
#endif
/*---------------------------Defines----------------------*/
typedef long long int ll;
typedef long double ld;
#define pll pair<ll,ll>
#define pb push_back
#define F first
#define S second
#define I insert
#define vll vector<ll>
#define vbl vector<bool>
#define vvll vector<vll>
#define vld vector<ld>
#define vb vector<bool>
#define vc vector<char>
#define vpll vector<pll>
#define all(x) (x).begin(), (x).end()
/*-----------------------Modular Arithmetic---------------*/
inline int add(int x,int y,int mod){
    x+=y;
    if (x>=mod) return x-mod;
    return x;
}
inline int sub(int x,int y,int mod){
    x-=y;
    if (x<0) return x+mod;
    return x;
}
inline int mul(int x,int y,int mod){
    return (x*1ll*y)%mod;
}
inline int power(int x,int y,int mod){
    int ans=1;
    while(y){
        if (y&1) ans=mul(ans,x,mod);
        x=mul(x,x,mod);
        y>>=1;
    }
    return ans;
}
inline int inv(int x,int mod){
    return power(x,mod-2,mod);
}
/*-----------------------------Code begins----------------------------------*/



void solve(){
    ll n,k;cin>>n>>k;
    ll a[n];
    for(ll i=0;i<n;i++) cin>>a[i];
    vll dp(n+k,1ll<<60);
    dp[0]=0;
    for(ll i=0;i<n;i++){
        for(ll j=1;j<=k;j++)
            dp[i+j]=min(dp[i+j], dp[i]+abs(a[i]-a[i+j]));
    }
    cout<<dp[n-1]<<"\n";
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout<<fixed<<setprecision(25);

    ll t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 1792
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = -inf ;count = 0 ;pro = 1

n=int(input())
P=list(map(int,input().split()))
for i in range(n):
    if mans > P[i]:
        count+=1
    mans=min(mans,P[i])
print(count)

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

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

    map<int, int> f;
    for(int i=2; i<=n; ++i) {
        int k=i;
        for(int j=2; j*j<=k; ++j) {
            int c=0;
            while (k%j==0) { ++c; k/=j; }
            if (c) f[j]+=c;
        }
        if (k>1) ++f[k];
    }
    auto res=1LL;
    const int mod=1e9+7;

    for(auto& e: f)
        res=res*(1+e.second)%mod;
    cout<<res<<endl;
}


Measured memory_bytes: 384
package main

import (
	"fmt"
	"math"
)

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

type luggage struct {
	weight int
	value int
}

func main(){
	var N,W int
	var luggge_list []luggage
	var DP [][]int
	fmt.Scanf("%d %d",&N,&W)
	for i:=0;i<N;i++{
		l := luggage{}
		fmt.Scanf("%d %d",&l.weight,&l.value)
		luggge_list = append(luggge_list,l)
	}

	for i:=0;i<N+1;i++{
		DP = append(DP,make([]int,W+1))
	}

	for i:=1;i<N+1;i++{
		//i 荷物
		for j:=1;j<W+1;j++{
			//j 許容
			if luggge_list[i-1].weight <= j{
				DP[i][j] = max(DP[i-1][j],DP[i-1][j-luggge_list[i-1].weight]+luggge_list[i-1].value)
			}else{
				DP[i][j] = DP[i-1][j]
			}
		}
	}

	fmt.Println(DP[N][W])

}

Measured memory_bytes: 81804
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ for(auto it : P) { s << "<" << it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ for(auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s << endl; }


using pll = pair<long long, long long>; // (money, time)
using Edge = pair<int, pll>;
using Graph = vector<vector<Edge>>;
const long long INF = 1LL<<60;
const int MAX = 2500;

int N, M;
long long S;
Graph G;
vector<long long> C, D; // money, time

void solve() {
    if (S >= MAX) S = MAX;
    vector<vector<long long>> dp(N, vector<long long>(MAX+1, INF));
    priority_queue<pair<long long, pll>, vector<pair<long long, pll> >, greater<pair<long long, pll> > > que;
    dp[0][S] = 0;
    que.push(make_pair(0, pll(0, S)));
    while (!que.empty()) {
        auto p = que.top(); que.pop();
        //COUT(p);
        long long time = p.first;
        int v = p.second.first;
        long long s = p.second.second;
        if (time > dp[v][s]) continue;

        if (s + C[v] <= MAX) {
            long long ns = s + C[v];
            long long ntime = time + D[v];
            if (chmin(dp[v][ns], ntime)) {
                que.push(make_pair(ntime, pll(v, ns)));
            }
        }
        for (auto e : G[v]) {
            if (s < e.second.first) continue;
            int nv = e.first;
            long long ns = s - e.second.first;
            long long ntime = time + e.second.second;
            if (chmin(dp[nv][ns], ntime)) {
                que.push(make_pair(ntime, pll(nv, ns)));
            }
        }
    }
    for (int v = 1; v < N; ++v) {
        long long res = INF;
        for (int s = 0; s <= MAX; ++s) chmin(res, dp[v][s]);
        cout << res << endl;
    }
}

int main() {
    while (cin >> N >> M >> S) {
        G.assign(N, vector<Edge>());
        for (int i = 0; i < M; ++i) {
            long long u, v, a, b;
            cin >> u >> v >> a >> b;
            --u, --v;
            G[u].push_back(Edge(v, pll(a, b)));
            G[v].push_back(Edge(u, pll(a, b)));
        }
        C.resize(N); D.resize(N);
        for (int i = 0; i < N; ++i) cin >> C[i] >> D[i];
        solve();
    }
}

















Measured memory_bytes: 7300
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.awt.Point;
public class Main {
	static Scanner sc;
	static PrintWriter out;
	static final int uncal = -1;
	static final int mod = (int) (1e9)+7;
	public static void main(String[] args) throws Exception{
		// TODO Auto-generated method stub
		sc = new Scanner(System.in); 
		out = new PrintWriter(System.out);
		int n = sc.nextInt();
		int k = sc.nextInt();
		long left;
		long right;
		long ans = 0l;
		for(int i=k;i<=n;i++) {
			left = sum(i-1);
			right = sum(n)-sum(n-i);
			ans += right - left + 1;
		}
		ans %= mod;
		out.println(ans+1);
		out.close();
	}
	static long sum(int n) {
		long sum = 1l;
		if(n%2 == 0)
		{
			sum *= n/2;
			sum *= (n+1);
		}else {
			sum *= (n+1)/2;
			sum *= n;
		}
		return sum;
	}
	static void shuffle(int[] array) {
		Random rand = new Random();
		for (int i = 0; i < array.length; i++) {
			int randomIndexToSwap = rand.nextInt(array.length);
			int temp = array[randomIndexToSwap];
			array[randomIndexToSwap] = array[i];
			array[i] = temp;
		}
	}
	static boolean isPalindrome(String s) {
		int l = s.length();
		char[] sa = s.toCharArray();
		for(int i=0;i<l/2;i++) {
			if(sa[i] != sa[l-i-1])
				return false;
		}
		return true;
	}
	static class Point extends java.awt.Point implements Comparable<Point>{
		public Point(int x,int y) {
			// TODO Auto-generated constructor stub
			super(x,y);
		}
		public String toString() {
			return x+" "+y;
		}
		@Override
		public int compareTo(Point p) {
			// TODO Auto-generated method stub
			if(x == p.x)
				return y - p.y;
			return x - p.x;
		}
		
	}
	static class Scanner{
		private BufferedReader br;
		private StringTokenizer st;
		public Scanner(InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
		}
		public Scanner(String filename) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(filename));
		}
		public String next() throws IOException{
			while(st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
		public int nextInt() throws IOException{
			return Integer.parseInt(next());
		}
		public long nextLong() throws IOException{
			return Long.parseLong(next());
		}
		public double nextDouble() throws IOException{
			return Double.parseDouble(next());
		}
		public int[] inArr(int n) throws Exception{
			int a [] = new int[n];
			st = new StringTokenizer(br.readLine());
			for(int i=0;i<n;i++) {
				a[i] = Integer.parseInt(next());
			}
			return a;
		}
	}

}

Measured memory_bytes: 33040
import collections

H, W = map(int, input().split((" ")))
mp = []
for _ in range(H):
    mp.append(input())

white = 0
for i in range(H):
    for j in range(W):
        if mp[i][j] == '.':
            white += 1

que = collections.deque()
dist = [[-1 for _ in range(W)] for _ in range(H)]
dist[0][0] = 1
que.append((0, 0))

while que:
    h, w = que.popleft()
    for dh, dw in ((0, 1), (0, -1), (1, 0), (-1, 0)):
        if h + dh < 0 or w + dw < 0 or h + dh >= H or w + dw >= W:
            continue
        elif mp[h + dh][w + dw] == '#' or dist[h + dh][w + dw] != -1:
            continue
        dist[h + dh][w + dw] = dist[h][w] + 1
        que.append((h + dh, w + dw))

if dist[H - 1][W - 1] == -1:
    print(-1)
else:
    print(max(white - (dist[H - 1][W - 1]), 0))

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

using namespace std;

template<typename T>
struct Network {
    static const T INF = numeric_limits<T>::max() >> 12;
    struct Edge {
        int from, to;
        T cap;
        Edge* rev;
        Edge(int from, int to, T cap) :
            from(from), to(to), cap(cap) {}
    };
    vector<Edge*> edges;
    vector<vector<Edge*>> graph;
    Network(int N) : graph(N, vector<Edge*>()) {}
    ~Network() { 
        for (auto e : edges) delete(e);
    }
    void addEdge(int s, int t, T cap) {
        auto e = new Edge(s, t, cap);
        auto r = new Edge(t, s, 0);
        edges.push_back(e); edges.push_back(r);
        e->rev = r; r->rev = e;
        graph[s].push_back(e); graph[t].push_back(r);
    }
    T maxFlow(int s, int t) {
        const int N = graph.size();
        vector<int> label(N, 0); label[s] = N;
        vector<T> excess(N, 0);
        int level = 0;
        for (auto e : graph[s]) {
            auto gamma = e->cap;
            e->cap = 0;
            e->rev->cap = gamma;
            excess[e->from] -= gamma;
            excess[e->to] += gamma;
        }
        vector<vector<int>> L(2*N, vector<int>()); {
            for (int i = 0; i < N; i++) if (i != s and i != t and excess[i] > 0) {
                L[0].push_back(i);
            }
        }
        auto push = [&](Edge* e) {
            auto gamma = min(excess[e->from], e->cap);
            if (gamma == 0) return;
            e->cap -= gamma;
            e->rev->cap += gamma;
            int u = e->from; int v = e->to;
            if (u != s and u != t and excess[u] == gamma) {
                assert(not L[label[u]].empty());
                L[label[u]].pop_back();
            }
            if (v != s and v != t and excess[v] == 0) L[label[v]].push_back(v);
            excess[u] -= gamma; excess[v] += gamma;
        };
        auto relabel = [&](int v) {
            assert(not L[level].empty());
            L[level].pop_back();
            label[v] = 1<<28;
            for (auto e : graph[v]) {
                if (e->cap <= 0) continue;
                int w = e->to;
                label[v] = min(label[v], label[w] + 1);
            };
            L[label[v]].push_back(v);
            level = label[v];
        };
        while (level >= 0) {
            if (L[level].empty()) { level--; continue; }
            auto v = L[level].back();
            bool used = false;
            for (auto e : graph[v]) {
                if (label[e->from] == label[e->to] + 1 and e->cap > 0) {
                    used = true;
                    push(e);
                }
            }
            if (not used) {
                relabel(v);
            }
        }
        return excess[t];
    }
};

int main() {
    int X, Y, E; cin >> X >> Y >> E;
    Network<int> n(X + Y + 2);
    for (int i = 0; i < E; i++) {
        int x, y; cin >> x >> y;
        int a = x + 1;
        int b = y + X + 1;
        n.addEdge(a, b, 1);
    }
    for (int a = 1; a <= X; a++) n.addEdge(0, a, 1);
    for (int b = X + 1; b <= X + Y; b++) n.addEdge(b, X + Y + 1, 1);
    cout << n.maxFlow(0, X + Y + 1) << endl;
    return 0;
}

Measured memory_bytes: 3920
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
#include <bitset>
#include <iomanip>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  //cout<<fixed<<setprecision(10);
  ll n,k,ans=0;
  cin>>n>>k;
  if(n*500>=k)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

int main(){
    int a, b, num, digit;
    
    while(cin >> a)
    {
        cin >> b;
        num = a + b;
        digit = 0;
        while(num != 0)
        {
            num = num / 10;
            digit++;
        }
        cout << digit << endl;
    }
    return 0;
}

Measured memory_bytes: 2988
main = do
    n <- readLn
    let xs = [x | x <- [1..n], x `mod` 3 == 0 || rdiv x ]
     in putStrLn $ concatMap ((' ' :) . show) xs
    where
        rdiv :: Int -> Bool
        rdiv x
            | x `mod` 10 == 3 = True
            | x `div` 10 /= 0 = rdiv (x `div` 10)
            | otherwise       = False


Measured memory_bytes: 3980
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,k=map(int,input().split())
    if(2*k>n+1):
        print(-1)
        return
    
    h=(2*k+3*n-1)//2
    for i in range(0,(n+1)//2):
        print(k+2*i,h-i,k+2*n+i)
    for i in range(0,n//2):
        print(k+1+i*2,k+2*n-1-i,k+2*n+((n-1)//2)+i+1)
resolve()

Measured memory_bytes: 50088
#include<iostream>
using namespace std;
int n,p,a,c;
long long ans=1;
main(){
    cin>>n>>p;
    for(int i=0;i<n;i++){
        cin>>a;
        if(!(a%2))c++;
        ans*=2;
    }
    if(n==c && p==1)cout<<0<<endl;
    else if(c==n)cout<<ans<<endl;
    else cout<<ans/2<<endl;
}

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

def getPrimeFactors(x):
    ans = []
    for d in range(2, int(x**0.5)+1):
        while x%d == 0:
            ans.append(d)
            x //= d
    if x != 1:
        ans.append(x)
    return ans

pfAs = [1] + getPrimeFactors(A)
pfBs = [1] + getPrimeFactors(B)

ans = len(set(pfAs) & set(pfBs))
print(ans)


Measured memory_bytes: 38896
#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000000000001;
struct edge{int to,cost;};
struct pos{
	int x,y,cost;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	int r;
	cin>>r;
	cout<<r*2*3.1415<<endl;

	return 0;
}


Measured memory_bytes: 3788
L=int(input())

ans = []
m = 0
add = -1
mask = 0xffffff
for i in range(24):
    mask >>= 1
    d = 24 - i - 1
    if ((~mask) & L) != 0:
        if add == -1:
            n = d+1
            add = 1 << d
            b = 1
            # [0, 2^d) の範囲
            for i in range(1,d+1):
                ans.append(str(i) + " " + str(i+1) + " 0")
                ans.append(str(i) + " " + str(i+1) + " " + str(b))
                b *= 2
                m += 2
        else :
            ans.append(str(d+1) + " " + str(n) + " " + str(add))
            add += (1 << d)
            m += 1
        L &= mask
#    print(" ",d,L,mask)
print(n,m)
for i in ans:
    print(i)



Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main()
{
    int n, s = 0;
    cin >> n;

    int x = n;
    while (x > 0) {
        s += x % 10;
        x /= 10;
    }
    string ans = "No";
    if (n % s == 0) ans = "Yes";

    cout << ans << endl;

    return 0;
}

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

int main()
{
    int a, b, s;
    cin >> a >> b;
    s = a + b;
    if (s % 2 == 0)
    {
        cout << s / 2 << endl;
    }
    if (s % 2 != 0)
    {
        cout << s / 2 + 1 << endl;
    }
}


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

using ll = long long;
using P = pair<ll, ll>;

const ll MOD = 998244353;
const ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(ll)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define DEBUG(x) ;

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

int main(int argc, char **argv)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll N, X, M; cin >> N >> X >> M;
	vector<ll> his;
	vector<bool> is(100000+10, false);

	ll res{0};
	ll m{-1};
	REP(i, N)
	{
		if (is[X])
		{
			m = X;
			break;
		}
		else
			is[X] = true;
		res += X;
		his.push_back(X);
		(X *= X) %= M;
	}

	if (m == -1)
	{
		std::cout << res << std::endl;
		return 0;
	}

	vector<ll> hiss;
	ll it = find(ALL(his), m) - his.begin();
	for (ll i = it; i < his.size(); ++i)
	{
		hiss.push_back(his[i]);
		DEBUG(his[i]);
	}

	ll rem = N - it;
	DEBUG(rem);
	ll sum = accumulate(ALL(hiss), 0ll);
	DEBUG(sum);
	ll cs = hiss.size();
	DEBUG(cs);
	res += sum * (rem/cs -1);
	res += accumulate(hiss.begin(), hiss.begin()+(rem%cs), 0ll);
	
	std::cout << res << std::endl;
	return 0;
}


Measured memory_bytes: 4300
from heapq import heappop,heappush
import sys
input=sys.stdin.buffer.readline
N,M,S=map(int,input().split())
INF=10**18
Time=[[INF]*2501 for _ in range(N)]#[都市][お金]
graph=[[] for _ in range(N)]
S=min(S,2500)
for _ in range(M):
    u,v,a,b=map(int,input().split())
    graph[u-1].append((v-1,a,b))
    graph[v-1].append((u-1,a,b))

cd=[tuple(map(int,input().split())) for _ in range(N)]

hq=[(0,0,S)] #時間、都市、金
while hq:
    ct,cur_city,si=heappop(hq)
    for nxt_city,cost,t in graph[cur_city]:#都市、費用、所要時間
        if si>=cost:
            new_t=ct+t
            if new_t<Time[nxt_city][si-cost]:
              Time[nxt_city][si-cost]=new_t
              heappush(hq,(new_t,nxt_city,si-cost))
    c,d=cd[cur_city]
    v_new=min(si+c,2500)
    t_new=ct+d
    if t_new<Time[cur_city][v_new]:
      Time[cur_city][v_new]=t_new
      heappush(hq,(t_new,cur_city,v_new))
for i in range(1,N):
    print(min(Time[i]))

Measured memory_bytes: 24312
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		int mod = 1000000007;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		sc.close();
		long []mini= new long[n+2];
		long []maxi= new long[n+2];

		long ans = 0;
		for (int i=k; i<=n+1;i++) {
			ans += max(i, n, maxi) - min(i, mini) +1;
		}
		System.out.println(ans%mod);
	}

	private static long max(int i, int n, long[] maxi)
	{
		if (i==1) {
			maxi[i]=n;
		} else if (maxi[i-1] == 0) {
			maxi[i]=max2(i, n);
		} else {
			maxi[i]=maxi[i-1]+n-i+1;
		}
		return maxi[i];
	}

	private static long max2(int i, int n)
	{
		long ans = 0;
		int k = n;
		for (int j=0; j<i; j++) {
			ans += k;
			k--;
		}
		return ans;
	}

	private static long min(int i, long[] mini)
	{
		if (i==1) {
			mini[i]=0;
		} else if (mini[i-1] == 0) {
			mini[i]=min2(i);
		} else {
			mini[i]=mini[i-1]+i-1;
		}
		return mini[i];
	}

	private static long min2(int i)
	{
		long ans = 0;
		int k = 0;
		for (int j=0; j<i; j++) {
			ans += k;
			k++;
		}
		return ans;
	}
}


Measured memory_bytes: 30336
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = Integer.parseInt(sc.nextLine());
        char[] S = sc.nextLine().toCharArray();
        int[] WE = new int[N];
        int[] EW = new int[N];
        int tmp = 0;
        for (int i = 1; i < N; i++) {
            if (S[i - 1] == 'W') {
                tmp++;
            }
            WE[i] = tmp;
        }
        tmp = 0;
        for (int i = N - 1; i > 0; i--) {
            if (S[i] == 'E') {
                tmp++;
            }
            EW[i - 1] = tmp;
        }

        int ans = WE[0] + EW[0];
        for (int i = 1; i < N; i++) {
            int sum = WE[i] + EW[i];
            ans = Math.min(ans, sum);
        }
        System.out.println(ans);
    }
}



Measured memory_bytes: 33708
#include<bits/stdc++.h>
using namespace std;
#define pb          push_back
#define m_p			make_pair
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define sz(x)       (int)x.size()
#define f			first
#define debug		cout<<"##########3"<<endl
#define mod			1000000007
#define ll			long long int
#define lMax		LLONG_MAX
// queue<int> , prefix_sum(a,a+n) , reverse(a,a+n) , priority_queue <int> max heap , priority_queue <int, vector<int>, greater<int> > min heap;
// == precedence gretaer then &
ll n,m;
string s,s1,s2;
priority_queue <long long int> pq;
map<ll, char> mp;
vector<pair<int,int> > inc;
vector<pair<int,int> > de;
ll arr[300005],barr[300005];
//EG
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
	ll i,j,k,z,ans=0,c=0,x=0,y=0;
	
	cin>>x>>y;
	z = __gcd(x,y);
	n = z;
	c++;
	for(i=2;i<=sqrt(z);i++){
		if(n%i==0){
			c++;
			while(n%i==0){
				n=n/i;
			}
		}
	}
	if(n>1)
	c++;
	cout<<c;
 	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
int32_t main() {
	fast_io();
	int a, v, b, w, t;
	cin >> a >> v >> b >> w >> t;
	if (w >= v)
		cout << "NO\n";
	else
	{
		int d1 = v * t;
		int d2 = w * t;
		if (d1 >= d2 + abs(a - b))
			cout << "YES\n";
		else
			cout << "NO\n";
	}
	return 0;
}

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

int main()
{
  int x, y;
  while(1){
    cin >> x >> y;
    
    if (x == 0 && y == 0) {
      /* code */
      break;
    }
    else if(x <= y){
      cout << x << " " << y << endl;
    }
    else
    {
      cout << y << " " << x << endl;
    }
  }
  
  return 0;
}



Measured memory_bytes: 3096