akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

func main() {
	sc := NewScanner(os.Stdin)
	X := sc.NextInt()
	Y := sc.NextInt()
	Z := sc.NextInt()
	K := sc.NextInt()
	A := make([]int, X)
	B := make([]int, Y)
	C := make([]int, Z)
	for i := 0; i < X; i++ {
		A[i] = sc.NextInt()
	}
	for i := 0; i < Y; i++ {
		B[i] = sc.NextInt()
	}
	for i := 0; i < Z; i++ {
		C[i] = sc.NextInt()
	}
	AB := make([]int, X*Y)
	for i := 0; i < X; i++ {
		for j := 0; j < Y; j++ {
			AB[Y*i+j] = A[i] + B[j]
		}
	}
	sort.Ints(AB)

	all := make([]int, 0)
	for i := 0; i < min(K, len(AB)); i++ {
		for j := 0; j < len(C); j++ {
			all = append(all, AB[len(AB)-1-i]+C[j])
		}
	}

	sort.Ints(all)
	for i := 0; i < K; i++ {
		fmt.Println(all[len(all)-1-i])
	}

}

func vmin(v []int) int {
	mn := math.MaxInt32
	for i := 0; i < len(v); i++ {
		mn = min(mn, v[i])
	}
	return mn
}

func lcm(x, y int) int {
	x, y = max(x, y), min(x, y)
	if y == 0 {
		return x
	}
	return lcm(y, x%y)
}

func max64(x, y int64) int64 {
	if x > y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

// scanner
type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner(r io.Reader) *Scanner {
	rdr := bufio.NewReaderSize(r, 1024)
	return &Scanner{r: rdr}
}

func (s *Scanner) ReadLine() {
	s.buf = make([]byte, 0)
	for {
		line, isp, err := s.r.ReadLine()
		if err != nil {
			os.Exit(1)
		}
		s.buf = append(s.buf, line...)
		if !isp {
			break
		}
	}
}

func (s *Scanner) NextInt64() int64 {
	i, err := strconv.ParseInt(s.Next(), 10, 64)
	if err != nil {
		os.Exit(1)
	}
	return i
}

func (s *Scanner) NextInt() int {
	i, err := strconv.Atoi(s.Next())
	if err != nil {
		os.Exit(1)
	}
	return i
}

func (s *Scanner) NextFloat64() float64 {
	i, err := strconv.ParseFloat(s.Next(), 64)
	if err != nil {
		os.Exit(1)
	}
	return i
}

func (s *Scanner) Next() string {
	s.Pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	next := string(s.buf[start:s.p])
	s.p++
	return next
}

func (s *Scanner) Pre() {
	if s.p >= len(s.buf) {
		s.ReadLine()
		s.p = 0
	}
}


Measured memory_bytes: 108416
#include <iostream> 
#include <queue>
#define NODE_NUM 100
using namespace std;

int v_num, v_degree, v, v_id;
int adj_M[NODE_NUM][NODE_NUM], Distance[NODE_NUM], visit_state[NODE_NUM];
static const int WHITE = 0;
static const int GRAY  = 1;
static const int BLACK = 2;

void BreadthFirstSearch(int node) 
{
    queue<int> Q;
    Q.push(node);
    Distance[node] = 0;
    visit_state[node] = GRAY;

    while(! Q.empty())
    {
        int cur_node = Q.front();
        for (int i = 0; i < v_num; ++i) 
        {
            if (adj_M[cur_node][i] == 1 && visit_state[i] == WHITE) 
            {
                Q.push(i);
                visit_state[i] = GRAY;
                Distance[i] = Distance[cur_node] + 1;
            } 
        } 
        Q.pop();
        visit_state[cur_node] = BLACK;
    }
}

int main() 
{
    cin >> v_num;

    // init
    for (int i = 0; i < v_num; ++i) 
    {
        for (int j = 0; j < v_num; ++j) 
        {
            adj_M[i][j] = 0;
        }
        Distance[i] = -1;
        visit_state[i] = WHITE;
    }

    for (int i = 0; i < v_num; ++i) 
    {
        cin >> v_id >> v_degree;
        v_id--;
        for (int i = 0; i < v_degree; ++i) 
        {
            cin >> v;
            adj_M[v_id][v-1] = 1;
        }
    }

    BreadthFirstSearch(0);

    for (int i = 0; i < v_num; ++i) cout << i+1 << " " << Distance[i] << endl;
}


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

#define ll long long
#define mod 1000000007

using namespace std;



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,a;
    cin>>n;a=n;
    for(int i=a;i<=999;i++){
        if(i%111==0){cout<<i;return 0;}
    }
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  ll n = s.size();
  
  ll ans = n*(n-1)/2;
  ll alp[26]={};
  rep(i,n) alp[s[i]-'a']++;
  rep(i,26) ans -= alp[i]*(alp[i]-1)/2;
  
  cout << ans+1 << endl;
  return 0;
}

Measured memory_bytes: 720
#include<iostream>
#include<cmath>
#include<numeric>
#include<string>
#include<algorithm>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define int64 long long
#define yokuwaruprime (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int main(){
  int64 n,s,t,k,ans;
  cin>>n>>k;
  if(k%2!=0){
    s=floor((double)n/k);
    ans=s*s*s;
  }else{
    s=floor((double)n/k);
    t=floor((double)(n+k/2)/k);
    ans=s*s*s+t*t*t;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
def kakaka():
    a = list(map(int, input().split()))
    b = map(int, input().split())
    c = int(input())

def start_process():
    return
def main():
    a, b = map(int, input().split())
    if a > b:
        count = a
        a -= 1
    else:
        count = b
        b -= 1
    count += max(a, b)
    print(count)



if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using ll=long long;
using ld=long double;
#define INF 1000000009
const ll INFll=1ll*INF*INF;
#define MOD 998244353
#define MODE 1000000007
const long double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define pb push_back
#define mp make_pair
#define rep(i,n) for (ll i = 0; i < n; i++)
#define rev(i,n) for (ll i = n-1; i >= 0; i--)
#define REP(i,a,b) for (ll i = a; i < b; i++)
#define REV(i,a,b) for (ll i = a; i >= b; i--)
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define vl vector<ll>
#define pll pair<ll,ll>
#define sz(a) (ll)a.size()
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << ' '; cout << endl;
#define printii(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << it->f<<' '<<it->s << endl; cout << endl;
#define MID(i,j) ((i)+(j))/2
#define nl '\n' 
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define int ll
ll gcd(ll a,ll b)  {return (b==0)? a:gcd(b,a%b);}

ll bpow(ll a, ll b, ll m) {
  a %= m;
  ll res = 1;
  while (b > 0) {
    if (b & 1)res = res * a % m;
    a = a * a % m;
    b >>= 1;
}
return res;
}

vector<vector<int> >g;
vector<bool>visited;
vector<int> ans;

void dfs(int v) {
    visited[v] = true;
    for (int u : g[v]) {
        if (!visited[u])
            dfs(u);
    }
    ans.push_back(v);
}

void solve() {
    int n, m;
    cin >> n >> m;
    g.resize(n);
    for(int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        g[x].pb(y);
    }
    visited.resize(n, false);
    ans.clear();
    for (int i = 0; i < n; ++i) {
        if (!visited[i])
            dfs(i);
    }
    reverse(ans.begin(), ans.end());
    vector<int>dp(n, 0);
    for(int u : ans){
        for(int v : g[u]){
            dp[v] = max(dp[v], dp[u]+1);
        }
    }
    int longest = 0;
    for(int i = 0; i < n; i++){
        longest = max(longest, dp[i]);
    }
    cout << longest << endl;

}

// DONT GET TLE FOR NOT USING FASTIO (--__--)

signed main(){
	fastio;
    ll t = 1;
    // cin >> t;
    rep(i, t){
        solve();
    }
    return 0;
}


Measured memory_bytes: 12392
N,X=map(int,input().split())
a=[1]
p=[1]
for i in range(N):
    a.append(a[i]*2+3)
    p.append(p[i]*2+1)

def f(n,x):
    if n==0:
        return 0 if x<=0 else 1
    if x<=a[n-1]+1:
        return f(n-1,x-1)
    return p[n-1]+f(n-1,x-a[n-1]-2)+1
print(f(N,X))

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

int main(){
  std::string str;
  std::cin>>str;

  int maxlength = 0;
  int length = 0;
  bool check = false;
  for(int i = 0 ; i < (int)str.length() ; i++){
    if(str[i]=='A'||str[i]=='T'||str[i]=='C'||str[i]=='G'){
      check = true;
    }else{
      check = false;
    }
    if(check==true){
      length++;
    }
    if(check==false && maxlength<=length){
      maxlength = length;
      length = 0;
    }
    if(check==false && maxlength > length){
      length = 0;
    }
    if(i == (int)str.size()-1 && check == true && maxlength<=length){
      maxlength = length;
    }
  }
  std::cout<<maxlength<<std::endl;
  return 0;
}


Measured memory_bytes: 256
x, n = map(int, input().split())
p = list(map(int, input().split()))

if not(x in p):
  print(x)
else:
  for i in range(100):
    if not(x-i in p):
      print(x-i)
      break
    if not(x+i in p):
      print(x+i)
      break

Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define REP(i, n) FOR(i,0,n)
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }


constexpr int b = 80 * 80 + 3;
constexpr int M = b * 2 + 3;
int main()
{
    int H, W;
    cin >> H >> W;
    vector<vector<int>> A(H, vector<int>(W));
    vector<vector<int>> B(H, vector<int>(W));
    cin >> A >> B;

    vector<bitset<M>> dp(W);
    dp[0][b] = 1;
    REP(i, H) {
        REP(j, W) {
            int d = abs(A[i][j] - B[i][j]);
            if (j) dp[j] |= dp[j - 1];
            dp[j] = (dp[j] << d) | (dp[j] >> d);
        }
    }
    int ret = M;
    REP(i, M) if (dp.back()[i]) ret = min(ret, abs(i - b));
    cout << ret << endl;
}


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

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

using ll = long long;
using P = pair<int,int>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1<<30;
const ll mod = 1000000007LL;

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

int main() {
    ll N;
    cin>>N;
    vector<ll> v(N);
    rep(i,N) cin>>v[i];
    vector<ll> c(N-1);
    rep(i,N-1){
        if(v[i+1]>v[i]) c[i]=1;
        else c[i]=-1;
    }
    ll M = 1000,t = 0;
    rep(i,N-1){
        if(c[i]==1){
            t = M/v[i];
            M = M%v[i];
            M += t * v[i+1];
            t = 0;
        }
    }
    cout<<M<<endl;
}

Measured memory_bytes: 3644
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#define ll int64_t
#define REP(i, n) for (ll i=0; i<n; i++)
using namespace std;

ll GCD (ll a, ll b) {
    if (a < b) swap(a, b);
    int r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

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

    ll N, M;
    string S, T;
    cin >> N >> M >> S >> T;

    ll g = GCD(N, M);
    ll n = N / g;
    ll m = M / g;

    REP (i, g) {
        // cout << S[i*n] << " " << T[i*m] << "\n";
        if (S[i * n] != T[i * m]) {
            cout << "-1" << "\n";
            return 0;
        }
    }

    cout <<  N * M / g << "\n";
}

Measured memory_bytes: 640
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#define MOD 1000000007
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
signed main(){
  ll n,v=1;
  cin >> n;
  for(int i=0;i<n;i++){
    v*= (i+1);
    v%=MOD;
  }
  cout << v << endl;
}


Measured memory_bytes: 256
while 1:
    a=[i+1 for i in range(10)]
    try:b=list(map(int,input().split()))
    except:break
    for i in range(3):a.remove(b[i])
    print('YES' if sum([1 for i in a if i<=20-sum(b[:2])])/7>=0.5 else 'NO')

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



int main(){
    
    int h,w;
    cin >> h>>w;
    long long map[10][10]={0};
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            cin >>map[i][j];
        }
    }

    for(int a=0;a<10;a++){
        for(int b=0;b<10;b++){
            for(int c=0;c<10;c++){
                map[b][c]=min(map[b][a]+map[a][c],map[b][c]);
            }
        }
    }
    long long ans=0;
    int value;
    for(int i=0;i<w;i++){
        for(int j=0;j<h;j++){
            cin >>value;
            if(value>=0){
                ans+=map[value][1];
            }
        }
    }
    cout << ans;
    
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
static const int INF = 1145141919;
 
int main()
{
	int n;
	cin >> n;
	int h[100002];
	for (int i = 0; i < n; ++i)
	{
		cin >> h[i];
	}
	int dp[100002] = {};
	dp[100000] = dp[100001] = INF;
	for (int i = 0; i < 100002; ++i)
	{
		dp[i] = INF;
	}
	dp[0] = 0;
	for (int i = 0; i < n; ++i)
	{
		dp[i+1] = min(dp[i+1], dp[i] + abs(h[i] - h[i + 1]));
		dp[i+2] = min(dp[i+2], dp[i] + abs(h[i] - h[i + 2]));
	}
	cout << dp[n - 1] << endl;
	return 0;
}

Measured memory_bytes: 1024
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 998244353LL;

int mod_pow(int x, int k) {
    int res = 1;
    for(; k>0; k>>=1) {
        if(k & 1) (res *= x) %= MOD;
        (x *= x) %= MOD;
    }
    return res;
}

int dp[3][300 * 300 + 10][1 << 3];
signed main() {
    int N, sum = 0; cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++) {
        cin >> A[i];
        sum += A[i];
    }

    int whole = 0;
    whole = (whole + mod_pow(3, N)) % MOD;
    whole = (whole + 3 * (MOD - mod_pow(2, N))) % MOD;
    whole = (whole + 3) % MOD;

    // fprintf(stderr, "whole = %lld\n", whole);

    dp[0][0][0] = 1;
    for(int i=0; i<N; i++) {
        int cur = i % 2, nxt = 1 - cur;
        for(int j=0; j<=sum; j++) {
            for(int bit=0; bit<(1<<3); bit++) {
                // a+b 側に入れる
                if(j + A[i] <= sum) {
                    int nbit1 = bit | (1 << 0);
                    (dp[nxt][j + A[i]][nbit1] += dp[cur][j][bit]) %= MOD;

                    int nbit2 = bit | (1 << 1);
                    (dp[nxt][j + A[i]][nbit2] += dp[cur][j][bit]) %= MOD;
                }
                
                // c 側に入れる
                int nbit3 = bit | (1 << 2);
                (dp[nxt][j][nbit3] += dp[cur][j][bit]) %= MOD;

                dp[cur][j][bit] = 0;
            }
        }
    }

    int full = (1 << 3) - 1;
    for(int s=0; s<=sum; s++) {
        int t = sum - s;
        if(s <= t) {
            // fprintf(stderr, "sub: s = %lld, val = %lld\n", s, dp[N%2][s][full]);
            whole = (whole + MOD - (dp[N%2][s][full] * 3 % MOD)) % MOD;
        }
    }
    cout << whole << endl;
    return 0;
}


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

int main(){
  string S;
  cin >> S;
  int count = 0;
  int s = S.size();
  
  for (int i = 0; i < s; i++){
    if (S.at(i) != S.at(s-1-i)){
      count++;
    }
  }
  cout << count/2 << endl;
  
  return 0;
}

Measured memory_bytes: 256
using System;

class FightingOverCandies {
    static void Main() {
        string input = Console.ReadLine();

        int candy_pack1 = int.Parse(input.Split(' ')[0]);
        int candy_pack2 = int.Parse(input.Split(' ')[1]);
        int candy_pack3 = int.Parse(input.Split(' ')[2]);
        
        if (candy_pack1 + candy_pack2 == candy_pack3 ||
            candy_pack1 + candy_pack3 == candy_pack2 ||
            candy_pack2 + candy_pack3 == candy_pack1 )
            Console.WriteLine("Yes");
        else
            Console.WriteLine("No");
    }
}

Measured memory_bytes: 2648
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define rint register int
#define gc() getchar()
inline int read(int r=0,int s=0,int c=gc()){for(;c<48||c>57;s=c,c=gc());for(;c>=48&&c<=57;(r*=10)+=c-48,c=gc());return s^'-'?r:-r;}
unordered_map<ll,int> G; ll Ans, S; int n;
int main(){n = read(); G[0] = 1; for(rint i = 1; i <= n; S += read(), Ans += G[S], ++G[S], i++); cout << Ans << endl; return 0;}

Measured memory_bytes: 8520
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define chmin(x,y) x = min(x,y)
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1001001001;

int main() {
    int n, m, l;
    cin >> n >> m >> l;
    vector<vector<int>> dist(n, vector<int> (n, INF));
    rep(i, n) dist[i][i] = 0;
    rep(i, m) {
        int a, b, c;
        cin >> a >> b >> c;
        --a; --b;
        dist[a][b] = dist[b][a] = c;
    }
    rep(k,n)rep(i,n)rep(j,n) chmin(dist[i][j], dist[i][k]+dist[k][j]);
    vector<vector<int>> dist2(n, vector<int>(n,INF));
    rep(i, n) rep(j, n) {
        if (dist[i][j] <= l) dist2[i][j] = 1;
    }
    rep(k,n)rep(i,n)rep(j,n) {
        chmin(dist2[i][j], dist2[i][k]+dist2[k][j]);
    }
    int Q;
    cin >> Q;
    rep(i, Q) {
        int s, t;
        cin >> s >> t;
        --s; --t;
        if (dist2[s][t] == INF) puts("-1");
        else cout << dist2[s][t] - 1 << '\n';
    }
    return 0;
}


Measured memory_bytes: 4348
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] N = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            HashSet<int> A = new HashSet<int>();
            for(int i = 0; i < N[1] * 2; i++)
            {
                int[] abc = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
                for(int j = 0; j < abc.Length; j++)
                {
                    if (i % 2 != 0 )
                    {
                        A.Add(abc[j]);
                    }
                }
            }
            Console.WriteLine(N[0] - A.Count);
        }
    }
}

Measured memory_bytes: 28484
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <numeric>
using namespace std;

int main(){
    int n,a,b ;
    cin >> n >> a >> b ;
    a += b ;
    int j = 0 ;
    int f = 0 ;
    char c ;
    bool Q = false ;
    for (int i = 0; i < n; i++)
    {
        Q = 0 ;
        cin >> c ;
        if (c == 'a')
        {
            if (j < a)
            {
                Q = 1 ;
                j ++ ;
            }
            
        }else if (c == 'b')
        {
            if (f < b && j < a)
            {
                Q = 1 ;
                f ++ ;
                j++ ;
            }
            
        }
        if (Q == 1)
        {
            cout << "Yes" << endl; 
        }else
        {
            cout << "No" << endl ;
        }
        
        
        
    }
    
}

Measured memory_bytes: 640
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int 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;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//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) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) 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(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

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

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

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

int main() {
  int month, dates, day;
  while(cin >> month >> dates) {
    if(month == 0)break;
    day = 3;
    for(int i = 1; i < month; i++) {
      switch(i) {
      case 1:
      case 3:
      case 5:
      case 7:
      case 8:
      case 10:
      case 12:
	day += 31;
	break;
      case 2:
	day += 29;
	break;
      case 4:
      case 6:
      case 9:
      case 11:
	day += 30;
	break;
      }
    }

    day += dates-1;
    day %= 7;
    
    switch(day) {
    case 0:
      cout << "Monday" << endl;
      break;
    case 1:
      cout << "Tuesday" << endl;
      break;
    case 2:
      cout << "Wednesday" << endl;
      break;
    case 3:
      cout << "Thursday" << endl;
      break;
    case 4:
      cout << "Friday" << endl;
      break;
    case 5:
      cout << "Saturday" << endl;
      break;
    case 6:
      cout << "Sunday" << endl;
      break;
    }
  }
}

Measured memory_bytes: 1152
#include<iostream>

using namespace std;

int main()

{
	
     int a,b;
	
     cin>>a>>b;
	
     if(a%3==0)
	
    {
		
        cout<<"Possible"<<endl;
		
        return 0;
	
     }
	
     if(b%3==0)
	
    {
		
        cout<<"Possible"<<endl;
	
 	return 0;

     }
	
     if((a+b)%3==0)
	
    {
		
        cout<<"Possible"<<endl;
	
	return 0;

     }
	
     cout<<"Impossible"<<endl;

     return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i] >> c[i];
  }
  vector<int> enda(n), endb(n), endc(n);
  enda[0] = a[0];
  endb[0] = b[0];
  endc[0] = c[0];
  for (int i = 1; i < n; i++) {
    enda[i] = max(endb[i - 1], endc[i - 1]) + a[i];
    endb[i] = max(enda[i - 1], endc[i - 1]) + b[i];
    endc[i] = max(enda[i - 1], endb[i - 1]) + c[i];
  } 
  cout << max(enda[n - 1], max(endb[n - 1], endc[n - 1])) << endl;
  return 0;
}

Measured memory_bytes: 5616
/* おまじない　*/
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
typedef long long ll;
typedef long double ld;
using namespace std;
const ll MOD=pow(10,9)+7;
const ll INF=(1LL<<62);
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(a%b==0)return b;
    return gcd(a%b,b);
}
ll lcm(ll a,ll b){
    return a/gcd(a,b)*b;
}


int main(){
    init();
	ll n;cin>>n;
	vector<pair<ll,ll>>v;
	for(int i=0;i<n;i++){
		ll a,b;cin>>a>>b;
		v.push_back(make_pair(b,a));
	}
	sort(v.begin(),v.end());

	ll time=0;
	for(int i=0;i<n;i++){
		time+=v[i].second;
		if(time>v[i].first){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;

}

Measured memory_bytes: 6512
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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

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 / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------

int main(){
ll a,b;
cin>>a>>b;
cout<<(a+b)%24<<endl;
}










Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << '\n';
typedef int64_t Int;
Int mod = 1e9+7;
Int INF = 1e9+7;

int main() {
    ios::sync_with_stdio(false);
    Int n;
    cin >> n;
    vector<pair<Int, Int>> res;
    if (n % 2 == 1) {
        for (Int i = 1; i < n; i++) res.emplace_back(i, n);
        n--;
    }
    Int s = n + 1;
    for (Int i = 1; i <= n; i++) {
        for (Int j = i + 1; j <= n; j++) {
            if (i + j == s) continue;
            res.emplace_back(i, j);
        }
    }
    dump((Int)res.size());
    for (Int i = 0; i < (Int)res.size(); i++) cout << res[i].first << " " << res[i].second << endl;
    return 0;
} 

Measured memory_bytes: 512
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define REP(i, n) FOR((i), 0, (n))

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}

int main() {
    ll x;
    cin >> x;
    ll now = 100;
    int i = 0;
    while(now < x){
        i++;
        now = (double)now * 1.01;
    }

    cout << i << endl;

    return 0;
}

Measured memory_bytes: 3192
#include <stdio.h>
int main(void)
{
char x[1300];
char v;
int i = 0;
 int k;
while(1)
{
scanf("%c",&v);
 
if(v == '\n')
break;
 
else if('a' <= v && v <= 'z')
v -= 32;
else if('A' <= v && v <='Z')
v += 32;
 
x[i] = v;
i++;
}

for(k = 0; k < i; k++){
 
printf("%c",x[k]);
}
printf("\n");
 
return 0;
}

Measured memory_bytes: 524
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int count_bit(unsigned  int n) {
    n = (n &  0x55555555) + (n >>  1  &  0x55555555);
    n = (n &  0x33333333) + (n >>  2  &  0x33333333);
    n = (n &  0x0f0f0f0f) + (n >>  4  &  0x0f0f0f0f);
    n = (n &  0x00ff00ff) + (n >>  8  &  0x00ff00ff);
    return (n &  0x0000ffff) + (n >>  16  &  0x0000ffff);
}

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n, m;
    cin >> n;
    vector<vector<pair<int, bool>>> a(n);
    for(int i=0;i<n;++i){
        cin >> m;
        a[i].resize(m);
        for(int j=0;j<m;++j) {
            cin >> a[i][j].first >> a[i][j].second;
            --a[i][j].first;
        }
    }

    int ans = 0;
    for(int bi=0;bi<(1<<n);++bi) {
        vector<bool> is_honest(n);
        for(int i=0;i<n;++i) {
            is_honest[i] = (bi & (1 << i));
        }
        bool failed = false;
        for(int i=0;i<n;++i) {
            for(int j=0;j<a[i].size();++j) {
                if(is_honest[i]) {
                    if(is_honest[a[i][j].first] != a[i][j].second) {
                        failed = true;
                        break;
                    }
                }
            }
            if(failed) break;
        }
        if(!failed) {
            ans = max(ans, count_bit(bi));
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

#define FOR(i,s,e) for (int i = int(s); i < int(e); i++)
#define FORIT(i,c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define ISEQ(c) (c).begin(), (c).end()

int main(){
	bool colors[8] = {0};
	int freeColor = 0;
	int N;
	cin >> N;

	int rateMax[] = {399,799,1199,1599,1999,2399,2799,3199};
	int rateMin[] = {1,400,800,1200,1600,2000,2400,2800};

	FOR(i,0,N){
		int ai;
		cin >> ai;
		FOR(j,0,8){
			if(rateMin[j] <= ai && ai <= rateMax[j]) colors[j] = true;
		}
		if (rateMax[7] < ai) freeColor++;
	}

	int num = 0;
	FOR(j,0,8){
		if (colors[j]) num++;
	}
	int ret1 = num;
	if (ret1 == 0) ret1++;
	int ret2 = num+freeColor;

	cout << ret1 << " " << ret2 << endl;

	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
double f[1005][1005],dis[1005];
int a[1005][3];
bool b[1005];
int main()
{
	int xs,ys,xt,yt,i,j,k,n;
	double xi;
	scanf("%d%d%d%d",&xs,&ys,&xt,&yt);
	scanf("%d",&n);
	a[0][0]=xs;a[0][1]=ys;a[0][2]=0;
	a[n+1][0]=xt;a[n+1][1]=yt;a[n+1][2]=0;
	for(i=1;i<=n;i++)
		scanf("%d%d%d",&a[i][0],&a[i][1],&a[i][2]);
	n++;
	for(i=0;i<=n;i++)
		for(j=i+1;j<=n;j++){
			f[i][j]=f[j][i]=1.0*sqrt(1.0*(a[i][0]-a[j][0])*(a[i][0]-a[j][0])+1.0*(a[i][1]-a[j][1])*(a[i][1]-a[j][1]))-1.0*(a[i][2]+a[j][2]);
			if(f[i][j]<0)
				f[j][i]=f[i][j]=0;
		}
	for(i=1;i<=n;i++) 
		dis[i]=f[0][i];
	b[0]=1; 
	dis[0]=0; 
	for(i=0;i<=n-1;i++){ 
		xi=2000000000; 
		k=0; 
		for(j=0;j<=n;j++){
            if(b[j]==0&&dis[j]<xi){ 
				xi=dis[j]; 
				k=j; 
			} 
        }
		b[k]=1; 
		for(j=0;j<=n;j++)
			dis[j]=min(dis[j],dis[k]+f[k][j]);
	}
	printf("%.10f",dis[n]);
}

Measured memory_bytes: 8192
fun main(arg: Array<String>) {
    val (K, N) = listOfInt()
    val A = listOfInt().toMutableList()
    A.add(A[0] + K)
    var max = 0
    for (n in 0 until N) max = Math.max(max, A[n + 1] - A[n])
//System.err.println(C.joinToString())
    var ans = K - max
    println(ans)
}

fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun listOfString() = next().split(" ")
fun listOfInt(delta: Int = 0) = listOfString().map { Integer.parseInt(it) + delta }
fun listOfLong(delta: Long = 0L) = listOfString().map { java.lang.Long.parseLong(it) + delta }
fun listOfDouble(delta: Double = 0.0) = listOfString().map { java.lang.Double.parseDouble(it) + delta }
fun listOfInt() = listOfString().map(String::toInt)
fun listOfLong() = listOfString().map(String::toLong)
fun listOfDouble() = listOfString().map(String::toDouble)


Measured memory_bytes: 84844
def LI(): return list(map(int,input().split()))
A,B,C,X,Y = LI()
ans = min(A*X+B*Y,C*(max(X,Y)*2))
if X!=Y:
    temp = (min(X,Y)*2)*C + (max(X,Y)-min(X,Y))*(A if X>Y else B)
    ans = min(temp,ans)
print(ans)


Measured memory_bytes: 3060
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define uid uniform_int_distribution
#define FILE ifstream in("input.txt");ofstream out("output.txt");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int G = 200005;
int a;
vec<int> l[G];
ll o = 0;

int main() {
    fast;
    cin>>a;
    for(int q=0; q<a-1; q++){
        int x,y; cin>>x>>y; x--, y--;
        l[x].pb(y);
        l[y].pb(x);
    }
    ll cur = 0, E = 0;
    for(int q=0; q<a; q++){
        cur++;
        for(int h : l[q]) cur -= h<q;
        E += cur;
    }
    o += E;
    for(int q=0; q<a; q++){
        vec<int> m;
        for(int h : l[q]) if(h>q) m.pb(h);
        sort(m.begin(), m.end());
        E -= a-q;
        for(int i : m) E += a-i;
        o += E;
    }
    cout<<o;
}

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

#define endl '\n'
#define db(x) cerr << #x << " == " << x << endl
#define dbs(x) cerr << x << endl
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3f

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

const int N = 2e5+5;
int n, h[N], a[N];
ll bit[N], dp[N];

void update(int p, ll val){
  for(; p<=n; p+=p&(-p)) bit[p]=max(bit[p], val);
}

ll query(int p){
  ll ans=0;
  for(; p>=1; p-=p&(-p)) ans=max(ans, bit[p]);
  return ans;
}

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

  cin >> n;
  for(int i=1; i<=n; i++) cin >> h[i]; 
  for(int i=1; i<=n; i++) cin >> a[i];

  for(int i=1; i<=n; i++){
    dp[i]=a[i]+query(h[i]-1);
    update(h[i], dp[i]);
  }
  ll ans=0;
  for(int i=1; i<=n; i++) ans=max(ans, dp[i]);
  cout << ans << endl;
}

Measured memory_bytes: 4992
def shuffle(word, length):
	li = list(word)
	ad = li[0:length]
	li += ad
	del li[0:length]
	return ''.join(li)

while True:
	str = input()
	if str == '-':
		break
	num = int(input())
	
	for i in range(num):
		rn = int(input())
		str = shuffle(str, rn)
		
	print(str)

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

struct Edge{int to, id;};
vector<vector<Edge>>g;
vector<int>ans;

void dfs(int v, int c = -1, int p = -1){
  int k = 1;
  rep(i,g[v].size()){
    int u = g[v][i].to, ei = g[v][i].id;
    if(u==p) continue;
    if(k==c) ++k;
    ans[ei] = k; ++k;
    dfs(u,ans[ei], v);
  }
}

int main() {
  int n;
  cin >> n;
  g.resize(n);
  ans = vector<int>(n-1);
  rep(i,n-1){
    int a, b;
    cin >> a >> b;
    --a; --b;
    g[a].push_back((Edge){b, i});
    g[b].push_back((Edge){a, i});
  }
  dfs(0);
  int mx = 0;
  rep(i, n) mx = max(mx, int(g[i].size()));
  cout << mx << endl;
  rep(i, n-1) {
    cout << ans[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 8320
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using P = pair<int, int>;

int N;
int a[100];

int selectionSort() {
  int count = 0;
  rep(i, N) {
    // int key = a[i];
    int ind = i;
    for(int j = i+1; j < N; j++) {
      if(a[j] < a[ind]) {
        ind = j;
      }
    }
    if(ind != i) {
      swap(a[i], a[ind]);
      count++;
    }
  }
  return count;
}

int main() {
  cin >> N;
  rep(i, N) {
    cin >> a[i];
  }
  int ans = selectionSort();
  rep(i, N) {
    cout << a[i];
    if(i != N-1) cout << " ";
    else cout << endl;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3088
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val s = sc.next()
    println(problem063b(s))
}

fun problem063b(s: String): String {
    val hashSet = hashSetOf<Char>()
    for (i in s.indices) {
        if (hashSet.contains(s[i])) return "no"
        hashSet.add(s[i])
    }
    return "yes"
}

Measured memory_bytes: 35840
#if __has_include("noamoa_atcoder_lib.h")
#include "noamoa_atcoder_lib.h"
#else
#include <bits/stdc++.h>
#define endl '\n'
#define all(x) (x).begin(),(x).end()
namespace atcoder {
	using namespace std;
	using ll = long long;
	using intv = vector<int>;
	using charv = vector<char>;
	using boolv = vector<bool>;
	using floatv = vector<float>;
	using doublev = vector<double>;
	using stringv = vector<string>;

	constexpr ll MOD  = 1000000007;
	constexpr ll MOD9 = 1000000009;

	template<typename T>
	void sort(vector<T>& v){
		sort(all(v));
	}
	template<typename T>
	void sortInv(vector<T>& v){
		sort(all(v), greater<T>());
	}

	template<typename T>
	T sum(const vector<T>& v){
		T ret = 0;
		for(const auto& e : v) ret += e;
		return ret;
	}

	template<typename T>
	inline vector<T>& operator+=(vector<T>& v, const T& e){
		v.push_back(e);
		return v;
	}

	template<typename T>
	void in(vector<T>& v){
		for(auto& e : v) cin >> e;
	}

	template<typename T>
	istream& operator>>(istream &stream, vector<T>& v){
		for(auto& e : v) stream >> e;
		return stream;
	}

	template<typename T>
	void out(const vector<T>& v){
		for(const auto& e : v) cout << e << ' ';
		cout << endl;
	}

	template<typename T>
	void outln(const vector<T>& v){
		for(const auto& e : v) cout << e << endl;
	}

	void init(){
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(15);
	}
}
using namespace atcoder;
#endif
#define _USE_MATH_DEFINES
int main(){
	init();

	double R;cin>>R;
	cout <<(acos(-1)*R*2);

	/*int N;cin>>N;
	intv A(N-1);cin>>A;*/
}

Measured memory_bytes: 3764
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			int[] arr = Console.ReadLine().Trim().Split(' ').Select(hogehoge => int.Parse(hogehoge)).ToArray<int>();

			int[] tallArr = Console.ReadLine().Trim().Split(' ').Select(hogehoge => int.Parse(hogehoge)).ToArray<int>();

			int cnt = 0;

			for ( int i = 0; i < arr[0]; i++)
			{
				if (tallArr[i] >= arr[1]) cnt++;

			}

			Console.WriteLine(cnt);
		}


	}

}


Measured memory_bytes: 19168
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	string s, t;
	cin >> s >> t;
	sort(s.begin(), s.end());
	sort(t.rbegin(), t.rend());
	int len = min (s.length(), t.length());
	if(s < t){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;


int main(){
  //整数の時はint
  int h,w,k,ans=0;
  //文字の時はstring
  //string s;
  cin>>h>>w>>k;
  vector<string> s(h);
  for(int i=0;i<h;i++){
    cin>>s[i];
  }
  for(int i=0;i<(1<<h);i++){
    for(int j=0;j<(1<<w);j++){
      int cnt=0;
      for(int is=0;is<h;is++){
        for(int js=0;js<w;js++){
          if(i>>is&1) continue;
          if(j>>js&1) continue;
          // cout<<is<<js<<endl;
          if(s[is][js]=='#')cnt++;
        }}
        if(cnt==k)ans++;
    }}

  cout<<ans<<endl;

  return 0;
}


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

int main() {
    int n;
    cin >> n;
    map<long long, int> cnt;
    long long sum = 0;
    cnt[0]++;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        sum += a;
        cnt[sum]++;
    }
    long long ans = 0;
    for (auto& p : cnt) {
        ans += 1ll * p.second * (p.second - 1) / 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 12800
#include <iostream>
#include <cassert>

void ng (long long val = -1LL) {
    std::cout << val << '\n';
    exit(0);
}

int main() {
    int n;
    long long a, b, x = 0;
    std::cin >> n >> a >> b;
    for (int i = 2; i < n; i++) {
        long long e;
        std::cin >> e;
        x ^= e;
    }

    long long d = (a + b) - x;
    if (d < 0 or d % 2 == 1) ng();
    d >>= 1;
    for (int i = 0; i < 50; i++) {
        if ((x >> i & 1) and (d >> i & 1)) ng();
    }

    long long ans = 0;
    for (int i = 50; i --> 0;) {
        int bd = (d >> i & 1), bx = (x >> i & 1);
        if (bd == 1 and bx == 0) {
            ans += (1LL << i);
        }
    }
    for (int i = 50; i --> 0;) {
        int bd = (d >> i & 1), bx = (x >> i & 1);
        if (bd == 0 and bx == 1) {
            if (ans + (1LL << i) < a) ans += (1LL << i);
        }
    }

    if (ans == 0 or ans > a) ans = -1;
    else ans = (a - ans);
    std::cout << ans << '\n';
    return 0;
}


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

int main(){
    ll h,w;
    cin>>h>>w;
    if(h==1||w==1){cout<<1<<endl; return 0;}
    if(h%2==0||w%2==0)cout<<h*w/2<<endl;
    else cout<<h*w/2+1<<endl;
    return 0;
}

Measured memory_bytes: 256
import bisect
S = list(input())
T = list(input())
s_dict = {}
# 二週分の文字とインデックス番号の組み合わせを保持
for s in S:
    s_dict[s] = []
for i, s in enumerate(S+S):
    bisect.insort_right(s_dict[s], i)

N = len(S)
try:
    ret = 0
    cnt = 0
    pre_t_idx = -1
    for t in T:
        t_idx = s_dict[t][bisect.bisect_right(s_dict[t], pre_t_idx)]
        if t_idx > N-1:
            cnt += 1
            t_idx -= N
        ret = t_idx+1
        pre_t_idx = t_idx

    print(cnt*N+ret)
except Exception as e:
    print(-1)


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

using namespace std;
using ll = long long;

const ll mod = 1e9 + 7;

string bin_string(int size, ll n) {
    string ret = "";
    for (int i = size - 1; i >= 0; i--) {
        ll k = n >> i;
        if (k & 1) {
            ret += "1";
        } else {
            ret += "0";
        }
    }
    return ret;
}

ll rep_pow(int n, int p) {
    if (p == 0) {
        return 1;
    }
    if (p % 2 == 0) {
        ll t = rep_pow(n, p / 2);
        return t * t % mod;
    } else {
        return n * rep_pow(n, p - 1) % mod;
    }
}

int main() {
    ll n;
    cin >> n;
    vector<string> a(n);
    for (int i = 0; i < n; i++) {
        ll al;
        cin >> al;
        a[i] = bin_string(60, al);
    }
    ll ans = 0;
    for (int k = 0; k < 60; k++) {
        ll one_count = 0;
        for (auto s: a) {
            if (s[59 - k] == '1') {
                one_count++;
            }
        }
        ans += one_count * (n - one_count) % mod * rep_pow(2, k) % mod;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 35456
package main
import(
  "fmt"
)
func main(){
  var n int 
  x:=0
  ans:=0
  var s string 
  fmt.Scan(&n, &s)
  for i:=0;i<n;i++{
    if s[i]=='I'{
      x++
      if ans<x{
        ans=x
      }
    }else{
      x--
    }
  }
  fmt.Println(ans)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
 
#define itn int
#define all(x) (x).begin(), (x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
 
#define random_shuffle(...) shuffle(__VA_ARGS__, rng)
#define rand() rng()
 
using namespace std;
 
inline int nxt() {
	int x;
	scanf("%d", &x);
	return x;
}
 
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int S[100005];

int main() {
	
	int n = nxt();
	vector<int> A;

	for (int i = 0; i < n; ++i) {
		int a = nxt();
		S[a - 1] = i + 1;
	}

	for (int i = 0; i < n; ++i) {
		cout << S[i] << " ";
	}

	cout << "\n";
 
	return 0;
}

Measured memory_bytes: 1152