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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n;
vector<int> ans[1000];

int main() {
    scanf("%d", &n);
    int k = 1;
    while (k * (k - 1) / 2 < n) {
        ++k;
    }
    if (k * (k - 1) / 2 > n) {
        puts("No");
        return 0;
    }
    int num = 1;
    for (int i = 0; i < k; ++i) {
        for (int j = i + 1; j < k; ++j) {
            ans[i].pb(num);
            ans[j].pb(num);
            ++num;
        }
    }
    assert(num == n + 1);
    puts("Yes");
    printf("%d\n", k);
    forn(i, k) {
        printf("%d", (int)ans[i].size());
        for (int x : ans[i]) {
            printf(" %d", x);
        }
        puts("");
    }
    return 0;
}


Measured memory_bytes: 2304
#include <stdio.h>
int main(void){
  int i,la=0,lb=0;
  char a[101],b[101];
  scanf("%s%s",a,b);
  while (a[la]) la++;
  while (b[lb]) lb++;
  if (la>lb) printf("GREATER\n");
  else if (la<lb) printf("LESS\n");
  else{
    i=0;
    while (a[i]==b[i]) i++;
    if (!a[i]) printf("EQUAL\n");
    else if ((int)a[i]>(int)b[i]) printf("GREATER\n");
    else printf("LESS\n");
  }
  return 0;
}

Measured memory_bytes: 128
// AOJ 1200 "Goldbach's Conjecture" (ICPCアジア地区予選 1998 東京大会 Problem A)
import java.util.Scanner;
import java.util.BitSet;
import java.util.ArrayList;

public class Main {
    static BitSet isNotPrime; // 素数でないならtrue
    static ArrayList<Integer> primeList;
    static final int MAX_N = 65535;
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        isNotPrime = new BitSet(MAX_N);
        primeList = new ArrayList<Integer>();
        sieve();
        while (true) {
            int n = sc.nextInt();
            if (n == 0) {
                break;
            }
            
            int ans = 0;
            for (int i = 0; primeList.get(i) <= n / 2; i++) {
                if (!isNotPrime.get(n - primeList.get(i))) {
                    ans++;
                }
            }
            System.out.println(ans);
        }
    }
    
    // ここのsieveはふるいにかけると同時に、素数だけのリストを生成する
    public static void sieve() {
        isNotPrime.set(0);
        isNotPrime.set(1);
        for (int i = 2; i <= MAX_N; i++) {
            if (!isNotPrime.get(i)) {
                primeList.add(i);
                for (int j = i * 2; j <= MAX_N * 2; j += i) {
                    isNotPrime.set(j);
                }
            }
        }
    }

}

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

typedef long long ll;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>=(b);i--)

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

#define pii pair<int,int>

#define pb(a) push_back(a)
#define mp make_pair

int main()
{
	int n,c;
	cin >> n >> c;
	vector<vector<bool>> record(c, vector<bool>(100001, false));
	FOR(i,0,n){
		int si,ti,ci;
		cin >> si >> ti >> ci;
		for(int j = si; j <= ti; j++)record[ci-1][j] = true;
	}
	int ans = 0;
	FOR(i,0,100001){
		int cnt = 0;
		FOR(j,0,c){
			if(record[j][i])cnt++;
		}
		ans = max(ans,cnt);
	}
	ANS(ans);
	return 0;
}


Measured memory_bytes: 768
n=int(input())
l=list(map(int,input().split()))
x,y=[],[]
for i in range(n):
    if(i%2==0):
        y.append(l[i])
    else:
        x.append(l[i])
if(n%2==0):
    print(*(x[::-1]+y))
else:
    print(*(y[::-1]+x))


Measured memory_bytes: 110116
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;

ll inf=9223372036854775806;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	int x,y,z;
	cin>>x>>y>>z;
	x-=z;
	cout<<(int)x/(y+z);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define int long long
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
#define MOD 1000000007
#define INF 1000000000000000007
#define MAXN 300005

// it's swapnil07 ;)

signed main(){
    fast
    #ifdef SWAPNIL07
        freopen("/home/swapnil/Desktop/c++/input.txt","r",stdin);
        freopen("/home/swapnil/Desktop/c++/output.txt","w",stdout);
    #endif
    int n, k; cin>>n>>k;
    double ans = 0.0;
    For(i, 1, n+1){
        int sv = i;
        double val = 1.0;
        while(sv<k){
            val = val/2.0;
            sv *= 2;
        }
        ans += val;
    }
    ans = ans/(double)n;
    printf("%.14f\n", ans);
    return 0;
}

Measured memory_bytes: 256
"use strict";
function Main(input) {
    let lines = input.split("\n");
    let s = lines[0];
    let t = lines[1];
// console.log(`len: ${s.length}`);
    const a = 'a'.charCodeAt(0);
    let sa = new Array(26).fill(0);
    let ta = new Array(26).fill(0);
    let result = false;
    for (let n = 0; n < s.length; n++) {
        if (sa[s.charCodeAt(n) - a] == 0) sa[s.charCodeAt(n) - a] = t.charCodeAt(n) - a;
        else if (sa[s.charCodeAt(n) - a] != t.charCodeAt(n) - a) {
            console.log('No');
            return;
        }
        if (ta[t.charCodeAt(n) - a] == 0) ta[t.charCodeAt(n) - a] = s.charCodeAt(n) - a;
        else if (ta[t.charCodeAt(n) - a] != s.charCodeAt(n) - a) {
            console.log('No');
            return;
        }
    }
    console.log('Yes');
}

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


Measured memory_bytes: 7372
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

#define                           int                         long long
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);




using namespace std;

const int inf=1e18;
const int mod=1e9+7;
const int M=100009;
inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}

bool red[M+2];
int cnt[M+2];

 main()

{
    fast
    int n,m;
    cin>>n>>m;
    f(i,1,n)cnt[i]=1,red[i]=false;
    red[1]=true;
    f(i,1,m)
    {
        int u,v;
        cin>>u>>v;
        if(red[u])red[v]=true;
        cnt[u]--;
        cnt[v]++;
        if(cnt[u]==0)red[u]=false;
    }
    int ses=0;
    f(i,1,n)
    {
        if(red[i]==true)ses++;
    }
    cout<<ses<<endl;
    return 0;

}













Measured memory_bytes: 1152
#include <iostream>
#include <string>
using namespace std;
 
int64_t N, K;
int64_t A[100001];
int64_t B[100001];

int64_t Check(int64_t n){
    int64_t m = 0;
    for(int j = 0; j < N; ++j){
        if(n == (n | A[j])){
            m += B[j];
        }
    }
    return m;
}

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

    for(int i = 0; i < N; ++i){
        cin >> A[i] >> B[i];
    }

    int top = 0;
    for(int i = 0; 1 << i <= K; ++i) top = i;

    int64_t ans = Check(K);
    for(int i = 0; 1 << i <= K; ++i){
        if((K >> i) & 1){
            int64_t n = K >> i;
            n >>= 1;
            n <<= 1;
            int num = i;
                while(num > 0){
                n <<= 1;
                n |= 1;
                num--;
            }
            ans = max(ans, Check(n));
        }
    }
    cout << ans << endl;
}

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

const int MAXN = 2e5+7;
int n;

int a[MAXN];

LL canDo(int x) {
    LL rt = 0;
    for (int i = 1; i <= n; i++) {
        rt += (a[i]+x-1)/x - 1;
    }
    return rt;
}

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

    int lo = 1, hi = 0;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        hi = max(hi, a[i]);
    }

    while (lo <= hi) {
        int mid = (lo+hi)/2;
        if (canDo(mid) > k) lo = mid+1;
        else hi = mid-1;
    }

    cout << lo << endl;

    return 0;
}



Measured memory_bytes: 4340
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K;
  cin >> N >> K;
  
  vector<long long>vec(N,0);
  
  for(int i=0;i<N;i++){
    cin >> vec.at(i);
  }
  
  for(int i=K;i<N;i++){
    
    if( vec.at(i-K) < vec.at(i) ){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }
}



Measured memory_bytes: 4840
a,b,h,m = map(int,input().split())
import math
x = h*60 + m
c = (((a*math.cos((math.pi*x)/360))-b*math.cos((math.pi*x)/30))**2+((a*math.sin((math.pi*x)/360))-(b*math.sin((math.pi*x)/30)))**2)**(1/2)
print(c)

Measured memory_bytes: 9512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

int a, b, c, d, e, f;
double ans = 0;
int aa = 0, ab = 0;

int main() {
	cin >> a >> b >> c >> d >> e >> f;
	//for (int i = 0; 100 * a*i <= f; i++) {
	//	for (int j = 0; 100 * a*i + 100 * b * j <= f; j++) {
	//		for (int k = 0; 100 * a*i + 100 * b * j + c*k <= f; k++) {
	//			for (int l = 0; 100 * a*i + 100 * b * j + c*k + d*l <= f; l++) {
	//				//cout << "!" << endl;
	//				if (c*k + d*l <= e*(a*i + b*j)) {
	//					double num =
	//						(100 * (c*k + d*l)) / (100 * a*i + 100 * b*j + c*k + d*l);
	//					if (ans < num) {
	//						ans = num;
	//						aa = 100 * a*i + 100 * b*j + c*k + d*l;
	//						ab = c*k + d*l;
	//					}
	//				}
	//			}
	//		}
	//	}
	//}
	//cout << aa << " " << ab << endl;
	vector<int> u, v;
	for (int i = 0; 100 * i*a <= f; i++) {
		for (int j = 0; 100 * i*a + 100 * j*b <= f; j++) {
			u.push_back(100 * i*a + 100 * j*b);
		}
	}
	for (int i = 0; i*c <= f; i++) {
		for (int j = 0; i*c + j*d <= f; j++) {
			v.push_back(i*c + j*d);
		}
	}
	rep(i, u.size()) {
		rep(j, v.size()) {
			int m = u[i], s = v[j];
			if (m + s == 0)continue;
			if (m + s <= f&&m * e >= s * 100 && ans*(m + s) <= 100 * s) {
				ans = (100.0 * (double)s) / ((double)m + (double)s);
				aa = m + s;
				ab = s;
			}
		}
	}
	cout << aa << " " << ab << endl;
}

Measured memory_bytes: 1400
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

const int maxN = 100011;

int n, m, i, x, y, R;
int a[maxN], b[maxN];
int gr[maxN];
vector<int> list[maxN], adj[maxN];
bool used[maxN];
ll ans, act;
ll add[maxN], sum[maxN];

vector< pair<int, int> > ord;
int dad[maxN];

int Find(int x) {
    if (dad[x] == x) return x;
    dad[x] = Find(dad[x]);
    return dad[x];
}

bool Merge(int x, int y) {
    x = Find(x);
    y = Find(y);
    if (x == y) return false;
    dad[x] = y;
    adj[y].pb(x);


    return true;
}

void make_tree() {
    int i;
    
    for (i = 1; i <= n; i++) dad[i] = i;
    sort(ord.begin(), ord.end());

    for (auto node : ord) {
        used[node.second] = true;
        for (auto to : list[node.second]) {
            if (!used[to]) continue;
            Merge(to, node.second);
        }
    }

    R = ord.back().second;
}

void dfs(int node) {
    int i;
    
    for (auto to : adj[node])
        dfs(to);

    for (auto to : adj[node]) {
        sum[node] += sum[to];
        add[node] = min(add[node], add[to] + max(0LL, a[node] - b[node] - add[to] -
                    sum[to]));
    }
}

int main()
{
   // freopen("test.in","r",stdin);

    scanf("%d%d", &n, &m);
    for (i = 1; i <= n; i++) {
        scanf("%d%d", &a[i], &b[i]);
        a[i] = max(a[i], b[i]);
        ord.pb(mp(a[i] - b[i], i));
   }

    for (i = 1; i <= m; i++) {
        scanf("%d%d", &x, &y);
        list[x].pb(y);
        list[y].pb(x);
    }

    make_tree();

    for (i = 1; i <= n; i++) {
        add[i] = a[i] - b[i];
        sum[i] = b[i];
    }
    dfs(R);

    printf("%lld", sum[R] + add[R]);

    return 0;
}


Measured memory_bytes: 17012
#include <iostream>
#include <math.h>

using namespace std;

int main(){

    int n, i;
    cin >> n;

    bool done = false;

    for ( i = 1; i <= 50000; i++){
        if (floor(i * 1.08) == n) {
            done = true;
            break;
        }
    }

    if (done){
        cout << i << endl;
    } else {
        cout << ":(" << endl;
    }
    return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
ll L, R;

int main() {
    cin >> L >> R;
    if(R - L >= 2019) {
        cout << 0 << endl;
        return 0;
    }
    ll ans = 1e9;
    for(ll i = L; i <= R; i++) {
        for(ll j = i + 1; j <= R; j++) {
            chmin(ans, (i * j) % 2019);
        }
    }
    cout << ans << endl;
    return 0;
}


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

typedef long long ll;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) {
    return arg1.first < arg2.first;
}

int main(void) {
    ll n, k;
    cin >> n >> k;

    vector<pair<int, int>> ab(n);

    for(int i=0;i<n;i++) {
        cin >> ab.at(i).first >> ab.at(i).second;
    }

    sort(ab.begin(), ab.end(), compPair);

    ll know = 0;
    for(int i=0;i<n;i++) {
        know += ab.at(i).second;
        if(know>=k) {
            cout << ab.at(i).first << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 1024
import sys
input=sys.stdin.readline
n=int(input())
P=tuple(map(float,input().split()))
DP=[[0]*(n+1) for _ in range(n+1)]
for i in range(n+1):
    DP[i][0]=1
for i in range(1,n+1):
    for j in range(1,i+1):
        DP[i][j]=DP[i-1][j-1]*P[i-1]+DP[i-1][j]*(1-P[i-1])
print(DP[n][n//2+1])

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

int main() {
	int n, k;
	cin >> n >> k;
	long long r,s,p;
	cin >> r >> s >> p;
	
	string t;
	cin >> t;
	
	long long sum = 0LL;
	
	for(int i = 0; i < n; i++){
		if(i + k < n){
			if(t[i] == t[i + k]){
				t[i + k] = 'x';
			}
		}
		
		switch(t[i]){
			case 'r':
			sum += p;
			break;
			case 'p':
			sum += s;
			break;
			case 's':
			sum += r;
			break;
			default:
			break;
		}
	}
	
	cout << sum << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#include <cstring>

using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define RREP(i,n) for(int i = n - 1; i >= 0; i--)

#define ALL(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define y0 y3487465
#define y1 y8687969

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;

ll N, X;

int main(){
  cin >> N >> X;
  ll a, b;
  if(X > N - X) {
    a = X;
    b = N - X;
  } else {
    a = N - X;
    b = X;
  }
  ll ans = N;

  while(1) {
    ll c = a % b;
    ans += (a / b) * 2 * b;
    if(c == 0) {
      ans -= b;
      break;
    }
    a = b;
    b = c;
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import math

A, B = map(int, input().split())

def gcd(a, b):
    if b == 0:
        return(a)
    else:
        return(gcd(b, a % b))

def prime_factorize(n):
    res = []
    tmp = n

    for i in range(2, int(math.sqrt(n))+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            res.append([i, cnt])

    if tmp != 1:
        res.append([tmp, 1])

    if len(res) == 0 and n != 1:
        res.append([n, 1])

    return(res)

# AとBの公約数は
# AとBの最大公約数の約数に等しい
# ここではAとBの2個なのでAとBの約数を列挙して
# setの&などで共通部分を取っても良いが
# もっと個数が多い時はこの方法でやらないと遅いので使える方法だよ
g = gcd(A, B)
div = prime_factorize(g)
ans = len(div) + 1
print(ans)

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

int main(){
    int a,b; cin >> a >> b;
    b *= 2;
    if(b>=a){
        cout << 0 << endl;
    }else{
        cout << a - b << endl;
    }
}

Measured memory_bytes: 3604
#include<iostream>
using namespace std;
int main() {
    long long n, p;
    cin >> n >> p;
    long long ans = 1;
    if (n == 1) {
        cout << p << endl;
        return 0;
    }
    for (long long i = 2; i * i <= p; ++i) {
        int cnt = 0;
        while (p % i == 0) {
            cnt++;
            p /= i;
            if (cnt == n) {
                ans *= i;
                cnt = 0;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>

using ll = long long;
using namespace std;
typedef unsigned long long ull;
typedef pair<ll, ll>P;
const ll mod = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 9000000000000000000LL;
bool fl = true;;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
struct edge { ll to, cost; };

int main() {
	ll k, a[100010];
	cin >> k;
	for (int i = 0;i < k;i++) {
		cin >> a[i];
	}
	ll l = 1, r = INF2;
	while (r - l > 1) {
		ll mid = (l + r) / 2;
		ll M = mid;
		for (int i = 0;i < k;i++) {
			mid -= mid%a[i];
		}
		if (mid > 2)r = M;
		else l = M;
	}
	ll L = 1, R = INF2;
	while (R - L > 1) {
		ll mid = (L + R) / 2;
		ll M = mid;
		for (int i = 0;i < k;i++) {
			mid -= mid%a[i];
		}
		if (mid < 2)L = M;
		else R = M;
	}
	if (R > l)cout << -1 << endl;
	else cout << R << ' ' << l << endl;
}

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

int main()
{
  int N;cin>>N;
  int a,b;
  a = N%10;
  b = N/10 %10;
  if (a==9 | b==9) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <map>
#include <functional>
#include <cmath>
#include <cstdint>
#include <mutex>
#include <thread>
#include <bitset>
#include <utility>

using namespace std;

int main()
{
	double r;
	cin >> r;
	cout << (r * 2)* 3.141592653589793;
	return 0;
}

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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  int k;
  cin >> k;
  
  string ans = "No";
  for(int i=1;i<=k;i++){
    if(b>a and c>b){
      ans = "Yes";
    }else if(c<=b){
      c = 2*c;
//      continue;
    }else if(b<=a){
      b = 2*b;
//      continue;
    }
    if(b>a and c>b){
      ans = "Yes";
    }
  }
    
  cout << ans;
}

Measured memory_bytes: 3620
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<fstream>
#include<stdlib.h>
#include<set>
#include<climits>
#include<cmath>  
#include<memory.h> 
#include<sstream>
#include<time.h>
#include<iomanip>
using namespace std;
const unsigned long long BIGEST=1000000000000000000+1000000000000000000;
const long long BIGER=1000000000000000000;
const int BIG=1000000000;
const int MOD=1000000007;
const long long LMOD=998244353;
//const long long LMOD=1000000007;
#define Fi first
#define Se second
#define P2 pair
#define Pii pair<int,int>
#define Cb make_pair
#define Ll long long
#define Ull unsigned long long
#define Snf scanf
#define Prf printf
#define Pb push_back
#define Stc stack
#define Vct vector
#define Ret return
#define Sz size
#define Ins insert
int n;
Pii a[55];
Vct<Pii>v;
set<Pii>S;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i].Fi>>a[i].Se;
		S.insert(a[i]);
	}
	
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			v.Pb(Cb(a[i].Fi-a[j].Fi,a[i].Se-a[j].Se));
		}
	}
	int g=0;
	int mn=60;
	for(int i=0;i<v.size();i++)
	{
		//cout<<v[i].Fi<<" "<<v[i].Se<<endl;
		g=0;
		for(int j=1;j<=n;j++)
		{
			S.erase(a[j]);
			if(S.count(Cb(a[j].Fi-v[i].Fi,a[j].Se-v[i].Se)))g--;
			g++;
			//cout<<a[j].Fi-v[i].Fi<<" "<<a[j].Se-v[i].Se<<" "<<a[j].Fi<<" "<<a[j].Se<<endl;
			S.Ins(a[j]);
		}
		//cout<<g<<endl;
		mn=min(mn,g);
	}
	cout<<mn;
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1000000)

N = int(input())
G = [[] for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    G[a].append([b, i])

ans = [None]*(N-1)
def rec(cur, color):
    cnt = 1
    for (to, j) in G[cur]:
        if cnt == color:
            cnt += 1
        ans[j] = cnt
        rec(to, cnt)
        cnt += 1

rec(0,0)
print(max(ans))
[print(a) for a in ans]

Measured memory_bytes: 70928
#include <stdio.h>
int main()
{
    int a, b, c;

    scanf("%d %d %d", &a, &b, &c);

        if (a >= b && b >= c)

    printf("%d %d %d\n", c, b, a);

        else if (a >= b && b <= c && a >= c)

    printf("%d %d %d\n", b, c, a);

        else if (a >= b && b <= c && a <= c)

    printf("%d %d %d\n", b, a, c);

        else if (a <= b && b <= c)
        
    printf("%d %d %d\n", a, b, c);

       else if (a <= b && b >= c && a >= c)

    printf("%d %d %d\n", c, a, b);

       else if (a <= b && b >= c && a <= c)
        
    printf("%d %d %d\n", a, c, b);

return 0;
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
#define lli long long int

lli f(lli n)
{
	if(n&1)
		return(3*n+1);
	return(n>>1);
}
int main()
{
 	std::ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	
  	lli a,prev,curr,res;
  	  	cin>>a;
  	map<lli,lli> mp;
  	for(lli i=1;;i++)
  	{
  		if(i==1)
  		{
  			mp[a]=i;
  			prev=a;
  			continue;
		  }
		  else
		  {
		  		curr=f(prev);
		  		if(mp.find(curr)!=mp.end())
		  		{
		  			res=i;
		  			break;
				  }
				mp[curr]=i;
				prev=curr;
		  }
	  }
	  cout<<res;

  return 0;
}

Measured memory_bytes: 256
N = input()
K = int(input())

def K1(N):
  le = len(N)
  if le == 1:
    return int(N)
  else:
    return 9*(le-1)+int(N[0])
def K2(N):
  le = len(N)
  if le == 1:
    return 0
  else:
    j=1
    if int(N[j]) == 0 and j != le-1:
      while int(N[j]) == 0:
        j+=1
        if j == le-1:
          break
        
    n = N[j:le]
    return (9**2)*((le-1)*(le-2)//2) + K1(n) +(int(N[0])-1)*K1("9"*(le-1))
  
def K3(N):
  le = len(N)
  if le == 1 or le == 2:
    return 0
  else:
    j=1
    if int(N[j]) == 0 and j != le-1:
      while int(N[j]) == 0:
        j+=1
        if j == le-1:
          break
        
    n2 = N[j:le]
    
    return (9**3)*((le-1)*(le-2)*(le-3)//6) + K2(n2) + (int(N[0])-1)*K2("9"*(len(N)-1))
if K == 1:
  print(K1(N))
    
if K == 2:
  print(K2(N))
  
if K == 3:
  print(K3(N))
  

Measured memory_bytes: 3064
import java.util.*;

public class Main {

    int[] parents;

    void run() {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int m = sc.nextInt();

        parents = new int[n + 1];

        for (int i = 0; i < n + 1; i++) {
            parents[i] = i;
        }

        for (int i = 0; i < m; i++) {
            int x = sc.nextInt();
            int y = sc.nextInt();
            sc.nextInt();
            unite(x, y);
        }

        // ここまで10の6〜7じょうくらい

        Set<Integer> set = new HashSet();
        for (int i = 1; i < n + 1; i++) {
            set.add(findRep(parents[i]));
        }
        
        System.out.println(set.size());

    }

    void unite(int x, int y) {
        int rep1 = findRep(x);
        int rep2 = findRep(y);
        parents[rep2] = rep1;
    }

    int findRep(int x) {
        if (parents[x] != x) {
            parents[x] = findRep(parents[x]);
        }
        return parents[x];
    }


    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


Measured memory_bytes: 89756
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long ll;

string s;

int main()
{
    cin>>s;
    if(s[0] == '7' || s[1] == '7' || s[2] == '7') printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>

int main(void)
{
  int a,b,k,i,minb,maxs;
  scanf("%d %d %d",&a,&b,&k);
  if(k >= b - a)
    {
      for(i=a;i<=b;i++)
	{
	  printf("%d\n",i);
	}
      return 0;
    }
  for(i=a;i<a+k;i++)
    {
      printf("%d\n",i);
    }
  if(a+k-1 >= b-k+1)
    {
      minb = a+k;
    }
  else
    {
      minb = b -k +1;
    }
  for(i=minb;i<=b;i++)
    {
      printf("%d\n",i);
    }
  return 0;
}


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

int main(){
  int n,m;
  cin >> n >> m;
  int ans = 0;
  if( n >= 2 ){
    ans += n*(n-1)/2;
  }
  if( m >= 2 ){
    ans += m*(m-1)/2;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
a, b, k = gets.split(" ").map{ |i| i.to_i }
  
if b - a + 1 <= k * 2
  for i in a..b do
    puts i
  end
else
  k.times do |i|
    puts a + i
  end
  k.times do |i|
    puts b - k + 1 + i
  end
end


Measured memory_bytes: 1788
#pragma GCC optimize ("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
#define sz(x) (int)(x).size();
#define all(x) x.begin(), x.end()
#define trav(i,a) for(auto &i:a) 
inline int in(){int x;scanf("%lld",&x);return x;}
vector<vector<int>> a(10,vector<int>(10));
vector<vector<int>> tmp(10,vector<int>(10));
int32_t main()
{
	int n=in();int m=in();int K=in();
	string s;
	
	for(int i=0;i<n;i++)
	{
		cin>>s;
		for(int j=0;j<m;j++)
		{
			if(s[j]=='#')a[i][j]=1;
		}
	}

	int ans=0;
	for(int rm=0;rm<(1LL<<n);rm++)
	{
		tmp=a;
		vector<int> rowsel;
		for(int i=0;i<n;i++){if(rm&(1LL<<i))rowsel.push_back(i);}
		for(int cm=0;cm<(1LL<<m);cm++)
		{
			
			vector<int> colsel;
			for(int i=0;i<m;i++){if(cm&(1LL<<i))colsel.push_back(i);}
			
			for(auto i:colsel)
			{
				for(int j=0;j<n;j++)tmp[j][i]=2;
			}
			for(auto i:rowsel)
			for(int j=0;j<m;j++)tmp[i][j]=2;
			int ct=0;			
			for(int i=0;i<n;i++)
			for(int j=0;j<m;j++)
			if(tmp[i][j]==1)ct++;
			if(ct==K)ans++;
			tmp=a;
		
		}
	}
	
	cout<<ans;
}

Measured memory_bytes: 3700
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


s =  int(input())
    
n = s//3
ans = 0
for i in range(1,n+1):
    ss = s-i*3
    ans = (ans + cmb(ss+i-1,i-1))%(10**9+7)

print(ans%(10**9+7))

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n); i > 0; i--)
#define all(n) n.begin(), n.end()
#define print(n) cout << n << endl
 
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    ll n;
    cin >> n;
    vector<ll> a(n);
    ll bmin=1<<29,cmax=0;
    rep(i,n){
        cin >> a[i];
        if(i+a[i]<bmin) bmin = i+a[i];
        if(i-a[i]>cmax) cmax = i-a[i];
    }

    if(cmax-bmin<0){
        print(0);
        return 0;
    }

    vector<pair<ll,ll>> x(cmax-bmin+1);
    rep(i,n){
        if(i+a[i]<=cmax){
            x[i+a[i]-bmin].first++;
        }
        if(i-a[i]>=bmin){
            x[i-a[i]-bmin].second++;
        }
    }
    ll ans=0;
    for(auto i: x){
        if(i.first!=0 && i.second!=0) ans += i.first * i.second;
    }
    print(ans);
    return 0;
}

Measured memory_bytes: 7952
import java.util.Scanner;
 public class Main {
 
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
      
        String a ="";
      
      for(int i=0;i<S.length();i++){
        a =a+"x";
      }
      System.out.println(a);
    }
 }

Measured memory_bytes: 21844
<?php
list($n, $h) = ints();
for ($i = 0; $i < $n; $i++) {
    list($a[], $b[]) = ints();
}
$max_a = max($a);
$cnt = 0;
rsort($b);
for ($i = 0; $i < $n; $i++) {
    if ($b[$i] > $max_a) {
        $h -= $b[$i];
        $cnt++;
        if ($h <= 0) break;
    }
}
if ($h > 0) $cnt += intval(ceil($h / $max_a));
echo $cnt;
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

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

  double N;
  cin>>N;
  double L=N/3.0;
  printf("%.10f\n", L*L*L);

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector<int> v;
int main()
{
	int r,d,x;cin>>r>>d>>x;
	int x1=x;
	for(int i=1;i<=10;i++)
	{
		x=r*x-d;
		cout<<x<<endl;
	}
}

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

#define mp make_pair

using namespace std;

typedef int32_t i32;
typedef uint32_t u32;
typedef int64_t i64;
typedef uint64_t u64;
typedef pair<int,int> pii;
typedef pair<i64,int> pli;
typedef pair<int,i64> pil;
typedef pair<i64,i64> pll;
typedef vector<int> vi;
typedef vector<i64> vl;

template <typename T>
T id(T b) {return b;};
template <class It>
bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It>
bool any(It f,It l){return std::any_of(f,l,id<bool>);}

string s;
string k = "keyence";

int main()
{
  cin >> s;
  int i,j;
  for (i = 0; i < (int)k.length(); i++)
    if (s[i] != k[i]) break;

  for (j = 0; j < (int)k.length(); j++)
    if (s[s.length()-1-j] != k[k.length()-1-j]) break;

  if (i+j >= (int)k.length())
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  
  return 0;
}


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

using Int = long long int;
using std::vector;

// 加算と総和
struct SegmentTree {
    int length;
    vector<int> dat;

    int query(int ql, int qr, int nidx, int nl, int nr) {
        if (nr <= ql || qr <= nl) return 0;
        if (ql <= nl && nr <= qr) return dat[nidx];
        int vl = query(ql, qr, nidx * 2, nl, (nl + nr) / 2);
        int vr = query(ql, qr, nidx * 2 + 1, (nl + nr) / 2, nr);
        return vl + vr;
    }

    SegmentTree(int n) : length(1) {
        while (length < n) length <<= 1;
        dat.assign(length * 2, 0);
    }

    // half-open interval [ql, qr)
    int query(int ql, int qr) { return query(ql, qr, 1, 0, length); }

    void update(int idx, int e) {
        int nidx = idx + length;
        dat[nidx] += e;
        while (nidx > 0) {
            nidx >>= 1;
            dat[nidx] = dat[nidx * 2] + dat[nidx * 2 + 1];
        }
    }
};

int main() {
    int n, k;
    std::cin >> n >> k;

    vector<int> p(n);
    for (auto& x : p) {
        std::cin >> x;
        --x;
    }

    if (k == n) {
        int i;
        for (i = 0; p[i] != 0; ++i) {}
        for (int j = 0; j < n; ++j) {
            if (p[(i + j) % n] != j) {
                std::cout << "No" << std::endl;
                return 0;
            }
        }
    } else if (k % 2 == 1) {
        Int rev = 0;
        SegmentTree seg(n);
        for (auto x : p) {
            rev += seg.query(x + 1, n);
            seg.update(x, 1);
        }
        if (rev % 2 == 1) {
            std::cout << "No" << std::endl;
            return 0;
        }
    }

    std::cout << "Yes" << std::endl;
    return 0;
}



Measured memory_bytes: 4092
n = int(input())
h = list(map(int,input().split()))
ans = 0
l = 0
for i in range(n-1):
    if h[i] >= h[i+1]:
        l += 1
    else:
        ans = max(ans,l)
        l = 0
ans = max(ans,l)
print(ans)

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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

const ll MOD = (ll) 1e9 + 7;
const ll MAXN = (ll) 3e3 + 10;
const ll INF = (ll) 2242545357980376863;
const ld EPS = (ld) 1e-8;

ld dp[MAXN][MAXN];
ld p[MAXN];

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n;
	cin >> n;
	for(int i =1;i<=n; i++) cin >> p[i];
	dp[0][0] = 1;
	for(int i = 1;i <= n; i++){
		for(int j = 0;j<=i;j++){
			dp[i][j] = dp[i-1][j] * (1 - p[i]);
			if(j > 0) dp[i][j] += (dp[i-1][j-1] * p[i]);
		}
	}
	ld ans = 0;
	for(int i = n/2 + 1; i <= n; i++) ans += dp[n][i];
	cout << fixed << setprecision(16) << ans;
	return 0;
}


/*

                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/


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

int main() {
  int p, q, r;
  cin >> p >> q >> r;

  if ( p+r <= p+q && p+r <= q+r) {
    cout << p+r << endl;
  }

  else if ( p+q <= p+r && p+q <= q+r) {
    cout << p+q << endl;
  }
  else if (q+r <= p+r && q+r <= p+q){
    cout << q+r << endl;
  }
  }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
   long long n,k,p,c=1;
   cin>>n;
   long long a[n];

   for(int i=0;i<n;i++)
    cin>>a[i];
   long long mini=a[0];
   for(int i=1;i<n;i++)
   {
       mini=min(mini,a[i]);
       if(mini==a[i])
          c++;
   }
   cout<<c<<"\n";
   return 0;
}


Measured memory_bytes: 1792
#import <stdio.h>
#import <stdlib.h>

int main(int argc, const char * argv[]) {
    long N, T;
    scanf("%ld %ld", &N, &T);
    long *t = (long*)malloc(N * sizeof(long));
    
    long n;
    long i = 0;
    while (scanf("%ld", &n) != EOF) {
        t[i] = n;
        i++;
    }
    
    long last = 0;
    long total = 0;
    for(i=0;i<N;i++){
        total += T - ((t[i]<last) ? (last-t[i]) : 0);
        last = t[i]+T;
    }
    
    printf("%ld", total);
    
    free(t);
    return 0;
}


Measured memory_bytes: 7120
# author:  Taichicchi
# created: 19.09.2020 21:01:22

import sys

N = int(input())

c = 0


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

print("No")


Measured memory_bytes: 9164
#include<bits/stdc++.h>
using namespace std; 
#define ll long long int
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define INF LLONG_MAX
#define PI acos(-1)
#define MOD 1e9 + 7
#define fir first
#define sec second
#define all(x) x.begin(),x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
bool issec(ll x,ll y,ll z)
{
	ll n=y;
	vector<ll> v;
	v.pb(x);
	v.pb(y);
	v.pb(z);
	sort(all(v));
	if(n==v[1])
		return 1;
	return 0;
}
int main()
{
	IOS
	ll n;
	cin>>n;
	ll i=0;
	ll a[n];
	ll x,y,z,count=0;
	for(i=0;i<n;i++)cin>>a[i];

	for(i=1;i<n-1;i++)
	{
		x=a[i-1];
		y=a[i];
		z=a[i+1];
		if(issec(x,y,z))
			count++;
	}
	cout<<count;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;
using ll = long long;

int main(){
  int N;
  cin >> N;
  vector<int> p(N);
  for( int i=0; i<N; i++ ) cin >> p.at(i);
  
  int ans = 0;
  for( int i=1; i<N-1; i++ ){
    if( p.at(i-1) < p.at(i) && p.at(i) < p.at(i+1) ) ans++;
    if( p.at(i-1) > p.at(i) && p.at(i) > p.at(i+1) ) ans++;
  }
  
  cout << ans;
  return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::Integer;
#[allow(unused_imports)]
use proconio::derive_readable;
use proconio::fastout;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::collections::*;

#[fastout]
fn main() {
    input! {
        n: usize,
        d: i64,
        ps: [(i64, i64); n],
    }
    let ans = ps
        .into_iter()
        .filter(|&(x, y)| x * x + y * y <= d * d)
        .count();

    println!("{}", ans);
}


Measured memory_bytes: 7844
#include<stdio.h>

int main(){
  int x,y,z;
  scanf("%d %d %d",&x,&y,&z);
  if(x<y && x<z){
    printf("%d ",x);
    if(y<z) {
      printf("%d %d\n",y,z);
    }else{
      printf("%d %d\n",z,y);
    }
  }else if(y<x && y<z){
    printf("%d ",y);
    if(x<z) {
      printf("%d %d\n",x,z);
    }else{
      printf("%d %d\n",z,x);
    }
  }else{
    if(x<y){
      printf("%d %d %d\n",z,x,y);
    }else{
      printf("%d %d %d\n",z,y,x);
    }
  }
  return 0;
}

Measured memory_bytes: 596
// Vicfred
// https://atcoder.jp/contests/abc167/tasks/abc167_a
use std::io;

fn main() {
    let mut s = String::new();

    io::stdin()
        .read_line(&mut s)
        .unwrap();

    let s = s.trim();

    let mut t = String::new();

    io::stdin()
        .read_line(&mut t)
        .unwrap();

    let t = t.trim();

    if &s[0..] == &t[0..t.len()-1] {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2124
S = input()

mm = ('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12')

head = S[0:2]
tail = S[2:4]
if head in mm and tail in mm:
    print('AMBIGUOUS')
elif head in mm and tail not in mm:
    print('MMYY')
elif head not in mm and tail in mm:
    print('YYMM')
else:
    print('NA')


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


//dp[i+1][j]：i番目までの硬貨を使ってj円支払う時の使用硬貨の最小枚数
int dp[25][50005];

int main(){
	int n,m;
	cin >> n >> m;
	vector<int> c(m);
	rep(i,m){
		cin >> c[i];
	}
	
	rep(i,m+1){
		rep(j,n+1){
			dp[i][j] = 1 << 29;
		}
	}
	
	//初期条件
	rep(i,m+1){
		dp[i][0] = 0;
	}
	
	rep(i,m){
		rep(j,n+1){
			//i番目の硬貨を使わない場合
			dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
			//i番目の硬貨を使う場合
			if(j >= c[i]){
				dp[i+1][j] = min(dp[i+1][j], dp[i+1][j-c[i]]+1);
			}
		}
	}
	
	cout << dp[m][n] << endl;
    return 0;
}




Measured memory_bytes: 7196
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

A, B, C, D = map(int, input().split())

bc = B // C
bd = B // D
be = B // int((C*D/gcd(C, D)))
BB = B - bc - bd + be

ac = (A-1) // C
ad = (A-1) // D
ae = (A-1) // int(C*D/gcd(C, D))
AA = (A-1) - ac - ad + ae

print(BB-AA)

Measured memory_bytes: 3064
import sys
input = sys.stdin.readline

from collections import Counter

N = int(input())
S = [str(input()) for _ in range(N)]

C = Counter(S)

lst = [[] for _ in range(N + 1)]

saidai = 0
for c in C:
    lst[C[c]].append(c)
    saidai = max(saidai, C[c])

ans = lst[saidai]
ans.sort()
# print (ans)
for tmp in ans:
    print (tmp, end = '')

Measured memory_bytes: 47856
#include<bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int, int> P;

lint x[55], y[55];
vector<P> point;

int main(){
    int n, K; cin >> n >> K;
    for(int i=0;i<n;i++){
        cin >> x[i] >> y[i];
        point.push_back(P(x[i], y[i]));
    }

    sort(x, x+n); sort(y, y+n);

    lint ans = 1e20;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=0;k<n;k++){
                for(int l=k+1;l<n;l++){
                    int cnt = 0;
                    for(auto it : point)
                        if(x[i]<=it.first && it.first<=x[j] && y[k]<=it.second && it.second<=y[l]) cnt++;
                    if(K<=cnt) ans = min(ans, (x[j]-x[i])*(y[l]-y[k]));
                }
            }
        }
    }

    cout << ans << endl;
    return 0;
}


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

#define endl '\n'

int const N = 13, inf = 1e9;
int c[N], ma[N][N], n, m, x;
int used[N];

int solve(int ii, int usa){
    used[ii] = usa;
    if (ii == n-1){
        vector<int> skill(m);
        int cost = 0, ok = 1;
        for (int i=0; i<n; i++){
            if (!used[i]) continue;
            cost += c[i];
            for (int j=0; j<m; j++){
                skill[j] += ma[i][j];
            }
        }
        for (int i=0; i<m; i++) if (skill[i] < x) ok = 0;
        if (!ok) return inf;
        return cost;
    } else{
        return min(solve(ii+1, 1), solve(ii+1, 0));
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> m >> x;

    for (int i=0; i<n; i++){
        cin >> c[i];
        for (int j=0; j<m; j++){
            cin >> ma[i][j];
        }
    }
    int ans = min(solve(0,0), solve(0,1));
    if (ans == inf) cout << -1 << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 3656
H,W,K = map(int,input().split())
move= [0]*(W-1)
count = 0
MOD = 10**9+7

if W == 1:
    print(1)
    exit()

for i in range(2**(W-1),2**W):
    b = bin(i)[3:]
    flag = True
    for j in range(W-2):
        if b[j] == '1' and b[j+1] == '1':
            flag = False
    if flag :
        count += 1
        for j in range(W-1):
            move[j] += int(b[j])

DP = [[0]*W for i in range(H+1)]
DP[0][0] = 1
for i in range(H):
    for j in range(W):
        if j == 0:
            DP[i+1][j] = (DP[i][j]*(count - move[0]) + DP[i][j+1]*move[0])%MOD
        elif j == W-1:
            DP[i+1][j] = (DP[i][j-1] * move[j-1] + DP[i][j]*(count - move[j-1])) % MOD
        else:
            DP[i+1][j] = (DP[i][j-1] * move[j-1] + DP[i][j]*(count - move[j] - move[j-1]) + DP[i][j+1]*move[j]) % MOD
print(DP[-1][K-1])

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

//Function Macros:
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

//Type Definitions:
typedef long long ll;
typedef unsigned long long ull;

//Constants:
const int INF = 2e9;
const int MOD = 1e9 + 7;

//Global Variables:

//Prototype Declarations:
int gcd(int, int);

//================ Main Loop ================
int main()
{
    int N, K, cnt = 0;
    string S;
    cin >> N >> K >> S;
    int score = 0;
    rep(i, N - 1)
    {
        if (S[i] == S[i + 1])
            score++;
    }
    cout << min(score + 2 * K, N - 1) << endl;
    return 0;
}
//===========================================

//Functions:
int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}

Measured memory_bytes: 512
#include <stdio.h>

int main(void) {
    int n, a, fx;
    
    scanf("%d", &n);

    for (fx = 0, a = n; a > 0; a /= 10) {
        fx += a % 10;
    }

    puts((n % fx) == 0 ? "Yes" : "No");
    
    return 0;
}

Measured memory_bytes: 128