akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  string s, t;
  ll a, b, c, d, e, f, x, y, z, n, m;

  cin >> s;
  n = s.size();
  f = 1;
  if (s.size()%2 == 0) {
    rep(i, n) {
      if (s.substr(i, 2) != "hi") {
        f = 0;
        break;
      }
      i++;
    }
  } else {
    f = 0;
  }
  if (f) {
    cout <<"Yes" << endl;
  } else {
    cout <<"No" << endl;
  }
}


Measured memory_bytes: 256
n=int(input())
m=1000000000
l=[0,0]
if(n<=m):
    l.append(1)
    l.append(0)
    l.append(0)
    l.append(n)
elif(n == 1000000000000000000):
    l.append(m)
    l.append(0)
    l.append(0)
    l.append(m)
else:
    l.append(m)
    l.append(1)
    x=n%m
    l.append(m-x)
    l.append(((n)//m)+1)
for i in l:
    print(i,end=" ")



Measured memory_bytes: 38384
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int N = in.nextInt();
            range[] rs = new range[N];
            for (int i = 0; i < N; i++) {
                int X = in.nextInt();
                int L = in.nextInt();
                rs[i] = new range();
                rs[i].l = X - L;
                rs[i].r = X + L;
            }
            Arrays.sort(rs, (range f, range s) -> f.r - s.r);
            int lastR = rs[0].r;
            for (int i = 1; i < N; i++) {
                if (rs[i].l >= lastR) {
                    lastR = rs[i].r;
                } else {
                    rs[i].used = false;
                }
            }
            int ans = 0;
            for (int i = 0; i < N; i++) {
                if (rs[i].used) {
                    ans++;
                }
            }
            out.println(ans);
        }

    }

    static class range {
        int l;
        int r;
        boolean used = true;

    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer stt;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        public String next() {
            while (stt == null || !stt.hasMoreTokens()) {
                stt = new StringTokenizer(nextLine());
            }
            return stt.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 44476
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl
#define show2(a, n, m) rep(i, n) { rep(j, m) {cout << a[i][j] << ' ';} cout << endl;} 
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<long long, long long> pll;
typedef long double ld;

const int INF = 1 << 30;
const long long INFL = 1LL << 60;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

void fills(vector<vi>& s) {
	int h = s.size();
	rep(j, 5) {
		int d = h-1;
		for(int i = h-1; i >= 0; i--) {
			if(s[i][j] == 0) continue;
			swap(s[i][j], s[d][j]);
			d--;
		}
	}
}

int delsl(vi& s) {
	int len = 0;
	int l = 0, r = 0;
	for(r = 1; r < 5; r++) {
		if(s[l] != s[r]) {
			if(len >= 3) break;
			else l = r;
		}
		else if(r - l >= 2) {
			chmax(len, r - l + 1);
		}
	}
	int ret = s[l] * len;
	for(int i = l; i < len + l; i++) s[i] = 0;
	return ret;
}

int dels(vector<vi>& s) {
	int ret = 0;
	int h = s.size();
	rep(i, h) ret += delsl(s[i]);
	return ret;
}

int score(vector<vi>& s) {
	int ret = 0;
	int add;
	while(add = dels(s)) {
		ret += add;
		fills(s);
	}
	return ret;
}

int main() {
//	cout << fixed << setprecision(15);
	int h;
	vi ans;
	while(true) {
		cin >> h;
		if(h == 0) break;
		vector<vi> s(h, vi(5));
		rep(i, h) rep(j, 5) cin >> s[i][j];
		ans.push_back(score(s));
	}
	for(auto i: ans) cout << i << endl;
}



Measured memory_bytes: 3180
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
    int a, b, c, d;
    scanf("%d%d%d%d", &a, &b, &c, &d);
    printf("%s\n", (c + b - 1) / b <= (a + d - 1) / d ? "Yes" : "No");
    return 0;
}

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

int main(){
    int m,f,r;
    while(1){
        cin>>m>>f>>r;
        if(m==(-1) && f==(-1) && r==(-1))break;

        if(m==(-1)||f==(-1))cout<<"F"<<endl;
        else if(m+f>=80)cout<<"A"<<endl;
        else if(m+f>=65)cout<<"B"<<endl;
        else if(m+f>=50)cout<<"C"<<endl;
        else if(m+f>=30){
            if(r>=50)cout<<"C"<<endl;
            else cout<<"D"<<endl;
        }else cout<<"F"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3096
import java.util.*;
public class Main {
    
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] happiness = new int[n][3];

        for(int ind = 0; ind < n; ind++) {

            happiness[ind][0] = sc.nextInt();
            happiness[ind][1] = sc.nextInt();
            happiness[ind][2] = sc.nextInt();
        }

        int[][] dp = new int[n][3];

        dp[0][0] = happiness[0][0];
        dp[0][1] = happiness[0][1];
        dp[0][2] = happiness[0][2];

        for(int ind = 1; ind < n; ind++) {

            dp[ind][0] = happiness[ind][0] + Math.max(dp[ind - 1][1], dp[ind - 1][2]);
            dp[ind][1] = happiness[ind][1] + Math.max(dp[ind - 1][0], dp[ind - 1][2]);
            dp[ind][2] = happiness[ind][2] + Math.max(dp[ind - 1][0], dp[ind - 1][1]);
        }

        System.out.println(Math.max(dp[n - 1][1], Math.max(dp[n - 1][0], dp[n - 1][2])));
    }
}


Measured memory_bytes: 63944
#string = ' '.join(list(input() for _ in range(int(input()))))
n = int(input())
a = list(map(float,input().split()))
dp = [[0 for i in range(n+1)] for j in range(n+1)]
dp[0][0] = 1.0
for i in range(1,n+1):
    for j in range(n+1):
        if j==0:
            dp[i][j] = (1-a[i-1])*(dp[i-1][j])
        else:
            dp[i][j] = (a[i-1]*dp[i-1][j-1])+((1.0-a[i-1])*dp[i-1][j])
ans = 0.0
for i in range((n//2)+1,n+1):
    ans+=dp[n][i]
print(ans)
        


Measured memory_bytes: 259848
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
     string c;
     cin>>c;
     int k=c.size()-1;
     if(c[k]=='2' ||c[k]== '4'||c[k]=='5'||c[k]== '7'||c[k]== '9')cout<<"hon"<<endl;
     else if(c[k]=='0' ||c[k]== '1'||c[k]=='6'||c[k]== '8')cout<<"pon"<<endl;
     else cout<<"bon"<<endl;
}


Measured memory_bytes: 3624
public class Main {
  private static void solve() {
    int n = ni();
    int m = ni();
    int[] s = new int[m];
    for (int i= 0; i < m; i ++ ) {
      int k = ni();
      for (int j = 0; j < k; j ++) {
        s[i] |= 1 << (ni() - 1);
      }
    }
    int[] p = na(m);
    int ret = 0;
    for (int i = 0; i < (1 << n); i ++) {
      int cnt = 0;
      for (int j = 0; j < m; j ++) {
        if (Integer.bitCount(s[j] & i) % 2 == p[j]) cnt ++;
      }
      if (cnt == m) ret ++;
    }
    System.out.println(ret);
    
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 23252
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	io := newIo()
	defer io.Flush()
	_, m := io.NextInt(), io.NextInt()
	yearCity := make(map[int]int)
	cityYear := make([]int, m)
	cityPref := make([]int, m)
	prefYears := make(map[int][]int)
	cityRates := make([]int, m)
	for city := 0; city < m; city++ {
		pref, year := io.NextInt(), io.NextInt()
		yearCity[year] = city
		cityYear[city] = year
		cityPref[city] = pref
		prefYears[pref] = append(prefYears[pref], year)
	}
	for _, years := range prefYears {
		sort.Ints(years)
		for i, year := range years {
			rate := i + 1
			city := yearCity[year]
			cityRates[city] = rate
		}
	}
	for city := 0; city < m; city++ {
		pref := cityPref[city]
		rate := cityRates[city]
		fmt.Printf("%06d", pref)
		fmt.Printf("%06d", rate)
		fmt.Println("")
	}
}

type io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func newIo() *io {
	return &io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *io) PrintIntLn(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func (io *io) PrintStringLn(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}


Measured memory_bytes: 20352
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c;
  cin >> c;
  if (c == 'a'){
	cout << "vowel" << endl;
  }
  else if(c == 'i'){
	cout << "vowel" << endl;
  }
  else if (c == 'u'){
	cout << "vowel" << endl;
  }
  else if(c == 'e'){
    cout << "vowel" << endl;
  }
  else if (c == 'o'){
	cout << "vowel" << endl;
  }
  else{
	cout << "consonant" << endl;
  }
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
vector <int> des[100010];
int dfs(int s,int pre=0)
{
	int all=0,dou=0,p=0;
	for (int k=0;k<des[s].size();k++) if (des[s][k]!=pre) {int p=dfs(des[s][k],s);dou|=all&p;all|=p;}
	while (((1<<p)<dou)||(all&(1<<p))) p++;
	return (all>>p<<p)|(1<<p);
}
int main()
{
	int n;scanf("%d",&n);
	for (int i=1;i<n;i++)
	{
		int u,v;scanf("%d%d",&u,&v);
		des[u].push_back(v);
		des[v].push_back(u);
	}
	printf("%d\n",(int)log2(dfs(1)));
}

Measured memory_bytes: 11392
#include<bits/stdc++.h>
#include<iostream>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<int,ll>Pil;
typedef pair<P1,ll> P2;
typedef pair<string,string> Ps;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct pos{
	// 1 変数を入れる;
	int x,y;
};

int main() {

	while(1){
		int w,h;
		cin>>w>>h;
		if(w==0&&h==0)return 0;
		int c[51][51]={},dp[51][51]={};
		rep(i,h)rep(j,w)cin>>c[j][i];

		int ans=0;
		rep(i,h){
			rep(j,w){
				if(c[j][i]==0||dp[j][i]==1)continue;
				ans++;
				queue<pos> que;
				pos pos1={j,i};
				que.push(pos1);
				dp[j][i]=1;
				while(!que.empty()){
					pos pos2=que.front();que.pop();
					if(dp[pos2.x+1][pos2.y]==0&&c[pos2.x+1][pos2.y]==1){
						pos pos3={pos2.x+1,pos2.y};
						dp[pos2.x+1][pos2.y]=1;
						que.push(pos3);
					}
					if(dp[pos2.x-1][pos2.y]==0&&c[pos2.x-1][pos2.y]==1){
						pos pos4={pos2.x-1,pos2.y};
						dp[pos2.x-1][pos2.y]=1;
						que.push(pos4);
					}
					if(dp[pos2.x][pos2.y+1]==0&&c[pos2.x][pos2.y+1]==1){
						pos pos5={pos2.x,pos2.y+1};
						dp[pos2.x][pos2.y+1]=1;
						que.push(pos5);
					}
					if(dp[pos2.x][pos2.y-1]==0&&c[pos2.x][pos2.y-1]==1){
						pos pos6={pos2.x,pos2.y-1};
						dp[pos2.x][pos2.y-1]=1;
						que.push(pos6);
					}
					if(dp[pos2.x+1][pos2.y-1]==0&&c[pos2.x+1][pos2.y-1]==1){
						pos pos7={pos2.x+1,pos2.y-1};
						dp[pos2.x+1][pos2.y-1]=1;
						que.push(pos7);
					}
					if(dp[pos2.x+1][pos2.y+1]==0&&c[pos2.x+1][pos2.y+1]==1){
						pos pos8={pos2.x+1,pos2.y+1};
						dp[pos2.x+1][pos2.y+1]=1;
						que.push(pos8);
					}
					if(dp[pos2.x-1][pos2.y+1]==0&&c[pos2.x-1][pos2.y+1]==1){
						pos pos9={pos2.x-1,pos2.y+1};
						dp[pos2.x-1][pos2.y+1]=1;
						que.push(pos9);
					}
					if(dp[pos2.x-1][pos2.y-1]==0&&c[pos2.x-1][pos2.y-1]==1){
						pos pos10={pos2.x-1,pos2.y-1};
						dp[pos2.x-1][pos2.y-1]=1;
						que.push(pos10);
					}
				}
			}
		}
		cout<<ans<<endl;
	}

	return 0;
}



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

int main(){
  vector<ll>com(100001);
  com.at(0)=0;com.at(1)=0;
  for(ll i=2;i<=100000;i++){
    com.at(i)=i*(i-1)/2;
  }
  
  int N;cin>>N;
  vector<string>s(N);
  for(int i=0;i<N;i++){
    cin>>s.at(i);
    sort(s.at(i).begin(),s.at(i).end());
    //cout<<s.at(i)<<endl;
  }
  
  sort(s.begin(),s.end());
  
  ll res=0;
  int count=0;

  for(int i=1;i<N;i++){
    if(s.at(i)==s.at(i-1)){
      count++;
    }
    else{
      res+=com.at(count+1);
      count=0;
    }
  }
  res+=com.at(count+1);
  
  cout<<res;
}
  



Measured memory_bytes: 8064
#include<bits/stdc++.h>
#define mod 1000000007
#define N 109
#define ad(x,y) (x=(x+(y))%mod)
using namespace std;

int n,m,a[N],dp[N][N][N];
int main(){
	scanf("%d",&n); m=(n<<1)-1;
	int i,j,k,l,x,y;
	for (i=1; i<=m; i++) scanf("%d",&a[i]);
	sort(a+1,a+m+1);
	dp[1][1][1]=1;
	for (i=1; i<n; i++)
		for (j=1; j<=m; j++)
			for (k=1; k<=j; k++) if (dp[i][j][k]){
				x=j; y=k;
				if (a[n-i]!=a[n-i+1]){ x++; y++; }
				if (a[n+i]!=a[n+i-1]) x++;
				for (l=1; l<y; l++) ad(dp[i+1][x-(y-l-1)][l],dp[i][j][k]);
				ad(dp[i+1][x][y],dp[i][j][k]);
				for (l=y+1; l<=x; l++) ad(dp[i+1][x-(l-y-1)][y+1],dp[i][j][k]);
			}
	int ans=0;
	for (i=1; i<=m; i++)
		for (j=1; j<=i; j++) ad(ans,dp[n][i][j]);
	printf("%d\n",ans);
	return 0;
}


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

int main(){
  string S;
  cin >> S;
  string ans;
  if(S[0]==S[1]&&S[2]==S[3]&&S[0]!=S[2])ans="Yes";
  else if(S[0]==S[2]&&S[1]==S[3]&&S[0]!=S[1])ans="Yes";
  else if(S[0]==S[3]&&S[1]==S[2]&&S[0]!=S[1])ans="Yes";
  else ans="No";
  
  cout << ans << endl;
}

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

int main(){
  string a;
  int b0=0,b1=0,c0=0,c1=0;
  cin>>a;
  for(int i=0;i<a.size();i+=2){
    if(a.at(i)=='0')
      b0++;
    else
      b1++;
  }
  for(int i=1;i<a.size();i+=2){
    if(a.at(i)=='0')
      c0++;
    else
      c1++;
  }
  cout<<min(b0+c1,b1+c0)<<endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
int main()
{
	int n,i,j,x;
	scanf("%d",&n);
	vi a;
	int sum = 0;
	for(i=0;i<n;++i)
	{
		scanf("%d",&x);
		a.push_back(x);
		sum += x;
	}
	int m = 100000;
	bool dp[n][m];
	for(i=0;i<n;++i)
	{
		for(j=0;j<m;++j)
		{
			dp[i][j] = false;
		}
	}
	dp[0][a[0]] = true;
	for(i=0;i<n-1;++i)
	{
		for(j=0;j<m;++j)
		{
			if(dp[i][j]==true)
			{
				if(j<=a[i+1])
				{
					dp[i+1][a[i+1]-j] = true;
				}
				else 
				{
					dp[i+1][j-a[i+1]] = true;
				}
				if(j+a[i+1]<m)
				{
					dp[i+1][j+a[i+1]] = true;
				}
			}
		}
	}
	for(i=0;i<m;++i)
	{
		if(dp[n-1][i]==true)
		{
			printf("%d",(sum+i)/2);
			return 0;
		}
	}
}


Measured memory_bytes: 199116
{-# LANGUAGE FlexibleInstances    #-}
{-# LANGUAGE TypeSynonymInstances #-}

import           Control.Applicative
import           Control.DeepSeq
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                    as A
import qualified Data.Array.IArray             as IA
import qualified Data.Array.IO                 as AI
import qualified Data.Array.MArray             as MA
import qualified Data.Array.ST                 as STA
import qualified Data.Array.Unboxed            as AU
import           Data.Bits
import qualified Data.ByteString.Char8         as BS
import           Data.Char
import qualified Data.Graph                    as G
import           Data.Int
import qualified Data.IntMap                   as IM
import qualified Data.IntSet                   as IS
import           Data.List
import qualified Data.Map.Strict               as M
import           Data.Maybe
import           Data.Ord
import qualified Data.Sequence                 as SQ
import qualified Data.Set                      as S
import           Data.Time
import qualified Data.Tree                     as T
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as VM
import qualified Data.Vector.Unboxed           as VU
import qualified Data.Vector.Unboxed.Mutable   as VUM

readInt :: IO [Int]
readInt = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

readInts :: Int -> IO [[Int]]
readInts n = replicateM n readInt

readInteger :: IO [Integer]
readInteger = map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine

readIntegers :: Int -> IO [[Integer]]
readIntegers n = replicateM n readInteger

readString :: IO [String]
readString = map BS.unpack . BS.words <$> BS.getLine

readStrings :: Int -> IO [[String]]
readStrings n = replicateM n <$> readString

toPair :: [a] -> (a, a)
toPair [x, y] = (x, y)

count :: Eq a => a -> [a] -> Int
count a as = length $ filter (== a) as

put :: Show a => a -> IO ()
put = putStr . show

putLn :: Show a => a -> IO ()
putLn = print

putList :: Show a => [a] -> IO ()
putList [n     ] = put n
putList (n : ns) = do
  put n
  putStr " "
  putList ns

putStrList :: [String] -> IO ()
putStrList [n     ] = putStr n
putStrList (n : ns) = do
  putStr n
  putStr " "
  putStrList ns

yesNoUpper b | b         = putStrLn "YES"
             | otherwise = putStrLn "NO"

yesNo b | b         = putStrLn "Yes"
        | otherwise = putStrLn "No"

main = do
  [a, b] <- readInt
  if (a + b) >= 10 then putStrLn "error" else print (a + b)


Measured memory_bytes: 380
#include <iostream>
using namespace std;
int main()
{
    int n,x,y,t;
    cin>>n;
    for (int i = 1;i <= n; i++)
    {
        cin >> t >> x >> y;
        if (x + y > t)
        {
            cout << "No";
            return 0;
        }
        if ((x + y) % 2 != t % 2)
        {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}


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

#define FOR(i,a,b) for(ll i=a; i<b; i++)
#define IN(a) cin>>a
#define OUT(a) cout<<a<<endl


int main(){
  int a,b;
  IN(a); IN(b);
  
  OUT(a*b); 
}


Measured memory_bytes: 3672
# python3 (3.4.3)
import sys
input = sys.stdin.readline

# main
N,H = map(int,input().split())
A,B = 0,[]
for i in range(N):
    a,b = map(int,input().split())
    A = max(A,a)
    B.append(b)

ans = 0

B.sort(reverse=True)
for b in B:
    if b > A:
        ans += 1
        H -= b
        if H <= 0:
            print(ans)
            sys.exit()
            
print(ans + (H-1)//A + 1)

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

int N;

class Q {
    public:
    int a,b;
    Q (int a,int b) :
        a(a),b(b) {
        };

    bool operator <(const Q &q) const {
        return a*q.b < b*q.a;
    }
    bool operator >(const Q &q) const {
        return a*q.b > b*q.a;
    }
    bool operator ==(const Q &q) const {
        return a*q.b == b*q.a;
    }


};
bool comp(const pair<Q,string> &arg1,const pair<Q,string> &arg2) {
    if(arg1.first.a*arg2.first.b == arg1.first.b*arg2.first.a)
       return arg1.second < arg2.second;
    return arg1.first.a*arg2.first.b > arg1.first.b*arg2.first.a;

}

void solve() {
    vector<string> L(N);
    vector<pair<Q,string> > ans;
    rep(i,N) {
        string ss;
        int p,a,b,c,d,e,f,s,m;
        cin>>ss>>p>>a>>b>>c>>d>>e>>f>>s>>m;
        int mm = a+b+c;
        mm += (d+e)*m;
        int pp = f*s;
        pp = pp*m-p;
        Q q(pp,mm);
        ans.push_back(make_pair(q, ss));
    }
    sort(ans.begin(), ans.end(), comp);
    rep(i,ans.size()) {
        cout<<ans[i].second<<endl;
    }
}
int main() {
    while(cin>>N) {
        if(!N) return 0;
        solve();
        cout<<"#"<<endl;
    }

    return 0;
}

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

typedef long long ll;
typedef pair<int,int> P;

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

void hakidashi(vector<ll>& a) {
    int n = a.size(),m = 60;
    int i = 0;
    for (int j = 59;j >= 0;--j) {
        if (((a[i]>>j)&1)^1) for (int k = i;k < n;++k) if ((a[k]>>j)&1) {
            swap(a[i],a[k]);
            break;
        }
        if ((a[i]>>j)&1) {
            for (int s = 0;s < n;++s) if (i != s && ((a[s]>>j)&1)) a[s] ^= a[i];
            i++;
            if (i == n) break;
        }
    }
}

int main() {
    int n;
    ll sum = 0;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0;i < n;++i) {
        cin >> a[i];
        sum ^= a[i];
    }
    for (int i = 0;i < 60;++i) if ((sum>>i)&1) for (int j = 0;j < n;++j) if ((a[j]>>i)&1) a[j] ^= (1LL<<i);
    hakidashi(a);
    ll ans = 0;
    for (int i = 0;i < n;++i) ans ^= a[i];
    cout << ans*2+sum << endl;
    /*
    for (int i = 0;i < n;++i) {
        for (int j = 0;j < 60;++j) cout << ((a[i]>>j)&1);
        cout << endl;
    }
    p_ary(a,0,n,i);
    */
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#include <math.h> 
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll so[1000010];
int main() {
	so[1]=1;
	for(ll i=2;i<1000010;i++){
		ll now=i;
		if(so[i]!=0){
			continue;
		}
		for(ll j=1;j*i<1000010;j++){
			so[i*j]=now;
		}
	}
	ll n;
	cin>>n;
	ll ch[10010];
	for(ll i=0;i<n;i++){
		cin>>ch[i];
	}
	ll ke[1000010]={};
	for(ll i=0;i<n;i++){
		ll now=ch[i];
		map<ll,ll>q;
		while(now!=so[now]){
			q[so[now]]++;
			now/=so[now];
		}
		q[now]++;
		for(auto itr=q.begin();itr!=q.end();itr++){
			ll num=itr->first;
			ll val=itr->second;
			ke[num]=max(ke[num],val);
		}
	}
	ll lcm=1;
	for(ll i=2;i<1000010;i++){
		lcm*=modpow(i,ke[i],inf);
		lcm%=inf;
	}
	//cout <<lcm;
    // a を 10000000007 で割ってから b の逆元をかけて計算
    //a %= MOD;
    //cout << a * modinv(b, MOD) % MOD << endl;
    ll ans=0;
    for(ll i=0;i<n;i++){
    	ll now=ch[i];
    	ll cnt=lcm*modinv(now,inf)%inf;
    	ans+=cnt;
    	ans%=inf;
    }
    cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 19304
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	int n, m; scanf("%d%d", &n, &m);
	REP(i, m) { int a; scanf("%d", &a); n -= a; }
	if(n < 0) n = -1;
	printf("%d\n", n);
}


Measured memory_bytes: 3828
const BKRT = "\n";
const SPAC = " ";
const NOSP = "";

var arr = Array.from({length:100001},(a,b)=>b);

const one = [1];
const six = [46656,7776,1296,216,36,6];
const nine = [59049,6561,729,81,9];

function Main(input){
	input = [].concat(...input.trim().split(BKRT).map(a=>a.split(SPAC)));
  const strShift = ()=>input.shift();
  const intShift = ()=>~~input.shift();
  
  var a = intShift();
  
  for(var i = 6 ; i <= a; i++){
  	var o = [];
    o.push(arr[i-1]+1);
    for(var n of nine){
    	if(i >= n){
      	o.push(arr[i-n]+1);
        break;
      }
    }
    for(var s of six){
    	if(i >= s){
      	o.push(arr[i-s]+1);
        break;
      }
    }
    arr[i] = Math.min(...o);
  }
  return arr[a];
}

// If you are interested in the algorithms I used, 
// there is no need to read down from this line.

((b,c,d)=>"undefined"!=typeof require?console.log(Main(require("fs").readFileSync("/dev/stdin","utf8"))):[b=b.split("\n").slice(1,-1).join("\n"),c=function(){try{return Main(b)}catch(f){return f.stack||f.message}}(),d=typeof c,"string"==d||(c=JSON.stringify(c)),$("<form>").append([[10,b],0,[1,d],0,[10,c]].map(f=>$(f?"<textarea>":"<br>",f&&{rows:f[0],cols:40,text:f[1]}))).appendTo("body")])(`
44852
`);

Measured memory_bytes: 16536
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n,temp=1,x;
	scanf("%d",&n);
	if(n==1) printf("1\n");
	else
	{
		for(int i = 1;i <= n;i++){
			if(temp*2<=n && temp*2*2>n)
			{
				x=temp*2;
				break;
			}
			else temp=temp*2;
		}
		printf("%d\n",x);
	}
}


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

int main()
{
  string s;
  int a, b;
  cin >> a >> b >> s;
  string ans = "Yes";
  rep(i, s.size()){
    //cout << s[i] << i << endl;;
    if(i == a){
      if(s[i] != '-') {
      	ans = "No";
      }
      else continue;
    }
    if(s[i] < '0' || s[i] > '9') ans = "No";
    //cout << ans << endl;
  }
  cout << ans << endl;

  return 0;
}


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

using namespace std;

#define pb push_back
#define eb emplace_back
#define ll long long
#define pii pair < int, int >
#define fr first
#define sc second
#define mk make_pair
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()
#define ok puts("ok");
#define whatis(x) cerr << #x << " = " << x << endl;
#define pause system("pause");

const int N = (int)2e5 + 7;
const int inf = (int)1e9 + 7;
int mod = 998244353;

string s;
int n;

ll add(ll a, ll b) {
  return (a + b) % mod;
}

ll mult(ll a, ll b) {
  return a * b % mod;
}

ll sub(ll a, ll b) {
  a -= b;
  if (a < 0) a += mod;
  return a;
}

ll binpow(ll a, int n) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) {
      res = mult(res, a);
    }
    a = mult(a, a);
    n >>= 1;
  }
  return res;
}

int dp[N][3][3];

main() {
  for (int i = 0; i < 3; i++)
    dp[1][i][i] = 1;

  for (int i = 1; i < N - 1; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 3; k++) {
        for (int l = 0; l < 3; l++) {
          if (k != l) {
            dp[i + 1][(j + l) % 3][l] = add(dp[i + 1][(j + l) % 3][l], dp[i][j][k]);
          }
        }
      }
    }
  }
  cin >> s;
  n = sz(s);
  set < char > ss;
  for (int i = 0; i < n; i++) {
    ss.insert(s[i]);
  }
  if (sz(ss) == 1) {
    puts("1");
    return 0;
  }
  if (n == 2) {
    cout << 2;
    return 0;
  } else if (n == 3) {
    for (int i = 0; i < 3; i++) {
      ss.insert(s[i]);
    }
    if (sz(ss) == 3) {
      puts("3");
      return 0;
    }
  }
  ll res = binpow(3, n - 1);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    sum += (s[i] - 'a');
  }
  sum %= 3;
  for (int i = 0; i < 3; i++) {
    res = sub(res, dp[n][sum][i]);
  }
  bool fl = 0;
  for (int i = 1; i < n; i++) {
    fl |= (s[i] == s[i - 1]);
  }
  if (!fl)
    res = add(res, 1);
  cout << res << endl;
}


Measured memory_bytes: 7680
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    n = II()
    ab = LIR(n)
    ab.sort()
    if n & 1:
        ans = ab[n // 2][0]
    else:
        ans = ab[n // 2 - 1][0] + ab[n // 2][0]
        ans /= 2
    ab = list(map(lambda x: x[1], ab))
    ab.sort()
    if n & 1:
        print((ab[n // 2] - ans) + 1)
    else:
        print(int(((ab[n // 2 - 1] + ab[n // 2]) / 2 - ans) * 2 + 1))
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 123588
def examA():
    N = I()
    S = SI(); T = SI()
    ans = 2*N
    for l in range(N-1,-1,-1):
        flag = True
        for i in range(l+1):
            if S[N-1-i] != T[l-i]:
                flag = False
                break
        if flag:
            ans -=(l+1)
            break
    print(ans)
    return

def examB():
    N, x = LI()
    d = defaultdict(bool)
    if x==1 or x==2*N-1:
        print("No")
        return
    print("Yes")
    ans = [0]*(2*N-1)
    ans[N-1] = x
    d[x] = True

    ans[N] = x+1
    ans[N-2] = x-1
    d[x+1] = True
    d[x-1] = True
#    print(d); print(ans)
    cur = 1
    for j in range(N-2):
        while(d[cur]):
            cur +=1
        ans[j] = cur
        cur +=1
    for j in range(N+1,2*N-1):
        while(d[cur]):
            cur +=1
        ans[j] = cur
        cur +=1
    for v in ans:
        print(v)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examB()


Measured memory_bytes: 29148
from collections import Counter
n = int(input())
D = Counter(map(int,input().split()))
m = int(input())
for i in map(int,input().split()):
    try:
        D[i] -= 1
        if D[i] < 0:
            print("NO")
            break
    except:
        print("NO")
        break
else:
    print("YES")

Measured memory_bytes: 45028
import java.util.*;

import static java.lang.System.*;

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

        if(A * C <= B){
            out.println(C);
        } else {
            out.println(B / A);
        }
    }
}


Measured memory_bytes: 23380
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define mrep(i,j,n) for(int i = j; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define el cout<<endl
#define cer(x) cerr << x <<endl
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())

typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll mod = 1e9 + 7;
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; }

int main()
{
	int n; cin >> n;
	vector<ll> a(n),b(n);
	ll asum = 0, bsum = 0;
	rep(i, n) 
	{
		cin >> a[i];
		asum += a[i];
	}
	rep(i, n)
	{
		cin >> b[i];
		bsum += b[i];
	}
	if (asum < bsum)
	{
		co(-1);
		return 0;
	}
	vector<ll> exc;
	ll lac_sum = 0, lac_num = 0;
	rep(i, n)
	{
		if (a[i] > b[i])exc.push_back(a[i] - b[i]);
		if (a[i] < b[i])
		{
			lac_sum += b[i] - a[i];
			lac_num++;
		}
	}
	sort(all(exc));
	reverse(all(exc));
	reps(i, sz(exc) - 1)exc[i] += exc[i - 1];
	int x = 0;
	if(lac_num)x=lower_bound(all(exc), lac_sum) - exc.begin() + 1;
	int ans = lac_num + x;
	co(ans);
	return 0;
}


Measured memory_bytes: 2428
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define ll_MAX LONG_LONG_MAX
#define ll_MIN LONG_LONG_MIN
#define pi pair<int,int>
#define endl "\n"
#define MAXN 1e7
using namespace std;
vector<ll> primes;
void seive(vector<bool> &isprime, ll n, vector<bool> &sqprime)
{
    primes.pb(2);
    for(ll i=2*2; i<=n; i += 2)
    {
        isprime[i] = false;
    }
    for(ll i=3; (i*i)<=n; i+=2)
    {
        if(isprime[i])
        {
            for(ll j= i*i; j<=n; j += i)
            {
                isprime[j] = false;
            } 
        }
    }
    for(ll i=2; i<=MAXN; i++)
    {
        if(isprime[i])
        {
            primes.pb(i);
            if(i*i <= MAXN)
            {
                sqprime[i*i] = true;
            }
        }
    }
}
ll F(ll x, vector<bool> &isprime, vector<bool> &sqprime)
{
    ll res = 1;
    ll temp = x;
    for(ll i=0; i<primes.size(); i++)
    {
        ll cnt = 1;
        if(primes[i]*primes[i]*primes[i] > temp)
        {
            break;
        }
        while( temp%primes[i] == 0)
        {
            cnt++;
            temp = temp/primes[i];
        }
        res *= cnt;
    }
    if(isprime[temp])
    {
        res = res*2;
    }
    else if(sqprime[temp])
    {
        res *= 3;
    }
    else if(temp!=1)
    {
        res *= 4;
    }
    return res;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
    ll n;
    cin>>n;
    vector<bool> isprime(MAXN + 1, true);
    vector<bool> sqprime(MAXN + 1, false);
    isprime[0] = isprime[1] = false;
    seive(isprime, MAXN, sqprime);
    ll ans = 0;
    for(ll i=1; i<=n; i++)
    {
        ans = ans + i*F(i, isprime, sqprime);
    }
    cout<<ans<<'\n';
}

Measured memory_bytes: 14072
#include<cstdio>
#include<cstring>
#define max(a,b) (a>b?a:b)
int main(){
	int k[100001],a,b,table[2][100001];
	while(scanf("%d%d",&a,&b),a,b){
	memset(k,0,sizeof(k));
	memset(table,0,sizeof(table));
		for(int i=0;i<b;i++){
			int c;
			scanf("%d",&c);k[c]=1;
		}	
		int res=0;
		for(int i=1;i<=a;i++){
			if(k[i]){
				table[0][i]=table[0][i-1]+1;
				table[1][i]=table[1][i-1]+1;
			}
			else{
				if(k[0]){
					table[1][i]=table[0][i-1]+1;
				}
			}
			res=max(res,max(table[0][i],table[1][i]));
		}
		printf("%d\n",res);
	}
	return 0;
}

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

int main(){
    int N,K,d[101], A[101][101];
    cin >> N >> K;

    set<int> values;
    for(int i=0; i<K; i++){
        cin >> d[i];
        for(int j=0; j<d[i]; j++){
            cin >> A[i][j];
            values.insert(A[i][j]); //Insert
        }
    }

    cout << N-values.size() << endl;
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <sstream>

using namespace std;

int main() {
    string a,b;

    cin >> a >> b;

    if(a[0] == b[2] && a[1] == b[1] && a[2] == b[0]){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>

using namespace std;

int main() {
	int n, m, d;
	cin >> n >> m >> d;

	int c = d == 0 ? 1 : 2;

	double ans = 1.0 * c * (n - d) * (m - 1) / n / n;
	printf("%.12f\n", ans);
	return 0;
}


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

def li():
    return [int(x) for x in input().split()]

N = int(input())
L = li()

# 組み合わせ列挙
c = it.combinations(L, 3)
c_list = list(c)

cnt = 0
for l in c_list:
    unique_l = len(set(l))
    if unique_l != 3:
        continue
    sum_l = l[0] + l[1] + l[2]
    max_l = max(l)
    sum_lest = sum_l - max_l
    if sum_lest > max_l:
        cnt += 1

print(cnt)

Measured memory_bytes: 87128
#include <iostream>
#include <math.h>
#include <string.h>
#include<stdlib.h>
#define N 100
using namespace std;


int main(){
    char s[N],t,u;
    cin>>s;
    t=76;//L
    u=82;//R
    
for(int i=0;i<sizeof(s);i++){
    if(s[i]==t){
        if((i+1)%2!=0){
            cout<<"No"<<endl;
            exit(0);
        }
    }
    if(s[i]==u){
        if((i+1)%2==0){
            cout<<"No"<<endl;
            exit(0);
        }
    }
}

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

Measured memory_bytes: 256
process.stdin.resume();
process.stdin.setEncoding('utf8');


process.stdin.on('data', function (chunk) {
    let n = chunk.toString() // 文字列化する
        .split("\n") // \nで分割
        .filter(x => x !== "");

    for (let i = 0; i < n.length; i++) {
        const money = 1000 - n[i];
        const fivehundred = money / 500;
        const amari = money % 500;
        const hundred = amari / 100;
        const hundredamari = amari % 100;
        const fifty = hundredamari / 50;
        const fiftyamari = hundredamari % 50;
        const ten = fiftyamari / 10;
        const tenamari = fiftyamari % 10;
        const five = tenamari / 5;
        const onecoin = tenamari % 5;
        const a = Math.floor(fivehundred);
        const b = Math.floor(hundred);
        const c = Math.floor(ten);
        const d = Math.floor(five);
        const e = Math.floor(fifty);
        const f = Math.floor(onecoin);
        // console.log(a);
        // console.log(b);
        // console.log(c);
        // console.log(d);
        // console.log(onecoin);
        if (n[i] !== "0") {
            console.log(a + b + c + d + e + f);
        } else {
            false;
        }
    }
});


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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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






int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    int i,l;
    string s;
    cin >> s;
    l=s.SZ;
    for(i=0;i<l/2;i++)
    {
        if(s[i] != s[l-i-1])
        {
            cout << "No";
            return 0;
        }
    }
    for(i=0;i<l/4;i++)
    {
        if(s[i] != s[l/2-i-1])
        {
            cout << "No";
            return 0;
        }
    }
    for(i=l/2+1;i<l/2+1+l/4;i++)
    {
        if(s[i] != s[l+l/2-i])
        {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;

int main(void)
{
  string s;
  cin >> s;
  cout << string(s.begin(),s.begin()+3) << endl;
  return 0;
}


Measured memory_bytes: 3596
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    s=0
    n=II()
    aa=LI()
    for a in aa:s^=a
    ans=[]
    for a in aa:ans.append(a^s)
    print(*ans)

main()

Measured memory_bytes: 31412
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

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

int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };  // i<4:4way i<8:8way
int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    double a,b,h,m,c,d;
    double pi = acos(-1);
    cin >> a >> b >> h >> m;
    double angA = h * 30 + m/2;
    double angB = m * 6;
    double ang  = max(angA,angB) - min(angA,angB);
    ang = min(360 - ang,ang);
    cout << sqrt(a*a + b*b - 2*a*b*cos(ang*pi/180)) << endl;
}

Measured memory_bytes: 4228
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int(i) = 0;(i) < (n); (i)++)
    int main(){
      vector <int> L;
      L = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
       1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
      int K;
      cin >> K;
      cout << L.at(K-1) << endl;

}

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

int main(){
  int n;
  cin >> n;
  
  vector<int> a(n);
  int i;
  for( i = 0 ; i < n ; i++ )	cin >> a.at(i);
  
  int min = 0;
  for( i = 0 ; i < n ; i++ ){
    int count = 0;
    while( a.at(i) % 2 == 0 ){
      a.at(i) /= 2;
      count++;
    }
    if( count == 0 ){
      min = 0;
      break;
    }
    if( min == 0 || min > count ) min = count;
  }
    
  
  cout << min << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
    cin >> n;
    vector<int> h(n, 0);
    for(int i = 0; i < n; ++i) cin >> h.at(i);

    vector<int> dp(n+1, 0);
    dp.at(0) = 0;
    dp.at(1) = dp.at(0) + abs(h.at(1) - h.at(0));
    for(int i = 2; i < n; ++i) {
        dp.at(i) = min({(dp.at(i-2) + abs(h.at(i)-h.at(i-2))), dp.at(i-1) + abs(h.at(i)-h.at(i-1))});
    }

    cout << dp.at(n-1) << endl;
}

Measured memory_bytes: 1024
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;

void main()
{
  while (1) {
    auto n = readln.chomp.to!int;
    if (!n) break;
    int[] list;
    int cnt;
    foreach (i; 0..n) {
      auto x = readln.chomp.to!int;
      foreach (e; list) {
        if (x < e) cnt++;
      }
      list ~= x;
    }
    cnt.writeln;
  }
}

Measured memory_bytes: 1048
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


int main() {
    std::string s; std::cin >> s;
    std::set<char> st;
    for (int c : s) st.insert(c);
    for (char c = 'a'; c <= 'z'; c++) {
        if (st.count(c)) continue;
        std::cout << s + c << std::endl;
        return 0;
    }
    while (!s.empty()) {
        for (char c = s.back() + 1; c <= 'z'; c++) {
            if (st.count(c)) continue;
            s.pop_back();
            std::cout << s + c << std::endl;
            return 0;
        }
        st.erase(s.back());
        s.pop_back();
    }
    std::cout << -1 << std::endl;
    return 0;
}


Measured memory_bytes: 256