akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
struct edge{
    int to;
    int cap;
    int rev;
};
struct Ford{
    vector<vector<edge>> G;
    int V;
    vector<int> used;
    Ford(int N){
        V = N;
        used.resize(V, 0);
        G.resize(V);
    }
    void add(int u, int v, int c){
        edge e1 = {v, c, (int)G[v].size()};
        G[u].push_back(e1);
        edge e2 = {u, 0, (int)G[u].size() - 1};
        G[v].push_back(e2);
    }
    int dfs(int s, int t, int f){
        if(s == t) return f;
        used[s] = 1;
        for(edge &e: G[s]){
            if(used[e.to] == 0 && e.cap > 0){
                long long temp = dfs(e.to, t, min(f, e.cap));
                if(temp > 0){
                    e.cap -= temp;
                    G[e.to][e.rev].cap += temp;
                    return temp;
                }
            }
        }
        return 0;
    }
    int solve(int s, int t){
        int ans = 0;
        int INF = 1e9;
        while(1){
            used.assign(V, 0);
            int res = dfs(s, t, INF);
            if(res == 0) return ans;
            ans += res;
        }
    }
};
int main(){
    int N;
    cin >> N;
    Ford Ford(2 * N + 2);
    int can[N][N];//can[i][j] = 1でペアが作れる
    vector<int> a(N), b(N), c(N), d(N);
    for(int i = 0; i < N; i++) cin >> a[i] >> b[i];
    for(int i = 0; i < N; i++) cin >> c[i] >> d[i];
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            if(a[i] < c[j] && b[i] < d[j]) can[i][j] = 1;
            else can[i][j] = 0;
        }
    }
    for(int i = 0; i < N; i++){
        Ford.add(2 * N, i, 1);
        Ford.add(N + i, 2 * N + 1, 1);
    }
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            if(can[i][j]) Ford.add(i, N + j, 1);
        }
    }
    int ans = Ford.solve(2 * N, 2 * N + 1);
    cout << ans << endl;
}

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

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

int main() {
    int n, X; cin >> n >> X;
    ll ans = 0;
    rep(i, n) {
        ll x; cin >> x;
        ans = gcd(ans, abs(X-x));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
h1,m1,h2,m2,k = map(int, input().split())

h=h2-h1
m=0
if m2<m1:
    h-=1
    m=60+m2-m1
else:
    m=m2-m1

hm=h*60
ans=hm+m

print(ans-k)


Measured memory_bytes: 9196
#include<bits/stdc++.h>
using namespace std;
long long f[41]={0,6,14,30,62,126,
254,510,1022,2046,4094,
8190,16382,32766,65534,131070,
262142,524286,1048574,2097150,4194302,
8388606,16777214,33554430,67108862,134217726,
268435454,536870910,1073741822,2147483646,4294967294,
8589934590,17179869182,34359738366,68719476734,137438953470,
274877906942,549755813886,1099511627774,2199023255550,4398046511102,};
long long mn(long long a,long long b){return a<b?a:b;}
long long mx(long long a,long long b){return a>b?a:b;}
int n;
int main(){
	cin>>n;
	cout<<f[n];
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define MAX_N 2002
using namespace std;

typedef long long ll;
typedef pair<int,int> P1;
typedef pair<P1,P1> P2;
const ll INF=100000000000000001;
int dp1[MAX_N][MAX_N]={};
int dp2[MAX_N][MAX_N]={};
bool d[MAX_N][MAX_N]={};
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
queue<P1> que;
vector<string> v;

int main() {
	int n,x;
	cin>>n>>x;
	if(n==2){
		if(x==2){
			cout<<"Yes"<<endl;
			cout<<"1"<<endl;
			cout<<"2"<<endl;
			cout<<"3"<<endl;
		}else{
			cout<<"No"<<endl;
		}
	}else{
		if(2*n-2>x&&x>2){
			if(x<n){
				cout<<"Yes"<<endl;
				rep(i,x-3)cout<<i+3<<endl;
				rep(i,n-x)cout<<i+x+1<<endl;
				cout<<"1"<<endl;
				cout<<"2"<<endl;
				cout<<x<<endl;
				cout<<2*n-1<<endl;
				cout<<2*n-2<<endl;
				rep(i,n-3)cout<<n+i+1<<endl;
			}else{
				cout<<"Yes"<<endl;
				rep(i,n-3)cout<<i+3<<endl;
				cout<<"1"<<endl;
				cout<<"2"<<endl;
				cout<<x<<endl;
				cout<<2*n-1<<endl;
				cout<<2*n-2<<endl;
				rep(i,x-n)cout<<i+n<<endl;
				rep(i,2*n-3-x)cout<<i+x+1<<endl;
			}
		}else if(x==2){
			cout<<"Yes"<<endl;
			rep(i,n-2)cout<<i+3<<endl;
			cout<<"1"<<endl;
			cout<<"2"<<endl;
			cout<<2*n-1<<endl;
			cout<<2*n-2<<endl;
			rep(i,n-3)cout<<n+i+1<<endl;
		}else if(x==2*n-2){
			cout<<"Yes"<<endl;
			rep(i,n-3)cout<<i+3<<endl;
			cout<<"1"<<endl;
			cout<<"2"<<endl;
			cout<<2*n-1<<endl;
			cout<<2*n-2<<endl;
			rep(i,n-2)cout<<n+i<<endl;
		}else{
			cout<<"No"<<endl;
		}
	}
	return 0;
}


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

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

  if ( 1==s || 2==s || 4==s ) {
    cout << 4 <<endl;
    return 0;
  }

  int x = 0;
  rep( i, 1, INT_MAX ) {
    if ( 1 == i ) x = s;
    if ( 1 < i ) {
      if (x%2) x = 3*x + 1;
      else x /= 2;
    }
    if (x == 4) {
      cout << i + 3 << endl;
      break;
    }
  }
  return 0;
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const ll mod = 1e9+7;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s,s1,s2;
  cin >> s >> s1 >> s2;
  cout << (char)toupper(s[0]) << (char)toupper(s1[0]) << (char)toupper(s2[0]) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    string str;
    cin >> str;
    int ans = 0;
    
    for(char s : str){
        if(ans == 0 && s == 'C'){
            ans++;
        }
        if(ans == 1 && s == 'F'){
            ans++;
        }
    }   
    
    if(ans == 2){
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
'use strict'
function main(inp) {
  inp = inp.trim().split(' ').map(n => Number(n));
  let arr = []
  for (let i = inp[1] - inp[0] + 1; i <= inp[1] + inp[0] - 1; i++) {
    arr.push(i)
  }
  console.log(arr.join(' '))
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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

#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define T(a, b, c) make_pair(a, make_pair(b, c))
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 222222

using namespace std;
//using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const ld pi = 2 * acos(0.0);
template<class T> bool umin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool umax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

ll a[N];
int main()
{
	int n, k;
	cin >> n >> k;
	for(int i = 1; i <= n; i ++)
		cin >> a[i];
	sort(a + 1, a + n + 1);
	ll s = 0;
	for(int i = 1; i <= k; i ++)
		s += a[i];
	cout << s;
	





	





	getchar();
	getchar();
	return 0;
	//ios::sync_with_stdio(false);
	//cin.tie(0);
}

Measured memory_bytes: 3632
#include<iostream>
using namespace std;
int main (void){
  int N,n=0,i,b=0;
  int A[100000],B[100000];
  cin>>N;
  for(i=0;i<N;i++){
    cin>>A[i]>>B[i];
    if(n<A[i]){
      n=A[i];
      b=B[i];
    }
  }
  cout<<n+b<<endl;

  return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

int main(void)
{
	LL K;
	cin >> K;
	LL A = K / 50;
	LL B = K % 50;
	LL lef = 49 + A - B;
	LL rht = 100 + A - B;
	cout << "50\n";
	for (int i = 0; i < 50; ++i)
	{
		if (i < 50 - B)
		{
			cout << lef;
		}
		else
		{
			cout << rht;
		}
		cout << " \n"[i == 49];
	}
	return 0;
}


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

using namespace std;

#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define _repis(i,a,b,s) for(int i=a, i##_len(b); i<i##_len; i+=s)
#define REP(...) _overload3(__VA_ARGS__,_repis,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl
#define POSS(n) cout<<((n)?"POSSIBLE":"IMPOSSIBLE")<<endl

int main(){
    int a,b;
    cin>>a>>b;
    if(a==1)a=14;
    if(b==1)b=14;
    if(a>b){
        cout<<"Alice"<<endl;
    }else if(a==b){
        cout<<"Draw"<<endl;
    }else{
        cout<<"Bob"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    Program().solve()
}

class Program {
    fun solve() {
        val sc = MyScanner()
        val n = sc.nextInt()
        val x = Array(n) { 0 }
        val y = Array(n) { 0 }

        for (i in 0 until n) {
            x[i] = sc.nextInt()
            y[i] = sc.nextInt()
        }

        val ar = IntArray(n) { it }
        val c = NextPermutation()

        var l = 1
        for (i in 1..n) {
            l *= i
        }

        var ans = 0.0
        for (i in 0 until l) {
            var dist = 0.0
            for (j in 1 until n) {
                val dx = x[ar[j]] - x[ar[j - 1]]
                val dy = y[ar[j]] - y[ar[j - 1]]
                dist += Math.sqrt(dx.toDouble() * dx + dy * dy)
            }
            ans += dist
            c.nextPermutation(ar)
        }
        println(ans / l)
    }
}

class NextPermutation {

    fun nextPermutation(nums: IntArray) {
        var i = nums.size - 2
        while (i >= 0 && nums[i] >= nums[i + 1]) {
            i--
        }
        if (i >= 0) {
            var j = nums.size - 1
            while (nums[j] <= nums[i]) {
                j--
            }
            swap(nums, i, j)
        }
        reverse(nums, i + 1, nums.size - 1)
    }

    private fun swap(nums: IntArray, i: Int, j: Int) {
        val tmp = nums[i]
        nums[i] = nums[j]
        nums[j] = tmp
    }

    private fun reverse(nums: IntArray, i: Int, j: Int) {
        var tmpI = i
        var tmpJ = j
        while (tmpI < tmpJ) {
            swap(nums, tmpI++, tmpJ--)
        }
    }

}

class MyScanner() {
    private var index = 0
    private var line = listOf<String>()

    fun next(): String {
        while (line.size <= index) {
            line = readLine()!!.split(' ')
            index = 0
        }
        return line[index++]
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextDouble() = next().toDouble()
    fun nextCharArray() = next().toCharArray()
    fun nextChar() = next()[0]

    fun strList(): List<String> {
        index = line.size
        return readLine()!!.split(' ')
    }

    fun intList() = strList().map { it.toInt() }
    fun longList() = strList().map { it.toLong() }
    fun doubleList() = strList().map { it.toDouble() }
}

Measured memory_bytes: 38172
n = int(input())
l = [int(input()) for i in range(n)]
x = 0
check = [True] * n
ans = 0
flg = False
while (check[x]):
    if x == 1:
        flg = True
        break
    else:
        ans += 1
        check[x] = False
        x = l[x] - 1
if flg:
    print(ans)
else:
    print(-1)

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

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


// ABC161 F

void common_multiple(s64 x, vs64& ret)
{
    for (s64 i = 2; i * i <= x; ++i)
    {
        if (x % i == 0)
        {
            if (x / i != i) ret.push_back(x / i);
            ret.push_back(i);
        }
    }
    if (x != 1) ret.push_back(x);
}

s64 solve1(s64 x)
{
    s64 ret = 0;
    vs64 cand;
    common_multiple(x, cand);
    rep (i, cand.size())
    {
        s64 div = cand[i];
        s64 temp = x;
        while (temp % div == 0) temp /= div;
        if (temp % div == 1) ++ret;
    }
    return ret;
}

s64 solve2(s64 x)
{
    vs64 ret;
    common_multiple(x, ret);
    return ret.size();
}

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

    s64 n;
    cin >> n;

    cout << solve1(n) + solve2(n - 1) << "\n";
    return 0;
}



Measured memory_bytes: 384
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int K = scanner.nextInt();
        int Q = scanner.nextInt();
        
        int [] A = new int [Q];
        int [] B = new int [N];
        
        for(int i =0; i<Q; i++){
            A[i] = scanner.nextInt()-1;
            B[A[i]]+=1;
        }
        
        for (int l=0; l<N; l++){
            if(B[l]+K-Q>0){
            System.out.println("Yes");
            }
            else{
                System.out.println("No");
            }
        } 
   }        
}

Measured memory_bytes: 57740
successive_win::Int->Int->Int
successive_win init_point k = if init_point >= k then 0 else 1 + (successive_win (init_point*2) k)

solver::Int->Int->Double
solver n k = let n_d = fromIntegral n in
             (sum [0.5^(fromIntegral (successive_win (n-i) k))|i<-[0..(n-1)]])/n_d

main::IO()
main=do
  (n:k:[])<-return.map read.words=<<getLine
  print (solver n k)

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

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  for(ll i=0;i<n;i++){
    cin >> a[i];
  }
  
  ll money=1000;
  ll kabu=0;
  
  for(ll i=0;i<n;i++){
    if(i < n-1 && a[i] < a[i+1] && money >= a[i]){
      kabu += money/a[i];
      money -= kabu*a[i];
    }else if(i > 0 && a[i] > a[i+1] && kabu > 0){
      money += kabu*a[i];
      kabu = 0;
    }
    //cout << i << " " << money << " " << kabu << endl;
  }
  
  if(kabu > 0){
	money += kabu * a[n-1];
  }
  
  cout << money << endl;
  
  return(0);
}

Measured memory_bytes: 3596
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

public static class P
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var l = Console.ReadLine().Split().Select(int.Parse).OrderBy(x => x).ToArray();
        long res = 0;
        for (int i = 0; i < l.Length; i++)
        {
            for (int j = i + 1; j < l.Length; j++)
            {
                for (int k = j + 1; k < l.Length; k++)
                {
                    if (l[i] != l[j] && l[j] != l[k] &&  l[i] + l[j] > l[k]) res++;
                }
            }
        }
        Console.WriteLine(res);
    }
}


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

int n,x,t;

int main(){
	cin>>n>>x>>t;
	cout<<(n+x-1)/x*t<<endl;
}

Measured memory_bytes: 3548
from collections import Counter
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

S = input()[:-1]
if len(S) == 1:
    print("YES")
elif len(S) == 2:
    if len(set([s for s in S])) == 2:
        print("YES")
    else:
        print("NO")
else:
    C = Counter(S)

    L = [C[s] for s in "abc"]
    if max(L)-min(L) <= 1:
        print("YES")
    else:
        print("NO")


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

int main() {
  string s;
  int counter=0;
  
  cin >> s;
  rep(i,3){
    if(s[i]=='1') counter++;  
  }
  cout << counter << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
char a[15];
int cnt;
long long g(int st,int ed){
	long long ans = 0;
	for(int i=st;i<=ed;i++){
		ans*=10LL;
		ans+=(long long)(a[i]-'0');
	}
	//printf("g(x) : %d\n",ans);
	return ans;
}
long long f(int st,int cur){
	//printf("f(x) : %d %d\n",st,cur);
	if(a[cur+1]==0) return g(st,cur);
	return g(st,cur)*(1<<(cnt-cur-2))+f(cur+1,cur+1)+f(st,cur+1);
}
int main(){
	scanf("%s",a);
	for(int i=0;a[i]!=0;i++) cnt++;
	//printf("%d\n",cnt);
	printf("%lld",f(0,0));
}

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

long long moduo=1000000007;
ll fak[200010];

ll stepen(ll a, ll st)
{
    if(st == 0) return 1;
    ll res = stepen(a, st/2);
    res %= moduo;
    res *= res;
    res %= moduo;
    if(st % 2 == 1)
    {
        res *= a;
        res %= moduo;
    }
    return res;
}
ll mul(ll a, ll b)
{
    a %= moduo;
    b %= moduo;
    return (a*b)%moduo;
}
 ll pref()
{
    fak[0] = 1;
    for(ll i = 1; i <= 200000; i++)
        fak[i] = mul(fak[i-1], i);
}
ll fakt(ll a)
{
    return fak[a];
}


long long res[100020];
long long r[100020];
int main()
{
    int h,w,a,b;
    cin>>h>>w>>a>>b;
    res[0]=1;
    pref();
    for(int k=1;k<=h-a;k++)
    {
        //res[k]=(res[k-1]*(k+b-1)*inverz(k,moduo-2))%moduo;
        res[k]=mul(res[k-1],k+b-1);
        res[k]=mul(res[k],stepen(k,moduo-2));
    }
    r[0] = fakt(h+w-b-2);
    r[0] %= moduo;
    r[0] = mul(r[0], stepen(fakt(w-b-1), moduo-2));
    r[0] = mul(r[0], stepen(fakt(h - 1), moduo-2));
    for(int k=1;k<=h-a;k++)
    {
        r[k]=mul(r[k-1],h-k+1-1);
        r[k]=mul(r[k],stepen(h-k+1+w-b-2,moduo-2));
    }

    long long rr=0;
    for(int k=0;k<h-a;k++)
       {
           rr+=mul(res[k],r[k]);
           rr%=moduo;
       }
    cout<<rr;
    return 0;
}


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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main(){
    gearup;
    ll n,k;cin>>n>>k;
    vpii p;
    rep(i,n){
        int a,b;cin>>a>>b;
        p.emplace_back(a,b);
    }
    sort(all(p));
    rep(i,p.size()){
        if(k > p[i].second)k-=p[i].second;
        else{
            rep(j,p[i].second){
                k--;
                if(k==0){
                    out(p[i].first);
                    return 0;
                }
            }
        }
    }
}

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

int main()
{
    int n;
    string s;
    cin >> n >> s;
    int a[n + 1]{}, b[n + 1]{};
    for (int i = 0; i < n; i++)
    {
        a[i + 1] = a[i] + (s[i] == 'E');
    }
    for (int i = 0; i < n; i++)
    {
        b[i + 1] = b[i] + (s[n - i - 1] == 'E');
    }
    int ans = (1 << 30);
    for (int i = 0; i < n; i++)
    {
        int tmp = (i - a[i]) + b[n - i - 1];
        ans = min(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3076
#include <iostream>
#include <assert.h>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;

int sentou(int k){
  if (k < 0)
    assert(false);

  if (k < 10)
    return k;
  else
    return sentou(k / 10);
}

int simo(int k){
  return (k % 10);
}

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

  int memo[11][11] = {};

  for (int i = 1; i < 10; i++){
    for (int j = 1; j < 10; j++){
      for (int k = 1; k <= n; k++){
        if (sentou(k) == i && simo(k) == j)
          memo[i][j]++;
      }
    }
  }

  long long int num = 0;
  for (int i = 1; i < 10; i++){
    for (int j = 1; j < 10; j++){
      num += memo[i][j] * memo[j][i];
    }
  }


  cout << num << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
//�����Ȃ�P�A�����Ȃ�O���o��
int integer(double a){
  int  b = a;
  if(a-b==0){
    return 1;
  }
  else{
    return 0;
  }

}
//�Q����o�͂���
double pow_2(double a){
  return a*a;
}

int main(void){
  int N, D;
  scanf("%d %d",&N,&D);
  int i,j,k, X[N][D];
  for(i=0;i<N;i++){
    for(j=0;j<D;j++){
      scanf("%d",&X[i][j]);

    }
  }
  double count[N];
  int count1=0;
  for(i=0;i<N;i++){
    for(j=i+1;j<N;j++){
      count[j]=0;
      for(k=0;k<D;k++){
       	count[j]+=pow_2(X[i][k]-X[j][k]);
      }
      if(integer(sqrt(count[j]))==1){
	count1++;
      }

    }
  }

printf("%d",count1);
  return 0;
}


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

using namespace std;

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

int mod3[3];

int main()
{
	memset(mod3, 0, sizeof(mod3));
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	rep (i, n){
		int in; cin >> in;
		++mod3[in % 3];
	} // end rep

	int res = 0;
	if (mod3[0] != 0 && mod3[1] == 0 && mod3[2] == 0){
		res = min(1,mod3[0]);
	}else
	if (mod3[0] == 0 && mod3[1] != 0 && mod3[2] == 0){
		res = min(3, mod3[1]);
	}else
	if (mod3[0] == 0 && mod3[1] == 0 && mod3[2] != 0){
		res = min(3, mod3[2]);
	}else
	if (mod3[0] != 0 && mod3[1] != 0 && mod3[2] == 0){
		res = mod3[0] + min(3, mod3[1]);
	}else
	if (mod3[0] != 0 && mod3[1] == 0 && mod3[2] != 0){
		res = mod3[0] + min(3, mod3[2]);
	}else
	if (mod3[1] != 0 && mod3[2] != 0){
		res = mod3[0] + 2 * min(mod3[1], mod3[2]) + min(3, max(mod3[1], mod3[2]) - min(mod3[1], mod3[2]));
	} // end if
	cout << res << endl;

	return 0;
}

Measured memory_bytes: 1200
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>

int main(){
    std::string s;
    std::cin>>s;

    std::string ans;
    int k = s.size();
    std::sort(s.begin(), s.end());
    s.erase(std::unique(s.begin(), s.end()), s.end());
    if(k == s.size()){
        ans = "yes";
    }else{
        ans = "no";
    }
    std::cout<<ans<<std::endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)) {
			String qwright = "nmhjklyuiop" ;
			
			while(true) {
				int cnt = 0;
				String str = sc.next();
				char[] input = str.toCharArray();
				if(str.equals("#"))	break;
				int[] left = new int[input.length];
				for(int i=0; i<input.length; i++) {
					if(qwright.indexOf(input[i]) != -1) {
						left[i] = 1;
					}else {
						left[i] = 0;
					}
					if(i != 0) {
						if(left[i] != left[i-1]) {
							cnt++;
						}
					}
				}
				System.out.println(cnt);
			}
			
			
			
		}
	}
}




Measured memory_bytes: 27216
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(a) sort(a.begin(), a.end())
const int INF = 1<<30;
const ll MOD = 1000000007;

int main(void) {

    char s; cin >> s;
    if (65 <= s && s <= 90) cout << "A" << endl;
    else cout << "a" << endl;


    return 0;
}

Measured memory_bytes: 3596
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val m = sc.nextInt()
    val d = sc.nextInt()
    println(problem20190804a(m, d))
}

fun problem20190804a(m: Int, d: Int): Int {
    var count = 0
    for (i in 1..m) {
        for (j in 22..d) {
            val temp = j.toString().drop(1).toInt()
            if (temp >= 2) {
                if (temp * (j.toString().dropLast(1).toInt()) == i) {
                    count++
                }
            }
        }
    }
    return count
}

Measured memory_bytes: 31392
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    if(N == 1){
        cout << 1 << endl;
        return 0;
    }
    if(N == 2){
        cout << 2 << endl;
        return 0;
    }

    LL acc = 0;
    int n;
    FOR(i,1,11234567){
        acc += i;
        if(N <= acc){
            n = i;
            break;
        }
    }
    for(int i = n; i >= 0; i--){
        if(N >= i){
            cout << i << endl;
            N -= i;
        }
        if(N == 0){
            break;
        }
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

using pll = pair<ll, ll>;
vector<pll> prime_factorization(ll n) {
	vector<pll> res;
	
	for (ll i = 2; i * i <= n; i++) {
		if (n % i == 0) res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n > 1) res.emplace_back(n, 1);
	
	return res;
}

int main() {
	ll N;
	cin >> N;
	auto v = prime_factorization(N);
	ll ans = 0;
	for (pll cur : v) {
		int c = 1;
		while (cur.se > 0) {
			if (cur.se >= c) {
				++ans;
				cur.se -= c;
				++c;
			}
			else break;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3632
//~#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
//~#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
//~#pragma GCC target("avx2")  //Enable AVX
#include<bits/stdc++.h>
using namespace std;

#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair
 
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
 
const int mod=1e9+7;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int mul(int a,int b)
{
	return ((a)*1ll*(b))%mod;
}
 
void add(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
}
 
int sub(int a,int b){
	a-=b;
	if(a<0){
		a+=mod;
	}
	return a;
}
 
int powz(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1){
			res=mul(res,a);
		}
		b/=2;
		a=mul(a,a);
	}
	return res;
}
 
template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
	input>>x.F>>x.S;
	return input;
}
 
template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
	for(auto& i:x)
		input>>i;
	return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
	for(auto& i:x)
		output<<i<<' ';
	return output;
}
 
const int N=2000002;

void solve(){
	int n;
	cin>>n;
	vi a(n);
	cin>>a;
	int flag=0;
	for(int i=0;i<n;i++){
		if(a[i]%2==0){
			if(a[i]%3&&a[i]%5){
				flag++;
			}
		}
	}
	if(flag){
		cout<<"DENIED";
	}
	else{
		cout<<"APPROVED";
	}
		
}  
 
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int tc=1;
	//~cin>>tc;
	for(int _=0;_<tc;_++){
		//~ cout<<"Case #"<<_+1<<": ";
		solve();
		if(_!=tc-1)
		cout<<"\n";
	}
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define EPS 1e-9
//#define PI 3.14159265358979

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	string S;
	cin >> S;
	rep(i, S.size()) cout << 'x';
	cout << endl;
	return 0;
}

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

using namespace std;

int H,W,K;
char map[6][6];

int main(void){
  cin >> H >> W >> K;
  int rmax,cmax;
  rmax = pow(2,H);
  cmax = pow(2,W);
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      char c;
      cin >> c;
      map[i][j] = c;
    }
  }
  int ans = 0;
  for(int ridx=0;ridx<rmax;ridx++){
    for(int cidx=0;cidx<cmax;cidx++){
      int count = 0;
      for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
           //ridx >> i == 0 && cidx >> j == 0 => 
          //cout << i << " " << j << " " << ridx << " " << cidx << endl;
          if((ridx >> i)%2 == 0 && (cidx >> j)%2 == 0 && map[i][j] == '#'){
            //cout << "!!" << endl;
            count++;
          }
        }
      }
      if(count == K)
        ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4100
#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl 
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl 
#define no cout<<"no"<<endl
#define vec(a,y,x)  vector<vector<char>> a (y,vector<char>(x))
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
const vector<int> dx={1,0,-1,0};
const vector<int> dy={0,1,0,-1};

int main(){
  string s,t;
  cin>>s>>t;
  int ans=0;
  int n=s.size();
  rep(i,n){
    if(s.at(i)!=t.at(i))
      ans++;
  }
  cout<<ans<<endl;
}

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

using namespace std;
using ll = long long;

int main() {
	int a, b, c;
	cin >> a >> b >> c;

	if ((a == b) && (b == c)) { cout << "Yes" << endl; }
	else { cout << "No" << endl; }

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
       
using namespace std;
typedef long long ll;
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; }
class ModInt {
  static int MOD;
  long long x;

 public:
  static void mod(int m) { MOD = m; }

  ModInt(long long v = 0) : x(v % MOD) {
    if (x < 0) x += MOD;
  }

  ModInt& operator+=(const ModInt& r) {
    x += r.x;
    if (x >= MOD) x -= MOD;
    return *this;
  }

  ModInt& operator-=(const ModInt& r) {
    x -= r.x;
    if (x < 0) x += MOD;
    return *this;
  }
  ModInt& operator*=(const ModInt& r) {
    x = (x * r.x) % MOD;
    return *this;
  }
  ModInt& operator/=(const ModInt& r) {
    *this *= r.inverse();
    return *this;
  }

  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt& r) const { return ModInt(*this) += r; }
  ModInt operator-(const ModInt& r) const { return ModInt(*this) -= r; }
  ModInt operator*(const ModInt& r) const { return ModInt(*this) *= r; }
  ModInt operator/(const ModInt& r) const { return ModInt(*this) /= r; }
  bool operator==(const ModInt& r) const { return x == r.x; }
  bool operator!=(const ModInt& r) const { return x != r.x; }

  ModInt inverse() const {
    long long a = x, b = MOD, u = 1, v = 0, t;
    while (b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }

  ModInt pow(long long n) const {
    ModInt ret(1), mul(x);
    while (n > 0) {
      if (n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }

  friend ostream& operator<<(ostream& os, const ModInt& x) { return os << x.x; }

  friend istream& operator>>(istream& is, ModInt& x) { return is >> x.x; }

  int getMod() { return MOD; }

  long long val() { return x; }
};
int ModInt::MOD = 1000000007;

int main() {
  int n, a, b;
  cin >> n >> a >> b;

  auto C = [&](int n, int k) {
    ModInt res = 1;
    for (int i = 0; i < (int)k; ++i) res *= (n - i);
    for (int i = 0; i < (int)k; ++i) res /= (i + 1);
    return res;
  };

  ModInt ans = ModInt(2).pow(n) - 1;
  ans = ans - C(n, a) - C(n, b);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import bisect
s=input()
n=len(s)
a=[]
c=[0]*n
for i in range(n-1):
	if s[i]!=s[i+1]:
		a.append(i)


for i in range(n):
	if s[i]=="L":
		pp=bisect.bisect_left(a,i)
		idou=i-a[pp-1]+1
		if idou%2==0:
			c[a[pp-1]+1]+=1
		else:
			c[a[pp-1]]+=1
	else:
		pp=bisect.bisect_left(a,i)
		idou=a[pp]-i
		if idou%2==0:
			c[a[pp]]+=1
			
		else:
			c[a[pp]+1]+=1
			
print(*c)





Measured memory_bytes: 51548
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin>>n;
	vector<long long int> arr (n);
	vector<long long int> res (n);
	long long int x=0;
	for(int i=0;i<n;i++)
	{
	    cin>>arr[i];
	    x=x^arr[i];
	}
	for(int i=0;i<n;i++)
	{
	    res[i]=arr[i]^x;
	}
	for(int i=0;i<n;i++)
	{
	    if(i==n-1)
	        cout<<res[i]<<endl;
	    else
	        cout<<res[i]<<" ";
	}
    return 0;
}


Measured memory_bytes: 6364
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <bitset>
#include <unordered_map>
#include <queue>
#include <cmath>

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

double calc_distance(pair<double, double> a, pair<double, double> b){
    double x = pow((a.first - b.first), 2);
    double y = pow((a.second - b.second), 2);
    return sqrt(x + y);
}

int main(){
    int N;
    cin >> N;
    vector<pair<double, double> > towns(N);
    rep(i,N){
        int x,y;
        cin >> x >> y;
        towns[i] = make_pair(x, y);
    }
    sort(towns.begin(), towns.end());
    double ans = 0;
    double count = 0;

    do{
        count++;
        rep(i,N-1){
            ans += calc_distance(towns[i], towns[i+1]);
        }
    } while(next_permutation(towns.begin(), towns.end()));
    printf("%.7f\n", ans/count);

}


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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクトル */
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const long long INF = 1LL << 60;

int main(){
    string S;
    cin >> S;
    if(S == "Sunny"){
        cout << "Cloudy" << endl;
    }
    if(S == "Cloudy"){
        cout << "Rainy" << endl;
    }
    if(S == "Rainy"){
        cout << "Sunny" << endl;
    }


}

Measured memory_bytes: 256
X=int(input())

def func(num):
    cand=[]
    for b in range(-500,501):
        a=b+num
        temp=a**4+a**3*b+a**2*b**2+a*b**3+b**4
        cand.append(temp)
    return cand

yaku=[]

for i in range(1,int(X**0.5)+1):
    if X%i==0:
        yaku.append(i)
        if i!=X**0.5:
            yaku.append(X//i)

for item in yaku:
    lis=func(item)
    for i in range(len(lis)):
        if lis[i]*item==X:
            i-=500
            print(i+item,i)
            exit()




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

namespace ProblemA
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine().ToCharArray();
            var T = Console.ReadLine().ToCharArray();
            var count = 0;
            for (int i = 0; i < S.Length; i++)
            {
                if (S[i] == T[i])
                    count++;
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
long long ans=0,mx,x;
int n;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>x;
		if(i==1)mx=x;
		if(x<mx)ans+=mx-x;
		mx=max(mx,x);
	}
	printf("%lld\n",ans);
	
}


Measured memory_bytes: 3760
#include <stdio.h>
int main(){
	int a,b;
	scanf("%d",&a);
	scanf("%d",&b);
	if(a>b)	printf("%d\n",a+a-1);
	else if(a==b)	printf("%d\n",a+a);
	else	printf("%d\n",b+b-1);
	return 0;	
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define int long long
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define inf 1000000000000000007
#define f first
#define s second
#define mini(c,a,b) *min_element(c+a,c+b)
#define maxi(c,a,b) *max_element(c+a,c+b)
//printf("%.12Lf\n",c);
int keta(int x){
	rep(0,i,30){
		if(x<10){
			return i+1;
		}
		x=x/10;
	}
}
int gcd(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return bb;
		}	
		bb=bb%aa;
		if(bb==0){
			return aa;
		}
	}
}	
int lcm(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return x/bb*y;
		}	
		bb=bb%aa;
		if(bb==0){
			return x/aa*y;
		}
	}
}
bool p(int x){
	if(x==1)return false;
	rep(2,i,sqrt(x)+1){
		if(x%i==0&&x!=i){
			return false;
		}
	}	
	return true;
}
int primes[200];
int prime[1000000];
int pr[100000];
int el[314514],wl[314514];
int er[314514],wr[314514];
int a[114514];
int b[214514],c[214514];
int n2[41];
int nis[41]; 
int nia[41];
int mody[41];
signed main(){
	ic(n) ic(x) ic(y)
	int ni=1;
	rep(0,i,41){
		n2[i]=ni;
		ni*=2;
	}
	int nn=n;
	for(int i=40;i>=0;i-=1){
		if(nn>n2[i]){
			nis[i]++;
			nn-=n2[i];
		}
	}
	ni=2;
	rep(0,i,41){
		nia[i]=ni;
		ni=(ni*ni)%mod;
	}
	ni=2;
	rep(0,i,41){
		if(nis[i]==1){
			ni=(ni*nia[i])%mod;
		}
	}
	int ans1=ni-1;
	
	int bunsi=1,bunbo=1;
	rep(0,i,x)bunsi=(bunsi*(n-i))%mod;
	rep(0,i,x)bunbo=(bunbo*(i+1))%mod;
	mody[0]=bunbo;
	rep(1,i,41){
		bunbo=(bunbo*bunbo)%mod;
		mody[i]=bunbo;
	}
	rep(0,i,41)nis[i]=0;
	nn=mod-2;
	for(int i=40;i>=0;i-=1){
		if(nn>n2[i]){
			nis[i]++;
			nn-=n2[i];
		}
	}
	nis[0]++;
	rep(0,i,41){
		if(nis[i]==1){
			bunsi=(bunsi*mody[i])%mod;
		}
	}
	int ans2=bunsi;	
	
	bunsi=1,bunbo=1;
	rep(0,i,y)bunsi=(bunsi*(n-i))%mod;
	rep(0,i,y)bunbo=(bunbo*(i+1))%mod;
	mody[0]=bunbo;
	rep(1,i,41){
		bunbo=(bunbo*bunbo)%mod;
		mody[i]=bunbo;
	}
	rep(0,i,41)nis[i]=0;
	nn=mod-2;
	for(int i=40;i>=0;i-=1){
		if(nn>n2[i]){
			nis[i]++;
			nn-=n2[i];
		}
	}
	nis[0]++;
	rep(0,i,41){
		if(nis[i]==1){
			bunsi=(bunsi*mody[i])%mod;
		}
	}
	int ans3=bunsi;
	
	c((mod+mod+ans1-ans2-ans3)%mod)
}	


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define myPair pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define qmax priority_queue<int>
#define qmin priority_queue<int,vector<int>,greater<int>>
#define all(x) x.begin(),x.end()
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define FORR(i,a,b) for(int i = a; i >= b; i--)

const int mxn = 1e5 + 10;
int dp[mxn][3];
bool c[mxn][3];
int h[mxn][3];
int n;

int f(int i,int choice)
{
	if(c[i][choice])
		return dp[i][choice];
	if(i == n + 1)
		dp[i][choice] = 0;
	else
	{
		dp[i][choice] = -2e18;
		FOR(j,1,2)
			dp[i][choice] = max(dp[i][choice], h[i][choice] + f(i + 1, (choice + j) % 3));
	}
	c[i][choice] = 1;
	return dp[i][choice];
}

int32_t main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin >> n;
	FOR(i,1,n)
		cin >> h[i][0] >> h[i][1] >> h[i][2];
	memset(c,0,sizeof(c));
	int ans = -2e18;
	FOR(i,0,2)
		ans = max(ans, f(1,i));
	cout << ans;

	return 0;
}

Measured memory_bytes: 16452
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.StringTokenizer;

import static java.lang.Integer.decode;
import static java.lang.Integer.parseInt;

/**
 * Elementary data structures - Stack
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		Deque<Integer> stack = new ArrayDeque<Integer>();

		StringTokenizer st = new StringTokenizer(br.readLine());
		while (st.hasMoreTokens()) {
			String str = st.nextToken();
			int a, b;
			switch (str.charAt(0)) {
				case '+':
					b = stack.pop();
					a = stack.pop();
					stack.push(a + b);
					break;
				case '-':
					b = stack.pop();
					a = stack.pop();
					stack.push(a - b);
					break;
				case '*':
					b = stack.pop();
					a = stack.pop();
					stack.push(a * b);
					break;
				default:
					stack.push(parseInt(str));
					break;
			}
		}
		System.out.println(stack.pop());
	} //end main
}

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

using namespace std;

#define REP(i, N) for (int i = 0; i < (int)N; i++)
#define LOOP(i, N) for (int i = 1; i <= (int)N; i++)
#define RREP(i, N) for (int i =(int)N-1; i >= 0; i--)
#define RLOOP(i, N) for (int i =(int)N; i > 0; i--)
#define FOR(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

typedef long long ll;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;
//cout<<"Yes"<<endl;
//cout<<"No"<<endl;
int main(){
  int n;
  cin>>n;
  n=n%10;
  if(n==3){
    cout<<"bon"<<endl;
  }else if(n==0||n==1||n==6||n==8){
    cout<<"pon"<<endl;
  }else{
    cout<<"hon"<<endl;
  }
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s; cin>>s;
  int n; cin>>n;
  int ans=0;
  for(int i=0;i<n;++i){
    string t; cin>>t;
    t+=t;
    if(t.find(s)!=string::npos) ++ans;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3200