akhauriyash/Code-Regression huggingface dataset:
from collections import Counter
N = int(input())
div = []
for i in range(2,N+1):
    while i != 1:
        for d in range(2,i+1):
            while i%d==0:
                i = i//d
                div.append(d)
C = Counter(div).most_common()
Ans = 1
for k,v in C:
    Ans = Ans*(v+1) % (10**9+7)

print(Ans)


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

void print(int* a, int n){
	for(int i = 0; i < n-1; i++) cout << a[i] << " ";
	cout << a[n-1] << endl;
}

int main(){

	int n, v, j;
	int *a;

	cin >> n;
	a = new int[n];

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

	print(a,n);

	for(int i = 1; i < n; i++){
		v = a[i];
		j = i-1;
		while(j >= 0 && a[j] > v){
			a[j+1] = a[j];
			j--;
		}
		a[j+1] = v;
		print(a,n);
	}

	return 0;
}

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

const int maxn=100005;
int a[maxn];

int gcd(int a,int b){
    return b==0?a:gcd(b,a%b);
}

int main()
{
    ios::sync_with_stdio(false);
    int n,x;
    while(cin>>n>>x){
        for(int i=0;i<n;i++){
            cin>>a[i];
            a[i]=abs(a[i]-x);
        }
        int ans=a[0];
        for(int i=1;i<n;i++){
            ans=gcd(ans,a[i]);
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 640
a, b, c, d, e, f = gets.split.map(&:to_i)
a *= 100
b *= 100

ans = [-1, 0, 0]
(0..).each do |i|
    (0..).each do |j|
        water = a * i + b * j
        break if water > f
        max_suger = [water, e * water / 100, f - water].min

        (0..).each do |k|
            suger = c * k
            break if suger > max_suger
            suger += d while suger + d <= max_suger

            rate = suger.fdiv(water + suger)

            if rate > ans[0]
                ans[0] = rate
                ans[1] = water + suger
                ans[2] = suger
            end
        end
    end

    break if a + i > f
end

puts ans[1,2].join(" ")

Measured memory_bytes: 14284
def boolean(a,b):
    D = abs(a[0] - b[0]) -abs(a[1] - b[1]) - abs(a[2] - b[2])
    if(D >= 0 and D %2 == 0):
        return 0
    else:
        return 1

N = int(input())
txy=[0 for i in range(N+1)]
txy[0]=[0,0,0]
for i in range(N):
    a=list(map(int,input().split()))
    txy[i+1]=a
ans = "Yes"
for i in range(1,N + 1):
    if(boolean(txy[i-1],txy[i])):
        ans = "No"
        break
print(ans)

Measured memory_bytes: 27316
#include<bits/stdc++.h>
#define ll long long
#define fr(i,x) for( int i=0;i<(x);i++)
#define io ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
int main()
  {
      
          ll x,s=100,count=0,p=0;
          cin>>x;
       while(s<x)
        {
            
            s=s+s/100;
            count++;
        }
		
       cout<<count<<endl;
      
  }

Measured memory_bytes: 3620
_ = input()
A = [0]
b = ''

for a in input().split():
    if b == '' or b == a:
        A.append(1)
    else:
        A[-1] += 1
    b = a

ans = 0
if len(A) < 5:
    ans = sum(A)
else:
    for i in range(1, len(A)-2):
        ans = max(ans, sum(A[i:i+3]))

print(ans)



Measured memory_bytes: 6980
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] x = new int[m];
		for (int i = 0; i < m; i++) {
			x[i] = sc.nextInt();
		}
		sc.close();

		if (n >= m) {
			System.out.println(0);
			return;
		}

		Arrays.sort(x);
		int ans = x[m - 1] - x[0];

		int[] y = new int[m - 1];
		for (int i = 0; i < m - 1; i++) {
			y[i] = x[i + 1] - x[i];
		}
		Arrays.sort(y);

		for (int i = 1; i < n; i++) {
			ans -= y[y.length - i];
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 48668
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner io = new Scanner(System.in);
		String A = io.next();
		String B = io.next();
		String C = io.next();
		
		System.out.println((A.charAt(A.length()-1)==B.charAt(0)
								&& B.charAt(B.length()-1)==C.charAt(0))?"YES":"NO");
		
	}
}

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

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define sz(v) (int)v.size()

#define MOO(i, a, b) for(int i=a; i<b; i++)
#define M00(i, a) for(int i=0; i<a; i++)
#define MOOd(i,a,b) for(int i = (b)-1; i >= a; i--)
#define M00d(i,a) for(int i = (a)-1; i>=0; i--)

#define FAST ios::sync_with_stdio(0); cin.tie(0);
#define finish(x) return cout << x << '\n', 0;
#define dbg(x) cerr << ">>> " << #x << " = " << x << "\n";
#define _ << " _ " <<

template<class T> bool ckmin(T& a, const T& b) {return b < a ? a = b, 1 : 0;}
template<class T> bool ckmax(T& a, const T& b) {return a < b ? a = b, 1 : 0;}

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ld,ld> pd;
typedef complex<ld> cd;

const int MAX_N = 200020;
int n;
string s;
int cntW[MAX_N];

int getR(int l) {
    int len = n-1-l+1;
    int numW;
    if(l == 0) numW = cntW[n-1];
    else numW = cntW[n-1] - cntW[l-1];
    return len-numW;
}

int main() { FAST
    cin >> n >> s;
    cntW[0] = s[0] == 'W';
    MOO(i, 1, n) cntW[i] = (s[i] == 'W') + cntW[i-1];
    int res = cntW[n-1]; // all red
    M00(i, n) {
        // first w at i
        int bef = (i-1>=0?cntW[i-1]:0);
        int aft = getR(i);
        int need = max(bef,aft);
        ckmin(res, need);
    }
    finish(res);
}



Measured memory_bytes: 4520
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int inf = 1001001001;
 
int main(){
    int N,sum=0;
    cin >> N;
    vector<int> A(N),B(N),C(N-1);
    rep(i,N){
        cin >> A.at(i);
    }
    rep(i,N){
        cin >> B.at(i);
    }
    rep(i,N-1){
        cin >> C.at(i);
    }
    rep(i,N){
        if(i==0){
            sum+=B.at(A.at(i)-1);
        }
        if(i!=0){
            sum+=B.at(A.at(i)-1);
        }
        if(i!=0 && A.at(i)==(A.at(i-1)+1)){
                sum+=C.at(A.at(i-1)-1);
        }
        
    }

    cout << sum << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <map>
#include <cstdlib>
using namespace std;
int main()
{
    string s;
    int ans = 0;
    cin >> s;
    if (s[0] == 'o')
    {
        ans += 100;
    }
    if (s[1] == 'o')
    {
        ans += 100;
    }
    if (s[2] == 'o')
    {
        ans += 100;
    }
    cout << ans + 700 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T iabs(const T& x) { return max(x, -x); }
// #define abs gabs

int n;
map<string, int> mp;
int main() {
    cin >> n;
    int sum = 0;
    for (int i = 0; i < n; ++i) {
        string s;
        int t;
        cin >> s >> t;
        sum += t;
        mp[s] = sum;
    }    

    string x;
    cin >> x;
    cout << sum - mp[x] << endl;
    return 0;
}

Measured memory_bytes: 888
#include<iostream>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int b=0;
  int count=0;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    if(a==b){
      count++;
      a=101;
    }
	b=a;
  }
	cout<<count;
}
    


Measured memory_bytes: 3624
if __name__ == '__main__':
    S = int(input())

    x0 = 0
    x1 = 10**9
    x2 = 1
    y0 = 0
    y2 = (S + x1 - 1)//x1
    y1 = x1 * y2 - S

    print(str(x0) + ' ' + str(y0) + ' ' + str(x1) + ' ' + str(y1) + ' ' + str(x2) + ' ' + str(y2))

Measured memory_bytes: 3060
N = int(input())
A = list(map(int, input().split(' ')))

flag = 1 #一度でも入れ替えをした
cnt = 0
while flag:
    flag = 0
    for i in range(1,N,1):
        if A[i-1] > A[i]:
            A[i-1], A[i] = A[i], A[i-1]
            cnt += 1
            flag = 1
print (' '.join(map(str,A)))
print(cnt)




Measured memory_bytes: 5600
/*

 Remember, Hope is a good thing... May be the best of things... And No Good thing ever Dies !!!

*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define IOS ios::sync_with_stdio(0); cout.tie(0);
#define endl "\n"
#define MOD 1000000007
const ll inf=(1LL<<60)-1;
int dx[]= {-1,1,0,0};
int dy[]= {0,0,-1,1};
void solve()
{
    string s;
    cin>>s;
    if(s[s.size()-1]=='0' || s[s.size()-1]=='1' || s[s.size()-1]=='6' || s[s.size()-1]=='8')
        cout<<"pon"<<endl;
    else if(s[s.size()-1]=='3')
        cout<<"bon"<<endl;
    else
        cout<<"hon"<<endl;
}
int main()
{
    IOS;
    // ll t;
    //cin>>t;
    //while(t--)
    solve();
    return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int MOD = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct edge{
    ll to, cost;
};


ll gcd(ll a,ll b){
    if(b == 0){
        return a;
    }else{
        return gcd(b, a%b);
    }
}

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

// 素数
vector<bool> IsPrime;
void sieve(size_t max){
    if(max+1 > IsPrime.size()){
        IsPrime.resize(max+1,true);
    } 
    IsPrime[0] = false;
    IsPrime[1] = false;

    for(size_t i=2; i*i<=max; ++i){
        if(IsPrime[i]){
            for(size_t j=2; i*j<=max; ++j){
                IsPrime[i*j] = false;
            }
        }
    }
}

// べき乗の余り
ll modpow(ll a, ll n, ll mod){
    ll res = 1;
    while(n){
        if(n & 1){
            (res *= a) %= mod;
        }else{
            (a *= a) %= mod;
        }
        n >>= 1;
    }
    return res;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    ll n;
    cin>>n;
    vector<ll> a(2*1e5+10);
    ll ans = 0;
    map<ll, ll> ma;
    for(ll i=1;i<=n;++i){
        cin>>a[i];
        ma[a[i] + i]++;
        ans += ma[i - a[i]];
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 27528
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define MN 1000000007
#define fox(k, x) for (int k=0; k<x; ++k)
#define fox1(k, x) for (int k=1; k<=x; ++k)
#define foxr(k, x) for (int k=x-1; k>=0; --k)
#define fox1r(k, x) for (int k=x; k>0; --k)
#define ms multiset
#define flood(x) memset(x, 0x3f3f3f3f, sizeof x)
#define drain(x) memset(x, 0, sizeof x)
#define rng() (rand() >> 3)*rand()

int n, k, a, cnt[200005], c;
vector<int> v;
int main(){
    scanf("%i%i", &n, &k);
    fox(l, n){
        scanf("%i", &a);
        cnt[a]++;
    }
    fox1(l, n){
        v.pb(cnt[l]);
    }
    sort(v.begin(), v.end());
    fox(l, n-k){
        c+=v[l];
    }
    cout << c;
    return 0;
}


Measured memory_bytes: 2168
import java.util.Scanner;
public class Main{
    public static Scanner scan  = new Scanner(System.in);
    public static void main(String[]args){
        int a = nextInt();
        print(a+a*a+a*a*a);
    }

    public static int nextInt(){
        return Integer.parseInt(scan.next());
    }
    public static long nextLong(){
        return Long.parseLong(scan.next());
    }
    public static String next(){
        return scan.next();
    }
    public static double nextDouble(){
        return Double.parseDouble(scan.next());
    }
    public static float nextFloat(){
        return Float.parseFloat(scan.next());
    }

    //Yes or No
    public static void yesNo(boolean flag){
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    }

    //print
    public static void print(Object a){
        System.out.println(a);
    }


    //gcd
    public static int gcd (int a, int b){
        int tmp;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return b;
    }


    //lcm
    public static int lcm(int a,int b){
        int tmp;
        long c = a;
        c *= b;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return (int)(c/b);
    }
}

Measured memory_bytes: 35896
using System;
using System.Collections.Generic;
using System.Linq;
class Program {
    static void Main (string[] args) {
        // 整数の入力
        // Console.Write ("入力\n");
        ulong N = ulong.Parse (Console.ReadLine ());
        ulong ans = ((N-1)*N)/2;
        Console.WriteLine (ans);
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >>n;
 string s;
 cin >>s;
 long long int a[26];
  for(int i=0;i<26;i++)a[i]=1;
 for (int i=0;i<s.size();i++){
   for(int j=0;j<26;j++)
     if(s[i]==j+'a')a[j]++;
 }
  long long int ans=1;
  for(int i=0;i<26;i++)ans=ans*a[i]%1000000007;
  cout << ans-1 <<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long ;
int main(){
    int a,b;
    cin >> a >>b;
    if(b%a == 0) cout << a+b << endl;
    else cout << b-a << endl;

}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <random>
 
using namespace std;

typedef long long ll;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define sz(s) (int)s.size()

mt19937 rnd(1337);

int main() {
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    vector<string> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
        sort(v[i].begin(), v[i].end());
    }
    sort(v.begin(), v.end());
    long long ans = 0;
    int cnt = 1;
    for (int i = 1; i < n; ++i) {
        if (v[i] == v[i - 1]) {
            cnt++;
        } else {
            ans += 1LL * cnt * (cnt - 1) / 2;
            cnt = 1;
        }
    }
    ans += 1LL * cnt * (cnt - 1) / 2;
    cout << ans;
}

Measured memory_bytes: 5760
#include <iostream>
#include <cmath>
#include <string>

using namespace std;

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

	string ans = "";
	while (N > 0) {
		N--;
		ans = string(1, 'a' + N % 26) + ans;
		N /= 26;
	}

	cout << ans << endl;

	return 0;
}

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  int h,w;
  cin >> w >> h;
  int n;
  cin >> n;
  vector<pair<int,int>> blk(n);
  for(int i=0;i<n;i++) cin >> blk[i].first >> blk[i].second;
  sort(blk.begin(),blk.end());
  // cout << endl;
  // for(int i=0;i<n;i++){
  //   cout << blk[i].first SP blk[i].second << endl;
  // }
  // cout << endl;
  int now=1,pre=1;
  for(int i=0;i<n;i++){
    if(blk[i].first==pre) continue;
    now+=blk[i].first-pre-1;
    if(blk[i].second<=now){
      cout << blk[i].first-1 << endl;
      return 0;
    }
    if(now+1<blk[i].second) now++;
    // cout << i SP now << endl;
    pre=blk[i].first;
  }
  cout << w << endl;
  return 0;
}


Measured memory_bytes: 1792
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
}

type node struct {
	totalTime int64
	ai int
	bi int
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	N := getNextInt(scanner)
	M := getNextInt(scanner)
	K := getNextInt(scanner)

	A := make([]int, N)
	B := make([]int, M)
	for i:=0; i<N; i++ {
		A[i] = getNextInt(scanner)
	}
	for i:=0; i<M; i++ {
		B[i] = getNextInt(scanner)
	}
	
	dpa := make([]int64, N+1)
	dpa[0] = 0
	for i:=1; i<N+1; i++ {
		dpa[i] = dpa[i-1] + int64(A[i-1])
	}

	dpb := make([]int64, M+1)
	dpb[0] = 0
	for i:=1; i<M+1; i++ {
		dpb[i] = dpb[i-1] + int64(B[i-1])
	}

	ans := 0
	j := M
	for i:=0; i<N+1; i++ {
		if dpa[i] > int64(K) {
			break
		}
		for ;j > 0 && dpb[j] > int64(K) - dpa[i]; {
			j--
		}
		if ans < i+j {
			ans = i+j
		}
	}

	fmt.Fprintln(writer, ans)
}


Measured memory_bytes: 11944
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		String[] tmp = scanner.nextLine().split(" ");
		int n = Integer.parseInt(tmp[0]);
		int d = Integer.parseInt(tmp[1]);

		double range = d * 2 + 1;
		double ra = n / range;
		int ans = (int)Math.ceil(ra);
		System.out.println(ans);


	}
}


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

template <class T> using V = vector<T>;
template <class S, class T> using P = pair<S, T>;
template <class... T> using TP = tuple<T...>;

using ll = long long;
using db = double;
using ldb = long db;
using str = string;
using vll = V<ll>;
using vvll = V<V<ll>>;
using pll = P<ll,ll>;
using tpll = TP<ll,ll,ll>;
using vpll =V<pll>;
using vtpll = V<tpll>;
using vst = V<str>;
using vch = V<char>;

#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) __lcm(a,b)
#define co(a) cout<<a<<endl
#define ci(a) cin>>a
#define pb(a) push_back(a)
#define pob pop_back()
#define mp make_pair
#define mt make_tuple
#define pbmp(a,b) push_back(mp(a,b))
#define subs(a,b) substr(a,b)
#define cfs(a) cout<<fixed<<setprecision(a)
#define INF 1e16
#define mod 1e9+7
//vvll v(n,vll(m)) n行m列
//A.erase(A.begin()+i) 配列Aのi番目を消せる
//std::binary_search(v.bgn,v.en,a);
//abs(a,b)   pow(a,n)  to_string  stoll
//auto Iter=lower_bound(v.bgn,v.en,a);
//lower//upper  co(*Iter)co(Iter-v.bgn);

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
#define comuse Comuse()
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  ll n;
  cin>>n;
  V<ldb> v(n);
  FOR(i,0,n){
    cin>>v[i];
  }
  ldb bns=0,ans=0;
  FOR(i,0,n){
    bns+=1/v[i];
  }
  ans=1/bns;
  co(ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  unordered_map<string,int>m;
  for(int i=0;i<n;i++)
  {
    string s;
    cin>>s;
    m[s]++;
  }
 cout<<"AC"<<" "<<"x"<<" "<<m["AC"]<<endl;
  cout<<"WA"<<" "<<"x"<<" "<<m["WA"]<<endl;
  cout<<"TLE"<<" "<<"x"<<" "<<m["TLE"]<<endl;
  cout<<"RE"<<" "<<"x"<<" "<<m["RE"]<<endl;
  
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S, T;
const ll MOD = 998244353;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

mat G(100010, vec(0));
ll dfs(ll v){
    vec child(0);
    for(ll to : G[v]){
        child.push_back(dfs(to));
    }
    ll size, ans;
    ans = size = child.size();
    sort(ALL(child));
    rep(i,size){
        ans = max(ans, size - i + child[i]);
    }
    return ans;
}

int main() {
    cin>>N;
    rep(i,N-1){
        cin>>A;
        --A;
        G[A].push_back(i + 1);
    }
    cout<<dfs(0)<<endl;
}

Measured memory_bytes: 15104
#include<stdio.h>
int main()
{
    int k,a,n,ai[200001],i,j,m=0,s=0,b,c,d,e,f=0;
    scanf("%d%d",&k,&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&ai[i]);
    }
    b=k-ai[n-1]+ai[0];
    for(i=0;i<n-1;i++)
    {
        c=ai[i+1]-ai[i];
        if(m<c)
        {
            m=c;
        }
    }
    if(b>=m)
    {
        for(i=0;i<n-1;i++)
        {
            a=ai[i+1]-ai[i];
            s=s+a;
        }
        printf("%d\n",s);
    }
    else
    {
        for(i=0;i<n-1;i++)
        {
            a=ai[i+1]-ai[i];
            if(a==m && !f)
                { f=1;
                    continue;}
            s=s+a;
        }
        s=s+(k-ai[n-1]);
        s=s+ai[0];
        printf("%d\n",s);
    }
    return 0;

}


Measured memory_bytes: 896
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        var line = Console.ReadLine();
        int n = int.Parse(line.Split(' ')[0]);
        int y = int.Parse(line.Split(' ')[1]);

        for (int a = 0; a <= n; a++)
        {
            for (int b = 0; b <= n - a; b++)
            {
                int c = n - a - b;
                if (10000 * a + 5000 * b + 1000 * c == y)
                {
                    Console.WriteLine(a.ToString() + ' ' + b.ToString() + ' ' + c.ToString());
                    return;
                }
            }
        }

        Console.WriteLine("-1 -1 -1");

    }
}

Measured memory_bytes: 13140
#include <iostream>
using namespace std;
#define MOD 1000000007
typedef long long ll;
ll H,W,A,B;
ll fact[200001];

ll fastexp(ll base, ll exp){
  if (exp==0)
    return 1;
  ll temp=fastexp(base,exp/2);
  temp=(temp*temp)%MOD;
  if (exp%2==1)
    temp*=base;
  return temp%MOD;
}

void precompute()
{
  ll temp=1;
  for (ll i=1;i<=200000;i++){
    temp*=i;
    temp%=MOD;
    fact[i]=temp;
  }
}

ll choose(ll N, ll R){
  //cout<<N<<' '<<R<<endl;
  if (R==N || R==0)
    return 1;
  return (fact[N]*fastexp((fact[N-R]*fact[R])%MOD,MOD-2))%MOD;
}
int main()
{
  ll sum=0;
  cin>>H>>W>>A>>B;
  precompute();
  for (ll i=0;i<H-A;i++){
    sum+=choose(i+B-1,i)*choose(W-B-1+H-i-1,W-B-1);
    sum%=MOD;
  }
  cout<<sum<<endl;
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <math.h>
using namespace std;  
int main()
{
	long long x,a=0;
	cin>>x;
	double b=100;
	do
	{
		b=floor(b/100*101);
		a++;
	}while(b<x);
	cout<<a<<endl;
	return 0;
}

Measured memory_bytes: 3632
import numpy as np
#N=map(int, input().split())
N=int(input())
a=N//100
b=(N-a*100)//10
c=N-a*100-b*10
if (a%7==0 and a!=0) or (b%7==0 and b!=0) or (c%7==0 and c!=0):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 27132
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
#define PI 3.141592653589
typedef long long ll;
typedef pair<ll,ll> PP;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug false
#define debug2 false


signed main(void){
    int H1,M1,H2,M2,K;
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    int a = H1*60+M1,b=H2*60+M2;
    
    cout << max(0ll,b-a-K) << endl;
    
    return 0;
}




Measured memory_bytes: 3632
#include<iostream>  
#include<cstdio>  
#include<map>  
#include<cstring>  
#include<cmath>  
#include<vector>  
#include<algorithm>  
#include<set>  
#include<string>  
#include<queue>  
#define inf 100000005  
#define M 40  
#define N 200015  
#define maxn 300005  
#define eps 1e-10  
#define zero(a) fabs(a)<eps  
#define Min(a,b) ((a)<(b)?(a):(b))  
#define Max(a,b) ((a)>(b)?(a):(b))  
#define pb(a) push_back(a)  
#define mp(a,b) make_pair(a,b)  
#define mem(a,b) memset(a,b,sizeof(a))  
#define LL unsigned long long  
#define MOD 1000000007  
#define lson step<<1  
#define rson step<<1|1  
#define sqr(a) ((double)(a)*(a))  
#define Key_value ch[ch[root][1]][0]  
#define test puts("OK");   
using namespace std;  
struct SAM  
{  
  SAM *pre,*son[26];  
  int len,cnt;  
}*root,*tail,que[N],*b[N];  
char str[N/2];  
int son[N][26],cnt[N];  
int tot=0;  
int c[N];  
char ch[N][26];  
void add(int c,int l)  
{  
  SAM *p=tail,*np=&que[tot++];  
  np->len=l;  
  while(p&&p->son[c]==NULL) p->son[c]=np,p=p->pre;  
  if(p==NULL) np->pre=root;  
  else  
    {  
      SAM *q=p->son[c];  
      if(p->len+1==q->len) np->pre=q;  
      else  
        {  
          SAM *nq=&que[tot++];  
          *nq=*q;  
          nq->len=p->len+1;  
          np->pre=q->pre=nq;  
          while(p&&p->son[c]==q) p->son[c]=nq,p=p->pre;  
        }  
    }  
  tail=np;  
}  
void slove(int k)  
{  
  int l=0;  
  int now=0;  
  while(k)  
    {  
      for(int i=0;i<cnt[now];i++)  
        {  
          if(k>que[son[now][i]].cnt)  
            {  
              k-=que[son[now][i]].cnt;  
            }  
          else  
            {  
              str[l++]=ch[now][i];  
              now=son[now][i];  
              k--;  
              break;  
            }  
        }  
    }  
  str[l]='\0';  
  puts(str);  
}  
int main()  
{  
  root=tail=&que[tot++];  
  scanf("%s",str);  
  int l=strlen(str);  
  for(int i=0;str[i];i++) add(str[i]-'a',i+1);  
  for(int i=0;i<tot;i++) c[que[i].len]++;  
  for(int i=1;i<tot;i++) c[i]+=c[i-1];  
  for(int i=0;i<tot;i++) b[--c[que[i].len]]=&que[i];  
  for(int i=0;i<tot;i++) que[i].cnt=1;  
  for(int i=tot-1;i>=0;i--)  
    {  
      SAM *p=b[i];  
      for(int j=0;j<26;j++)  
        {  
          if(p->son[j])  
            {  
              int u=p-que,v=p->son[j]-que;  
              son[u][cnt[u]]=v;  
              ch[u][cnt[u]++]=j+'a';  
              p->cnt+=p->son[j]->cnt;  
            }  
        }  
    }  
  int q,k;  
  scanf("%d",&k);  
  slove(k);  
  return 0;  
}  


Measured memory_bytes: 8576
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:16777216")

#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-15)
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef vector< pii > vpii;
typedef tuple<int, int, int> tiii;



int main()
{
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	int n;
	cin >> n;
	vi a(n);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	sort(all(a));
	int res = 0;
	for (int i = n - 1; i >= 2; i--)
	{
		int l = 0, r = i - 1;
		while (l < r)
		{
			if (a[l] + a[r] > a[i])
			{
				res += r - l;
				r--;
			}
			else
				l++;

		}
	}
	cout << res;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
int main() {
	int N;
	std::cin >> N;
	if (N < 3)
		std::cout << 0 << std::endl;
	else if (N % 3 == 0)
		std::cout << N / 3 << std::endl;
	else
		std::cout << N / 3 << std::endl;
}

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

class C
{
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		var d = new int[n].Select(_ => Console.ReadLine()).GroupBy(x => x).ToDictionary(g => g.Key, g => g.Count());

		var m = d.Max(p => p.Value);
		Console.WriteLine(string.Join("\n", d.Where(p => p.Value == m).Select(p => p.Key).OrderBy(x => x)));
	}
}


Measured memory_bytes: 82224
#include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define int long long
  #define all(v) v.begin(),v.end()
  #define f first
  #define s second
  #define PB push_back
  #define MP make_pair
  #define db long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  #define MOD 1000000007
    

  int32_t main()
  {         
   
      string s;
      cin>>s;

      for(int i=0;i<s.length()-1;i++)
      {
        if(s[i]==s[i+1])
        {
          cout<<"Bad";
          return 0;
        }
      }

      cout<<"Good";

      
      return 0;
  }           

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int h1,h2,k1,k2,a,b,c,d,xh1,xh2,yk1,yk2,xx,yy,xxx,yyy,x1,x2,y1,y2,x,y;
	scanf("%d %d %d %d %d %d %d %d",&h1,&h2,&k1,&k2,&a,&b,&c,&d);
	xh1=h1*a;
	xh2=h2*b;
	yk1=k1*a;
	yk2=k2*b;
	x1=h1/10;
	y1=k1/10;
	x2=h2/20;
	y2=k2/20;
	xxx=(x1*c)+(x2*d);
	yyy=(y1*c)+(y2*d);
	x=xxx+xh1+xh2;
	y=yyy+yk1+yk2;
	if(x==y){
		printf("even\n");
	}
	else if(y<x){
		printf("hiroshi\n");
	}
	else if(x<y){
		printf("kenjiro\n");
	}
	return 0;
}


Measured memory_bytes: 2056
#include <algorithm>
#include <cfloat>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps LDBL_EPSILON
#define mod 1000000007
#define int long long
#define double long double
#define INF LLONG_MAX/1000
#define P pair<int,int>
#define prique priority_queue
using namespace std;
int gcd(int x, int y) {
	if (!y)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
signed main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << b - a + 1 - (b / c - (a - 1) / c + b / d - (a - 1) / d - b / lcm(c, d) + (a - 1) / lcm(c, d)) << endl;
	return 0;
}

Measured memory_bytes: 256
from collections import OrderedDict
d = OrderedDict()
d['S'] = set()
d['H'] = set()
d['C'] = set()
d['D'] = set()
a = frozenset(range(1,14))

n = int(input())
for i in range(n):
    s, r = input().split()
    d[s].add(int(r))

for k, v in d.items():
    racks = a.difference(v)
    for rack in racks:
        print(k, rack)

Measured memory_bytes: 7984
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x) cout<<#x<<" = "<<(x)<<endl;
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  int a,b,c; cin >> a >> b >> c;
  COUT(min(c,b/a));
  return 0;
}

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

int main(void){
    int n;
    cin >> n;
    ll V = 0, E = 0;
    for(int i=1; i<=n; ++i) V+=ll(i)*(n-i+1);
    rep(i, n-1){
        int a, b;
        cin >> a >> b;
        if (a > b) swap(a,  b);
        E += ll(a)*(n-b+1); //Lの取れる個数*Rの取れる個数
    }
    ll ans = V - E;
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3604
#include<iostream>
#include<vector>
#include<map>
#include<cmath>
#include<algorithm>
#include<string>
#include<set>
#include<deque>
#include<bits/stdc++.h>

using namespace std;

#define pb push_back
#define ld long double
#define int long long

mt19937 rnd(51);

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int x;
    cin >> x;
    cout << (x == 0);
    return 0;
}


Measured memory_bytes: 3612
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {1, 1, 1};
int dy[] = {-1, 0, 1};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int board[20][20], dp[30][30];
 
signed main() {
    int W, H;
    while(cin >> W >> H, W || H) {
        memset(board, 0, sizeof(board));
        for(int i=0; i<H; i++) {
            for(int j=0; j<W; j++) {
                cin >> board[i][j];
            }
        }

        memset(dp, 0, sizeof(dp));
        for(int i=0; i<W; i++) if(board[0][i] == 0) dp[0][i] = 1;

        for(int i=0; i<H - 1; i++) {
            for(int j=0; j<W; j++) {
                if(board[i][j] == 1) continue;
                for(int k=0; k<3; k++) {
                    if(board[i][j] == 2 and k != 1) continue;
                    int dbl = (board[i][j] == 2 ? 2 : 1);

                    int ni = i + dx[k] * dbl, nj = j + dy[k];
                    if(ni < 0 or nj < 0 or nj >= W) continue;
                    if(board[ni][nj] == 1) continue;
                    if(board[ni][nj] == 2 and k != 1) continue;
                    dp[ni][nj] += dp[i][j];
                }
            }
        }

        int ans = 0;
        for(int i=H-1; i<H+5; i++) {
            for(int j=0; j<W; j++) {
                ans += dp[i][j];
            }
        }

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


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef complex<double> Point;

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

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

ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

int n;

int main(){
    while(cin >> n && n){
        vector<string> vs;
        ll maxk = 0;
        rep(i,n){
            string s,t = "";
            cin >> s;
            rep(j,s.size()){
                if(j == 0)t += s[j];
                else{
                    if(s[j - 1] == 'a' || s[j - 1] == 'i' || s[j - 1] == 'u' || s[j - 1] == 'e' || s[j - 1] == 'o'){
                        t += s[j];
                    }
                }
            }
            maxk = max(maxk,(ll)t.size());
            vs.push_back(t);
        }
        
        rep(i,51){
            set<string> ss;
            string t;
            rep(j,n){
                if(i+1 <= vs[j].size())t = vs[j].substr(0,i+1);
                else t = vs[j];
                ss.insert(t);
            }
            if(ss.size() == n){
                cout << i+1 << endl;
                break;
            }
            if(i == 50)cout << -1 << endl;

            // ll cnt[30] = {};
            // bool ok = true;
            // rep(j,n){
            //     if(vs[j].size() > i)cnt[vs[j][i] - 'a']++;
            // }
            // rep(j,30){
            //     if(cnt[j] > 1)ok = false;
            // }
            // if(ok){
            //     cout << i+1 << endl;
            //     break;
            // }
            // if(i == maxk - 1){
            //     cout << -1 << endl;
            // }
        }
    }
}


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

int main() {
  int a,b;
  cin >> a >> b;
  
  int count = 0;
  while(a <= b){
    if((a%10==(a/10000)%10) && ((a/10)%10==(a/1000)%10)) count++;
    a++;
  }
  cout << count;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

var n, m, q int

func main() {
	fmt.Scan(&n, &m, &q)

	// 入力を受け取る
	var inputs [][]int
	for i := 0; i < q; i++ {
		var input []int
		for j := 0; j < 4; j++ {
			var num int
			fmt.Scan(&num)
			input = append(input, num)
		}
		inputs = append(inputs, input)
	}

	var nums []int
	for i := 1; i <= m; i++ {
		nums = append(nums, i)
	}

	// 正整数列を作成 1~mの間
	seq := make([]int, 0)
	sequences := make([][]int, 0)
	dfs(seq, &sequences)

	count := 0
	for _, v := range sequences {
		tmpSum := 0
		for _, input := range inputs {
			a, b := input[0], input[1]
			if ((v[b-1]) - (v[a-1])) == input[2] {
				tmpSum += input[3]
			}
		}
		if tmpSum > count {
			count = tmpSum
		}
	}
	fmt.Println(count)
}

func dfs(seq []int, sequences *[][]int) {
	if len(seq) == n {
		*sequences = append(*sequences, seq)
		return
	}

	// 1つ前の要素の数 (最初の要素の場合は1)
	var last int
	if len(seq) == 0 {
		last = 1
	} else {
		last = seq[len(seq)-1]
	}
	// last以上M以下の数を追加
	for i := last; i <= m; i++ {
		dfs(append(seq, i), sequences)
	}
}


Measured memory_bytes: 15396
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Math;
using static System.Console;
using static exMath;
using static exReadLine;


class Program
{
    static void Main(string[] args)
    {
        string S = ReadLine();
        if(S[2] == S[3] && S[4] == S[5])
        {
            WriteLine("Yes");
        }
        else
        {
            WriteLine("No");
        }
    }
}

static class exReadLine
{
    public static void intReadLine(out int a)
    {
        a = int.Parse(ReadLine());
    }
    public static void intReadLine(out int a, out int b)
    {
        int[] input = ReadLine().Split().Select(int.Parse).ToArray();
        a = input[0];
        b = input[1];
    }
    public static void intReadLine(out int a, out int b, out int c)
    {
        int[] input = ReadLine().Split().Select(int.Parse).ToArray();
        a = input[0];
        b = input[1];
        c = input[2];
    }
    public static void intReadLine(out int a, out int b, out int c, out int d)
    {
        int[] input = ReadLine().Split().Select(int.Parse).ToArray();
        a = input[0];
        b = input[1];
        c = input[2];
        d = input[3];
    }

    public static void longReadLine(out long a)
    {
        a = long.Parse(ReadLine());
    }
    public static void longReadLine(out long a, out long b)
    {
        long[] input = ReadLine().Split().Select(long.Parse).ToArray();
        a = input[0];
        b = input[1];
    }
    public static void longReadLine(out long a, out long b, out long c)
    {
        long[] input = ReadLine().Split().Select(long.Parse).ToArray();
        a = input[0];
        b = input[1];
        c = input[2];
    }
    public static void longReadLine(out long a, out long b, out long c, out long d)
    {
        long[] input = ReadLine().Split().Select(long.Parse).ToArray();
        a = input[0];
        b = input[1];
        c = input[2];
        d = input[3];
    }
    
    public static int[] intArrayReadLine()
    {
        return ReadLine().Split().Select(int.Parse).ToArray();
    }

    public static long[] longArrayReadLine()
    {
        return ReadLine().Split().Select(long.Parse).ToArray();
    }

    public static List<int> intListReadLine()
    {
        return ReadLine().Split().Select(int.Parse).ToList();
    }

    public static List<long> longListReadLine()
    {
        return ReadLine().Split().Select(long.Parse).ToList();
    }
}

static class exMath
{
    // 最大公約数
    public static int Gcd(int a, int b)
    {
        if (a < b) return Gcd(b, a);
        while (b != 0)
        {
            var r = a % b;
            a = b;
            b = r;
        }
        return a;
    }
    public static long Gcd(long a, long b)
    {
        if (a < b) return Gcd(b, a);
        while (b != 0)
        {
            var r = a % b;
            a = b;
            b = r;
        }
        return a;
    }

    // 最小公倍数
    public static long Lcm(int a, int b)
    {
        return BigMul(a, b) / Gcd(a, b);
    }
    public static long Lcm(long a, long b)
    {
        return a * b / Gcd(a, b);
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define intt unsigned long long
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i = 0;i<n;i++)
        cin>>a[i];

    vector<int>dp(n,INT_MAX);
    dp[0] = 0;
    for(int i = 0;i<n;i++)
    {
        if(i+1<n)
            dp[i+1] = min(dp[i+1],dp[i]+abs(a[i+1]-a[i]));
        if(i+2<n)
            dp[i+2] = min(dp[i+2],dp[i]+abs(a[i+2]-a[i]));
    }
    cout<<dp.back()<<"\n";
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define mii map<int, int>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type *arr = new type[n];
#define w(x) \
  ll x;      \
  cin >> x;  \
  while (x--) 

void cpc()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

int main(){ 
   
  int k=0;
  string s,t;
  cin>>s>>t;
  for(int i=0;i<s.length();i++){
    if(s[i]!=t[i]){
      cout<<"No"<<"\n";
      k=1;
      break;
    }
  }
  if(k==0){
    cout<<"Yes"<<"\n";
  }
}

Measured memory_bytes: 3624
S = input()
dic = {}

dic[" "] = 1

for i in S:
    dic[i] = 1

cha = "abcdefghijklmnopqrstuvwxyz "

for i in cha:

    if i not in dic:
        print(i)
        break

    if i == " ":
        print("None")
        break


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

using namespace std;

typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli>> mat;

lli n;
lli p;
vll x;
mat tree;

void error(){
  cout << "IMPOSSIBLE" << endl;
  exit(0);
}

lli dfs(lli p){
  mat dp = mat(tree[p].size()+1,vll(5001,LONG_MAX/2ll));
  dp[0][0] = 0;
  for(lli i = 1;i <= tree[p].size();i++){
    lli y = dfs(tree[p][i-1]);
    if(y == LONG_MAX/2ll) error();
    for(lli j = 0;j <= 5000;j++){
      if(j-y >= 0) dp[i][j] = min(dp[i][j],dp[i-1][j-y]+x[tree[p][i-1]]);
      if(j-x[tree[p][i-1]] >= 0) dp[i][j] = min(dp[i][j],dp[i-1][j-x[tree[p][i-1]]]+y);
    }
  }
  // cout << p << " " << *min_element(dp[tree[p].size()].begin(),dp[tree[p].size()].begin()+x[p]) << endl;
  return *min_element(dp[tree[p].size()].begin(),dp[tree[p].size()].begin()+x[p]+1);
}

int main(){
  cin >> n;
  tree = mat(n+1);
  x = vll(n+1);
  for(lli i = 2;i <= n;i++){
    cin >> p;
    tree[p].push_back(i);
  }
  for(lli i = 1;i <= n;i++) cin >> x[i];
  if(dfs(1) == LONG_MAX/2ll) error();
  cout << "POSSIBLE" << endl;
  return 0;
}


Measured memory_bytes: 41440
#include <stdio.h>

int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  int h, ans=0;
  for (int i=0; i<n; i++) {
    scanf("%d", &h);
    ans = (h>=k) ? ans+1 : ans;
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;
int main(void){
    int A[20], B[20], C[19];
    int N;
    
    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];
    for (int i = 0; i < N; i++) cin >> B[i];
    for (int i = 0; i < N-1; i++) cin >> C[i];
    
    int value = 0;
    int before_food = -2;
    for (int i = 0; i < N; i++) {
        value += B[A[i]-1];
        if (before_food == A[i]-1)
            value += C[before_food-1];
        before_food = A[i];
    }
    cout << value << endl;
}

Measured memory_bytes: 256