akhauriyash/Code-Regression huggingface dataset:
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string { sc.Scan(); return sc.Text() }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }
	return res
}

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1000000)

	n := scanInt()
	m := scanInt()

	g := make([][]int, n)

	es := make([]edge, m)

	for i := 0; i < m; i++ {
		a, b := scanInt()-1, scanInt()-1
		g[a] = append(g[a], b)
		g[b] = append(g[b], a)
		es[i] = edge{a,b}
	}

	ans := 0

	for _, e := range es {
		a,b := e.a, e.b
		f := make([]bool, n)
		q := []int{0}
		f[0] = true
		for len(q) != 0 {
			for _, v := range g[q[0]] {
				if f[v] {
					continue
				}

				if a == q[0] && b == v || b == q[0] && a == v {
					continue
				}

				f[v] = true
				q = append(q, v)
			}
			q = q[1:]
		}

		for i := 0; i < n; i++ {
			if !f[i] {
				ans++
				break
			}
		}
	}

	fmt.Println(ans)
}

type edge struct {
	a int
	b int
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cctype>
#include <map>

const int INT_INF = 1000000000;                 // 10^9
const long long LONG_INF = 1000000000000000000; // 10^18

using namespace std;

int main()
{
    int n;
    cin >> n;
    long long sum = 0;
    for (int i = 1; i <= n; i++)
    {
        if (i % 3 == 0 || i % 5 == 0)
        {
            continue;
        }
        sum += i;
    }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3596
import java.util.Scanner;
public class Main{
static int[]check;//1=checked,0=yet,2=checking
static int[][]graph;
static int[][]hz;//[][0]:
static int cnt=0,n;
final static int MAX=100;
	public static void main(String[] args) {
		int i,j,s,pn,num;
		// TODO Auto-generated method stub
		Scanner sca = new Scanner(System.in);
		n=sca.nextInt();
		check=new int[n+1];
		hz=new int[n+1][2];
		graph=new int[MAX+1][MAX+1];
		for(i=1;i<=n;i++){
			num=sca.nextInt();
			pn=sca.nextInt();
			for(j=0;j<pn;j++){
				s=sca.nextInt();
				graph[num][s]=1;
			}
		}
		explores();
		for(i=1;i<=n;i++){
				System.out.println(i+" "+hz[i][0]+" "+hz[i][1]);
		}

	}
	public static void explores(){
		int i;
		for(i=1;i<=n;i++){
			if(check[i]==0)expl(i);
		}
	}
	public static void expl(int now){
		int i;
		check[now]=2;
		hz[now][0]=++cnt;
		for(i=1;i<=n;i++){
			if(graph[now][i]==1&&check[i]==0)expl(i);
		}
		check[now]=1;
		hz[now][1]=++cnt;
	}

}


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

int main(){
	int N;
	cin>>N;
	set<int>st;
	for(int i=0;i<N;i++){
		int a;
		cin>>a;
		if(st.count(a)){
			st.erase(a);
		}else{
			st.insert(a);
		}
	}
	cout<<st.size()<<endl;
	return 0;
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
#define forn(i,a,b) for(int i=a; i<b; ++i)
typedef long long int ll;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll n;
    cin >> n;
    cout << 2 * n / __gcd(2ll, n) << "\n";
    return 0;
}

Measured memory_bytes: 256
N = int(input())
SP = [input().split() for n in range(N)]

# 得点が高い＝100からの減算値が小さい。文字列を昇順に並べながら得点が高い特徴を並べやすく
# 文字列と入力順番値を辞書型で登録
sp = {s.lower()+' '+"{:03}".format(100-int(p)):n+1 for n, (s, p) in enumerate(SP)}

# 昇順文字列に並べ、その文字列に対応する入力順番値を表示する
for k in sorted(sp):
    print(sp[k])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  IOS;
  ll x,k,d;
  cin >> x >> k >> d;
  x = abs(x);

  ll c = x / d + (x%d > 0);
  if (k < c) {
    COUT(x - k*d);
    return 0;
  }

  // if x <= k*d
  if ( (k-c) % 2 == 0 ) {
    COUT( abs(x- d*c) );
  } else {
    COUT( abs(x- d*(c-1)) );
  }

  return 0;
}


Measured memory_bytes: 3648
s=int(input())

x=[]
x.append(s)

chk=0
cnt=0

while chk==0: 
	cnt+=1
	if x[cnt-1]%2==0:
		x.append(x[cnt-1]//2)
	else:
		x.append(x[cnt-1]*3+1)
	if len(set(x))<cnt:
		print(cnt)
		chk=1

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

struct Dinic{
  int INF=1e17;
  
  struct edge {
    int to,cap,rev;
    edge(){}
    edge(int to,int cap,int rev):to(to),cap(cap),rev(rev){}
  };

  int n;
  vector<vector<edge> > G;
  vector<map<int,int> > M;
  vector<int> level,iter;

  Dinic(){}
  Dinic(int sz):n(sz),G(n),M(n),level(n),iter(n){}
  
  void add_edge(int from,int to,int cap){
    M[from][to]=G[from].size();
    M[to][from]=G[to].size();
    G[from].push_back(edge(to,cap,G[to].size()));
    // undirected
    //G[to].push_back(edge(from,cap,G[from].size()-1));
    // directed
    G[to].push_back(edge(from,0,G[from].size()-1));
  }
  
  void bfs(int s){
    fill(level.begin(),level.end(),-1);
    queue<int> que;
    level[s]=0;
    que.push(s);
    while(!que.empty()){
      int v=que.front();que.pop();
      for(int i=0;i<(int)G[v].size();i++){
        edge &e = G[v][i];
        if(e.cap>0&&level[e.to]<0){
          level[e.to]=level[v]+1;
          que.push(e.to);
        }
      }
    }
  }
  
  int dfs(int v,int t,int f){
    if(v==t) return f;
    for(int &i=iter[v];i<(int)G[v].size();i++){
      edge &e=G[v][i];
      if(e.cap>0&&level[v]<level[e.to]){
        int d = dfs(e.to,t,min(f,e.cap));
       if(d>0){
         e.cap-=d;
         G[e.to][e.rev].cap+=d;
         return d;
       }
      }
    }
    return 0;
  }
  
  int flow(int s,int t,int lim){
    int fl=0;
    for(;;){
      bfs(s);
      if(level[t]<0||lim==0) return fl;
      fill(iter.begin(),iter.end(),0);
      int f;
      while((f=dfs(s,t,lim))>0){
       fl+=f;
       lim-=f;
      }
    }
  }

  int flow(int s,int t){
    return flow(s,t,INF);
  }

  //cap==1 only
  bool back_edge(int s,int t,int from, int to){
    for(int i=0;i<(int)G[from].size();i++) {
      edge& e=G[from][i];
      if(e.to==to) {
        if(e.cap==0&&flow(from,to,1)==0) {
          flow(from,s,1);
          flow(t,to,1);
          return 1;
        }
      }
    }
    return 0;
  }
};

map<string,int>m;

void init(){
  m["Sunday"]=0;
  m["Monday"]=1;
  m["Tuesday"]=2;
  m["Wednesday"]=3;
  m["Thursday"]=4;
  m["Friday"]=5;
  m["Saturday"]=6;
}

main(){
  init();
  int n,W,t,x,sum;
  while(cin>>n>>W){
    if(!n&&!W)break;
    sum=0;
    Dinic d(n+9);
    r(i,7)d.add_edge(n+7,i,W);
    r(i,n){
      cin>>t>>x;
      sum+=t;
      d.add_edge(i+7,n+8,t);
      r(j,x){
        string s;
        cin>>s;
        d.add_edge(m[s],i+7,W);
      }
    }
    if(sum==d.flow(n+7,n+8,sum))cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
}


Measured memory_bytes: 3256
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define ALL(a) (a).begin(),(a).end()
 
using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;
 
const ll MOD  = 1e9+7;
const ll LINF = 1LL << 60;
const int INF = 1e9 + 7;

int solve(string x, string y){
    //dp[i][j] xの i文字目、yのj文字目までの最長共通部分列の長さ
    int dp[1010][1010] = {};

    rep(i, x.size())rep(j, y.size()){
        dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
        if(x[i] == y[j])dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j]+1);
    }

    return dp[x.size()][y.size()];
}
int main(){
    int q;
    cin >> q;

    int ans[q];

    rep(i, q){
        string x, y;
        cin >> x >> y;
        
        ans[i] = solve(x, y);
    }

    rep(i, q)cout << ans[i] << endl;
}


Measured memory_bytes: 7168
#include<iostream>
#include<stdio.h>

using namespace std;

double guu(double);
double ki(double);


int main(){

  double a[10], sum;

  while(cin >> a[0]){
    sum = a[0];

    for(int i = 1; i < 10; i++){
      if(i % 2 == 1){
	a[i] = guu(a[i-1]);
	sum += a[i];
      }else{
	a[i] = ki(a[i-1]);
	sum += a[i];
      }
    }
    printf("%.8f\n",sum);

  }

  return 0;

}

    
    

double guu(double x){

  return 2*x;
}

double ki(double x){

  return x / 3;
}

Measured memory_bytes: 0
;; -*- coding:utf-8 -*-

(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 1))
    #-swank '(optimize (speed 3) (safety 0) (debug 0))))

(defmacro println (obj &optional (stream '*standard-output*))
  `(prog1 (princ ,obj ,stream) (terpri ,stream)))


;; Hauptteil

(deftype uint nil `(integer 0 ,(expt 10 9)))
(defun main ()
  (let ((n (read))
        (k (read)))
    (println (- n (- k 1)))))

#-swank(main)


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

void partition(int a[], int p, int r){
	int x = a[r];
	int i = p-1;
	for( int j=p; j<r; j++ ){
		if( a[j] <= x ){
			i++;
			int tmp = a[j];
			a[j] = a[i];
			a[i] = tmp;
		}
	}
	a[r] = a[i+1];
	a[i+1] = x;
	cout << a[0];
	for( int j=1; j<=i; j++ ){
		cout << " " << a[j];
	}
	cout << " [" << a[i+1] << "]";
	for( int j=i+2; j<=r; j++ ){
		cout << " " << a[j];
	}
	cout << endl;
}

int main(){
	int n, a[100001];
	cin >> n;
	for( int i=0; i<n; i++ )	cin >> a[i];
	partition( a, 0, n-1 );
	return 0;
}

Measured memory_bytes: 1548
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
#include <queue>
#include <sstream>
#include <stack>
#include <deque>
#include <memory.h>
#include <cassert>
#include <ctime>
#include <climits>
#include <list>
#include <time.h>
#include <unordered_map>
#include <bitset>
#include <exception>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define INPUT "/Users/bekhzodsoliev/Desktop/C++/cp/cp/file.in"
#define OUTPUT "/Users/bekhzodsoliev/Desktop/C++/cp/cp/file.out"
#define lc v << 1
#define rc (v << 1) + 1
#define inf 1e+9
#define linf ll(1e+18)
#define dinf 1e+14

void solve()
{
    ll d, n;
    cin >> d >> n;
    
    if(d == 0)
    {
        cout << n + (n == 100);
    }
    
    if(d == 1)
    {
        cout << n * 100 + (n == 100) * 100;
    }
    
    if(d == 2)
    {
        cout << n * 100 * 100 + (n == 100) * 100 * 100;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0);
    //freopen(INPUT, "r", stdin);freopen(OUTPUT, "w", stdout);
    //freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    int t = 1;
    //cin >> t;
    
    
    while(t--)
    {
        solve();
    }
    
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner scanner =new Scanner(System.in);
        int a=scanner.nextInt();
        int b=scanner.nextInt();
        int c=scanner.nextInt();
        int sum=0;
        for(int i=0;a<=b;a++){
            if(c % a==0){
                sum++;
            }
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 26228
import math

N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i], y[i] = map(int, input().split())
d = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        d += math.sqrt((x[i] - x[j])**2 + (y[i] - y[j])**2)
m = d * 2 / N
print(m)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef vector<int>V;
typedef priority_queue<int>PQ;
typedef long long LL;
V v[100001];
int main(void){
	int n,m;
	
	int x,y;
	LL sum;
	PQ que;
	int i,j;
	cin>>n>>m;
	for(i=0;i<n;i++){
		cin>>x>>y;
		v[x].push_back(y);
	}
	j=1;
	sum=0;
	while(1){
		if(m==0)	break;
		if(v[j].empty())	v[j].push_back(0);
		for(i=0;i<(int)v[j].size();i++)	que.push(v[j][i]);
		sum+=que.top();
		que.pop();
		m--;
		j++;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 6772
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');
		long n = long.Parse(input[0]);
		long q = long.Parse(input[1]);
    long[] nums = new long[400*400];
    long[] numSetsMin = new long[400];//400*400に分割
    long sumMemo = 0;

    for(long question = 0; question < q; question++)
    {
      string[] inputq = Console.ReadLine().Split(' ');
      long howNum = long.Parse(inputq[0]);
      long leftNum = long.Parse(inputq[1]);
      long rightNum = long.Parse(inputq[2]);
      if(howNum == 0)//書き換え
      {
        nums[leftNum] += rightNum;
        long numPosition = WherePosition(leftNum);//どの分類に属するか
        numSetsMin[numPosition] += rightNum;
      }
      if(howNum == 1)//和を求める
      {
        sumMemo = 0;
        long leftPosition = WherePosition(leftNum);
        long rightPosition = WherePosition(rightNum);

        if(leftPosition == rightPosition)
        {
          for(long i = leftNum; i <= rightNum; i++)//左右が同じ分類のとき
          {
            sumMemo += nums[i];
          }
        }else
        {
          for(long i = leftNum; i < 400*(leftPosition+1); i++)//左区間内（左端より右だけ見る）
          {
            sumMemo += nums[i];
          }
          for(long i = 400*rightPosition; i <= rightNum; i++)//右区間内
          {
            sumMemo += nums[i];
          }
          for(long i = leftPosition+1; i < rightPosition; i++)//見ていない区間内
          {
            sumMemo += numSetsMin[i];
          }
        }
        Console.WriteLine(sumMemo);
      }
    }
	}

  static long WherePosition(long num)//左から何番目の分類に属するか
  {
    return num / 400;
  }
  
}


Measured memory_bytes: 20300
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int main(){
    int n,a,b;cin>>n>>a>>b;
    string s;cin>>s;
    int total =0;
    int vtotal=0;
    rep(i, s.size()){
        if(s[i]=='c'){co("No");continue;}
        if(s[i]=='a'){
            if(total<a+b){co("Yes");total+=1;}else co("No");
        }
        if(s[i]=='b'){
            if(total<a+b&&vtotal<b){co("Yes");total+=1;vtotal+=1;}else co("No");
        }
    }
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string o,e;cin >> o >> e;
	rep(i,o.size()){
		cout << o.at(i);
		if(i < e.size()) cout << e.at(i);
	}
	cout << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<iomanip>
#include<unordered_map>
using namespace std;
 
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
  int N,K;
  cin>>N>>K;
  vector<double> p(N+1);  
  p.at(0)=0;
  double P;
  for(int i=1;i<=N;i++){
    cin>>P;
    p.at(i)=p.at(i-1)+(1+P)/2;
  }
  double M=0;
  for(int i=K;i<=N;i++) M=max(M,p.at(i)-p.at(i-K));
  cout<<fixed<<setprecision(10)<<M;
return 0;}

Measured memory_bytes: 4824
#include <cstdio>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <cstring>
#define min(a,b)    (((a) < (b)) ? (a) : (b))
#define max(a,b)    (((a) > (b)) ? (a) : (b))
#define abs(x)    ((x) < 0 ? -(x) : (x))
//#define INF 0x3f3f3f3f
#define delta 0.85
#define eps 1e-3
#define PI 3.14159265358979323846
#define MAX_V 205
#define MAX_R 1005
using namespace std;
const int INF = 1e8;
int E, V, R;
int order[MAX_R];
int dl[MAX_V][MAX_V], ds[MAX_V][MAX_V], dp[MAX_R][MAX_V];

int main(){
	while(~scanf("%d%d", &V, &E) && V){
		for(int i = 0; i < V; i++){
			for(int j = 0; j < V; j++){
				dl[i][j] = ds[i][j] = INF;
			}
			dl[i][i] = ds[i][i] = 0;
		}
		for(int i = 0; i < E; i++){
			char c;
			int u, v, d;
			scanf("%d%d%d %c", &u, &v, &d, &c);
			--u, --v;
			if(c == 'L') dl[u][v] = dl[v][u] = min(dl[u][v], d);
			else ds[u][v] = ds[v][u] = min(ds[u][v], d);
		}
		scanf("%d", &R);
		for(int i = 0; i < R; i++){
			scanf("%d", order + i);
			--order[i];
		}
		// Warshall_floyd
		for(int k = 0; k < V; k++){
			for(int i = 0; i < V; i++){
				for(int j = 0; j < V; j++){
					dl[i][j] = min(dl[i][j], dl[i][k] + dl[k][j]);
					ds[i][j] = min(ds[i][j], ds[i][k] + ds[k][j]);
				}
			}
		}
		// Dp
		for (int i = 0; i < R; i++){
			for(int j = 0; j < V; j++){
				dp[i][j] = INF;
			}
		}
		dp[0][order[0]] = 0;
		for(int i = 0; i < R - 1; i++){
			for(int j = 0; j < V; j++){
				if(dp[i][j] != INF){
					dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + dl[order[i]][order[i + 1]]);
					for(int k = 0; k < V; k++){
						dp[i + 1][k] = min(dp[i + 1][k], dp[i][j] + dl[order[i]][j] + ds[j][k] + dl[k][order[i + 1]]);
					}
				}
			}
		}
		printf("%d\n", *min_element(dp[R - 1], dp[R - 1] + V));
	}
	return 0;
}




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

namespace V0038{
    public class Program{
        public static void Main(string[] args){
            var hands = new[]{"null", "one pair", "two pair", "three card", "full house", "straight", "four card"};

            while(Console.In.Peek() != -1){
                var card = Console.ReadLine().Split(',').Select(int.Parse).OrderBy(x => x).ToArray();
                var res = 0;

                for(var i = 0; i < 5; i++){
                    for(var j = i + 1; j < 5; j++){
                        if(card[i] == card[j]) res++;
                    }
                }

                if(card.SequenceEqual(new[]{1, 10, 11, 12, 13})) res = 5;
                
                if(res == 0){
                    var straight = true;
                    for(var i = 1; i < 5; i++){
                        if(card[i - 1] + 1 != card[i]) straight = false;
                    }
                    if(straight) res = 5;
                }

                Console.WriteLine(hands[res]);
            }
        }
    }
}

Measured memory_bytes: 9784
using System;
using System.IO;

class Program{
    static void Main(string[] args){
        var arr = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        var K = arr[0];
        var N = arr[1];
        var A = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        var longest = A[0] + K - A[^1];
        for (int i = 0; i < N - 1; i++){
            if (longest >= A[i + 1] - A[i]) continue;
            longest = A[i + 1] - A[i];}
        var answer = K - longest;
        var writer = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();}}

Measured memory_bytes: 42912
import java.util.Scanner;

public class Main {
    public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        System.out.println(((a * b) % 2 == 0) ? "Even" : "Odd");
    }
}

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

// フィボナッチ数列の別ver(リュカ数)
// あとで再帰関数で書くけど、とりあえず今はmax_N = 86なので足し算してリスト作る。

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

  // vector<long int> L(N);
  // L[0] = 2; L[1] = 1;

  long int L_2 = 2, L_1= 1;
  long int L = 0;

  for (int i = 2; i <= N; i++) {
    L = L_2 + L_1;
    L_2 = L_1;
    L_1 = L;
    // cout << L << endl;
  }

  // for (int i = 2; i <= N; i++) {
  //   L[i] = L[i - 1] + L[i - 2];
  // }

  if (N == 1) cout << 1 << endl;
  else cout << L << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<utility>
#include<climits>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<map>
#include<set>
#include<queue>
#include<assert.h>

using namespace std;

#define sz(a) int((a).size()) 
#define pb push_back 
#define mp make_pair
#define all(c) (c).begin(),(c).end() 
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++) 
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end()) 

typedef long long ll;

typedef struct node{
	ll val,more=0,less=0;
	bool operator <(const node& a){
		return val<a.val;
	}
}node;

typedef pair<int,int> pi;
typedef pair<pi,int> pii;
typedef pair<pi,pi > pi2;

typedef pair<ll,ll> pl;
typedef pair<pl,ll> pll;
typedef pair<pl,pl > pl2;

typedef vector<node> vn;

typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<pii> vpii;
typedef vector<pi2 > vpi2;

typedef vector<ll> vl;
typedef vector<pl> vpl;
typedef vector<pll> vpll;
typedef vector<pl2 > vpl2;

const int M=1000000007;

int _pow(ll base, ll pow){
	if(pow==0)
		return 1;
	if(pow==1)
		return base;
	ll temp=_pow(base,pow/2);
	temp=(temp*temp)%M;
	if(pow&1)
		temp=(temp*base)%M;
	return temp;
}

bool func(pi x, pi y){
	return x.first>=y.first;
}

vi tree[5005];
bool visited[5005];
bool visited2[5005];
vi new_tree[5005];

int dfs(int s){
	if(!(visited[s] || visited2[s])){
		visited2[s]=true;
		int cnt=1;
		for(int i=0;i<tree[s].size();i++){
			if(!visited[tree[s][i]] && !visited2[tree[s][i]])
				cnt+=dfs(tree[s][i]);
		}
		return cnt;
	}
}

void bfs(int s){
	queue<int> q;
	visited[s]=true;
	q.push(s);
	while(!q.empty()){
		int v=q.front();
		q.pop();
		for(int i=0;i<tree[v].size();i++){
			if(!visited[tree[v][i]]){
				visited[tree[v][i]]=true;
				q.push(tree[v][i]);
			}
		}
	}
}

class compare{
public:
	bool operator()(pi a, pi b){
		if(a.first!=b.first){
			return a.first>b.first;
		}
		return a.second<b.second;
	}
};



int main(){

	int n,k;
	cin>>n>>k;
	int a[n];
	int pos;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(a[i]==1)
			pos=i;
	}

	if(pos==0 || pos==n-1){
		cout<<(n-1+k-2)/(k-1);
		return 0;
	}
	int steps=INT_MAX;
	for(int i=1;i<=k;i++){
		int s=1;
		int l=pos-i;
		int r=pos+k-i;
		if(l>=0)
			s+=(l+1+k-2)/(k-1);
		if(r<n-1)
			s+=(n-r-1+k-2)/(k-1);
		steps=min(steps,s);
		//cout<<i<<" "<<s<<"\n";
	}

	cout<<steps;
	return 0;
}

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

int main() {
  int N,M;
  cin >> N >> M;
  vector<int> vecA(M);
  vector<int> vecB(M);
  
  for(int i = 0; i<M; i++){//a,bの配列作成
    cin >> vecA.at(i);
    cin >> vecB.at(i);
  }

  vector<int> vecR(N);//都市iから伸びる道の数の配列
  
  for(int i = 0; i<N; i++){
    for(int j = 0; j<M; j++){
  if(vecA.at(j) == i+1){
    vecR.at(i)++;
  }
  if(vecB.at(j) == i+1){
    vecR.at(i)++;
  }
    }
  }
for(int i = 0; i<N; i++){
    cout << vecR.at(i) << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int h,w,x,y,a,b;

  while(1){scanf("%d%d",&h,&w);
    if(h==0&&w==0)break;
    for(a=0;a<w;a++){printf("#");}
    printf("\n");
    for(x=0;x<h-2;x++){
      for(y=0;y<w;y++){
	if(y!=0&&y!=w-1){
	  printf(".");
	}else {
	  printf("#");
	}
      }
      
      printf("\n");
    }
    
    for(a=0;a<w;a++){printf("#");
    } 
    printf("\n");
    if(a!=w-1&&b!=w-1){printf("\n");
   }
  }
    

    
  return 0;
}

Measured memory_bytes: 572
#include<bits/stdc++.h>
using namespace std;
#define read() 	        freopen("in.txt","r",stdin)
#define write()         freopen("out.txt","w",stdout)
#define sf(n) 	        scanf("%d",&n)
#define sfd(n)          scanf("%lf",&n)
#define sff(n,m) 	    scanf("%d%d",&n,&m)
#define sl(x)           scanf("%I64d",&x)
#define sfl(n) 	        scanf("%lld", &n)
#define sfc(n)          scanf(" %c",&n)
#define sffl(n,m) 	    scanf("%lld%lld",&n,&m)
#define sful(n)         scanf("%ull",&n)
#define ll              long long
#define ull             unsigned long long int
#define endll           pf("\n")
#define pf              printf
#define pi              acos(-1.0)
#define eps 	        1e-10
#define mem(a,b)        memset(a,b,sizeof(a))
#define pb              push_back
#define xx              first
#define yy              second
#define pii             pair<int, int>
#define pll             pair<ll, ll>
#define inf 1999999999
#define MP make_pair
#define MX 100005
#define mod 1000000007
#define var    int i,j,k,n,m,z=0,c=0,t,x,y

/*
ll bigmod(ll x,ll y,ll m)
{
    if(y==0)return 1;
    ll n=bigmod(x,y/2,m);
    n=(n*n)%mod;
    if(y & 1)n=((n%m)*(x%m))%m;
    return n;
}
*/

int main()
{
    ll var;
    cin>>n>>m;
    if(n==m)
        cout<<-1<<endl;
    else if(m==1)cout<<-1<<endl;
    else
    {
        i=3;
        z=n*2;
        while(z%m==0 && i<100000001)
        {
            z=n*i;
            i++;
        }
        if(z%m==0)cout<<-1<<endl;
        else
            cout<<z<<endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <functional>
#include <algorithm>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <typeinfo>
#include <functional>
#include <iomanip>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;
typedef long long ll;

int main()
{
	int  N;
	cin >> N;
	if (N % 2 == 0)
	{
		cout << N / 2 - 1 << endl;

	}
	else
	{
		cout << N / 2 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <cmath>

using namespace std;

int main() {
	int n;
	while ( cin >> n, n ) {
		map<string, int> conv;
		conv["lu"] = 0;
		conv["ru"] = 1;
		conv["ld"] = 0;
		conv["rd"] = 1;
		int cnt[2] = {0};

		for (int i = 0; i < n; ++i) {
			string str; cin >> str;
			cnt[conv[str]]++;
			if (abs(cnt[0] - cnt[1]) >= 2) {
				int v = min(cnt[0], cnt[1]);
				cnt[0] = v;
				cnt[1] = v;
			}
		}
		cout << min(cnt[0], cnt[1]) << endl;
	}
}

Measured memory_bytes: 1220
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

immutable long MOD = 10^^9 + 7;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!int).array;

    int x1 = (N+1)/2;
    int x2 = N/2;
    int[int] c1;
    int[int] c2;

    for (int i = 0; i < N; i += 2) c1[A[i]] += 1;
    for (int i = 1; i < N; i += 2) c2[A[i]] += 1;
    c1[-1] = 0;
    c2[-2] = 0;

    auto A1 = c1.keys.dup;
    auto A2 = c2.keys.dup;
    A1.sort!((a, b) => c1[a] > c1[b]);
    A2.sort!((a, b) => c2[a] > c2[b]);
    A1 = A1[0..min(A1.length, 3)] ~ -1;
    A2 = A2[0..min(A2.length, 3)] ~ -2;

    int ans = 1 << 29;

    foreach (a; A1)
        foreach (b; A2)
            if (a != b)
                ans = min(ans, x1-c1[a] + x2-c2[b]);

    ans.writeln;
}


Measured memory_bytes: 14272
def actual(s):
    # S の先頭の文字は大文字の A である。
    cond1 = s[0] == 'A'

    # S の先頭から 3 文字目と末尾から 2 文字目の間（両端含む）に大文字の C がちょうど 1 個含まれる。
    cond2 = s[2:-1].count('C') == 1

    # A, C を除く S のすべての文字は小文字である。
    cond3 = all([char.islower() for char in s if char != 'A' and char != 'C'])

    if cond1 and cond2 and cond3:
        return 'AC'

    return 'WA'

s = input()
print(actual(s))

Measured memory_bytes: 9060
#include <algorithm>
#include <cstdio>

int main(int argc, const char *argv[]) {
  int N, Hi, m;

  scanf("%d", &N);

  m = 0;
  for (int i = 0; i < N; i++) {
    scanf("%d", &Hi);
    if (!(m <= Hi)) {
      printf("No\n");
      return 0;
    }
    m = std::max(m, Hi - 1);
  }
  printf("Yes\n");
}

Measured memory_bytes: 256
def resolve():
    a=int(input())
    b=int(input())
    c=int(input())
    d=int(input())
    kane=0
    if a>=b:
        kane+=b
    else:
        kane+=a
    if c>=d:
        kane+=d
    else:
        kane+=c
    print(kane)

resolve()

Measured memory_bytes: 3060
n = int(input())
a_list = list(map(int, input().split()))
alice = 0
bob = 0
a_list.sort(reverse=True)
i = 0
for a_i in a_list:
  if i % 2 == 0:
    alice += a_i
  else:
    bob += a_i
  i += 1
print(alice - bob)

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

#define INPUT_FROM_FILE (0)
#if INPUT_FROM_FILE
#include <fstream>
#endif

int main(int argc, char **argv){
#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif
	int n = 0;

#if INPUT_FROM_FILE
	ifs >> n;
#else
	std::cin >> n;
#endif
	if(n == 0){
		std::cout << "1" << std::endl;
	}
	else if(n == 1){
		std::cout << "1" << std::endl;
	}
	else{
		int pp = 1;
		int p = 1;
		int ans = 0;

		for(int i = 2; i <= n; i++){
			ans = p + pp;

			pp = p;
			p = ans;
		}
		std::cout << ans << std::endl;
	}
	return 0;
}


Measured memory_bytes: 3088
import java.util.*;
public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		C(sc);
	}
	
	public static void A(Scanner sc) {
		int n = sc.nextInt();
		int k = sc.nextInt()-1;
		String s = sc.next();
		System.out.println(s.substring(0,k)+Character.toLowerCase(s.charAt(k))+s.substring(k+1,n));
	}
	
	public static void B(Scanner sc) {
		String s = sc.next();
		if((Integer.valueOf(s.substring(0,2))==0 || Integer.valueOf(s.substring(0,2))>=13) && Integer.valueOf(s.substring(2,4))<=12 && Integer.valueOf(s.substring(2,4))>=1) System.out.println("YYMM");
		else if((Integer.valueOf(s.substring(2,4))>=13 ||Integer.valueOf(s.substring(2,4))==0)&& Integer.valueOf(s.substring(0,2))<=12 && Integer.valueOf(s.substring(0,2))>=1) System.out.println("MMYY");
		else if(Integer.valueOf(s.substring(2,4))<=12 && Integer.valueOf(s.substring(0,2))<=12 && Integer.valueOf(s.substring(2,4))>=1 && Integer.valueOf(s.substring(0,2))>=1) System.out.println("AMBIGUOUS");
		else System.out.println("NA");
	}
	
	public static int findminl(int x, int k) {
		int ret = 1;
		int pro = x*2;
		while(pro<k) {
			ret++;
			pro*=2;
		}
		return ret;
	}
	
	public static void C(Scanner sc) {
		int n = sc.nextInt();
		int k = sc.nextInt();
		double ret = (n>=k)? (n-k+1)/(double)n:0.0;
		for(int i=1;i<=Math.min(k-1,n);i++) ret+=((1.0/Math.pow(2.0, findminl(i,k)))*(1.0/n));
		System.out.println(ret);
	}
}

Measured memory_bytes: 23636
#include <stdio.h>

int main()
{
    int a,b;
    scanf("%d%d", &a, &b);

    if(a==1&&b==2||a==2&&b==1){
        printf("3");
    }
    else if(a==2&&b==3||a==3&&b==2){
        printf("1");
    }
    else if(a==3&&b==1||a==1&&b==3){
        printf("2");
    }else{}

    return 0;
}


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

int main(){
  ll n,a,b;
  cin>>n>>a>>b;
  cout<<min(b,n*a);
  
  return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);

		String S = scan.next();

		int ans = 700;

		char[] input = S.toCharArray();

		for (int i = 0; i < input.length; i++) {
			if (input[i] == 'o') {
				ans += 100;
			}
		}

		System.out.println(ans);
	}

	//***********************以下共通関数************************************************
	/**
	 * 文字列を反転して返す
	 * @param pStr 文字列
	 * @return 反転した文字列
	 */
	public static String myReverse(String pStr) {
		if (pStr.length() < 1) {
			return "";
		}

		StringBuffer sb = new StringBuffer(pStr);
		return sb.reverse().toString();
	}

	/**
	 * 余りを求める。
	 * @param a
	 * @param b
	 * @return 余り。余りがマイナスの時はプラスで返す。
	 */
	public static long myMod(long a, long b) {
		long ret = 0;

		ret = a % b;

		if (ret < 0) {
			ret += b;
		}

		return ret;
	}

	/**
	 * 乗数を求める ※mod対応
	 * @param kisu 基数
	 * @param josu 乗数
	 * @param primeNumMod_0 法 mod値 使わない場合は「0」
	 * @return
	 */
	public static long myPowWithMod(long kisu, long josu, long primeNumMod_0) {

		long ans = 1;

		//乗数が0の場合→1
		if (josu == 0)
			return 1;

		if (primeNumMod_0 == 0) {
			//modを使わないとき

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= kisu;
					josu = josu / 2;
				} else {
					//累乗が奇数の時
					ans *= kisu;
					josu--;
				}
			}

			return ans;

		} else {
			//modを使うとき

			//初めに桁を落とす
			kisu = myMod(kisu, primeNumMod_0);

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= myMod(kisu, primeNumMod_0);
					josu = josu / 2;

				} else {
					//累乗が奇数の時
					ans *= myMod(kisu, primeNumMod_0);
					josu--;

				}
			}

			return myMod(ans, primeNumMod_0);

		}

	}

}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X,i) ((X>>i)&1)
#define REP(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define r_all(a) (a).rbegin(), (a).rend()
#define ina(x,n) rep(x_i,n) cin>>x[x_i]
#define outa(x,n) rep(x_i,n) cerr<<x[x_i]<<" \n"[x_i==n-1]

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = (1<<28);
const ll INFL = (1LL<<61);

int main() {
  int a, b; cin >> a >> b;
  cout << (6-a-b) << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.math.*;
 
public class Main {
  static int mod = (int) 1e9 + 7;
    static int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };
 
    static int n;
    static long k;
    static long a[];
  public static void main(String[] args) {
    	Scanner fs = new Scanner(System.in);
    	n = fs.nextInt();
        k = fs.nextLong();
    	a = new long[n];
        for(int i = 0; i < n; ++i) {
          a[i] = fs.nextLong();
        }
        Arrays.sort(a);
        long INF = (long)(1e18)+1;
        long l = -INF;
        long r = INF;
        while(l+1<r) {
            long c = (l+r)/2;
            if(check(c))l=c;
            else r = c;
        }
        System.out.println(l);
    }
    //x未満の組合せがk個未満ならtrue
    static boolean check(long x) {
        long tot = 0;
        for(int i=0;i<n;i++) {
            long now = a[i];
            int l = 0, r = n;
            if(now >= 0) {
                while(l<r) {
                    int c = (l+r)/2;
                    if(now * a[c] < x) l = c+1;
                    else r = c;
                }
                tot += l;
            }
            else {
                while(l<r) {
                    int c = (l+r)/2;
                    if(now * a[c] >= x) l = c+1;
                    else r = c;
                }
                tot += (n - l);
            }
            if((long)a[i] * a[i]<x)tot--;
        }
        if(tot/2 < k) return true;
        else return false;
    }
}
    

Measured memory_bytes: 83568
use std::collections::BinaryHeap;
use std::io::{self, BufRead};

fn main() {
    let stdin = io::stdin();
    let mut lines = stdin.lock().lines();
    let nm = lines.next().unwrap().unwrap();
    let mut nm = nm.split_whitespace().skip(1);
    let m: i64 = nm.next().unwrap().parse().unwrap();
    let mut a: BinaryHeap<i64> = lines
        .next()
        .unwrap()
        .unwrap()
        .split_whitespace()
        .map(|s| s.parse().unwrap())
        .collect();
    for _ in 0..m {
        let a_max = a.pop().unwrap();
        a.push(a_max / 2);
    }
    let ans: i64 = a.iter().sum();
    println!("{}", ans);
}


Measured memory_bytes: 8444
import sys
import itertools


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n, m, x = list(map(int, readline().split()))
    c = [list(map(int, readline().split())) for _ in range(n)]
    mv = 10 ** 10
    for v in itertools.product([True, False], repeat=n):
        score = [0] * m
        amt = 0
        for i, vv in enumerate(v):
            if vv:
                amt += c[i][0]
                for j in range(m):
                    score[j] += c[i][j+1]
                b = True
                for sv in score:
                    if sv < x:
                        b = False
                        break
                if b:
                    mv = min(mv, amt)
    print(mv if mv != 10 ** 10 else -1)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 68588
#include <algorithm>
#include <bitset>
//#include <boost/multiprecision/cpp_int.hpp>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <sstream>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
// namespace mp = boost::multiprecision;
using namespace std;
using ull = unsigned long long;
using ld = long double;
// using ll = boost::multiprecision::cpp_int;
using ll = long long;
#define FOR(i, N) for(ll i = 0; i < N; ++i)

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
// using int = ll;
ll gcd(ll m, ll n) {
    if(n == 0)
        return abs(m);
    return (gcd(n, m % n));
}
void putYN(bool b) {
    if(b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}
void swap(ll &a, ll &b) {
    ll tmp = a;
    a = b;
    b = tmp;
}
ll combi(ll n, ll k) {
    ll r = 1, rr = 1;
    for(ll i = 0; i < k; ++i) {
        r *= (n - i);
        rr *= (i + 1);
        // r %= 1000000007;
        // rr %= 1000000007;
    }
    r /= rr;
    // r %= 1000000007;
    return r;
}

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    FOR(i, N) {
        cin >> A[i];
        ;
    }
    double a = 0;
    FOR(i, N){
        a+=1.0/A[i];
        ;
    }
    cout << 1 / a << endl;
    return 0;
}


Measured memory_bytes: 888
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
class b{
    public static void Main(){
        int n = int.Parse(Console.ReadLine());
        int cnt = 0;
        string ans = "No";
        for(int i=0; i<n; i++){
            int[] num = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            if(num[0] == num[1]){
                cnt++;
            }
            else{
                if(cnt >= 3){
                    ans = "Yes";
                }
                cnt = 0;
            }
        }
        if(cnt >= 3){
            ans = "Yes";
        }
        Console.WriteLine(ans);
    }
}


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


int main()
{
    int n;
    std::vector<int> p;
    std::cin>>n;
    p.resize(n);
    for(int i=0;i<n;i++)std::cin>>p[i];

    int cnt = 0;
    for(int i=1;i<=n;i++)
    {
        if(p[i-1]!=i)cnt++;
    }
    std::cout<<(cnt<=2 ? "YES" : "NO")<<std::endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
typedef struct node_s node;

struct node_s{
  int key;
  node *pre;
  node *nx;
};

void insert(int);
void del(node *);
node *search(int);
node *h;
 
int main(){
  int i,n,x;
  char str[16];
  node *tsp;
     
  h = malloc(sizeof(node));
  h->key = -1;
  h->pre = h;
  h->nx = h;
  scanf("%d",&n);
 
  for (i=0;i<n;i++){
    scanf("%s", &str);
    if (str[0]=='i'){
      scanf("%d",&x);
      insert(x);
    }else if (str[0]=='d' && str[6]=='\0'){
      scanf("%d",&x);
      del(search(x));
    }else if (str[0]=='d' && str[6]=='F'){
    	del((h->nx));
    }else if (str[0]=='d' && str[6]=='L'){
    	del((h->pre));
    }
  }
  for (tsp = h->nx; tsp->nx->key != -1; tsp = tsp->nx)
    printf("%d " ,tsp->key);
    printf("%d\n" ,tsp->key);
  return 0;
}
void insert(int x){
  node *o = malloc(sizeof(node));
  o->key = x;
  o->nx = h->nx;
  o->pre = h;
  h->nx->pre = o;
  h->nx = o;
}
void del(node *n){
  if(n == NULL) return;
  n->pre->nx = n->nx;
  n->nx->pre = n->pre;
  free(n);
} 
node *search(int key){
  node *p;
  for (p=h->nx; p->key!=-1; p = p->nx){
    if (p->key == key){
      return p;
    }
  }
  return NULL;
}


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

int main()
{
int H,W;
cin>> H>>W;
while(H!=0||W!=0)
{
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
	if(i==0||i==H-1||j==0||j==W-1)
		cout << "#";
	else
		cout << '.';

}
cout << endl;
}
cout << endl;
cin >> H>>W;
}
return 0;
}

Measured memory_bytes: 1152
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

x = k()
if 400<=x<=599:
    print("8")
elif 600<=x<=799:
    print("7")
elif 800<=x<=999:
    print("6")
elif 1000<=x<=1199:
    print("5")
elif 1200<=x<=1399:
    print("4")
elif 1400<=x<=1599:
    print("3")
elif 1600<=x<=1799:
    print("2")
else:
    print("1")


Measured memory_bytes: 10508
#include<bits/stdc++.h>
using namespace std;
typedef long long lli;
const int maxn = 5e5 + 50;
typedef pair<int, int> P;

int arr[maxn];
int a, b, c, d, e, f, g;
void solve();
int main()
{
	int t = 1;
//	cin >> t;
	for(int i=0; i<t; i++)
	{
		solve();
	}
	return 0;
}

// type below

void solve()
{
	cin >> a >> b;
	int arr[a + 50] = {0};
	for(int i=1; i<=b; i++)
		cin >> arr[i];
	int ans = arr[b] - arr[1];
	for(int i=1; i<=b; i++)
	{
		ans = min(ans, a - arr[i] + arr[i - 1]);
		ans = min(ans, arr[i] + a - arr[i + 1]);
	}
	cout << ans << '\n';
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF=1e18,MOD=1e9+7;
ll ans_0[100001],ans_1[100001];
int main(){
	ll n,k;
	cin>>n>>k;
	string s;
	cin>>s;
	ll ptr_0=0,ptr_1=0;
	for(int i=0;i<n;){
		ll sum=0;
		while(i<n&&s[i]=='0'){
			sum++;
			i++;
		}
		if(sum>0){
			ans_0[ptr_0]=sum;
			ptr_0++;
		}
		sum=0;
		while(i<n&&s[i]=='1'){
			sum++;
			i++;
		}
		if(sum>0){
			ans_1[ptr_1]=sum;
			ptr_1++;
		}
	}


	ll ans=0,i,hoge=0,j;
	if(ptr_0<=k)ans=n;
	else if(s[0]=='0'){
		for(i=0;i<ptr_0-k+1;i++){
			hoge=0;
			if(i!=0){
				hoge+=ans_1[i-1];
			}
			for(j=i;j<k+i;j++){
				hoge+=ans_0[j];
				hoge+=ans_1[j];
			}
			ans=max(ans,hoge);
		}
	}
	else{
		for(i=0;i<ptr_0-k+1;i++){
			hoge=0;
			for(j=i;j<k+i;j++){
				hoge+=ans_0[j];
				hoge+=ans_1[j];
			}
			hoge+=ans_1[j];
			ans=max(ans,hoge);
		}
	}
	cout<<ans<<endl;

}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds; 
using namespace std;

using   ll=long long;
using   ld=long double;

#define fast        	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ordered_set 	tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>

#define endl        	"\n"
#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define int 			long long int
#define pll 			pair<ll , ll>

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			1000000007

ll mod_pow(ll a,ll b) {
    ll res = 1;
    while(b)	
    {
        if(b&1) 	
        {
        	res=(res*a)%mod;
        }
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a) {
	return mod_pow(a , mod-2);
}

void solve() {
    
    string s;
    
    cin >> s;
    
    if(s == "SUN") {
    	cout << 7;
    }
    else if(s[0] == 'M') {
    	cout << 6;
    }
    else if(s == "TUE") {
    	cout << 5 ;
    }
    else if(s == "WED") {
    	cout << 4;
    }
    else if(s == "THU" ) {
    	cout << 3;
    }
    else if(s == "FRI") {
    	cout << 2;
    }
    else {
    	cout << 1;
    }
}       

signed main() {
    fast;
    
    int t = 1;
    
    //cin >> t;
    
    while(t--) {
        solve();
    }
 
    return 0;
}


Measured memory_bytes: 3544
#include "bits/stdc++.h"
#define lpa(i,a,b) for(int i=a; i<b; ++i)
#define lp(i,n) lpa(i,0,n)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define print_v(v,n) lp(i,n) cout<<v[i]<<' '; cout<<'\n';
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int main(int argc, char const *argv[])
{
	ll l, r; cin>>l>>r;
	if(r - l + 1 >= 2019){
		cout<<0;
	}
	else{
		ll minx = 2019;
		for(ll i=l;i<r;++i)
			for(ll j=i+1;j<=r; ++j)
				minx = min(minx,(i*j)%2019ll);
		cout<<minx;
	}
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
int main()
{
	double x;
	int q;
	while(1)
	{
		cin >> q;
		if(q==-1)break;
		x=q/2.0;
		while(fabs(x*x*x-q)>=0.00001*q)
		{
			x-=((x*x*x-q)/(3*x*x));
		}
		printf("%.6f\n",x);
	}
	return 0;
}

Measured memory_bytes: 1192
import sys
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

n = I()
DL = LIR(n)
ans = 0

for i, D in enumerate(DL):
    if D[0] == D[1]:
        ans += 1
    elif ans < 3 and D[0] != D[1]:
        ans = 0
        
if ans >= 3:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9304
from collections import Counter
 
def f(n,v):
	a=Counter(v[0::2]).most_common()
	b=Counter(v[1::2]).most_common()
	
	a.append([0,0])
	b.append([0,0])
	if a[0][0]!=b[0][0]:
		return n-(a[0][1]+b[0][1])
	else:
		return min(n-(a[1][1]+b[0][1]),n-(a[0][1]+b[1][1]))
 
if __name__=="__main__":
	x=int(input())
	data=[int(i) for i in input().split()]
	print(f(x,data))

Measured memory_bytes: 20692