akhauriyash/Code-Regression huggingface dataset:
Scanf.scanf "%d %d" (fun n m ->
    let p = Array.init n (fun _ -> Scanf.scanf " %d" (fun p -> p - 1)) in
    let rev = Array.make n 0 in
    Array.iteri (fun i v -> rev.(v) <- i) p;
    let par = Array.init n (fun i -> i) in

    let rec root x =
        if x = par.(x) then x else
            let r = root par.(x) in
            let () = par.(x) <- r in
            r
    in

    let merge a b =
        if root a <> root b then par.(par.(b)) <- par.(a)
    in

    for i = 1 to m do
        Scanf.scanf " %d %d" (fun x y ->
            merge (x - 1) (y - 1)
        )
    done;
    let rec loop i acc =
        if i = n then acc else
            let acc = if root i = root rev.(i) then acc + 1 else acc in
            loop (i + 1) acc
    in
    loop 0 0 |> Printf.printf "%d\n"
)

Measured memory_bytes: 5888
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
using namespace std;

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

const long long INF = 1LL << 60;
int main()
{
	int n;
	int res = 0;
	cin >> n;
	int a[2][110];
	int k[2][110] = { 0 };
	for (int j = 0;j < 2;j++)for (int i = 0;i < n;i++) {
		cin >> a[j][i];
	}
	k[0][0] = a[0][0];
	k[1][0] = a[0][0] + a[1][0];
	for (int i = 1;i < n;i++) {
		k[0][i] = k[0][i - 1] + a[0][i];
	}
	for (int i = 1;i < n;i++) {
		k[1][i] = max(k[0][i], k[1][i - 1]) + a[1][i];
	}
	cout << k[1][n - 1] << endl;
}


Measured memory_bytes: 256
n,a,b=map(int,input().split())

mod=10**9+7

def repmod(n,m):
    if n==1:return 2
    nn = n // 2
    te = repmod(nn, m)
    if n%2==0:
        ans=(te*te)%mod
        return ans
    elif n%2==1:
        ans=(2*te*te)%mod
        return ans
def extgcd(a,b):
    a0,b0=a,b
    x0,y0=1,0
    x1,y1=0,1

    while b0!=0:
        q = a0 // b0
        r = a0 % b0

        a0,b0=b0,r
        temp=x1
        x0,x1=x1,x0-q*x1
        y0,y1=y1,y0-q*y1

    return a0,x0,y0

def mo(x,m):
    return (m+x%m)%m

def inv(a,m):
    g,x,y=extgcd(a,m)
    ans=mo(x,m)
    return ans

total=repmod(n,mod)-1

c=max(a,b)

temp=1
s=0
for i in range(c):
    temp=(temp*(n-i))%mod
    invi=inv(i+1,mod)
    temp=temp*invi
    if i+1==a:
        s+=temp
    if i+1==b:
        s+=temp

ans=(total-s)%mod
print(ans)

Measured memory_bytes: 3064
n, k = map(int, input().split())

maximum = (n-1) * (n-2) // 2
if k > maximum:
    print(-1)
    exit()

print(n - 1 + maximum - k)

for i in range(2, n+1):
    print(1, i)

remainder = maximum - k
for i in range(2, n):
    for j in range(i+1, n+1):
        if remainder <= 0:
            exit()
        print(i, j)
        remainder -= 1

Measured memory_bytes: 42736
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <set>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

int ans, N;
int P[10], Q[10], R[10];

int main(void) {
    scanf("%d", &N);
    rep(i, 0, N) {scanf("%d", &P[i]); R[i] = P[i];}
    rep(i, 0, N) scanf("%d", &Q[i]);

    int a, b;
    int stage = 0;

    sort(R, R+N);
    do {
        bool p = true;
        bool q = true;
        rep(i, 0, N) {
            if (R[i] != P[i]) p = false;
            if (R[i] != Q[i]) q = false;   
        }
        if (p) a = stage;
        if (q) b = stage;

        stage++;
      
    } while (next_permutation(R, R+N));
    

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

	return 0;
}


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

const int N=5e6+15;
const ll mo=1e9+7;
ll n,m,tot;
ll s[N],fac[N];
void div(ll x)
{
	for (int i=2;1ll*i*i<=x;i++)
	{
		if (x%i) continue;
		++tot;
		while (x%i==0) x/=i,s[tot]++;
	}
	if (x>1)
	{
		s[++tot]=1;
	}
}
ll qpow(ll a,ll b)
{
	ll re=1;
	for (;b;b>>=1,a=a*a%mo) if (b&1) re=re*a%mo;
	return re;
}
ll C(ll a,ll b)
{
	return fac[a]*qpow(fac[b],mo-2)%mo*qpow(fac[a-b],mo-2)%mo;
}
int main()
{
	fac[0]=1;
	for (int i=1;i<N;i++) fac[i]=fac[i-1]*i%mo;
	scanf("%lld%lld",&n,&m);
	div(m);
	ll ans=1;
	for (int i=1;i<=tot;i++)
	{
		ll now=C(s[i]+n-1,n-1);
		ans=ans*now%mo;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 41216
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading;

class Program
{

    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        int disticnt_Len = Console.ReadLine().Split(' ').Select(v => int.Parse(v)).Distinct().Count();
        if (n == disticnt_Len) Console.WriteLine("YES");
        else Console.WriteLine("NO");
    }




}

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

#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define lg long long
#define db double
#define lb(x) ((x)&-(x))
#define ft first
#define sd second

#define HII cerr<<"HI"<<endl
#define LLLINE cerr<<"@@@@@@@@@@@@@@@@@@@@"<<endl

template <class _T_>
void read(_T_& d){
	d=0;int f=1;char c=getchar();
	for(;c<'0'||c>'9';c=getchar())if(c=='-')f*=-1;
	for(;c>='0'&&c<='9';c=getchar())d=d*10+c-'0';
	d*=f;
}

/************************************************/
#define MN 200005
int n;
int v[MN];
int t[16];
int dp[MN];
int r[MN];
int main(){
	read(n);
	for(int i=1,x,y,z;i<n;++i){
		read(x);read(y);read(z);
		v[x]^=z;v[y]^=z;
	}
	for(int i=0;i<n;++i)++t[v[i]];
	int res=0;
	int h=0;
	for(int i=1;i<16;++i){
		res+=(t[i]+1)/2;t[i]%=2;h|=t[i]*(1<<i);
	}
	memset(dp,-0x3f,sizeof dp);
	dp[0]=0;
	for(int i=0;i<h;++i){
		for(int j=0;j<16;++j)if((1<<j)&i){
			r[i]^=j;
		}
	}
	for(int i=0;i<h;++i)if(dp[i]>=0){
		int S=h-i;
		for(int j=S;j;j=S&(j-1))if(r[j]==0){
			dp[i+j]=max(dp[i]+1,dp[i+j]);
		}
	}
	cout<<res-dp[h];
	return 0;
}


Measured memory_bytes: 1664
import std;

alias P = Tuple!(double, "x", double, "y");

double radians(double deg) {
    return PI * deg / 180.0;
}

P rotate(P p, double degree) {
    auto rad = radians(degree);
    auto x = p.x * cos(rad) - p.y * sin(rad);
    auto y = p.x * sin(rad) + p.y * cos(rad);
    return P(x, y);
}

double calc(double a, double b, double h, double m) {
    // 短針:
    //     1 周するのに 12 * 60 分
    //     現在の角度 = (60 * h + m) / (12 * 60) * 360
    // 長針:
    //     1 周するのに 60 分
    //     現在の角度 = m / 60 * 360

    auto s = rotate(P(0, a), (60 * h + m) / (12 * 60) * 360);
    auto t = rotate(P(0, b), m / 60 * 360);
    return hypot(s.x - t.x, s.y - t.y);
}

// 複素数を用いた解法
double calc2(double a, double b, double h, double m) {
    auto s = fromPolar(a, (60 * h + m) / (12 * 60) * 2 * PI);
    auto t = fromPolar(b, m / 60 * 2 * PI);
    return abs(s - t);
}

void main() {
    int a, b, h, m; scan(a, b, h, m);
    writefln("%.20f", calc2(a, b, h, m));
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T=string)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readints = reads!int;


Measured memory_bytes: 3924
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(void) {
	int bel[3];
	for (int i = 0; i < 3; i++) {
		scanf("%d", &bel[i]);
	}
	sort(bel, bel + 3);
	printf("%d", bel[0] + bel[1]);
	return 0;
}


Measured memory_bytes: 3716
#include<iostream>

using namespace std;
int main()
{
	int sum[300],N,i,j,k,ans=0;
	cin >> N;
	for(i=1; i<=N; i++){
		sum[0] =1;
		k = i;
		for(j=2; j<=N; j++){
			sum[j] = 0;
			if(k % j == 0){
				sum[j] += 2;
				k /= j;
				for(int l=0; l<5; l++){
					if(k % j == 0){
						sum[j]++;
						k /= j;
					}
				}
			}
			if(sum[j] != 0)
				sum[0] *= sum[j];
			}
		if(sum[0] == 8)
			ans++;
		i++;
	}
	cout << ans << endl;
	
	return 0;
}


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

#define ll long long
#define mk make_pair
#define pb push_back
#define fr first
#define sc second
#define vi vector < int >
#define pii pair < int, int >

const int N = 1e6 + 7;
const int INF = 1e18 + 7;

ll dp[200][N];
int w[N], c[N];
int n, cp;

main(){
    scanf("%d%d", &n, &cp);
    fill(dp[0], dp[0] + N, INF);
    dp[0][0] = 0;
    for (int i = 1; i <= n; i++){
        scanf("%d%d", &w[i], &c[i]);
    }
    for (int i = 1; i <= n; i++){
        for (int j = 0; j < N; j++){
            dp[i][j] = dp[i - 1][j];
            if (j >= c[i])
                dp[i][j] = min(dp[i - 1][j - c[i]] + w[i], dp[i][j]);
        }
    }
    for (int j = N - 1; j >= 0; j--){
        if (dp[n][j] <= cp){
            printf("%d", j);
            return 0;
        }
    }
    puts("0");
}


Measured memory_bytes: 794880
n,m = map(int, input().split())
height = list(map(int, input().split()))
c = 0
net = [[] for i in range(n)]
for j in range(m):
  a,b = map(int, input().split())
  net[a-1].append(height[b-1])
  net[b-1].append(height[a-1])
for i in range(n):
  net[i].append(0)
  if max(net[i]) < height[i]:
    c += 1
print(c)

Measured memory_bytes: 23992
//compiledef
#include <bits/stdc++.h>
#define rep(i, n) for(i=0;i<(n);i++)
#define per(i, n) for(i=(n);i>0;i--)
#define repx(i, n, x) for(i=(x);i<(n);i++)
#define xper(i, n, x) for(i=(n);i>(x);i--)
#define pback push_back

//c++def
using namespace std;
typedef long long int ll;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
int main(){
	int r[200001], n;
	int i, j, k, l;
	int mina, maxa;
	cin >> n;
	rep(i, n) cin >> r[i];
	maxa = r[1]-r[0];
	mina = r[0];
	repx(i, n, 1){
		maxa = max(maxa, r[i]-mina);
		mina = min(mina, r[i]);
	}
	cout << maxa << endl;
}




Measured memory_bytes: 3872
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
using namespace std;

/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define fi first
#define se second

using Graph = vector<vector<int>>;


int main() {
    int a,b,c;
    cin>>a>>b>>c;
    cout<<c<<" "<<a<<" "<<b<<endl;



    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

        int w = sc.nextInt();
        int n = sc.nextInt();
        int num[] = new int[w];
        int a,b,c;
        for(int i=0;i<w;i++){
            num[i]=i+1;
        }

        for(int i=0;i<n;i++){
            String str = sc.next();
            String pa[]=str.split(",");
            a=Integer.parseInt(pa[0])-1;
            b=Integer.parseInt(pa[1])-1;
            c=num[a];
            num[a]=num[b];
            num[b]=c;
        }
        for(int i=0;i<w;i++){
            System.out.println(num[i]);
        }

        sc.close();
    }
}



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


int main(void) {
  string s;
  string ans;
  rep(i, 3) {
    cin >> s;
    ans.push_back(toupper(s[0]));
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3620
import functools
N, M = (int(x) for x in input().split())
KA_arr = []
for i in range(N):
    KA_arr.append([int(x) for x in input().split()])

M_arr = [1]*M
for KA in KA_arr:
    for i in range(M):
        if not i+1 in KA[1:]:
            M_arr[i] = 0

ans = functools.reduce(lambda x,y:x+y, M_arr, 0)
print(ans)


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1'000'000'007;
const ll inf=1'000'000'000'000'000'00;
const int INF=1'000'000'000;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll a,b;
    cin>>a>>b;
    if(a>b) swap(a,b);
    if((a+b)%2) cout<<"IMPOSSIBLE"<<endl;
    else{
        ll k=(a+b)/2;
        if(a<k && k<b){
            cout<<k<<endl;
        }else{
            cout<<"IMPOSSIBLE"<<endl;
        }
    }
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<ll,pll> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=998244353;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;
vi a,b;

void add(int u,int v){
	a.push_back(u);
	b.push_back(v);
}

int main(){
	cin>>n;
	int t=0;
	for(int i=0;i<20;i++) t+=(n>>i)%2;
	if(t==1){
		cout<<"No"<<endl;
		return 0;
	}
	cout<<"Yes"<<endl;
	add(2,1);
	add(1,3);
	add(3,n+2);
	add(n+2,n+1);
	add(n+1,n+3);
	for(int i=4;i<n;i+=2){
		add(i,1);
		add(i+1,i);
		add(n+i+1,n+1);
		add(n+i,n+i+1);
	}
	if(n%2==0){
		t=1;
		while(2*t<=n) t*=2;
		add(n-t,n);
		add(2*n,n+t+1);
	}
	for(int i=0;i<2*n-1;i++) cout<<a[i]<<' '<<b[i]<<endl;
}

Measured memory_bytes: 4332
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	ll n,w ;
	cin >> n >> w ;
	vvll vec(4,vll(0)) ;
	ll a,b ; cin >> a >> b ;
	ll s = a ;
	vec.at(0).emplace_back(b) ;
	for(int i=1;i<n;i++){
		cin >> a >> b ;
		vec.at(a-s).emplace_back(b) ;
	}
	for(int i=0;i<4;i++) sort(all(vec.at(i))) ;
	for(int i=0;i<4;i++) reverse(all(vec.at(i))) ;
	ll ans = 0 ;
	ll c,d ;
	a = b = c = d = 0 ;
	for(int i=0;i<=vec.at(0).size();i++){
		if(i!=0) a += vec.at(0).at(i-1) ;
		for(int j=0;j<=vec.at(1).size();j++){
			if(j!=0) b += vec.at(1).at(j-1) ;
			for(int k=0;k<=vec.at(2).size();k++){
				if(k!=0) c += vec.at(2).at(k-1) ;
				for(int l=0;l<=vec.at(3).size();l++){
					if(l!=0) d += vec.at(3).at(l-1) ;
					if(s*i+(s+1)*j+(s+2)*k+(s+3)*l<=w){
						ans = max(ans,a+b+c+d) ;
					}
				}
				d = 0 ;
			}
			c = 0 ;
		}
		b = 0 ;
	}
	cout << ans << endl ;
}


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

#define tm tm228
#define hash hash228
#define matr vector < vector < int > >
#define int long long
#define pii pair < int, int >
#define tri pair < pair < int, int >, int >
#define all(v) v.begin(), v.end()
#define endl "\n"

using namespace std;

double binpow(double a, int b)
{
    if (b == 0)
        return 1.0;
    double t = binpow(a, b / 2);
    t *= t;
    if (b % 2)
        t *= a;
    return t;
}

void solve(){
    int l;
    cin >> l;
    double a = l / 3.0;
    cout << fixed << setprecision(6) << binpow(a, 3);
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int m = 1;
    //cin >> m;
    while (m--)
    {
        solve();
        cout << endl;
    }
    return 0;
}


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

using namespace std;

int main(){
    int N;
    cin >> N;
    string s, t;
    cin >> s >> t;
    
    int cnt = 0;
    for(int i = 1; i <= N; ++i){
        if(s.substr(N - i, i) != t.substr(0, i))        continue;
        
        cnt = i;
    }
    
    cout << N + N - cnt << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double PI = 3.14159265358979;
const double E = 2.718281828459045;
const double root2 = sqrt(2);
typedef pair<int, int> P;
typedef unsigned int ui;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int i;
	for (i = 0; i < 60; i++) {
		int t = (i * 60 + c) % (a + b);
		if (t<=a) {
			cout << i * 60 + c << endl; break;
		}
	}
	if (i == 60) {
		cout << -1 << endl;
	}
	return 0;
}



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

namespace ALDS1_1_A
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            var line = Console.ReadLine();
            var array = line.Split(' ').Select(int.Parse).Cast<int>().ToArray();
            insertionSort(array);
            Console.WriteLine(string.Join(" ", array.Select(e => e.ToString()).ToArray()));
        }
        static void insertionSort<T>(T[] array) where T: IComparable
        {
            // ?????\??????????´?????????????????????????
            for (var i = 1; i < array.Count(); i++)
            {
                Console.WriteLine(string.Join(" ", array.Select(e => "" + e).ToArray()));

                // ?????\??????????´?
                var v = array[i];

                var j = i - 1;
                while (0 <= j && v.CompareTo(array[j]) < 0)
                {
                    // ?????\??§????????????????????£???????´???????????????????
                    array[j + 1] = array[j];
                    j--;
                }
                // ???????????´???????????????
                array[j + 1] = v;
            }
        }
    }
}

Measured memory_bytes: 9792
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int r;
    cin >> r;
    cout << r*r << "\n";
    return 0;
}

Measured memory_bytes: 764
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
ans = ''
m = 2
cnt = 0
x = n
while 1:
    if x % m:
        ans += '1'
        x -= (-2)**(cnt)
    else:
        ans += '0'
    cnt += 1
    m *= 2
    if x == 0:
        break
print(ans[::-1])
    

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

int n,m,isfj,ans,a[100002],p,q,r;

int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		int dis;
		cin>>dis;
		if(dis%2==1)p++;
		if(dis%4==0)q++;
		if(dis%2==0&&dis%4!=0)r++;
	}
	if(p<=q+1&&r==0)cout<<"Yes"<<endl;
	else if(p<=q)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	//cin>>isfj;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb       push_back
#define mp       make_pair
#define mod      1000000007
#define first    ff
#define second   ss
#define pi       acos(-1.0)
#define test     int t;cin>>t;while(t--)
typedef long long ll;
using namespace std;
int a[28],b[28];

int main()
{      
     ios::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);
     
      ll n,cnt=0;
     
     cin>>n;
     string s;
     s=to_string(n);

     for(int i=0;i<s.size();i++)
       cnt+=(s[i]-'0');
     if(n%cnt)
      cout<<"No"<<endl;
     else
      cout<<"Yes"<<endl;


      return 0;
      
 }       


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

int n;
int x[205], y[205];
vector<int> al[205];
bool vis[205];
int match[205];

int aug(int l) {
    if (vis[l]) return 0;
    vis[l] = 1;
    for (int& r : al[l]) {
        if (match[r] == -1 || aug(match[r])) {
            match[r] = l;
            match[l] = r;
            return 1;
        }
    }
    return 0;
}

int main() {
    //freopen("in", "r", stdin);
    scanf("%d", &n);
    for (int i = 0; i < 2*n; ++i) {
        scanf("%d%d", &x[i], &y[i]);
    }

    for (int i = 0; i < n; ++i) {
        for (int j = n; j < 2*n; ++j) {
            if (x[i] < x[j] && y[i] < y[j]) {
                al[i].push_back(j);
                al[j].push_back(i);
            }
        }
    }

    memset(match, -1, sizeof match);
    int mcbm = 0;
    for (int l = 0; l < n; ++l) {
        for (int& r : al[l]) {
            if (match[r] == -1) {
                match[l] = r;
                match[r] = l;
                ++mcbm;
                break;
            }
        }
    }

    for (int l = 0; l < n; ++l) {
        if (match[l] == -1) {
            memset(vis, 0, sizeof vis);
            mcbm += aug(l);
        }
    }
    printf("%d\n", mcbm);
}


Measured memory_bytes: 256
#include<stdio.h>


void swap(int *a, int *b){
	int w = *a;
	*a = *b;
	*b = w;
}

int gojoho(int a, int b){
	if(b > a){
		swap(&a, &b);
	}
	while(1){
		int r = a % b;
		if(r == 0){
			break;
		}
		a = b;
		b = r;
	}
	return b;
}

int main(){
	int a, b;

	while(scanf("%d %d", &a, &b) != EOF){
		int g = gojoho(a, b);
		int l = a/g*b;
		printf("%d %d\n", g, l);
	}
	
	return 0;
}

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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}

template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int a, b; cin >> a >> b;
  cout << a * b << endl;

}
























Measured memory_bytes: 3608
n = int(input());
data = input().split();
co = int(1);
x = 0;

for v in range(n):
    if int(data[v]) == 0:
        x = x + 1;
    
for i in range(n):
    b = int(data[i]);
    co = co * b;
    if co > 1000000000000000000:
        co = -1;
        break;

if x == 0:
    print(co);
else:
    print(0);

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

int main(void) {
	int i;
	int W, H, N;
	int x, y, a;
	int l, r, t, b;
	int S;
	char buf[128], *ch;

	fgets(buf, sizeof(buf), stdin);
	ch = strtok(buf, " ");
	W = atoi(ch);
	ch = strtok(NULL, " ");
	H = atoi(ch);
	ch = strtok(NULL, " ");
	N = atoi(ch);

	l = 0;
	r = W;
	t = H;
	b = 0;

	for(i = 0; i < N; i += 1) {
		fgets(buf, sizeof(buf), stdin);
		ch = strtok(buf, " ");
		x = atoi(ch);
		ch = strtok(NULL, " ");
		y = atoi(ch);
		ch = strtok(NULL, " ");
		a = atoi(ch);
		if(a == 1) {
			if(x > l) {
				l = x;
			}
		} else if (a == 2) {
			if(x < r) {
				r = x;
			}
		} else if (a == 3) {
			if(y > b) {
				b = y;
			}
		} else {
			if(y < t) {
				t = y;
			}
		}
	}

	S = (r - l) * (t - b);
	if((r - l) < 0 || (t - b) < 0) {
		printf("0\n");
	} else {
		printf("%d\n", S);
	}

	return 0;
}


Measured memory_bytes: 2132
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main() {
  long N;
  cin >> N;
  
  vector<long> costs(N, 0);
  for (long i = 0; i < N; ++i) cin >> costs[i];

  vector<long> dp(N, 0);
  dp[1] = abs(costs[1] - costs[0]);
  for (long i = 2; i <= N; ++i) {
    dp[i] = min(dp[i-2] + abs(costs[i] - costs[i-2]), dp[i-1] + abs(costs[i] - costs[i-1]));
  }
  cout << dp[N-1] << std::endl;
    
  return 0;
}

Measured memory_bytes: 1792
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>  
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 10000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD  998244353
#define REP(i,n) for(long long i = 0;i < n;++i)
long long dp[5000][5000] = {};
long long bobo[10000] = {};
long long inverse[10000] = {};
long long inv(long long now) {
	long long ans = 1;
	long long te = MAX_MOD - 2LL;
	while (te != 0) {
		if (te % 2 == 1) {
			ans *= now;
			ans %= MAX_MOD;
		}
		te /= 2;
		now *= now;
		now %= MAX_MOD;
	}
	return ans;
}
int main() {
	int n;
	cin >> n;
	vector<pair<int, int>> now_go;
	REP(i, n) {
		int a, b;
		cin >> a >> b;
		dp[2000 - a][2000 - b]++;
		now_go.push_back(make_pair(2000+a, 2000+b));
	}
	for (int i = 0; i <= 4000; ++i) {
		for (int q = 0; q <= 4000; ++q) {
			dp[i + 1][q] += dp[i][q];
			dp[i + 1][q] %= MAX_MOD;
			dp[i][q + 1] += dp[i][q];
			dp[i][q + 1] %= MAX_MOD;
		}
	}
	bobo[1] = 1;
	inverse[1] = 1;
	for (long long i = 2; i <= 8000; ++i) {
		bobo[i] = i * bobo[i - 1];
		bobo[i] %= MAX_MOD;
		inverse[i] = inv(bobo[i]);
	}
	long long ans = 0;
	REP(i, now_go.size()) {
		ans += dp[now_go[i].first][now_go[i].second];
		ans %= MAX_MOD;
		now_go[i].first -= 2000;
		now_go[i].second -= 2000;
		long long geko = bobo[(now_go[i].first + now_go[i].second)*2];
		geko *= inverse[now_go[i].first * 2];
		geko %= MAX_MOD;
		geko *= inverse[now_go[i].second * 2];
		geko %= MAX_MOD;
		ans -= geko;
		ans += MAX_MOD;
		ans %= MAX_MOD;
	}
	ans *= MAX_MOD / 2LL + 1LL;
	ans %= MAX_MOD;
	cout << ans << endl;
	return 0;
}

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

#define int long long
int A, B;

void solve() {
	cin >> A >> B;
	if (A > B) swap(A, B);
	long long prod = 1LL * A * B;
	--prod;
	if (!prod) {
		printf("0\n"); return;
	}

	int s = sqrt(prod);
	if (1LL * (s + 1) * (s + 1) <= prod) ++s;
	if (1LL * s * s > prod) --s;

	long long res = s + s;
	if (s == prod / s) --res;

	// A
	if (A <= s) --res;

	// B
	int a = prod / B;
	if (a && B == prod / a) --res;

	printf("%lld\n", max(0LL, res)); 
}

main() {
	int tt;
	cin >> tt;
	while(tt--) {
		solve();
	}
}

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

int a, b, c;
string s;
int main()
{
	int i;
	cin >> a >> b >> s;
	for (i = 0; i < s.size(); i++) {
		if (s[i] == '-') {
			if (c) {cout << "No"; return 0;}
			c = i;
		}
	}
	if (c == a && a + b + 1 == s.size()) cout << "Yes";
	else cout << "No";
    return 0;
}

Measured memory_bytes: 256
s=list(input())
t=list(input())
result=0
#count=0
for i in range(len(s)-len(t)+1) :
    count=0
    for n in range(len(t)):
        if s[i+n]==t[n]:
            count += 1
        #s[i:i+len(t)] == t
    
    if count>result:
        result=count


print(len(t)-result)

Measured memory_bytes: 9060
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a
  
def gcd3(a,b,c):
    return gcd(gcd(a,b),c)
    
k= int(input())    
total = 0
for i in range(1,k+1):
    for ii in range(1,k+1):
        for iii in range(1,k+1):
            total += gcd3(i,ii,iii)
 
print(total)

Measured memory_bytes: 74024
package main

import (
	"fmt"
)

var n string

func main() {
	fmt.Scan(&n)
	a := "abcdefghijklmnopqrstuvwxyz"
	for i, aa := range a {
		if string(aa) == n {
			fmt.Print(string(a[i+1]))
		}
	}
}


Measured memory_bytes: 512
c=[0 for _ in range(3)]
for i in range(3):
    c[i] = list(map(int,input().split()))
for i in range(2):
    if c[i][0]-c[i+1][0] != c[i][1]-c[i+1][1] or c[i][1]-c[i+1][1] != c[i][2]-c[i+1][2] :
        print("No")
        exit()
for i in range(2):
    if c[0][i]-c[0][i+1] != c[1][i]-c[1][i+1] or c[1][i]-c[1][i+1] != c[2][i]-c[2][i+1] :
        print("No")
        exit()
print("Yes")


Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> void pr_vec(vector<T> &v, char ep=' '){int n=v.size();REP(ni,n){cout<<v[ni];if(ni!=n-1)cout<<ep;}cout<<endl;};
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int N;
    cin >> N;
    vector<string> S(N);
    REP(i, N) cin >> S[i];
    vector<vector<int>> c(N);
    REP(i, N)REP(j, N) if(S[i][j]=='1') c[i].pb(j);

    int ans = -100;
    REP(i, N){
        chmax(ans, [&](){
            vector<int> ok(N, -10);
            queue<int> q; q.push(i);
            ok[i] = 1;
            while(!q.empty()){
                auto f = q.front(); q.pop();
                for(auto&& ci : c[f]){
                    if(ok[ci]==-10){
                        ok[ci] = ok[f]+1;
                        q.push(ci);
                    }else if(ok[ci]!=ok[f]-1&&ok[ci]!=ok[f]+1){
                        return -1;
                    }
                }
            }
            return *(max_element(ALL(ok)));
        }());
    }
    pr(ans);
}

Measured memory_bytes: 3844
#include <iostream>
#include <bitset>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
using namespace std;
using ll = long long int;
#define REP(i,n) for(int i=0;i<n;i++)

int main()
{
    int N, K;
    cin >> N >> K;

    int ans = 1;
    for (int i = 0; i < N; i++)
    {
        ans = min(2*ans, ans+K);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        long k = sc.nextLong();
        int x = sc.nextInt();
        int m = sc.nextInt();
        
        // ans:
        // array = {2,4,<16,256,471,620>}について、
        // 「i=0からスタートし、">"まで来たら"<"に戻る」ルールで、
        // 操作「今いるarray[i]の値を加算し、i++する」をk回したときの合計
        
        // array: a[i+1] = (a[i] * a[i]) % m
        
        // how: ρの形で考えて3パターンでそれぞれ集計する。
        
        Set<Integer> set = new HashSet<Integer>();
        List<Integer> list = new ArrayList<Integer>();
        int now = x;
        set.add(now);
        list.add(now);
        int last = 0;
        for (long i = 0; i < k; i++) {
            now = (int)((long)now * now % m);
            if (set.contains(now)) {
                last = now;
                break;
            } else {
                set.add(now);
                list.add(now);
            }
        }
        // System.out.println(list.toString());
        
        int loop_idx = 0;
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i) == last) {
                loop_idx = i;
            }
        }
        
        long ans = 0;
        
        // [start, loop始点)
        for (int i = 0; i < loop_idx; i++) {
            ans += list.get(i);
        }
        k -= loop_idx;
        
        // [loop始点, loop終点] * 何周できるか
        long loop_sum = 0;
        for (int i = loop_idx; i < list.size(); i++) {
            loop_sum += list.get(i);
        }
        long len = list.size() - loop_idx;
        long block = k / len;
        ans += loop_sum * block;
        k %= len;
        
        // [loop始点, 残りの移動回数]
        for (int i = loop_idx; i < loop_idx + k; i++) {
            ans += list.get(i);
        }
        
        System.out.println(ans);
    }
}

Measured memory_bytes: 43968
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=998244353;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};




int main(){
    LL n,k;cin >> n >> k;
    cout << min(abs(n%k),abs(k - n%k)) << 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;

//#define DEBUG


int main(void)
{
  string S;
  cin >> S;
  int len;
  len = S.length(); 
  int count=0;  
  
  for(int i=0;i<len/2;i++)
  {
    if(S[i]!=S[len-i-1]) count++;
//    cout << S[i] << "," << S[len-i-1] << endl;
  }
  
  cout << count;
  
  return 0;
} 

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


int main(){
    int n;
    cin >> n;
    bool ok = true;
    rep(i,n){
        int a;
        cin >> a;
        if(a%2 == 0){
            if(a%3 != 0 && a%5 != 0) ok = false;
        }
    }
    if(ok) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
	Scanner sc;
	int N, M;
	int[] a;
	int[] k;
	
	int[] min;
	int n;
	
	public Main() {
		sc = new Scanner(System.in);
	}
	
	private void calc() {
		N = sc.nextInt();
		M = sc.nextInt();
		a = new int[M];
		k = new int[M];
		
		for (int i = 0; i < M; i++) {
			a[i] = sc.nextInt();
			int b = sc.nextInt();
			for (int j = 0; j < b; j++) k[i] |= (1<<(sc.nextInt()-1));
		}
		n = 1<<N;
		min = new int[n];
		for (int i = 1; i < n; i++) min[i] = Integer.MAX_VALUE/2;
		
		for (int i = 0; i < M; i++)
			for (int j = 0; j < n; j++)
				min[j|k[i]] = Math.min(min[j|k[i]], min[j]+a[i]);
		
		if (min[n-1] >= Integer.MAX_VALUE/2) System.out.println(-1);
		else System.out.println(min[n-1]);
	}
	
	public static void main(String[] args) {
		new Main().calc();
	}
}


Measured memory_bytes: 32212
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
d = {}
a = []
for i in range(n):
    aa = ni()
    d[aa] = i
    a.append(aa)

a.sort()
c = 0
for j in range(n):
    p = a[j]
    if (d[p]-j)%2 == 1:
        c += 1

print((c-1)//2+1)

Measured memory_bytes: 18580
import java.util.*;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// get a integer
		int a = sc.nextInt();
		// get two integers separated with half-width break
		int b = sc.nextInt();
		int c = sc.nextInt();
		// get a string
		//String s = sc.next();
		// output
		int res = (a+b)*c;
		res = res / 2;
		System.out.println(res);
	}
	
}

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

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

#define pb push_back
#define mp make_pair
#define all(_c) _c.begin(), _c.end()

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

    ld T, X; cin >> T >> X;
    cout << fixed << setprecision(20) << T/X << '\n';
    return 0;
}


Measured memory_bytes: 256
import sys
import itertools
input = sys.stdin.readline


def read_values():
    return map(int, input().split())


def read_list():
    return list(read_values())


def read_lists(N):
    return [read_list() for n in range(N)]


def f(n):
    if n < 2:
        return 1
    
    return n * f(n - 2)


def main():
    N = int(input())
    if N % 2 == 1:
        print(0)
        return

    N //= 2
    res = 0
    while N > 0:
        N //= 5
        res += N
    print(res)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;
const int INF=1e9;

int main(){
    string s;
    cin>>s;
    map<char, int> mp;
    for(auto it: s) mp[it]++;
    for(char it='a'; it<='z'; it++){
        if(!mp[it]){
            cout<<it<<endl;
            return 0;
        }
    }
    cout<<"None"<<endl;
}



Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <cmath>
 
using namespace std;

int count(int n){
    if(n<=1){
        return 0;
    }
    return n*(n-1)/2;
}

int main() {
    
    int N,M,ans;

    // input
    cin >> N >> M;

    ans = count(N) + count(M);

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

Measured memory_bytes: 256
#include <iostream>

int main(int argc, char **argv){
	int a = 0;
	int b = 0;
	int c = 0;
	int n = 0;

	std::cin >> a >> b >> c;

	for(int i = a; i <= b; i++){
		if(c % i == 0){n++;}
	}
	std::cout << n << std::endl;
	return 0;
}

Measured memory_bytes: 3112
/* Simplicity and Goodness */

#include <bits/stdc++.h>
using namespace std;
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld ",n)
#define pri(n) printf("%d ",(int)n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define deb(x) cout << #x << ' ' << x << '\n'
#define rep(i,ini,n) for(int i=ini;i<(int)n;i++)
#define per(i,ini) for(int i=ini;i>=0;i--)
#define tc int tt; scn(tt); while(tt --)
#define pb push_back
#define mp make_pair
#define F first
#define S second
using ll = long long;
const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 998244353;
// const int N = 1e5+2;

int N, M, Q;
vector<int> a, b, c, d;
int ans;

void dfs(vector<int> A)
{
	if(A.size() == N+1)
	{
		int here = 0;
		for(int i=0; i<Q; i++)
		if(A[b[i]] - A[a[i]] == c[i])
		here += d[i];

		ans = max(ans, here);
		return;
	}

	A.pb(A.back());

	while(A.back() <= M)
	{
		dfs(A);
		A.back() ++;
	}
}

int main()
{
    scanf("%d%d%d", &N, &M, &Q);

    a = b = c = d = vector<int> (Q);

    rep(i, 0, Q)
    scanf("%d%d%d%d", &a[i], &b[i], &c[i], &d[i]);

    dfs(vector<int> (1, 1));

    prin(ans);

    return 0;
}

Measured memory_bytes: 3788
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* struct for mod Calculation*/
struct mint {
    ll x;
    mint(ll x = 0):x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod - 2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
/* global variables */
/* function */
/* main */
int main(){
    int N;
    cin >> N;
    int l = 64;
    vector<vector<mint> > dp(N+5, vector<mint>(l));

    dp[0][3*16+3*4+3] = 1;
    for (int n = 0; n < N; n++) {
        for (int i = 0; i < 4; i++) {
            for(int j = 0; j < 4; j++) {
                for (int k = 0; k < 4; k++) {
                    if (dp[n][i*16+j*4+k].x == 0) continue;
                    for (int l = 0; l < 4; l++) {
                        if (j == 0 && k == 1 && l == 2) continue;
                        if (j == 0 && k == 2 && l == 1) continue;
                        if (j == 1 && k == 0 && l == 2) continue;
                        if (i == 0 && j == 1 && l == 2) continue;
                        if (i == 0 && k == 1 && l == 2) continue;
                        dp[n+1][j*16+k*4+l] += dp[n][i*16+j*4+k];
                    }
                }
            }
        }
    }
    mint ans = 0;
    for (int i = 0; i < l; i++) ans += dp[N][i];
    cout << ans << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
#define mod 1000000007
using namespace std;
const int N = 1010;
int dp[N][N];
char str[N][N];
int main(){
	int n, m;
	cin >> n >> m;
	for(int i = 0; i < n; i++)
		for(int j = 0; j < m; j++)
			cin >> str[i][j];
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			if(str[i][j] == '#')
				dp[i][j] = 0;
			else if(i == 0 && j == 0)
				dp[i][j] = 1;
			else if(j == 0)
				dp[i][j] = dp[i - 1][j];
			else if(i == 0)
				dp[i][j] = dp[i][j - 1];
			else
				dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % mod;
		}
	}
	cout << dp[n - 1][m - 1] << "\n";
	return 0;
}


Measured memory_bytes: 8496
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	string s;
	cin>>s;
	ll ans[100010]={};
	ll l=0;
	ll r=0;
	for(ll i=0;i<s.size();i++){
		if(s[i]=='R'){
			r++;
			swap(l,r);
		}
		else{
			ans[i-1]+=l;
			ans[i]+=r;
			l=r=0;
		}
	}
	ans[s.size()-1]+=l+r;
	l=r=0;
	for(ll i=s.size()-1;i>=0;i--){
		if(s[i]=='L'){
			l++;
			swap(l,r);
		}
		else{
			ans[i]+=l;
			ans[i+1]+=r;
			l=r=0;
		}
	}
	ans[0]+=l+r;
	for(ll i=0;i<s.size();i++){
		cout<<ans[i]<<" ";
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 1408