akhauriyash/Code-Regression huggingface dataset:
import sys


def input():
    return sys.stdin.readline().strip()
# sys.setrecursionlimit(100000)


def main():
    n, h = [int(i) for i in input().strip().split()]
    attack = []
    throw = []
    for _ in range(n):
        a, t = [int(i) for i in input().strip().split()]
        attack.append(a)
        throw.append(t)

    a_max = max(attack)
    throw = sorted(throw)[::-1]
    cnt = 0
    for t in throw:
        if t > a_max:
            h -= t
            cnt += 1
        elif t <= a_max:
            break
        if h <= 0:
            print(cnt)
            return
    if h > 0:
        cnt += h // a_max
        if h % a_max > 0:
            cnt += 1
    print(cnt)

    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 83936
#include <stdio.h> 
 #include <ctype.h> 
 
 
 int main(){ 
     char ch; 
     while(1){ 
         scanf("%c", &ch); 
         if(ch=='\n'){ 
             printf("\n"); 
             break; 
         }else if(islower(ch)){ 
             printf("%c", toupper(ch)); 
         }else if(isupper(ch)){ 
             printf("%c", tolower(ch)); 
         }else{ 
             printf("%c", ch); 
         } 
     } 
 
 
     return 0; 
 } 



Measured memory_bytes: 2048
package main

import (
	"bufio"
	"container/list"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := newInputScanner(true, 512*1024)
	S := sc.nextStr()
	Q := sc.nextInt()
	answer := list.New()
	for _, r := range S {
		answer.PushBack(r)
	}
	var T, F int
	var C rune
	var flipped bool
	for i := 0; i < Q; i++ {
		switch T = sc.nextInt(); T {
		case 1:
			flipped = !flipped
		case 2:
			F, C = sc.nextInt(), []rune(sc.nextStr())[0]
			if flipped {
				F = 3 - F // 1 -> 2, 2 -> 1
			}
			switch F {
			case 1:
				answer.PushFront(C)
			case 2:
				answer.PushBack(C)
			}
		}
	}
	if flipped {
		for e := answer.Back(); e != nil; e = e.Prev() {
			fmt.Print(string(e.Value.(rune)))
		}
	} else {
		for e := answer.Front(); e != nil; e = e.Next() {
			fmt.Print(string(e.Value.(rune)))
		}
	}
	fmt.Println()
}

type inputScanner struct {
	*bufio.Scanner
}

func newInputScanner(enabledScanWords bool, sizeInKB int) *inputScanner {
	scanner := bufio.NewScanner(os.Stdin)
	if enabledScanWords {
		scanner.Split(bufio.ScanWords)
	}
	capacity := sizeInKB * 1024
	buf := make([]byte, capacity)
	scanner.Buffer(buf, capacity)
	return &inputScanner{
		Scanner: scanner,
	}
}

func (inputSc *inputScanner) nextInt() int {
	i, e := strconv.Atoi(inputSc.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (inputSc *inputScanner) nextUInt64() uint64 {
	i, e := strconv.ParseUint(inputSc.nextStr(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func (inputSc *inputScanner) nextStr() string {
	inputSc.Scan()
	return inputSc.Text()
}


Measured memory_bytes: 42112
N=int(input())
A=[int(input()) for i in range(N)]

A.sort()

k1=[]
if N%2==1:
    k1.extend([1,1])
    k1.extend([-2]*(N//2))
    k1.extend([2]*(N-N//2-2))
    k1.sort()
    sum1=0
    sum2=0
    for i in range(N):
        sum1+=A[i]*k1[i]
        sum2+=(-1)*A[i]*k1[-1-i]
    print(max(sum1,sum2))
else:
    k1.extend([-1,1])
    k1.extend([-2]*((N-2)//2))
    k1.extend([2]*((N-2)//2))
    k1.sort()
    sum1=0
    sum2=0
    for i in range(N):
        sum1+=A[i]*k1[i]
        sum2+=(-1)*A[i]*k1[-1-i]
    print(max(sum1,sum2))

Measured memory_bytes: 8160
K, N = list(map(int, input().split()))
a = list(map(int, input().split()))
a = list(sorted(a))
s = []
for i in range(1, N):
    s.append(a[i] - a[i-1])
s.append(K - a[-1] + a[0])
print(K - max(s))


Measured memory_bytes: 26444
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(a, b, c) for(ll c=a;c<b;c++)
#define re(b, c) for(ll c=0;c<b;c++)
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n, q;
  string s;
  std::cin >> n; std::cin >> s; std::cin >> q;
  re(q,i){
    ll t, ans=0, a=0, b=0, c=0;std::cin >> t;
    re(t, j){
      if(s[j]=='D') a++;
      if(s[j]=='M') b+=a, c++;
      if(s[j]=='C') ans+=b;
    }
    //std::cout << ans << '\n';
    rep(t, n, j){
      if(s[j-t]=='D') a--, b-=c;
      if(s[j-t]=='M') c--;
      if(s[j]=='D') a++;
      if(s[j]=='M') b+=a, c++;
      if(s[j]=='C') ans+=b;
    }
    std::cout << ans << '\n';
  }
  return 0;
}


Measured memory_bytes: 2040
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, n) for(int i = 1; i <= (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=pow(10,18);
const double inf=pow(10,10);
const ld pi=acosl(1);
const ll mod = 1000000007;
const ll dx[4]={0,0,1,-1};
const ll dy[4]={-1,1,0,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};

ll count(string s){
  reverse(all(s));
  ll count=0;
  rep(i,s.size()){
    if(s[i]=='0')count++;
    else return count;
  }
  return count;
}

template<class T>
T gcd(T a,T b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(a%b,b);
}
template<class T>
T lcm(T a,T b){
    return a/gcd(a,b)*b;
}

bool solve(){
  ll n,m;cin>>n>>m;
  string s,t;cin>>s>>t;
  ll ans=lcm(s.size(),t.size());
  ll index=0;
  map<ll,char>mp;
  rep(i,s.size()){
    mp[index]=s[i];
    // cout<<index<<endl;
    index+=ans/s.size();
  }
  index=0;
  rep(i,t.size()){
    if(mp[index]!=0 and mp[index]!=t[i]){
      cout<<-1<<endl;return false;
    }
    // cout<<index<<endl;
    index+=ans/t.size();
    // cout<<ans/t.size()<<endl;
  }
  cout<<ans<<endl;
  return false;
}

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout<<fixed;
  return solve();
}


Measured memory_bytes: 10880
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pl = pair<ll, ll>;
int n,k;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n >> k;
    if(k > (n-1)*(n-2)/2)
    {
        cout << -1;
        return 0;
    }
    cout << n*(n-1)/2 - k << '\n';
    k = n*(n-1)/2 - k;
    for(int i=1;i<n;i++)
    {
        cout << i << ' ' << n << '\n';
        k--;
    }
    for(int i=1;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            if(!k) return 0;
            cout << i << ' ' << j << '\n';
            k--;
        }
    }
}

Measured memory_bytes: 256
n, m = map(int, input().split())
height = [int(i) for i in input().split()]
neighbors = {}
for _ in range(m):
  a, b = map(int, input().split())
  if a not in neighbors:
    neighbors.update({a:set()})
  if b not in neighbors[a]:
    neighbors[a].add(b)
  if b not in neighbors:
    neighbors.update({b:set()})
  if a not in neighbors[b]:
    neighbors[b].add(a)
#print(neighbors)
#print(height)
count = 0
visited = set()
for std, s in neighbors.items():
  flag = True
  visited.add(std)
  height_std = height[std - 1]
  for each in s:
    h = height[each - 1]
    if height_std <= h:
      flag = False
      break
  if flag:
    count += 1
#print(visited)
for i in range(n):
  if i + 1 not in visited:
    count += 1
print(count)

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

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a==b&&a!=c&&b!=c)
    cout<<"Yes"<<endl;
  else if(a==c&&a!=b&&c!=b)
    cout<<"Yes"<<endl;
  else if(b==c&&b!=a&&c!=a)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  return 0;
}
  

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

#define ms(a,b) memset(a, b, sizeof(a))
#define rep(a,b,c) for(int a = (int)(b); a < (int)(c); a++)
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define m_p(a,b) make_pair(a, b)
#define lson l,mid,o << 1
#define rson mid + 1,r,o << 1 | 1
#define ls o << 1
#define rs o << 1 | 1
#define inf 0x3f3f3f3f

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;

inline bool isdigit(char& ch) {
	return ch >= '0' && ch <= '9';
}
template<class T>
void read(T &x) {
	x = 0;
	ll f = 1;char ch = getchar();
	for (;!isdigit(ch);ch = getchar()) 
		if (ch == '-') f = -1;
	for (; isdigit(ch);ch = getchar())
		x = (x << 1) + (x << 3) + ch - '0';
	x *= f;
}
template<class T>
inline void write(T x) {
	if (x == 0) {putchar('0');return ;}
	if (x < 0) {putchar('-');x = -x;}
	int _stk[65],_top = 0;
	for (;x;x /= 10) _stk[++_top] = x % 10 + 48;
	for (;_top;_top--)putchar(_stk[_top]);
}

const int MAXN = 2e5 + 10;

int arr[MAXN];
int n;
bool use[MAXN * 10];
int cnt[MAXN * 10];
int main () {
	
	read(n);
	rep(i, 1, n + 1) {
		read(arr[i]);
		cnt[arr[i]]++;
	}

	sort(arr + 1, arr + 1 + n);
	ll ans = 0;
	rep(i, 1, n + 1) {
		if (!use[arr[i]]) {
			if (cnt[arr[i]] <= 1)
				ans++;
			for (int j = arr[i] * 2 ; j <= arr[n]; j += arr[i])
				use[j] = 1;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 9192
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;
#define downque(que)  priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;


int main(){
  string s,res="" ; cin>>s;
  int n=s.size();

 REP(i,n){
    if(s[i]=='B'){

    if(res.size()>0)
    res.erase(res.size()-1);
    
    }else if (s[i]=='0')res+='0';
    else if (s[i]=='1')res+='1';

    
  }
   cout<<res<<endl;
}


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

#define MAX 2002


int n;
int k;


#define MOD 1000000007

long long int ppow(long long int i, long long int j){
	long long int res = 1;
	while(j){
		if ((j & 1LL)){
			res *= i;
			if (res >= MOD){
				res %= MOD;
			}
		}
		i *= i;
		if (i >= MOD){
			i %= MOD;
		}
		j >>= 1LL;
	}
	return res;
}

long long int dp[MAX][MAX];


int main(){
	cin >> n >> k;
	for (int i = 1; i <= n; i++){
		long long int sum = 0;
		for (int j = n; j >= 1; j--){
			if (i == 1){
				//begin
				dp[i][j] = 1;
			}
			else{
				//not update
				long long int val = dp[i - 1][j];
				if(n-j+1-(i-1))dp[i][j] += val;
				dp[i][j] %= MOD;
				//update
				dp[i][j] += sum;
				dp[i][j] %= MOD;
			}
			sum += dp[i - 1][j];
		}
	}
	long long int ans = 0;
	for (int i = 2; i <= n; i++){
		ans += dp[k - 1][i] * ppow(2, max(0,n - k-1));
		ans %= MOD;
	}
	if (k == 1){
		ans = ppow(2, max(0, n - k - 1));
	}
	printf("%lld\n", ans);
	return 0;
}

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

using namespace std;

using ll = long long;
constexpr ll MOD = 1e9 + 7;
constexpr ll INF = 1e18;

int main() {
    ll n, m, i, j, k;
    cin >> n;
    ll a,b;
    cin >> a >> b;
    cout << n/(a+b)*a+min(n%(a+b),a) << endl;
    return 0;
}

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

namespace Algorithm
{
    class Program
    {
        const int Mod = 1000000007;
        static int n;
        static char[] s = new char[100005];
        static long[,] dp = new long [100005, 13];
        static void Main(string[] args)
        {
            int i, j, k;
            var res = 0L;

            s = Console.ReadLine().ToCharArray();
            n = s.Length;

            dp[0, 0] = 1;
            for (i = 0; i < n; i++)
            {
                var c = 0;
                if (s[i] == '?') c = -1;
                else c = s[i] - '0';
                for (j = 0; j < 10; j++)
                {
                    if (c != -1 && c != j) continue;
                    for (var ki = 0; ki < 13; ki++)
                    {
                        dp[i+1, (ki*10+j)%13] += dp[i, ki];
                    }
                }
                for (j = 0; j < 13; j++) dp[i + 1, j] %= Mod;
            }
            res = dp[n, 5];

            Console.WriteLine(res);
        }
    }
}


Measured memory_bytes: 22100
#include <bits/stdc++.h>  // ver1.9.1
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define mp make_pair
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  cout << fixed << setprecision(15);
  Vi a(3),b(3),r(4);
  r = {1,2,3,4};
  rep(i,0,3) cin >> a[i] >> b[i];
  bool ok=false;
  
  do {
    
    bool ok2;
    rep(i,0,3){
      
      ok2=false;
      
      rep(j,0,3){
        if(r[i]==a[j]&&r[i+1]==b[j]) ok2=true;
        if(r[i]==b[j]&&r[i+1]==a[j]) ok2=true;
      }
      if(!ok2) break;
      if(i==2) ok = true;
    }
    
  } while (next_permutation(ALL(r)));
  
  if(ok) cYES;
  else cNO;
  return 0;
}


Measured memory_bytes: 256
import std.stdio;
import std.algorithm;
import std.string;
import std.range;
import std.array;
import std.conv;
import std.complex;
import std.math;
import std.ascii;
import std.bigint;
import std.container;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

const real eps = 1e-10;

void main(){
	while(true) {
		auto l = readInts();
		auto a0 = l[0];
		auto L = l[1];
		if(a0 == 0 && L == 0){
			return;
		}
		auto s = a0.to!string.rightJustify(L,'0');
		int[string] h;
		int i;
		while((s in h) is null) {
			h[s] = i;
			++i;
			auto nMax = s.dup.sort.reverse.to!int;
			auto nMin = s.dup.sort.to!int;
			s = (nMax-nMin).to!string.rightJustify(L,'0');
		}
		writeln(h[s], " ", s.to!int, " ", i-h[s]);
	}
}

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<string> Vs;

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;}
template<class T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void uniq(vector<int> &vec){sort(vec.begin(), vec.end());vec.erase(unique(vec.begin(), vec.end()), vec.end());}
void start(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);}

signed main(){start();
    int n,x,ans=1;
    cin>>n>>x;
    Vi l(n),a(n+1);
    REP(i,0,n) cin>>l[i];
    a[0]=0;
    REP(i,1,n+1){
        a[i]=a[i-1]+l[i-1];
        if(a[i]<=x) ans++;
        else break;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_variables)]

fn main() {
    let (N, x): (usize, usize) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };

    // x == 1, 2N - 1 ならばNo
    // そうでなければ中央付近にxが2個現れるように順列を作ればよい
    let ans = if x == 1 || x == 2 * N - 1 {
        "No".to_string()
    } else if x == 2 {
        format!(
            "Yes\n{}",
            (1..(2 * N)).map(|i|
                if i <= N {
                    (N - i + 1).to_string()
                } else {
                    i.to_string()
                }
            )
            .collect::<Vec<_>>()
            .join("\n")
        )
    } else {
        let mut p = vec![0; 2 * N - 1];
        let mut k = 0;
        for i in 0..(2 * N - 1) {
            if i == N - 3 {
                p[i] = x - 2;
            } else if i == N - 2 {
                p[i] = x + 1;
            } else if i == N - 1 {
                p[i] = x;
            } else if i == N {
                p[i] = x - 1;
            } else {
                k += 1;
                if x - 2 <= k && k <= x + 1 {
                    k = x + 2;
                }
                p[i] = k;
            }
        }
        format!(
            "Yes\n{}",
            p.iter()
                .map(std::string::ToString::to_string)
                .collect::<Vec<_>>()
                .join("\n")
        )
    };
    println!("{}", ans);
}


Measured memory_bytes: 16636
#include<bits/stdc++.h>				//Written by ThiDaiLoc
using namespace std;				//Team Three Wolves
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pll;
#define fu(i,a,b)   for(ll i=a;i<b;i++)
#define fd(i,b,a)   for(ll i=b;i>=a;i--)
#define ms(a,x) 	memset(a, x, sizeof a)
#define prec(n) 	fixed<<setprecision(n)
#define pb(i)	    push_back(i)
#define popb()    	pop_back()
#define sc(a) 	    cin>>a
#define sc2(a,b)    cin>>a>>b
#define pr(a)	    cout<<a<<" "
#define pr2(a,b)    cout<<a<<" "<<b<<" "
#define lowb(a,n,x) lower_bound(a,a+n,x) -a
#define lowb2(a,x)	lower_bound(a.begin(),a.end(),x) -a.begin()
#define all(x) 		(x).begin(), (x).end()
#define sz(a) 		(ll)a.size()
#define le			length()						
#define re 			return 	
#define	mp(a,b)  	make_pair(a,b)
#define se			second
#define fi			first 
#define debug(x)    cerr << #x << " = " << x << endl
#define INPUT       freopen("locin.txt", "r", stdin)
#define OUTPUT      freopen("locout.txt", "w", stdout)
void inline minize(ll& a,ll b){a=(a>b?b:a);};
void inline maxize(ll& a,ll b){a=(a<b?b:a);};
double const eps = 1e-6;
ll const Base=1e9+7,oo=1e17;


ll arr[1000000],mark[1000000],fac[100005];

ll Solves(){
	//INPUT;
	ll n,m,k,cnt=0,ans=0,x;
	// PROCESSING IN HERE
	sc2(n,m);
	if(abs(n-m)>=2)re cout<<0,0;
	fac[0]=1;
	fu(i,1,1e5+3)fac[i]=(fac[i-1]*i)%Base;
	
	if(n==m){
		cout<<(fac[n]*fac[n]*2)%Base;
	}
	else{
		cout<<fac[n]*fac[m]%Base;
	}
	
	
	re 0;
	// Hack it if you can :)
}
int main(){
	
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	Solves();
}

Measured memory_bytes: 1024
fun main(args: Array<String>)
{
    val r = readInt()

    println(3 * r *r)

}


// Read an integer
// Usage: val a = readInt()
private fun readInt() = readLine()!!.toInt()

// Read N integers separated by " "
// Usage: val (a, b, c) = readNInts()
private fun readNInts() = readLine()!!.split(" ").map(String::toInt)

// Read a string
// Usage: val a = readString()
private fun readString() = readLine()!!


Measured memory_bytes: 31764
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vl vaector<long>
#define vll vector<long long int>
#define vC  vector<char>
#define FastIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
ll pow(ll x, ll y,ll m) { ll res = 1;x=x%m; while (y > 0) { if (y & 1) res = ((res%m) * (x%m))%m; y = y >> 1; x = ((x%m) * (x%m))%m; } return res%m; }
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
const ll INF = 0xFFFFFFFFFFFFFFFL;
clock_t time_p=clock();
void abhigyan10()
{time_p=clock()-time_p;cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";}
ll seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline ll rnd(ll l=0,ll r=INF){return uniform_int_distribution<ll>(l,r)(rng);}
#define clrbuf cin.ignore(numeric_limits<streamsize>::max(),'\n');
#define preciset(x) cout<<setprecision(x)<<fixed;
const ll mod =1000000007;
int main()
{
   
        FastIO
        int n,count=0,i,j;
        cin>>n;
        string s;
        string c="ABC";
        cin>>s;
        for(i=0;i<n-2;i++)
        {
        	string z="";
        	for(j=0;j<=2;j++)
        	{
        		z+=s[i+j];
        	}
        	if(z==c)
        		count++;
        }
        cout<<count;
        return 0;
    }

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int h[110];
    rep(i, N) cin >> h[i];
    int ans = 0;
    rep(i, N) ans += h[i];
    rep(i, N - 1) {
        int c = min(h[i], h[i + 1]);
        ans -= min(h[i], h[i + 1]);
        // h[i] -= c;
        // h[i + 1] -= c;
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){ 
int n;
cin >> n;
  set<int> a;
  for(int i=0;i<n;i++) a.insert(i+1);
  int k;
  cin >> k;
  while(k--){
    int temp,temp2;
    cin >> temp;
    for(int i=0;i<temp;i++){
      cin >> temp2;
      if(a.find(temp2)!=a.end())
        a.erase(temp2);
    }
    
  }
  cout << a.size() << endl;
  
}

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

int main() {
	double_t w, h, x, y;
	cin >> w >> h >> x >> y;
	cout << w * h / 2 << " ";
	if (w / 2 == x && h / 2 == y)cout << 1 << endl;
	else cout << 0 << endl;
}

Measured memory_bytes: 256
import numpy as np
N,M,C = map(int,input().split())
B_s = np.array(list(map(int,input().split())))
A_s = []
for _ in range(N):
  A_s.append(list(map(int,input().split())))
A_s = np.array(A_s)

print(int(np.sum(np.where((np.dot(A_s,B_s)+C)>0,1,0))))


Measured memory_bytes: 12472
/**
 * Grading.cpp
 * Create:20180424
 * Description:入力された点数から成績をつけるプログラム。
 */
#include <iostream>
#include <vector>

class Grad{
private:
  int middle_point;
  int final_point;
  int retry_point;
public:
  /**
   * 試験結果
   * @param middle_point 中間試験点数
   * @param final_point  期末試験点数
   * @param retry_point  再試験点数
   */
  Grad(int middle_point, int final_point, int retry_point){
    this->middle_point = middle_point;
    this->final_point = final_point;
    this->retry_point = retry_point;
  }

  /**
   * 成績判定関数
   * @return 試験結果
   */
  std::string judge(){
    // 中間・期末試験いずれか欠席
    if (-1 == middle_point || -1 == final_point)
      return "F";

    int result_point = middle_point + final_point;
    if (80 <= result_point){
      // 中間・期末試験の合計が80点以上
      return "A";
    } else if (65 <= result_point){
      // 80点未満65点以上
      return "B";
    } else if (50 <= result_point){
      // 65点未満50点以上
      return "C";
    } else if (30 <= result_point){
      // 50点未満30点以上
      // ただし、再試験で50点以上はC
      if (50 <= retry_point){
        return "C";
      }
      return "D";
    } else {
      // それ以外はF
      return "F";
    }
  }
};

int main(int argc, char* argv[]){
  int m, f, r;
  std::vector<Grad> vec;

  while (true){
    std::cin >> m >> f >> r;
    if (-1 == m && -1 == f && -1 == r){
      break;
    }
    Grad g = Grad(m, f, r);
    vec.push_back(g);
  }

  for(Grad g:vec){
    std::cout << g.judge() << std::endl;
  }

  return 0;
}


Measured memory_bytes: 3136
import sys
import time
import math
import itertools as it
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()
# ------------------------------

N, M = inpl()
H = inpl()
dp = [True] * N
for _ in range(M):
    A, B = inpl()
    if H[A-1] > H[B-1]:
        dp[B-1] = False
    elif H[A-1] < H[B-1]:
        dp[A-1] = False
    else:
        dp[A-1] = False
        dp[B-1] = False
ans = 0
for i in dp:
    if i:
        ans += 1
print(ans)

# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)


Measured memory_bytes: 20108
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <sstream>
#include <climits>
 
using namespace std;

vector<string> vec_splitter(string s) {
  s += ',';
  vector<string> res;
  while(!s.empty()) {
    res.push_back(s.substr(0, s.find(',')));
    s = s.substr(s.find(',') + 1);
  }
  return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx,
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
  if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
  stringstream ss; ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, LINE_NUM, T...);
}

#ifndef ONLINE_JUDGE
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
 
#define MOD 1000000007
#define A first
#define B second
#define all(x) (x).begin(), (x).end

typedef long long ll;
 
inline int mulmd(ll a, ll b){
  ll ret = (a * b) % MOD;
  return (int) ret;
}
 
inline int power(ll x, ll y, int m){
  ll res = 1;
  x = x % m;
  while(y > 0){
    if(y & 1){
      res = mulmd(res, x);
    }
    y = y >> 1;
    x = mulmd(x, x);
  }
  return (int) res;
}
 
inline int submd(ll a, ll b){
  ll ret = (a - b);
  if(ret < 0) ret += MOD;
  return (int) ret;
}
 
inline int addmd(ll a, ll b){
  ll ret = (a + b) % MOD;
  return (int) ret;
}
 
inline int invPow(ll a){
  return power(a, MOD - 2, MOD);
}
 
inline int divmd(ll a, ll b){
  ll ret = mulmd(a, invPow(b));
  return (int) ret;
}
 
const int N = 1e5 + 5;

int arr[N];
int dp[N];

void solve(){
  int n, k;
  cin >> n >> k;
  for(int i = 0; i < n; i++) cin >> arr[i];
  dp[0] = 0;
  for(int i = 1; i < n; i++){
    dp[i] = INT_MAX;
    for(int j = i - 1; j >= max(i - k, 0); j--){
      dp[i] = min(dp[i], dp[j] + abs(arr[i] - arr[j]));
    }
  }
  cout << dp[n - 1];

}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  t = 1;
  //cin >> t;
  while(t--){
    solve();
  }
}



Measured memory_bytes: 4396
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<map>
#include<set>
#include<queue>

using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(a) (a).begin(),(a).end()
#define PI 3.141592653589793238
#define INF 1050000000
#define INFL (long long)(4e18)

using vi = vector<int>;

template<class T>
struct Edge {
    int to;
    T cost;
    Edge() {};
    Edge(int to, T cost) : to(to), cost(cost) {};
};

template<class T>
class Graph {
    int n;
    bool directed;
    vector<vector<Edge<T>>> edges;
public:

    Graph(int n, bool directed) :n(n), directed(directed), edges(vector<vector<Edge<T>>>(n)){};
    Graph() {};

    void add(int from,int to, T cost) {
        edges[from].emplace_back(to, cost);
        if(!directed){
            edges[to].emplace_back(from,cost);
        }
    }

    int size() {
        return n;
    }
};


int main() {

    int N;

    cin >> N;

    vi P(N);

    REP(i,N)cin >> P[i];

    int mi = INF;
    int ans = 0;

    REP(i,N){
        if(mi >= P[i]){
            ans++;
            mi = P[i];
        }
    }

    cout << ans << endl;



    return 0;
}

Measured memory_bytes: 1024
a = []
for i in range(3):
    a.append(list(map(int, input().split())))
n = int(input())

flag_hit = [[False,False,False],
            [False,False,False],
            [False,False,False]]

for i in range(n):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if a[j][k] == b:
                flag_hit[j][k] = True

flag_bingo = False
for i in range(3):
    if (flag_hit[i][0] is True) and (flag_hit[i][1] is True) and (flag_hit[i][2] is True):
        flag_bingo = True
    if (flag_hit[0][i] is True) and (flag_hit[1][i] is True) and (flag_hit[2][i] is True):
        flag_bingo = True
    if (flag_hit[0][0] is True) and (flag_hit[1][1] is True) and (flag_hit[2][2] is True):
        flag_bingo = True
    if (flag_hit[0][2] is True) and (flag_hit[1][1] is True) and (flag_hit[2][0] is True):
        flag_bingo = True

if flag_bingo is True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
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 $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")
    };
}

fn main() {

    input!{
        n: i32,
        h: i32,
        w: i32,
    }
    println!("{}", (n-h+1)*(n-w+1));
}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
bool cmp(char a,char b){
	return a>b;	
}
int main()
{
	string s,t;
	cin>>s;
	cin>>t;
	
	sort(s.begin(),s.end());
	sort(t.begin(),t.end(),cmp);
	if(s<t)
	   cout<<"Yes";
	else
       cout<<"No";
       
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

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

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int H, W;
  string s[50];
  cin >> H >> W;
  for (int i = 0; i < H; i++) {
    cin >> s[i];
  }
  bool yes = true;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (s[i][j] == '.') continue;
      bool flag = false;
      for (int k = 0; k < 4; k++) {
        int ny = i + dy[k];
        int nx = j + dx[k];
        if (ny >= 0 && ny < H && nx >= 0 && nx < W) {
          flag |= s[ny][nx] == '#';
        }
      }
      yes &= flag;
    }
  }
  cout << (yes ? "Yes" : "No") << endl;

  return 0;
}

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

using namespace std;

int main(){
    long long q, h, s, d;
    long long n;
    scanf("%lld%lld%lld%lld",&q,&h,&s,&d);
    scanf("%lld",&n);
    h = min(2*q,h);
    s = min(2*h,s);
    d = min(2*s,d);
    printf("%lld\n",n/2*d+n%2*s);

    
    
    
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
  int n, m;
  cin >> n >> m;
  vector<int> left;
  vector<int> right;
  int l, r;
  for (int i = 0; i < m; i++){
    cin >> l >> r;
    left.push_back(l);
    right.push_back(r);
  }
  
  int max_l = *max_element(left.begin(), left.end());
  int min_r = *min_element(right.begin(), right.end());
  if (max_l <= min_r){
    cout << min_r - max_l + 1 << endl;
  }else{
    cout << 0 << endl;
  }
}

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

#define MP make_pair
#define FF first
#define SS second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pie;
const int MOD = 1e9 + 7;

int n;

int main() {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n;
	cout << n * (n - 1) / 2 - n / 2 << endl;
	for (int i = 1; i < n; i++)
		for (int j = i + 1; j <= n; j++)
			if (i + j != n + 1 - n % 2)
				cout << i << ' ' << j << endl;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>

using namespace std;
int a[200000];
int b[200000];
int main(){
    int T;
    int j,l,i;
    int temp;
    int flag;
    cin>>T;
    for(int i = 0;i < T;i++){
        cin>>a[i];
    }
    b[T/2] = a[0];
    if(T%2) flag=1;//基数放后面
    else flag=-1;//放前面
    int n=1;
    int m=0;
    for(int i = 1;i < T;i++){
        if(flag==1){b[T/2+n]=a[i];
            m++;
        }
        if(flag==-1){b[T/2-n]=a[i];
            m++;
        }
        if(m==2){
            n++;
            m=0;
        }
        flag *= -1;
    }

    for(int i = 0;i < T;i++){
        if(i==0)cout<<b[i];
        else cout<<" "<<b[i];
    }
    return 0;
}

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

int main(){
	int n,a[100];
	int exchanges=0;
	
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	
	for(int i=0;i<n;i++){
		int minIndex = i;
		for(int j=i;j<n;j++){
			if(a[j]<a[minIndex]){
				minIndex=j;
			}
		}
		if(minIndex!=i){
			int tmp;
			tmp=a[i];
			a[i]=a[minIndex];
			a[minIndex]=tmp;
			exchanges++;
		}
	}
	for(int i=0;i<n;i++){
		if(i>0) cout<<" ";
		cout<<a[i];
	}
	cout<<endl;
	cout<<exchanges<<endl;
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define RFOR(i,a,b) for(int i = (int)(b-1);i>=(int)(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(20);

  int a, b, n;
  cin >> a >> b >> n;

  int x = min(b - 1, n);
  cout << (a * x) / b - a * (x / b) << endl;

  return 0;
}

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

int main()
{
    string s;
    cin >> s;
    int count = 0;
    for (size_t i = 0; i < 3; i++)
    {
        if (s[i] == '1')
        {
            count++;
        }
    }

    std::cout << count << std::endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {

	int h, w;
	while (1) {
		cin >> h >> w;

		if (h == 0 && w == 0)break;
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (i == 0 || i == h-1) {
					cout << "#";
				}
				else {
					if (j == 0 || j == w - 1) {
						cout << "#";
					}
					else {
						cout << ".";
					}
				}
			}
			cout << endl;
		}
		cout << endl;
	}

	return 0;

}


Measured memory_bytes: 3104
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define MUL(A,B,C)	(max(A*C, B*C))
int main(){
	ll a[4];
	for(int i=0; i<4; i++)  scanf("%lld", &a[i]);
	printf("%lld\n", max(MUL(a[0],a[1],a[2]), MUL(a[0],a[1],a[3])));
}

Measured memory_bytes: 3772
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	int i,j,k,f=1,l;
	string s;
	cin >> s;
	l=s.size()-2;
	while(l){
        f=1;
		for(i=0;i<l/2;i++){
			if(s[i]!=s[l/2+i]){
				f=0;
				break;
			}
		}
		if(f){
			cout << l << endl;
			break;
		}
		l-=2;
	}
	return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class ERotationMatching {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int N, M;
        cin >> N >> M;

        int l = 1;
        int r = N;
        int cl = N / 2;
        int cr = cl + 2;
        REP(i, M) {
            if (i % 2 == 0) {
                cout << l << " " << r << endl;
                l++, r--;
            } else {
                cout << cl << " " << cr << endl;
                cl--, cr++;
            }
        }
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    ERotationMatching solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
#define N 10001 
#define Q 501

int Same(){
	int array1[N];
	int array2[Q];
	int sum = 0;
	int m;
	int n;
	cin >> m;
	for(int i=0; i<m; ++i){
		cin >> array1[i];
	}
	cin >> n;
	for(int i=0; i<n; ++i){
		cin >> array2[i];

	}
	for(int i=0; i<m; ++i){
		for(int j=0; j<n; ++j){
			if(array1[i] == array2[j]){
				++sum;
				break;
			}
		}
	}
	return sum;
}

int main(){
	//cout << Same() << endl;
	 int n[N];
  int q[Q];
 
  int num,num2,i,j,count=0;
 
  cin >>num;
 
  for(i=0;i<num;i++){
    cin >>n[i];
  }
 
  cin >>num2;
  for(i=0;i<num2;i++){
    cin >>q[i];
  }
 
  for(i=0;i<num2;i++){
    for(j=0;j<num;j++){
      if(q[i]==n[j]){
    count++;
    break;
      }
    }
  }
 
  cout <<count<<endl;
	return 0;
}

Measured memory_bytes: 1200
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <map>

#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  int A, B ,T; cin >> A >> B >> T;
  int result = B*(T/A);
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cstring>
#include <map>
using namespace std;

int main()
{
    int a[4], k;
    cin >> a[0] >> a[1] >> a[2] >> k;
    sort(a, a + 3);
    int m = 2;
    for (int i = 0; i < k; i++)
        a[2] *= 2;
    printf("%d\n", a[0] + a[1] + a[2]);

   
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i, a, b) for (int i = a; i < b; i++)
typedef pair<ll,ll> pi;
typedef vector<ll> vi;
string s, t;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> s >> t;
	int ans = 0;
	for (int i = 0; i < s.length(); i++){
		if (s[i] != t[i]){
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3804
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
using namespace std;
 
int main(){
    int n;
    string s;
    cin>>n>>s;
    rep(i,s.size()){
        if((int)(s.at(i)+n)>=91) cout<<(char)(s.at(i)+n-26);
        else cout<<(char)(s.at(i)+n);
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
N,P = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)

kisu = a.count{|v| v.odd?}
gusu = a.count{|v| v.even?}

def comb (n, k)
  return 1 if k == 0
  return ((n-k+1)..n).inject(&:*)/(1..k).inject(&:*)
end

ans = 0
if P == 0
  (0..gusu).each do |i|
    cnt = comb(gusu, i)
    ans += cnt
    j = 2
    while j <= kisu
      ans += cnt * comb(kisu, j)
      j += 2
    end
  end
else
  if kisu > 0
    i = 1
    while i <= kisu
      cnt = comb(kisu, i)
      ans += cnt
      if gusu > 0
        (1..gusu).each do |j|
          ans += cnt*comb(gusu,j)
        end
      end
      i += 2
    end
  end
end

puts ans

Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;

int main(){

    int N, K;
    cin>>N>>K;
    int ans = 1145141919;
    vector<int>vec(N);
    for(int i=0;i<N;i++)cin>>vec[i];
    sort(vec.begin(), vec.end());
    for(int i=0, j = K-1;j<N;i++, j++){
        ans = min(ans, vec[j]-vec[i]);
    }
    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
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;}

int main() {
    string s;
    cin >> s;
    int ans = 0;
    rep(i,s.size()) {
        ans += s[i]-'0';
    }
    if(ans%9==0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3724
h,w = map(int,input().split())
ass = 10**9
if h%3 == 0:
    ass = 0
else:
    ass = w

if w % 3 == 0:
    ass = 0
else:
    ass = min(ass,h)


if h % 2 == 0:
    for i in range(1,w):
        ass = min(ass,abs(h*i-(w-i)*h//2))
else:
    for i in range(1,w):
        ass = min(ass,max(abs(h*i-(h-1)*(w-i)//2),abs(h*i-(h+1)*(w-i)//2),w-i))

if w % 2 == 0:
    for i in range(1,h):
        ass = min(ass,abs(w*i-(h-i)*w//2))
else:
    for i in range(1,h):
        ass = min(ass,max(abs(w*i-(w-1)*(h-i)//2),abs(w*i-(w+1)*(h-i)//2),h-i))
print(ass)
        

    


Measured memory_bytes: 40304
#include<stdio.h>

int main(void)

{

int a,b,c;

int tmp,i,j;

scanf("%d %d %d",&a,&b,&c);

if(a>b)

{

tmp = a;

a = b;

b = tmp;

}

if(a>c)

{

tmp = a;

a = c;

c = tmp;

}

if(b>c)

{

tmp = b;

b = c;

c = tmp;

}

printf("%d %d %d\n",a,b,c);

return 0;

}
 

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

int main(){
	int t;
	while(cin >> t,t){
		int n,cnt = 0;
		cin >> n;
		for(int i = 0;i < n;i++){
			int f,s;
			cin >> f >> s;
			cnt += s - f;
		}
		if(cnt >= t) cout << "OK" << endl;
		else cout << t - cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 3108
#include <iostream>
#include <cassert>

using namespace std;

const long long kMax = 2 * 100000;
const long long kMod = 998244353;

long long factorial[kMax + 1];
long long inverse[kMax + 1];
long long expm[kMax + 1];

long long modinv(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

void init(int M) {
  factorial[0] = 1;
  expm[0] = 1;
  for (long long x = 1; x <= kMax; ++x) {
    factorial[x] = factorial[x - 1] * x % kMod;
    inverse[x] = modinv(x, kMod);
    expm[x] = expm[x - 1] * (M - 1) % kMod;
  }
}

int main() {
  int N, M, K;
  cin >> N >> M >> K;

  init(M);

  long long cnt = 0;
  for (int k = 0; k <= K; ++k) {
    long long c = M;
    c *= expm[N - 1 - k];
    c %= kMod;
    c *= factorial[N - 1];
    c %= kMod;
    c *= modinv(factorial[N - 1 - k], kMod);
    c %= kMod;
    c *= modinv(factorial[k], kMod);
    c %= kMod;
    cnt += c;
    cnt %= kMod;
  }
  cout << cnt << endl;
}


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

using namespace std;

#define fcout(d) cout << fixed << setprecision(d)
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rep1(i,n) for(int (i) = 1; (i) <= (n); ++(i))
#define repU(i,bottom,ceiling) for(int (i) = (bottom); (i) <= (ceiling); ++(i))
#define repD(i,ceiling,bottom) for(int (i) = (ceiling); (i) >= (bottom); --(i))
#define pub push_back
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define fir first
#define sec second
#define clr(a) memset((a),0,sizeof(a))
#define all(v)  begin((v)),end((v))

typedef long long ll;
typedef unsigned long long ull;
typedef double db;

const vector<pair<int,int>> DIR = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int INF = -1 + (1<<30);
const int MOD = (int)1e9 + 7;

template<typename T> T gcd(T a,T b){ if(a % b){ return gcd(b,a % b); }else{ return b; } }

template<typename T> T lcm(T a,T b){ return a / gcd(a,b) * b; }

long long Pow(long long n,long long m,int mod = MOD){
	long long res = 1,pow = n % mod;
	while(m) {
		if(m & 1) res = (res * pow) % mod;
		pow = (pow * pow) % mod;
		m >>= 1;
	}
	return res;
}

vector<long long> Frac(int range,int mod = MOD){
	vector<long long> frac;
	frac.push_back(1);
	for(int i = 1; i <= range; ++i) frac.push_back((long long)frac.back() * i % mod);
	return frac;
}

long long Comb(int n,int m,int mod = MOD){
	if(n < m || m < 0) return 0;
	vector<long long> frac(Frac(n,mod));
	long long rev = Pow((long long)frac[m] * frac[n-m] % mod,mod-2,mod);
	return rev * frac[n] % mod;
}

template<class T,class U> auto LB(T v,U in){ return lower_bound(v.begin(),v.end(),in); }

template<class T,class U> auto UB(T v,U in){ return upper_bound(v.begin(),v.end(),in); }

unsigned long long next_subset(unsigned long long subset){
	unsigned long long tem = subset + (subset & -subset);
	unsigned long long btm = (~tem & subset) / (subset & -subset) >> 1;
	return btm | tem;
}


int n,a,b,c,x,y;

void solve(){
	if(a+b <= c*2) cout<<a*x+b*y;
	else{
		if(x>y) cout<<c*y*2+(x-y)*min(a,c*2);
		else cout<<c*x*2+(y-x)*min(b,c*2);
	}
	return;
}

void input(){
	cin>>a>>b>>c>>x>>y;
	return;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	input();
	solve();
	return 0;
}





Measured memory_bytes: 256
s = int(input())
n = s
c = 1
a = []
a.append(s)
for i in range(1000000):
	if n % 2 == 0:
		c = c + 1
		n = n /2
		if n in a:
			break
		a.append(n)
	else:
		c = c + 1
		n = 3*n + 1
		if n in a:
			break
		a.append(n)
print(c)

Measured memory_bytes: 3060