akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<ll,pll> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int sx,sy,gx,gy,n;
vp a;

int main(){
	cin>>sx>>sy>>gx>>gy>>n;
	for(int i=0;i<n;i++){
		int x,y;
		cin>>x>>y;
		if(min(sx,gx)<=x&&x<=max(sx,gx)&&min(sy,gy)<=y&&y<=max(sy,gy)) a.push_back({x,y});
	}
	n=a.size();
	if(gx<sx){
		sx*=-1,gx*=-1;
		for(int i=0;i<n;i++) a[i].first*=-1;
	}
	if(gy<sy){
		sy*=-1,gy*=-1;
		for(int i=0;i<n;i++) a[i].second*=-1;
	}
	sort(a.begin(),a.end());
	vi dp(n,inf);
	for(auto p:a){
		int x=p.second,I=lower_bound(dp.begin(),dp.end(),x)-dp.begin();
		dp[I]=x;
	}
	int d=lower_bound(dp.begin(),dp.end(),inf)-dp.begin();
	double res=100.0*(gx-sx+gy-sy)-20*d+5*pi*d;
	if(d==gx-sx+1||d==gy-sy+1) res+=5*pi;
	cout<<syosu(13)<<res<<endl;
}

Measured memory_bytes: 2544
package main

import "fmt"

func main() {
	var num, val, min, max int
	var sum int64
	fmt.Scan(&num)
	fmt.Scan(&val)
	min = val
	max = val
	sum = int64(val)
	for i := 1; i < num; i++ {
		fmt.Scan(&val)
		sum += int64(val)
		if val < min {
			min = val
		} else if max < val {
			max = val
		}
	}
	fmt.Println(min, max, sum)
}



Measured memory_bytes: 1692
#include <iostream>
#include <vector>

using namespace std;

#define D

#ifdef D
int A[100][100] = {};
int B[100][100] = {};
int main(void)
{
	int n, m, l;
	cin >> n >> m >> l;

	for (size_t i = 0; i < n; i++)
	{
		for (size_t j = 0; j < m; j++)
		{
			cin >> A[i][j];

		}
	}
	for (size_t i = 0; i < m; i++)
	{
		for (size_t j = 0; j < l; j++)
		{
			cin >> B[i][j];
		}
	}
	for (size_t i = 0; i < n; i++)
	{
		for (size_t j = 0; j < l; j++)
		{
			if (j != 0)
				cout << " ";
			long long ans = 0;
			for (size_t k = 0; k < m; k++)
			{
				ans += A[i][k] * B[k][j];
			}
			cout << ans;
		}
		cout << endl;
	}

	return 0;
}

#endif // D

Measured memory_bytes: 3152
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner s = new Scanner(System.in);
        String str = s.next();
        StringBuilder sb = new StringBuilder();
        sb.append(str).setCharAt(3, '8');
        System.out.println(sb);
    }
}


Measured memory_bytes: 21844
#include<iostream>
#include<map>
using namespace std;main(){map<string,int>h;map<string,int>::iterator t;int n;string s;for(cin>>n;cin>>s>>n;)h[s]+=n;for(n=0;n++<5;)for(t=h.begin();t!=h.end();t++)if(t->first.size()==n)cout<<t->first<<" "<<t->second<<"\n";}

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

#define PB push_back
#define all(a) a.begin(), a.end()
#define REP(type,i, a, n) for ( type i = a; i < n; i++)

#define vi vector<int>
#define vii vector<pair<int, int> >
#define vl vector<long long>
#define vvi vector< vector<int> >

typedef long long ll;

// for debugging output uncomment below line 
// #define DBG
//NOTE : COMMNET ABOVE LINE BEFORE SUBMITTING

#ifdef DBG
	#define dout if(true) cout
	#define dfor if(true) REP
#else
	#define dout if(false) cout
	#define dfor if(false) REP
#endif


using namespace std;

void optimizeIO() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

//==================================================================================///////////////////
///                  CLASHER
//////////////==========================================================//////////////////////////////

int main() {
    optimizeIO();
    int n;
    cin >> n;
     vi tm(n+1), h(n);
     REP(ll, i,0, n+1){
         cin >> tm[i];
     }
     REP(int,i,0,n){
         cin >> h[i];
     }

     ll counter=0;
     REP(int ,i,0,n){
         int x = min(tm[i],h[i]);
         counter +=x;
         tm[i] = tm[i]-x;
         h[i] = h[i]-x;

         x = min(tm[i+1], h[i]);
        tm[i+1] = tm[i+1]-x;
         h[i] = h[i]-x;
         counter +=x;
     }
     cout << counter;
    return 0;

}



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

int main(){
  int n;
  cin >> n;
  double t,a;
  cin >> t >> a;
  int place;
  double tmin=999999;
  double h;
  rep(i,n){
    cin >> h;
    if(tmin>abs((t-h*0.006)-a)){
      tmin = abs((t-h*0.006)-a);
      place = i;
    }
  }
  cout << place+1 << endl;

	return 0;
}


Measured memory_bytes: 256
N, *XY = map(int, open(0).read().split())
XY = list(zip(*[iter(XY)] * 2))

mod = sum(XY[0]) % 2
if any((x + y) % 2 != mod for x, y in XY):
    print(-1)
    quit()

D = [2 ** i for i in reversed(range(32))] + [1] * (mod == 0)
print(len(D))
print(*D)

for x, y in XY:
    A = []
    for d in D:
        if 0 <= x - y and 0 <= x + y:
            A.append("R")
            x -= d
        elif x - y < 0 and 0 <= x + y:
            A.append("U")
            y -= d
        elif 0 <= x - y and x + y < 0:
            A.append("D")
            y += d
        else:
            A.append("L")
            x += d

    print("".join(A))

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, P;
  string S;
  cin >> N >> P >> S;
  int64_t res = 0;
  if (P == 2 || P == 5) {
    for (int i = 0; i < N; i++) {
      if ((S[i] - '0') % P == 0) res += i + 1;
    }
  } else {
    reverse(S.begin(), S.end());
    map<int, int> mp;
    mp[0] = 1;
    int cur = 0, b = 1;
    for (char s : S) {
      cur += (s - '0') * b;
      cur %= P;
      res += mp[cur]++;
      b *= 10;
      b %= P;
    }
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 916
;
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	ArrayList<ArrayList<Integer>> g = new ArrayList<>();
	int n;
	boolean used[];
	public void run() {
		Scanner sc = new Scanner(System.in);
		n=sc.nextInt();
		for(int i=0; i<n; i++) {
			g.add(new ArrayList<>());
		}
		long d1[] = new long[n];
		long d2[] = new long[n];

		used = new boolean[n];
		for(int i=0; i<n-1; i++) {
			int a=sc.nextInt();
			int b=sc.nextInt();
			a--;
			b--;
			g.get(a).add(b);
			g.get(b).add(a);
		}
		Arrays.fill(used, false);
		d1[0]=0;
		dfs(0,0,d1);

		Arrays.fill(used, false);
		d2[n-1]=0;
		dfs(n-1,0,d2);

		int bc=0;
		int wc=0;
		for(int i=1; i<n-1; i++) {
			if(d1[i]<=d2[i]) {
				bc++;
			}else {
				wc++;
			}
		}
		if(bc==wc) {
			System.out.println("Snuke");
		}else if(bc<wc) {
			System.out.println("Snuke");
		}else {
			System.out.println("Fennec");
		}
		sc.close();
	}

	public void dfs(int parent, long dist, long d[]) {
		used[parent]=true;
		d[parent]=dist;
		for(int i=0; i<g.get(parent).size(); i++) {
			int t = g.get(parent).get(i);
			if(used[t]) continue;
			dfs(t, dist+1, d);
		}
	}

}


Measured memory_bytes: 92820
#include<bits/stdc++.h>
using namespace std;
#define y1 A2Dalek
#define y0 Cyberman
#define yn RoseTyler
#define j1 JackHarkness
#define fs first
#define sd second
const int N=2e5;
const long long oo=1e16+5;
int du[]={-1,0,0,1};
int dv[]={0,-1,1,0};
const long long mod=1e9+7;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
long long sqr(long long x) {return x*x;}
int getbit(int state, int i) {return ((state>>i)&1);}

int n,nq,A,B,q[N+5];
long long res=oo;
struct IT
{
    long long f[4*N+5];
    long long lz[4*N+5];
    long long a[N+5];
    void build(int id, int l, int r)
    {
        if (l>r) return;
        if (l==r) {f[id]=a[l]; return;}
        int mid=(l+r)/2;
        build(id*2,l,mid); build(id*2+1,mid+1,r);
        f[id]=min(f[id*2],f[id*2+1]);
    }
    void down(int id)
    {
        long long val=lz[id]; lz[id]=0;
        f[id*2]+=val; f[id*2+1]+=val;
        lz[id*2]+=val; lz[id*2+1]+=val;
    }
    void update(int id, int l, int r, int u, long long val)
    {
        if (l>u || r<u || l>r) return;
        if (l==r)
        {
            f[id]=min(f[id],val);
            return;
        }
        int mid=(l+r)/2;
        down(id);
        update(id*2,l,mid,u,val); update(id*2+1,mid+1,r,u,val);
        f[id]=min(f[id*2],f[id*2+1]);
    }
    long long get(int id, int l, int r, int u, int v)
    {
        if (l>r || l>v || r<u) return oo;
        if (u<=l && r<=v) return f[id];
        int mid=(l+r)/2;
        down(id);
        return min(get(id*2,l,mid,u,v),get(id*2+1,mid+1,r,u,v));
    }
} tru,cong;
int main()
{
	//freopen("Many Moves.inp","r",stdin);
	//freopen("Many Moves.out","w",stdout);
	ios_base::sync_with_stdio(false);
    cin>>n>>nq;
    cin>>A>>B;
    for (int i=1;i<=n;i++)
    {
        tru.a[i]=abs(B-i)-i;
        cong.a[i]=abs(B-i)+i;
    }
    tru.build(1,1,n); cong.build(1,1,n);
    q[0]=A;
    for (int i=1;i<=nq;i++)
    {
        cin>>q[i];
        long long val=abs(q[i]-q[i-1]);
        long long now=min(tru.get(1,1,n,1,q[i])+q[i], cong.get(1,1,n,q[i],n)-q[i]);
        tru.f[1]+=val; cong.f[1]+=val;
        tru.lz[1]+=val; cong.lz[1]+=val;
        tru.update(1,1,n,q[i-1],now-q[i-1]);
        cong.update(1,1,n,q[i-1],now+q[i-1]);
    }
    for (int i=1;i<=n;i++)
    {
        res=min(res,tru.get(1,1,n,i,i)+i);
    }
    cout<<res;
	return 0;
}


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

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

int main(){
  int64_t a,b;cin>>a>>b;
  cout<<lcm(a,b)<<endl;
}

Measured memory_bytes: 256
//made by Sert
#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9 + 34;
const int N = (int)1e6 + 34;

typedef long long ll;

set<pair<int, int>> s;

void del(int x, int y) {
    pair<int, int> p = make_pair(x, y);
    if (s.find(p) != s.end()) s.erase(p);
}

void go(int n, int mult, int d) {
    if (d % 4 == 3) return;
    if (d % 4 == 0) {
        go(n, mult * 2, d / 4);
    }
    for (int i = 0; i < n * 2; i++) {
        for (int j = 0; j < n * 2; j++) {
            int y = i / mult;
            int x = j / mult;
            if (d % 4 == 1 && (x + y) % 2 == 1) del(j, i);
            if (d % 4 == 2 && x % 2 == 1) del(j, i);
        }
    }
}

void solve() {
    int n, d1, d2;
    cin >> n >> d1 >> d2;
    s.clear();
    for (int i = 0; i < n * 2; i++) {
        for (int j = 0; j < n * 2; j++) {
            s.insert(make_pair(i, j));
        }
    }
    go(n, 1, d1);
    go(n, 1, d2);
    auto it = s.begin();
    for (int i = 0; i < n * n; i++) {
        cout << it->first << " " << it->second << "\n";
        it++;
    }
}

int main() {
#ifdef SERT
    freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    //solve();
    //solve();
    //solve();
    //solve();
#endif
    solve();
    return 0;
}

Measured memory_bytes: 17920
#include <stdio.h>
#include <string.h>

typedef long long ll;
ll max(ll a, ll b){ return ( a > b )?a:b;}
ll min(ll a, ll b){ return ( a < b )?a:b;}

int main(){
        ll A, B;
        scanf("%lld %lld",&A,&B);
        printf("%lld\n",A*B-B-A+1);
}

Measured memory_bytes: 128
p = int(input())
a = list(map(int, input().split( )))

#よくある補間だとiごとにO(p)次多項式をx-j倍する操作が入ってO(p**3),間に合わない

#editorial
#1-(x-j)**(p-1)

ans = [0 for _ in range(p)]

chs = [1]

deno = 1
nume = 1

for i in range(1,p):
    nume*=p-i
    deno *= pow(i,p-2,p)
    chs.append(nume*deno%p)

#pow使っていたの修正
for i in range(p):
    tmp = 1
    if not a[i]:
        continue
    for j in range(p):
        ans[p-1-j] -= chs[p-1-j]*tmp
        tmp *= p-i
        tmp %= p
    ans[0]+=1
    

for i in range(p):
    ans[i]%=p 


print(*ans)
    

Measured memory_bytes: 82524
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

signed main() {
  init();
  ll N;
  cin >> N;

  rep(i, 100) {
    rep(j, 100) {
      if (i * 4 + j * 7 == N) {
        COUT("Yes");
        return 0;
      }
    }
  }
  COUT("No");
  return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define M 200005
using namespace std;
int n,A[M],bn;
bool vis[M];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&A[i]);
	for(int i=n;i>=1;i--){
		int res=0;
		for(int j=i+i;j<=n;j+=i)res^=vis[j];
		vis[i]=(A[i]^res);
	}
	for(int i=1;i<=n;i++)bn+=vis[i];
	cout<<bn<<endl;
	for(int i=1;i<=n;i++){
		if(vis[i])printf("%d ",i);	
	}
	return 0;
}

Measured memory_bytes: 1920
#![allow(unused_imports)]
use std::cmp;
use std::collections::*;
use std::io::*;
use std::mem::swap;
#[allow(dead_code)]
struct Io<'a> {
    r: BufReader<StdinLock<'a>>,
    w: BufWriter<StdoutLock<'a>>,
    buf: VecDeque<String>,
    buf_str: String,
}
#[allow(dead_code)]
impl<'a> Io<'a> {
    fn r<T: std::str::FromStr>(&mut self) -> T {
        if self.buf.len() == 0 {
            self.r.read_line(&mut self.buf_str).unwrap();
            for w in self.buf_str.split_whitespace() {
                self.buf.push_back(w.to_owned());
            }
            self.buf_str.clear();
        }
        self.buf
            .pop_front()
            .unwrap()
            .parse()
            .unwrap_or_else(|_| panic!())
    }
    fn r_s(&mut self) -> String {
        if self.buf.len() == 0 {
            self.r.read_line(&mut self.buf_str).unwrap();
            for w in self.buf_str.split_whitespace() {
                self.buf.push_back(w.to_owned());
            }
            self.buf_str.clear();
        }
        self.buf.pop_front().unwrap()
    }
    fn w<T: std::fmt::Display>(&mut self, v: T) {
        write!(self.w, "{}", v).unwrap();
    }
    fn wl<T: std::fmt::Display>(&mut self, v: T) {
        writeln!(self.w, "{}", v).unwrap();
    }
    fn iter<'b, T: std::str::FromStr>(&'b mut self) -> IoIter<'a, 'b, T> {
        IoIter {
            io: self,
            p: std::marker::PhantomData,
        }
    }
}
#[allow(dead_code)]
struct IoIter<'a: 'b, 'b, T: std::str::FromStr> {
    io: &'b mut Io<'a>,
    p: std::marker::PhantomData<T>,
}
#[allow(dead_code)]
impl<'a, 'b, T: std::str::FromStr> Iterator for IoIter<'a, 'b, T> {
    type Item = T;
    fn next(&mut self) -> Option<T> {
        Some(self.io.r())
    }
}
fn main() {
    let stdin = stdin();
    let stdout = stdout();
    let r = BufReader::new(stdin.lock());
    let w = BufWriter::new(stdout.lock());
    let mut io = Io {
        r,
        w,
        buf: VecDeque::new(),
        buf_str: String::new(),
    };
    problem(&mut io);
}

fn problem(io: &mut Io) {
    let s: usize = io.r();
    let w: usize = io.r();
    if w >= s {
        io.wl("unsafe");
    } else {
        io.wl("safe");
    }
}


Measured memory_bytes: 2168
n = gets.chomp!.to_i
s = gets.chomp!

#s = "aabbbbaaca"
ls = s.split("")
#p ls
i = 0

def slime(ls)
  count = 0
  for i in 0..ls.length-1 do
    if i == ls.length-1
      return count
    end
    if ls[i] != ls[i+1]
      count += 1
    end
  end
  return count
end


p slime(ls) + 1

Measured memory_bytes: 7708
#include <bits/stdc++.h>
using namespace std;
int W[100005],n,k;
typedef long long llong;
int load(llong P){
	int goods=0;
	for(int car=1;car<=k;car++){
		int already = 0;
		while(W[goods+1]+already<=P){
			already += W[goods+1];
			goods++;
			if(goods==n) return n;
		}
	}
	return goods;
}
llong bs(llong left,llong right){
	llong mid;
	while(left<right){
		mid=(left+right)/2;
		if(load(mid)<n) left = mid+1;
		else right = mid;
	}
	return right;
}
int main(){
	cin>>n>>k;
	llong max=0;
	for(int i=1;i<=n;i++){
		scanf("%d",&W[i]);
		if(W[i]>max) max = W[i];
	}
	cout<<bs(max,max*n)<<endl;
    return 0;
}


Measured memory_bytes: 3552
N = int(input())
S = str(input())

if len(S) % 2 == 1:
  print('No')
else:
  half = int(len(S) / 2)
  S_1 = S[:half]
  S_2 = S[half:]
  if S_1 == S_2:
    print('Yes')
  else:
    print('No')

Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0; i < N; i++){
      cin >> A[i];
    }

    //体力最小(1以上)のモンスターが体力最大のモンスターを限界まで攻撃する
    int alive_one = 0;
    int alive;
    int max_A, max_A_i;
    int min_A, min_A_i, min_A_max;

    min_A_max = *std::max_element(A.begin(), A.end());
    while(true){
      //生きているモンスターは1か？
      alive = 0;
      min_A = min_A_max;
      max_A = 0;
      for(int i=0; i < N; i++){
        if(A[i] >= 1){
          alive_one = i;
          alive++;
          // 最小値の更新
          if(A[i] < min_A){
            min_A_i = i;
            min_A = A[i];
          }
        }
      }
      if(alive == 1){
        break;
      }
      
      //攻撃されたモンスターの体力を攻撃したモンスターの体力と同じ値だけ減らす
      for(int i=0; i < N; i++){
        if(min_A_i != i){
          A[i] = A[i] % min_A;
        }
      }

      //debug
      /*
      cout << max_A << ',' << min_A << endl;
      for(int i = 0; i < N; i++){
        cout << A[i] << ',';
      }
      cout << endl;
      */
    }
    cout << A[alive_one] << endl;
    return 0;
}


Measured memory_bytes: 640
n  = int(input())
hs = [int(x) for x in input().split()]
m  = 0
c  = 0
for i in range(0, len(hs) - 1):
    if hs[i + 1] <= hs[i]:
        c += 1
    else:
        m = max(m, c)
        c = 0
print(max(m, c))


Measured memory_bytes: 14224
#include<stdio.h> 
#define MAX 100000
#define INFTY 1000000000

struct Card{
	char suit;
	int value;
};

struct Card L[MAX/2+2] , R[MAX/2+2];

void merge(struct Card A[], int left, int mid, int right){

	int n1 , n2;
	int i , j , k;
	
	n1 = mid - left;
	n2 = right - mid;
	
	for( i = 0; i < n1; i++ ){
		L[i] = A[left + i];
	}
	for( i = 0; i < n2; i++ ){
		R[i] = A[mid + i];
	}
	
	L[n1].value = R[n2].value = INFTY;
	
	i = 0;
	j = 0;
	
	for ( k = left; k < right; k++ ){
		
		if( L[i].value <= R[j].value ){
			A[k] = L[i];
			i++;
		}else{
			A[k] = R[j];
			j++;
		}
	}
}

void mergeSort(struct Card A[], int left, int right){
	
	int mid;
	
	if ( left+1 < right ){
		
		mid = (left + right)/2;
		mergeSort(A, left, mid);
		mergeSort(A, mid, right);
		merge(A, left, mid, right);
		
	}
	
}

int partition( struct Card A[] , int p , int r ){
	
	struct Card x,temp;
	int i;

	x = A[r];
	i = p - 1;
	
	for( int j = p; j < r; j++ ){
		
		if( A[j].value <= x.value ){
			i++;
			temp = A[i];
			A[i] = A[j];
			A[j] = temp;
		}
		
	}
	
	temp = A[i+1];
	A[i+1] = A[r];
	A[r] = temp;
	
	return i + 1;
	
}

void quickSort(struct Card A[] , int p , int r ){
	
	int q;
	if( p < r ){
		q = partition(A,p,r);
		quickSort(A,p,q-1);
		quickSort(A,q+1,r);
	}
}

int stablesort( struct Card A[] , struct Card B[] , int n ){
	
	int i;
	
	for( i = 0; i < n; i++ ){
		if( A[i].suit != B[i].suit ){ return 0; }
	}
	
	return 1;
}

int main( void ){
	
	int n;
	struct Card M[MAX],Q[MAX];
	int i;
	char S[10];
	int v;
	
	scanf( "%d" , &n );
	
	for( i = 0; i < n; i++ ){
		scanf( "%s %d" , S , &v );
		M[i].suit = Q[i].suit = S[0];
		M[i].value = Q[i].value = v;
	}
	
	mergeSort(M,0,n);
	quickSort(Q,0,n-1);
	
	if( stablesort( M , Q , n ) == 1 ){
		printf( "Stable\n" );
	}else{
		printf( "Not stable\n" ); 
	}
	
	for( i = 0; i < n; i++ ){
		printf( "%c %d\n" , Q[i].suit , Q[i].value );
	}
	
}


Measured memory_bytes: 4076
#include<bits/stdc++.h>
using namespace std;
unordered_map<int,int>p;
int ans;
int n,m;
int gcd(int x,int y){
	if(x%y==0)return y;
	return gcd(y,x%y);
}
int main(){
	scanf("%d%d",&n,&ans);
	for(int i=1;i<n;i++){
		int x;
		scanf("%d",&x);
		ans=gcd(ans,x);
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define ina(n,a) cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            coyhhhhhhyoc    
#define next          sdNNNmNNNNNNNmds  
#define y0           hNNNNy_yNNNNNN_sNh
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy___smNNNms
#define tm            oooooosyysooooot 
#define read               tyhyt        
#define rank              ytmNmo         
#define index              yyy
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    char p = ' ';
    rall(c, s) {
        if(c != p) {
            p = c;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define pb            push_back
template<class T, class S> inline pair<T, S> mp(T x, S y){ return make_pair(x, y); }
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

static const int    INF = 1000000000;
static const ll     MOD = 1000000007LL;
static const double EPS = 1E-12;

const int N = 333333;
int n;

bool check(int x)
{
  rrep(i, 2, x){
    if(x % i == 0 && (i % 7 == 1 || i % 7 == 6)) return false;
  }
  return x != 1;
}

template<typename T> ostream& operator <<(ostream& r, const vector<T> t){vrep(v,t)r<<*v<<(v+1==t.end()?"":" ");return r;}
template<typename T> ostream& operator <<(ostream& r, const pair<vector<T>, int> p){int n=p.second;minup(n,p.first.size());rep(i,n-1)r<<p.first[i]<<' ';r<<p.first[n-1];return r;}
template<typename T> ostream& operator <<(ostream& r, const pair<T*, int> p){int n=p.second-1;rep(i,n)r<<p.first[i]<<' ';return r<<p.first[n];}
template<typename T, size_t S> ostream& operator <<(ostream& r, const T (&a)[S]){rep(i,S-1)r<<a[i]<<' ';return r<<a[S-1];}


int main()
{
  while(cin >> n, n > 1){
    vi res;
    rrep(i, 1, n){
      if(n % i == 0 && (i % 7 == 1 || i % 7 == 6)){
        if(check(i)) res.pb(i);
        if(check(n / i)) res.pb(n / i);
      }
    }
    sort(ALL(res));
    res.erase(unique(ALL(res)), res.end());
    cout << n << ':' << ' ' << res << endl;
  }

  return 0;
}

Measured memory_bytes: 1228
#include <stdio.h>

//printf array
void printArray(int *a, int num){
	int i;
	for(i = 0; i <= num-2; i++)
	{
		printf("%d ", a[i]);
	}
	printf("%d", a[num-1]);
}

int main()
{
	int a[100];
	int N, i, j, v;

	while(scanf("%d", &N) == 1)
	{
		for(i = 0; i < N; i++){
		scanf("%d", &a[i]);
		}
		
		for(i = 0; i <= N-1; i++)
		{
			v = a[i];
			j = i - 1;
			while(j >= 0 && a[j] > v)
			{
				a[j+1] = a[j];
				j--;
			}
			a[j+1] = v;

			printArray(a,N);
			puts("");
		}
	}
	
	return 0;
}

Measured memory_bytes: 612
/* 166-D.cpp
 *     Created on : May 3, 2020 
 *     Time       : 7:00:47 PM
 *     Author     : null_ptr
 */
#include<iostream>
#include<vector>
#include<cmath>

using namespace std;

const long long inf=1e18;

int main()
{
	vector<long long>seq;

	long long n;
	cin>>n;

	for(long long i=0;pow(i,5)<=inf;++i)
		seq.emplace_back(i);

	for(int i=0;i<(int)seq.size();++i)
	{
		for(int j=i+1;j<(int)seq.size();++j)
		{
			if(pow(seq[j],5)-pow(seq[i],5)==n)
				return cout<<seq[j]<<' '<<seq[i],0;
			else if(pow(seq[j],5)-pow(-seq[i],5)==n)
				return cout<<seq[j]<<' '<<-seq[i],0;
		}
	}
}


Measured memory_bytes: 4292
#pragma target("avx")
#pragma optimize("O3")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using PP = std::pair<ll,P>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define REP(i,b,e) for(ll i=b; i<e; i++)
#define ALL(vec) vec.begin(),vec.end()
#define PRINT(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define SCAN(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
	ll m, k;
	scanf("%ld %ld", &m, &k);
	if(k==0){
		REP(i, 0, 1<<m) printf("%ld %ld ", i, i);
		putchar('\n');
		return 0;
	}
	int x = 0;
	REP(i, 0, 1<<m) if(i!=k) x ^= i;
	if(x!=k){
		puts("-1");
		return 0;
	}

	REP(i, 0, 1<<m) if((1<<m)-1-i!=k) printf("%ld ", (1<<m)-1-i);
	printf("%ld ", k);
	REP(i, 0, 1<<m) if(i!=k) printf("%ld ", i);
	printf("%ld\n", k);
	return 0;
}



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

int main()
{
    std::size_t N;
    std::cin >> N;

    double D;
    std::cin >> D;

    std::size_t answer = 0;
    for(std::size_t i=0; i<N; ++i)
    {
        std::int64_t x, y;
        std::cin >> x >> y;
        if(std::sqrt(x*x + y*y) <= D)
        {
            answer += 1;
        }
    }

    std::cout << answer << std::endl;

    return 0;
}


Measured memory_bytes: 3776
#include"bits/stdc++.h"
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

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

void Main()
{
	int n;
	cin >> n;
	ll ans = 0;
	vi cnt(n+1, 0);
	int a;
	rep(i,n) {
		cin >> a;
		if(a <= n) cnt[a]++;
		else ans++;
	}
	rep(i,n+1){
		if(cnt[i] < i) ans += cnt[i];
		if(cnt[i] > i) ans += cnt[i] - i;
	}	

	cout << ans << endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<stdio.h>
using namespace std;

int main(void){

  int a,b,d,r;
  double a1,b1,f;

  cin >> a >> b;

  d = a / b;
  r = a % b;
  a1 = (double)a;
  b1 = (double)b;
  f = a1 / b1;

  cout << d << " " << r << " ";
  printf("%lf\n",f);

  return 0;

}

Measured memory_bytes: 1240
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int tr[4][14];
    int n,i,j,c;
    char m;
    for(i = 0 ; i < 4 ; i++){
        for(j = 0 ; j < 14 ; j++){
            tr[i][j] = 0;
        }
    }
    scanf("%d",&c);
    for(i = 0 ; i < c ; i++){
        scanf("\n");
        scanf("%c %d",&m,&n);
        if(m == 'S'){
            tr[0][n] = 1;
        }else if(m == 'H'){
            tr[1][n] = 1;
        }else if(m == 'C'){
            tr[2][n] = 1;
        }else if(m == 'D'){
            tr[3][n] = 1;
        }
    }
    for(j = 1 ; j < 14 ; j++){
        if(tr[0][j] != 1){
            printf("S %d\n",j);
        }
    }
    for(j = 1 ; j < 14 ; j++){
        if(tr[1][j] != 1){
            printf("H %d\n",j);
        }
    }
    for(j = 1 ; j < 14 ; j++){
        if(tr[2][j] != 1){
            printf("C %d\n",j);
        }
    }
    for(j = 1 ; j < 14 ; j++){
        if(tr[3][j] != 1){
            printf("D %d\n",j);
        }
    }
    return 0;
}



Measured memory_bytes: 2048
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000009;

int main(){
	int n;
	cin >> n;
	if(n % 2 == 0)cout << 0.5 << endl;
	else{
		printf("%.14lf\n",(n+1)/2 / (double)n);
	}
}


Measured memory_bytes: 256
/*
 * d.cc: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 40;

/* typedef */

typedef vector<int> vi;
typedef queue<int> qi;
typedef pair<int,int> pii;

/* global variables */

int as[MAX_N], bs[MAX_N], cs[MAX_N];

/* subroutines */

void check(int ai, int aj, int as[],
	   int bi, int bj, int bs[],
	   int ci, int cj, int cs[]) {
  if (ai == aj) {
    cs[ci] = as[ai];
    return;
  }

  int root = as[ai], k;
  for (k = bi; k <= bj; k++)
    if (bs[k] == root) break;
  // bs -> [bi, k - 1], [k + 1, bj]
  int ln = k - bi, rn = bj - k;

  // as -> [ai + 1, ai + ln], [ai + ln + 1, aj]
  // cs -> [ci, ci + ln - 1], [ci + ln, cj - 1]

  cs[cj] = root;
  if (ln > 0) check(ai + 1, ai + ln, as, bi, k - 1, bs, ci, ci + ln - 1, cs);
  if (rn > 0) check(ai + ln + 1, aj, as, k + 1, bj, bs, ci + ln, cj - 1, cs);
}

/* main */

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

  for (int i = 0; i < n; i++) cin >> as[i];
  for (int i = 0; i < n; i++) cin >> bs[i];

  check(0, n - 1, as, 0, n - 1, bs, 0, n - 1, cs);

  for (int i = 0; i < n; i++) {
    if (i) putchar(' ');
    printf("%d", cs[i]);
  }
  putchar('\n');
  return 0;
}

Measured memory_bytes: 1144
import java.util.*;
  
class Main{
  public static void main(String[] args){
    Scanner stdId = new Scanner(System.in);
    int x = stdId.nextInt(); 
    for(int i=1;;i++){
      if(x==0) break;
      System.out.println("Case " + i + ": " + x);
      x = stdId.nextInt();
    }
  }
}

Measured memory_bytes: 31352
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

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

def main():
  n,W=LI()
  dp=[[inf]*100100 for _ in range(n+1)]
  dp[0][0]=0

  w=[]
  v=[]
  for _ in range(n):
    a,b=LI()
    w.append(a)
    v.append(b)

  for i in range(n):
    for j in range(100100):
      dp[i+1][j]=min(dp[i+1][j],dp[i][j])

      if j+v[i]<100100:
        dp[i+1][j+v[i]]=min(dp[i+1][j+v[i]],dp[i][j]+w[i])

  ans=0
  for i in range(100100):
    x=dp[n][i]
    if x<=W:
      ans=i

  return ans

# main()
print(main())


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

bool has3(int x){
    while(x){
        if( x % 10 == 3 )return true;
        x /= 10;
    }
    return false;
}

void call(int n){
    for( int x = 1; x <= n; x++ ){
        if( x % 3 == 0 || has3(x) ){
            cout << " " << x;
        }
    }
    cout << endl;
}

int main(){
    int n;
    cin >> n;
    call(n);
    
    return 0;
}


Measured memory_bytes: 3056
# DDCC B
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
n = ni()
a = nl()
a_sum = []
s = sum(a)
ans = 10**10
ss = 0
for i in range(n):
    ss += a[i] 
    a_sum.append(ss)

for i in range(n):
    start = a_sum[i]
    end = s - start
    t = abs(start - end)
    ans = min(t,ans)

print(ans)

Measured memory_bytes: 26060
from operator import itemgetter

n = int(input())
input_list = []
for i in range(n) :
    a = input().split()
    input_list.append((a[0],int(a[1])))  

sorted_list = sorted(input_list, key=itemgetter(1), reverse=True)
sorted_list = sorted(sorted_list, key=itemgetter(0), reverse=False)
    
for i in sorted_list :
    print(input_list.index(i)+1)


Measured memory_bytes: 3060
from math import factorial
from itertools import permutations

n = int(input())
t,*c = [list(map(int, input().split())) for _ in range(n)]

print(sum(sum(((x-v)**2+(y-w)**2)**.5 for (x, y), (v, w) in zip([t]+l, l+[t])) for l in map(list,permutations(c)))*(n-1)/factorial(n))

Measured memory_bytes: 9368
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main () {
  int n;
  cin >> n;
  vi c(n-1), s(n-1), f(n-1);
  rep(i,n-1) cin >> c[i] >> s[i] >> f[i];
  
  vi ans(n);
  rep(i,n) {
    int t = 0;
    for (int j = i; j < n-1; ++j) {
      if (t < s[j]) t = s[j];
      else if (t%f[j] == 0) ;
      else t += f[j] - t%f[j];
      t += c[j];
    }
    ans[i] = t;
  }

  rep(i,ans.size()) printf("%d\n", ans[i]);
  return 0;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let a: i64 = read();
    let b: i64 = read();
    let c: i64 = read();
    if c < a + b {
        println!("No");
    } else if 2 * (a * b + b * c + c * a) < a.pow(2) + b.pow(2) + c.pow(2) {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

#define ff first
#define ss second

#define pb push_back
#define mp make_pair
#define ins insert

#define f(i,n) for(int i = 0 ;  i < n ; i ++)
#define f1(i,n) for(int i = 1 ; i<= n ; i++)

#define int long long int

#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);
#define test() int t;cin>>t;while(t--)





int32_t main()
{
	fast();

	int a,b,c,k;
	cin >> a >> b >> c >> k;

	int tot = 0 ;

	int tmp;
  
	if(k and a)
	{
		tmp = min(k,a);
      	k-=tmp;
      	tot+=tmp;
	}

	if(k and b)
	{
		tmp = min(k,b);
      	k-=tmp;
      	
	}

	if(k and c)
	{
		tot-=k;
     }	

	cout<<tot;
	
		
	return  0 ;
	
}




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

int main()
{
	int n;
  	cin >> n;
	vector<int> t(n);
 	for(int i = 0; i < n; i++) {
     	cin >> t[i]; 
    }
  	int m;
  	cin >> m;
  	vector<int> toi(m);
  	vector<int> drink(m);
 	for(int i = 0; i < m; i++) {
     	cin >> toi[i] >> drink[i]; 
    }
  	for(int i = 0; i < m; i++) {
    	int count = 0;
     	int tmp = t[toi[i]-1];
      	t[toi[i]-1] = drink[i];
      	for(int j=0; j<n;j++){
          count += t[j];
        }
		cout << count << endl;
      	t[toi[i]-1] = tmp;      	
    }
}


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

int main() {
  int N;
  cin >> N;
  vector<int> v(N);
  vector<int> c(N);
  for(int i=0;i<N;i++) {
    cin >> v[i];
  }
  int total = 0;
  for(int i=0;i<N;i++) {
    cin >> c[i];
    if(v[i] > c[i]) {
      total += v[i] - c[i];
    }
  }

  cout << total << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int max = 0;
		int ans = 0;
		for (int i = 0; i < n; i++) {
			int h = scan.nextInt();
			if (max <= h) {
				ans++; 
				max = h;
			}
		}
		System.out.println(ans);
	}
    public static void main(String[] args) {
    	new Main().run();
    }
}


Measured memory_bytes: 22740
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(N):
	a.append(a[i] + A[i])
for i in range(M):
	b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
	if a[i] > K:
		break
	while b[j] > K - a[i]:
		j -= 1
	ans = max(ans, i + j)
print(ans)


Measured memory_bytes: 47316
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <functional>
#include <iomanip>
#include <bitset>
#include <numeric>
#include <queue>
#include <map>
#include <cstdint>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
const long long mod = 1000000007;
typedef long long int ll;
typedef pair<ll, ll> P;
const vector<int> di = { -1, 0, 1, 0 };
const vector<int> dj = { 0, 1, 0, -1 };
const double PI = 3.14159265358979323846;

int main() {

    double r;
	cin >> r;

	cout << double(2 * r * PI) << endl;

	return 0;
	
}



Measured memory_bytes: 3736
//https://atcoder.jp/contests/code-festival-2016-qualb/tasks/codefestival_2016_qualB_b
//B - Qualification simulator
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
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;}
int main() {
    ll N,A,B; cin>>N>>A>>B;
    string S; cin>>S;
    ll ca=0;
    ll cb=0;
    for(const auto& c:S){
        bool res=false;
        if(c=='a') {
            if(ca+cb<A+B) {
                ++ca;
                res=true;
            }
        }
        else if(c=='b'){
            if(ca+cb<A+B&&cb<B){
                res=true;
                ++cb;
            }
        }
        cout<<(res?"Yes":"No")<<endl;
    }
    return 0;
}

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

int main() {
	int n,j;
	(void)scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		if (i % 3 == 0) printf(" %d", i);
		else {
			j = i;
			do{
				if (j % 10 == 3) {
					printf(" %d", i);
					break;
				}
				j /= 10;
			} while (j);
		}
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 2688
#include <iostream>
using namespace std;
int main(void){
    int n,t[2],x[2],y[2];
    string ans="Yes";
    cin>>n;
    t[0]=0;
    x[0]=0;
    y[0]=0;
    for(int i=0;i<n;i++){
        cin>>t[1]>>x[1]>>y[1];
        if((t[1]+x[1]+y[1]-t[0]-x[0]-y[0])%2==0 && t[1]-t[0]>=abs(x[1]-x[0])+abs(y[1]-y[0])){
        } else {
            ans="No";
        }
        t[0]=t[1];
        x[0]=x[1];
        y[0]=y[1];
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
import sys
import math
from collections import Counter

n = int(sys.stdin.readline().strip())
a = [int(s) for s in sys.stdin.readline().strip().split()]
c = Counter(a)

total = 0
for key, val in c.items():
    total += val * (val-1) // 2

for i in range(n):
    ai = a[i]
    ai_count = c[ai]

    original = ai_count * (ai_count-1) // 2
    updated = (ai_count-1) * (ai_count-2) // 2
    print(total - original + updated)


Measured memory_bytes: 83156
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

int color[(int)1e5 + 1];
vector<vector<int> > edge;
int cl;
void dfs(int v){
	color[v] = cl;
	REP(i,edge[v].size()){
		if(not color[edge[v][i]]){
			dfs(edge[v][i]);
		}
	}
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
	int n,m,q;
	cin>>n>>m;
	edge.resize(n,vector<int>());
	REP(i,m){
		int u,v;cin>>u>>v;
		edge[u].push_back(v);
		edge[v].push_back(u);
	}
	REP(i,n){
		cl = i+1;
		if(not color[i]){
			dfs(i);
		}
	}
	cin>>q;
	REP(i,q){
		int u,v;cin>>u>>v;
		if(color[u] == color[v]){
			cout << "yes" << endl;
		}else{
			cout << "no" << endl;
		}
	}
  return 0;
}

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


 int main()
 {

   ll a[20];
   cin>>a[0]>>a[1]>>a[2];
   sort(a,a+3);
   if((a[2]-a[0])>0&&(a[1]-a[0]==0||a[2]-a[1]==0))
   cout<<"Yes"<<endl;
   else
    cout<<"No"<<endl;
     return 0;
 }


Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
using namespace std;
int main()
{
	int j,w[11],k[11],i,wg=0,kg=0;
	for(i=0;i<10;i++)
	{
		cin>>w[i];
	}
	for(i=0;i<10;i++)
	{
		cin>>k[i];
	}
	sort(w,w+10);
	sort(k,k+10);
	wg=w[7]+w[8]+w[9];
	kg=k[7]+k[8]+k[9];
		cout<<wg<<" "<<kg<<endl;
	return 0;
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rem(i, s, n) for (int i = (s); i >= (n); --i)
using ll = long long;
const int MAX = 1e9+7;

int main(){
    int n; cin >> n;
    vector<ll> a(n), b(n), c(n);
    rep(i, 0, n) cin >> a[i] >> b[i] >> c[i];

    vector<tuple<ll, ll, ll>> v(n+1, make_tuple(0, 0, 0));
    get<0>(v[0]) = a[0]; get<1>(v[0]) = b[0]; get<2>(v[0]) = c[0];
    rep(i, 1, n){
        get<0>(v[i]) = max(get<1>(v[i-1]), get<2>(v[i-1])) + a[i];
        get<1>(v[i]) = max(get<0>(v[i-1]), get<2>(v[i-1])) + b[i];
        get<2>(v[i]) = max(get<0>(v[i-1]), get<1>(v[i-1])) + c[i];
    }

    cout << max({get<0>(v[n-1]), get<1>(v[n-1]), get<2>(v[n-1])}) << endl;

    return 0;
}

Measured memory_bytes: 4992
#include<stdio.h>

int main(void){
	int n,i;
	
	scanf("%d",&n);
	
	int a[n];
	
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	
	for(i=0;i<n;i++){
		if(a[i]%2==0 && a[i]%3!=0 && a[i]%5!=0){
			break;
		}
	}
	
	if(i==n){
		printf("APPROVED");
	}
	else{
		printf("DENIED");
	}
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 200010;

int main(){
    lint a; string b;
    cin >> a >> b;
    b.erase(b.end()-3);
    printf("%lld\n", a * stoll(b) / 100);
}

Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	i64 s; scanf("%lld", &s);

	std::vector<std::pair<i64, i64>> vec(3);
	vec[0].first = vec[0].second = 0;
	vec[1].first = (int)1e9;
	vec[2].second = (s + vec[1].first - 1) / vec[1].first;
	i64 tmp = vec[1].first * vec[2].second - s;

	for(i64 i = 1; i * i <= tmp; i++) {
		if(tmp % i) continue;
		if(i > 1e9 or tmp / i > 1e9) continue;
	
		vec[1].second = i;
		vec[2].first = tmp / i;
	}

	for(auto v: vec) printf("%lld %lld ", v.first, v.second);
	printf("\n");
	return 0;
}


Measured memory_bytes: 256
N = int(input())
A,B = map(int,input().split())
P = list(map(int,input().split()))
cnt = 0
e,m,h = 0,0,0
for i in range(N):
	if P[i] <= A:
		e+=1
	elif P[i] <= B:
		m+=1
	else:
		h+=1
ans = min(min(e,m),h)
print(ans)

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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

//実行部
void Main()
{
  ll n; cin >> n;
  vll a(n); rep(i, n) cin >> a[i];
  ll ans = 0;
  rep(i, n)
  {
    if(a[i] % 2 == 1) ans++;
  }
  if(ans % 2 == 1)
  {
    fin("NO");
  }
  fin("YES");
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}

/*
//test時
  g++ test.cpp -o test;./test
*/


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long a,b;
        a = scanner.nextLong();
        b = scanner.nextLong();
        a = a % b;

        long temp;
        while (true) {
            temp = Math.abs(a - b);
            if (temp >= a) {
                System.out.println(a);
                return;
            }
            a = temp;
        }
    }

}

Measured memory_bytes: 23124