akhauriyash/Code-Regression huggingface dataset:
n=gets.to_i
s=gets
max=0
for i in 0..n do
  lista=[]
  listb=[]
  c=0
  for x in 0...i do
    lista.push(s[x])
  end
  for y in i...n do
    listb.push(s[y])
  end
  lista=lista.uniq
  listb=listb.uniq
  lista.each{|o|
    if listb.include?(o) then c+=1 end
  }
  if max<c then max=c end
end
puts max

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

int main(void)
{
  int n;
  scanf("%d", &n);
  int i, k, b[n];
  memset(b, 0, sizeof(b));
  for (i = 2; i <= n; i++)
  {
    scanf("%d", &k);
    b[k - 1]++;
  }
  
  for (i = 0; i < n; i++)
    printf("%d\n", b[i]);
  
  return 0;
}


Measured memory_bytes: 2504
#include<bits/stdc++.h>
#include <iomanip>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define PI 3.14159265358979
int main()
{
    double a, b;
    double h, m;
    cin >> a >> b >> h >> m;

    
    double ang_m = m / 60.0;
    double ang_h = h / 12.0 + m / (60.0*12);
    double ang = abs(ang_h - ang_m)* PI* 2;
    double x1 = pow(b*sin(ang), 2);
    double x2 = pow(a - b*cos(ang), 2);
    double ans = pow(x1 + x2, 0.5);
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF (1LL<<25)     //33554432
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

int f(ll n) {
  ll ret = 0;
  while(n > 2) {
    n = (n-1)/2;
    ret++;
  }
  return ret;
}

signed main(void)
{
  int x;
  cin >> x;

  ll high = INF*INF, low = 0;
  while(high - low > 1) {
    ll mid = (high+low)/2;
    //cout << high << " " << mid << " " << low << " " << f(mid) << endl;
    if(f(mid) <= x) low = mid;
    else high = mid;
  }

  cout << low << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MXN = 100005;
int p[MXN], r[MXN];

void init(int n)
{
    for(int i = 0; i <= n; ++i)
    {
        p[i] = i;
        r[i] = 1;
    }
}

int Find(int x)
{
    return (x == p[x] ? x : p[x] = Find(p[x]));
}

bool Union(int x, int y)
{
    x = Find(x);
    y = Find(y);
    if(x == y)
    {
        return false;
    }
    if(r[x] == r[y])
    {
        p[y] = x;
        ++r[x];
    }
    else if(r[x] > r[y])
    {
        p[y] = x;
    }
    else
    {
        p[x] = y;
    }
    return true;
}

int main(){
    int n, m;
    cin >> n >> m;
    init(n);
    for(int i = 0, x, y, z; i != m; ++i)
    {
        cin >> x >> y >> z;
        if(Union(x, y))
        {
            --n;
        }
    }
    cout << n << '\n';
}


Measured memory_bytes: 1024
def binary_search(char, letter):
    bottom = 0
    top = len(char)
    while bottom < top:
        m = (bottom+top)//2
        if char[m] == letter:
            return True
        elif letter < char[m]:
            top = m
        else:
            bottom = m + 1
    return False


a = int(input())
x = list(map(int, input().split()))
b = int(input())
xx = list(map(int, input().split()))
total = 0

for i in xx:
    if binary_search(x, i):
        total += 1

print(total)



Measured memory_bytes: 16708
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AthleteProgramming2
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                var str = Console.ReadLine();
                if (str == null) break;
                string temp = "this";
                for (int i = 0; i < 26; i++)
                {
                    temp = swap(str, i);
                    if (check(temp) == true)
                    {
                        Console.WriteLine(temp);
                        break;
                    }
                }
            }

        }
        static string swap(string str1, int n)
        {
            int code;
            string swap_str = "";
            char[] strs = new char[str1.Length];
            for (int i = 0; i < str1.Length; i++)
            {
                if (str1.Substring(i, 1) != " " && str1.Substring(i, 1) != ".")
                {
                    code = (int)str1[i] + n;
                    if (122 < code) { code -= 26; }
                    strs[i] = (char)code;
                }
                else if (str1.Substring(i, 1) == " ") strs[i] = ' ';
                else strs[i] = '.';
            }
            for (int i = 0; i < strs.Length; i++) swap_str += strs[i].ToString();
            return swap_str;
        }
        static Boolean check(string str)
        {
            Boolean tf = false;
            for (int i = 0; i < str.Length - 2; i++)
            {
                if (str.Substring(i, 3) == "the")
                {
                    tf = true;
                    break;
                }
            }
            for (int i = 0; i < str.Length - 3; i++)
            {
                if (str.Substring(i, 4) == "this" || str.Substring(i, 4) == "that")
                {
                    tf = true;
                    break;
                }
            }
            return tf;
        }
    }

}

Measured memory_bytes: 8892
a,b,c,k=map(int, input().split())
ans=0
if a>=k:
    ans+=k*1
    k=0
else:
    ans+=a*1
    k=k-a
if b>=k:
    ans+=k*0
    k=0
else:
    ans+=b*0
    k=k-b
if c>=k:
    ans+=k*-1
    k=0
else:
    ans+=c*-1
    k=k-c
print(ans)

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

constexpr int INF = (1 << 30) - 1;
int cnt = 0;
template < typename T >
void Merge(T *A, int l, int m, int r)
{
        int i, j, k;
        int n1 = m - l;
        int n2 = r - m; 
        
        auto L = make_unique < T[] > (n1 + 2);
        auto R = make_unique < T[] > (n2 + 2);

        for ( i = 0; i < n1; i++ ) L[i] = A[l + i];
        for ( i = 0; i < n2; i++ ) R[i] = A[m + i];

        L[n1] = INF, L[n2] = INF;
        i = 0, j = 0;
        for ( k = l; k < r; k++ ) {
                if ( j >= n2 || L[i] <= R[j] ) A[k] = L[i++];
                else A[k] = R[j++];
                cnt++;
        }
}

template < typename T >
void Mergesort(T *A, int l, int r) 
{
        if ( l + 1 < r ) {
                int m = (l + r) / 2;
                Mergesort(A, l, m);
                Mergesort(A, m, r);
                Merge(A, l, m, r);
        }
}

int main()
{
        int n;
        int A[500005];

        cin >> n;
        for ( int i = 0; i < n; i++ ) cin >> A[i];
        
        Mergesort(A, 0, n);
        
        cout << A[0];
        for ( int i = 1; i < n; i++ ) cout << " " << A[i];
        cout << endl;
        cout << cnt << endl;

        return ( 0 );
}



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

const int N = 200005;

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

int getDist(pair <int, int> st, pair <int, int> end, vector <string> s) {

   int n = s.size();
   int m = s[0].length();

   queue <pair <int, int>> q;
   q.push(st);
   vector<vector<bool>> visited(n, vector<bool>(m));
   vector<vector<int>> dist(n, vector<int>(m));
   visited[st.first][st.second] = true;
   dist[st.first][st.second] = 0;

   while(!q.empty()) {
      auto t = q.front();
      q.pop();

      int x = t.first;
      int y = t.second;

      for(int i = 0; i < 4; i++) {
         int x_ = x + dx[i];
         int y_ = y + dy[i];
         if(x_ >= 0 && x_ < n && y_ >= 0 && y_ < m && s[x_][y_] == '.') {
            if(visited[x_][y_] == false) {
               visited[x_][y_] = true;
               dist[x_][y_] = dist[x][y] + 1;
               q.push({x_, y_});
            }
         }
      }
   }

   return dist[end.first][end.second];
}
int main() {
   ios_base::sync_with_stdio(0);
   cin.tie(0);

   int n, m;
   cin >> n >> m;
   vector <string> s(n);
   for(int i = 0; i < n; i++) {
      cin >> s[i];
   }

   int ans = 0;

   for(int i = 0; i < n; i++) {
      for(int j = 0; j < m; j++) {
         for(int i_ = 0; i_ < n; i_++) {
            for(int j_ = 0; j_ < m; j_++) {
               if(s[i][j] == '.' && s[i_][j_] == '.') {
                  ans = max(ans, getDist({i, j}, {i_, j_}, s));
               }
            }
         }
      }
   }
   cout << ans << endl;

   return 0;
}


Measured memory_bytes: 256
N = int(input())
S = input().split()

while True:
    s = ''.join([S[i] for i in range(1, len(S)) if S[i] != S[i-1]])
    s = S[0]+s
    if len(s) == len(S):
        break
    else:
        S = s

print(len(S))

    

Measured memory_bytes: 3956
import java.util.*;

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

		int N = sc.nextInt();
		int[] a = new int[N];
		
		int c = 0;
		for (int i = 0; i < N; ++i) {
			a[i] = sc.nextInt();
			if ((i + 1) % 2 == 1 && a[i] % 2 == 1) c++;
		}
		
		System.out.println(c);
	}
}


Measured memory_bytes: 35088
class UnionFind:
    # 各要素の親要素の番号を格納するリスト
    # 要素が根（ルート）の場合は-(そのグループの要素数)を格納する
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    # 要素xが属するグループの根を返す
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    # 要素xが属するグループと要素yが属するグループとを併合する
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    # 要素xが属するグループのサイズ（要素数）を返す
    def size(self, x):
        return -self.parents[self.find(x)]

    # 要素x, yが同じグループに属するかどうかを返す
    def is_same(self, x, y):
        return self.find(x) == self.find(y)

    # 要素xが属するグループに属する要素をリストで返す
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    # すべての根の要素をリストで返す
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    # グループの数を返す
    def group_count(self):
        return len(self.roots())

    # {ルート要素: [そのグループに含まれる要素のリスト], ...}の辞書を返す
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    # ルート要素: [そのグループに含まれる要素のリスト]を文字列で返す (print()での表示用)
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def resolve():
    N, M = map(int, input().split())
    uf = UnionFind(N)

    for _ in range(M):
        a, b = map(lambda x: int(x) - 1, input().split())
        uf.union(a, b)

    ans = 0
    for i in range(N):
        ans = max(ans, uf.size(i))
    print(ans)

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 14756
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;


vector<int> vec;

int detection(vector<int> v, int x)
{
    for (int i=0; i<v.size(); ++i)
    {
        if(v[i] == x)
        {
            return 0;
        }
    }
    return 1;
}

int main()
{
    int N,d;
    cin >> N;
    for (int i=0; i<N; ++i)
    {
        cin >> d;
        if(detection(vec,d)) vec.push_back(d);
    }

    cout << vec.size() << endl;

    return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.container;
import std.array;
import std.math;
import std.range;
import std.typecons;
import std.ascii;
import std.format;

void main()
{
  auto input = readln.chomp.split.map!(to!int);
  auto n = input[0];
  auto k = input[1];
  long[] xs;
  long[] ys;
  bool[long] xset;
  bool[long] yset;
  foreach (i; 0..n) {
    auto xy = readln.chomp.split.map!(to!int);
    xs ~= xy.front;
    ys ~= xy.back;
    xset[xy.front] = true;
    yset[xy.back] = true;
  }
  long[] xlist = xset.keys;
  long[] ylist = yset.keys;
  std.algorithm.sort(xlist);
  std.algorithm.sort(ylist);
  long ans = long.max;
  foreach (xmin; xlist) {
    foreach (ymin; ylist) {
      foreach (xmax; xlist) {
        if (xmax < xmin) {
          continue;
        }
        foreach (ymax; ylist) {
          if (ymax < ymin) {
            continue;
          }
          int cnt = 0;
          foreach (i; 0..n) {
            long x = xs[i];
            long y = ys[i];
            cnt += xmin <= x && x <= xmax
                && ymin <= y && y <= ymax;
          }
          if (cnt >= k) {
            ans = min(ans, (xmax - xmin) * (ymax - ymin));
          }
        }
      }
    }
  }
  ans.writeln;
}


Measured memory_bytes: 380
w=input()
s='abcdefghijklmnopqrstuvwxyz'
c=0
if len(w)%2==1:
    print('No')
else:
    for i in range(len(s)):
        if w.count(s[i])%2==1:
            c+=1
    if c>0:
        print('No')
    else:
        print('Yes')

Measured memory_bytes: 2940
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
//#pragma GCC target("avx,avx2")
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")

//# include <x86intrin.h>
# include <bits/stdc++.h>

# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
 
template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int n;
ll k;
int a[N];
vector < int > st;

int u[N];

void dfs (int v) {
	u[v] ++;
	if (u[v] == 2) {
		int s = 0;
		while(st[s] != v) ++s;
		k -= sz(st)+1;
		vector < int > arr;
		while(s < sz(st)) {
			arr.pb(st[s]);
			s++;
		}
		cout << arr[k%sz(arr)] << '\n';
		return;
	}

	st.pb(v);
	if(sz(st) > k-1) {
		cout << st[k-1] << '\n';
		return;
	}

    dfs(a[v]);
}


int main () {
	SpeedForce;
	cin >> n >> k;
	For (i, 1, n) {
		cin >> a[i];
	}
	k++;
	dfs(1);

	return Accepted;
}

// B...a

Measured memory_bytes: 24332
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int N,A,B;
  cin >> N >> A >> B;
  int P[N];
  int one = 0;
  int two = 0;
  int three = 0;
  for (int i = 0; i < N; i++) {
    cin >> P[i];
    if (P[i] <= A) {
      one++;
    } else if (P[i] >= B+1) {
      three++;
    } else {
      two++;
    }
  }
  cout << min({one,two,three}) << endl;
  return 0;
}

Measured memory_bytes: 256
x = gets.to_i

def is_prime?(n)
  s = Math.sqrt(n).floor
  for i in 2.upto(s)
    if n % i == 0
      return false
    end
  end
  true
end

loop do
  if is_prime?(x)
    break
  else
    x = x.next
  end
end
puts x


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, start, n) for (int i = (int)(start); i < (int)(n); ++i)
static const int INFTY = (1 << 30);
int N, M;
void func()
{
    cin>>N;
    int a[N+1];
    rep(i, 1, N+1) {
        cin>>a[i];
    }
    int b[N+1]={};
    // memset(b, -1, sizeof(int));
    for (int i=N;i>0;--i) {
        for (int j=2*i;j<=N;j+=i) {
            b[i]^=b[j];
        }
        b[i]^=a[i];
    }
    int ans=0;
    rep(i, 1, N+1) {
        if (b[i])++ans;
    }
    cout<<ans<<endl;
    if (ans) {
        rep(i, 1, N+1) {
            if (b[i])cout<<i<<' ';
        }
        cout<<endl;
    }

}
int main()
{
    func();
}

Measured memory_bytes: 5156
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
using namespace std;

int main(){
    // あとで消す
    //std::ifstream in("cin3.txt");
    //std::cin.rdbuf(in.rdbuf());

    vector<bool> data(1000000001,false);
    int N;
    cin >> N;

    int Ai;

    for(size_t i=0;i<N;i++){
        cin >> Ai;
        if(!data.at(Ai)){
            data.at(Ai) = true;
        }else{
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 122368
#define _USE_MATH_DEFINES
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	vector<int> v(3);
	for(int i=0;i<3;++i){
		cin>>v[i];
	}
	int K;
	cin>>K;
	sort(v.begin(),v.end());
	int ans = v[0]+v[1]+(v[2]<<K);
	cout << ans << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 256
N = int(input())
X = sorted([int(i) for i in input().split()])
R = 1000000
for c in range(X[0], X[-1]+1):
    if sum((c-X[i])**2 for i in range(N)) < R:
        R = sum((c-X[i])**2 for i in range(N))
    else:
        pass
print(R)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define mod 1000000007
using namespace std;
typedef long long ll;
int main() 
{
    fast;
    ll t;
    cin>>t;
    ll sm = 0;
    for(ll i=1;i<=t;i++)
    {
        for(ll j=1;j<=t;j++)
        {
            for(ll k=1;k<=t;k++)
            {
                ll gcd = __gcd(i,j);
                gcd = __gcd(k,gcd);
                sm += gcd;
            }
        }
    }
    cout<<sm;
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
char f[10001];
int main(){
	cin>>f;
	for(int i=0;f[i]!=0;i++){
		if(f[i]=='C'){
			for(int j=i+1;f[j]!=0;j++){
				if(f[j]=='F'){
					cout<<"Yes\n";
					return 0;
				}
			}
		}
	}
	cout<<"No\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;cin>>N;
  int M;cin>>M;
  vector<int> X(M);
  vector<int> L(M-1);
  for(int i=0;i<M;i++)cin>>X[i];
  sort(X.begin(),X.end());
  int ans=0;
  if(N>=M){
    ans=0;
  }else{
  	for(int i=0;i<M-1;i++){
      L[i]=X[i+1]-X[i];
    }
    sort(L.begin(),L.end());
    for(int i=0;i<M-N;i++){
      ans+=L[i];
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
// vector<int> vec(3); = vector<int> vec={0,0,0}
// vec.at()
// sort(num.begin(),num.end(), greater<int>());
// reverse(num.begin(),num.end());
 
// 切り上げ　a/b+1
//  1からNの総和　N*(N+1)/2
 
int main() {
  char a,b;
  cin >> a >> b;
  
  if(a == 'H' && b == 'H'){
    cout << 'H' << endl;
  }
  else if(a == 'H' && b == 'D'){
    cout << 'D' << endl;
  }
  else if(a == 'D' && b == 'H'){
  	cout << 'D' << endl;
  }else{
  	cout << 'H' << endl;
  }
}

Measured memory_bytes: 256
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// ここまで

use std::io::Write;

fn run() {
    let out = std::io::stdout();
    let mut out = std::io::BufWriter::new(out.lock());
    input! {
        n: usize,
        m: usize,
        e: [(usize, usize); m],
    }
    if m % 2 != 0 {
        writeln!(out, "-1").unwrap();
        return;
    }
    let mut g = vec![vec![]; n + 1];
    for (i, &(a, b)) in e.iter().enumerate() {
        g[a].push((b, i));
        g[b].push((a, i));
    }
    let mut s = vec![];
    let mut q = vec![];
    let mut parent = vec![0; n + 1];
    let mut used = vec![false; n + 1];
    let mut used_e = vec![false; m];
    let mut d = vec![0; n + 1];
    used[1] = true;
    s.push(1);
    while let Some(v) = s.pop() {
        q.push(v);
        for &(u, k) in g[v].iter() {
            if !used[u] {
                parent[u] = v;
                used[u] = true;
                s.push(u);
            } else if parent[v] != u && !used_e[k]{
                used_e[k] = true;
                d[u] += 1;
                writeln!(out, "{} {}", u, v).unwrap();
            }
        }
    }
    for &v in q[1..].iter().rev() {
        let u = parent[v];
        if d[v] % 2 == 0 {
            d[u] += 1;
            writeln!(out, "{} {}", u, v).unwrap();
        } else {
            writeln!(out, "{} {}", v, u).unwrap();
        }
    }
}

fn main() {
    run();
}


Measured memory_bytes: 21884
using System;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using System.Text;
 
class DandA {
    static void Main(string[] args) {
        int n = ReadLineInt();
        int[] lList = ReadLineIntArray();
        Array.Sort(lList);
        int rtn = 0;
        for (int i = 0;i < n; i++) {
            for (int j = i + 1;j < n; j++) {
                for (int l = n - 1;l > j; l--) {
                    if (lList[l] < lList[i] + lList[j]) {
                      rtn += l - j;
                      break;
                    }
                }
            }
        }
        Console.WriteLine(rtn);
    }
 
    static string[] ary = new string[] {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
  
    static private string ReadLineStr() {return Console.ReadLine();}
    static private int ReadLineInt() {return int.Parse(Console.ReadLine());}
    static private long ReadLineLong() {return long.Parse(Console.ReadLine());}
    static private string[] ReadLineStrArray() {return Console.ReadLine().Trim().Split();}
    static private int[] ReadLineIntArray() {return Console.ReadLine().Trim().Split().Select(a => int.Parse(a)).ToArray();}
    static private long[] ReadLineLongArray() {return Console.ReadLine().Trim().Split().Select(a => long.Parse(a)).ToArray();}
    static private double[] ReadLineDoubleArray() {return Console.ReadLine().Trim().Split().Select(a => double.Parse(a)).ToArray();}
    static private decimal[] ReadLineDecimalArray() {return Console.ReadLine().Trim().Split().Select(a => decimal.Parse(a)).ToArray();}
    static private string[][] ReadMLineStrArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split()).ToArray();}
    static private int[][] ReadMLineIntArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();}
 
    static private bool IsPrime(int num) {
        if (num < 2) return false;
        if (num == 2) return true;
        else if (num % 2 == 0) return false;
        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2) {
            if (num % i == 0) return false;
        }
        return true;
    }
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
#define clr(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
const int maxn=100010;
int n;
ll a[maxn],ans,maxx,tep,b[maxn];
priority_queue<ll >qmax;
priority_queue<ll ,vector<ll>,greater<ll> >qmin;
void cal(){
	ans=0;
	ll p1=qmin.top(),p2=qmin.top();
	qmin.pop();
	int flag=0;
	while((!qmin.empty())||(!qmax.empty())){
		if(flag==0){
			flag=1;
			if(!qmax.empty()){
				ans+=abs(qmax.top()-p1);
				p1=qmax.top();
				qmax.pop();
			}
			if(!qmax.empty()){
				ans+=abs(qmax.top()-p2);
				p2=qmax.top();
				qmax.pop();
			}
		}else if(flag==1){
			flag=0;
			if(!qmin.empty()){
				ans+=abs(qmin.top()-p1);
				p1=qmin.top();
				qmin.pop();
			}
			if(!qmin.empty()){
				ans+=abs(qmin.top()-p2);
				p2=qmin.top();
				qmin.pop();
			}
		}
	}
	maxx=max(maxx,ans);
}
int main() {
	cin>>n;
	ans=0;
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
	}
	sort(a+1,a+1+n);
	for(int i=1;i<=(n/2);i++){
		qmin.push(a[i]);
	}
	for(int i=(n/2)+1;i<=n;i++)
	{
		qmax.push(a[i]);
	}
	cal();
	for(int i=1;i<=(n-n/2);i++){
		qmin.push(a[i]);
	}
	for(int i=(n-n/2)+1;i<=n;i++)
	{
		qmax.push(a[i]);
	}
	cal();
	printf("%lld\n",maxx);
}


Measured memory_bytes: 2296
#include<bits/stdc++.h>
using namespace std;
#define For(i,a,b) for(int i=a;i<b;i++) 
#define _For(i,a,b) for(int i=a;i>=b;i--)
#define LL long long 
const int N = 105;
int t,n,m;
LL ans;
int a[N][N];
vector<int> v;
int main(){
	cin>>n>>m;
/*	if(m==0){
		cout<<n*n<<endl;
		exit(0);
	}*/
	for(int i=m+1;i<=n;i++){
		ans+=(1LL)*(n/i)*(i-m);
		if(n%i>=m)
			if(m)
			ans+=n%i-m+1;
			else
			ans+=n%i;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void print_vec(vector<int>& a,int n=-1){
	n = (n==-1 ? a.size():n);
	for(int i=0;i<n;i++)
		cout << a[i] << (i<n-1 ? " ":"\n");
}

void print_vec(vector<long long>& a,int n=-1){
	n=(n==-1 ? a.size():n);
	for(int i=0;i<n;i++)
		cout << a[i] << (i<n-1 ? " ":"\n");
}

long long rec(vector<long long>& a, int x, int y, long long p){
	long long ans=0;
	if(y<x)
		return 0ll;
	if(y-x+1<=10){
		for(int i=x;i<=y;i++){
			long long tmp=0ll;
			for(int j=i;j<=y;j++){
				tmp=tmp*10ll+a[j];
				if(tmp%p==0)
					ans++;
			}
		}
		return ans;
	}
	else{
		ans = rec(a,x,(x+y)/2,p)+rec(a,(x+y)/2+1,y,p);
		unordered_map<long long, int> ht;
		int mid=(x+y)/2+1;
		vector<long long> tmp;
		long long tot=0;
		for(int i=mid;i<=y;i++){
			tot=(tot*10ll+a[i])%p;
			tmp.pb(tot);
		}
		tot=1;
		for(int i=y;i>=mid;i--){
			tmp[i-mid]=(1ll*tmp[i-mid]*tot)%p;
			tot=(tot*10)%p;
		}

		for(int i=0;i<tmp.size();i++){
			if(ht.find(tmp[i])!=ht.end()){
				(ht.find(tmp[i]))->second++;
			}
			else{
				ht[tmp[i]]=1;
			}
		}
		tot=1;
		long long half_sum=0,other_half;
		for(int i=mid;i<=y;i++){
			tot=(tot*10ll)%p;
		}

		for(int i=mid-1;i>=x;i--){
			half_sum=(half_sum+a[i]*tot)%p;
			tot=(tot*10)%p;
			other_half=(p-half_sum)%p;
			if(ht.find(other_half)!=ht.end()){
				ans+=((ht.find(other_half))->second);
			}
		}
	}
	return ans;
}

void solve(){
	int n;
	long long p;
	string s;
	cin>>n>>p>>s;
	vector<long long> a(n,0);
	for(int i=0;i<n;i++)
		a[i]=int(s[i]-'0');
	long long ans=0;
	if(p!=2 && p!=5)
		ans=rec(a,0,n-1,p);
	else{
		if(p==2){
			for(int i=0;i<n;i++)
				if(a[i]%2==0)
					ans+=(i+1);
		}
		else{
			for(int i=0;i<n;i++)
				if(a[i]%5==0)
					ans+=(i+1);
		}
	}
	cout<<ans<<"\n";
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(NULL);
	std::cout.tie(NULL);
	solve();
	return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>
#include <iterator>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<long long, long long>
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

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

using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;

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

  int n; cin >> n;
  vector<int> d(n);
  rep(i, n) {
    cin >> d[i];
  }
  int m; cin >> m;
  vector<int> t(m);
  rep(i, m) {
    cin >> t[i];
  }
  sort(d.begin(), d.end());
  sort(t.begin(), t.end());

  int now = 0;
  rep(i, m) {
    while(now < n && t[i] != d[now]) {
      now++;
    }
    if (now >= n) {
      cout << "NO" << endl;
      return 0;
    }
    now++;
  }

  cout << "YES" << endl;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
     
#define int  long long
#define endl '\n'
const int MOD = 1e9 + 7;
const int INF = 1e18;

void solve(){
 int a, b;
 cin >> a >> b;
 bool ok = a <= 9 && b <= 9;
 if (!ok) cout << -1 << endl;
 else{
  int ret = a * b;
  cout << ret << endl;	 
 }	
}

int32_t main(){
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  solve();	
}


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

ll N,M;
bool is_visited[8];
bool edges[28][28];

int dps(int start, bool visited[]){
    bool all_done = true;
    visited[start]=true;
    
    // for (int i = 0; i < N; i++) {
    //     std::cout << visited[i];
    // }
    // std::cout << std::endl;
    
    ll local_result =0;
    for (int i = 0; i < N; i++) {
        if(!visited[i]){
            all_done=false;
            break;
        }
    }
    // 全て探索が終わっていたらそのとおりを+1する。
    if(all_done){
       return 1;
    }
    
    for (int i = 0; i < N; i++) {
        // 自分自身、訪れたとこ、エッジがないところは省く
        if(i==start || visited[i] || !edges[start][i]){
            continue;
        }
        bool local_visited[8];
        memcpy(local_visited, visited, sizeof(bool) * 8);

        local_result+=dps(i,local_visited);
    }
    return local_result;
}

int main() {
    std::cin >> N>>M;
    for (int i = 0; i < M; i++) {
        ll tmp_a,tmp_b;
        std::cin >> tmp_a>>tmp_b;
        // 1ずらす
        edges[tmp_a-1][tmp_b-1]=true;
        edges[tmp_b-1][tmp_a-1]=true;
    }

    std::cout << dps(0,is_visited) << std::endl;
}


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

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };

#define MAX_N (int)2e5+20
#define INF 1e12+20

typedef long long ll;
using namespace std;

string s,a = "CODEFESTIVAL2016";
int main() {
	cin >> s;
	
	int count = 0;
	rep(i,0,s.size()){
		if(s[i] != a[i]) count++;
	}
	pout(count);
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
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();
		// // 文字列の入力
		// String s = sc.next();
		// // 出力
    // System.out.println((a+b+c) + " " + s);
    int N = sc.nextInt();
    int A = sc.nextInt();
    int B = sc.nextInt();
    System.out.println(Math.min(A * N, B));
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define int long
using pi=pair<int,int>;
signed main(){
    int n;
    cin>>n;
    vector<int> a(n),aii(n),jaj(n);
    for(auto& i:a)cin>>i;
    for(int i=0;i<n;++i){
        aii[i] = a[i] + i + 1;
        jaj[i] = i + 1 - a[i];
    }
    int res = 0;
    map<int, int> maii, mjaj;
    for (int i = 0; i < n; ++i) ++mjaj[jaj[i]];
    for(int i=0;i<n;++i){
        ++maii[aii[i]];
        --mjaj[jaj[i]];
        res += mjaj[aii[i]];
    }
    cout << res;
}

Measured memory_bytes: 42268
class Heap
	require 'forwardable'
	extend Forwardable

	def initialize
		@array = []
		@index = {}
	end

	def add(x)
		@array << x
		@index[x] = @array.size - 1
		lift_up(@array.size - 1)
	end

	def swap(i, j)
		u = @array[i]
		v = @array[j]
		@index[u], @index[v] = j, i
		@array[i], @array[j] = v, u
	end

	def lift_up(i)
		return if i == 0
		j = (i - 1) / 2
		if (@array[i] <=> @array[j]) < 0
			swap(i, j)
			lift_up(j)
		end
	end

	def del_min
		min = @array[0]
		if size > 1
			swap(0, @array.size-1)
			@array.pop
			lift_down(0)
		else
			@array.pop
		end
		@index.delete(min)
		min
	end

	def dec_key(obj, diff)
		i = @index[obj]
		@array[i] -= diff
		lift_up(i)
	end

	def del(obj)
		dec_key(obj, Float::INFINITY)
		del_min
	end

	def lift_down(i)
		j = 2 * i + 1
		k = j + 1
		if k >= size
			return if j >= size
			if (@array[i] <=> @array[j]) > 0
				swap(i, j)
				lift_down(j)
			end
		else
			l = ((@array[j] <=> @array[k]) < 0 ? j : k)
			if (@array[i] <=> @array[l]) > 0
				swap(i, l)
				lift_down(l)
			end
		end
	end

	def_delegators :@array, :empty?, :size
end

def check(ope_num, customers, deadline)
	queue_heap = Heap.new
	supported = {}
	finished = {}
	working = 0

	start_events = (0..deadline).map { [] }
	giveup_events = (0..deadline).map { [] }
	finish_events = (0..deadline).map { [] }
	start_events[0] = (0..customers.size-1).to_a

	(0..deadline).each do |t|
		abort_flag = false

		start_events[t].each do |id|
			support_time, wait_time, recall_time = customers[id]
			queue_heap.add(id)
			gt = t + wait_time
			giveup_events[gt] << id if gt <= deadline
		end

		finish_events[t].each do |id|
			finished[id] = 1
			working -= 1
		end

		until working == ope_num || queue_heap.empty?
			id, _ = queue_heap.del_min
			support_time, wait_time, recall_time = customers[id]
			ft = t + support_time
			if ft <= deadline
				finish_events[ft] << id 
				supported[id] = 1
				working += 1
			else
				abort_flag = true
				break
			end
		end
		break if abort_flag

		giveup_events[t].each do |id|
			next if supported[id]
			support_time, wait_time, recall_time = customers[id]
			queue_heap.del(id)
			st = t + recall_time
			if st + support_time <= deadline
				start_events[st] << id
			else
				abort_flag = true
				break
			end
		end
		break if abort_flag
	end

	return finished.size == customers.size
end

loop do
	n, deadline = gets.split.map(&:to_i)
	break if n == 0
	customers = (1..n).map { gets.split.map(&:to_i) }		

	lower_bound = (customers.map(&:first).inject(:+) / deadline.to_f).ceil
	(lower_bound..n).each do |o|	
		if check(o, customers, deadline)
			puts o
			break
		end
	end
end

Measured memory_bytes: 17664
#include<iostream>
#include<string>

using namespace std;

signed main(){
    string s;
    cin>>s;

    int l=s.length();
    int k=0;
    if(s[0]==s[l-1])k=1;

    if((l-k)%2==0)cout<<"Second"<<endl;
    else cout<<"First"<<endl;

    return 0;
}

Measured memory_bytes: 512
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> x;
  if (x == 1)
    Cout(0);
  else
    Cout(1);
  return 0;
}

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

class SegTree {
    using T = long long int;
    static const T& op(const T& lhs, const T& rhs) { // binary operator
        return max(lhs, rhs);
    }
    constexpr static T unit = -1LL<<60; // unit element
    const int N;
    T *data, *delay;
    int calc_size(int n) { int ret = 1; while (n > ret) ret *= 2; return ret; }
    void force(int i, int l, int r) {
        if (delay[i]) {
            data[i] += delay[i];
            if (r - l > 1) {
                delay[2*i+1] += delay[i];
                delay[2*i+2] += delay[i];
            }
            delay[i] = 0;
        }
    }
public:
    explicit SegTree(int n) : N(calc_size(n)) {   // [0, n-1]
        data = new T[2*N-1];
        delay = new T[2*N-1];
    }
    ~SegTree() { delete[] data, delay; }
    T query(int a, int b, int i = -1, int l = -1, int r = -1) {
        if (i == -1) { i = 0; l = 0; r = N; }
        if (r <= a || b <= l) return unit;
        force(i, l, r);
        if (a <= l && r <= b) return data[i];
        T v1 = query(a, b, 2*i+1, l, (l+r)/2),
            v2 = query(a, b, 2*i+2, (l+r)/2, r);
        return op(v1, v2);
    }
    void update(int i, T v) {
        int x = i + N - 1;
        data[x] = v;
        while (x > 0) {
            x = (x-1)/2;
            data[x] = op(data[2*x+1], data[2*x+2]);
        }
    }
    void add(int a, int b, T v, int i = -1, int l = -1, int r = -1) {
        if (i == -1) { i = 0; l = 0; r = N; }
        if (r <= a || b <= l) return;
        if (a <= l && r <= b) { delay[i] += v; force(i, l, r); return; }
        add(a, b, v, 2*i+1, l, (l+r)/2); force(2*i+1, l, (l+r)/2);
        add(a, b, v, 2*i+2, (l+r)/2, r); force(2*i+2, (l+r)/2, r);
        data[i] = op(data[2*i+1], data[2*i+2]);
    }
    void dump() {
        cerr << "data "; for (int i = 0; i < 2*N-1; i++) cerr << ' ' << data[i]; cerr << endl;
        cerr << "delay "; for (int i = 0; i < 2*N-1; i++) cerr << ' ' << delay[i]; cerr << endl;
    }
};

int main() {
    int n, m; cin >> n >> m;
    map<int, long long> intervals[200100];
    for (int i = 0; i < m; i++) {
        int l, r, a; cin >> l >> r >> a;
        intervals[r][l] += a;
    }
    SegTree st(n+1);
    for (int r = 1; r <= n; r++) {
        const long long prev_max = st.query(0, r);
        long long sum = 0;
        int previdx = 1;
        for (auto &x : intervals[r]) {
            st.add(previdx, x.first, sum);
            previdx = x.first;
            sum += x.second;
        }
        st.add(previdx, r, sum);
        st.update(r, sum + prev_max);
    }
    cout << st.query(0, n+1) << endl;
}


Measured memory_bytes: 29440
#include <bits/stdc++.h>
 
using namespace std;
 
#define int long long
#define ll long long
#define vi vector <int>
#define vvi vector <vector<int> >
#define vii vector <pair<int,int> >
#define rep(i,a,b) for (int i=a;i<b;i++)
#define repD(i,a,b) for (int i=a;i>=b;i--)
#define init(i,k) memset(i,k,sizeof i)
#define pb push_back
#define pii pair <int,int>
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define MOD 998244353
#define PI 3.14159265359
inline ll add(ll a, ll b){ return ((a%MOD)+(b%MOD))%MOD;}
inline ll mul(ll a, ll b){ return ((a%MOD)*(b%MOD))%MOD;}
inline ll sub(ll a, ll b){ return ((a%MOD)-(b%MOD)+MOD)%MOD;}
// const int N = 1e5+7;
 
#define deb(x) {x}
#ifndef local
	#define deb(x) ;
#endif
///---------------------------------------------------------------

void solve()
{
	long double r;cin>>r;
	long double t = 3.14159265359;
	t*=(2*r);
	cout<<setprecision(10)<<t<<endl;
}

signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	
	#ifdef local
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	clock_t qwertyuiop = clock();
	#endif
 
	int t=1;
	// cin>>t;
	rep(a,0,t)
	{
		// cout<<"Case #"<<a+1<<": ";
		solve();
	}

	// solve();
	
	#ifdef local
	{qwertyuiop = clock() - qwertyuiop;
	double time_taken = ((double)qwertyuiop)/CLOCKS_PER_SEC;
	cerr<<fixed<<setprecision(5)<<"\n\nTime Taken : "
	<<time_taken<<" seconds\n";}
	#endif
}

Measured memory_bytes: 3796
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;

int main(void) {
  ll N, A, B;
  cin >> N >> A >> B;
  ll res = 0;
  res += N / (A+B) * A;
  ll r = N % (A+B);
  res += min(A, r);
  cout << res << endl;
  return 0;
}


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

int main() {
    int n; cin >> n;
    vector<pair<int,int>> rb;
    rep(i,n){
        int x, l; cin >> x >> l;
        rb.push_back(make_pair(x+l,x-l));
    }
    sort(rb.begin(),rb.end());
    int ans = 1;
    int r = rb[0].first;
    for(int i = 1; i < n; i++){
        int &li = rb[i].second;
        int &ri = rb[i].first;
        if(li >= r){
            r = ri;
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1400
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cctype>

#define int long long

const int mod = 1e9 + 7;

inline void read(int & x)
{
	x = 0;
	int k = 1;
	char c = getchar();
	while (!isdigit(c))
		if (c == '-') c = getchar(), k = -1;
		else c = getchar();
	while (isdigit(c))
		x = (x << 1) + (x << 3) + (c ^ 48),
		c = getchar();
	x *= k;
}

inline int min(int a, int b) { return a > b ? b : a; }

int n, ans = 0, O = 2001;
int a[201010], b[201010];
int d[4050][4050];
int dp[4050][4050];
int fac[40005];
int inv[40005];

inline int ksm(int a, int b)
{
	int ans = 1;
	while (b)
	{
		if (b & 1) ans = (ans * a) % mod;
		b >>= 1, a = (a * a) % mod;
	}
	return ans;
}

void DP_it(void)
{
	for (int i = 1; i <= 4030; ++i)
		for (int j = 1; j <= 4030; ++j)
			dp[i][j] = (dp[i - 1][j] + dp[i][j - 1] + d[i][j]) % mod;
}

inline int C(int a, int b) { return ((fac[a] * inv[b]) % mod * inv[a - b]) % mod; }

signed main()
{
	fac[0] = 1; inv[0] = 1;
	for (int i = 1; i <= 40000; ++i) fac[i] = (1LL * fac[i - 1] * i) % mod;
	inv[40000] = ksm(fac[40000], mod - 2);
	for (int i = 39999; i >= 1; --i) inv[i] = (inv[i + 1] * (i + 1)) % mod; 
	read(n);
	for (int i = 1; i <= n; ++i) read(a[i]), read(b[i]), ++d[O - a[i]][O - b[i]];
	DP_it();
	for (int i = 1; i <= n; ++i)
		ans =((ans + dp[O + a[i]][O + b[i]] - C((a[i] + b[i]) << 1, a[i] + a[i])) % mod + mod) % mod;
	std::cout << (ans * ksm(2, mod - 2)) % mod; 
}

Measured memory_bytes: 196736
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
using namespace std;

int main(){
int t,h,s,sec,sec3;

while(1){
    cin>>t>>h>>s;
    if(t==-1&&h==-1&&s==-1){
        break;
    }
    sec = 7200 - (3600*t+60*h+s);
    sec3=3*sec;

    printf("%02d:%02d:%02d\n",sec/3600,(sec%3600)/60,(sec%3600)%60);
    printf("%02d:%02d:%02d\n",sec3/3600,(sec3%3600)/60,(sec3%3600)%60);
}
    return 0;
}


Measured memory_bytes: 3048
#include <iostream>
#include <string>
using namespace std;
int main(){

  int n,sa=0,sb=0;
  string ca,cb;

  cin >>n;

  for( int i=0; i < n ; i++ ){
    
    cin >>ca>>cb;

    if( ca > cb ){
      sa+=3;
    }else if( ca < cb ){
      sb+=3;
    }else if( ca == cb ){
      sa++;
      sb++;
    }
  
  }

  cout<<sa<<" "<<sb<<endl;

  return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <string>

using namespace std;

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

    int n;
    cin >> n;

    int ca = 0, cw = 0, ct = 0, cr = 0;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;

        if (s == "AC") {
            ca++;
        } else if (s == "WA") {
            cw++;
        } else if (s == "TLE") {
            ct++;
        } else {
            cr++;
        }
    }

    cout << "AC x " << ca << endl;
    cout << "WA x " << cw << endl;
    cout << "TLE x " << ct << endl;
    cout << "RE x " << cr << endl;

    return 0;
}


Measured memory_bytes: 3652