akhauriyash/Code-Regression huggingface dataset:
a = list(map(int, input().split(' ')))

if a[0] == 0:
    if a[1] == 100:
        print(101)
    else:
        print(a[1])
elif a[0] == 1:
    if a[1] == 100:
        print(10100)
    else:
        print(a[1]*100)
elif a[0] == 2:
    if a[1] == 100:
        print(1010000)
    else:
        print(a[1]*10000)


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

int main() {
  int n;
  cin >> n;
  map<int, int> m;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    m[a] += 3;
  }
  vector<int> h;
  for (auto x : m) {
    if (x.second % n) {
      puts("No");
      return 0;
    }
    for (int i = 0; i < x.second / n; i++) {
      h.push_back(x.first);
    }
  }
  if (h.at(0) ^ h.at(1) ^ h.at(2)) {
    puts("No");
  } else {
    puts("Yes");
  }
}


Measured memory_bytes: 3840
import java.util.Scanner;

public class Main{
    static long dp[][] = new long[100005][3]; /// dp[dia][actividad]   para el dia d, actvidad j max abajo
    static int n;
    static int[][] matrix;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        matrix = new int[n][3];

        for(int i=0;i<n;i++) {
            for(int j=0;j<3;j++) {
                int curr = in.nextInt();
                matrix[i][j]=curr;
            }

        }
        solve(0,0); solve(0,1); solve(0,2);
        long max = Long.max(Long.max(dp[0][0],dp[0][1]), dp[0][2]);
        System.out.println(max);

    }

    public static long solve(int dia, int actividad) {
        // caso base
        if(dia == n-1) {dp[dia][actividad]=matrix[dia][actividad]; return matrix[dia][actividad];}
        if(dp[dia][actividad]!=0) return dp[dia][actividad];

        long a=0;long b=0; long c=0;
        if(actividad!=0)a = solve(dia+1,0) + matrix[dia][actividad]; 
        if(actividad!=1)b = solve(dia+1,1)+ matrix[dia][actividad];
        if(actividad!=2)c = solve(dia+1,2)+ matrix[dia][actividad]; 

        long max = Long.max(Long.max(a,b), c);
        dp[dia][actividad]=max;
        return max;
    }

}

Measured memory_bytes: 61432
n=gets.to_i
s=gets.split('').map(&:to_i)

answerarray=Array.new(1000,false)
dparray=Array.new(n).map{Array.new(121,false)}
dparray[0][s[0]+1]=true


(n-1).times{|i|
    number=s[i+1]
    dparray[i+1][number+1]=true
    dparray[i].map.with_index{|value,index|
        if value
            dparray[i+1][index]=true
        end
        
        if value && index<=10
           dparray[i+1][index*11+number+2]=true
        elsif value
            index-=1
            syou=index/11
            amari=index%11
            hyaku=(syou-1)*100
            zyuu=(amari-1)*10
            if amari==0
                zyuu=9
            end
            answerarray[hyaku+zyuu+number-1]=true
        end
    }
}

puts answerarray.count(true)

Measured memory_bytes: 53784
#include <iostream>
#include <string>
#include <cctype>
using namespace std;

int cur;
string s;

int digit();
int number();
int factor();
int term();
int expression();

int digit() {
	return ( s[cur++] - '0' );
}

int number() {
	int n = digit();
	while ( isdigit( s[cur] ) )
		n = n * 10 + digit();
	return n;
}

int factor() {
	int n;
	if ( s[cur] == '(' ) {
		cur++;
		n = expression();
		cur++;
	} else
		n = number();
	return n;
}

int term() {
	int n = factor();
	while ( s[cur] == '*' || s[cur] == '/' ) {
		cur++;
		if ( s[cur - 1] == '*' )
			n *= factor();
		else
			n /= factor();
	}
	return n;
}

int expression() {
	int n = term();
	while ( s[cur] == '+' || s[cur] == '-' ) {
		cur++;
		if ( s[cur - 1] == '+' )
			n += term();
		else
			n -= term();
	}
	return n;
}

int main() {
	int n;
	cin >> n;
	for ( int i = 0; i < n; i++ ) {
		cur = 0;
		cin >> s;
		int m = expression();
		cout << m << endl;
	}
}

Measured memory_bytes: 1204
#include<bits/stdc++.h>
typedef long long LL;
typedef double dl;
#define opt operator
#define pb push_back
const LL maxn=1e6+9,mod=998244353,inf=0x3f3f3f3f;
LL Read(){
	LL x(0),f(1); char c=getchar();
	while(c<'0' || c>'9'){
		if(c=='-') f=-1; c=getchar();
	}
	while(c>='0' && c<='9'){
		x=(x<<3ll)+(x<<1ll)+c-'0'; c=getchar();
	}return x*f;
}
void Chkmin(LL &x,LL y){
	if(y<x) x=y;
}
void Chkmax(LL &x,LL y){
	if(y>x) x=y;
}
LL add(LL x,LL y){
	return x+=y,x>=mod?x-mod:x;
}
LL dec(LL x,LL y){
	return x-=y,x<0?x+mod:x;
}
LL mul(LL x,LL y){
	return 1ll*x*y%mod;
}
LL n;
LL f[maxn];
char s[maxn];
int main(){
    scanf(" %s",s+1);
    n=strlen(s+1);
    for(LL i=n-2;i>=0;--i){
    	if(s[i+1]=='B' && s[i+2]=='C') f[i]=f[i+2]+1;
    	if(s[i+1]=='A') f[i]=f[i+1];
	}
	LL ret(0);
	for(LL i=0;i<=n-2;++i) if(s[i]=='A') ret+=f[i];
	printf("%lld\n",ret);
	return 0;
}



Measured memory_bytes: 5544
str1 = input()
str2 = input()

A = str1.split(" ")
B = str2

res = 0
#print(A[1])
if A[1] == "0":
    res = A[0]
else:
#    print("A[1]!=0")
    B = B.split(" ")
    intB = []
    for i in B:
        intB.append(int(i))
    intB.sort(reverse=True)

    X = int(A[0])
    N = int(A[1])

    res = 0
    diff = 999999

    # 1~100の配列を作る
    l = list(range(-101, 102))

    # 入力内容を削る
    for i in range(0, N):
        l.pop(intB[i]+101)

 #   print(l)
    for i in l:
        if 0 == abs(X - int(i)):
            diff = 0
            res = i
            break
        elif diff > abs(X - int(i)):
            diff = abs(X - int(i))
            res = i
#            print(diff, res)


print(res)

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

count = 0
for i in range(N):
    d1, d2 = [int(d) for d in input().split()]
    if d1 == d2:
        count += 1
    else:
        count = 0
    
    if count == 3:
        print("Yes")
        exit()

print("No")


Measured memory_bytes: 9108
#include <bits/stdc++.h>
#define inf (long long)1e9
using namespace std;

template <class T>
struct SegmentTree {
  // 1-indexed
  typedef function<T(T, T)> F;
  int n;
  F f;
  T unit;
  vector<T> dat;
  SegmentTree(){};
  SegmentTree(int newn, F f, T t) : f(f), unit(t) {
    init(newn);
  }
  void init(int newn) {
    n = 1;
    while(n < newn) n <<= 1;
    dat.assign(n << 1, unit);
  }

  // "go up" process
  void update(int k, T newdata) {
    dat[k += n] = newdata;
    while(k >>= 1) {
      dat[k] = f(dat[(k << 1) | 0], dat[(k << 1) | 1]);
    }
  }
  // [a,b)
  T query(int a, int b) {
    T vl = unit, vr = unit;
    for(int l = a + n, r = b + n; l < r; l >>= 1, r >>= 1) {
      if(l & 1) vl = f(vl, dat[l++]);
      if(r & 1) vr = f(dat[--r], vr);
    }
    return f(vl, vr);
  }
};

long long n, l;
vector<long long> a;

long long solve();

int main() {
  cin >> n >> l;
  a.resize(n);
  for(int i = 0; i < n; ++i) cin >> a[i];
  solve();
  return 0;
}

long long solve() {
  auto f = [](long long l, long long r) {
    return min(l, r);
  };
  SegmentTree<long long> rmq(n, f, (long long)1e9);
  for(int i = 0; i < n; ++i) rmq.update(i, a[i]);
  for(int i = 0; i + l <= n; ++i) {
    if(i != 0) cout << " ";
    cout << rmq.query(i, i + l);
  }
  cout << endl;
  return 0;
}


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

#define REP(i,n) for(int i=0; i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
using namespace std;

int main() {
	int n, k=1;
	cin >> n;
	while (true) {
		if (k * 2 <= n) {
			k *= 2;
		}
		else {
			cout << k << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll x[100100],ans=1ll;

int main(void){
	int i,n;
	ll cnt=1ll;
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> x[i];
	}
	if(x[0]>1ll){
		x[0] = 1ll;
	}
	for(i=1; i<n; ++i){
		++cnt;
		if(x[i]-x[i-1]==1ll){
			mul_mod(ans,cnt);
			--x[i];
			--cnt;
		}
		x[i] = min(x[i],x[i-1]+2);
	}
	while(cnt){
		mul_mod(ans,cnt);
		--cnt;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
'use strict'

function main(input) {
    const args = input.split('\n');
    const A = parseInt(args[0], 10),
          B = parseInt(args[1], 10),
          C = parseInt(args[2], 10),
          X = parseInt(args[3], 10);

    let count = 0;

    for (let a = 0; a <= A; ++a) {
        for (let b = 0; b <= B; ++b) {
            for (let c = 0; c <= C; ++c) {
                if ((a * 500) + (b * 100) + (c * 50) === X) count++;
            }
        }
    }
    console.log(count);
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

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


S1 = 0
S2 = sum(W)
d = 100 * 100 + 1

for i in range(N):
    S1 += W[i]
    S2 -= W[i]

    c_d = abs(S1 - S2)
    if c_d < d: d = c_d

print(d)


Measured memory_bytes: 3060
n=int(input())
s=input()

leftw=0
rightr=0

for i in range(n):
    if s[i]=='R':
        rightr+=1

ans=rightr

for i in range(n):
    if s[i]=='W':
        leftw+=1
    else:
        rightr-=1
    ans=min(ans,max(leftw,rightr))

print(ans)

Measured memory_bytes: 70372
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define vector1d(type,name,...) vector<type>name(__VA_ARGS__)
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }
ll updivide(ll a,ll b){if(b==1) return a;else if(a%b==0) return a/b;else return (a/b)+1;}

int main(){
    INT(n);
    vector<ll> vec(n);
    ll sum=0;
    rep(i,n){
        in(vec[i]);
        sum+=vec[i];
    }
    ll ans=0;
    rep(i,n){
        sum-=vec[i];
        ans+=(vec[i]*(sum%MOD))%MOD;
        ans%=MOD;
    }
    out(ans);
}

Measured memory_bytes: 4776
import java.util.Scanner;

public class Main {
	
	static int linearsSearch(int[] a, int[] b) {
		int counter = 0;
		for(int i=0; i<b.length; i++)
		{			
			for(int j=0; j<a.length; j++)
			{
				if(b[i]==a[j])
				{
					counter++;
					break;
				}					
			}			
		}
		return counter;
	}
	
    public static void main(String argv[]) {

        Scanner in = new Scanner(System.in);
        int num1 = in.nextInt();
//        System.out.println(num1);

        int intArray1[];    //declaring array
        intArray1 = new int[num1];  // allocating memory to array
        
     // accessing the numbers in the second line
        for (int i = 0; i < intArray1.length; i++){
        	intArray1[i] = in.nextInt();
//        	System.out.println(intArray1[i]);
        }
        
        int num2 = in.nextInt();
//        System.out.println(num2);

        int intArray2[];    //declaring array
        intArray2 = new int[num2];  // allocating memory to array
        
     // accessing the numbers in the second line
        for (int i = 0; i < intArray2.length; i++){
        	intArray2[i] = in.nextInt();
//        	System.out.println(intArray2[i]);
        }        
        int res = linearsSearch(intArray1, intArray2);
        System.out.println(res);
        in.close();
    }
}



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

class DisjointSetUnion {
  int size;
  vector<int> V;
  public:
  DisjointSetUnion(int s): size(s), V(s, -1) {
    for (int i = 0; i < s; i++) V[i] = i;
  }
  void connect(int u, int v) {
    V[find(u)] = find(v);
  }
  int find(int node) {
    int cur_node = node, p = V[node];
    while (cur_node != p) {
      V[cur_node] = V[p];
      cur_node = p;
      p = V[p];
    }
    return cur_node;
  }
  int same(int u, int v) {
    return (find(u) == find(v));
  }
};

int R[100010];

int main() {
  int N, M; cin >> N >> M;
  DisjointSetUnion D(M);
  for (int i = 0; i < N; i++) {
    int k, v; cin >> k;
    cin >> R[i]; R[i]--;
    for (int j = 1; j < k; j++) {
      cin >> v; v--;
      D.connect(R[i], v);
    }
  }
  int r = D.find(R[0]);
  for (int i = 1; i < N; i++) if (r != D.find(R[i])) { cout << "NO" << endl; return 0; }
  cout << "YES" << endl;
}

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

int main(){
    ll h,w,m2;
    cin >> h >> w >> m2;
    vector <vector <ll>> m;
    vector <vector <ll>> hh(h,vector<ll> (2,0));
    vector <vector <ll>> ww(w,vector<ll> (2,0));
    vector <ll> hh2;
    vector <ll> ww2;

    rep(i,h){
        hh[i][1]=i;
    }
    rep(i,w){
        ww[i][1]=i;
    }
    
    ll x,y;
    rep(i,m2){
        cin >> x >> y;
        --x;
        --y;
        ++hh[x][0];
        ++ww[y][0];
        //++m[x][y];
        m.push_back({x,y});
    }

    sort(hh.rbegin(),hh.rend());
    sort(ww.rbegin(),ww.rend());
    sort(m.rbegin(),m.rend());
    sort(hh2.rbegin(),hh2.rend());
    sort(ww2.rbegin(),ww2.rend());


    /*rep(i,h){
        cout << hh[i][0] << hh[i][1] <<  endl;
    }*/

    ll ans=0;

    /*rep(i,h){
        rep(j,w){
            //cout << i << " " << j << " " << hh[i][0] << " " << ww[j][0] << " " << m[hh[i][1]][ww[j][1]] << endl;
            
            //cout << i << " " << j << " " << hh[i][0]+ww[j][0]-m[hh[i][1]][ww[j][1]] << endl;
            ans=max(ans,hh[i][0]+ww[j][0]-m[hh[i][1]][ww[j][1]]);
            if(ans>(hh[i][0]+ww[j][0]-m[hh[i][1]][ww[j][1]]+1)){
                break;
            }
        }
    }*/

    ll hma,wma;
    hma=hh[0][0];
    wma=ww[0][0];

    rep(i,h){
        if(hh[i][0]==hma){
            hh2.push_back(hh[i][1]);
        }
        else{
            break;
        }
    }
    rep(i,w){
        if(ww[i][0]==wma){
            ww2.push_back(ww[i][1]);
        }
        else{
            break;
        }
    }

    ll hl,wl;
    hl=hh2.size();
    wl=ww2.size();

    int rr=1;
    ans=hma+wma;
    int k=0;

    rep(i,hl){
        rep(j,wl){
            while(1){
                if(m[k][0]==hh2[i] and m[k][1]==ww2[j]){
                    break;
                }
                else{
                    ++k;
                    if(k==m2){
                        rr=0;
                        break;
                    }
                }
            }
            if(rr==0){
                break;
            }
        }
        if(rr==0){
            break;
        }
    }

    if(rr==1){
        --ans;
    }
    

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 61356
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} 
#define rep(i, l, n) for (int i = l; i < (int)(n); i++)
#define repn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
#define sort(v) sort(v.begin(), v.end())
#define sortr(v) sort(v.rbegin(), v.rend())
void chmin(int &a, int b) {if(a > b) a = b;}
void chmax(int &a, int b) {if(a < b) a = b;}

const int mod = 1000000007;
const int inf = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};


int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(2*b == a + c) cout << "YES";
    else cout << "NO";
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;
 
int main(){
  int n;
  ll d;
  cin >> n >> d;
  int ans=0;
  for(int i=0;i<n;i++){
    ll x,y;
    cin >> x >> y;
    if(x*x+y*y<=d*d) ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
int x[105];
int max(int a,int b){
	return a>b?a:b;
}
int min(int a,int b){
	return a<b?a:b;
}
int main(){
	int n,i,ans=10000000,j,mx=0,t;
	scanf("%d",&n);
	for(i=1;i<=n;i++)scanf("%d",&x[i]),mx=max(mx,x[i]);
	for(j=1;j<=mx;j++){
		t=0;
		for(i=1;i<=n;i++)
			t+=(x[i]-j)*(x[i]-j);
		ans=min(t,ans);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'

const int N = 1e5;

int dp[N+5];
int arr[N+5];

int main(){

	ios_base::sync_with_stdio(0);
	int n; cin >>n;
	for(int i = 1; i<=n; i++) cin >>arr[i];
	
	dp[0] = dp[1] = 0; arr[0] = arr[1];
	for(int i = 2; i<=n; i++){
		dp[i] = min(dp[i-1] + abs(arr[i-1] - arr[i]), dp[i-2] + abs(arr[i-2] - arr[i])); 
	}
	
	cout <<dp[n] <<endl;
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<sstream>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
#define rep(i,n) for(int i=0;(i)<(n);i++)
#define rep1(i,n) for(int i=1;(i)<=(n);i++)
#define mst(a,b) memset(a,b,sizeof(a))
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define dbg(a) cout<<"* "<< #a <<" : "<<a<<endl
#define fr first
#define se second
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ls x<<1
#define rs x<<1|1
#define lowbit(x) x&(-x)
#define ac cout<<ans<<endl
//#define DEBUG 0
using namespace std;
const double pi=acos(-1.0);
const double eps=1e-6;
const ull hashp=1e7+19;
const ll INF=0x3f3f3f3f3f3f3f3fll;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int maxn=3e5+100;
int gcd(int a,int b){
	return b?gcd(b,a%b):a;
}
ll qpow(ll a,ll b){
	ll ret=1;
	while(b){
		if(b&1)ret*=a;
		b>>=1;
		a*=a;
	}
	return ret;
}
ll get(ll x){
	return x*(x+1)/2;
}

void solve()
{
    int a,b;scdd(a,b);
    int now=1,ans=0;
    while(now<b){
    	now+=a-1;
    	ans++;
	}
	ac;
}
int main(){
	//freopen("in.txt","r",stdin);
	//freopen("D://out.txt","w",stdout);
    //IOS;
    solve();
    return 0;
}

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

vector<int> sieve(int n) {
  vector<int> p(n);
  for(int i=2; i<n; i++) p[i]=i;
  for(int i=2; i*i<n; i++) {
    if(p[i]) {
      for(int j=i*i; j<n; j+=i) p[j]=0;
    }
  }
  p.erase(remove(p.begin(),p.end(),0),p.end());
  return p;
}

int main() {
  vector<int> p=sieve(1000000);
  int a[2];
  while(cin >> a[0] >> a[1]&&a[0]) {
    int b[2]={0,0};
    for(int j=0; j<2; j++) {
      int k=1;
      for(int i=p.size()-1; i>=0; i--) {
        if(a[j]%p[i]==0) {
          b[j]+=p[i]*k;
          k=-1;
        }
      }
    }
    if(b[0]>b[1]) cout << 'a' << endl;
    else cout << 'b' << endl;
  }
  return 0;
}

Measured memory_bytes: 6544
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> ipair;
typedef tuple<int, int, int> ituple;

// const ll INF = LLONG_MAX;
// const int MOD = (int)1e9 + 7;
// const double EPS = 1e-10;
#define PI acosl(-1)
#define MAX_N 200000 + 2

void exec(){
  int n;
  int a[MAX_N], b[MAX_N];

  cin >> n;
  for (int i = 0; i < n; i++){
    scanf("%d", &a[i]);
  }

  int start = 0;
  int end = n - 1;
  bool isStart = true;
  int currentIndex = n - 1;

  while (currentIndex >= 0){
    if (isStart){
      b[start] = a[currentIndex];
      // printf("start: b[%d] = %d\n", start, a[currentIndex]);
      start++;
    }
    else{
      b[end] = a[currentIndex];
      // printf("end: b[%d] = %d\n", end, a[currentIndex]);
      end--;
    }

    isStart = !isStart;
    currentIndex -= 1;
  }

  for (int i = 0; i < n; i++){
    printf("%d%c", b[i], i == n-1? '\n' : ' ');
  }

}

void solve(){
  int t = 1;
  // scanf("%d", &t);
  for (int i = 0; i < t; i++){
    exec();
  }
}

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


Measured memory_bytes: 3712
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <complex>

int main(){

  long long int k, q, tmp, tmp1, tmp2, tmp3, D;
  std::vector<long long int> d, n, x, m;

  scanf("%lld%lld", &k, &q);
  D = 0;
  for(long long int i = 0; i < k; i++){
    scanf("%lld", &tmp);
    d.push_back(tmp);
    D += d[i];
  }
  for(long long int i = 0; i < q; i++){
    scanf("%lld%lld%lld", &tmp1, &tmp2, &tmp3);
    n.push_back(tmp1);
    x.push_back(tmp2);
    m.push_back(tmp3);
  }

  std::cerr << "k:" << k << std::endl << "q: " << q << std::endl;

  // solve problem
  std::vector<long long int> d2(k);
  long long int tmp4, tmp5, tmp6, tmp7, tmp8;

  std::cerr << "Answer: " << std::endl;

  for(long long int i = 0; i < q; i++){

    //std::cerr << i << " " << n[i] << " " << x[i] << " " << m[i] << std::endl;
    // x[i] (mod m[i])
    x[i] = (x[i]+m[i])%m[i];
    // make d2
    long long int Dtot=0, D2 = 0;
    for(long long int j = 0; j < k; j++){
      tmp = (d[j]+m[i])%m[i];
      if(tmp == 0)tmp = m[i];
      Dtot += tmp;
    }
    for(long long int j = 0; j < (n[i]-1+k)%k; j++){
      tmp = (d[j]+m[i])%m[i];
      if(tmp == 0)tmp = m[i];
      D2 += tmp;
    }

    //std::cerr << "hoge" << std::endl;
    tmp1 = Dtot/m[i];
    tmp2 = (Dtot+m[i])%m[i];
    tmp3 = ((n[i]-1)/k)/m[i];
    tmp4 = ((n[i]-1)/k + m[i])%m[i];

    tmp5 = m[i]*tmp1*tmp3 + tmp1*tmp4 + tmp2*tmp3;
    tmp5 += (x[i] + tmp2*tmp4 + D2)/m[i];

    std::cout << n[i]-tmp5-1 << std::endl;
  }

  return 0;
  

  
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
const int maxn = 123;
int p[maxn];
int main(){
	int n;
	cin >> n;
	for(int i = 2; i <= n; i++){
		int c = i;
		for(int j = 2; j <= c; j++){
			while(c % j == 0){
				p[j]++;
				c /= j;
			}
		}
	}
	vector<long long> f(maxn);
	f[1] = 1;
	for(int i = 2; i < maxn; i++){
		vector<long long> nf(maxn, 0);
		for(int j = 0; j <= p[i]; j++){
			for(int k = 0; k < maxn; k++){
				int nv = k * (j + 1);
				if(nv < maxn){
					nf[nv] += f[k];
				}
			}
		}
		f = nf;
	}
	cout << f[75] << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<sstream>
using namespace std;
int main()
{
    int a,b;
    cin >> a >> b;
    if(a == b){
        cout << "Draw";
        return 0;
    }
    if(a > b && b!=1){
        cout << "Alice";
        return 0;
    }else if(b > a && a !=1){
        cout << "Bob";
        return 0;
    }else if(a ==1){
        cout << "Alice";
        return 0;
    }
    cout << "Bob";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define All(a) a.begin(),a.end()
#define INF 1000000007
const int MOD = 1000000007;
//accumulate(vec.begin(), vec.end(), 0)
//std::sort(v.begin(), v.end(), std::greater<Type>());
//set_intersection(x, x+7, y, y+6, back_inserter(v));
//set_union(x, x+7, y, y+6, back_inserter(v));
//set_difference(x, x+7, y, y+6, back_inserter(v));

int gcd(int x,int y){
  if(x%y==0) return y;
  else return gcd(y,x%y);
}

bool isPrime(int n){
  if(n < 2) return false;
  else if(n == 2) return true;
  else if(n%2==0) return false;

  for(int i=3;i<=sqrt(n);i++){
    if(n%i==0) return false;
  }
  return true;
}

int main(){

  long double A,B;
  cin >> A >> B;
  cout<< ll(A*B+0.001) <<endl;
}


Measured memory_bytes: 3792
from collections import namedtuple
import math
Co = namedtuple('Co', 'x y')

def f(i, n, l, r):
    if i >= n:
        print(l.x, l.y)
        return
    il = Co(x=(1/3 * r.x + (1 - 1/3) * l.x), y=(1/3 * r.y + (1 - 1/3) * l.y))
    ir = Co(x=(2/3 * r.x + (1 - 2/3) * l.x), y=(2/3 * r.y + (1 - 2/3) * l.y))

    trix = 1/2 * (ir.x + il.x - math.sqrt(3) * ir.y + math.sqrt(3) * il.y)
    triy = 1/2 * (math.sqrt(3) * ir.x - math.sqrt(3) * il.x + ir.y + il.y)
    trico = Co(trix, triy)

    f(i+1, n, l, il)
    #print(il.x, il.y)
    f(i+1, n, il, trico)
    #print(trico.x, trico.y)
    f(i+1, n, trico, ir)
    #print(ir.x, ir.y)
    f(i+1, n, ir, r)

if __name__ == '__main__':
    n = int(input())
    #print(0, 0)
    f(0, n, Co(0,0), Co(100,0))
    print(100, 0)



Measured memory_bytes: 6176
#include <iostream>
#include <set>

using namespace std;

int main () {
    set<int> s;
    int n;  cin >> n;
    while (n>0) {
        int c;  cin >> c;
        s.insert(c);
        n--;
    }

    set<int>::iterator ite;
    int ans = 0;
    for (ite = s.begin(); ite != s.end(); ite++) {
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
b = list(map(int, input().split()))
r = []
flag = True

for i in range(n-1, -1, -1):
  for j in range(i, -1, -1):
    if b[j] == (j + 1):
      r.append(b[j])
      del b[j]
      break
  else:
    flag = False
    break

if flag:
  r.reverse()
  for i in r:
    print(i)
else:
  print('-1')


Measured memory_bytes: 3064
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

#define chmax(a, b) (a) = max(a, b)
#define chmin(a, b) (a) = min(a, b)

int encode(int x, int y, int R, int C) {
  if (y == 0) {
    return x;
  }
  if (x == R) {
    return R + y;
  }
  if (y == C) {
    return 2 * R + C - x;
  }
  if (x == 0) {
    return 2 * R + 2 * C - y;
  }
  return -1;
}

int main() {
  int R, C;
  int N;
  cin >> R >> C >> N;

  using P = pair<int, int>;
  vector<P> onEdge;
  rep(i, N) {
    int x, y, z, w;
    cin >> x >> y >> z >> w;

    if ((x == 0 || x == R || y == 0 || y == C) &&
        (z == 0 || z == R || w == 0 || w == C)) {
      onEdge.push_back(P(encode(x, y, R, C), i));
      onEdge.push_back(P(encode(z, w, R, C), i));
    }
  }

  sort(onEdge.begin(), onEdge.end());
  stack<int> s;
  s.push(-1);
  for (const P& p : onEdge) {
    int v;
    tie(ignore, v) = p;
    if (s.top() == v) {
      s.pop();
    } else {
      s.push(v);
    }
  }

  cout << (s.size() > 1 ? "NO" : "YES") << endl;

  return 0;
}

Measured memory_bytes: 4900
#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<map>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
bool cmp_P(const P &a,const P &b){
  return a.second < b.second;
}
int main()
{
  int c=0,f=1;
  string s;
  cin >> s;
  if(s[0] != 'A')
    f = 0;
  for(int i=2;i<s.size()-1;i++){
    if(s[i] == 'C')
      c++;
  }
  if(c != 1)
    f = 0;
  for(int i=1;i<s.size();i++){
    if(!(s[i] <= 'z' && s[i] >= 'a'))
      if(s[i] != 'C')
        f = 0;
  }
  if(f)
    cout << "AC" << endl;
  else
    cout << "WA" << endl;
  return 0;
}

int par[MAX_N];
int ranks[MAX_N];

//n要素で初期化
void init(int n){
  REP(i,n){
    par[i] = i;
    ranks[i] = 0;
  }

}

//木の根を求める
int find(int x){
  if(par[x] == x){
    return x;
  }else{
    return par[x] = find(par[x]);
  }
}

void unite(int x,int y){
  x = find(x);
  y = find(y);
  if(x == y) return ;
  if(ranks[x] < ranks[y]){
    par[x] = y;
  }else{
    par[y] = x;
    if(ranks[x] == ranks[y]) ranks[x]++;
  }
}

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



Measured memory_bytes: 256
n = int(input())
s = str(input())
a = 0
if n % 3 == 1 or n % 3 == 0:
  for i in range(n-1):
    if s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C':
      a += 1
elif n % 3 == 2:
  for i in range(n-2):
    if s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C':
      a += 1
print(a)

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

using namespace std;

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

  int n, k, q, a;
  cin >> n >> k >> q;
  vector<int> count(n, 0);
  for (int i = 0; i < q; ++i) {
    cin >> a;
    count[--a]++;
  } 
  for (int i = 0; i < n; ++i) {
    if (q-count[i]<k) cout << "Yes" << endl;
    else cout << "No" << endl;
  }

  return 0;
}



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

int main(void) {
	int h, w, i;
	scanf("%d%d", &h, &w);
	if (!h && !w) {
		return 0;
	}
	char rect[w + 1];
	memset(rect, '#', w);
	rect[w] = 0;
	for (i = 0; i < h; i++) {
		puts(rect);
	}
	puts("");
	return main();
}

Measured memory_bytes: 592
import java.util.Scanner;

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

		// 入力値の取得
		int K = sc.nextInt();
		int X = sc.nextInt();
		
		// 結果の出力
		System.out.println((K * 500) >= X ? "Yes" : "No");
		
		sc.close();
	}
}


Measured memory_bytes: 35604
if __name__ == '__main__':
    c = [[], [], []]
    for i in range(3):
        c[i] = list(map(int, input().split()))
    
    ans = "Yes"
    for i in range(2):
        d0 = c[0][2] - c[0][i]
        d1 = c[1][2] - c[1][i]
        d2 = c[2][2] - c[2][i]
        
        if d0 != d1 or d0 != d2:
            ans = "No"
    
    print(ans)

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

int main(){
  int N,Y;
  cin >> N >>Y;
  bool br = false;
  for(int i=0;i<=N;i++){
    if(i*10000 > Y) break;
    for(int j=0;j<=N-i;j++){
      if(i*10000 + j*5000 > Y) break;
      if(i*10000 + j*5000 + (N-i-j)*1000 == Y){
        cout << i << " " << j << " " << (N-i-j);
        br = true;
        break;
      }
    }
  if(br == true) break;
  }
  if(br == false) cout << -1 << " " << -1 << " " << -1;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<iomanip>
#include<math.h>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
#define LINF (long long)4e18

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    int A,B; cin >> A >> B;
    cout << max(A+B,max(A-B,A*B)) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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; }

const long long INF = 1LL << 60;

int main(){
  string w;
  cin >> w;
  sort(all(w));

  string s1 = "";
  string s2 = "";
  rep(i, w.size()){
    if(i&1) s1 += w[i];
    else s2 += w[i];
  }

  cout << (s1 == s2 ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, os
range = xrange

def main():
    inp = [int(x) for x in os.read(0, os.fstat(0).st_size).split()]
    n, m = inp[0],inp[1]
 
    wi, vi = inp[2], inp[3]
 
 
    dp = [0] * (m + 1)
    for j in range(wi, m + 1):
        dp[j] = vi
 
    for i in range(n - 1):
        wi = inp[2*i + 4]
        vi = inp[2*i + 5]
        for j in range(m, wi-1, -1):
            if dp[j] < vi + dp[j - wi]:
                dp[j] = vi + dp[j - wi]
 
    print(dp[-1])
main()

Measured memory_bytes: 5764
#include<stdio.h>
#define SIZE 100

int main(void)
{
    int i, j, tmp;
    int n, m, A[SIZE][SIZE], b[SIZE];
    
    scanf("%d %d", &n, &m);
    for ( i=0; i<n; ++i)
        for ( j=0; j<m; ++j)
            scanf("%d", &A[i][j]);
    for ( j=0; j<m; ++j)
        scanf("%d", &b[j]);

    for ( i=0; i<n; ++i){
        tmp = 0;
        for ( j=0; j<m; ++j)
            tmp += A[i][j] * b[j];
        printf("%d\n", tmp);
    }
    
    return 0;
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long 
#define FI first 
#define SE second
#define pb push_back 
#define eb emplace_back
#define mod 1000000007
#define all(c) (c).begin(),(c).end()
#define LB  lower_bound
#define UB  upper_bound
#define max3(a,b,c) max(c,max(a,b))
#define min3(a,b,c) min(c,min(a,b))
#define mems(s, n) memset(s, n, sizeof(s))
#define NINF -1e18
#define INF 1e18
#define int ll int
#define double long double
#define OOK order_of_key  //no of elements less than
#define FBO find_by_order //iterator pointing kth element;indexing starts from 0
#define CK3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define CK4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl

typedef pair<int,int> PII;
typedef pair<pair<int,int>,int> PPII;
typedef pair<int,pair<int,int>> PIPI;
typedef map<int,int>MII;
typedef vector<int> VI;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

/*int power(int a, int b)
{int x=1,y=a;while(b>0){if(b%2){x =(x*y)%mod;}y =(y*y)%mod;b/=2;}return x%mod;}
*/


signed main()
{
ios::sync_with_stdio(false); cin.tie(0);
int T=1,T1=0;//cin>>T;
while(T1++<T)
{//cout<<"Case #"<<T1<<": ";
    int n;cin>>n;
    string s;
    cin>>s;
    map<char,int>mr;
    mr['W']=0;mr['R']=1;
    int ans=0,x=0,y=0,x1=0,y1=0;
    for(int i=0;i<n;i++)
    {
        if(s[i]=='R')x++;
        else y++;
    }
    ans=min(x,y);
    for(int i=0;i<n;i++)
    {
        if(s[i]=='R'){x--;x1++;}
        else {y--;y1++;}
        ans=min(ans,max(y1,x));
    }
    cout<<ans<<endl;
}


return 0;
}





Measured memory_bytes: 3724
#include<bits/stdc++.h>
using namespace std;
const int N=20;
int n,m,k[N],s[N][N],ans;
bool p[N],open[N];
bool check()
{
	for(int i=0;i<m;i++)
	{
		int sum=0;
		for(int j=0;j<k[i];j++)
			if(open[s[i][j]-1])
				sum++;
		if(sum%2!=p[i])return false;
	}
	return true;
}
void dfs(int now)
{
	if(now==n)
	{
		if(check())ans++;
		return;
	}
	dfs(now+1);
	open[now]=true;
	dfs(now+1);
	open[now]=false;
}
int main()
{
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		cin>>k[i];
		for(int j=0;j<k[i];j++)
			cin>>s[i][j];
	}
	for(int i=0;i<m;i++)cin>>p[i];
	dfs(0);
	cout<<ans<<endl;
	return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)

typedef long long LL;
typedef long double LD;

int main(){
  string s;
  cin >> s;
  vector<int> a(26,0);
  for(int i=0;i<4;i++){
    a[s[i]-'A']++;
  }
  sort(all(a),greater<int>());
  if(a[0]==2&&a[1]==2){
    CYES;
  }else{
    CNO;
  }
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define repr(i,a,n) for(ll i = n-1;i >= a;i--)
#define LINF (ll)1e17
#define INF (int)1e9
#define MOD (ll)1e9+7
#define sMOD 1e5
#define fs first
#define sc second

ll gcd(ll a,ll b){
	if(!b) return a;
	return gcd(b,a%b);
	
}

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



signed main(){
	ll a,b,c,d;
	cin >> a >> b >> c >> d;
	
	cout << b - a + 1 - ((b/d) - ((a-1)/d)) - ((b/c) - ((a-1)/c)) + ((b/(lcm(c,d))) - ((a-1)/(lcm(c,d))))  << endl;
	
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct node {int key;  struct node *right,*left,*pr;} node;
node *root,*NIL;

node * treemin(node *x){
  while(x->left != NIL) x = x->left;
  return x;
}

node * find(node *u,int k){
  while(u != NIL && k != u->key)//uがNILまたはkeyが見つかったら抜ける。//
  { if(k < u->key) u = u->left;
    else u = u->right;
  }
  return u;
}

node * treesuccessor(node *x){
  node *y = x->pr;
  if(x->right != NIL) return treemin(x->right);
  while(y != NIL && x == y->right){
    x = y;
    y = y->pr;
  }
  return y;
}

void treedelete(node *z){
  node *y; node *x;

  if(z->left == NIL || z->right == NIL) y = z;
  else y = treesuccessor(z);
  if(y->left != NIL) x = y->left;
  else x = y->right;

  if(x != NIL) x->pr = y->pr;
  if(y->pr == NIL) root = x;
  else{
    if(y == y->pr->left) y->pr->left = x;
    else y->pr->right = x;
  }

  if(y != z) z->key = y->key;
  free(y);
}

void insert(int k){
  node *y = NIL,*x = root,*z;
  z = (node *)malloc(sizeof(node));
  z->key = k; z->left = z->right = NIL;
  while(x != NIL){
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->pr = y;
  if(y == NIL) root = z;
  else{
    if(z->key < y->key) y->left = z;
    else y->right = z;
  }
}
//中間順巡回//
void inP(node *u){
  if(u == NIL) return;
  inP(u->left);
  printf(" %d",u->key);
  inP(u->right);
}
//先行準巡回//
void preP(node *u){
  if(u == NIL) return;
  printf(" %d",u->key);
  preP(u->left);
  preP(u->right);
}

int main(){
  int n,i,key;
  node *t;
  char cmd[10];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s",cmd);

    if(cmd[0] == 'f'){
      scanf("%d",&key);
      t = find(root,key);
      if(t != NIL) printf("yes\n");
      else printf("no\n");
    }else if(cmd[0] == 'i'){
      scanf("%d",&key);
      insert(key);
    }else if(cmd[0] == 'p'){
      inP(root);
      printf("\n");
      preP(root);
      printf("\n");
    }else if(cmd[0] == 'd'){
      scanf("%d",&key);
      treedelete(find(root,key));
    }
  }
  return 0;
}



Measured memory_bytes: 20496
function main(argString) {
  var num = 0;
  var split = argString.split('\n');
  var A = Number(split[0]), B = Number(split[1]), C = Number(split[2]), X = Number(split[3]);
  for (var a = 0; a <= A; a++) {
    for (var b = 0; b <= B; b++) {
    	for (var c = 0; c <= C; c++) {
    		if ((500 * a + 100 * b + 50 * c) === X) num++;
  		}
  	}
  }
  console.log(num);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 11468
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
#include<deque>
const double PI = acos(-1);
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;
class mint {
	long long x;
public:
	mint(long long 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 {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint & a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint & a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll 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) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

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



//小文字=大文字+32
int main() {
	ll n, L;
	cin >> n >> L;
	ll ans=0;
	ll m=100000000;
	rep(i, n) {
		ans += L + i;
		if ((int)labs(L + i)< labs(m)) {

			m = L + i;
		}
	}
	cout << ans - m;
}
	



Measured memory_bytes: 3628
#include <iostream>
//#include <iomanip>
//#include <math.h>
//#include<string>
//#include <algorithm>
//#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
if (a == b){
 cout<<"Draw";}
else if (a == 1){
 cout<<"Alice";}
else if (b == 1){
cout<<"Bob";}
else if (a > b){
 cout<<"Alice";}
else{
 cout<<"Bob";}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
    ll n;
    cin >> n;
    map<char, ll> mp;
    rep(i, 0, n) {
        string s;
        cin >> s;
        mp[s[0]]++;
    }
    char c[] = {'M', 'A', 'R', 'C', 'H'};
    ll ans = 0;
    map<pair<ll,ll>, ll> seen;
    int array[]={0,1,2,3,4};
    do{
        ll tmp = 1;
        if(seen[{array[3], array[4]}] > 0) continue;
        if(seen[{array[4], array[3]}] > 0) continue;
        for(int i=0; i<3; i++){
            ll j = array[i];
            tmp *= mp[c[j]];
        }
        //cerr << tmp << endl;
        seen[{array[3], array[4]}]++;
        ans += tmp;
    }while(next_permutation(array,array+5));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
//phoenix




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


#define spdio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pp pop_back
#define mp make_pair
#define fr(i,j,n) for(ll i=j; i<n; i++)
#define rfr(i,j,n) for(ll i=n-1; i>=0; i--)
#define vsort(v) sort(v.begin(),v.end())
#define asort(a) sort(a,a+n);


typedef long double ld;
typedef long long int ll;


//getline(cin,string);
const ll inf = (ll) 1e18 + 19;



/*
ll solveDp(ll i,ll w[],ll v[],ll n,ll wt,map <ll,map <ll,ll> > &dp) {
    if(i>=n || wt<0)
        return 0;
    if(dp[wt][i])
        return dp[wt][i];
    else if(wt<w[i])
        return dp.insert(mp([wt][i]=solveDp(i+1,w,v,n,wt,dp);
    else
        return dp[wt][i]=max(solveDp(i+1,w,v,n,wt,dp),v[i]+solveDp(i+1,w,v,n,wt-w[i],dp));
}
*/


/*
void bfs(ll k,bool vis[],ll n,vector <ll> v[]) {
    queue <ll> q;
    q.push(k);
    while(!q.empty()) {
        ll node=q.front();
        q.pop();
        cout<<node<<" ";
        vis[node-1]=true;
        fr(j,0,v[node-1].size()) {
            if(vis[v[node-1][j]-1]!=true)
                q.push(v[node-1][j]),vis[v[node-1][j]-1]=true;
        }
    }
}




void dfs(ll k,bool vis[],ll n,vector <ll> v[]) {
    cout<<k<<" ";
    vis[k-1]=true;
    fr(i,0,v[k-1].size()) {
        if(!vis[v[k-1][i]-1])
            dfs(v[k-1][i],vis,n,v);
    }
}




ll solveDp(ll i,ll a[],ll n,vector <ll> &dp) {
    if(i>=n)
        return 0;
    if(dp[i]!=-1)
        return dp[i];
    else {
        ll mx=-inf;
        fr(j,0,n) {
            mx=max(mx,a[i]+solveDp(i+j+2,a,n,dp));
        }
        return dp[i]=mx;
    }
}
*/



void cazz() {
    ll n,i,j,k,ans=0,f=0,b=1,wt,m=0,r;
    cin>>r;
    double res;
    res=((double)22/7)*2*r;
    cout<<res<<"\n";
    /*cin>>n>>m;
    vector <ll> v[n];
    fr(i,0,m) {
        cin>>j>>k;
        v[j-1].pb(k);
        v[k-1].pb(j);
    }
    cout<<"\n";
    fr(i,0,n) {
        cout<<i+1<<"\t";
        fr(j,0,v[i].size()) {
            cout<<v[i][j]<<" ";
        }cout<<"\n";
    }
    cout<<"\n";
    cin>>k;
    bool vis[n]={};
    bfs(k,vis,n,v);
    cout<<"\n";
    bool vi[n]={};
    dfs(k,vi,n,v);*/
}




int main() {
    spdio;
	cazz();
	return 0;
}


Measured memory_bytes: 3800
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int N,i;
  cin >> N >> i;
  cout << N-i+1 << endl;
  return 0;
}

Measured memory_bytes: 3584
// Author : Chi
// created :
// Sawal : Practice

//header files
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

//namespaces
using    namespace __gnu_pbds;
using    namespace std;
typedef tree <pair<int,int>, null_type, greater<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update > ordered_set;

//macros
#define ll 		    long long
#define pii         pair<ll,ll>
#define ss          second
#define ff          first
#define vi          vector<int>
#define vll         vector<long long>
#define pb(x)       push_back(x)
#define TEST  	    int TesT;cin>>TesT;while(TesT--)solve();
#define ai(a)       for(auto &i:a)cin>>i;
#define ao(a)       for(auto i:a)cout<<i<<' ';
#define TEST1       solve();
#define mod         1000000007
#define aLL(x)      x.begin(),x.end()
#define r0n(i,n)    for(ll i = 0; i < n; ++i)
#define r1n(i,n)    for(ll i = 1; i <= n; ++i)
#define pdp(d,i)    fixed<<setprecision(i)<<d
#define CHI         ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define db(...)     __f(#__VA_ARGS__, __VA_ARGS__)                      //for debugging
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
//LOVE ALGO
//Make sure you have test cases (:->)
void solve(){
    int t;
    cin >>t;
    int ct=0;
    bool f=0;
    while(t--){
        int a,b;
        cin>>a>>b;
        if(a==b)
            ct++;
        else
            ct=0;
        if(ct>=3)
            f=1;
    }
    if(f)cout<<"Yes\n";
    else
        cout<<"No\n";
}
int main(){
    CHI
    TEST1
    return 0;
}


Measured memory_bytes: 3616
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int H = scn.nextInt(), W = scn.nextInt(), A = scn.nextInt(), B = scn.nextInt();
		int[][] ans = new int[H][W];
		for(int h = 0;h < H;h++) {
			for(int w = 0;w < W;w++) {
				if(h < B) {
				System.out.print((w < A)?0:1);
				}else {
					System.out.print((w < A)?1:0);
				}
			}
			System.out.println();
		}
	}

}

Measured memory_bytes: 47404