akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>

using namespace std;


int main(){
    long long n;
    vector<string> v;
    string tmp;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> tmp;
        sort(tmp.begin(), tmp.end());
        v.push_back(tmp);
    }
    sort(v.begin(), v.end());
    long long int cnt=0, cur=1;
    tmp=v[0];
    for(int i=1;i<n;i++){
        if(v[i]==tmp){
            cur++;
        }
        if(i==n-1 || v[i]!=tmp){
            if(cur>1){
                cnt+=(cur*(cur-1))/2;
            }
            cur=1;
            tmp=v[i];
        }
    }
    cout << cnt << endl;
}

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

int main(){

  int N,A;
  
  cin >>N >>A;
  
  if(N%500==0){
  cout <<"Yes"<<endl;}
  
  else if(A>=N%500){
  cout<<"Yes"<<endl;}
  else{
  cout<<"No"<<endl;}
  





}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	void run(){
		int[] map={31,29,31,30,31,30,31,31,30,31,30,31};
		int[] dp = new int [12];
		String[] str ={
				"Monday",
				"Tuesday",
				"Wednesday",
				"Thursday",
				"Friday",
				"Saturday",
				"Sunday",
		};
		dp[0] = 2;
		for(int i=1; i <12;i++){
			dp[i] = (dp[i-1] + map[i-1] )%7;
		}
		for(;;){
			int m = sc.nextInt();
			
			int n = sc.nextInt();
			if((m|n)==0){
				break;
			}
			System.out.println(str[(dp[m-1]+n)%7]);
		}
	}
	public static void main(String[] args){
		Main m = new Main();
		m.run();
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i, n) ;for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) ;for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF (922337203685477587+1)
#define sosuu 1000000007


int main() {
  
  vector<vector<lli>> dp(105, vector<lli>(100005));
  int N, W;
  cin >> N >> W;
  vector<lli> w(N);
  vector<lli> v(N);
  rep(i, N) cin >> w[i] >>v[i];
  
  rep(i, N)
  {
    rep(we, W+1)
    {
      if(we >= w[i]) dp[i+1][we] = max(dp[i][we-	w[i]] + v[i], dp[i][we]);
      else           dp[i+1][we] = dp[i][we];
    }
  
  
  }
  
  cout << dp[N][W] << endl;
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define vi vector<ll>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define el printf("\n")
#define pb push_back
#define f first
#define s second
#define arrondi(a) (long long)floor(a+0.5);
ll N=500005;
ll MAX=9223372036854775807;
ll MOD=1000000007;
long double PI =4*atan(1);

int main()
{
    int n,w; cin >> n >> w; vector <ll> W(n+1),v(n+1);
    for (int i=1;i<=n;i++)
    {
        sll(W[i]); sll(v[i]);
    }
    ll dp[n+1][w+1];
    for (int i=0;i<=n;i++)
    {
        for (int j=0;j<=w;j++)
        {
            dp[i][j]=0;
        }
    }
    for (int i=1;i<=n;i++)
    {

        for (int j=1;j<=w;j++)
        {
            if (W[i]>j)
                dp[i][j]=dp[i-1][j];
            else
            {
                dp[i][j]=max(dp[i-1][j],dp[i-1][j-W[i]]+v[i]);
            }
        }
    }
    cout << dp[n][w];


    return 0;
}


Measured memory_bytes: 79104
N = gets.to_i
H = gets.chomp.split.map(&:to_i)

max = 0
count = 0
(N-1).times do |i|
  if H[i+1] <= H[i]
    count += 1
  else
    if count > max
      max = count
    end
    count = 0
  end
end

if count > max
  max = count
end

puts max


Measured memory_bytes: 9604
N = int(input())
S = input()
ansMax = 0

for i in range(N - 1):
    ansCnt = 0
    tmpX = "".join(set(S[0:i + 1]))
    tmpY = "".join(set(S[i + 1:]))

    for j in range(len(tmpX)):
        if tmpY.count(tmpX[j]) == 1:
            ansCnt += 1

    ansMax = max(ansMax, ansCnt)

print(ansMax)

Measured memory_bytes: 3060
# AOJ 0035 Is it Convex?

require "matrix"

while line = gets
  dat = line.split(",").map(&:to_f)

  ra = Vector[dat[0], dat[1]]
  rb = Vector[dat[2], dat[3]]
  rc = Vector[dat[4], dat[5]]
  rd = Vector[dat[6], dat[7]]

  points = [ra, rb, rc, rd]

  convex = true
  points.each_with_index do |r, i|
    # r の隣接点が、r と他の 2 点で作られる三角形の内部にあれば
    # 凹んでいる
    r_next = points[(i + 1) % 4] - r
    r1 = points[i - 1] - r
    r2 = points[(i + 2) % 4] - r

    st = Matrix[r1, r2].transpose.inv * r_next
    s, t = st[0], st[1]
    if 0 < s + t && s + t < 1 && 0 < s && s < 1 && 0 < t && t < 1
      convex = false
      break
    end
  end

  puts convex ? "YES" : "NO"
end

Measured memory_bytes: 6448
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N; int A; int B;
  cin >> N; cin >> A; cin >> B;
  if (N*A <= B){
    cout << N*A << endl;
  }
  if (N*A > B){
    cout << B << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template <class T> void corner(bool flg, T hoge) { if (flg) { cout << hoge << endl; exit(0); } }
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) { o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o; }
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) { o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o; }
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) { o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o; }
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) { o << "{" << obj.first << ", " << obj.second << "}"; return o; }
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) { o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o; }
void print(void) { cout << endl; }
template <class Head> void print(Head&& head) { cout << head; print(); }
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) { cout << head << " "; print(forward<Tail>(tail)...); }
void YN(bool flg) { cout << ((flg) ? "YES" : "NO") << endl; }
void Yn(bool flg) { cout << ((flg) ? "Yes" : "No") << endl; }
void yn(bool flg) { cout << ((flg) ? "yes" : "no") << endl; }

int main() {
	int N; cin >> N;
	V<string> S(N);
	REP(i, N) cin >> S[i];
	string T; cin >> T;
	int af = 0, ab = 0, zf = 0, zb = 0, f = 0, b = 0;
	REP(i,N){
		string U = S[i];
		REP(j, U.size()) if (U[j] == '?') U[j] = 'a';
		if (U < T) af++;
		if (U > T) ab++;

		U = S[i];
		REP(j, U.size()) if (U[j] == '?') U[j] = 'z';
		if (U < T) zf++;
		if (U > T) zb++;
	}
	f = min(af, zf);
	b = min(ab, zb);
	for (int i = f + 1; i <= N + 1 - b; ++i) cout << i << (i != N + 1 - b ? " " : "");
	cout << endl;


	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define pii pair<ll,ll>
#define pll pair<long long, long long >
#define ll long long
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define maxn 1000000007
#define endl '\n'
#define trace(x) cerr << #x << ": " << x << endl;
#define trace2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z) cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
bool check(ll mask,ll i)
{
  return mask&(1<<i);
}
ll Set(ll mask, ll i)
{
  return mask | (1 << i);
}
ll mod(ll x)
{
  if(x < maxn)return x;
  return x%maxn;
}
ll add(ll x, ll y)
{
  if(x+y<maxn)return x+y;
  else return(x+y)%maxn;
}
ll dir8[2][8] = {{1,-1,0,0,1,-1,1,-1},{0,0,1,-1,1,-1,-1,1}};
ll dir4[2][4] = {{1,-1,0,0},{0,0,1,-1}};
ll m,n,row,col,lim;
ll g[22][22];
ll memo[22][2200000];
ll dp(ll i,ll mask)
{
  if(i>=n && mask == lim)return 1;
  if(i>=n && mask!= lim)return 0;
  ll p = 0ll;
  if(memo[i][mask]!=-1)return memo[i][mask];
  for(ll w=0;w<n;w++)
  {
    if(!check(mask,w) && g[i][w] == 1)p = add(p,dp(i+1,Set(mask,w)));
  }
  memo[i][mask] = p;
  return memo[i][mask];
}
void solve()
{
  scanf("%lld",&n);
  lim = (1<<n)-1;
  memset(memo,-1,sizeof memo);
  for(ll w=0;w<n;w++)
  {
    for(ll q=0;q<n;q++)scanf("%lld",&g[w][q]);
  }
  cout << dp(0ll,0ll) << endl;
}
void test()
{
  ll t;
  //scanf("%d",&t);
  t = 1;
  for(ll test=1;test<=t;test++)
  {
    solve();
  }
}
int main()
{
  test();
  return 0;
}


Measured memory_bytes: 378368
#include <iostream>
#include <stdio.h>
#include <vector>
#include <functional>
#include <unordered_set>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <ctime>
#include <cassert>
#include <queue>
#include <stack>
#include <bitset>

using namespace std;

const int N = 3e3 + 1;
const int K = 1e5 + 1;
const int MOD = 1e9 + 7;

int a[N];
long long DP[N][N];
bool have[N][N];
int n;

// X - Y
long long dp(int l, int r) {
	if (l == r) {
		return 0;
	}
	int turn = (l + r + n) % 2;
	if (have[l][r])
		return DP[l][r];
	if (turn == 0) {
		long long ans = max(a[l] + dp(l + 1, r), a[r - 1] + dp(l, r - 1));
		have[l][r] = true;
		return DP[l][r] = ans;
	} else {
		long long ans = min(dp(l + 1, r) - a[l], dp(l, r - 1) - a[r - 1]);
		have[l][r] = true;
		return DP[l][r] = ans;
	}
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int k;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	cout << dp(0, n) << "\n";
	return 0;
}

Measured memory_bytes: 78592
use proconio::*;
use std::cmp::*;

#[derive(Clone, Copy)]
struct Top2<T> {
    a: T,
    b: T,
}

impl<T: Ord + Copy> Top2<T> {
    fn new(a: T, b: T) -> Self {
        assert!(a > b);
        Top2 {
            a, b
        }
    }
    fn merge(self, rhs: Self) -> Self {
        match self.a.cmp(&rhs.a) {
            Ordering::Equal => {
                Top2::new(self.a, max(self.b, rhs.b))
            },
            Ordering::Less => {
                Top2::new(rhs.a, max(self.a, rhs.b))
            },
            Ordering::Greater => {
                Top2::new(self.a, max(self.b, rhs.a))
            },
        }
    }
}

#[fastout]
fn run() {
    proconio::input! {
        n: usize,
        a: [u32; 1 << n],
    }
    let mut dp = a.iter().enumerate().map(|a| Top2::new((*a.1, a.0), (0, 0))).collect::<Vec<_>>();
    for i in 0..n {
        for j in 1..(1 << n) {
            if j >> i & 1 == 1 {
                dp[j] = dp[j].merge(dp[j ^ (1 << i)]);
            }
        }
    }
    let mut ans = 0;
    for Top2{a, b} in dp.into_iter().skip(1) {
        ans = max(ans, a.0 + b.0);
        println!("{}", ans);
    }
}

fn main() {
    run();
}


Measured memory_bytes: 15148
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
using ll = long long;
const long long INF = 1LL << 60;
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;
}



int main(){

long long  n,k;cin >> n>>k;
long long h[110000];
rep(i,n)cin >> h[i];
long long dp[110000];
rep(i,110000)dp[i]= INF;
dp[0]=0;
for(int i = 0; i< n;i++){
    for(int j = 1 ; j<=k;j++){
    chmin(dp[i+j],abs(h[i]-h[i+j])+dp[i]);
    }
}

cout << dp[n-1] << endl;
return 0;
}





Measured memory_bytes: 1920
import bisect
N=int(input())
alist=list(map(int,input().split()))
alist.sort(reverse=True)

blist=[]
for a in alist:
  a2=a
  digit_a2=0
  while(a2>0):
    a2>>=1
    digit_a2+=1
  b=2**(digit_a2)-a
  blist.append(b)
#print(alist)
#print(blist)

dic_a={}
for a in alist:
  if a in dic_a:
    dic_a[a]+=1
  else:
    dic_a[a]=1

answer=0
for i in range(N):
  a=alist[i]
  b=blist[i]
  if a==b:
    if dic_a[a]>1:
      dic_a[a]-=2
      answer+=1
      #print(a,a)
  else:
    if dic_a[a]>0 and b in dic_a and dic_a[b]>0:
      dic_a[a]-=1
      dic_a[b]-=1
      answer+=1
      #print(a,b)
    
print(answer)

Measured memory_bytes: 40644
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define MOD 1000000007
 
typedef long long ll;
typedef pair<int, int> ii;

int main() {

	int n;
	string s;
	cin >> n >> s;
	rep(i, 4){
		vector<int> v(n+2);
		v[0] = i % 2;
		v[1] = i / 2;
		
		rep(index, n){
			if(v[index+1]){ //正直
				if(s[index] == 'o') v[index+2] = v[index];
				else v[index+2] = (v[index] + 1) % 2;
			}else{
				if(s[index] == 'o') v[index+2] = (v[index] + 1) % 2;
				else v[index+2] = v[index];
			}
		}
		
		if(v[0] == v[n] && v[1] == v[n+1]){
			REP(index, 1, n+1){
				cout << (v[index] ? 'S' : 'W');
			}
			cout << endl;
			return 0;
		}
	}
	
	cout << -1 << endl;
	
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
int main(){std::string l[1000];int c=0,k;while(std::cin>>l[c]){k=l[c].length();if((l[c].find(","))+(l[c].find("."))!=-2)l[c].replace(k-1,1,""),k-=1;if((k>2)&&(k<7))c++;}for(k=0;k<c-1;k++)std::cout<<l[k]<<" ";std::cout<<l[c-1]<<"\n";}

Measured memory_bytes: 0
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define PI 3.14159265358979323846264338327950L

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back

template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

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

bool isPalindrome(string s){
    REP(i, s.length() / 2){
        if(s[i] != s[(s.length() - 1) - i]){
            return false;
        }
    }
    return true;
}

//scanf("%lld", &);
//cin >> ;
//cout << ans << endl;

ll N, M, i, j, k, l, tmp, ans, X, T;
ll D, x, y;
ll cnt;
ll a;

int main(){
    cin >> N;
    vector<ll> As(N, 0);

    REP(i, N){
        scanf("%d", &As[i]);
    }

    for(int i = 1; i < N; i++){

        // 前の人より後ろが高いか同じ
        if(As[i - 1] <= As[i]){
            // OK
        }else{
            // 踏み台を設置しないといけない
            ans += As[i - 1] - As[i];
            As[i] = As[i - 1];
        }
    }
    
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 4780
#include <iostream>
#include <cmath>
#include <algorithm>
#include <stdio.h>
#include <cstring>
#include <string>
#include <cstdlib>
#include <vector>
#include <bitset>
#include <map>
#include <chrono>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <queue>
#include <ctime>
#include <stack>
#include <set>
#include <list>
#include <deque>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdarg.h>
#include <utility>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unisgned long long
#define ld long double
#define all(a) a.begin(), a.end()
#define SORT(a) sort(all(a))
#define pii pair<int, int>
#define tii triple<int, int, int>
#define e 1e-7
#define PI acos(-1)
#define sz(a) (int)(a.size())
#define inf 1e17
#define vi vector<int>
#define F first
#define S second
#define rng(x) for(int _ = 0; _ < (x); _++)
#define rngi(i, x) for(int i = 0; i < (x); i++)
#define rngsi(s, i, x) for(int i = (s); i <(x); i++)
#define int long long
#define problem ""

template<typename A, typename B, typename C>
struct triple{
    A X;
    B Y;
    C Z;
    triple(A a = 0, B b = 0, C c = 0) :X(a), Y(b), Z(c) {}
};
template<typename A, typename B, typename C>
triple<A, B, C> make_triple(A a = 0, B b = 0, C c = 0){
    return triple<A, B, C>(a, b, c);
}
template<typename A, typename B, typename C>
bool operator<(const triple<A, B, C>& a, const triple<A, B, C>& b){
    if (a.X != b.X)
        return a.X < b.X;
    if (a.Y != b.Y)
        return a.Y < b.Y;
    return a.Z < b.Z;
}
template<typename T, typename SS>
ostream& operator<<(ostream& ofs, const pair<T, SS>& p){
    ofs << "( " << p.F << " , " << p.S << " )";
    return ofs;
}
template<typename T>
void print(T a){
    for (auto i : a)
        cout << i << ' ';
    cout << '\n';
}
template<typename T>
T max(T a, T b, T c){
    return max(a, max(b, c));
}
template<typename T>
T min(T a, T b, T c){
    return min(a, min(b, c));
}
template<typename T, typename D>
D min(T a){
    return *min_element(all(a));
}
template<typename T, typename D>
D max(T a){
    return *max_element(all(a));
}
struct custom_hash{
    static uint64_t splitmix64(uint64_t x){
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const{
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
void solve(){
    int x; cin >> x;
  	for(int k = 1;;k++)if((x*k)%360==0) return void(cout<<k<<'\n');
};
signed main()
{
    if(0){
        freopen(problem".in", "r", stdin);
        freopen(problem".out", "w", stdout);
    }
    srand(time(NULL));
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(false);
    int t = 1; //cin >> t;
    rng(t) solve();
}


Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
long long gcd(long long a,long long b){if(a%b==0){return b;}else return gcd(b,a%b);}
long long lcm(long long a,long long b){if(a==0){return b;} return a/gcd(a,b)*b;}
long long MOD; template<class T> void mod(T &n){MOD=n;}
#define sym cout<<"---------"<<endl;
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl
#define WHITE 1
#define BLACK 2
#define GRAY 1
#define RE return 0
#define int ll


signed main(){
  int a,b;
  while(cin>>a>>b&&a&&b){
    cout<<gcd(a, b)<<" "<<lcm(a, b)<<en;
  }
}






Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,f,n) for(int i=f; i<(n); i++)
int m_x[4] = { 0, 0,-1, 1};
int m_y[4] = {-1, 1, 0, 0};

int main()
{
  int n,ans = 2147483646;
  cin >> n;
  int x[n];
  REP(i,0,n){
    cin >> x[i];
  }
  REP(j,0,100){
    int g = 0;
    REP(i,0,n){
      g += (x[i] - j)*(x[i] - j);
    }
    ans = min(g,ans);
  }
  cout << ans << endl;
  
  //--debug : end_stoper
  //string end_stoper; cin >> end_stoper;

  return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <sstream>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <iomanip>
#include <numeric>
#include <climits>
#include <algorithm>
#include <cstdint>
using namespace std;

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

    vector<int> niz(n);
    for (int i = 0; i < n; i++)
        cin >> niz[i];
    sort(niz.begin(), niz.end());
    cout << niz.back() - niz[0];
}

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

#define INF INT_MAX/2;
#define MOD 1000000007

using namespace std;

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

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

   ll N,K;
   cin>>N>>K;
   vector<pair<ll,ll>>n(N);
   for(int i=0;i<N;i++)cin>>n[i].first>>n[i].second;
   sort(n.begin(),n.end());
   ll now = 0;
   for(int i=0;i<N;i++){
      if(now+n[i].second>=K){
         cout<<n[i].first<<endl;
         return 0;
      }
      now+=n[i].second;
   }
   return 0; 
}


Measured memory_bytes: 1792
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] c = sc.next().toCharArray();
		sc.close();

		for (int i = 0; i < c.length; i++) {
			char a = c[i];
			if (i % 2 == 0) {
				if (!(a == 'R' || a == 'U' || a == 'D')) {
					System.out.println("No");
					return;
				}
			} else {
				if (!(a == 'L' || a == 'U' || a == 'D')) {
					System.out.println("No");
					return;
				}
			}
		}

		System.out.println("Yes");
	}
}


Measured memory_bytes: 35736
def main():
  n, m = map(int, input().split())
  height = []
  for _ in range(n):
    lst = list(map(int, input().split()))
    k = lst[0]
    ss = lst[1::2]
    hs = lst[2::2]
    v_acc = 0
    h_acc = 0
    index = 0
    s, h = ss[0], hs[0]
    save = []
    for i in range(m + 1):
      if i < v_acc + s * h:
        save.append(h_acc + (i - v_acc) / s)
      else:
        v_acc = i
        h_acc += h
        index += 1
        save.append(h_acc)
        if index == k:break
        s, h = ss[index], hs[index]
    height.append(save)
  
  dp = [0] * (m + 1)
  for i in range(n):
    hi = height[i]
    for j in range(m, -1, -1):
      dp[j] = max([dp[j - v] + hi[v] for v in range(min(len(hi), j + 1))])
  print(dp[-1])

main()


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

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> a(m);
    if (m != 0){
        for (int i = 0;i < m;i++){
        cin >> a[i];
        a[i]--;
        }
    }

    int c = 0;
    vector<bool> s(n,true);

    if (m != 0){
        for (int i = 0; i < n; i++){
            if (i == a[c]){
                s[i] = false;
                c++;
            }
        }
    }
    
    vector<long long> ans(n,0);

    for (int i = 0; i < n; i++){
        if (i == 0){
            if (s[i] == false){
                ans[i] = 0;
            }
            else{
                ans[i] = 1;
            }
        }
        else if (i == 1){
            if (s[1] == false){
                ans[i] = 0;
            }
            else{
                ans[i] = ans[i-1] + 1;
            }
        }
        else{
            if (s[i] == false){
                ans[i] = 0;
            }
            else{
                ans[i] = ans[i-1] + ans[i-2];
                ans[i] %= 1000000007;
            }
        }
    }

    cout << ans[n-1] << endl;
}


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

using namespace std ;

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

int s , w;  
cin >> s >> w;  
if (w >= s )
	cout << "unsafe" << endl ;
else
	cout << "safe" << endl; 
}


Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<algorithm>
#define vvi vector<vector<int>>
#define rep(i,N) for(int i = 0; i < N; i++)
#define vi vector<int>
#define MAX 10000000
using namespace std;


int main() {
	int D, G;
	cin >> D >> G;
	G /= 100;
	vector<int> Prob(D), Bonus(D);
	rep(i, D) {
		int x, y; cin >> x >> y;

		Prob[i] = x;
		Bonus[i] = y;
		Bonus[i] /= 100;
	}

	vvi dp(D + 1, vi(G + 1, MAX));
	dp[0][0] = 0;
	for (int i = 0; i < D; i++) {
		for (int j = 0; j < G + 1; j++) {
			for (int k = 0; k < Prob[i] + 1; k++) {
				int posit = min(j+(i + 1) * k, G);
				if (k == Prob[i]) {
					posit += Bonus[i];
					posit = min(G, posit);
				}
				/*
				cout << "i" << i << "j" << j << "k" << k << endl;
				cout << "a"<< dp[i][posit] << endl; 
				cout << "b" << dp[i][j] + k << endl;
				*/

				dp[i + 1][posit] = min({ dp[i][posit], dp[i][j] + k,dp[i + 1][posit] });
				//cout << "Refresh" << endl << dp[i + 1][posit] << endl;
				
			}
		}
		for (int k = G-1; k >= 0; k--) {
			if (dp[i + 1][k] == MAX) {
				dp[i + 1][k] = dp[i + 1][k + 1];
			}
		}
	}

	cout << dp[D][G] << endl;
}

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

using namespace std;

#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}

#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define endl '\n'

int n, m, x;
int a[105];

signed main()
{
	IOS;
	cin >> n >> m >> x;
	int c1 = 0, c2 = 0;
	for (int i = 0; i < m; i++) 
		cin >> a[i];
	for (int i = 0; i < m; i++) {
		if (a[i] > x) {
			c1++;
		}
		if (a[i] < x) {
			c2++;
		}
	}
	cout << min(c1, c2) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=100005,M=200005;
const ll ms=1e9+7,inf=1ll<<60;
int read(){
	int x=0,f=1; char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1; ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
struct Edg{
	int nxt,poi,cost;
}e[M<<1];
ll dis[N],fdis[N],f[N],g[N],n,m,s,t;
vector<int>E[N],G[N];
int first[N],l=0;
bool vis[N],use[N];
void addedge(int u,int v,int k){
	l++;
	e[l].nxt=first[u];
	e[l].poi=v;
	e[l].cost=k;
	first[u]=l;
}
void spfa(ll *dis,int s){
	for (int i=1;i<=n;i++) dis[i]=inf,vis[i]=0;
	queue<int>q;
	q.push(s);
	dis[s]=0; vis[s]=0;
	while (!q.empty()){
		int now=q.front(); q.pop();
		for (int p=first[now];p;p=e[p].nxt){
			int v=e[p].poi;
			if (dis[v]>dis[now]+e[p].cost){
				dis[v]=dis[now]+e[p].cost;
				if (!vis[v]) q.push(v),vis[v]=1;
			}
		}
		vis[now]=0;
	}
}
void add(ll &x,ll y){
	x+=y;
	if (x>=ms) x-=ms;
}
void dfs1(int u){
	vis[u]=1;
	for (int i=0;i<E[u].size();i++){
		int v=E[u][i];
		if (!vis[v]) dfs1(v);
		add(f[u],f[v]);
	}
}
void dfs2(int u){
	vis[u]=1;
	for (int i=0;i<G[u].size();i++){
		int v=G[u][i];
		if (!vis[v]) dfs2(v);
		add(g[u],g[v]);
	}
}
int main(){
	n=read(),m=read();
	s=read(),t=read();
	for (int i=1;i<=m;i++){
		int u=read(),v=read(),k=read();
		addedge(u,v,k); addedge(v,u,k);
	}
	spfa(dis,s); spfa(fdis,t);
	for (int i=1;i<=n;i++)
	use[i]=(dis[i]+fdis[i]==dis[t]);
	for (int i=1;i<=n;i++){
		if (!use[i]) continue;
		for (int p=first[i];p;p=e[p].nxt){
			int v=e[p].poi;
			if (use[v]&&dis[v]==dis[i]+e[p].cost)
			E[i].push_back(v);
		}
	}
	for (int i=1;i<=n;i++){
		if (!use[i]) continue;
		for (int p=first[i];p;p=e[p].nxt){
			int v=e[p].poi;
			if (use[v]&&fdis[v]==fdis[i]+e[p].cost)
			G[i].push_back(v);
		}
	}
	memset(vis,0,sizeof(vis));
	vis[t]=1; f[t]=1; dfs1(s);
	memset(vis,0,sizeof(vis));
	vis[s]=1; g[s]=1; dfs2(t);
	ll ans=0;
	for (int i=1;i<=n;i++){
		if (!use[i]) continue;
		if (dis[t]==dis[i]*2){
			ans=(ans+f[i]*g[i]%ms*f[i]%ms*g[i]%ms)%ms;
		}
	}
	for (int i=1;i<=n;i++){
		if (!use[i]||dis[i]*2>=dis[t]) continue;
		for (int j=0;j<E[i].size();j++){
			int v=E[i][j];
			if (dis[v]*2>dis[t]){
				ans=(ans+g[i]*f[v]%ms*g[i]%ms*f[v]%ms)%ms;
			}
		}
	}
	ans=(f[s]*f[s]-ans+ms)%ms;
	printf("%lld\n",ans);
	return 0;
}

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

using namespace std;

char ch[200];
int main()
{
  string l;
  cin >> l;
  for(int i = 0; i < l.size(); i++){
     ch[l[i]]++;
  }
  for(int i = 'a'; i < 'z'; i++){
    if(ch[i]){
       if(ch[i] & 1){
         cout << "No" << endl;
         return 0;
         }
    }
     else
       continue;
  }
  cout <<  "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		System.out.println(Math.min(Math.min(a+b, b+c), a+c));
	}

}

Measured memory_bytes: 22996
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

const int mod = 1000000007;
//const int mod = 998244353;

struct mint {
	int64_t x;
	mint(int64_t x=0):x((x%mod+mod)%mod){}
	mint operator-() const { return mint(-x);}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
	mint operator+(const mint a) const { return mint(*this) += a;}
	mint operator-(const mint a) const { return mint(*this) -= a;}
	mint operator*(const mint a) const { return mint(*this) *= a;}
	mint pow(int64_t t) const {
		if (!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if (t&1) a *= *this;
		return a;
	}

	//for prime mod
	mint inv() const { return pow(mod-2);}
	mint& operator/=(const mint a) { return *this *= a.inv();}
	mint operator/(const mint a) {return mint(*this) /= a;}
};

istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct mat{
	mint mm[3][3];
	mat() {memset(mm, 0, sizeof(mm));}
	mat(mint i) {
		memset(mm, 0, sizeof(mm));
		rep(j, 3) mm[j][j] = i;
	}
};

//head

mat mul(mat &a, mat &b) {
	mat res;
	rep(i, 3) rep(j, 3) rep(k, 3) {
		res.mm[i][j] += a.mm[i][k] * b.mm[k][j];
	}
	return res;
}
mat pow(mat &a, ll p) {
	if(!p) return mat(1);
	mat res = pow(a, p>>1);
	res = mul(res, res);
	if(p&1) {
		res = mul(a, res);
	}
	return res;
}


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

	int n, m;
	cin >> n >> m;
	vi x(m+1);
	rep(i, m) cin >> x[i+1];

	mat A, B;
	rep(i, 3) A.mm[0][i] = B.mm[0][i] = 1;
	rep(i, 3) A.mm[1][i] = B.mm[1][i] = i;
	rep(i, 2) A.mm[2][i] = 1;
	A.mm[2][2] = 2;
	B.mm[2][2] = 1;
	mat res(1);
	mat X;
	rep(i, m) {
		X = pow(A, x[i+1]-x[i]-1);
		res = mul(X, res);
		res = mul(B, res);
	}
	X = pow(A, n-x[m]-1);
	res = mul(X, res);

	mint ans;
	rep(i, 3) ans += res.mm[i][2];
	cout << ans << endl;
}

Measured memory_bytes: 3704
#include<bits/stdc++.h>
#define int long long


using namespace std ;

const int N = 1e5 + 5 ;
const int inf = 1e9+7 ;
int dp[105][N] ;

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

    int n ,W ;
    cin >> n >>W;
    memset(dp ,inf, sizeof(dp)) ;
    vector<pair<int,int>> b(n) ;
    int max_val = n*1000 ;
    for(int i = 0 ; i  < n ; ++i)
    {
        int w ,v ;
        cin >>w >> v ;

        b[i] = (make_pair(w,v)) ;
    }


    dp[0][0] = 0 ;


    for(int i =1 ; i <= n ; ++i)
    {
        for(int j=0 ; j <=max_val  ; ++j)
        {
            if(j >= b[i-1].second)
            {
                dp[i][j] = min(dp[i-1][j] , dp[i-1][j-b[i-1].second]+ b[i-1].first);
            }
            else
            {
                dp[i][j] = dp[i-1][j] ;
            }

        }
    }
    int ans = 0 ;

    for(int i = 0 ; i <=max_val ; ++i)
    {
        if( dp[n][i]<= W){
            ans = i ;

        }
    }
    cout << ans <<endl;



}


Measured memory_bytes: 85704
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	ll n,k;
	cin>>k>>n;
	ll a[n+1];
	cin>>a[0];
	for(int i=1;i<n;i++){
		cin>>a[i];
		if(i==n-1) a[n]=k-a[n-1];
		//a[i]=a[i]-a[i-1];
	} 
	ll sum=0;
	for(int i=1;i<n;i++){
		sum=sum+a[i-1];
		a[i]=a[i]-sum;
	}
	ll mini=1000000007;
	for(int i=0;i<n;i++){
		if(i==0){
			if(k-a[i]-a[n]<mini) mini=k-a[i]-a[n];
		//	cout<<k-a[i]-a[n];
		}
		else{
			if((k-a[i])<mini) mini=(k-a[i]); 
		//	cout<<k-a[i];
		}
		//cout<<endl;
		
	}
	cout<<mini;
	return 0;
}

Measured memory_bytes: 1792
n = int(input())
dp = [0, 0, 0]
for x in range(n):
    new_dp = [0]*3
    happy = [int(x) for x in input().split()]
    for y in range(3):
        for z in range(3):
            if y != z:
                new_dp[y] = max(new_dp[y], dp[z] + happy[y])
    dp = new_dp
print(max(dp[0], dp[1], dp[2]))

Measured memory_bytes: 75580
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-03-30 21:17:58
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) { os << '{'; for (auto it = mp.begin(); it != mp.end(); ++it) { os << '{' << it->first << ':' << it->second << '}'; if (it != --mp.end()) os << ','; } os << '}'; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, const std::set<T>& st) { os << '{'; for (auto it = st.begin(); it != st.end(); ++it) { os << *it; if (it != --st.end()) os << ','; } os << '}'; return os; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...) 1728
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

std::map<int64, int> prime_fact(int64 n){
  std::map<int64, int> result;
  for (int64 i = 2; i * i <= n; ++i){
    if (n % i != 0) continue;
    int cnt = 0;
    while (n % i == 0){
      n /= i; ++cnt;
    }
    result[i] = cnt;
  }
  if (n != 1) result[n] = 1;
  return result;
}

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

  int64 n, p; cin >> n >> p;
  map<int64, int> mp = prime_fact(p);

  int64 mx = 1;

  for (auto x : mp) {
    if (x.second >= n) {
      for (int i = 0; i < x.second / n; ++i) {
        mx *= x.first;
      }
    }
  }

  cout << mx << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
int main() {
  ios::sync_with_stdio(false);
  ll N;
  cin >> N;
  if (N == 2) {
    cout << 1 << endl;
    return 0;
  }
  ll ret = 0;
  for (ll k=2; k*k<=N; k++) {
    ll n = N;
    while (n >= k) {
      if (n % k == 0) {
        n /= k;
      } else {
        n %= k;
      }
    }
    if (n == 1) {
      ret++;
      //cout << k << endl;
    }
  }
  for (ll k=2; k*k<=N; k++) {
    ll d = N / k;
    if (d <= k) break;
    if (N % k == 1) {
      ret++;
      //cout << d << endl;
    }
  }
  cout << ret + 2 << endl;
}

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

// Type alias
using ll=long long;
using ld=double;

using pi=pair<int,int>;
using pll=pair<ll,ll>;
using pld=pair<ld,ld>;
using ti3=tuple<int, int, int>;

using vi=vector<int>;
using vll=vector<ll>;
using vld=vector<ld>;
using vpi=vector<pi>;
using vpll=vector<ll>;
using vpld=vector<ld>;
using vti3=vector<ti3>;

// Constants
const double EPS = 1e-9;
const int inf = numeric_limits<int>::max() / 2;
const ll mod = 1e9+7;

// Macro
#define rep(i,n) for(int i=0;i<int(n);++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;--i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(i,a,b) for(int i=int(b-1);i>=int(a);--i)
#define SHOW(a) cout << #a << " = " << a << endl
#define ARR(a,n) for(int i=0;i<int(n);++i) cout << #a << "[" << i << "]" << " = " << a[i] << endl

#define ALL(a) a.begin(),a.end()

// Funtcions
ll pow(ll base, ll i, ll mod){
  ll a = 1;
  while(i){
    if (i & 1) {
      a *= base;
      a %= mod;
    }
    base *= base;
    base %= mod;
    i >>= 1;
  }
  return a;
}
ll gcd(ll a, ll b){
  while(b){
    ll c = a % b;
    a = b;
    b = c;
  }
  return a;
}
ll lcm(ll a, ll b){
  return a / gcd(a, b) * b;
}
template<typename T> bool chmin(T& a, const T& b) {
  if (a > b) return a = b, true; else return false;
}

template<typename T> bool chmax(T& a, const T& b) {
  if (a < b) return a = b, true; else return false;
}


void solve(){
  int N;
  cin >> N;
  cout << fixed << setprecision(5) << 2 * M_PI * N << endl;
}

int main(){
// FastIO
//ios_base::sync_with_stdio(false);
cin.tie(NULL);
  solve();
  return 0;
}

Measured memory_bytes: 3780
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(int argc, char* argv[])
{
  int H, W;
  cin >> H >> W;
  
  vector< vector<bool> > map(H); // indicates if each cell is reacheable
  for (int i=0; i<H; i++) {
    map[i].resize(W);
    string s;
    cin >> s;    
    for (int j=0; j<W; j++) {
      map[i][j] = (s[j] == '.');
    }
  }
  /*
  for (int i=0; i<H; i++) {
    for (int j=0; j<W; j++) {
      cout << map[i][j] << " ";
    }
    cout << "\n";
  }
  */

  // number of ways to get to each cell
  vector< vector<long long> > v(H);
  for (int i=0; i<H; i++) {
    v[i].resize(W, 0);  // 0 means unreachable
  }
  
  v[0][0] = 1;
  for (int i=1; i < H; i++) {
    if (!map[i][0]) break;
    v[i][0] = 1;
  }
  for (int j=1; j < W; j++) {
    if (!map[0][j]) break;
    v[0][j] = 1;
  }
  
  long long modulo = 1e9 + 7;
  for (int i=1; i<H; i++) {
    for (int j=1; j<W; j++) {
      if (!map[i][j]) continue;
      v[i][j] = (v[i-1][j] + v[i][j-1]) % modulo;
    }
  }
  /*
  for (int i=0; i<H; i++) {
    for (int j=0; j<W; j++) {
      cout << v[i][j] << " ";
    }
    cout << "\n";
  }
  */
  cout << v[H-1][W-1] << "\n";
  return 0;
}


Measured memory_bytes: 8320
#include <bits/stdc++.h>
using namespace std;
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto x : v) cerr << x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int i = 0; i < (n); ++i) cerr << a[i] << ", "; cerr << endl
typedef long long ll;
typedef long double ld;
bool G[705][705];
int col[705];
int cnt[2];
int n;
bool go(int x, int c) {
	if (col[x] != -1) {
		return col[x] == c;
	}
	col[x] = c;
	++cnt[c];
	for (int y = 1; y <= n; ++y) {
		if (!G[x][y]) continue;
		if (!go(y, 1 - c)) return false;
	}
	return true;
}
int main() {
	int m;
	scanf("%d%d", &n, &m);
	memset(G, 1, sizeof(G));
	for (int i = 0; i < m; ++i) {
		int a, b;
		scanf("%d%d", &a, &b);
		G[a][b] = G[b][a] = 0;
	}
	for (int i = 1; i <= n; ++i) G[i][i] = 0;
	vector<pair<int, int>> vec;
	memset(col, -1, sizeof(col));
	for (int i = 1; i <= n; ++i) {
		if (col[i] != -1) continue;
		cnt[0] = cnt[1] = 0;
		if (!go(i, 0)) {
			printf("-1\n");
			return 0;
		}
		vec.push_back({cnt[0], cnt[1]});
	}
	bitset<705> can;
	can[0] = 1;
	for (auto v : vec) {
		can = (can << v.first) | (can << v.second);
	}
	int ans = INT_MAX;
	for (int i = 0; i <= n; ++i) {
		if (can[i]) ans = min(ans, i * (i - 1) / 2 + (n - i) * (n - i - 1) / 2);
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
typedef long long ll;
using namespace std;
int main()
{
  string a;
  cin >> a;
  vector<char > b(3);
  b[0] = a[0];
  b[1] = a[1];
  b[2] = a[2];

  sort(all(b));
  if(b[0] == 'a'&&b[1] == 'b'&&b[2] == 'c'){cout << "Yes" << endl;}
  else cout << "No" << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ldb = long double;
using pa = pair < ll, ll >;
using vec = vector < ll >;
#define pb push_back
#define po pop_back
#define mp make_pair
#define mt make_tuple
#define F  first
#define S  second
#define f(i,x,n) for(ll i=x;i<n;i++) 
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))
#define all(c) c.begin(),c.end()
#define str string
#define edl "\n"
#define add insert
#define cot continue
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e5 + 10;
const double PI = acos(-1);
const ll LINF = LLONG_MAX;



int32_t main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ll l ,r;
  cin >> l >>r;
  ll ans = LLONG_MAX;
  f(i,l,min(r+1,l+2019)){
    f(j,i+1,min(r+1,l+2019)){
      ans = min(ans,(i*j)%2019);
    }
  }
  cout << ans << '\n';
  return 0; 
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int MOD = 1000000009;
const long long INF = 1LL << 60;

int main() {
    int L, R, d;
    cin >> L >> R >> d;
    int res = 0;
    for (int i = L; i <= R; ++i) {
        if (i % d == 0) ++res;
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3632
#include <iostream>

int main(int argc, char const* argv[])
{
    char c;
    std::cin >> c;

    if(c == 'A')
    {
        std::cout << 'T' << std::endl;
    }
    if(c == 'T')
    {
        std::cout << 'A' << std::endl;
    }
    if(c == 'C')
    {
        std::cout << 'G' << std::endl;
    }
    if(c == 'G')
    {
        std::cout << 'C' << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::prelude::BufRead;
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufReader, BufWriter, Write};
#[allow(unused_imports)]
use std::mem::swap;
#[allow(unused_imports)]
use std::str::FromStr;


fn main() {
	let param = read_vector::<usize>();
    let (n, k) = (param[0], param[1]);
    let mut ans = 0.0;
    for i in 1..(n + 1) {
        let mut score = i;
        let mut prob = 1.0;
        while score < k {
            score *= 2;
            prob *= 0.5;
        }
        ans += prob;
    }
    ans /= n as f64;
    println!("{}", ans);
}

#[allow(dead_code)]
fn read<T>() -> T where T: std::str::FromStr, T::Err: std::fmt::Debug {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    return buf
        .trim()
        .parse()
        .unwrap();
}

#[allow(dead_code)]
fn read_vector<T>() -> Vec<T> where T: std::str::FromStr, T::Err: std::fmt::Debug {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    return buf
        .split_whitespace()
        .map(|s| s.parse().unwrap())
        .collect();
}

#[allow(dead_code)]
fn read_matrix<T>() -> Vec<Vec<T>> where T: std::str::FromStr, T::Err: std::fmt::Debug {
    use std::io::prelude::*;
    let stdin = stdin();
    return stdin
        .lock()
        .lines()
        .map(|line| line
            .unwrap()
            .split_whitespace()
            .map(|s| s.parse().unwrap())
            .collect())
        .collect();
}

Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.ComTypes;

namespace AOJGRL_2_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var VE = ReadInt();
            int V = VE[0];
            int E = VE[1];

            Edge[] edges = new Edge[E];
            for (int i = 0; i < E; i++)
            {
                var input = ReadLong();
                Edge e = new Edge();
                e.s = (int)input[0];
                e.t = (int)input[1];
                e.cost = input[2];

                edges[i] = e;
            }

            edges = edges.OrderBy(x => x.cost).ToArray();

            UnionFind unionFind = new UnionFind(V);

            long ans = 0;
            foreach (var e in edges)
            {
                //すでに結合済み？
                if (!unionFind.same(e.s, e.t))
                {
                    unionFind.unite(e.s, e.t);
                    ans += e.cost;
                }
            }

            Console.WriteLine(ans);
            Console.ReadKey();
        }

        struct Edge
        {
            public int s;
            public int t;
            public long cost;
        }

        static int[] ReadInt()
        {
            int[] ret = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return ret;
        }
        static long[] ReadLong()
        {
            long[] ret = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return ret;
        }
    }

    class UnionFind
    {
        int[] par;
        int[] rank;

        public UnionFind(int n)
        {
            init(n);
        }

        void init(int n)
        {
            par = new int[n];
            rank = new int[n];

            for (int i = 0; i < n; i++)
            {
                par[i] = i;
                rank[i] = 0;
            }
        }

        public int find(int x)
        {
            if (par[x] == x)
            {
                return x;
            }
            else
            {
                return par[x] = find(par[x]);
            }
        }

        public void unite(int x, int y)
        {
            x = find(x);
            y = find(y);
            if (x == y) return;

            if (rank[x] < rank[y])
            {
                par[x] = y;
            }
            else
            {
                par[y] = x;
                if (rank[x] == rank[y]) rank[x]++;
            }

        }
        public bool same(int x, int y)
        {
            return find(x) == find(y);
        }
    }
}



Measured memory_bytes: 33732