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

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

int main() {
    int Map[500][500];
    int X[210], Y[210];
    while (true) {
        int N;
        cin >> N;
        if (N == 0) break;
        for (int i = 0; i < 500; ++i) {
            for (int j = 0; j < 500; ++j) {
                Map[i][j] = -1;
            }
        }
        for (int i = 0; i < 210; ++i) {
            X[i] = Y[i] = -1;
        }
        int offset = 500 / 2;
        Map[0 + offset][0 + offset] = 0;
        X[0] = Y[0] = offset;
        for (int i = 1; i < N; ++i) {
            int n, d;
            cin >> n >> d;
            int nx = X[n] + dx[d];
            int ny = Y[n] + dy[d];
            Map[nx][ny] = i;
            X[i] = nx;
            Y[i] = ny;
        }

        int lx = offset, rx = offset, ly = offset, ry = offset;
        for (int i = 0; i < 500; ++i) {
            for (int j = 0; j < 500; ++j) {
                if (Map[i][j] != -1) {
                    lx = min(lx, i);
                    rx = max(rx, i);
                    ly = min(ly, j);
                    ry = max(ry, j);
                }
            }
        }
        // cout << "-----" << endl;
        // for (int i = offset - 10; i < offset + 10; ++i) {
        //     for (int j = offset - 10; j < offset + 10; ++j) {
        //         cout << Map[i][j] << " ";
        //     }
        //     cout << endl;
        // }

        // cout << "-----" << endl;
        cout << ry - ly + 1 << " " << rx - lx + 1 << endl;
    }
    return 0;
}


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

int main(int argc, const char * argv[]) {
    string str;
    int m;
    int h;
    int i, cnt;
    
    while(1){
        h=0;
        cnt=0;
        cin >> str;
        if(str=="-"){
            break;
        }else{
            cin >> m;
            for(i=0;i<m;i++){
                cin >> h;
                str=str.substr(h)+str.substr(0,h);
            }
            cout << str << endl;
        }
    }
    
    return 0;
}



Measured memory_bytes: 3180
//This is getting accepted!
// I HATE BUG
// God Of The Bugs
// 12/11/2016
#include<bits/stdc++.h>

using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FI first
#define SE second
#define pb push_back
#define mp make_pair
#define ll long long
#define sz(a) ((int)(a).size())
#define __builtin_popcount __builtin_popcounll
#define ld long double

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<int, pii> ppi;

const double PI = acos(0) * 2;
const double EPS = 1e-8;
const ll MOD = 1e9 + 7;
const int MAXN = 1e5 + 5;
const int oo = 1e9;
const double foo = 1e30;

template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return __builtin_popcounll(s);}
template<class T> T sqr(T x) { return x * x; }

inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}

int n, ma, mb, a[50], b[50], c[50], dp[500][500], tmp[500][500];

int main() {
//#ifndef ONLINE_JUDGE
//    freopen("inp.txt", "r", stdin);
////    freopen("out.txt", "w", stdout);
//#endif

	cin >> n >> ma >> mb;
	for (int i=0; i<n; i++) {
		cin >> a[i] >> b[i] >> c[i];
	}
	
	for (int i=0; i<401; i++) {
		for (int j=0; j<401; j++) dp[i][j] = oo;
	}
	
	dp[0][0] = 0;
	
	for (int k=0; k<n; k++) {
		for (int i=0; i<401; i++) {
			for (int j=0; j<401; j++) {
				tmp[i][j] = oo;
			}
		}
		for (int i=0; i<401; i++) {
			for (int j=0; j<401; j++) {
				int na = i + a[k];
				int nb = j + b[k];
				tmp[na][nb] = min(tmp[na][nb], dp[i][j] + c[k]);
			}
		}
		for (int i=0; i<401; i++) {
			for (int j=0; j<401; j++) {
				dp[i][j] = min(dp[i][j], tmp[i][j]);
			}
		}
	}
	
	int ans = oo;
	for (int i=1; i<401; i++) {
		for (int j=1; j<401; j++) {
			int tt = __gcd(i, j);
			int ga = i / tt;
			int gb = j / tt;
			if (ga == ma && gb == mb) {
				ans = min(ans, dp[i][j]);
			}
		}
	}
	
	if (ans == oo) {
		cout << -1;
	}
	else cout << ans;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

// 最大公約数
int gcd(int m, int n) {
  if (n==0) return abs(m);
  else return gcd(n, m%n);
}

int main() {
  int K;
  cin >> K;
  ll ans = 0LL;
  for (int a=1; a<=K; a++) {
    for (int b=1; b<=K; b++) {
      for (int c=1; c<=K; c++) ans += gcd(a, gcd(b, c));
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<queue>
#include<stack>
#include<iomanip>
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
 
using namespace std;
using ll = long long int;
 
int main(void) {
    int n, k = 2; cin >> n;
    vector<int> h(n), dp(n + 100, 1000000000);
    REP(i, n) cin >> h[i];
    dp[0] = 0;
    REP(i, n) {
        REP(j, k) {
            dp[i + j + 1] = min(dp[i + j + 1], dp[i] + abs(h[i] - h[i + j + 1]));
        }
    }
    cout << dp[n - 1] << endl;
}

Measured memory_bytes: 1024
#include<stdio.h>

int main(void){

    long long int N,K,ans;

    scanf("%lld %lld",&N,&K);

    if((N % K) < (K-(N % K))){
        ans = N % K;
    }else{
        ans = K - (N % K);
    }

    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 128
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void readV(T...)(ref T t){auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(typeof(v));r.popFront;}}
void readA(T)(size_t n,ref T t){t=new T(n);auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(ElementType!T);r.popFront;}}
void readM(T...)(size_t n,ref T t){foreach(ref v;t)v=new typeof(v)(n);foreach(i;0..n){auto r=readln.splitter;foreach(ref v;t){v[i]=r.front.to!(ElementType!(typeof(v)));r.popFront;}}}
void readS(T)(size_t n,ref T t){t=new T(n);foreach(ref v;t){auto r=readln.splitter;foreach(ref j;v.tupleof){j=r.front.to!(typeof(j));r.popFront;}}}

void main()
{
  int a, b, c; readV(a, b, c);

  auto dp = new int[][][](60, 60, 60), inf = 10^^9;

  int calc(int a, int b, int c)
  {
    if (a >= 60 || b >= 60 || c >= 60) return inf;
    if (a == b && b == c) return 0;
    if (dp[a][b][c]) return dp[a][b][c];

    return dp[a][b][c] = min(calc(a+1, b+1, c),
                             calc(a+1, b, c+1),
                             calc(a, b+1, c+1),
                             calc(a+2, b, c),
                             calc(a, b+2, c),
                             calc(a, b, c+2)) + 1;
  }

  writeln(calc(a, b, c));
}


Measured memory_bytes: 1276
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define double long double
#define low lower_bound
#define upp upper_bound
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define Rep(i,n) for (int i = (int)(n); i >= 0; i--)
#define all(vec) vec.begin(),vec.end()
#define rever(vec) reverse(all(vec));
#define cend cout << endl;
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define prique2(T) priority_queue<T>
struct edge { int to, cost; };
using P = pair<int, int>;
using PP = pair<P, int>;
const int mod2 = 998244353;
const int mod = 1e9 + 7, inf = 1e16;

int modpow(int x, int n) {
	int ans = 1;
	while (n > 0) {
		if (n & 1) {
			ans *= x;
			if (mod <= ans) ans %= mod;
		}
		x *= x;
		if (mod <= x) x %= mod;
		n >>= 1;
	}
	return ans;
}

int fact_memo[114514];
int fact(int n) {
	int ans = 1;
	if (fact_memo[n]) return fact_memo[n];
	rep(i, n) {
		ans *= (i + 1);
		if (mod <= ans) ans %= mod;
		fact_memo[i + 1] = ans;
	}
	return (ans + mod) % mod;
}

int comb(int n, int r) {
	if (n < r) return 0;
	if (n - r < r) r = n - r;
	return (fact(n) * modpow(fact(n - r), mod - 2) % mod * modpow(fact(r), mod - 2) + mod) % mod;
}

int perm(int n, int r) {
	if (n < r) return 0;
	if (n - r < r) r = n - r;
	return (fact(n) * modpow(fact(n - r), mod - 2) % mod + mod) % mod;
}

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

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

bool pri(int p) {
	for (int i = 2; i * i <= p; i++) if (p % i == 0) return false;
	return p > 1;
}

map<int, int>factring(int n) {
	map<int, int>ans;
	for (int i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			n /= i;
			ans[i]++;
		}
	}
	if (n != 1) ans[n]++;
	return ans;
}

P operator+(const P& a, const P& b) {
	return P(a.first + b.first, a.second + b.second);
}
P operator-(const P& a, const P& b) {
	return P(a.first - b.first, a.second - b.second);
}

int n;
prique(double) que;
signed main() {
	cin >> n;
	rep(i, n) {
		double a;
		cin >> a;
		que.push(a);
	}
	while (que.size() != 1) {
		double a = que.top(); que.pop();
		double b = que.top(); que.pop();
		que.push((a + b) / 2.0);
	}
	printf("%.10Lf\n", que.top());
}


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

#define all(c) (c).begin(),(c).end()
#define FOR(i, x, n) for(int i = x; i < (int)n; i++)
#define REP(i, n) FOR(i, 0, n)
#define debug(x) #x << "=" << (x) << "(L" << __LINE__ << ")"
#define show(x) cout << #x << "=" << x << endl
#define show2(x,y) cout << #x << "=" << x << "," << #y << "=" << y <<  endl
#define show3(x,y,z) cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z <<  endl
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;

const ld eps = 1e-9, pi = acos(-1.0);
const ld EPS = 1e-8;
const int INF = INT_MAX/2;
const ll LINF = LONG_MAX/2;
const int MOD = 1000000007;

template<class T> inline void amin(T &a, const T &b) { if (b<a) a=b; }
template<class T> inline void amax(T &a, const T &b) { if (a<b) a=b; }

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

int main(){
    
    ll a, b, c;
    cin >> a >> b >> c;
    
    set<ll> s;
    
    s.insert(a);
    s.insert(b);
    s.insert(c);
    
	int ans = 0;
    cout << fixed << setprecision(10);
    if(s.size()==2){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}



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

int main() {
  int s, count;
  cin >> s;
  if (s/100 == 1){
    count += 1;
    s -= 100;
  }
  if (s/10 == 1){
    count += 1;
    s -= 10;
  }
  if (s == 1){
    count += 1;
  }
  cout << count << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,a=0,b=0;
  cin>>n;
  vector<int> v(n);
  for(int i=0;i<n;i++) cin>>v.at(i); 
  while(a<n){
    a++;
    b=v.at(b)-1;
    if(b==1){
      cout<<a<<endl;
      return 0;
    }
  }
  cout<<-1<<endl;
}


Measured memory_bytes: 640
using System;
using System.Linq;

class C
{
	static void Main()
	{
		var c = new int[3].Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();

		var a = new int[3];
		for (int a1 = 0; a1 <= 100; a1++)
		{
			var b1 = c[0][0] - a1;
			var b2 = c[0][1] - a1;
			var b3 = c[0][2] - a1;

			for (int a2 = 0; a2 <= 100; a2++)
			{
				if (!(a2 + b1 == c[1][0] && a2 + b2 == c[1][1] && a2 + b3 == c[1][2]))
					continue;

				for (int a3 = 0; a3 <= 100; a3++)
					if (a3 + b1 == c[2][0] && a3 + b2 == c[2][1] && a3 + b3 == c[2][2])
					{ Console.WriteLine("Yes"); return; }
			}
		}
		Console.WriteLine("No");
	}
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define fo(i,n) for(ll i=0;i<n;i++)
#define fo1(i,n) for(ll i=1;i<=n;i++)
#define loop(i,a,b)for(ll i=a;i<=b;i++)
#define loopr(i,a,b)for(ll i=b;i>=a;i--)
#define vll vector<ll> 
#define vvl vector<vll>
#define pii pair<ll,ll>
#define F first
#define S second
#define endl "\n"
#define M 1000000007
ll max(ll a,ll b){if (a>b) return a; else return b;}

ll po(ll x, ll y){
    if(y==0)
    return 1;
    if(y%2){
        return ((x)*(po(x,y/2)%M)*(po(x,y/2)%M))%M;
    }
   return ((po(x,y/2)%M)*(po(x,y/2)%M))%M;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll t=1;
	//cin>>t;
    while(t--){
       ll n; cin>>n;
       vll v(n);
       fo(i,n)
       cin>>v[i];
       ll ans=0;
       fo(i,n){
           for(ll j=i+1; j<n; j++){
               for( ll k=j+1; k<n; k++){
                   if(v[i]!=v[j] && v[j]!=v[k] && v[i]!=v[k] && v[i]+v[j]>v[k] && v[i]+v[k]>v[j] && v[j]+v[k]>v[i])
                   ans++;
               }
           }
       }
       cout<<ans<<endl;
    }
return 0;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = n; i > 0; i--)
#define rep3(i, s, e) for (int i = (s); i < (int)(e); i++)
#define rep4(i, s, e) for (int i = (e); i < (int)(s); i--)

int main() {
    int n, a, c;
    int max_count = int(pow(2, 9));
    cin >> n;
    rep(i, n) {
        cin >> a;
        c = 0;
        while (a % 2 == 0) {
            a /= 2;
            c++;
        }

        if (c < max_count) {
            max_count = c;
        }
    }
    cout << max_count << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#define ll long long
#define endl '\n'
using namespace std;

int main(void)
{
  cin.tie(NULL); ios_base::sync_with_stdio(false);
  int N; cin >> N;
  unordered_set<int> st;
  while(N--)
    {
      int a; cin >> a;
      if(st.find(a) == st.end())
	{
	  st.insert(a);
	}
      else
	{
	  st.erase(a);
	}
    }
  cout << st.size() << endl;
  return 0;
}



Measured memory_bytes: 4128
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	map<int, int> mp;
	int n; cin >> n;
	REP(i, n)
	{
		int a; cin >> a;
		mp[a]++;
	}
	int ans = 0;
	for (auto i : mp)
	{
		if (i.first > i.second) ans += i.second;
		else ans += i.second - i.first;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4736
#include<iostream>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstring>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
#define me(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f
const int N=500005;
int a[N];
int main()
{
	int n,m,i,sum=0,ans=0;
	cin>>n;
	for(i=0;i<n;i++)
	{
	   scanf("%d",&a[i]);
	   sum+=a[i];
	   
    }
    int f,h = sum/n;
    double kum=sum*1.0/n;
    if(kum-1.0*h>0.5)f=h+1;
    else f=h;
     for(i=0;i<n;i++)
     ans+=(a[i]-f)*(a[i]-f);
     
	cout<<ans;
}

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

int N;
vector<ll> a;

void solve() {
  ll res = 0;
  vector<bool> check(N, false);
  for (int i = 0; i < N; i++) {
    if (i + 1 == a[a[i] - 1] && !check[i]) {
      res++;
      check[i] = check[a[i] - 1] = true;
    }
  }
  cout << res << "\n";
  return;
}

int main() {
  cin >> N;
  a.assign(N, 0);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  solve();
  return 0;
}

Measured memory_bytes: 1024
import sys
import heapq

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


def main():
    N, M = map(int, input().split())

    H = []
    for i in list(map(int, input().split())):
        heapq.heappush(H, [-i, 1])

    for i in range(M):
        b, c = map(int, input().split())
        heapq.heappush(H, [-c, b])

    cnt = 1
    ans = 0
    while cnt <= N:
        c, b = heapq.heappop(H)
        c = -c
        ans += c
        if b > 1:
            b -= 1
            heapq.heappush(H, [-c, b])
        cnt += 1

    print(ans)


if __name__ == "__main__":
    main()


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

int main(void)
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
	int n;
	cin>>n;
	vector<int> arr(n);
	long long int s = 0, s2 = 0;
	for (auto &a: arr) {
		cin>>a;
		s += a;
	}
	s /= n;
	s2 = s+1;
	long long int ans = 0, ans2 = 0;
	for (auto &a: arr) {
		ans += (s -a)*(s-a);
		ans2 += (s2 - a) * (s2-a);
	}
	ans = min(ans, ans2);
	cout<<ans<<"\n";

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <set>
#include <string>
#include <vector>

int main(){
    int a,b,c,d;
    std::cin >> a >> b >> c >> d;

    int start,end;

    if(a>c){
        start = a;
    }
    else if(a < c){
        start = c;
    }

    if(b > d){
        end = d;
    }
    else if(b < d){
        end = b;
    }

    if(start >= end){
        std::cout << 0;
        return 0;
    }
    if(end > start){
        std::cout << end - start;
        return 0;
    }
}


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;
    vector<ll> cnt(n+1, 0);
    rep(x, 1, 101){
        rep(y, 1, 101){
            rep(z, 1, 101){
                ll f = x*x + y*y + z*z + x*y + y*z + z*x;
                if(f <= n) cnt[f]++;
            }
        }
    }
    rep(i, 1, n+1) cout << cnt[i] << endl;
    return 0;
}

Measured memory_bytes: 3676
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<vector>
#include<cmath>
#define pb push_back
#define ll long long
#define inf 0x3f3f3f3f
#define fill(a,b) memset(a,b,sizeof(a))
#define cpy(a,b) memcpy(a,b,sizeof(b))
template<typename T> inline bool MIN(T &a,const T &b) {return a>b? a=b,1:0;}
template<typename T> inline bool MAX(T &a,const T &b) {return a<b? a=b,1:0;}
#define mod 1000000007
inline int plu(int a,int b) {return a+b>=mod? a+b-mod:a+b;}
inline int sub(int a,int b) {return a-b<0? a-b+mod:a-b;}
inline int mul(int a,int b) {return (ll)a*b%mod;}
inline int inc(int &a,int b) {a+=b;if (a>=mod) a-=mod;}
inline int dec(int &a,int b) {a-=b;if (a<0) a+=mod;}
#define mp make_pair
#define SZ(a) ((int)a.size())
#define BK(a) (a[SZ(a)-1])
#define fi first
#define se second
#define N
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;

int n;

int main()
{

    int a,b;
    scanf("%d%d%d",&n,&a,&b);
    if ((b-a)&1) printf("Borys\n");
    else printf("Alice\n");
    return 0;
}


Measured memory_bytes: 256
import numpy as np
n,k = map(int,input().split())
p = list(map(int,input().split()))
cs = []
for x in p:
    cs.append(((x+1)*x//2)/x)
cs = [0]+np.cumsum(cs).tolist()
ans = 0
for i in range(k, n+1):
    ans = max(ans, cs[i]-cs[i-k])
print(ans)

Measured memory_bytes: 34148
use std::io;
use std::f64::consts::PI;


fn main() {
    let r = read_one::<f64>();
    println!("{} {}", r * r * PI, 2f64 * PI * r);
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}


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

int hash_(string const& s, int& p, vector<int> const& vs) {
    if(isalpha(s[p])) {
        return vs[s[p++] - 'a'];
    }
    if(s[p] == '[') {
        const auto op = s[++p];
        const auto h1 = hash_(s, ++p, vs);
        const auto h2 = hash_(s, p, vs);
        p++; // ']'
        if(op == '+') {
            return h1 | h2;
        } else if(op == '*') {
            return h1 & h2;
        } else {
            return h1 ^ h2;
        }
    }
    assert(false);
    return -1;
}
int parse(string const& s, vector<int> const& vs) {
    int p = 0;
    return hash_(s, p, vs);
}

int main() {
    string exp;
    while(cin >> exp, exp != ".") {
        vector<int> you(4);
        {
            string s; cin >> s;
            for(int i = 0; i < 4; ++i) {
                you[i] = s[i] - '0';
            }
        }
        const auto your_hs = parse(exp, you);
        int ans = 0;
        for(int a = 0; a <= 9; ++a) {
            for(int b = 0; b <= 9; ++b) {
                for(int c = 0; c <= 9; ++c) {
                    for(int d = 0; d <= 9; ++d) {
                        ans += parse(exp, {a, b, c, d}) == your_hs;
                    }
                }
            }
        }

        cout << your_hs << ' ' << ans << endl;
    }
}



Measured memory_bytes: 3072
def main():
  ## IMPORT MODULE
  #import sys

  #sys.setrecursionlimit(100000)
  #input=lambda :sys.stdin.readline().rstrip()

  #f_inf=float("inf")
  #MOD=10**9+7
  
  if 'get_ipython' in globals(): 
    ## SAMPLE INPUT
    n = 4
    S = ['((()))', '((((((', '))))))', '()()()']

  else:
    ## INPUT 
    n = int(input())
    #a, b = map(int, input().split())
    S = [input() for _ in range(n)]

  ## SUBMITION CODES HERE
  def CNT(A):
    tmp, Min = 0, 0
    for a in A:
        if a == '(': tmp += 1
        else: tmp -= 1
        Min = min(Min, tmp)
    return (-Min, tmp-Min)
  
  T = [CNT(s) for s in S]

  pls = []
  mis = []
  for l, r in T:
    if l <= r: pls.append((l, r))
    else: mis.append((l, r))

  pls.sort(key=lambda a: a[0])
  mis.sort(key=lambda a: a[1], reverse=True)
  total = pls + mis

  levl = 0
  for l, r in total:
    levl -= l
    if levl < 0:
        print('No')
        exit()
    levl += r

  print('Yes' if levl == 0 else 'No')
    
main()

Measured memory_bytes: 170772
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define chmax(x,y) x = max(x,y)

 
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int> > VVI;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<bool> VB;
typedef vector<LL> VL;
typedef vector<vector<long long>> VVLL;
typedef vector<set<int>> VSI;
const int MOD = 1e9+7;
const int INF = 1e9;
const LL LINF = 1e18;
int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

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

int main() {
    int n;
    cin >> n;
    VI a(n);
    rep(i,n) cin >> a[i];

    int ans = 0;

    rep(i,n) {
        if(a[i] % 2 == 1 and (i+1) % 2 == 1) {
            ans++;
        }
    }

    cout << ans << endl;
}


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

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

//shakyo
int main() {
    int n;cin>>n;
    int ans = n;
    rep(i,n){
        int cc = 0;
        int t = i;
        while(t>0)cc+=t%6,t/=6;
        t = n - i;
        while(t>0)cc+=t%9,t/=9;
        
        if(cc < ans)ans=cc;
    }
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3612
n, k = [int(i) for i in input().split()]
l = [int(i) - 1 for i in input().split()]

i = 0
m = [-1] * n
p = 0

while m[i] == -1:
    if p == k:
        break
    m[i] = p
    p += 1
    i = l[i]
else:
    z = (k - m[i]) % (p - m[i])
    i = m.index(m[i] + z)
print(i + 1)

Measured memory_bytes: 32316
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;

int main() {
	string s;
	cin >> s;
	int N = s.size();
	int cnt = 0;
	
	int ans = 0;
	for(int i=0; i<N; i++) {
		if(s[i]=='T') cnt++;
		else cnt--;
		ans = max(ans, cnt);
//		cnt = max(cnt, 0);
	}
	cout << ans * 2 << endl;
	
	return 0;
}



Measured memory_bytes: 640
N, C, K = map(int, input().split())
T = sorted([int(input()) for _ in range(N)])
s, c = 0, 0
ans = 0
for t in T:
    if t <= s + K and c:
        c -= 1
    else:
        s = t
        c = C - 1
        ans += 1
print(ans)


Measured memory_bytes: 51544
import math

from sys import exit, setrecursionlimit
setrecursionlimit(10**6)

def array2D(row, col ,val=0):
    return [[val]*col for i in range(row)]

x,k = map(int, input().split())

a1 = x//k
ans = 10**30
for i in range(-10, 11):
    ans = min(ans, abs(x-(a1+i)*k))
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
char a;
int n,m;
int main()
{
cin>>n>>m;
for(int i=0;i<n;i++)
{
cin>>a;
if(a<'0'||a>'9'){cout<<"No"<<endl;return 0;}
}
cin>>a;
if(a!='-'){cout<<"No"<<endl;return 0;}
for(int i=0;i<m;i++)
{
cin>>a;
if(a<'0'||a>'9'){cout<<"No"<<endl;return 0;}
}
cout<<"Yes"<<endl;
}

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

/*高速化*/
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

/* define */
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V))
#define REV(V) reverse(ALL(V))
#define RSORT(V) SORT(V);REV(V)
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i = 0;i < (int)(n);++i)
#define Rep(i,n) for(int i = 1;i <= (int)(n);++i)
#define REP(i,n,m) for(int i = (int)(n);i < (int)(m);++i)
#define Mod(n,m) n % m
#define Mod7(n) Mod(n,7)
#define Mod9(n) Mod(n,9)

/* 最大値と最小値に置き換える */
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}


/* 型定義 */
typedef vector<long long> vi;
typedef long long ll;
using Graph = vector<vi>;


/* 定数 */
const double PI = 3.141592;
const double e = 2.6;
const long long Inf = 1LL << 60;
const long long mInf = -Inf;

//bool isAGCT(char s)
//{
//    if(s == 'A' or s == 'C' or s == 'G' or s == 'T')
//        return true;
//    return false;
//}

void calc()
{
    vi item(5);
    cin >> item[0] >> item[1] >> item[2] >> item[3] >> item[4];
    int minindex = 10;
    int tmp;
    rep(i,5)
    {
        tmp = item[i];
        if(tmp % 10 == 0) continue;
        minindex = min(minindex,(int)item[i] % 10);
        tmp = tmp / 10;
        tmp++;
        item[i] = tmp * 10;
    }
    cout << accumulate(ALL(item),0) - (10 - minindex) << '\n';
}


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    calc();
}



Measured memory_bytes: 256
#include <vector>
#include <cstdio>

using namespace std;

#define M 100
#define INF 10e6

#define MIN(X,Y) ((X)<(Y)?(X):(Y))

int main(void){
    int n,m, qNum;
    int cost[M][M], tm[M][M];
    
    while (scanf("%d%d", &n,&m), n){
        // reset table
        for (int i=0; i<m; i++){
            for (int j=0; j<m; j++){
                cost[i][j] = tm[i][j] = INF;
            }
        }
        // read data
        for (int i=0; i<n; i++){
            int s,d,c,t;
            scanf("%d%d%d%d", &s, &d, &c, &t);
            s--; d--;
            cost[s][d] = cost[d][s] = c;
            tm[s][d] = tm[d][s] = t;
        }
        // warshall-floyd
        for (int k=0; k<m; k++){
            for (int i=0; i<m; i++){
                for (int j=0; j<m; j++){
                    cost[i][j] = MIN(cost[i][j],cost[i][k]+cost[k][j]);
                    tm[i][j] = MIN(tm[i][j],tm[i][k]+tm[k][j]);                    
                }
            }
        }
        scanf("%d", &qNum);
        for (int i=0; i<qNum; i++){
            int s, d, type;
            scanf("%d%d%d", &s, &d, &type);
            s--; d--;
            printf("%d\n", type==0?cost[s][d]:tm[s][d]);
        }
    }
    
    return 0;
}

Measured memory_bytes: 2644
#include<iostream>
#include<string>
using namespace std;
int main(){
	int a[5];
	int h=0;
	for(int i=0;i<5;i++){
		cin>>a[i];
		if(a[i]<40)
			a[i]=40;
		h+=a[i];
	}
	cout<<h/5<<endl;
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>

using namespace std;

int main(int argc, char* argv[]) {
  int i = 1;
  while (true) {
    int x; cin >> x; 
    if (x == 0) break;
    cout << "Case " << i << ": " << x << endl;
    i++;
  }

  return 0;
}

Measured memory_bytes: 1160
n = int(input())
t, a = input().split(' ')
t = int(t)
a = int(a)
h = input().split(' ')

diff = 10000
point = 10000

for x in range(n):
    temp = t - int(h[x]) * 0.006
    tmp = abs(a - temp)

    if tmp < diff:
        diff = tmp
        point = x + 1

print(point)


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <stack>
#include <queue>
using namespace std;
using ll = long long;
using P = pair<int, ll>;

int main()
{
    int n;
    cin >> n;
    vector<int> p(n), q(n);
    for (int i = 0; i < n; ++i) cin >> p[i], --p[i];
    for (int i = 0; i < n; ++i) cin >> q[i], --q[i];
    map<vector<int>, int> dic;

    vector<int> v(n);
    for (int i = 0; i < n; ++i) v[i] = i;

    int ind = 0;
    do{
        dic[v] = ind;
        ++ind;
    } while (std::next_permutation(v.begin(), v.end()));

    int ans = abs(dic[p] - dic[q]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5248
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

A, B, C, K = rl()

if K <= A:
	print(K)
elif K <= A+B:
	print(A)
elif K <= A+B+C:
	print(A - (K-(A+B)))

Measured memory_bytes: 61912
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin>>a>>b;
    PUTS(max(max(a+b,a-b),a*b));
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final int n = sc.nextInt();
		
		int[] array = new int[n];
		
		int min = Integer.MAX_VALUE;
		for(int i = 0; i < n; i++){
			array[i] = sc.nextInt();
			min = Math.min(min, array[i]);
		}
		
		int count = 0;
		LOOP:
		for(int i = 1; i <= min; i++){
			for(int a = 0; a < n; a++){
				if(array[a] % i != 0){
					continue LOOP;
				}
			}
			
			System.out.println(i);
		}
		
	}

}

Measured memory_bytes: 18824
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args)  {
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String a = br.readLine();
            String b = br.readLine();
          	Main app = new Main();
            int k = Integer.parseInt(a.split(" ")[1]);
            String[] split = b.split(" ");
            int[] A = new int[split.length];
            for (int i = 0; i < split.length; i++) {
               A[i] = Integer.parseInt(split[i]); 
            }
            boolean[] dp = new boolean[k + 1];
            for (int stones = 0; stones <= k; stones++) {
                for (int x: A) {
                    if (stones >= x && !dp[stones - x]) {
                        dp[stones] = true;
                        break;
                    }
                }
            }
            System.out.println(dp[k] ? "First" : "Second");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


Measured memory_bytes: 22484
#include <iostream>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;

size_t count_up_result(vector<vector<int64_t>>& a_array, vector<int64_t>& b_array, int64_t c)
{
    size_t count = 0;

    for(size_t i = 0; i < a_array.size(); ++i)
    {
        int64_t sum = 0;
        assert(a_array[i].size() == b_array.size());
        for(size_t j = 0; j < a_array[i].size(); ++j)
        {
            sum += a_array[i][j] * b_array[j];
        }
        sum += c;
        if (sum > 0) { count++; }
    }

    return count;
}


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

    int64_t n, m, c = 0;
    cin >> n;
    cin >> m;
    cin >> c;
    assert(1 <= n && n <= 20);
    assert(1 <= m && m <= 20);
    assert(-100 <= m && m <= 100);

    vector<int64_t> b_array;
    for(size_t i = 0; i < m; ++i)
    {
        int64_t b;
        cin >> b;
        assert(-100 <= b && b <= 100);
        b_array.push_back(b);
    }

    vector<vector<int64_t>> a_array;
    for(size_t i = 0; i < n; ++i)
    {
        vector<int64_t> a_line;
        for(size_t j = 0; j < m; ++j)
        {
            int64_t a;
            cin >> a;
            assert(-100 <= a && a <= 100);
            a_line.push_back(a);
        }
        a_array.push_back(a_line);
    }

    cout << count_up_result(a_array, b_array, c) << endl;
}

Measured memory_bytes: 256
include Math

def get_length(x1, y1, x2, y2, x3, y3)
  a = sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2))
  b = sqrt((x2 - x3)*(x2 - x3) + (y2 - y3)*(y2 - y3))
  c = sqrt((x3 - x1)*(x3 - x1) + (y3 - y1)*(y3 - y1))
  return a, b, c
end

def get_radius(x1, y1, x2, y2, x3, y3)
  a, b, c = get_length(x1, y1, x2, y2, x3, y3)
  s = (a + b + c)/2.0
  area = sqrt(s*(s-a)*(s-b)*(s-c))
  (a*b*c)/(4.0*area)
end

def get_center(x1, y1, x2, y2, x3, y3)
  a1 = 2.0*(x2 - x1)
  b1 = 2.0*(y2 - y1)
  c1 = x1**2 - x2**2 + y1**2 - y2**2
  a2 = 2.0*(x3 - x1)
  b2 = 2.0*(y3 - y1)
  c2 = x1**2 - x3**2 + y1**2 - y3**2
  x = (b1*c2 - b2*c1)/(a1*b2 - a2*b1)
  y = (c1*a2 - c2*a1)/(a1*b2 - a2*b1)
  return x, y
end

max = gets.to_i
max.times.each do
  x1, y1, x2, y2, x3, y3 = gets.split(/\s/).map(&:to_f)

  r = get_radius(x1, y1, x2, y2, x3, y3)

  px, py = get_center(x1, y1, x2, y2, x3, y3)

  puts sprintf("%.3f %.3f %.3f", px, py, r)
end

Measured memory_bytes: 6192
#include <stdio.h>
#define max(a,b) (a)>(b)? (a):(b);

main(){
    int N,W;
    int v[100],w[100];
    int dp[2][10001]={{0,},};
    int i,j;

    scanf("%d %d",&N,&W);
    for(i=0;i<N;i++)
        scanf("%d %d",&v[i],&w[i]);

    for(i=1;i<=N;i++){
        for(j=0;j<=W;j++){
            if(j-w[i-1]<0)
                dp[i%2][j]=dp[(i-1)%2][j];
            else
                dp[i%2][j]=max(dp[(i-1)%2][j],dp[(i-1)%2][j-w[i-1]]+v[i-1]);
        }
    }

    int maxv=-1;
    for(i=0;i<=W;i++){
        maxv=max(maxv,dp[N%2][i]);
    }
    printf("%d\n",maxv);

    return 0;
}

Measured memory_bytes: 684
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
int ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//gcdlcm, isPrime, eratos, modinv, bitSearch, bitList, dfs, bfs, dijkstra, UnionFind, COM, digitDP//
ll i, j, k, l, m, n; ll N, M, K, H, W, L;
ll MOD = 1000000007; ll INF = 9999999999999; ll ans = 0;
vl flag, color; vll path; vl D;
//***********//
int main() {
	ll X, Y, A, B, C;
	cin >> X >> Y >> A >> B >> C;
	vpll App;
	for (i = 0; i < A; i++) {
		ll p;
		cin >> p;
		App.push_back(make_pair(p, 1));
	}
	for (i = 0; i < B; i++) {
		ll p;
		cin >> p;
		App.push_back(make_pair(p, 2));
	}
	for (i = 0; i < C; i++) {
		ll p;
		cin >> p;
		App.push_back(make_pair(p, 3));
	}
	sort(App.begin(), App.end());
	reverse(App.begin(), App.end());
	for (i = 0; i < App.size(); i++) {
		//cout << App[i].first << " " << App[i].second << endl;
	}
	ll sum = X + Y;
	for (i = 0; i < App.size(); i++) {
		if (sum == 0)break;
		if (App[i].second == 1 && X > 0) {
			X--; ans += App[i].first; sum--;
		}
		if (App[i].second == 2 && Y > 0) {
			Y--; ans += App[i].first; sum--;
		}
		if (App[i].second == 3) {
			ans += App[i].first; sum--;
		}
	}
	cout << ans;
}

Measured memory_bytes: 10476
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define mod 1000000007
using namespace std;
// fflush(stdout); to flush after every print ;,use \n in interactive prob;

int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll int n,i,c=0;
char s[100];
cin>>n;
for(i=0;i<n;i++)
{cin>>s[i];}

for(i=0;i<n-2;i++)
{
    if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')
    {
        c++;
        i=i+2;
    }
}
cout<<c<<endl;

return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        Card card[]=new Card[4];
        card[0]=new Card('S');
        card[1]=new Card('H');
        card[2]=new Card('C');
        card[3]=new Card('D');
        String mark;
        int rank;
        while(n-->0){
            mark=sc.next();
            rank=sc.nextInt();
            switch(mark){
                case "S":
                    card[0].existTrue(rank-1);
                    break;
                case "H":
                    card[1].existTrue(rank-1);
                    break;
                case "C":
                    card[2].existTrue(rank-1);
                    break;
                case "D":
                    card[3].existTrue(rank-1);
                    break;
            }   
        }
        for(int i=0;i<4;i++)card[i].printNotExist();
    }
}

class Card{
    private boolean exist[]=new boolean[13];
    private char mark;
    Card(char m){
        this.mark=m;
        for(int i=0;i<13;i++)this.exist[i]=false;
    }
    public void existTrue(int x){
        this.exist[x]=true;
    }
    public void printNotExist(){
        for(int i=0;i<13;i++){
            if(!this.exist[i])System.out.printf("%c %d\n",this.mark,i+1);
        }
    }
}


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

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

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000000007LL
#define maxn 100005
#define IN freopen("C.in","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2
#define sq(x) ((x)*(x))

using namespace __gnu_pbds;
using namespace std ;

// typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// typedef pair<i64, i64> pii;

int x1[205] , x2[205] ;

int main()
{
    int i , j , k , l , m , n ;

    scanf("%d",&n) ;

    memset(x1,-1,sizeof(x1)) ;
    memset(x2,-1,sizeof(x2)) ;

    for(i=0 ; i<n ; i++)
    {
        scanf("%d %d",&j,&k) ;
        x1[j] = k ;
    }

    for(i=0 ; i<n ; i++)
    {
        scanf("%d %d",&j,&k) ;
        x2[j] = k ;
    }
    set <int> st ;
    int ans = 0 ;
    for(i=2*n-1 ; i>=0 ; i--)
    {
        if( x2[i]!=-1 ) st.insert(x2[i]) ;
        else{

            set <int> :: iterator it = st.upper_bound(x1[i]) ;
            if(it!=st.end())
            {
                ans++ ;
                st.erase(it) ;
            }
        }
    }

    printf("%d\n",ans) ;

    return 0 ;
}


Measured memory_bytes: 256
class DisjointSet():
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.rank = [0] * (n)

    def make_set(self, x):
        self.par[x] = x
        self.rank[x] = 0

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.find(self.par[x])

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def same_check(self, x, y):
        return self.find(x) == self.find(y)

class Edge():
    def __init__(self, source=0, target=0, cost=0):
        self.source = source
        self.target = target
        self.cost = cost

    def __lt__(self, e):
        return self.cost < e.cost

def kruskal(N, edges):
    # 今回は総コストのみ
    total_cost = 0
    edges = sorted(edges)

    dset = DisjointSet(N)

    source, target = 0, 0
    for i in range(E):
        e = edges[i]
        if not dset.same_check(e.source, e.target):
            total_cost += e.cost
            dset.unite(e.source, e.target)
    return total_cost

V, E = list(map(int, input().split(' ')))
edges = []
for i in range(E):
    s, t, d = list(map(int, input().split(' ')))
    edges.append(Edge(s, t, d))
print(kruskal(V, edges))



Measured memory_bytes: 33492
#define rep(i,n) for (int i=0;i<n;i++)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
 
 
int main(){
  int n,m,a,b;
  cin >> n >> m;
  
  bitset<200000> first;
  bitset<200000> second;
  
  rep(i,m){
    cin >> a >>b;
    if(a==1)
      first.set(b,1);
    if(b==n)
      second.set(a,1);  
  }
  
  first=first&second;
  
  
  if(first.any())
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  
  
  
  
}

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

int main(){
	int a[5];
	for(int i = 0; i < 5; i++){
		cin >> a[i];
	}
	sort(a,a+5);
	cout << a[4];
	for(int i = 1; i < 5; i++){
		cout << " " << a[4-i];
	}
	cout << endl;
}

Measured memory_bytes: 1172
def main():
    n, x = map(int, input().split())

    # p_n = 1 + 2 * p_n-1
    # l_n = 3 + 2 * p_n-1
    # p0 = 1
    # l0 = 1
    pl = [(0, 0)] * (n + 1)
    pl[0] = (1, 1)

    for i in range(1, n + 1):
        prv = pl[i - 1]
        pl[i] = (1 + 2 * prv[0], 3 + 2 * prv[1])

    res = 0

    while n and x > 0:
        x -= 1  # bands
        p, l = pl[n - 1]
        if x == l * 2 + 2 or x == l * 2 + 1:
            res += 2 * p + 1
            break

        if x == l or x == l + 1:
            res += p + (x - l)
            break

        if x < l:
            n -= 1
        else:
            res += p + 1
            x -= l

    print(res)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import sys

sys.setrecursionlimit(1000000)
input = lambda : sys.stdin.readline().rstrip()

def pow_mod(x, y, mod):
    tmp = x
    ret = 1
    while y > 0:
        if y % 2 == 1:
            ret = ret * tmp % mod
        tmp = tmp * tmp % mod
        y //= 2
    return ret

def inverse(x, mod):
    return pow_mod(x, mod - 2, mod)

N = int(input())
x = list(map(int, input().split()))

MOD = 1000000007

def factorial(x):
    if x <= 1:
        return 1
    else:
        return x * factorial(x - 1) % MOD

f = factorial(N - 1)

h = [0]
for _ in range(N):
    h.append((h[-1] + f * inverse(len(h), MOD)) % MOD)

ans = 0
for i in range(N - 1):
    ans += h[i + 1] * (x[i + 1] - x[i])
    ans %= MOD

print(ans)

Measured memory_bytes: 88468
fun main() {
    val (n, m) = readListInt()
    val a = readListInt()
    var sum = a.sum()
    val ans = n - sum
    if (ans >= 0) {
        println(ans)
        return
    }
    println("-1")

}

private fun read() = readLine()!!

private fun readInt() = read().toInt()

private fun readLong() = read().toLong()

private fun readDouble() = read().toDouble()

private fun readListString() = read().split(" ")

private fun readListInt() = readListString().map { it.toInt() }

private fun readListLong() = readListString().map { it.toLong() }

private fun readListDouble() = readListString().map { it.toDouble() }

private fun readMatrixString(n: Int): List<List<String>> {
    val matrix = mutableListOf<List<String>>()
    for (i in 0 until n) {
        val list = readListString()
        matrix.add(list)
    }
    return matrix
}

private fun readMatrixInt(n: Int): List<List<Int>> {
    val matrix = mutableListOf<List<Int>>()
    for (i in 0 until n) {
        val list = readListInt()
        matrix.add(list)
    }
    return matrix
}

private fun readMatrixDouble(n: Int): List<List<Double>> {
    val matrix = mutableListOf<List<Double>>()
    for (i in 0 until n) {
        val list = readListDouble()
        matrix.add(list)
    }
    return matrix
}

private fun readMatrixLong(n: Int): List<List<Long>> {
    val matrix = mutableListOf<List<Long>>()
    for (i in 0 until n) {
        val list = readListLong()
        matrix.add(list)
    }
    return matrix
}



Measured memory_bytes: 39220
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final long x = scanner.nextLong();
        final long div = x / 11L;
        final int mod = (int) (x % 11);

        if (mod == 0) {
            System.out.println(2 * div);
        } else if (mod <= 6) {
            System.out.println(2 * div + 1);
        } else {
            System.out.println(2 * div + 2);
        }
    }
}


Measured memory_bytes: 21716