akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define MOD 998244353
using namespace std;
struct point
{
    int x,y;
};
inline bool sameline(point a,point b,point c)
{
    if(a.x==b.x&&b.x==c.x)
        return true;
    if((a.x-b.x)*(b.y-c.y)==(b.x-c.x)*(a.y-b.y))
        return true;
    return false;
}
int n;
point a[205];
long long ans=1;
int main()
{
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        ans=ans*2%MOD;
    ans-=n+1;
    ans%=MOD;
    while(ans<0)
        ans+=MOD;
    for(int i=0;i<n;i++)
        scanf("%d %d",&a[i].x,&a[i].y);
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            long long  d=4,amt=2;
            bool vst=false;
            for(int k=0;k<j;k++)
                if(k!=i&&k!=j&&sameline(a[i],a[j],a[k]))
                    vst=true;
            if(vst)
                continue;
            for(int k=j+1;k<n;k++){
                if(sameline(a[i],a[j],a[k])){
                    d=d*2%MOD;
                    amt++;
                }
            }
            ans-=d-amt-1;
            ans%=MOD;
            while(ans<0)
                ans+=MOD;
        }
    }
    printf("%lld",ans);
    return 0;
}

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

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //  repマクロ
#define leng(n) (int)(log10(n)+1)  //  桁数leng
#define INF 9223372036854775807 //  巨大数INF
using namespace std;

signed main() {
  string s;
  cin >> s;
  int ans = INF;
  rep(i, s.size()-2){
    string t = "";
    t += s[i];
    t += s[i+1];
    t += s[i+2];
    int n = stoll(t);
    ans = min(ans, abs(753-n));
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
N = int(input())
H = list(map(int, input().split()))

ans = 'Yes'
max = 0
for h in H:
    # 今までの後の最大値よりも、2以上小さい数があればNG
    if h <= max - 2:
        ans = 'No'
        break

    # 現在の項が最大値となる場合、最大値を入れ替え
    if h >= max:
        max = h
    else:
        continue

print(ans)


Measured memory_bytes: 14252
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
int main(){
  ll a,b,n;cin>>a>>b>>n;
  if(n==1){
    cout<<a *n/b-a*(n/b);
  }else if(n<=b){
    if(n==b)n--;
    cout<<a*n/b-a*(n/b);
  }else if(n%b==b-1){
    cout<<a*n/b-a*(n/b);
  }else{
    ll c=b*(n/b)-1;
    cout<<max(a*n/b-a*(n/b),a*c/b-a*(c/b));
  }
}

Measured memory_bytes: 3532
#include <bits/stdc++.h>
#define PI 3.14159265358979323846264338327
using namespace std;
using ld = long double;
int main() {
  cout << fixed << setprecision(15);
  ld a, b, h, m;
  ld rad, ans;
  cin >> a >> b >> h >> m;
  if (h == 0.0L && m == 0.0L) {
    cout << abs(a - b) << endl;
    return 0;
  }
  h = h * 30.0L + m * 0.5L;
  m = m * 6.0L;
  // cout << h  << m << endl;
  if (h - m > 180.0L) {
    rad = (m - h) * PI / 180.0L;
  } else {
    rad = (h - m) * PI / 180.0L;
  }
  //cout << rad << endl;
  ans = a * a + b * b - 2.0L * a * b * cosl(rad);
  cout << sqrtl(ans) << endl;
  return 0;
}

Measured memory_bytes: 4036
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <set>

using namespace std;

typedef long long i64;
typedef int int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;

typedef pair<int_t, int_t> pi;

#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)

int main(int argc, char *argv[]) {
  i64 N, M, i;
  cin >> N >> M;
  getchar();
  string S;
  getline(cin, S);
  vi G;
  REP(0, N+1, i) {
    if(S[i] == '0')
      G.pb(i);
  }

  vi ans;
  i64 cur = N;
  while(cur > 0) {
    i64 n = cur - M - 1;
    auto next = upper_bound(all(G), n);
    ans.pb(cur - *next);
    //cout << cur << "->" << *next << endl;
    if(cur == *next) {
      cout << -1 << endl;
      return 0;
    }
    cur = *next;
  }
  
  REP(0, sz(ans), i) {
    if(i > 0)
      cout << " ";
    cout << ans[sz(ans)-i-1];
  }
  cout << endl;
  
  
  return 0;
}


Measured memory_bytes: 1592
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        //static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var N = Sarray()[0];
            var ans = N.ToString().Length;
            for (var i = 1L; i * i <= N; ++i)
            {
                if (N % i == 0)
                {
                    var tmp = Max(i.ToString().Length, (N / i).ToString().Length);
                    ans = Min(ans, tmp);
                }
            }
            WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13396
from functools import reduce

A,B= (int(i) for i in input().split()) 

def XOR(x):
	if x%2==1:
		if ((x+1)//2)%2==0:
			return 0
		else:
			return 1
	else:
		if (x//2)%2==0:
			return int(format(x,"b"))
		else:
			return int(format(x,"b"))+1

ans = int(str(XOR(A-1)), 2) ^ int(str(XOR(B)), 2)
print(ans)

Measured memory_bytes: 3684
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

const pi = math.Pi

var mod int = pow(10, 9) + 7
var Umod uint64 = 1000000007
var ans, cnt, sum int = 0, 0, 0

func main() {
	reader.Split(bufio.ScanWords)
	S := read()
	if S == "Sunny" {
		fmt.Println("Cloudy")
	} else if S == "Cloudy" {
		fmt.Println("Rainy")
	} else {
		fmt.Println("Sunny")
	}
}

/*  ----------------------------------------  */

var reader = bufio.NewScanner(os.Stdin)

func read() string {
	reader.Scan()
	return reader.Text()
}

func lcm(x, y int) int {
	return (x / gcd(x, y)) * y
}

func gcd(x, y int) int {
	if x%y == 0 {
		return y
	} else {
		r := x % y
		return gcd(y, r)
	}
}

var fac [1000000]int
var finv [1000000]int
var inv [1000000]int

func combination_init() {
	fac[0], fac[1] = 1, 1
	finv[0], finv[1] = 1, 1
	inv[1] = 1

	// invは a^(-1) mod p
	// pをaで割ることを考える

	// p/a*(a) + p%a = p
	// p/a*(a) + p%a = 0          (mod p)
	// -p%a = p/a*(a)             (mod p)
	// -p%a *a^(-1)= p/a          (mod p)
	// a^(-1)= p/a * (-p%a)^(-1)  (mod p)
	// a^(-1) =

	for i := 2; i < 1000000; 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
	}
}

func combination(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[y] * finv[x-y] % mod) % mod
	//return fac[x] / (fac[y] * fac[x-y])
}

func permutation(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[x-y] % mod) % mod
	//return fac[x] / fac[x-y]
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }
func ceil(x int) int   { return int(math.Ceil(float64(x))) }

type SortBy []int

func (a SortBy) Len() int           { return len(a) }
func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool { return a[i] < a[j] }

type PriorityQueue []int

func (h PriorityQueue) Len() int            { return len(h) }
func (h PriorityQueue) Less(i, j int) bool  { return h[i] < h[j] }
func (h PriorityQueue) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
func (h *PriorityQueue) Push(x interface{}) { *h = append(*h, x.(int)) }
func (h *PriorityQueue) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define int           long long
#define pb            push_back
#define all(a)        (a).begin(),(a).end()
#define sz(x)         (int)x.size()
#define F             first
#define S             second
#define endl          "\n"
#define inf           (long long)1000000007
#define FOR(i, a, b)  for(int i=a; i<b; i++)
#define bigint        1e18
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 
#define SHUF(v) shuffle(aint(v), RNG);
// Use mt19937_64 for 64 bit random numbers. 

template <typename T>
T ceil(T a, T b){ return (a+b-1)/b; }


template<typename T>
T binpow(T a, T b, T m) {
    a %= m;
    T res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

void solve(){
    int n, x, t;
    cin>>n>>x>>t;
    int r = (n+x-1)/x;
    cout<<r*t;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);     
    int t=1;
    //cin>>t;
    FOR(i, 1, t+1){ 
        //cout<<"Case #"<<i<<": ";
        solve();
    }
    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
 
}


Measured memory_bytes: 3564
#include "bits/stdc++.h"
using namespace std;

// 定義
typedef long long         ll;
typedef pair<ll, ll>      P;
#define ALL(x)            (x).begin(),(x).end()
#define REP(i, n)         for(ll i = 0 ; i < (ll)n ; ++i)
#define REPN(i, m, n)     for(ll i = m ; i < (ll)n ; ++i)
#define REVREP(i, n)      for(ll i = n - 1; i >= 0 ; i--)
#define VL                vector<ll>
#define VVL               vector<vector<ll>>
#define VVVL              vector<vector<vector<ll>>>
#define VC                vector<char>
#define VVC               vector<vector<char>>
#define INF               2e9
#define INF_LL            1LL<<60
#define MOD               1000000007

ll Ceil(ll val, ll div)   { return (val + div - 1) / div; }
ll CeilN(ll val, ll div)  { return Ceil(val, div) * div; }
ll FloorN(ll x, ll n)     { return (x - x % n); }
bool IsOdd(ll x)          { return ((x & 1) == 1); }
bool IsEven(ll x)         { return ((x & 1) == 0); }
ll _accumulate(const VL &v) { return accumulate(ALL(v), (ll)0); }
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


/* 素因数分解 */
map<ll, ll> factMap;
void primeFactor(ll n)
{
	if ((n % 2) == 0){
		while ((n % 2) == 0) {
			factMap[2]++;
			n = n / 2;
		}
	}

	for (ll i = 3; i <= sqrt(n); i += 2){
		while ((n % i) == 0){
			factMap[i]++;
			n = n / i;
		}
	}

	if (n != 1) {
		factMap[n]++;
	}
}


// 処理
void Solve()
{
	ll N;
	cin >> N;
	primeFactor(N);

	ll ans = 0;
	for (auto one : factMap) {
		ll cnt = 1;
		while (cnt <= one.second) {
			one.second -= cnt;
			ans++;
			cnt++;
		}
	}
	cout << ans << endl;
}

// メイン
int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Solve();
	return 0;
}


Measured memory_bytes: 3696
#include<stdio.h>

int main(void)
{
char a[101],b[101];
int i, flg;

scanf("%s", a);
scanf("%s", b);

for(i=0;a[i]!='\0' && b[i]!='\0';i++);
if(a[i]!='\0' && b[i]=='\0'){
printf("GREATER\n");
}else if(a[i]=='\0' && b[i]!='\0'){
printf("LESS\n");
}else {
flg = strcmp(a,b);
if(flg==0){
printf("EQUAL\n");
}else if(flg < 0){
printf("LESS\n");
}else{
printf("GREATER\n");
}
}
return 0;
}

Measured memory_bytes: 128
n,k,r,s,p,t=$<.read.split
n,k,r,s,p = [n,k,r,s,p].map(&:to_i)

ret = 0
i = 0
while i < k
  case t[i]
  when 'r' then ret += p
  when 's' then ret += r
  when 'p' then ret += s
  end
  i += 1
end

while i < t.length
  if t[i-k] != t[i]
    case t[i]
    when 'r' then ret += p
    when 's' then ret += r
    when 'p' then ret += s
    end
  else
    t[i] = '-'
  end
  i += 1
end

p ret


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

int main()
{
    long long int x,p,c;
    cin >> x;
    p=100,c=0;
    while(p<x)
    {
        p+=p/100;
        c++;
    }

    cout << c << endl;


    return 0;
}


Measured memory_bytes: 3636
a,b,c,d = input()
op_list = ['-', '+']
for i in range(8):
    op = format(i, '03b')
    formula = a+op_list[int(op[0])]+b + op_list[int(op[1])]+c + op_list[int(op[2])] +d
    if eval(formula) == 7:
        print(formula + '=7')
        break

Measured memory_bytes: 3060
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll __int64
#define ll long long
int n;
ll a[111111];
int cnt[111111];
int c1,c2;

int main(){
	cin>>n;
	rep(i,n)cin>>a[i];
	rep(i,n){
		cnt[a[i]+2]++;
		cnt[a[i]+1]++;
		cnt[a[i]]++;
	}
	int tmp=0,in=0;
	for(int i=0;i<=111110;i++)if(tmp<cnt[i])tmp=cnt[i],in=i;
	cout<<tmp<<endl;
	return 0;
}


Measured memory_bytes: 1408
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;

#define dump(a) (cerr << #a << " = " << (a) << endl)

struct data {
	int turn, damage, idx;
	data(int t, int d, int i):turn(t), damage(d), idx(i){}

	bool operator<(const data& d) const {
		return (double)damage / turn < (double)d.damage / d.turn;
	}
};

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

	int n;
	cin >> n;

	vector<int> h(n + 1), a(n + 1), d(n + 1), s(n + 1);
	for(int i = 0; i < n + 1; ++i)
		cin >> h[i] >> a[i] >> d[i] >> s[i];

	vector<data> dat;
	dat.reserve(n);
	for(int i = 1; i < n + 1; ++i) {
		const int attack = max(0, a[0] - d[i]);
		const int damage = max(0, a[i] - d[0]);
		if(attack == 0) {
			if(damage == 0)
				continue;

			cout << -1 << endl;
			return EXIT_SUCCESS;
		}

		const int turn = ceil((double)h[i] / attack);
		dat.push_back(data(turn, damage, i));
	}

	sort(dat.rbegin(), dat.rend());
	long long turn = 0, hp = h[0];
	for(int i = 0; i < n; ++i) {
		turn += dat[i].turn;
		hp -= dat[i].damage * (turn - (s[0] > s[dat[i].idx] ? 1 : 0));
		if(hp <= 0) {
			cout << -1 << endl;
			return EXIT_SUCCESS;
		}
	}

	cout << h[0] - hp << endl;

	return EXIT_SUCCESS;
}

Measured memory_bytes: 2060
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <list>
#include <queue>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <math.h>

using namespace std;

int combi(int n, int s, vector<int> usedNum){
	int combiCount = 0;
	int tmp;
	bool usedFlag;

	n--;
	for(int i = 0; i <= 9; i++){
		usedFlag = false;
		
		for(int j = 0; j < usedNum.size(); j++){
			if(usedNum[j] == i) usedFlag = true; 
		}
		
		if(usedFlag){
			continue;
		}
		tmp = s;
		tmp -= i;
		if(n != 0){
			usedNum.push_back(i);
			combiCount += combi(n, tmp, usedNum);
		}
		else if(n == 0 && tmp == 0){
			usedNum.pop_back();
			return ++combiCount;
		}
	}

	usedNum.pop_back();
	return combiCount;
}


int main(){
	int n, s;
	int combiCount = 0;
	vector<int> usedNum;
	while(cin >> n >> s && (n != 0 || s != 0)){
		combiCount = combi(n, s, usedNum);
		cout << combiCount << endl;
	}
	return 0;
}

Measured memory_bytes: 1216
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>

using ll = long long;
using namespace std;

int main() {
	int n;
	cin >> n;
	if (n < 1000) {
		cout << "ABC";
	}
	else {
		cout << "ABD";
	}
}







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

int main() {
  long A, B, C;
  cin >> A >> B >> C;
  if (min({A % 2, B % 2, C % 2}) == 0) cout << 0 << endl;
  else cout << min({A*B, B*C, C*A}) << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
	int r, D, x[11], y;
	cin >> r >> D >> x[0];




	for(int i=1; i<11; ++i){
		x[i] =r * x[i-1] - D;
		cout << x[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
 
using namespace std;
 
int main() {
    //ifstream in("C:\\Users\\yossw\\Desktop\\<name>.txt");
    //cin.rdbuf(in.rdbuf());
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if(abs(c-a)<=d || (abs(b-a)<=d && abs(c-b)<=d))cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

class Main {
    int H, W;
    int N;
    vector<int> a;
    void input() {
        cin >> H >> W >> N;
        a.resize(N);
        REP(i, N) { cin >> a[i]; }
    }
    void output() {
        vector<int> memo;
        REP(i, N) {
            REP(j, a[i]) { memo.emplace_back(i + 1); }
        }
        vector<vector<int>> res(H, vector<int>(W));
        REP(i, H) {
            REP(j, W) { res[i][j] = memo[i * W + j]; }
        }
        for (int i = 1; i < H; i += 2) { REV(res[i]); }
        REP(i, H) {
            REP(j, W) { cout << res[i][j] << " "; }
            cout << endl;
        }
    }

public:
    Main() {
        input();
        output();
    }
};

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

    Main();

    return 0;
}


Measured memory_bytes: 3812
def main():
    n, k = [int(val) for val in input().split()]
    values = [int(val) for val in input().split()]

    now_max = min(values) - 1
    for left_num in range(n + 1):
        for right_num in range(n - left_num + 1):
            if left_num + right_num > k:
                break
            for discard_num in range(k - left_num - right_num + 1):
                left_values = values[:left_num]
                right_values = list(reversed(values))[:right_num]
                all_values = left_values + right_values
                result = sum(sorted(all_values)[discard_num:])
                if result > now_max:
                    now_max = result
    print(now_max)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
import java.io.*;
import java.util.*;

public class Main implements Runnable {
    static ContestScanner in;
    static Writer out;
    public static void main(String[] args) {
        new Thread(null, new Main(), "", 16 * 1024 * 1024).start();
    }

    public void run() {
        Main main = new Main();
        try {
            in = new ContestScanner();
            out = new Writer();
            main.solve();
            out.close();
            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    void solve() throws IOException {
        int n = in.nextInt();
        int l = in.nextInt();
        int trueSum = 0;
        int min = 100000;
        for (int i = 0; i < n; i++) {
            trueSum += l + i;
            if (Math.abs(min) > Math.abs(l + i)) {
                min = l + i;
            }
        }
        System.out.println(trueSum - min);
    }
}

class Writer extends PrintWriter{
    public Writer(String filename)throws IOException
    {super(new BufferedWriter(new FileWriter(filename)));}
    public Writer()throws IOException {super(System.out);}
}
class ContestScanner implements Closeable {
    private BufferedReader in;private int c=-2;
    public ContestScanner()throws IOException
    {in=new BufferedReader(new InputStreamReader(System.in));}
    public ContestScanner(String filename)throws IOException
    {in=new BufferedReader(new InputStreamReader(new FileInputStream(filename)));}
    public String nextToken()throws IOException {
        StringBuilder sb=new StringBuilder();
        while((c=in.read())!=-1&&Character.isWhitespace(c));
        while(c!=-1&&!Character.isWhitespace(c)){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public String readLine()throws IOException{
        StringBuilder sb=new StringBuilder();if(c==-2)c=in.read();
        while(c!=-1&&c!='\n'&&c!='\r'){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public long nextLong()throws IOException,NumberFormatException
    {return Long.parseLong(nextToken());}
    public int nextInt()throws NumberFormatException,IOException
    {return(int)nextLong();}
    public double nextDouble()throws NumberFormatException,IOException
    {return Double.parseDouble(nextToken());}
    public void close() throws IOException {in.close();}
}


Measured memory_bytes: 23508
#include<stdio.h>

int main(void){
  int ans;
  int N, M, L, R;
  int min = 0, max = 100000;
  scanf("%d %d", &N , &M);

  for(int i = 0 ; i < M ; i++){
    scanf("%d %d", &L , &R);
    min = (min < L) ? L : min;
    max = (R < max) ? R : max; 
  }

  if(min <= max){
 	 ans = max - min + 1;
  }else{
    ans = 0;
  }

  printf("%d\n", ans);

  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

#define mod 1000000007

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

string S;

int main(){
    cin>>S;
    cout<<S[0]<<S.length()-2<<S[S.length()-1]<<endl;
}

Measured memory_bytes: 256
function f()
    N = parse(Int, readline())
    Nmin = N - 1
    k = 1
    while k*k <= N
        l = Int(floor(N/k))
        if (k*l == N)
            Nmin = min(Nmin, k+l-2)
        end
        k += 1
    end
    println(Nmin) 
end 
f()

Measured memory_bytes: 157024
def bubble_sort(array)
  times = 0
  (0...array.size).each do |i|
    (i + 1...array.size).reverse_each do |j|
      if array[j] < array[j - 1]
        times += 1
        array[j], array[j - 1] = array[j - 1], array[j]
      end
    end
  end
  [array, times]
end
n = gets.to_i
s = gets.split.map(&:to_i)
array, times = bubble_sort(s)
puts array.join(' ')
puts times

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

int main(void)
{
  int a, b;
  cin >> a >> b;
  a = a * b % 2;
  if (a == 0)
  {
    cout << "Even" << endl;
  }
  else
  {
    cout << "Odd" << endl;
  }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define pii pair<int,int>
#define ti3 tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
ll int MOD=998244353;
#define N 3000000
 
using namespace std;
string alphabet("abcdefghijklmnopqrstuvwxyz");

main(){
    ll int n;
    int a[N];
    cin>>n;
    ll int sum=0;
    rep(i,n){
        cin>>a[i];
        sum+=a[i];
    }
    ll int m=n*(n+1)/2;
    if(sum%m!=0){
        cout<<"NO"; return 0;
    }
    sum=sum/m;
    rep(i,n){
        if(a[i]<sum){
            cout<<"NO"; return 0;
        }
    }
    sum=sum%n;
    rep(i,n){
        if(i==n-1){
            if((a[i]+sum)%n!=(a[0])%n){
                cout<<"NO"; return 0;
            }
        }
        else{
            if((a[i]+sum)%n!=(a[i+1])%n){
                cout<<"NO"; return 0;
            }
        }
    }
    cout<<"YES";
    return 0;
}

Measured memory_bytes: 2560
inf = float("inf")
N, M = map(int, input().split())
A = map(int, input().split())
C = [2, 5, 5, 4, 5, 6, 3, 7, 6]
costs = {m: C[m - 1] for m in A}
dp = [0]
for i in range(1, N + 1):
    dp.append(
        max([dp[i - c] if i - c >= 0 else -inf for c in costs.values()]) + 1)

digits = list(costs.keys())
digits = sorted(digits, reverse=True)
num = N
result = []
for _ in range(dp[N]):
    for digit in digits:
        if num >= costs[digit] and dp[num - costs[digit]] != -inf and dp[num - costs[digit]] == dp[num] - 1:
            result.append(str(digit))
            num -= costs[digit]
            break
print("".join(result))


Measured memory_bytes: 3708
#include <iostream>

using namespace std;
 
int main() 
{
    int a, b, c;
    cin >> a >> b >> c;
    if(a <= b && b <= c)
        cout << a << " " << b << " " << c << endl;
    else if(a <= c && c <= b)
        cout << a << " " << c << " " << b << endl;
    else if(b <= c && c <= a)
        cout << b << " " << c << " " << a << endl;
    else if(b <= a && a <= c)
        cout << b << " " << a << " " << c << endl;
    else if(c <= b && b <= a)
        cout << c << " " << b << " " << a << endl;
     else if(c <= a && a <= b)
        cout << c << " " << a << " " << b << endl;    
}


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

class P
{
    static void Main()
    {
        Console.ReadLine();
        int[] A = Console.ReadLine().Split().Select(x => int.Parse(x) - 1).ToArray();
        List<int>[] liked = Enumerable.Range(1, A.Length).Select(_ => new List<int>()).ToArray();
        for (int i = 0; i < A.Length; i++)
        {
            liked[A[i]].Add(i);
        }
        int res = 0;
        for (int i = 0; i < A.Length; i++)
        {
            foreach (var item in liked[i])
            {
                if (item > i) break;
                if (liked[item].Contains(i)) res++;
            }
        }
        Console.WriteLine(res);
    }
}

Measured memory_bytes: 36340
#include<stdio.h>
 
#define N 100
 
int main(){
  int M[N][N];
  int n,u,k,v;
  int i,j;
   
  scanf("%d",&n);
 
  for(i = 0;i < n;i++){
    for(j = 0;j < n;j++){
      M[i][j] = 0;
    }
  }
 
  for(i = 0;i < n;i++){
    scanf("%d%d",&u,&k);
    u--;
    for(j= 0;j < k; j++){
      scanf("%d",&v);
      v--;
      M[u][v] = 1;
    }
  }
 
  for(i = 0;i < n; i++){
    for(j = 0;j < n; j++){
      if(j)printf(" ");
       printf("%d",M[i][j]);
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 636
import java.util.*;
import java.io.*;
 
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
    
    public  static void main(String[] args)   throws Exception, IOException{
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // int d[]=new int[n];
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}
 
        int n=sc.nextInt();
        int m=sc.nextInt();
        int ans=1;
        for (int i=1; i*i<=m ;i++ ) {            
            if(m%i==0 && n<=m/i)ans=max(ans,i);          
            if(m%i==0 && n<=i)ans=max(ans,m/i);
        }
 
 
        out.println(ans);
        out.flush();
        // out.println(ans);
    }
 
 
    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
 
    static long gcd(long a, long b){
        if(min(a,b) == 0)return max(a,b);
        return gcd(max(a,b) % min(a,b),min(a,b));
    }
}
 
class P implements Comparable<P>{
    int id, d;
    P(int  id, int d) {
        this.id=id;
        this.d=d;
    }
    public int compareTo(P p){
        return d-p.d; //des
    }
}
 
class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}

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

using namespace std;



int main() {
 int n;
 cin>>n;
 int res=0;
 map<long long,vector<long long>> mp{};
 int t=n;
 while (t--) {
     long long x;
     cin>>x;
     long long l;
     cin>>l;
     mp[x-l].push_back(x+l);
 }
 set<long long> cur{};
 for (auto p:mp) {
     int frnt=p.first;
     if (!cur.empty() && (*cur.begin())<=frnt) {
         res++;
         cur.clear();
     }
     for (long long a:p.second) cur.insert(a);
 }
 
 cout<<res+1<<endl;
 
 return 0;
}

Measured memory_bytes: 13568
#include <iostream>
#include <map>

int main(){
   int N, M;
   std::cin >> N >> M;
   std::map<int, int> mp;
   bool flag = true;
   for (int i=0; i<M; i++){
      int key, val;
      std::cin >> key >> val;
      if (mp.find(key) == mp.end()){
         mp[key] = val;
      } else{
         if (mp[key] != val){
            flag = false;
         }
      }
   }
   if (mp.find(1) != mp.end()){
      if ((N != 1) && mp[1] == 0){
         flag = false;
      }
   }
   if (!flag){
      std::cout << -1 << std::endl;
      return 0;
   }

   bool flag2 = false;
   for (int i=1; i<=N; i++){
      if (mp.find(i) != mp.end()){
         flag2 = true;
      }
      if (flag2){
         std::cout << mp[i];
      } else{
         if (N == 1){
            std::cout << 0;
         } else{
            std::cout << 1;
            flag2 = true;
         }
      }
   }
   std::cout << std::endl;


}



Measured memory_bytes: 3600
#include <iostream>

using namespace std;
typedef long long ll;

string n;
int k;
ll dp1[110][4]; // < n
ll dp2[110][4]; // maybe < n

void solve() {
  dp2[0][0] = 1;
  for (int i=0;i<n.size();i++) {
    for (int j=0;j<=k;j++) {
      dp1[i+1][j] += dp1[i][j];
      if (n[i] == '0') {
        dp2[i+1][j] += dp2[i][j];
      } else {
        dp1[i+1][j] += dp2[i][j];
      }
      if (j + 1 > k) {
        continue;
      }
      for (int l=1;l<=9;l++) {
        if (n[i] - '0' == l) {
          dp2[i+1][j+1] += dp2[i][j];
        }
        dp1[i+1][j+1] += dp1[i][j];
        if (n[i] - '0' > l) {
          dp1[i+1][j+1] += dp2[i][j];
        }
      }
    }
  }
  cout << dp1[n.size()][k] + dp2[n.size()][k] << endl;
}

int main() {
  cin >> n >> k;
  solve();
}


Measured memory_bytes: 256
/*
   Created by Rahul Goel.
*/
/*******************************************************************************/
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
/*******************************************************************************/
using namespace std;
using ll = long long;
using ld = long double;
ll mod = 1000000007;
const int INF = 1e9;
const ll LINF = 1e18;
/*******************************************************************************/
/*
.-.. . -. -.- .- / .. ... / .-.. --- ...- . -.-.--
 */
/* For PBDS */
/*Two new methods X.order_of_key() and X.find_by_order()*/
/*
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/

/*******************************************************************************/
ll mod_sum() { return 0LL; }
template<typename T, typename... Args>
T mod_sum(T a, Args... args) { return ((a + mod_sum(args...))%mod + mod)%mod; }

ll mod_prod() { return 1LL; }
template<typename T, typename... Args>
T mod_prod(T a, Args... args) { return (a*mod_prod(args...))%mod; }
/*******************************************************************************/
using pii = pair < ll, ll >;
using vi = vector < ll >;
using vb = vector < bool >;
using vvi = vector < vector < ll > >;
using vvb = vector < vector < bool > >;
using vpii = vector < pii >;
using vvpii = vector < vector < pii > >;
#ifdef ONLINE_JUDGE
#define endl '\n'
#endif
#define fastio          ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(c)          (c).begin(), (c).end()
#define present(c,x)    ((c).find(x) != (c).end())
#define cpresent(c,x)   (find(all(c),x) != (c).end())
#define uniq(c)         (c).resize(distance((c).begin(), unique(all(c))))
#define min_pq(t)       priority_queue < t, vector < t >, greater < t > >
#define max_pq(t)       priority_queue < t >
#define pb              push_back
#define ff              first
#define ss              second
/*******************************************************************************/

/*
    Code begins after this.
*/


ll solve(){
    ll x, n;
    cin >> x >> n;
    vb vis(105);
    for(ll i=0; i<n; i++){
        ll b;
        cin >> b;
        vis[b] = true;
    }
    ll dif = LINF, ans = LINF;
    for(ll i=0; i<(ll)vis.size(); i++){
        if(!vis[i] && llabs(i-x) < dif)
            dif = llabs(i-x), ans = i;
    }
    cout << ans << endl;
    return 0;
}


signed main(){
    fastio;

    ll t = 1;
    while(t--)
        solve();

    return 0;
}

/*******************************************************************************/
// Remeber - In a custom comparator cmp(a, b) a==b must always return to false.


Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define sz(arr) (int)arr.size()
#define All(arr) arr.begin(), arr.end()

using namespace std;
typedef long long ll;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

#define Cins(T, n, xs) \
  vector<T> xs(n);     \
  for (int i = 0; i < n; ++i) cin >> xs[i]

void Main() {
  Cin(int, n);
  Cin(string, s);
  if (s.substr(0, n / 2) == s.substr(n / 2))
    puts("Yes");
  else
    puts("No");
}

int main() {
  cout << fixed << setprecision(15);
  Main();
  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;
const int N = 2e5 + 10;
int F[N];

int64 power_mod(int64 a, int n) {
  int64 ret = 1;
  for (; n; n >>= 1) {
    if (n & 1) ret = ret * a % MOD;
    a = a * a % MOD;
  }
  return ret;
}

int64 inv_mod(int64 a) {
  return power_mod(a, MOD - 2);
}

int64 comb(int n, int m) {
  return F[n] * inv_mod(F[m]) % MOD * inv_mod(F[n - m]) % MOD;
}

int main() {
  F[0] = 1;
  for (int i = 1; i < N; ++i) F[i] = (int64)F[i - 1] * i % MOD;
  int H, W, A, B;
  cin >> H >> W >> A >> B;
  int ret = 0;
  int pre = 0;
  for (int i = B + 1; i <= W; ++i) {
    int cur = comb(H - A + i - 2, i - 1);
    ret += (cur + MOD - pre) * comb(A + W - i, W - i) % MOD;
    ret %= MOD;
    pre = cur;
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 1024
//
// Created by moono on 2018/10/27.
//

#include <vector>
#include <iostream>
using namespace std;




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

    if(N == 0)
        cout << 2 << endl;
    else if(N == 1)
        cout << 1 << endl;
    else{
        long long p1 = 2, p2 = 1, l;
        for (int i = 2; i <= N; ++i) {
            l = p1 + p2;
            p1 = p2;
            p2 = l;
        }


        cout << l << endl;
    }


    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

int mystoi(string s) {
  stack<int> st;
  FOR(i,0,4) st.push(1);
  int ret = 0;
  FOR(i,0,s.length()) {
    if(s[i] >= '2' && s[i] <= '9') {
      st.push(s[i]-'0');
    } else {
      if(s[i] == 'm') ret += 1000 * st.top();
      if(s[i] == 'c') ret += 100 * st.top();
      if(s[i] == 'x') ret += 10 * st.top();
      if(s[i] == 'i') ret += st.top();
      st.pop();
    }
  }
  return ret;
}

string myitos(int x) {
  string ret = "";
  if(x % 10 == 1) ret = 'i' + ret;
  else if(x % 10 > 1) ret = to_string(x % 10) + 'i' + ret;
  x /= 10;
  if(x % 10 == 1) ret = 'x' + ret;
  else if(x % 10 > 1) ret = to_string(x % 10) + 'x' + ret;
  x /= 10;
  if(x % 10 == 1) ret = 'c' + ret;
  else if(x % 10 > 1) ret = to_string(x % 10) + 'c' + ret;
  x /= 10;
  if(x % 10 == 1) ret = 'm' + ret;
  else if(x % 10 > 1) ret = to_string(x % 10) + 'm' + ret;
  return ret;
}

int main()
{
  int n; cin >> n;
  while(n--) {
    string a, b;
    cin >> a >> b;
    int aa = mystoi(a);
    int bb = mystoi(b);
    cout << myitos(aa + bb) << endl;
  }
  return 0;
}

Measured memory_bytes: 3140
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

using static Input;
using static Util;
class Program
{
    static long L, R;
    static void INPUT()
    {
        L = NextLong();
        R = NextLong();
    }

    static void OUT()
    {
        var min = long.MaxValue;
        R = Math.Min(R, L + 2020);
        for (var i = L; i <= R; i++)
            for (var j = i + 1; j <= R; j++)
                min = Math.Min(min, (i % 2019  * j % 2019) % 2019);

        Console.WriteLine(min);
    }

    static void Main(string[] args)
    {
#if DEBUG  
        //TESTINPUT();
        INPUT();

#else
        INPUT();
#endif
        OUT();
    }

    static void TESTINPUT()
    {
    }

}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

class Util
{
}


Measured memory_bytes: 17728
s = input()
q = int(input())
for i in range(q):
    x = input().split()
    func = x[0]
    a = int(x[1])
    b = int(x[2])
    if func=="print":
        print(s[a:b+1])
    elif func=="reverse":
        #s = s[:a]+s[b:a]+s[b+1:]
        s = list(s)
        if a==0:
            s[a:b+1] = s[b::-1]
        else:
            s[a:b+1] = s[b:a-1:-1]
        s = "".join(s)
    elif func=="replace":
        p = x[3]
        s = s[:a] + p + s[b+1:]
        

Measured memory_bytes: 7712
#include <iostream>
#include <set>
using namespace std;
using ll = long long;
#define out(v) cout<<v<<"\n"

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  ll N; cin >> N;
  ll ans = 0;
  if (N == 2) {
    out(0);
    return 0;
  }
  set<int> ms;
  for (ll m = 1; m * m <= N; ++m) {
    if (N % m == 0) {
      if (ms.find(m+1) == ms.end() && N / (m + 1) == N % (m + 1)) {
        ms.insert(m+1);
        ans += m + 1;
      }
      if (ms.find(N / m - 1) == ms.end() && m * m != N && N / (N / m - 1) == N % (N / m - 1)) {
        ms.insert(N / m - 1);
        ans += N / m - 1;
      }
    }
  }
  out(ans);

  return 0;
}



Measured memory_bytes: 384
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS

readInt = fst . fromJust . BS.readInteger
readIntList = map readInt . BS.words
getIntList = readIntList <$> BS.getLine
getIntNList n = map readIntList <$> replicateM (fromIntegral n) BS.getLine

addlist :: Num a => [a] -> [a] -> [a]
addlist xs [] = xs
addlist [] ys = ys
addlist (x:xs) (y:ys) = (x + y) : addlist xs ys

calc :: Num a => [a] -> [[a]] -> [a]
calc _ [] = []
calc [] _ = []
calc (c:cs) (xs:xss) = addlist (map (*c) xs) (calc cs xss) 

main = do
  [n, m, x] <- getIntList
  cs <- map readIntList <$> replicateM (fromIntegral n) BS.getLine
  let ps = replicateM (fromIntegral n) [0, 1]
  let results = filter (\t -> all (>=x) (tail t)) [calc p cs| p <- ps]
  if results == [] then
  	putStrLn $ "-1"
  else
    putStrLn $ show $ minimum (map head results)

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

int main() {
  int N,M;
  cin>>N>>M;
  int LR[2*M];
  for(int i=0;i<2*M;i++) cin>>LR[i];
  int left=LR[0];
  for(int i=2;i<2*M;i+=2) left=max(left,LR[i])  ;
  int right=LR[1];
  for(int i=3;i<2*M;i+=2) right=min(right,LR[i]);
  int ans=right-left+1;
  if(ans>0) cout<<ans<<endl;
  else cout<<0<<endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define S second
#define INF (1e9)
#define N 105
using namespace std;

typedef pair<int,int> P;

int n, m, d[N][N];
int used[N], ans=0;

vector<P> idx;

set<vector<int> > memo;

void dfs(int x,vector<int> G){
  
  if(x>=2){

    int sum=0;

    for(int i=0;i<G.size();i++){
      
      int mincost=INF;
      
      for(int j=0;j<G.size();j++){
      
	if(G[i]!=G[j])
	  mincost=min(mincost,d[G[i]][G[j]]);
      
      }

      if(mincost!=INF) sum+=mincost;
    
    }
  
    ans=max(ans,sum);

  }
  
  sort(G.begin(),G.end());
  
  if(memo.count(G)) return ;
  memo.insert(G);
  
  for(int i=0;i<n;i++){

    if(used[idx[i].S]) continue;

    used[idx[i].S]=1;
    
    int mincost=INF;

    vector<int> nG=G;

    nG.push_back(idx[i].S);
    
    for(int j=0;j<nG.size();j++)
      
      if(idx[i].S!=nG[j]&&used[nG[j]])
	mincost=min(mincost,d[idx[i].S][nG[j]]);
    
    if(!x||(mincost&&mincost!=INF)) dfs(x+1,nG);
    
    used[idx[i].S]=0;
    
  }
  
}

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

  int a, b , f;

  for(int i=0;i<n;i++) idx.push_back(P(0,i));
  
  for(int i=0;i<m;i++){
    
    cin>>a>>b>>f;
    
    d[a-1][b-1]=d[b-1][a-1]=f;
    
    idx[a-1].first++;
    idx[b-1].first++;
  }

  sort(idx.begin(),idx.end());
  
  vector<int> init;
  
  dfs(0,init);

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

Measured memory_bytes: 4880
s = str(input())
t = str(input())
ans = 10000
for i in range(len(s) - len(t) + 1) : 
  cnt = 0
  for j in range(len(t)) : 
    if s[i + j] != t[j] : 
      cnt += 1
  ans = min(ans, cnt)
print(ans)

Measured memory_bytes: 9008
N,A,B = map(int, input().split())
MOD = 10**9+7


def nCr(n,r):
    numerator, denominator = 1, 1
    for i in range(r):
        # n * N-1 * ... * n-r+1
        numerator = numerator * (n-i) % MOD
        # r * r-1 * ... * 1
        denominator = denominator * (r-i) % MOD

    # フェルマーの小定理より、aの逆元（逆数）が、a**(m-2)とのこと
    denominator = pow(denominator, MOD-2, MOD)
    return numerator * denominator % MOD

ans = pow(2, N, MOD)
ans -= (nCr(N, A) + nCr(N, B) + 1)
ans %= MOD
print(ans) 

Measured memory_bytes: 3444
#-swank
(unless (member :child-sbcl *features*)
  (quit
   :unix-status
   (process-exit-code
    (run-program *runtime-pathname*
                 `("--control-stack-size" "128MB"
                   "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
                   "--eval" "(push :child-sbcl *features*)"
                   "--script" ,(namestring *load-pathname*))
                 :output t :error t :input t))))

(defparameter *hash-memo* (make-hash-table :test #'equal))

(defmacro dp (&body func)
  `(let* ((f (quote func))
          (num (gethash f *hash-memo*)))
     (if num
       num
       (setf (gethash f *hash-memo*) ,func))))

(defun split (x str)
  (let ((pos (search x str))
        (size (length x)))
    (if pos
      (cons (subseq str 0 pos)
            (split x (subseq str (+ pos size))))
      (list str))))

(let ((n (read))
      (r (read)))
  (princ (+ r (* 100 (max 0 (- 10 n))))))


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

int main(){
  int n,x,bump=0,temp,count=1,i=1;cin >> n >> x;
  while(bump <= x && i<=n+1){
    cin >> temp;
	bump += temp;
    count++;
    i++;
  }
  cout << count-1 << endl;
}

Measured memory_bytes: 256
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { reader: s.lock() };
    let x: i64 = sc.read();
    let y: i64 = sc.read();

    if y == 0 {
        if x > 0 {
            println!("{}", x + 1);
        } else {
            println!("{}", -x);
        }
    } else if x == 0 {
        if y > 0 {
            println!("{}", y);
        } else {
            println!("{}", -y + 1);
        }
    } else if x == y {
        println!("0");
    } else {
        assert!(x != 0);
        assert!(y != 0);
        assert!(x != y);
        let mut v = [x, y, 0];
        v.sort();

        if v == [x, y, 0] {
            println!("{}", y - x);
        }
        if v == [y, x, 0] {
            println!("{}", x - y + 2);
        }
        if v == [0, x, y] {
            println!("{}", y - x);
        }
        if v == [0, y, x] {
            println!("{}", x - y + 2);
        }
        if v == [x, 0, y] {
            if x.abs() >= y.abs() {
                println!("{}", x.abs() - y.abs() + 1);
            } else {
                println!("{}", y.abs() - x.abs() + 1);
            }
        }
        if v == [y, 0, x] {
            if x.abs() >= y.abs() {
                println!("{}", 1 + x.abs() - y.abs());
            } else {
                println!("{}", y.abs() - x.abs() + 1);
            }
        }
    }
}

pub struct Scanner<R> {
    reader: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352