akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ROCK ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define f first
#define sec second
using namespace std;
using namespace __gnu_pbds;
const long long int linf =(long long)9223372036854775807;
const int dx[8] =  {0,0,1,-1,1,-1,1,-1},dy[9] = {1,-1,0,0,1,-1,-1,1};
typedef long long int ll;

const int N=1e5+5,sz=101;
ll n,W,dp[sz][N],w[sz],v[sz];


ll solve(int idx,ll left){
   if(idx==n)return 0;
   if(dp[idx][left]!=-1)return dp[idx][left];
   ll take=0;
   if((left-w[idx])>=0)take=solve(idx+1,left-w[idx])+v[idx];
   ll leave=solve(idx+1,left);
   ll ans=max(take,leave);
   return dp[idx][left]=ans;
}

int main()
{
    ROCK;
    memset(dp,-1,sizeof dp);
    cin>>n>>W;
    for(int i=0;i<n;i++)cin>>w[i]>>v[i];
    cout<<solve(0,W)<<endl;
    return 0;
}












Measured memory_bytes: 79232
package main

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

func main() {
	N := readint()
	A := make([]int, N)
	minA := 200001
	for i := 0; i < N; i++ {
		A[i] = readint()
		minA = min(minA, A[i])
	}
	if minA != 1 {
		fmt.Println(-1)
		return
	}
	b := 0
	ai := 0
	for i := 1; i <= N; i++ {
		for ; ai < N && A[ai] != i; ai++ {
			b++
		}
		ai++
	}
	fmt.Println(b)
}

const (
	iobufsize = 1 * 1024 * 1024 // 1 MB
)

var stdinsc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, iobufsize), iobufsize)
	sc.Split(bufio.ScanWords)
	return sc
}()

func readint() int {
	stdinsc.Scan()
	v, err := strconv.Atoi(stdinsc.Text())
	if err != nil {
		panic(err)
	}
	return v
}

func readstr() string {
	stdinsc.Scan()
	return stdinsc.Text()
}

func pow(x, y int) int {
	if y < 1 {
		return 1
	}
	return x * pow(x, y-1)
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}


Measured memory_bytes: 4736
main = do
  ns <- fmap (fmap (read :: String -> Int) . words) . lines <$> getContents
  let ts = head $ tail ns
  putStrLn $ show $ splc ts 0


splc :: [Int] -> Int -> Int
splc src acc = if all even src then
                 splc (map (\n -> n `div` 2) src) (acc + 1)
               else
                acc

Measured memory_bytes: 1020
sx,sy,tx,ty = map(int,input().split())
up_1 = ty-sy
right_1 = tx-sx
ans = "U"*up_1+"R"*right_1
key = ans
ans += key.replace("U","D").replace("R","L")
up_2 = up_1+1
right_2 = right_1+1
flag = "L"+"U"*up_2+"R"*right_2+"D"
key_2 = flag
ans += flag + key_2.replace("L","x").replace("R","L").replace("x","R").replace("D","y").replace("U","D").replace("y","U")
print(ans)


Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
long long a,b;
int main()
{
    cin>>a>>b;
    if(a==1)a=20;
    if(b==1)b=20;
    if(a>b)
    cout<<"Alice"<<endl;
    else
    {
        if(a<b)cout<<"Bob"<<endl;
        else
        {
            cout<<"Draw"<<endl;
        }
    }
}

Measured memory_bytes: 256
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

#define _USE_MATH_DEFINES

#include <stdio.h>
#include <iostream>
#include <vector>
#include <unordered_map>
#include <stack>
#include <list>
#include <math.h>
#include <map>
#include <iomanip>
#include <functional>
#include <string>
#include <algorithm>
#include <queue>
#include <set>

using namespace std;

template<class T> ostream& operator<<(ostream& os, const vector<T>& v) {
	for (auto i = begin(v); i != end(v); i++) os << *i << (i == end(v) - 1 ? "" : " "); return os;
}
template<class T> istream& operator>>(istream& is, vector<T>& v) {
	for (auto i = begin(v); i != end(v); i++) is >> *i; return is;
}

#define MOD 1000000007

long long binpow(long long x, long long pw)
{
	if (pw == 0)
		return 1;
	if (pw % 2 == 0)
	{
		auto xx = binpow(x, pw / 2);
		return (xx * xx) % MOD;
	}
	else
	{
		auto xx = binpow(x, pw - 1);
		return (x * xx) % MOD;
	}
}


long long fact[1000000];

long long binco(long long n, long long k)
{
	if (n < k)
		throw 1;
	long long tmp = fact[n];
	long long denom = (fact[k] * fact[n - k]) % MOD;
	return (tmp * binpow(denom, MOD - 2) ) %MOD;
}

int main()
{
#if defined(_DEBUG) 
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	cin.tie(NULL);
	ios_base::sync_with_stdio(false);
	cout.tie(NULL);

	int n;
	cin >> n;

	vector<int> x(n+1);
	for (int i = 0; i < n+1; i++)
		cin >> x[i];


	fact[0] = 1;
	for (int k = 1; k < 1000000; k++)
	{
		fact[k] = (fact[k - 1] * k) % MOD;
	}

	int left = 0, right = 0;
	map<int, int> pos;
	for (int i = 0; i < x.size(); i++)
	{
		if (pos.count(x[i]) == 0)
		{
			pos[x[i]] = i;
		}
		else
		{
			left = pos[x[i]];
			right = x.size() - i - 1;
			break;
		}
	}

	cout << n << "\n";
	for (int k = 2; k <= (n+1); k++)
	{
		long long resp = binco(n + 1, k);
		if ((left + right) >= (k-1))
			resp = (resp + MOD - binco(left + right, k - 1)) % MOD;
		cout << resp << "\n";
	}


	return 0;
}

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

namespace ITP2_9_B
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int n = ReadInt();
            int[] a = ReadIntAr();
            int m = ReadInt();
            int[] b = ReadIntAr();
            a = a.Intersect(b).ToArray();
            Array.Sort(a);
            foreach (var item in a) Console.WriteLine(item);
        }


        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }
        static string WriteAr(int[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(double[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(long[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }

    }

}



Measured memory_bytes: 52096
import java.util.Scanner;
public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int a[] = new int[n];//??¶???????????¨
		int b[] = new int[m];//????????????
		int cnt[] = new int[n];//????????????
		int max = 0, idx = 0;//?????§?????¨????????????????????????
		for(int i = 0;i < n;i++){
			a[i] = sc.nextInt();
			cnt[i] = 0;//????????????????????????
		}
		for(int i = 0;i < m;i++){
			b[i] = sc.nextInt();
		}
		for(int i = 0;i < m;i++){
			for(int k = 0;k < n;k++){
				if(a[k] <= b[i]){
					cnt[k]++;
					break;
				}
			}
		}
		for(int i = 0;i < n;i++){
			if(max < cnt[i]){
				max = cnt[i];
				idx = i;
			}
		}
		System.out.println(idx + 1);
	}
}

Measured memory_bytes: 33772
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin>>s>>t;
  for(int i=0;i<s.size();i++){
    if(s==t){
      cout<<"Yes"<<endl;
      return 0;
    }
    s=s.back()+s.substr(0,s.size()-1);
  }
  cout<<"No"<<endl;
  return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i=0; i<n; i++) {
    cin >> a[i];
  }
  vector<int> hist_table(3, 0);
  vector<int> t(n);
  for (int i=0; i<n; i++) {
    for (int j=0; j<3; j++) {
      if (a[i] == hist_table[j]) t[i]++;
    }
    if (a[i] == hist_table[0]) hist_table[0]++;
    else if (a[i] == hist_table[1]) hist_table[1]++;
    else hist_table[2]++;
  }
  ll T = 1;
  for (int i=0; i<n; i++) {
    T = (T*t[i])%1000000007;
  }
  cout << T << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <iostream>
#include <vector>
using namespace std;

int main()
{ 
    int a, b;
    char op;
    cin >> a >> op >> b;

    int t;
    if (op == '+')
        t = a + b;
    else
        t = a - b;

    printf("%d\n", t);
}

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

int main() {
  int N;
  cin >> N;
  int x = 0;
  for (int i = 0; i < N; i++) {
    int l, r;
    cin >> l >> r;
    x += r - l + 1;
  }
  cout << x << endl;
}


Measured memory_bytes: 256
#ifndef __cplusplus
    cat << EOF
#endif
#include <bits/stdc++.h>
using namespace std;

#define rep(...) overload_rep(__VA_ARGS__, rep_1, rep_0)(__VA_ARGS__)
#define rep_0(i, end) for(int i = 0; i < (end); ++i)
#define rep_1(i, fr, ba) for(int i = (fr); i <= (ba); ++i)
#define overload_rep(arg0, arg1, arg2, name, ...) name
#define all(box) box.begin(), box.end()

template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if(lhs < rhs) { lhs = rhs; return 1; } return 0; }
template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if(lhs > rhs) { lhs = rhs; return 1; } return 0; }

typedef long long lint;

int N;
int val[16][16];
long long dp[1 << 16];

int main() {

    cin >> N;
    rep(i, N) rep(j, N) cin >> val[i][j];

    rep(S, 1 << N) {
        rep(i, N) rep(j, i) {
            if(((1 << i) & S) > 0 && ((1 << j) & S) > 0) {
                dp[S] += val[i][j];
            }
        }
    }

    rep(S, 1 << N) {
        for(int T = (S - 1) & S; T > 0; T = (T - 1) & S) {
            chmax(dp[S], dp[T] + dp[S & ~T]);
        }
    }

    cout << dp[(1 << N) - 1] << '\n';
    return 0;

}


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



int main() {
 
  double d,t,s;
  cin>>d>>t>>s;
  
  if((d/s)<=t)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
    return 0;
  }



Measured memory_bytes: 3712
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        long[] a = new long[N];
        long t = 0;
        for (int i = 0; i < N; i++) {
            a[i] = scan.nextInt();
            t = t^a[i];
        }
        long[] ans = new long[N];
        for (int i = 0; i < N; i++) {
            ans[i] = t^a[i];
        }
        System.out.println(Arrays.stream(ans).mapToObj(i -> Long.toString(i)).collect(Collectors.joining(" ")));
    }
}


Measured memory_bytes: 73004
# -*- coding: utf-8 -*-
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))


sum_A = [0]
sum_B = [0]
for n in range(N):
    sum_A.append(sum_A[n]+A[n])
for m in range(M):
    sum_B.append(sum_B[m]+B[m])

max_j = M
max_book = 0
for i in range(N+1):
    # Aの机でi冊読んだときのBの机で読む最大値
    if sum_A[i] > K:
        break
    for j in range(max_j,-1,-1):
        if sum_A[i]+sum_B[j] <= K:
            max_j = j
            break
    else:
        max_j = 0
    
    max_book = max(max_book, i+max_j)

print(max_book)


Measured memory_bytes: 47496
N, M, X = [int(_) for _ in input().split()]
A = []
C = []
for _ in range(N):
    c, *a = [int(_) for _ in input().split()]
    A.append(tuple(a))
    C.append(c)

ans = 10 ** 10
for i in range(2 ** N):
    v = [0 for _ in range(M)]
    c = 0
    for j in range(N):
        if i & 1 << j:
            for k, a in enumerate(A[j]):
                v[k] += a
            c += C[j]
    if min(v) >= X:
        ans = min(ans, c)

if ans == 10 ** 10:
    print(-1)
else:
    print(ans)


Measured memory_bytes: 9212
// 問題の URL を書いておく
// https://atcoder.jp/contests/abc145/tasks/abc145_d

#include <algorithm>
#include <bitset>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>

using namespace std;

//#define ENABLE_PRINT

#if defined(ENABLE_PRINT)

#define Print(v) \
do {\
    cout << #v << ": " << v << endl; \
}while(0)

#define PrintVec(v) \
do {\
    for(int __i = 0; __i < v.size(); ++__i) \
    { \
        cout << #v << "[" << __i << "]: " << v[__i] << endl; \
    }\
}while(0)

#else

#define Print(v) ((void)0)
#define PrintVec(v) ((void)0)

#endif

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

template<int Mod>
struct MintBase {
  int64_t x; // typedef long long int64_t;
  MintBase(int64_t x=0):x((x%Mod+Mod)%Mod){}
  MintBase operator-() const { return MintBase(-x);}
  MintBase& operator+=(const MintBase a) {
    if ((x += a.x) >= Mod) x -= Mod;
    return *this;
  }
  MintBase& operator-=(const MintBase a) {
    if ((x += Mod-a.x) >= Mod) x -= Mod;
    return *this;
  }
  MintBase& operator*=(const MintBase a) { (x *= a.x) %= Mod; return *this;}
  MintBase operator+(const MintBase a) const { return MintBase(*this) += a;}
  MintBase operator-(const MintBase a) const { return MintBase(*this) -= a;}
  MintBase operator*(const MintBase a) const { return MintBase(*this) *= a;}
  MintBase pow(int64_t t) const {
    if (!t) return 1;
    MintBase a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime Mod
  MintBase inv() const { return pow(Mod-2);}
  MintBase& operator/=(const MintBase a) { return *this *= a.inv();}
  MintBase operator/(const MintBase a) const { return MintBase(*this) /= a;}
};

//const int Mod = 1000000007;
//const int Mod = 998244353;

using mint = MintBase<1000000007>;

istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

mint factorial(const mint& x)
{
    mint ans = 1;
    for(mint i = x.x; i.x != 0; i -= 1)
    {
        ans *= i;
    }
    return ans;
}

mint factorial(const mint& x, const mint& n)
{
    mint ans = 1;
    mint m = x;
    for(int64_t i = 0; i < n.x; ++i)
    {
        ans *= m;
        m -= 1;
    }
    return ans;
}

mint Combination(int64_t x, int64_t y)
{
    return  factorial(x, y) / factorial(y);
}

int main(int, const char**)
{
    int x, y;
    cin >> x >> y;
    auto ta = 2 * x - y;
    auto tb = -x + 2 * y;
    if(!(ta % 3 == 0 && tb % 3 == 0 && ta >= 0 && tb >= 0))
    {
        cout << 0 << endl;
        return 0;
    }

    mint a = ta / 3;
    mint b = tb / 3;

    mint total = a + b;
    auto ans = factorial(total) / (factorial(a) * factorial(b));

    cout << ans.x << endl;

    return 0;
}


Measured memory_bytes: 3608
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <assert.h>
#include <fstream>

using namespace std;

typedef long long ll;

const int MAXN = 300005;
const ll MOD = 998244353;

int n;
int state[MAXN];

ll ans;

char s[MAXN];

int main()
{
	scanf("%d%s",&n,s + 1);
	ans = 1;
	for (int i = 1;i <= n;i++)
		(ans *= i) %= MOD;
	n = 3 * n;
	int R = 0,G = 0,B = 0;
	for (int i = 1;i <= n;i++)
	{
		if (s[i] == 'R')
		{
			if (G && B)
			{
				state[i] = -1;
				G--;
				B--;
			}
			else
				R++;
		}
		if (s[i] == 'G')
		{
			if (R && B)
			{
				state[i] = -1;
				R--;
				B--;
			}
			else
				G++;
		}
		if (s[i] == 'B')
		{
			if (R && G)
			{
				state[i] = -1;
				R--;
				G--;
			}
			else
				B++;
		}
	}
	for (int i = n;i >= 1;i--)
	{
		if (s[i] == 'R')
		{
			if (G && B)
			{
				state[i] = 1;
				G--;
				B--;
			}
			else
				R++;
		}
		if (s[i] == 'G')
		{
			if (R && B)
			{
				state[i] = 1;
				R--;
				B--;
			}
			else
				G++;
		}
		if (s[i] == 'B')
		{
			if (R && G)
			{
				state[i] = 1;
				R--;
				G--;
			}
			else
				B++;
		}
	}
	int cnt = 0;
	for (int i = 1;i <= n;i++)
	{
		if (state[i] == 1)
			cnt++;
		if (!state[i])
		{
			(ans *= cnt) %= MOD;
			cnt--;
		}
	}
	cnt = 0;
	for (int i = n;i >= 1;i--)
	{
		if (state[i] == -1)
			cnt++;
		if (!state[i])
		{
			(ans *= cnt) %= MOD;
			cnt--;
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1664
s = list(str(input()))



for i in range(len(s)- 5):
    if s[i] == 'e' and s[i+1] == 'r' and s[i + 2] == 'a' and s[i + 3] == 's' and s[i + 4] == 'e' and s[i+5] == 'r':
        s[i] = ''
        s[i+1] = ''
        s[i + 2] = ''
        s[i + 3] = ''
        s[i + 4] = ''
        s[i + 5] = ''
        
        
for i in range(len(s)- 4):
    if s[i] == 'e' and s[i+1] == 'r' and s[i + 2] == 'a' and s[i + 3] == 's' and s[i + 4] == 'e' :
        s[i] = ''
        s[i+1] = ''
        s[i + 2] = ''
        s[i + 3] = ''
        s[i + 4] = ''
        

    
    
    
for i in range(len(s)- 6):
    if s[i] == 'd' and s[i+1] == 'r' and s[i + 2] == 'e' and s[i + 3] == 'a' and s[i + 4] == 'm' and s[i + 5] == 'e' and s[i + 6] == 'r':
        s[i] = ''
        s[i+1] = ''
        s[i + 2] = ''
        s[i + 3] = ''
        s[i + 4] = ''
        s[i + 5] = ''
        s[i+6] = ''
        

    
for i in range(len(s)- 4):
    if s[i] == 'd' and s[i+1] == 'r' and s[i + 2] == 'e' and s[i + 3] == 'a' and s[i + 4] == 'm' :
        s[i] = ''
        s[i+1] = ''
        s[i + 2] = ''
        s[i + 3] = ''
        s[i + 4] = ''

        
while '' in s:
    s.remove('')
    
if s == []:
    print('YES')
else:
    print('NO')



Measured memory_bytes: 4212
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const ll INF = 1LL<<60;
const int ny[4] = {-1,1,0,0}, nx[4] = {0,0,-1,1};
int sy,sx,gy,gx;


int main(){
  int n,m; cin >> n >> m;
  string a[n], b[m];
  rep(i,n) cin >> a[i];
  rep(i,m) cin >> b[i];

  int cnt = 0;
  for(int i = 0; i <= n-m; i++){
    for(int j = 0; j <= n-m; j++){
      bool flg = true;
      for(int bi = 0; bi < m; bi++){
        for(int bj = 0; bj < m; bj++){
          if(b[bi][bj] != a[i+bi][j+bj]) flg = false;
        }
      }
      if(flg) cnt++;
    }
  }
  if(cnt) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
    #include <stdlib.h>
     
    int main() {
     
        int k,s;
        int x,y,z;
        int cnt = 0;

        scanf("%d %d",&k,&s);
        for(x=0;x<=k;x++){
            for(y=0;y<=k;y++){
                if(0 <= (s-(x+y)) && (s-(x+y)) <= k){cnt++;}
            }
        }
        printf("%d",cnt);

        return 0;     
    }

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

using namespace std;

long long power(long long x, long long t, long long p) {
	long long ret = 1 % p;
	for(; t; t >>= 1, x = x * x % p) {
		if(t & 1) {
			ret = ret * x % p;
		}
	}
	return ret;
}

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

	int n;
	string s;
	cin >> n >> s;

	int one = 0;
	for(char c : s) {
		if(c == '1') {
			one += 1;
		}
	}

	if(one == 1) {
		if(s[n - 1] == '1') {
			for(int i = 0; i < n; ++i) {
				if(i == n - 1) {
					cout << 0 << '\n';
				} else {
					cout << 2 << '\n';
				}
			}
		} else {
			for(int i = 0; i < n; ++i) {
				if(s[i] == '1') {
					cout << 0 << '\n';
				} else if(i == n - 1) {
					cout << 2 << '\n';
				} else {
					cout << 1 << '\n';
				}
			}
		}

		exit(0);
	}

	if(one == 0) {
		for(int i = 0; i < n; ++i) {
			cout << 1 << '\n';
		}	
		exit(0);
	}

	long long suma = 0;
	long long sumb = 0;
	for(char c : s) {
		suma = (suma * 2 + c - '0') % (one + 1);
		sumb = (sumb * 2 + c - '0') % (one - 1);
	}

	auto popcount = [&] (long long v) {
		int ret = 0;
		while(v) {
			if(v & 1) {
				ret += 1;
			}
			v >>= 1;
		}

		return ret;
	};

	for(int i = 0; i < n; ++i) {
		if(s[i] == '0') {
			long long tmp = (suma + power(2, n - i - 1, one + 1)) % (one + 1);
			int ans = 1;
			while(tmp > 0) {
				int div = popcount(tmp);
				tmp = tmp % div;
				ans += 1;
			}

			cout << ans << '\n';
		} else {
			long long tmp = (sumb - power(2, n - i - 1, one - 1) + one - 1) % (one - 1);
			int ans = 1;
			while(tmp) {
				int div = popcount(tmp);
				tmp = tmp % div;
				ans += 1;
			}

			cout << ans << '\n';
		}
	}

	return 0;
}

Measured memory_bytes: 3852
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define X first
#define Y second
#define pie 3.14159265358979323846
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;


template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int mod =(int)1e9+7;
const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
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;
}

ll RS(ll N,ll P,ll M){
    if(P==0){
        return 1;
    }else{
        if(P%2==0){
            ll t=RS(N,P/2,M);
            return t*t%M;
        }else{
            return N*RS(N,P-1,M)%M;
        }
    }
}
bool greater_pair(pair<ll,ll> a,pair<ll,ll> b){
    if(a.first!=b.first){
        return a.first>b.first;
    }else{
        return a.second>b.second;
    }
}
int main() {
    ios::sync_with_stdio(false);
    int A,B,C;
    cin>>A>>B>>C;
    cout<<A+B+C+9*max(A,max(B,C))<<endl;
    return 0;
}


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


using ll = long long;
const int MaxN = 2e5;
const int Mod = 998244353;
int N;
vector<pair<int, int>> vxd;


void solve()
{
    sort(vxd.begin(), vxd.end());
    stack<pair<int, int>> st;
    vector<ll> f(N + 1);
    f[N] = 1;
    for (int i = N - 1; i >= 0; i--) {
        int k = i + 1;
        int x = vxd[i].first + vxd[i].second;
        while (!st.empty() && x > vxd[st.top().first].first) {
            k = st.top().second;
            st.pop();
        }
        st.push(make_pair(i, k));
        f[i] = (f[i + 1] + f[k]) % Mod;
    }
    cout << f[0] << endl;
}


int main()
{
    cin >> N;
    vxd.resize(N);
    for (int i = 0; i < N; i++) cin >> vxd[i].first >> vxd[i].second;
    solve();
    return 0;
}


Measured memory_bytes: 4224
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define SIZE 100000
#define rep(i, N) for (i = 0; i < N; i++) //制御変数iを用いてN回転
#define array(N, t) (t*)calloc(N, sizeof(t)) //t型N要素の1次元配列を動的確保後0クリア(freeを忘れずに)
#define zero(a); {int iter; rep(iter, sizeof(a)/sizeof((a)[0])) (a)[iter]=0;} //1次元配列aのゼロ初期化?
typedef long long ll;
void print_log(); //とりあえず文字を出力してどこまで実行できているか確認(for debug)
void printa_int(int *a, int size); //int型の1次元配列aを出力(for debug)
typedef struct node {
    int data;
    struct node *next;
} Node;
Node *list[SIZE];
Node* add_node(int i, int data) {
    if (!list[i]) {
        list[i] = (Node*)malloc(sizeof(Node*));
        list[i]->data = data;
    } else {
        Node *t;
        t = list[i];
        list[i] = (Node*)malloc(sizeof(Node*));
        list[i]->data = data;
        list[i]->next = t;
    }
    return list[i];
}
void free_node(Node* head) {
    Node *prev = NULL, *t = head;
    while (t) {
        prev = t;
        t = t->next;
        free(prev);
    }
}
void printl_int(int size);

int q[SIZE]; //queue
int q_head = 0, q_tail = 0;
int queue_empty() {
    return q_head == q_tail;
}
int queue_full() {
    return (q_head - 1) % SIZE == q_tail % SIZE;
}
void enqueue(int data) {
    if (queue_full()) {
        printf("full!\n");
        return;
    }
    q[q_tail++] = data;
    q_tail %= SIZE;
}
int dequeue() {
    if (queue_empty()) {
        printf("empty!\n");
        return -444444;
    }
    int data = q[q_head++];
    q_head %= SIZE;
    return data;
}

int main() {
    int i, N, M, A, B;
    int *ms, prev;
    Node *t;
    scanf("%d %d", &N, &M);
    ms = array(N, int);
    rep(i, N) {
        list[i] = NULL;
        ms[i] = -1;
    }
    rep(i, M) {
        scanf("%d %d", &A, &B);
        list[A - 1] = add_node(A - 1, B - 1);
        list[B - 1] = add_node(B - 1, A - 1);
    }
    ms[0] = 0;
    prev = 0;
    for (t = list[0]; t; t = t->next) {
        enqueue(t->data);
        ms[t->data] = prev;
    }
    while (!queue_empty()) {
        prev = dequeue();
        for (t = list[prev]; t; t = t->next) {
            if (ms[t->data] != -1) continue;
            enqueue(t->data);
            ms[t->data] = prev;
        }
    }
    rep(i, N) {
        if (!i) printf("Yes\n");
        else printf("%d\n", ms[i] + 1);
    }
    free(ms);
    return 0;
}

void print_log() {
    printf("===finish!===\n");
}

void printa_int(int *a, int size) {
    int i;
    printf("[");
    for (i = 0; i < size; i++)
        printf("%d, ", a[i]);
    printf("]\n");
}

void printl_int(int size) {
    int i;
    Node *t;
    rep(i, size) {
        printf("[%d] ", i);
        for (t = list[i]; t; t = t->next) printf("%d, ", t->data);
        printf("\n");
    }
}

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
vector<T> makeVector(size_t a, T b) { return (vector<T>(a, b)); }
template<typename... Ts>
auto makeVector(size_t a, Ts... ts) { 
	return (vector<decltype(makeVector(ts...))>(a, makeVector(ts...)));
}

template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	if (v.size()) {
		os << v[0];
		for (int i = 1; i < v.size(); i++) os << " " << v[i];
	}
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}

void Main() {
	ll N; cin >> N;
	vll A(N); cin >> A;
	vll left(N), right(N);

	left[0] = A[0];
	for (int i = 1; i < N; i++) {
		left[i] = gcd(left[i-1], A[i]);
	}

	right[N-1] = A[N-1];
	for (int i = N-2; i >= 0; i--) {
		right[i] = gcd(right[i+1], A[i]);
	}
	
	ll maxv = 0;
	for (int i = 0; i < N; i++) {
		if (i > 0 && i < N-1) chmax(maxv, gcd(left[i-1], right[i+1]));
		else if (i == 0) chmax(maxv, right[i+1]);
		else chmax(maxv, left[i-1]);
	}
	cout << maxv << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 5580
fun main(args: Array<String>){
    val N = nextInt()
    val A = listOfInt().toLongArray()
    val B = listOfInt().toLongArray()
    var ans = 0L
    for (n in 0 until N) {
        var a = A[n]
        A[n]   = a - Math.min(A[n]  , B[n])
        a -= A[n]
        var b = A[n+1]
        A[n+1] = b - Math.min(A[n+1], B[n] - a)
        b -= A[n+1]
        ans += a + b
    }
    println(ans)
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { it.toLong() }


Measured memory_bytes: 67884
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <math.h>
 
using namespace std;
typedef long double ld;
 
int main( void ) {
 
    ld d;
    cin >> d;
 
    cout << fixed << setprecision(14) << max((ld)(floor(d)+1.0),sqrt(2.0)*d) << endl;
 
    return 0;
}
 

Measured memory_bytes: 3280
import numpy as np
N = int(input())
A = np.array([int(x) for x in input().split(' ')])

absA = abs(A)
if sum(A <= 0) % 2 == 0:
    ans = sum(absA)
else:
    ans = sum(absA) - 2 * (min(absA))

print(ans)

Measured memory_bytes: 23296
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()

int main(){
    ll x,a,b;
    cin>>x>>a>>b;
    ll p=abs(x-a);
    ll q=abs(x-b);
    if(p<q)cout<<'A'<<endl;
    else cout<<'B'<<endl;
    return 0;
}

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

#define MOD 1000000007

using namespace std;

long long int mul(long long int ans, long long int x, long long int y){
    while (y){
        if (y%2){
            ans = (ans * x) % MOD;
        }
        x = (x * x) % MOD;
        y >>= 1;
    }
    return ans;
}

long long int inv(long long int n){
    return mul(1, n, MOD-2);
}

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i=0; i<n; i++){
        cin >> a[i];
    }
    vector<int> prime(1000000, 0);
    for (int i=0; i<n; i++){
        int m = a[i];
        int count = 0;
        while (m%2 == 0){
            m /= 2;
            count++;
        }
        prime[2] = max(prime[2], count);
        for (int j=3; j*j<=m; j+=2){
            count = 0;
            while (m%j == 0){
                m /= j;
                count++;
            }
            prime[j] = max(prime[j], count);
        }
        prime[m] = max(prime[m], 1);
    }

    long long int lcm = 1;
    for (int i=2; i<prime.size(); i++){
        if (prime[i] != 0)  lcm = mul(lcm, i, prime[i]);
    }

    long long int ans = 0;
    for (int i=0; i<n; i++){
        long long m = a[i], _ans = lcm;
        int count = 0;
        while (m%2 == 0){
            m /= 2;
            count++;
        }
        _ans = mul(_ans, inv(2), count);
        for (int j=3; j*j<=m; j+=2){
            count = 0;
            while (m%j == 0){
                m /= j;
                count++;
            }
            if (count != 0)  _ans = mul(_ans, inv(j), count);
        }
        _ans = mul(_ans, inv(m), 1);
        ans += _ans;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
ll INF = 1000000000;
int main()
{
  ios::sync_with_stdio(false);  cin.tie(0); cout.tie(0);
  ll n,a,b;
  cin>>n>>a>>b;
  ll ans = 0;
//  int dist = min(n-max(a,b), min(a,b)-1);
  if(abs(a - b) %2 == 0)
    ans = abs(a-b)/2;
  else
    ans = min((a+b-1)/2, ((2*n)-a-b+1)/2);
  cout << ans << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 9)
N, M = map(int, input().split())

switches = []
for i in range(M):
    temp = list(map(int, input().split()))
    temp = [val-1 for val in temp]
    switches.append(set(temp[1:]))

ps = list(map(int, input().split()))

def dfs(s):
    if len(s) == N:
        on = set([])
        for i, num in enumerate(s):
            if num == "1":
                on.add(i)

        for switch, p in zip(switches, ps):
            common = switch & on
            if len(common) % 2 != p:
                return 0
                break
        else:
            return 1
    else:
        return dfs(s + "0") + dfs(s + "1")

ans = dfs("")
print(ans)

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

int main()
{
    //データ定義
    int height;
    int width;

    //データ取得
    cin >> height >> width;

    while(height != 0 || width != 0){

        for(int i = 0; i < height; i++){
            for(int j = 0; j < width; j++){
                if( (i + j) % 2 == 0 ){
                    cout << '#';
                }else{
                    cout << '.';
                }
             }
             cout << endl;
        }

        //データ取得
        cout << endl;
        cin >> height >> width;
    }
    return 0;
}


Measured memory_bytes: 3084
#include<iostream>
using namespace std;
#define rep(i,N) for(int i=0;i<(int)N;i++)

int main() {
	int N, A, B;
	cin >> N >> A >> B;
	int c = A * N;
	if (c <= B)cout << c << endl;
	else cout << B << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>

int main(){
	int n;
	std::cin>>n;

	std::vector<int> aList(n);
	for(int i=0; i<n; i++)
		std::cin>>aList[i];

	int decNum=0;
	bool isCorrect= true;

	for(int i=0; i<n-1; i++){
		decNum+= aList[i] - aList[i+1];

		if(decNum>=2){
			isCorrect= false;
			break;
		}

		if(aList[i] - aList[i+1] < 0)
			decNum=0;
	}

	if(isCorrect)
		std::cout<<"Yes"<<std::endl;
	else
		std::cout<<"No"<<std::endl;
}

Measured memory_bytes: 640
#include <stdio.h>

long calc(long max, long count) {
  int i;
  long mx = 0, mn = 0;
  mn = (count - 1) * count / 2;
  mx = max * count - mn;
  return max * count - (count - 1) * count + 1;
}

int main(void) {
  int n, k;
  
  scanf("%d %d", &n, &k);
  if(k > n) {
    printf("1\n");
    return 0;
  }
  int i;
  long ret = 0;
  for(i = k;i <= n + 1;i++) {
    ret += calc(n, i);
  }
  ret %= 1000000007;
  printf("%ld\n", ret);
  return 0;
}


Measured memory_bytes: 2156
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(a) (a).begin(),(a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for(ll i = 0;i < (n);i++)
#define rep2(i,n) for(ll i = 0;i < (n);i++)
#define rep3(i,a,b) for(ll i = (a);i < (b);i++)
#define rep4(i,a,b,c) for(ll i = (a);i < (b);i += (c))
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i = (n)-1;i >= 0;i--)
#define rrep2(i,n) for(ll i = (n)-1;i >= 0;i--)
#define rrep3(i,a,b) for(ll i = (a)-1;i >= (b);i--)
#define rrep4(i,a,b,c) for(ll i = (a)-1;i >= (b);i -= (c))
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin>>s;
    int ans = 0,tmp = 0;

    rep(i,s.size()){
        if(s[i] == 'R')tmp++;
        else{
            ans = max(ans,tmp);
            tmp = 0;
        }
    }
    ans = max(ans,tmp);
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3604
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<ctype.h>
#include<stack>
#include<math.h>
#include <string>
#include<algorithm>
#include<iomanip>
#define _for(i,a,b) for(int i = (a);i < (b);i++)
#define mset(x) memset(x,0,sizeof(x));
using namespace std;
const int maxp = 200005;
int r[maxp],n;
int main() {
	cin>>n;
	for(int i = 1; i <= n;i++) cin>>r[i];
	int maxn = -2000000000;
	int minn = r[1];
	for(int i = 2; i<= n;i++)
	{
		maxn=max(maxn,r[i] - minn);
		minn = min(minn,r[i]);
	}
	cout<<maxn<<endl;
	return 0;
}


Measured memory_bytes: 3860
class Solver
  def main
    h, w = gets.split.map(&:to_i)

    bs = Array.new(w, 0)
    grid = []
    h.times do
      s = gets.chomp

      found_black = false
      s.each_char.with_index do |c, i|
        if c == '#'
          # 黒マスが存在する列は1にしていく
          bs[i] = 1
          found_black = true
        end
      end

      # 黒マスが1つでもあれば、文字列全体をgridに入れていく
      if found_black
        grid << s
      end
    end

    grid.each do |s|
      s.each_char.with_index do |c, i|
        if bs[i] == 1
          print c
        end
      end
      puts
    end
  end
end

if __FILE__ == $0
  Solver.new.main
end


Measured memory_bytes: 3836
#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;
int main()
{
	int L,R,d;int count=0;
	cin>>L;cin>>R;cin>>d;
	for(int i=L;i<=R;i++)
		{
			
			if(i%d==0)
			count++;
		}
	cout<<count<<endl;
 } 

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define int long long
#define double long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define ff first
#define ss second
#define frr(i,n) for(int i=0;i<n;i++)
#define td(v) v.begin(),v.end()
#define M   1000000007 // 1e9 + 7
#define MAXN 400100
using namespace std;
typedef pair<int,int> pii;
typedef pair<int,double> pdd;
inline int mod(int n, int m){int ret = n%m; if(ret < 0) ret += m; return ret;}
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int exp(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return mod(a,m);
    int k = mod(exp(a,b/2,m),m);
    if(b&1){
        return mod(a*mod(k*k,m),m);
    }    else return mod(k*k,m);
}

int fac[2000100];

int32_t main(){
	fastio;
	int x,y;
	cin>>x>>y;
	int t1=-1;
	for(int i=0;i<=x;i++){
		// andei i do tipo 1;
		int xx = x - i;
		int yy = y - 2*i;
		int j = yy;
		if(xx - 2*j == 0){
			t1 = i;
			break;
		}
	}
	if(t1==-1){
		cout<<0<<endl;
		return 0;
	}
	
	int yy = y - 2*t1;
	int t2 = yy;
	
	//combinacao de t1 e t2;
	
	fac[0] = 1;
	for(int i=1;i<=t1+t2;i++){
		fac[i] = mod(fac[i-1]*i,M);
	}
	
	
	int res = fac[t1+t2];
	res = mod(res*exp(fac[t1],M-2,M),M);
	res = mod(res*exp(fac[t2],M-2,M),M);
	cout<<res<<endl;
	
}

Measured memory_bytes: 6400
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
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<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;
 
int main(void){
    int n;
    cin >> n;
    int r = 0;
 
    if (n >= 105) r++;
  if (n >= 135) r++;
  if (n >= 165) r++;
  if (n >= 189) r++;
  if (n >= 195) r++;
 
    
    cout << r;
}

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

int nCr(int n){
    int ans = 1;
    for (int i=n; i>n-2; i--) ans *= i;
    ans /= 2;
    return ans;
}

int main(){
    int n, m, sum=0;
    cin >> n >> m;
    sum += nCr(n);
    sum += nCr(m);
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

/* prototype declaration */
void reverse(char* str);

int main(int argc, const char *argv[])
{
	char* str;
	str = malloc(sizeof(char)*20);

	scanf("%s",str);
	reverse(str);	
	
	free(str);	
	return 0;
}

void reverse(char* str)
{
	int i, size = strlen(str);
	
	for(i=size-1; i>=0; i--){
		printf("%c", *(str+i));		
	}
	printf("\n");
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <string.h>
#include <math.h>
using namespace std;

template <class F>
int min_value(int i0, int i1, F f) {
    auto m = f(i0);
    for (int i = i0 + 1; i < i1; i++) {
        auto t = f(i);
        if (t < m) m = t;
    }
    return m;
}

int main() {
    int x, y;
    cin >> x >> y;

    auto r = min_value(0, 4, [&](int i) -> unsigned int {
        int tx = x, ty = y;
        int k = 0;
        if (i & 1) tx *= -1, k++;
        if (i & 2) ty *= -1, k++;
        return tx > ty ? -1 : ty - tx + k;
    });

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 256
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int n,k;
  cin >> n >> k;
  double ans = 0;
  for(int i = 1; i <= n ; i++)
  {
    int s = i;
    int j;
    for(j = 0; s < k; j++ )
    {
      s *= 2;
    }
    ans += (1.0 / (double)n) / pow(2,j); 
  }

  cout << setprecision(12) << ans;  

  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}

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

using namespace std;

int main()
{
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    
    int ans = 0;
    for(int i = 1; i < N; ++i){
        if(S[i-1] == S[i]){ ans++; }
    }
    ans += K * 2;
    ans = min(ans, N - 1);
    
    cout << ans << endl;
}

Measured memory_bytes: 512
fun main(args:Array<String>) {
  val (n, m) = readLine()!!.split(" ").map(String::toInt)
  val a1 = (1..m).map { 2 }.reduce { y, x -> y*x } 
  val a2 = (n - m)*100
  println((1900*m + a2)*a1)
  //println(a1)
}

Measured memory_bytes: 37904
#include "bits/stdc++.h"
using namespace std;
#define int long long

int n, m;
signed main() {
	cin >> n >> m;
	vector<int> a(n);
	vector<pair<int, int> > pairs(n);
	vector<int> b(n);
	for (size_t i = 0; i < n; i++)
	{
		cin >> a[i];
		cin >> b[i];
		pairs[i] = make_pair(a[i], b[i]);
	}

	sort(pairs.begin(), pairs.end());
	int yen = 0;
	int cnt = 0;

	for (size_t i = 0; i < m; i++)
	{
		yen += pairs[cnt].first;
		pairs[cnt].second--;
		if (pairs[cnt].second == 0) cnt++;
	}
	cout << yen << endl;
}




Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;

int main(){
    int s[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;cin>>k;
    k--;
    cout<<s[k]<<endl;
}

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

using namespace std;

int main()
{
    int N,W;
    cin >>N>>W;
    vector<long> v(N);
    vector<long> w(N);

    for(int i=0;i<N;i++)
    {
        cin>> w[i] >>v[i]; 
    }

    vector<vector<long>> dp(N+1,vector<long>(W+1,0)); 
    for(int i=0;i<=N;i++)
    {
        for(int j=0;j<=W;j++)
        {
            if( i==0 || j==0) 
                dp[i][j]=0; 
            else if(w[i-1] <=j)
            {
               //cout<<"maybe add item "<<i<<endl; 
                dp[i][j]= max(v[i-1]+dp[i-1][j-w[i-1]],dp[i-1][j]); 
            }
            else
                dp[i][j] = dp[i-1][j]; 
        }

    }
    cout<<dp[N][W]<<endl; 
    return 0; 
}


Measured memory_bytes: 80256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[105];
int main(){
    int n,tag=0;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=1;i<=n;i++){
        if(a[i]%2==1) continue;
        if(a[i]%3!=0&&a[i]%5!=0){
            tag=1;break;
        }
    }
    if(!tag) cout<<"APPROVED"<<endl;
    else cout<<"DENIED"<<endl;
}

Measured memory_bytes: 256