akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void)
{
    int late;
    scanf("%d", &late);
    if (late > 40 || late < -40)
    {
        return 0;
    }
    else if (late < 30)
    {
        printf("No\n");
    }
    else
    {
        printf("Yes\n");
    }
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repc(i, a, b) for (int i = a; i <= (int)(b); i++)
#define ll long long
#define vec vector
#define pb push_back
#define ft first
#define sd second
#define all(vec) vec.begin(), vec.end()

typedef pair<int, int> P;

const int MOD = 1e9 + 7;
const int INF = 1001001001;
const int dx[4] = {1, 0,-1, 0};
const int dy[4] = {0, 1, 0,-1};

//------------------------------------------------------//


int main(){
  int n, x, t;
  cin >> n >> x >> t;
  if(n % x == 0){
    cout << (n / x) * t << endl;
  }
  else{
    cout << (n / x + 1) * t << endl;
  }
  return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;

int main() {
    int n, k; cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    int ans = 1;
    if (n > k) {
        ans += ceil(((double)n - k) / (k - 1));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
var a:array[1..20] of byte;
    n,i,re:byte;
begin
	readln(n);
	for i:=1 to n do read(a[i]);
	re:=0;
	for i:=2 to n-1 do 
	  if ((a[i] > a[i-1]) and (a[i] < a[i+1])) or ((a[i] < a[i-1]) and (a[i] > a[i+1])) then inc(re);
	write(re);
end.

Measured memory_bytes: 128
import sys

sys.stdin.readline()
As = list(map(int, sys.stdin.readline().split()))
As.reverse()

min = 2
max = 2

for a in As:
    min = ((min-1)//a+1)*a
    max = (max//a+1)*a-1
    #print(min, max)
    if min > max:
        print(-1)
        sys.exit()
print(min, max)



Measured memory_bytes: 14168
import java.util.*;
class Main
{
    public static void main(String [] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int w = sc.nextInt();
        int arr[][]= new int[n][2];
        for(int i=0;i<n;i++)
        {
            arr[i][0]=sc.nextInt();
            arr[i][1]=sc.nextInt();
        }
        long res[][] =new long[n+1][w+1];
        for(int i=0;i<=n;i++)
        {
            res[i][0]=0;
        }
        for(int i=0;i<=w;i++)
        {
            res[0][i]=0;
        }

        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=w;j++)
            {
                if(j<arr[i-1][0])
                {
                    res[i][j] = res[i-1][j];
                }   
                else
                {
                    res[i][j]= Math.max(res[i-1][j],arr[i-1][1]+res[i-1][j-arr[i-1][0]]);
                }
            }
        }
        System.out.println(res[n][w]);
    }
}

Measured memory_bytes: 139660
package main

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

const MAX = 121

func main() {
	sc := NewScanner()

	x := sc.ReadInt()

	pow5s := make([]int, MAX)
	for i := 0; i < MAX; i++ {
		pow5s[i] = Pow(i, 5)
	}

	// search |A|^5 - |B|^5 = X
	minAi := 0
	for i := 0; i < MAX; i++ {
		if pow5s[i] >= x {
			minAi = i
			break
		}
	}

	for ai := minAi; ai < MAX; ai++ {
		a5 := pow5s[ai]
		for bi := 0; bi < ai; bi++ {
			b5 := pow5s[bi]
			if a5-b5 == x {
				fmt.Printf("%d %d\n", ai, bi)
				return
			}
		}
	}

	// search |A|^5 + |B|^5 = X
	for ai := 0; ai < MAX; ai++ {
		a5 := pow5s[ai]
		for bi := 0; bi <= ai; bi++ {
			b5 := pow5s[bi]
			if a5+b5 == x {
				fmt.Printf("%d -%d\n", ai, bi)
				return
			}
		}
	}
}

// util
// *   math/simple

func Abs(x int) int {
	if x >= 0 {
		return x
	}
	return -x
}

func Min(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}
	min := values[0]
	for _, v := range values {
		if v < min {
			min = v
		}
	}
	return min
}

func Max(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}
	max := values[0]
	for _, v := range values {
		if v > max {
			max = v
		}
	}
	return max
}

func Pow(base int, exponent uint) int {
	answer := 1
	for i := uint(0); i < exponent; i++ {
		answer *= base
	}
	return answer
}

// *   io

type Scanner struct {
	bufScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	bufSc := bufio.NewScanner(os.Stdin)
	bufSc.Split(bufio.ScanWords)
	bufSc.Buffer(nil, 100000000)
	return &Scanner{bufSc}
}

func (sc *Scanner) ReadString() string {
	bufSc := sc.bufScanner
	bufSc.Scan()
	return bufSc.Text()
}

func (sc *Scanner) ReadInt() int {
	bufSc := sc.bufScanner
	bufSc.Scan()
	text := bufSc.Text()

	num, err := strconv.Atoi(text)
	if err != nil {
		panic(err)
	}
	return num
}


Measured memory_bytes: 1756
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>

using namespace std;

int main()
{
    int jiro[25];
    int l;
    int n;
    int index;
    while(cin >> l && l)
    {   
        n=32;
        index=-1;
        for(int i=0;i<l;++i) cin >> jiro[i];
        while(n)
        {   
            n -= (n-1)%5;
            cout << n << endl;
            n = max(n-jiro[++index], 0); 
            if(index >= l-1) index = -1; 
            cout << n << endl;
        }   
    }   
}

Measured memory_bytes: 1160
import java.io.IOException;
import java.util.Scanner;
class Main
{

	static int n,m,k,end=0;
	public static void main(String[] args)throws IOException
	{
		Scanner sc = new Scanner(System.in);
		n=sc.nextInt();m=sc.nextInt();k=sc.nextInt();
		for(int i=0;end==0&&i<=n;i++)
		{
			for(int j=0;j<=m;j++)
			{
				if(m*i+(n-i)*j-i*j==k){end=1;break;}
			}
		}
		if(end==1){System.out.println("Yes");}
		else{System.out.println("No");}
	}

}


Measured memory_bytes: 25172
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.Comparator;

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

    static class D {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int[][] AB = new int[N][2];
            for (int i = 0; i < N; i++) {
                AB[i] = new int[]{in.nextInt(), in.nextInt()};
            }
            Arrays.sort(AB, Comparator.comparingInt(a -> a[1]));

            long time = 0;
            for (int i = 0; i < N; i++) {
                time += AB[i][0];
                if (time > AB[i][1]) {
                    out.println("No");
                    return;
                }
            }
            out.println("Yes");
        }

    }
}



Measured memory_bytes: 116632
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as M
import Data.List
 
main = do
  [n, k] <- map read . words <$> getLine
  as <- B.words <$> B.getLine
  let dict = mkDict as
  print $ solve k dict
 
mkDict = foldr (\x y -> M.insertWith (+) x 1 y) M.empty
 
solve k dict = sum . drop k . sortBy (flip compare) $ M.elems dict

Measured memory_bytes: 52860
// C.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long LL;

int main(int argc, char* argv[]) {
	while (true) {
		LL n = -1, ans = 1LL << 60;
		cin >> n;
		if (n <= 0) break;
		for (LL i = 1; i * i <= n; ++i) {
			if ((n % i) == 0) {
				ans = min(ans, (LL)to_string(n / i).length());
			}
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
constexpr double EPS = 1e-8; 

int main(){
  int64 a;
  double b;
  cin >> a >> b;
  int64 bb = b * 100.0 + EPS;
  int64 ans = a * bb / 100LL;
  cout << ans << endl;
}

Measured memory_bytes: 3700
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
using namespace std;
const int N = 1e5 + 5;

int a[N];
int gcd(int x, int y) {
    if (y == 0) return x;
    return gcd(y, x % y);
}
int main() {
    int n, x;
    while (~scanf("%d %d", &n, &x)) {
        int ans;
        for (int i = 0; i < n; ++i) {
            scanf("%d", &a[i]);
            int tt = abs(a[i] - x);
            if (i)
                ans = gcd(ans, tt);
            else
                ans = tt;
        }

        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>

int main()
{
	char str[222];
	int n,i;
	scanf("%s",str);
	n = strlen(str);
	for(i=n-2;i!=0;i-=2){
		if((strncmp(str ,str+i/2 ,i/2))==0){
			printf("%d\n",i);
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<string.h>
#include<algorithm>
#include <cmath>

using namespace std;


char S[100];

int i,j,K,X,N,M,ans;

vector<int> A;

int main()
{
  cin>>K>>N;
  
  for(i=0;i<N;i++)
  {
    cin>>j;
    A.push_back(j);
  }
  
  sort(A.begin(),A.end());
  ans=A[0]+K-A[N-1];
  for(i=0;i<N-1;i++)
  {
    ans=max(ans,A[i+1]-A[i]);
  }
  ans=K-ans;
  cout <<ans;
  
  
}

Measured memory_bytes: 1400
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <string>

typedef long long int ll;

using namespace std;
ll a,b,c,n,m,q,aa[100000],bb[10000][10000];
bool ra,rb,rc[100000];
vector<ll> va,vb;
string st;

#define CE cout<<endl
#define C cout<<
#define E <<endl

int main(){
    cin>>n>>a;
    for(int i=0;i<n;i++){
        rc[i]=false;
    }
    for(int i=0;i<a;i++){
        cin>>aa[i];
        for(int j=0;j<aa[i];j++){
            cin>>bb[i][j];
            rc[bb[i][j]-1]=true;
        }
    }m=0;
    for(int i=0;i<n;i++){
        if(!rc[i])m++;
    }
    C m E;

}


Measured memory_bytes: 4072
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <climits>
#include <cmath>
#include <functional>
#include <map>
// #include <bits/stdc++.h>
using namespace std;

#define size_t int
typedef long long ll;
// #define int long long
typedef vector<int> VI;
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define debug(x) cerr << #x << " = " << (x) << " (line " << __LINE__ << ")" << endl;
#define debug1(i, x) cerr << "(" << (i) <<  ") " << #x << " = " << (x) << " (line " << __LINE__ << ")" << endl;
#define debug2(i, j, x) cerr << "(" << (i) << ", " << (j) <<  ") " << #x << " = " << (x) << " (line " << __LINE__ << ")" << endl;
template <typename T> class vec2d : public vector<vector<T>> {
public:
    vec2d(int H, int W): vector<vector<T>> (H, vector<T>(W)) {
    }
};
template <typename T> istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) is >> x;
  //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいいです。
  return is;
}
template <typename T> ostream& operator << (ostream& os, vector<T>& vec){
  REP(i, vec.size()) {
    os << vec[i] << ( i+1 == vec.size() ? "" : " " );
  }
  return os;
}
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0);
        // cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

struct S {
  string n;
  int v;
  int i;

  // 演算子オーバーロードで比較関数を定義
  bool operator<(const S& another) const {
    if (n != another.n) {
      return n < another.n; // 高い順に並べたいので演算子を逆に
    } else {
      if (v != another.v) {
        return v > another.v; // 同様に比較演算子を反転
      } else {
        return false;
      }
    }
  }
};

signed main(signed argc, char **argv) {
  int N;
  cin >> N;

  vector<S> ss(N);

  for (int i = 0; i < N; i++) {
    // cin >> S[i] >> P[i];
    // cin >> pairs[i].first >> pairs[i].second;
    cin >> ss[i].n >> ss[i].v;
    ss[i].i = i + 1;

  }
  // for (size_t i = 0; i < N; i++) {
  //   debug(ss[i].v);
  // }
  sort(ss.begin(), ss.end());
  for (size_t i = 0; i < N; i++) {
    // debug(ss[i].n);
    // debug(ss[i].v);
    cout << ss[i].i << endl;
  }
  return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
const int MOD = 1000000007;
int main() {
    int n,k;
    cin>>n>>k;
    ll h[n];
    REP(i,n){
        cin>>h[i];
    }
    sort(h,h+n);
    ll cnt=MOD;
    REP(i,n-k+1){
        cnt=min(cnt,h[i+k-1]-h[i]);
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define debug(n) cout << "DEBUG1 " << n << "\n";
#define debug2(n, m) cout << "DEBUG2 " << n << ' ' << m << "\n";
#define debug3(n, m, x) cout << "DEBUG3 " << n << ' ' << m << ' ' << x << "\n";
#define ss_def stringstream ss // stringstream, do ss_def(str), then ss >> n (n is int)
#pragma GCC optimize("Ofast")
using namespace std;
ll int BtoPmodM(ll int b, ll int p, ll int m) { // (b ^ p) % m (Big Mod)
    if (p == 0) return 1;
    else if (p % 2 == 0) return (BtoPmodM(b, p / 2, m) * BtoPmodM(b, p / 2, m)) % m; // a^(p/2) * a^(p/2) = a^p
    else if (p % 2 == 1) return (BtoPmodM(b, (p - 1) / 2, m) * BtoPmodM(b, (p - 1) / 2, m) * b) % m; // +1
    else return 0; // a function must return something
}
ll int euclidalgo(ll int a, ll int b) { // Euclidean Algorithm
    if (b == 0) {
        return a;
    } else {
        return euclidalgo(b,a % b);
    }
}
bool coprime(ll int a, ll int b) {
    if (euclidalgo(a, b) == 1) return true;
    else return false;
}
ll int factModP(ll int n, ll int p) {
    ll int fac[n - 1];
    fac[0] = 1;
    for (ll int i = 1;i <= n;i++) {
        fac[i] = fac[i - 1] * i % p;
    }
    return fac[n];
}
ll int nCrModP(ll int n, ll int r, ll int p) {
    if (r == 0) return 1;
    ll int fac[n + 1];
    fac[0] = 1;
    for (ll int i = 1;i <= n;i++) {
        fac[i] = fac[i - 1] * i % p;
    }
    return (fac[n] * BtoPmodM(fac[r], p - 2, p) % p * BtoPmodM(fac[n - r], p - 2, p) % p) % p;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string str;
    getline(cin, str);
    int strl = str.length();
    string tar = str;
    reverse(tar.begin(), tar.end());
    if (str != tar) {
    	cout << "No\n";
    	return 0;
	}
	if (strl % 2 == 0) {
		string tar1 = str.substr(0, strl / 2);
		string tar2 = str.substr(strl / 2, strl / 2);
		string tarr = tar1;
		reverse(tarr.begin(), tarr.end());
		if (tarr != tar1) {
			cout << "No\n";
			return 0;
		}
		tarr = tar2;
		reverse(tarr.begin(), tarr.end());
		if (tarr != tar2) {
			cout << "No\n";
			return 0;
		} else {
			cout << "Yes\n";
			return 0;
		}
	} else {
		string tar1 = str.substr(0, strl / 2);
		string tar2 = str.substr(strl / 2 + 1, strl / 2);
		string tarr = tar1;
		reverse(tarr.begin(), tarr.end());
		if (tarr != tar1) {
			cout << "No\n";
			return 0;
		}
		tarr = tar2;
		reverse(tarr.begin(), tarr.end());
		if (tarr != tar2) {
			cout << "No\n";
			return 0;
		} else {
			cout << "Yes\n";
			return 0;
		}
	}
}

Measured memory_bytes: 256
// finish date: 2019/06/29

#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)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<vector<vector<double>>> vvvd;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, pair<int, int>> plii;
const int bigmod = 1000000007;
const int INF = 1050000000;
const long long INFll = 100000000000000000;

vi fact;

//足し算
int add(int a, int b) {
    return (int) (((ll) a + b + bigmod) % bigmod);
}

//引き算
int sub(int a, int b) {
    return (int) (((ll) a - b + bigmod) % bigmod);
}

//掛け算
int mul(int a, int b) {
    return (int) (((ll) (a % bigmod) * (b % bigmod)) % bigmod);
}

//割り算(分母だけ)  -  逆元(求めたい数とbigmodを渡す)
int divide(int a, int p = bigmod, int b = -1) {
    if (b < 0) b = p - 2;  //int gyakugen(int a, int p, int b = p - 2とできなかったため。)
    if (b == 0) return 1;
    else if (b % 2 == 0) {
        int d = divide(a, p, b / 2);
        return mul(d, d);
    } else {
        return mul(a, divide(a, p, b - 1));
    }
}

//nやkが大きな場合nCkをO(1)で求めるようにプログラムを適切に変更する。
int nCk_gyakugen(int n, int k, int p = bigmod) {
    if (k == 0) return 1;
    if (n == 0) 0;
    if (n < k) return 0;
    int denominator = fact[n];
    int molecule1 = fact[k];
    int molecule2 = fact[n - k];
    return mul(denominator, mul(divide(molecule1), divide(molecule2)));
}


int main() {
    int N, K;
    cin >> N >> K;
    fact = vi(N, 0);
    fact[0] = 1;
    FOR(i, 1, fact.size()) {
        fact[i] = mul(fact[i - 1], i);
    }

    int blue = K;
    int red = N - K;
    int temp = 1;
    int comb = 1;
    FOR(i, 1, K + 1) {
//        if (red < i - 1 || blue < i) {
//            cout << 0;
//            continue;
//        }
        temp = mul(mul(temp, red - i + 2), divide(i));
        comb = nCk_gyakugen(blue - 1, blue - i);
        cout << mul(temp, comb) << endl;
//        comb = mul(comb, blue - i);
    }


    return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize("03", "unroll-loops")
//#pragma GCC target("avx2")

#include <bits/stdc++.h>

#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define FOR(i,n) for(i=0;i<n;i++)
#define FORn(i,j,n) for(i=j;i<n;i++)
#define pb push_back
#define unique_sort(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define vprint(v) for(auto t:v)cout<<t<<" "
#define endl "\n"

using namespace std;

typedef long long int lli;
typedef long int li;
typedef vector<lli> vli; 
typedef vector<int> vi; 
typedef vector<string> vs; 


const lli mod=1000000007;
const lli limit=1000000;


void fc(lli &x)
    {
        bool neg=false;
        register char c;
        x =0;
        c=getchar();
        if(c=='-')
        {
            neg = true;
            c=getchar();
        }
        for(;(c>47 && c<58);c=getchar())
            x = (x<<1) + (x<<3) +c -48;
        if(neg)
            x *=-1;
    }

int main() {

    fast()
    lli n,q,t;
    lli temp,temp1,temp2,temp3;
    lli i,j,k;
    cin>>n;
    temp=0;
    FORn(i,1,n+1)FORn(j,1,n+1)FORn(k,1,n+1)temp+=__gcd(i,__gcd(j,k));
    cout<<temp<<endl;
    
 
}

Measured memory_bytes: 3604
#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#include<bits/stdc++.h>
using namespace std; 
int main(){
    int a,b;
    cin>>a >>b;
    cout <<a*b;
    return 0;
}

Measured memory_bytes: 3636
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let mut sc = Scanner::new();
    let k = sc.next_usize();
    for _ in 0..k {
        print!("ACL");
    }

    println!();
}

pub struct Scanner {
    buf: std::collections::VecDeque<String>,
}

impl Scanner {
    pub fn new() -> Self {
        Self {
            buf: std::collections::VecDeque::new(),
        }
    }

    fn scan_line(&mut self) {
        let mut flag = 0;
        while self.buf.is_empty() {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).unwrap();
            let mut iter = s.split_whitespace().peekable();
            if iter.peek().is_none() {
                if flag >= 5 {
                    panic!("There is no input!");
                }
                flag += 1;
                continue;
            }

            for si in iter {
                self.buf.push_back(si.to_string());
            }
        }
    }

    pub fn next<T: std::str::FromStr>(&mut self) -> T {
        self.scan_line();
        self.buf
            .pop_front()
            .unwrap()
            .parse()
            .unwrap_or_else(|_| panic!("Couldn't parse!"))
    }

    pub fn next_usize(&mut self) -> usize {
        self.next()
    }

    pub fn next_isize(&mut self) -> isize {
        self.next()
    }

    pub fn next_chars(&mut self) -> Vec<char> {
        self.next::<String>().chars().collect()
    }

    pub fn next_string(&mut self) -> String {
        self.next()
    }

    pub fn next_char(&mut self) -> char {
        self.next()
    }

    pub fn next_float(&mut self) -> f64 {
        self.next()
    }
}


Measured memory_bytes: 2084
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int main() {
  int a, b, c, x, ans = 0;
  cin >> a >> b >> c >> x;
  rep(i,a+1)
    rep(j,b+1)
      rep(k,c+1)
        if (i * 500 + j * 100 + k * 50 == x)
          ans++;
  cout << ans;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include<vector>
#include<iostream>
#include<set>
#include<map>
#include<algorithm>
using namespace std;




int main() {
	string s;
	cin >> s;
	
	string ss(s.size(),'x');
	
	cout << ss <<endl;
	
	
    return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <tuple>
#include <utility>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <map>
#define rep(i, n) for (int i = 0; i < n; i++)
#define SORT(v) sort((v).begin(), (v).end())
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};

int main()
{
    int n;
    cin>>n;
    vector <string> s(n);
    map<string,ll> mp;
    rep(i,n){
        cin>>s[i];
        SORT(s[i]);
    }
   
    ll ans=0;

    rep(i,n){
        ans+=mp[s[i]];
        mp[s[i]]++;
    }
    
    cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 18176
#include<iostream>
#include <stdio.h>
#include<algorithm>
using namespace std;

int T[500001];
int n;

void maxHeapify(int i) {
    int largest;
	int l = 2 * i;
	int r = 2 * i + 1;
	if (l <= n && T[l] > T[i]) {
		largest = l;
	}
	else {
		largest = i;
	}
	if (r <= n && T[r] > T[largest]) {
		largest = r;
	}
	if (largest != i) {
		swap(T[i], T[largest]);
		maxHeapify(largest);
	}
}


int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> T[i];
	}
	for (int i = n / 2; i >= 1; i--) {
		maxHeapify(i);
	}
	for (int i = 1; i <= n; i++) {
		cout << " " << T[i];
	}
	cout << endl;
}



Measured memory_bytes: 5032
n = int(input())
a = list(map(int, input().split()))

counts = {4:0, 2:0, 1:0}
for i in range(n):
    if a[i]%4 == 0:
        counts[4] += 1
    elif a[i]%2 == 0:
        counts[2] += 1
    else:
        counts[1] += 1

if counts[2] > 0:
    if counts[4] >= counts[1]:
        print('Yes')
    else:
        print('No')
else:
    if counts[4] >= counts[1]-1:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 14252
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,N-1,0)
#define RREPS(i,n) RFOR(i,N,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
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;
}
const int INF=1e18;
const int MOD=1e9+7;
const int MAX_N=1e5;
int divup(int x,int y){
    if(x%y==0)return x/y;
    else return x/y+1;
}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
typedef pair<int,int>P;

signed main(){
    string S;cin>>S;
    int a=S[0]-'0';
    int b=S[1]-'0';
    int c=S[2]-'0';
    int d=S[3]-'0';
    REP(i,2){
        REP(j,2){
            REP(k,2){
                if(a+(i==0?b:-b)+(j==0?c:-c)+(k==0?d:-d)==7){
                    cout<<a<<(i==0?'+':'-')<<b<<(j==0?'+':'-')<<c<<(k==0?'+':'-')<<d<<"=7"<<endl;
                    return 0;
                }
            }
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MAX_N 200000
#define l long
#define ll long long
#define f(a, b) for (int i = a; i < b; i++)
#define f0(a) for (int i=0;i<a;i++)
#define input(d) cin >> d;
#define inputs(n,d) for(int i=0;i<n;i++){cin >> d[i];}
#define output(d) cout << d << endl;
#define outputs(n,d) for(int i=0;i<n;i++){cout << d[i] << endl;}

int main(void) {
	//ll n;
	//l n;
	ll n,x,t;
	ll ans;
	input(n);
	input(x);
	input(t);
	//vector<int> d();
	//vector<l> d();
	//vector<ll> d();

	ans=n/x;
	ll amari=n%x;
	if(n<x){
		ans=1;
	}
	else if(amari!=0){
		ans++;
	}
	ans*=t;
	output(ans);

	return 0;
}


Measured memory_bytes: 3592
N = int(input())
hh = list(map(int, input().split()))

for i in range(1, N):
    if hh[i - 1] == hh[i]:
        continue
    else:
        hh[i] -= 1
    if hh[i - 1] > hh[i]:
        print("No")
        exit()

print("Yes")


Measured memory_bytes: 14252
#include<stdio.h>
int main(void){
long long N, min=9999999999999999, a, b;
scanf("%lld", &N);
for(long long i=1; i*i<=N; i++){
     if(N%i==0){
    a=i-1;
    b=(N/i)-1;
     if((a+b)<min){
    min=(a+b);
    }
  }
}
printf("%lld\n", min);
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()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n, m;
	cin >> n >> m;

	ll ans;

	if (n == 1 && m == 1) {
		dunk(1);
		return 0;
	}

	if (n == 1 || m == 1) {
		ans = 1 * (-2 + max(n, m));
		dunk(ans);
		return 0;
	}

	ans = (n - 2ll) * (m - 2ll);

	dunk(ans);
	return 0;
}

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

using namespace std;

#define REP(i,n)	for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,s,n)	for(int i=(s), i##_len=(n); i<i##_len; ++i)

#define ALL(obj)	(obj).begin(),(obj).end()

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

typedef pair<int,int>			P;

#define LINF		((ll)1 << 63 -1)
#define INF 		2000000007
#define MINF		-2000000007
#define MAX 		100005

const int MOD = 1e9+7;
// テンプレ終了
//====================================================================//


ll Pascal[51][51];

//
int main(){
	int N;cin>>N;
	int A,B;cin>>A>>B;
	vector<ll> v(N);
	REP(i,N)cin>>v[i];

	sort(ALL(v),[&](ll x,ll y){return x > y;});

	Pascal[0][0] = 1;
	REPS(i,1,50+1){
		Pascal[i][0] = 1;
		REPS(j,1,i+1){
			Pascal[i][j] = Pascal[i-1][j-1]+Pascal[i-1][j];
		}
	}
	v.push_back(-1);

	ll suml = 0;
	REP(i,A)suml += v[i];
	
	int cnt = -1;
	while(v[0]==v[++cnt]) ;

	ll ans = 0;
	if(cnt <= A){
		int cPre = 0;
		int cNex = 0;
		for(int i=A-1;i>=0;--i)if(v[A-1]==v[i])cPre++;else break;
		for(int i=A;i<N;++i)if(v[A-1]==v[i])cNex++;else break;
		ans = Pascal[cPre+cNex][cPre];
		
	}else{
		REPS(i,A,B+1)ans += Pascal[cnt][i];
	}

	printf("%lf\n",(double)suml/A);
	cout << ans << endl;

	return 0;
}




Measured memory_bytes: 256
/******************************************************************************
 
рассвет. 
 
*******************************************************************************/
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define rapgame ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define eb emplace_back
#define vi vector <int>
#define vlli vector <lli>
#define vulli vector <ulli>
#define vchar vector <char>
#define vstr vector <string>
#define vb vector <bool>
#define fst first
#define sec second
#define all(a) (a).begin(),(a).end()
#define srt(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define vpii vector <pair <int,int> >
#define pii pair <int,int> 
#define pll pair <lli,lli> 
#define vplli vector <pair <lli,lli> >
#define vvi vector <vector <int> >
#define vvlli vector <vector <lli> >
#define vvpii vector <vector <pair <int,int>> >
#define fr(i,n) for (int i = 0; i < (n); ++i)
#define frbig(i,n) for (lli i = 0; i < (n); ++i)
#define fra(i,a,n) for (lli i = a; i < (n); ++i)
#define run(c,s) for(auto c:s) 
#define read(n) int n; cin >> n;
#define readchar(n) char n; cin >> n;
#define readstr(n) string n; cin >> n;
#define readarr(a,n) fr(i,n) cin >> a[i];
#define read2(x,y) int x,y; cin >> x >> y;
#define read2ll(x,y) long long int x,y; cin >> x >> y;
#define readll(n) lli n; cin >> n;
#define watch(x) cout << (#x) << " is " << (x) << endl
#define print_array(x) fr(i,x.size()) cout << x[i] << " ";
using namespace std;
 
const lli MOD=1e9+7;
const lli MAXN=2e6;
const lli INF=2e18;
const ld PI=acos(-1);
 
int main(){
    rapgame
    //freopen("brokeday.in", "r", stdin);
    //freopen("richday.out", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--){
        string s,t;
        cin >> s >> t;
        int ans=0;
        fr(i,s.size()){
            if(s[i]!=t[i]) ans++;
        }
        cout << ans;
    }
    return 0;
}

Measured memory_bytes: 3796
package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scan(&N)
	arr := make([]int64, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&arr[i])
	}
	fmt.Println(gcd2(arr))
}

func gcd2(arr []int64) int64 {
	r := arr[0]
	for i := 1; i < len(arr); i++ {
		r = gcd(r, arr[i])
	}
	return r
}

func gcd(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

Measured memory_bytes: 5504
n = gets.to_i
arr = gets.chomp.split(' ').map(&:to_i)
count = 0
flag = ""
while true
  arr.each do |num| #現在の数列が
    if num % 2 != 0 #奇数を含めば
      flag = "ng"   #フラグを立てて
      break         #数列の精査を止める
    end
  end
  if flag != "ng"     #もしフラグが立っていなければ
    arr.map!{|i| i/2} #全ての数字を半分にする。
  else                #奇数を含むなら
    break             #ループを抜けて終了する
  end
  count += 1          #breakしていなければ数列を更新できたので、カウントを進める。
end
puts count


Measured memory_bytes: 14380
/* 
 * Project: AtCoder Beginners Contest 159 B - String Palindrome
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/07/09
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
#include <cmath>
using namespace std;

int l;

void solve() {
   
    double v = pow(l, 3)/27;
    printf("%lf\n", v);
}

int main() {

    scanf("%d", &l);

    solve();

}

Measured memory_bytes: 3552
from collections import deque
import sys
 
dq = deque()
num = int(sys.stdin.readline())
line = sys.stdin.readlines()
 
for i in range(num):
 
    order = line[i].split()
 
    if order[0] == 'insert':
        dq.appendleft(order[1])
    elif order[0] == 'deleteFirst':
        dq.popleft()
    elif order[0] == 'deleteLast':
        dq.pop()
    else:
        if order[1] in dq:
            dq.remove(order[1])
 
print(' '.join(dq))

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


#define ll              long long int
#define fo(i,n)         for(ll i=0;i<n;i++)
#define rfo(i,n)        for(ll i=n-1;i>=0;i--)
#define Ull             unsigned long long
#define pb              push_back
#define F               first
#define S               second
#define INF             2e16
#define PI              acos(-1.0)
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define FastRead        ios_base::sync_with_stdio(0);cin.tie(nullptr);
#define tr(it, a)       for(auto it = a.begin(); it != a.end(); it++)
#define deb(x)          cout << #x << "=" << x << endl
#define deb2(x, y)      cout << #x << "=" << x << "," << #y << "=" << y << endl

const int N = 2;
const ll MOD = 1e9 + 7;


ll dx[4] = { -1, 1, 0, 0};
ll dy[4] = {0, 0, 1, -1};


bool comp(const pll &p1, const pll &p2)
{
	if (p1.first == p2.first)
		return p1.second > p2.second;

	else
		return p1.first > p2.first;
}

bool isPrime(ll x)
{
	if (x < 2)
		return false;

	if (x <= 3) return true;

	if (x % 2 == 0 || x % 3 == 0) return false;

	for (ll i = 5; i <= sqrt(x); i += 6)
	{
		if (x % i == 0 || x % (i + 2) == 0)
			return false;
	}

	return true;
}














void Solve()
{
	ll a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;
	if (a == 0) cout << "1" << "\n";
	if (b == 0) cout << "2" << "\n";
	if (c == 0) cout << "3" << "\n";
	if (d == 0) cout << "4" << "\n";
	if (e == 0) cout << "5" << "\n";



}







int main()
{
	FastRead;
	int T = 1;
	//cin >> T;

	while (T--)
	{
		Solve();
	}


	return 0;
}







Measured memory_bytes: 3668
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <iomanip>
#include <stack>
#include <queue>
#include <deque>

using namespace std;

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

#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define mkp make_pair
#define F first
#define S second
#define show(a) cerr << #a <<" -> "<< a <<"\n"
#define fo(a, b, c, d) for(int (a) = (b); (a) <= (c); (a) += (d))
#define foo(a, b, c ,d) for(int (a) = (b); (a) >= (c); (a) -= (d))
#define int ll

const int N = 3e6;
const int MOD = 1e9 + 7;

int x, y, fact[N];

int binpow (int a, int n) {
	int res = 1;
	while (n) {
		if (n & 1) {
			res *= a;
			res %= MOD;
		}
		a *= a;
		a %= MOD;
		n >>= 1;
	}
	return res;
}

int c(int n, int m) {
	return (fact[n] * binpow((fact[m] * fact[n - m]) % MOD, MOD - 2) % MOD) % MOD;
}

main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> x >> y;
	fact[0] = 1;
	fo(i, 1, 1e6 + 1e5, 1) {
		fact[i] = fact[i - 1] * 1ll * i;
		fact[i] %= MOD;
	}
	int i = 0, j = 0, len = 1;
	bool ok = 0;
	for(; i <= 1e6 + 1e5; i++, j += 2, ++len) {
		if(i - x == y - j) {
			ok = 1;
			break;
		}
	}
	if(!ok || j - y + 1 > len || j - y < 0) {
		cout << 0;
		return 0;
	}
//	cout << i <<' '<< j - y <<'\n';
	cout << c(i, j - y);
	return 0;
}


Measured memory_bytes: 10496
S=input()
if(len(S)%2==0):
  num=len(S)//2-1
  A=S[:num+1]
  B=S[num+1:]
else:
  num=len(S)//2
  A=S[:num+1]
  B=S[num:]

B=B[::-1]
count=0
for i in range(len(A)):
  if(A[i]!=B[i]):
    count+=1
print(count)


Measured memory_bytes: 38256
//#include <cstdio>
#include <iostream>

#include <cstring>

#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
//#include <queue>
//#include <stack>
#include <cassert>
#include <numeric>

using namespace std;

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

typedef long long llong;
typedef vector<int> VI;
typedef vector<VI> VVI;

#define MAXN 104
int N, C;
int W[MAXN], V[MAXN];

const int INF = 1000000010;
int memo[MAXN][MAXN*1001];
// F(n, val) : minimum weight of items I can take from suffix [n..N] such that
//             sum of values is exactly val
int F(int n, int val) {
   if (val < 0)
      return INF;
   if (n >= N)
      return val == 0 ? 0 : INF;
   int& res = memo[n][val];
   if (res < 0) {
      res = min( F(n+1, val), min(F(n+1, val-V[n]) + W[n], INF) );
   }
   return res;
}

int main(int argc, char* argv[]) {
   ios_base::sync_with_stdio(false); 
   cin.tie(nullptr);

   cin >> N >> C;
   REP(i, N)
      cin >> W[i] >> V[i];

   memset(memo, -1, sizeof(memo));
   int res = 0;
   FOR(v, 1, accumulate(V, V+N, 0)) {
      int t = F(0, v);
      if (t <= C)
         res = max(res, v);
   }
   cout << res << '\n';

   return 0;
}


Measured memory_bytes: 42624
#include<bits/stdc++.h>
#include <math.h>
#include <algorithm>
#include <functional>
#include<iostream>
#include <string>
using namespace std;
typedef long long ll;
#define pb pushback
#define fr(i,n) for(int i=0;i<n;i++)
#define fro(i,j,n) for(int i=j;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)


int main() {
    int n;
	cin >> n;
    double a[n];
    double ans=0;
    fr(i,n){
      cin >> a[i];
    }
    sort(a,a+n);
    ans = double(a[0]);
    fro(i,1,n){
      ans=(ans+a[i])/2;
    }
    
     cout <<ans << endl;
}

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


int test(int x,int y,int z){
       int min;//3数のうち最小のものを入れる
       int gcd3=0;
       
       min=x;
       if(min>y)
       min=y;
       if(min>z)
       min=z;
       
       for(int i=1;i<=min;i++){
           if(x%i==0&&y%i==0&&z%i==0)
                gcd3=i;
       }
       
       return gcd3;
   }
   
int main(void){
    // Your code here
   //3数の最大公約数の足しあげ
   
   int K;
   int a,b,c;
   int x = 0;
   
   cin >> K;
   
   for(a=1;a<=K;a++){
       for(b=1;b<=K;b++){
           for(c=1;c<=K;c++){
                
                x += test(a,b,c);
              
           }
       }
   }
   
   cout << x << endl;
}


Measured memory_bytes: 3636
//
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
//
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// solution 
#[allow(unused_mut)]
#[allow(non_snake_case)]
fn main() {
    input!{
        a: usize,
        b: usize,
        c: usize,
        d: usize,
        e: usize,
        k: usize,
    }

    let ant = [a, b, c, d, e];

    for ind0 in 0..ant.len() {
        for ind1 in ind0..ant.len() {
            if ant[ind1] - ant[ind0] > k {
                println!(":(");
                return;
            }
        }
    }
    println!("Yay!");
}


Measured memory_bytes: 4352
/*********************************************************************************\
*  _________  _      _  ________  _       _       __       ________               *
* |___   ___|| |    | ||  ______|| |     | |     /  \     |  ____  |              *
*     | |    | |    | || |______ | |_____| |    / /\ \    | |____| |              *
*     | |    | |    | ||______  ||  _____  |   / /__\ \   |  __  __|              *
*     | |    | |____| | ______| || |     | |  / ______ \  | |  \ \                *
*     |_|    |________||________||_|     |_| /_/      \_\ |_|   \_\               *
*                                                                                 *
*   Department of Computer Science & Engineering                                  *
*   Student ID : 18CSE035                                                         *
*   Bangabnadhu Sheikh Mujibur Rahman Science & Technology University,Gopalgonj.  *
*                                                                                 *
\*********************************************************************************/

//Now Write to Code ___________________________


#include <bits/stdc++.h>
using namespace std ;
 
 
typedef long long                ll;
typedef long double              ld;
typedef unsigned long long       ull;
typedef pair <int,int>           pii;
typedef pair <ll,ll>             pll;
typedef vector <int>             vi;
typedef vector <ll>              vll;
typedef vector <vector <int> >   vvi;
 
inline int    Int(){int x; cin >> x; return x;}
inline ll     Long(){ll x; cin >> x; return x;}
inline float  Float(){float x; cin >> x; return x;}
inline double Double(){double x; cin >> x; return x;}
inline void   Yes(){cout << "Yes" << endl;}
inline void   No(){cout << "No" << endl;}
inline void   YES(){cout << "YES" << endl;}
inline void   NO(){cout << "NO" << endl;}
 
const int N             =(int)2e5 + 5;
const int maxN          =(int)1e6 + 6;
const ll  Mod           =(ll)1e9 + 7;
const int inf           =(int)2e9;
const ll  Inf           =(ll)1e18;
 
#define     T           int t,q; cin >> t; for(q=1;q<=t;q++)
#define     debug(x)    cerr << #x << " = " << x << '\n' ;
#define     rep(i,b,e)  for(__typeof(e) i=(b); i!=(e+1)-2*(b > e); i =i+1-2*(b > e))
#define     Int         Int()
#define     Long        Long()
#define     Float       Float()
#define     Double      Double()
#define     all(x)      x.begin() , x.end()
#define     sz(x)       (int)x.size()
#define     ff          first
#define     ss          second
#define     pb          push_back
#define     eb          emplace_back
#define     mem(a)      memset(a , 0 ,sizeof a)
#define     memn(a)     memset(a , -1 ,sizeof a)
#define     biday       return 0 
 
 
int main(){

	ll A,y,result=0;
	cin >> A;

	
        y = A/500;
        result = result + y*1000;
	A = A%500;
	y = A/5;
	result = result + y*5;
    
        cout << result << endl;

        biday;
}
 
//...............BYE BYE................

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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template <class T> ostream& operator<<(ostream& os, const V<T>& v) {
    os << "[";
    for (auto d : v) os << d << ", ";
    return os << "]";
}

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    return os << "P(" << p.first << ", " << p.second << ")";
}

template <uint MD> struct ModInt {
    using M = ModInt;
    uint v;
    ModInt() : v(0) {}
    ModInt(ll _v) { set_v(_v % MD + MD); }
    M& set_v(uint _v) {
        v = (_v < MD) ? _v : _v - MD;
        return *this;
    }
    explicit operator bool() const { return v != 0; }
    M operator-() const { return M() - *this; }
    M operator+(const M& r) const { return M().set_v(v + r.v); }
    M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
    M operator*(const M& r) const { return M().set_v(ull(v) * r.v % MD); }
    M operator/(const M& r) const { return *this * r.inv(); }
    M& operator+=(const M& r) { return *this = *this + r; }
    M& operator-=(const M& r) { return *this = *this - r; }
    M& operator*=(const M& r) { return *this = *this * r; }
    M& operator/=(const M& r) { return *this = *this / r; }
    M pow(ll n) const {
        M x = *this, r = 1;
        while (n) {
            if (n & 1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
    M inv() const { return pow(MD - 2); }
    friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
using Mint = ModInt<TEN(9) + 7>;

const int MF = TEN(6) + TEN(5);
V<Mint> fact(MF + 1), iFac(MF + 1);
void first() {
    fact[0] = 1;
    for (int i = 1; i <= MF; i++) fact[i] = fact[i-1] * Mint(i);
    iFac[MF] = fact[MF].inv();
    for (int i = MF; i >= 1; i--) iFac[i-1] = iFac[i] * Mint(i);
    assert((fact[114] * iFac[114]).v == 1);
}

Mint C(int n, int k) {
    if (n < k || n < 0) return Mint(0);
    return fact[n] * iFac[k] * iFac[n - k];
}

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

    int n, k;
    cin >> n >> k;
    V<Mint> dp(k + 1);
    dp[0] = 1;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a; a++;
        for (int j = k; j >= a; j--) {
            dp[j] -= dp[j - a];
        }
    }
    Mint sm = 0;
    for (int j = 0; j <= k; j++) {
        sm += dp[j] * C(k - j + n - 1, n - 1);
    }
    cout << sm << endl;
    return 0;
}


Measured memory_bytes: 9216
import itertools

n = int(input())

seq = []
for i in range(1,n+1):
  seq.append(i)
  
#print(seq)

per = list(itertools.permutations(seq))


#print(type(per[0]))

A = tuple(map(int, input().split()))
#print(A)

#print(per.index(A))

B = tuple(map(int, input().split()))
#print(B)

#print(per.index(B))

print(abs(per.index(B)-per.index(A)))

Measured memory_bytes: 8052
//dhruv
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
#define ll long long
#define ffor(i,n) for(int i = 0;i < (n); ++i)
#define fro(i,j,n) for(int i = (j);i < (n); ++i)
#define all(v) v.begin(),v.end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vpii vector<pii>
#define ff first
#define ss second
const int mod = 1e9 + 7;
const int inf = 1e18 + 5;
 
template<typename T>
T binpow(T a,T b,T modi){
	T res = 1;
	while(b){
		if(b&1){
			res = (res*a)%modi;
		}
		b /= 2;
		(a *= a) %= modi;
	}
	return res;
}
 
 
template<typename T>
T binpow(T a,T b){
	T res = 1;
	while(b){
		if(b&1){
			res = (res*a);
		}
		b /= 2;
		a *= a;
	}
	return res;
}
 
template<typename T>
T add(T a,T b){
	return (a + b)%mod;
}
template<typename T>
T sub(T a,T b){
	return add(a,mod - b);
}
template<typename T>
T mul(T a,T b){
	return (a*b)%mod;
}
template<typename T>
T inv(T a){
	return binpow(a,mod - 2,mod);
}

int make_int(string s){
	int x = 0;
	reverse(s.begin(),s.end());
	string tmp = s;
	for(int i = 0;i < s.length(); ++i){
		x *= 10;
		x += (int)(tmp.back() - '0');
		tmp.pop_back();
	}
	return x;
}
 
string make_string(int s){
	string x;
	while(s){
		x.push_back(char(s%10 + '0'));
		s /= 10;
	}
	reverse(x.begin(),x.end());
	return x;
}

random_device rd;
mt19937 g(rd());

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

const int N = 100;

vi fact;

void factorial(){
	fact.resize(N);
	fact[0] = 1,fact[1] = 1;
	fro(i,2,N){
		fact[i] = (fact[i - 1]*i)%mod;
	}
}

int nCr(int n,int r){
	return (mul(fact[n],inv(mul(fact[r],fact[n - r]))));
}

int nPr(int n,int r){
	return(mul(nCr(n,r),fact[r]));
}

// Linear Seive


int lp[N + 1];
vector<int> pr;
void ls(){
	for(int i = 2;i <= N; ++i){
		// means prime
		if(lp[i] == 0){
			lp[i] = i;
			pr.push_back(i);
		}
		for(int j = 0;j < pr.size() && pr[j] <= lp[i] && i*pr[j] <= N; j++){
			lp[i*pr[j]] = pr[j];
		}
	}
}


// getting the prime factorisation

vector<int> getfc(int n){
	vi factors;
	while(n != 1){
		int x = lp[n];
		factors.push_back(x);
		while(n%x == 0){
			n /= x;
		}
	}
	return factors;
}

int gcd(int a,int b){
	while(b){
		a %= b;
		swap(a,b);
	}	
	return a;
}

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	// shuffle(all(a),g);
	int x,y;
	cin >> x >> y;
	bool ok = false;
	// i -> number of turtle
	for(int i = 0;i <= x; ++i){
		if(4*i + 2*(x - i) == y) ok = true;
	}
	cout << (ok?"Yes":"No");
	return 0;
}	

Measured memory_bytes: 3664