akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    cout<<(a-b)*(a-b-1)/2-b;
    return 0;
}


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

#define N_MAX 1000

int xs, ys, xt, yt;
int N;
int x[N_MAX + 2];
int y[N_MAX + 2];
int r[N_MAX + 2];

double cost[N_MAX + 2][N_MAX + 2];
double minDistance[N_MAX + 2];
int kettei[N_MAX + 2];

int main(void) {
	int i, j;
	if(scanf("%d%d%d%d", &xs,&ys,&xt,&yt)!=4)return 1;
	if(scanf("%d", &N)!=1)return 1;
	for(i=0;i<N;i++) {
		if(scanf("%d%d%d", &x[i],&y[i],&r[i])!=3)return 1;
	}
	x[N] = xs;
	y[N] = ys;
	r[N] = 0;
	x[N + 1] = xt;
	y[N + 1] = yt;
	r[N + 1] = 0;
	N += 2;

	for(i=0;i<N;i++) {
		cost[i][i]=0;
		for(j=i + 1;j<N;j++) {
			double abiru = sqrt(((double)x[i]-x[j])*((double)x[i]-x[j])+
				((double)y[i]-y[j])*((double)y[i]-y[j])) - ((double)r[i]+r[j]);
			if (abiru < 0) abiru = 0;
			cost[i][j] = cost[j][i] = abiru;
		}
	}

	for(i=0;i<N;i++)minDistance[i]=-1;
	minDistance[N-2] = 0;
	do {
		double minScore = -1;
		int minPos = -1;
		for(i=0;i<N;i++) {
			if(!kettei[i] && minDistance[i]>=0) {
				if(minScore <0 || minDistance[i]<minScore) {
					minScore=minDistance[i];
					minPos=i;
				}
			}
		}
		if(minPos<0)break;
		kettei[minPos]=1;
		for(i=0;i<N;i++) {
			if(minDistance[i]<0 || minDistance[minPos]+cost[minPos][i]<minDistance[i]) {
				minDistance[i]=minDistance[minPos]+cost[minPos][i];
			}
		}
	} while(!kettei[N-1]);

	printf("%.15f\n", minDistance[N-1]);
	return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
//#include "Local_Debug.h"
using namespace std;
#define Endl endl
#define debug(x) cout << #x << " = " << (x) << endl;
typedef long long ll;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)2e5 + 5;
ll n, m, t, a[MAXN];
int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	while (cin >> n)
	{
		for (ll i = 1; i <= n; ++i) cin >> a[i];
		ll mx = 0, cnt = 0;
		for (ll i = 2; i <= n; ++i)
		{
			if (a[i] <= a[i - 1])
				cnt++;
			else
				mx = max(mx, cnt), cnt = 0;
		}
		cout << max(mx, cnt) << endl;
	}
}
/*
5
10 4 8 7 3

7
4 4 5 6 6 5 5

4
1 2 3 4
*/

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

int main() {
    int n; cin >> n;
    int d; cin >> d;
    int x; cin >> x;
    while (n--) {
        int a; cin >> a;
        x += 1 + (d - 1) / a;
    }
    cout << x << endl;
    return 0;
}


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

#define	BUFSIZE 10

int main()
{
	int x, cube;
	char buf[BUFSIZE];

	fgets(buf, sizeof(buf), stdin);
	x = atoi(buf);

	if (x < 1 || 100 < x) {
		fprintf(stderr, "invalid input \n");
		return EXIT_FAILURE;
	}

	cube = x * x * x;

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

	return EXIT_SUCCESS;
}


Measured memory_bytes: 2096
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	vi v(4);
	REP(i, 3)
	{
		int a, b; cin >> a >> b;
		a--; b--;
		v[a]++;
		v[b]++;
	}
	if (*max_element(ALL(v)) == 3) cout << "NO" << endl;
	else cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
vector<ll> v;
void dfs(int k,ll x)
{
	v.push_back(x);
	if(k>=9)
	return;
	int a=x%10;
	if(a)
	dfs(k+1,x*10+a-1);
	dfs(k+1,x*10+a);
	if(a<9)
	dfs(k+1,x*10+a+1);
}
int main()
{
	for(int i=1;i<=9;i++)
	dfs(0,i);
	sort(v.begin(),v.end());
	v.erase(unique(v.begin(),v.end()),v.end());
	int k;
	cin>>k;
	cout <<v[k-1]<<endl;
	return 0;
}

Measured memory_bytes: 2420
X, Y = map(int, input().split())

tsuru = (4 * X - Y) / 2
kame = (Y-2*X)/2

policy1 = (tsuru.is_integer() and tsuru > 0) and (
    kame.is_integer() and kame > 0)
polocy2 = (tsuru.is_integer() and tsuru > 0) and (
    kame.is_integer() and kame == 0)
polocy3 = (tsuru.is_integer() and tsuru == 0) and (
    kame.is_integer() and kame > 0)


if policy1 or polocy2 or polocy3:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 61804
import java.util.Scanner;

public class Main {

	static Scanner scanner;

	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

	    double t=gd();
	    double x=gd();

        System.out.println(t/x);
//        if (n==3 || n==5 || n==7) {
//        	System.out.print("YES");
//        }else {
//        	System.out.print("NO");
//        }


	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 35752
while 1:
  n = input()
  if n==0: break
  a = b = 1e9
  for _ in [0]*n:
    i,h,w = map(int, raw_input().split())
    tmp = abs(w/(h/100.0)**2-22)
    if a>=tmp: a,b = tmp,i
  print b

Measured memory_bytes: 4252
u, s, e, w, n, d = input().split()
for i in input():
    if i == 'N':
        u, s, n, d = s, d, u, n
    elif i == 'E':
        u, e, w, d = w, u, d, e
    elif i == 'S':
        u, s, n, d = n, u, d, s
    elif i == 'W':
        u, e, w, d = e, d, u, w
print(u)

Measured memory_bytes: 7500
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")


void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod(ll n){return n%=MOD1;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{
    ll aa;
    ll bb;
}frequent;
ll po[10000]={};
void init(){
    po[0]=1;
    rep(i,1,10000){
        po[i]=po[i-1]+i+1;
    }
}
int main(void){
    // char ;
    ll n;
    scanf("%lld",&n);
    init();
    rep(i,0,10000){
        if(po[i]==n){
            rep(j,0,i+1){
                printf("%lld\n",j+1);
            }
            return 0;
        }
        if(po[i]>n){
            ll ans[i],re=n-po[i-1];
            rep(j,0,i){
                ans[j]=j+1;
            }
            rep(j,0,re){
                ans[i-j-1]++;
            }
            rep(j,0,i){
                printf("%lld\n",ans[j]);
            }
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, 1000000009)
	sc.Split(bufio.ScanWords)

	n, a, b := oneInt(), oneInt(), oneInt()

	nums := []int{}
	for i := 1; i <= n; i++ {
		if s := sumOfEachDigit(i); a <= s && s <= b {
			nums = append(nums, i)
		}
	}

	fmt.Println(sum(nums))
}

func oneInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func oneStr() string {
	sc.Scan()
	return sc.Text()
}

func scanNums(len int) (nums []int) {
	for i := 0; i < len; i++ {
		nums = append(nums, oneInt())
	}
	return nums
}

func scanStrings(len int) (strs []string) {
	for i := 0; i < len; i++ {
		strs = append(strs, oneStr())
	}
	return strs
}

func abs(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums []int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums []int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func sortAsc(a []int) []int {
	sort.Ints(a)
	return a
}

func sortDesc(a []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	return a
}

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

func lcm(a, b int) int {
	if a == 0 && b == 0 {
		return 0
	}
	return a * b / gcd(a, b)
}

func sum(nums []int) int {
	sum := 0
	for i := 0; i < len(nums); i++ {
		sum += nums[i]
	}
	return sum
}

func cumSum(nums []int) []int {
	sums := []int{0}

	for i := 0; i < len(nums); i++ {
		sums = append(sums, sums[i]+nums[i])
	}
	return sums
}

func sumOfEachDigit(num int) int {
	sum := 0
	for num > 0 {
		sum += num % 10
		num /= 10
	}
	return sum
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <cassert>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr ll INF = 3000000000000000000;

int main() {
    int h, w, k;
    cin >> h >> w >> k;
    vector<vector<char>> c(h, vector<char>(w));
    REP(i, h) REP(j, w) cin >> c[i][j];
    
    int ans = 0;
    REP(bit, 1 << (h + w)) {
        auto d = c;
        REP(i, h) {
            if ((bit >> i) & 1) {
                REP(j, w) d[i][j] = 'r';
            }
        }
        REP(i, w) {
            if ((bit >> (i + h)) & 1) {
                REP(j, h) d[j][i] = 'r';
            }
        }
        int cnt = 0;
        REP(i, h) REP(j, w) {
            if (d[i][j] == '#') ++cnt;
        }
        if (cnt == k) ++ans;
    }
    
    cout << ans << "\n";
    return 0;
}


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

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define fr(i,k) for(i=0;i<k;i++)
#define ALL(c) (c).begin(),(c).end()
#define deb(x) cerr<<#x<<"  = "<<x<<endl;
#define SZ(x) (x).size();
#define ll long long
#define MOD 1000000007
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define em emplace_back
#define ulli unsigned long long int
#define INF 1e18
#define endl "\n"
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> ii;
void solve();

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}


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

	int t;
	t = 1;

	//cin >> t;
	while (t--)
	{
		solve();
	}
	return 0;
}

ll n, W;

ll calc(ll w[], ll p[], ll n, ll wt, vector<vector<ll>> &dp)
{
	if (n < 0 || wt == 0)
		return 0;

	if (dp[n][wt] != -1)
		return dp[n][wt];

	dp[n][wt] = calc(w, p, n - 1, wt, dp);
	if (w[n] <= wt)
	{
		dp[n][wt] = max(dp[n][wt], p[n] + calc(w, p, n - 1, wt - w[n], dp));
	}

	return dp[n][wt];
}

void solve()
{
	ll i, ans;
	cin >> n >> W;

	ll w[n], p[n];

	for (i = 0; i < n; i++)
	{
		cin >> w[i] >> p[i];
	}

	vector<vector<ll>> dp(n, vector<ll>(W + 1, -1));

	ans = calc(w, p, n - 1, W, dp);

	cout << ans << endl;

}


Measured memory_bytes: 82340
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
const int inf = 1e17;
typedef pair<int, int> P;
typedef pair<int, P> PP;

signed main() {
	int x; cin >> x;
	int d = x % 100;
	int l = x / 100;
	if (5 * l < d)puts("0");
	else puts("1");
}

Measured memory_bytes: 256
Q, H, S, D = gets.split.map(&:to_i)
N = gets.to_i

if N == 1
  puts [Q * 4, H * 2, S].min
  exit
end

ans = [Q * 8, H * 4, S * 2, D].min * (N / 2)
ans += [Q * 4, H * 2, S].min * (N % 2)

puts ans

Measured memory_bytes: 14248
// Date: 2020-03-18

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;
#define FIO ios::sync_with_stdio(false);cin.tie(0)
#define rep(i, a, b) for(int i = int(a); i <= int(b); ++i)
#define per(i, b, a) for(int i = int(b); i >= int(a); --i)
#define mem(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(),(x).end()
#define D(x) cout<<#x<<" = "<<x<<endl;
#define SZ(x) ((int)x.size())
#define mk make_pair
#define pb push_back
#define fi first
#define se second
const LL INF = 1e18;
const LL mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const int N = 400 + 10;
template <typename T> void chkmax(T &x, T y) { x = max(x, y); }
template <typename T> void chkmin(T &x, T y) { x = min(x, y); }
LL qpow(LL x, LL y, LL MOD) {LL a=1; while(y){ if(y&1) a=a*x%MOD; x=x*x%MOD; y>>=1; } return a;}

LL dp[N][N], val[N][N];
int n, m, a[N], b[N];

int main() {
    FIO;
    cin >> n >> m;
    rep(i, 1, n) cin >> a[i];
    rep(i, 1, n) cin >> b[i];
    rep(i, 1, n) {
        rep(j, 0, m) {
            rep(k, a[i], b[i]) {
                val[i][j] += qpow(k, j, mod);
                val[i][j] %= mod;
            }
        }
    }
    dp[0][0] = 1;
    rep(i, 1, n) {
        rep(j, 0, m) {
            rep(k, 0, j) {
                dp[i][j] = (dp[i][j] + dp[i-1][k] * val[i][j-k] % mod) % mod;
            }
        }
    }
    cout << dp[n][m];

    return 0;
}

Measured memory_bytes: 2816
n = int(input())
s = input()

r = s.count('R')
g = s.count('G')
b = s.count('B')
ans = r*g*b
for i in range(n):
    for j in range(i+1, n):
        k = 2*j-i
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            ans -= 1
print(ans)


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

int main(){
  int N , M ; 
  cin >> N >> M ; 
  vector<int> X(M) ; 
  
  for(int i = 0 ; i < M ; i++) cin >> X.at(i) ; 
  sort(X.begin(),X.end());
  
  vector<long long> S(M) ; 
  for(int i = 1 ; i < M ; i++){
    S.at(i) = X.at(i) - X.at(i-1) ; 
    //cout << S.at(i) << endl; 
  }
  
  sort(S.begin(),S.end()) ; 
  reverse(S.begin(),S.end()) ; 
  long long ans = 0 ; 
  for(int i = N-1 ; i < M ; i++){
    ans += S.at(i) ;  
  }
  cout << ans << endl ; 
}

Measured memory_bytes: 4220
<?php
$numbers1 = fgets(STDIN);
$exploded_numbers[0] = explode(' ', trim($numbers1));
$numbers2 = fgets(STDIN);
$exploded_numbers[1] = explode(' ', trim($numbers2));
$numbers3 = fgets(STDIN);
$exploded_numbers[2] = explode(' ', trim($numbers3));

fscanf(STDIN, '%d', $n);
for ($i=1; $i<=$n; $i++) {
  fscanf(STDIN, '%d', $output[$i]);
}

$a1 = in_array($exploded_numbers[0][0], $output);
$a2 = in_array($exploded_numbers[0][1], $output);
$a3 = in_array($exploded_numbers[0][2], $output);
if ($a1 && $a2 && $a3) {
  echo 'Yes';
  exit;
}

$a1 = in_array($exploded_numbers[1][0], $output);
$a2 = in_array($exploded_numbers[1][1], $output);
$a3 = in_array($exploded_numbers[1][2], $output);
if ($a1 && $a2 && $a3) {
  echo 'Yes';
  exit;
}

$a1 = in_array($exploded_numbers[2][0], $output);
$a2 = in_array($exploded_numbers[2][1], $output);
$a3 = in_array($exploded_numbers[2][2], $output);
if ($a1 && $a2 && $a3) {
  echo 'Yes';
  exit;
}

$a1 = in_array($exploded_numbers[0][0], $output);
$a2 = in_array($exploded_numbers[1][0], $output);
$a3 = in_array($exploded_numbers[2][0], $output);
if ($a1 && $a2 && $a3) {
  echo 'Yes';
  exit;
}

$a1 = in_array($exploded_numbers[0][1], $output);
$a2 = in_array($exploded_numbers[1][1], $output);
$a3 = in_array($exploded_numbers[2][1], $output);
if ($a1 && $a2 && $a3) {
  echo 'Yes';
  exit;
}

$a1 = in_array($exploded_numbers[0][2], $output);
$a2 = in_array($exploded_numbers[1][2], $output);
$a3 = in_array($exploded_numbers[2][2], $output);
if ($a1 && $a2 && $a3) {
  echo 'Yes';
  exit;
}

$a1 = in_array($exploded_numbers[0][0], $output);
$a2 = in_array($exploded_numbers[1][1], $output);
$a3 = in_array($exploded_numbers[2][2], $output);
if ($a1 && $a2 && $a3) {
  echo 'Yes';
  exit;
}

$a1 = in_array($exploded_numbers[0][2], $output);
$a2 = in_array($exploded_numbers[1][1], $output);
$a3 = in_array($exploded_numbers[2][0], $output);
if ($a1 && $a2 && $a3) {
  echo 'Yes';
  exit;
}

echo 'No';

Measured memory_bytes: 4728
#include <stdio.h>
#include <math.h>

int main(void) {
	int w, h, r;
	char c;
	int hisi = 0;
	int chohou = 0;
	while(scanf("%d%c%d%c%d\n", &w, &c, &h, &c, &r)==5) {
		if(w*w+h*h==r*r) {
			chohou++;
		} else if(w==h && (w+h)>r) {
			hisi++;
		}
	}		
	printf("%d\n%d\n", chohou, hisi);
	
	return 0;
}

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

typedef long long ll;

const int MOD = 1e9 + 7;

ll modinv(ll a, ll m = MOD) {
	assert(1 <= a);
	assert(a < m);
	return a == 1 ? 1 : m - modinv(m % a, a) * m / a;
}

const int MAXN = 16;
const int MAXM = 16;
int N, M;
int A[MAXM];

int dp[MAXM+1][1<<MAXN];

const int MAXV = (1 << 16) + 10;
int fact[MAXV];
int ifact[MAXV];

int choose(int a, int b) {
	if (a >= b && b >= 0) {
		return fact[a] * ll(ifact[a-b]) % MOD * ifact[b] % MOD;
	} else {
		return 0;
	}
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	fact[0] = 1;
	for (int i = 1; i < MAXV; i++) {
		fact[i] = ll(i) * fact[i-1] % MOD;
	}
	ifact[MAXV-1] = modinv(fact[MAXV-1]);
	for (int i = MAXV-1; i >= 1; i--) {
		ifact[i-1] = ll(i) * ifact[i] % MOD;
	}

	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		cin >> A[i]; A[i]--;
	}
	sort(A, A + M, greater<int>());

	dp[0][0] = 1;
	for (int k = 0; k < M; k++) {
		for (int m = 0; m < (1<<N); m++) {
			dp[k+1][m] += dp[k][m];
			dp[k+1][m] %= MOD;
			int bigger = (1 << N) - 1 - A[k] - m;
			for (int i = 0; i < N; i++) {
				if (m & (1<<i)) continue;
				dp[k+1][m|(1<<i)] += MOD - choose(bigger, (1<<i)-1) * ll(dp[k][m]) % MOD * fact[1<<i] % MOD;
				dp[k+1][m|(1<<i)] %= MOD;
			}
		}
	}

	ll ans = 0;
	for (int m = 0; m < (1<<N); m++) {
		int v = ll(dp[M][m]) * fact[(1<<N)-m-1] % MOD;
		ans += v;
		ans %= MOD;
	}
	ans *= 1<<N;
	ans %= MOD;
	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
/*
	Karya anak bangsa yang paling agung
	Author : Yohandi or... bukan..
*/

#define fs first
#define sc second
#define pb push_back
#define eb emplace_back

#define all(a) a.begin(),a.end()
#define lb(a,x) (lower_bound(all(a),x)-a.begin())
#define ub(a,x) (upper_bound(all(a),x)-a.begin())

#define rep(a,x,y) for(int a=(int)x;a<=(int)y;++a)
#define repd(a,x,y,d) for(int a=(int)x;a<=(int)y;a+=d)
#define res(a,x,y) for(int a=(int)x;a>=(int)y;--a)
#define resd(a,x,y,d) for(int a=(int)x;a>=(int)y;a-=d)

// Ordered Set, Ordered Multiset
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define o_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
#define o_multiset tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>
using namespace __gnu_pbds;
// .order_of_key(x) -> Number of elements less than x
// * .find_by_order(k) -> Kth smallest element (0-based)
// .erase(x) -> Remove all elements equal to x

#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
using lint=long long;

mt19937 rng(time(NULL));

lint Power(lint A,lint B,lint C){
	if(!B) return 1LL;
	lint tmp=Power(A,B>>1,C);
	return tmp*tmp%C*(B&1?A:1)%C;
}

int T;

int main(){
//	ios_base::sync_with_stdio(0);
//	cin.tie(0); cout.tie(0);
	T=1;
//	cin>>T;
	rep(t,1,T){
        string S;
        cin>>S;
        if(S=="ABC") cout<<"ARC\n"; else cout<<"ABC\n";
	}
	return 0;
}




Measured memory_bytes: 3600
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>

using namespace std;

int n,x,p;
vector<int> vec;
int gcd(int a,int b);

int main(){
    cin >> n >> x;
    for(int k=0; k<n; k++){
        cin >> p;
        vec.emplace_back(p-x);
    }
    sort(vec.begin(),vec.end());
    p=vec[0];
    for(int k=1;k<n;k++)p=gcd(p,vec[k]);
    
    cout <<(int) abs(p) << '\n';
    return 0;
}

int gcd(int a,int b){
    int c;
    while(a%b!=0){
        c=b;
        b=a%b;
        a=c;
    }
    return(b);
}

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

int main(){
  int n,m,a,b,c[55]={};
  cin>>n>>m;
  fr(i,2*m){
    cin>>a;
    c[a]++;
  }
  fr(i,n) cout<<c[i]<<endl;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}

int main(){
  int n,input;
  int a,b,k;
  cin >> a >> b >> k;
  vector<int> A;
  for(int i = a; i < a + k ; i++) {
    if(i <= b )A.push_back(i);
  }
  for(int i = b-k+1; i <= b ; i++) {
    if(i >= a )A.push_back(i);
  }

  //descendingSort
  sort(A.begin(),A.end());
  //unique
  A.erase(unique(A.begin(),A.end()),A.end());
  for(int i = 0; i < A.size(); i++) cout << A[i] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    string s;
    cin>>s;
    ll ans=0;
    rep(0,i,3){
        if(s[i]=='R'){
            if(ans==0)++ans;
            else if(s[i-1]==s[i])++ans;
        }
    }
    cout<<ans;
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using P = pair<ll, ll>;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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;
}
struct edge {
  ll to, cost;
};

int main() {
  int x; cin >> x;
  if(x == 1) cout << 0 << endl;
  else cout << 1 << endl;
}

Measured memory_bytes: 3620
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(K):
    m = 0
    for i in range(1, 10**6):
        m = (m * 10 + 7) % K
        if m == 0:
            print(i)
            return
    print(-1)

if __name__ == '__main__':
    input = sys.stdin.readline
    K = int(input())
    main(K)


Measured memory_bytes: 62900
#include<stdio.h>

int main(void){

    int a,b;

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

    if(a>b){
      printf("a > b\n");
    }else if(a<b){
      printf("a < b\n");
    }else{
      printf("a == b\n");
    }

    return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
using namespace std;
int mp[200001] = {};
int main()
{
    int n;
    cin >> n;
    vector<int> a(n + 1), b(n + 1, 0);
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    int cnt = 0;
    for (int j = n; j >= 1; j--)
    {
        if ((mp[j] + a[j]) % 2 == 1)
        {
            b[j] += 1;
            cnt++;
            for (long long i = 1; i * i <= j; i++)
            {
                if (j % i == 0)
                {
                    mp[i]++;
                    if (i * i != j)
                        mp[j / i]++;
                }
            }
        }
    }
    cout << cnt << endl;
    for (int i = 1; i <= n; i++)
    {
        if (b[i] == 1)
            cout << i << " ";
    }
}

Measured memory_bytes: 3200
n = int(input())
prime = [2]
for i in range(3, n+1):
	if all(i % x for x in prime):
		prime.append(i)
ans = 1
p = 1000000007
for x in prime:
	a = n
	cnt = 0
	while(a!=0):
		cnt += a//x
		a //= x
	ans = ans * (cnt+1) % p
print(ans)

Measured memory_bytes: 3064
a=[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]
k=gets.chomp.to_i
puts a[k-1]

Measured memory_bytes: 1788
#include<stdio.h>
#include<iostream>
#include<queue>
#include<algorithm>
using namespace std;
const int maxn=1e5+5;
int n,m,a[maxn],b[maxn];
typedef struct node{
	int a,b;
	node(){
	}
	node(int aa,int bb){
		a=aa,b=bb;
	}
}node;
node nod[maxn];
int cmp(node x,node y){
	return x.a<y.a;
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++){
		scanf("%d%d",&a[i],&b[i]);
		// 按时间先后排序
		nod[i]=node(a[i],b[i]); 
	}
	sort(nod,nod+n,cmp);
//	for(int i=0;i<n;i++)printf("%d %d\n",nod[i].a,nod[i].b);
	int ans=0,cnt=0;
	priority_queue<int> q;
	int day=0,pos=0;
	for(int i=m;i>0;i--){
		day++;
		while(nod[pos].a<=day&&pos<n){
//			printf("node=%d %d\n",nod[pos].a,nod[pos].b);
			q.push(nod[pos].b);pos++;
		}	
		if(!q.empty()){
			ans+=q.top();q.pop();
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 2428
n, k = map(int, input().split())

p = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]

p_flag = [0 for _ in range(len(p))]
loop_max = []
loop_len = []
S = []
S_max = []
ans = []

for i in range(len(p)):
    # if p_flag[i] == 1:
    #     continue
    now = i
    temp_len = 0
    temp_s = 0
    S_max = - (10**9 + 1)
    temp_l = []
    while True:
        now = p[now] - 1
        temp_len += 1
        temp_s += c[now]
        temp_l.append(temp_s)
        p_flag[now] = 1

        # 最初に戻ってきたら
        if now == i:
            break

    loop_len.append(temp_len)
    loop_max.append(temp_l)
    S.append(temp_s)

for i in range(len(S)):
    mod = k % loop_len[i] if k % loop_len[i] != 0 else loop_len[i]
    if S[i] > 0:
        if max(loop_max[i][:mod]) > 0:
            ans.append(((k-1)//loop_len[i])*S[i] + max(loop_max[i][:mod]))
        else:
            ans.append(((k - 1) // loop_len[i]) * S[i])
    else:
        ans.append(max(loop_max[i]))

# print(loop_max)
# print(ans)
print(max(ans))


Measured memory_bytes: 286628
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		int N = s.nextInt();
		
		if(N >= 65 && N <=90){
			System.out.println(1);
		}else if(N >= 97 && N <=122){
			System.out.println(2);
		}else{
			System.out.println(0);
		}
	}
}


Measured memory_bytes: 26280
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int main()
{
	int n;
	cin >> n;
	vector<ld> v(n), pos(n);
	REP(i, n) cin >> v[i];
	if (n == 1)
	{
		cout << v[0] * 2 << endl;
		return 0;
	}
	pos[0] = v[0];
	int t;
	ld ans = 0;
	FOR(i, 1, n)
	{
		ld npos = v[i];
		REP(j, i)
		{
			ld l = v[i], r = v[j];
			ld h = abs(l - r), d = l + r;
			ld tmp = pos[j] + sqrt(d*d - h*h);
			chmax(npos, tmp);
		}
		pos[i] = npos;
		chmax(ans, pos[i] + v[i]);
	}
	cout << D10 << ans << endl;
	return 0;
}

Measured memory_bytes: 3280
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N,K = map(int,input().split())

answer = 0
for x in [17,18,19,20,21]:
    # y = x + 7t, 0 <= t <= n-3
    # 9y - 72 - K が11の倍数
    first_t = 0
    while (9*(x+7*first_t)-72)%11 != K:
        first_t += 1
    cnt = ((N-3) - first_t)//11 + 1
    answer += cnt
print(answer)



Measured memory_bytes: 3060
N = int(input())
P = list(map(int, input().split()))

S = sorted(P, reverse = True)
cn = 0
L = []



for i in range(N):
    if i == 0:
        cn = cn + 1
        L.append(P[i])

    else:
        if P[i] > L[0]:
            continue
                
        else:
            cn = cn + 1
            L.append(P[i])
            L.pop(0)


print(cn)

Measured memory_bytes: 32324
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int i, j, k;
		int floor1[][];
		int floor2[][];
		int floor3[][];
		int floor4[][];
		floor1 = new int[3][10];
		floor2 = new int[3][10];
		floor3 = new int[3][10];
		floor4 = new int[3][10];
		
		int n = scan.nextInt();
		int v;
		int w;
		
	
	
		for (k = 1; k <= n; k++) {
			
			int b = scan.nextInt();
			int f = scan.nextInt();
			int r = scan.nextInt();
			v = scan.nextInt();
			w = v;
		
if(b == 1 && v <= 9 && floor1[f-1][r-1] >= 0){
	floor1[f-1][r-1] += v;
}else if(b == 2 &&  v <= 9 && floor2[f-1][r-1] >= 0){
	floor2[f-1][r-1] += v;
}else if(b == 3 &&  v <= 9 && floor3[f-1][r-1] >= 0){
	floor3[f-1][r-1] += v;
}else if(b == 4 &&  v <= 9 && floor4[f-1][r-1] >= 0){
	floor4[f-1][r-1] += v;
}


		}
		
			
		for (j = 0; j < 3; j++) {
			for (i = 0; i < 10; i++) {
				
				System.out.print(" "+floor1[j][i]);
				if(i >= 9){
					System.out.println();
				}
				
			}
		}
		System.out.println("####################");
		for (j = 0; j < 3; j++) {
			for (i = 0; i < 10; i++) {
				System.out.print(" "+floor2[j][i]);
				if(i >= 9){
					System.out.println();
				}
				
			}
		}
		System.out.println("####################");
		for (j = 0; j < 3; j++) {
			for (i = 0; i < 10; i++) {
				System.out.print(" "+floor3[j][i]);
				if(i >= 9){
					System.out.println();
				}
				
			}
		}
		System.out.println("####################");
		for (j = 0; j < 3; j++) {
			for (i = 0; i < 10; i++) {
				System.out.print(" "+floor4[j][i]);
				if(i >= 9){
					System.out.println();
				}
				
			}
		}
	}
		

}

Measured memory_bytes: 29780
#include<bits/stdc++.h>
using namespace std;
template<typename T>
inline void read(T &x)
{
	x=0;
	int f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') f=-1;
		ch=getchar();
}
	while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=getchar();
	x*=f;
	return;
}	
template<typename T>
void write(T x)
{
	if(x<0) putchar('-'),x=-x;
	if(x>=10) write(x/10);
	putchar(x%10+'0');
	return;
}
const int MAXN=100010;
char ch[MAXN];
int q;
deque<char> hd,ta;
int rev=0;
int main()
{
    scanf("%s",ch);
    read(q);
    for(int i=1;i<=q;i++)
    {
        int op;
        read(op);
        if(op==1) rev^=1;
        else
        {
            int x;
            char y;
            read(x);
            scanf("%c",&y);
            if(rev) x=3-x;
            if(x==1) hd.push_front(y);
            else ta.push_back(y);
        }
    }
    if(!rev)
    {
        while(!hd.empty()) putchar(hd.front()),hd.pop_front();
        for(int i=0;i<strlen(ch);i++) putchar(ch[i]);
        while(!ta.empty()) putchar(ta.front()),ta.pop_front();
    }
    else
    {
        while(!ta.empty()) putchar(ta.back()),ta.pop_back();
        for(int i=strlen(ch)-1;i>=0;i--) putchar(ch[i]);
        while(!hd.empty()) putchar(hd.back()),hd.pop_back();
    }
    putchar('\n');
	return 0;
}


Measured memory_bytes: 896
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Atcoder
{
    class aaaa
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);int b = int.Parse(input[1]);
            
            if ((a * b) % 2 == 0){
                Console.WriteLine("Even");
            }else{
                Console.WriteLine("Odd");
            }
        }
    }
}

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

int main(){
    int n;
    cin >> n;
    int one = n%10;
    if(one==3) cout << "bon" << endl;
    else if (one==0 or one==1 or one==6 or one==8)
    {
        cout << "pon" << endl;
    }
    else cout << "hon" << endl;
    return 0;
}

Measured memory_bytes: 3596
from fractions import gcd
# def lcm(a,b): return a*b//gcd(a,b)

def lcm(a, b):
    return (a * b) // gcd(a, b)

n = int(input())

ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(t, ans)
print(ans)

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

int main( void )
{
	register int i, j;

	bool isPrime[50001 + 1];
	isPrime[2] = true;
	for ( i = 3; i < 50001; i += 2 )
	{
		isPrime[i] = true;
	}

	for ( i = 3; i < 50001; i += 2 )
	{
		for ( j = i + i; j < 50001; j += i )
		{
			isPrime[j] = false;
		}
	}

	register int cnt = 1;
	int primes[5500];
	primes[0] = 2;
	for ( i = 3; i < 50001; i += 2 )
	{
		if ( isPrime[i] )
		{
			primes[cnt] = i;
			cnt++;
		}
	}

	register int n;
	while ( cin >> n && n != 0 )
	{
		register int kotae = 0;
		for ( i = 0; i < cnt; i++ )
		{
			if ( primes[i] <= n / 2 )
			{
				if ( isPrime[n-primes[i]] )
					kotae++;
			}
		}
		cout << kotae << endl;
	}

	return 0;
}

Measured memory_bytes: 936
// Aizu Vol-5 0526: Boat Travel
// 2017.9.1 bal4u@uu

#include <stdio.h>
#include <string.h>

#define INF 0x7fffffff
#define N 105			// >= 100+2
#define MAX 11000		// >= N*N

typedef struct { int t, node; } QUE;
QUE que[MAX]; int qsize;

#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)

void min_heapify(int i)
{
  int l, r;
  int smallest;

  l = LEFT(i), r = RIGHT(i);
  if (l < qsize && que[l].t < que[i].t) smallest = l; else smallest = i;
  if (r < qsize && que[r].t < que[smallest].t) smallest = r;
  if (smallest != i) {
    QUE t = que[i]; que[i] = que[smallest]; que[smallest] = t;
    min_heapify(smallest);
  }
}

int deq(int *n)
{
  if (qsize == 0) return 0;
  *n = que[0].node;
  que[0] = que[--qsize];
  min_heapify(0);
  return 1;
}

void enq(int n, int t)
{
  int i, ii;

  i = qsize++;
  que[i].node = n, que[i].t = t;
  while (i > 0 && que[ii = PARENT(i)].t > que[i].t) {
    QUE tt = que[i]; que[i] = que[ii]; que[ii] = tt;
    i = ii;
  }
}

typedef struct { int len, to[N], t[N]; } TBL;
TBL tbl[N]; int node[N]; char visited[N]; int size;
int start, goal;

int search(void)
{
	int i, k, s, e;
	TBL *tp;

	qsize = 0;
	for (i = 1; i <= size; i++) node[i] = INF, visited[i] = 0;
	node[start] = 0;
	enq(start, 0);
	while(deq(&s)) {
		if (s == goal) break;
		if (visited[s]) continue;
		visited[s] = 1;
		tp = tbl + s;
		for (i = 0; i < tp->len; i++) {
			e = tp->to[i];
			if (visited[e]) continue;
			k = node[s] + tp->t[i];
			if (k < node[e]) node[e] = k, enq(e, k); 
		}
	}
	return node[goal];
}

int main()
{
	int n, k, c, a, b, e, i;

	while (scanf("%d%d", &n, &k) && n) {
		size = n;
		for (i = 1; i <= size; i++) tbl[i].len = 0;
		while (k-- > 0) {
			scanf("%d", &c);
			if (c) {
				scanf("%d%d%d", &a, &b, &e);
				tbl[a].to[tbl[a].len] = b, tbl[a].t[tbl[a].len++] = e;
				tbl[b].to[tbl[b].len] = a, tbl[b].t[tbl[b].len++] = e;
			} else {
				scanf("%d%d", &start, &goal);
				if ((e = search()) >= INF) e = -1; 
				printf("%d\n", e);
			}
		}
	}
	return 0;
}

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

int main() {
  int64_t n, x, m;
  cin >> n >> x >> m;
  int64_t a = x;
  int64_t sum = 0;
  vector<int> seen(m, -1);
  vector<int> sequence;
  int loop_start = -1;
  for (int i = 0; i < n; ++i) {
    if (seen[a] == -1) {
      seen[a] = sequence.size();
    } else {
      loop_start = seen[a];
      break;
    }
    sequence.push_back(a);
    a = a * a % m;
  }
  for (int i = 0; i < loop_start; ++i) {
    sum += sequence[i];
  }
  if (loop_start != -1) {
    int64_t loop_sum = 0;
    int sequence_len = 0;
    for (int i = loop_start; i < (int) sequence.size(); ++i) {
      loop_sum += sequence[i];
      ++sequence_len;
    }
    int64_t left = n - loop_start;
    sum += loop_sum * (left / sequence_len);
    for (int i = 0; i < left % sequence_len; ++i) {
      sum += sequence[loop_start + i];
    }
  } else {
    assert((int) sequence.size() == n);
    for (int i = 0; i < n; ++i) {
      sum += sequence[i];
    }
  }
  cout << sum << '\n';
  return 0;
}

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

using namespace std;
int a[100100];

int main()
{
    int n,m;  cin >> n >> m;
    for(int i = 0;i<m;i++){
        int l,r;
        cin >> l >> r;
        a[l]++;
        a[r + 1]--;
    }
    for(int i = 2;i<=n;i++)  a[i]+=a[i - 1];
    int Ans = 0;
    for(int i = 1;i<=n;i++)  if(a[i] == m)  Ans++;
    cout << Ans;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  rep(i, n){
    if (a[i]%2 == 0 && a[i]%3 != 0 && a[i]%5 != 0){
      cout << "DENIED" << endl;
      return 0;
    }
  }
  cout << "APPROVED" << endl;
  return 0;
}

Measured memory_bytes: 256
import itertools
n=int(input())
l=list(map(int,input().split()))
cnt=0
c=list(itertools.combinations(l,3))
for i in range(len(c)):
    if (c[i][0]!=c[i][1] and c[i][1]!=c[i][2] and c[i][2]!=c[i][0]) and (c[i][0]+c[i][1]>c[i][2] and c[i][1]+c[i][2]>c[i][0] and c[i][2]+c[i][0]>c[i][1]):
        cnt+=1
print(cnt)

Measured memory_bytes: 20616
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <array>
#include <vector>

using namespace std;

int n, m;

int f( int x ) {
  return min( x, n - 1 - x );
}

int main() {
  cin >> n >> m;
  for ( int i = 0; i < m; i++ ) {
	int x, y;
	cin >> x >> y;
	cout << min( f( x - 1 ), f( y - 1 ) ) % 3 + 1 << endl;
  }
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
using namespace std;
vector<int> a;
vector<long long> f;
int main()
{
    int n;
    int i;
    long long tmp1,tmp2;
    scanf("%d",&n);
    a.resize(n+1);
    f.resize(n+1);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
    }
    f[1]=0;
    f[2]=abs(a[1]-a[2]);
    for(i=3;i<=n;i++)
    {
        tmp1=f[i-1]+abs(a[i]-a[i-1]);
        tmp2=f[i-2]+abs(a[i]-a[i-2]);
        f[i]=min(tmp1,tmp2);
    }
    printf("%lld\n",f[n]);
    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define ll long long
#define pii pair <int , int>
#define psi pair <string , int >
#define pll pair <ll , ll>
#define pi 3.14159265358979323846
using namespace std;
int main()
{
    float r;
    cin >> r;
    printf("%.20f", 2 * pi * r);
    ///code here
    return 0;
}


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

int main() {
  int n, h;
  cin >> n >> h;
  vector<pair<int, int>> a(n), b(n);
  vector<int> katana(n, 1);
  for(int i = 0; i < n; i++){
    int now;
    cin >> now;
    a.at(i) = {now, i};
    cin >> now;
    b.at(i) = {now, i};
  }
  
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  
  int cut = a.at(n-1).first, cutnum = a.at(n-1).second;
  int ans = 0;
  for(int i = n-1; i >= 0; i--){
    if(h <= 0) break;
    if(h <= b.at(i).first){
      ans++;
      h -= b.at(i).first;
      break;
    }
    if(b.at(i).second == cutnum){
      if(b.at(i).first > cut) h -= b.at(i).first, ans++;
    }
    else{
      if(b.at(i).first > cut){
        h -= b.at(i).first;
        ans++;
      }
      else break;
    }
  }
  
  if(h > 0) ans += (h + cut - 1) / cut;
  
  cout << ans << endl;
}

Measured memory_bytes: 5032
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1061109567
#define pb push_back
#define in(s) freopen(s,"r",stdin);
#define out(s) freopen(s,"w",stdout);
#define fi first
#define se second
#define bw(i,r,l) for (int i=r-1;i>=l;i--)
#define fw(i,l,r) for (int i=l;i<r;i++)
#define fa(i,x) for (auto i:x)
using namespace std;
const int N = 2e5 + 5;
int n, m, deg[N][2], a[N];
vector<int> g[N];
bool rem[N];
signed main() {
	#ifdef aome
	in("aome.inp");	
	#endif
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	fw (i, 0, n) {
		char c; cin >> c;
		if (c == 'A') a[i] = 0;
		else a[i] = 1;
	}
	fw (i, 0, m) {
		int u, v;
		cin >> u >> v;
		u--, v--;
		g[u].pb(v), g[v].pb(u);
		deg[u][a[v]]++, deg[v][a[u]]++;
	}
	/*
	If there are no cycles, the answer is obviously No
	Else, then it's only possible if every element in the cycle is adjancent to a 'A' and a 'B'
	*/
	queue<int> q;
	fw (i, 0, n) {
		if (!deg[i][0] || !deg[i][1]) rem[i] = 1, q.push(i);
	}
	while (!q.empty()) {
		int u = q.front(); q.pop();
		fa (v, g[u]) {
			deg[v][a[u]]--;
			if (!deg[v][0] || !deg[v][1]) {
				if (!rem[v]) {
					rem[v] = 1;
					q.push(v);
				}
			}
		}
	}
	fw (i, 0, n) if (!rem[i]) {
		cout << "Yes";
		return 0;
	}
	cout << "No";
	return 0;
}

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

#define FOR(i,l,r) for(int i = int(l);i < int(r);i++)
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;

int N,K;
vector<int> A;

int main()
{
	scanf("%d%d",&N,&K);
	A.assign(N,0);
	map<int,int> mp;
	FOR(i,0,N){
		scanf("%d",&A [i]);
		mp [A [i]]++;
	}

	vector<int> v;
	for(const auto& it : mp){
		v.push_back(it.second);
	}
	sort(v.rbegin(),v.rend());

	int ans = 0;
	while(v.size() > K){
		ans += v.back();
		v.pop_back();
	}
	printf("%d\n",ans);

	return 0;
}


Measured memory_bytes: 11516
#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-1;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ll long long


ll Eucleadean(ll a, ll b){
	ll tmp;
	while (a%b != 0){
		tmp = b;
		b = a%b;
		a = tmp;
	}
	return b;
}


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a, b, c, d, cd;
	cin >> a >> b >> c >> d;
	cd = Eucleadean(c, d);
	cd = c*d/cd;
	ll ans = b-(b/c+b/d-b/cd) - (a-1-((a-1)/c+(a-1)/d-(a-1)/cd));
	cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
XY = [[int(x) for x in input().split()] for i in range(N)]
mod = 998244353
XY.sort() #Xについてソート
X, Y = zip(*XY)
Y_rank = {x:i for i, x in enumerate(sorted(Y), 1)}
BIT = [0] * (N+1)

def append_BIT(x):
    while x <= N:
        BIT[x] += 1
        x += x & (-x)

def sum_BIT(x):
    ret = 0
    while x:
        ret += BIT[x]
        x &= (x-1)
    return ret

pow2 = [1]
for i in range(N):
    pow2.append(pow2[-1] * 2 % mod)

ret = 0 
for i in range(N):
    y = Y_rank[Y[i]]
    L = i
    R = N-i-1
    D = y-1
    U = N-D-1
    LD = sum_BIT(y)
    append_BIT(y)
    LU = L - LD
    RU = U - LU
    RD = D - LD
    
    ret += (pow2[N]-1 - pow2[L] - pow2[R] - pow2[U] - pow2[D] + pow2[LD] + pow2[LU] + pow2[RU] + pow2[RD])
    
ret %= mod
print(ret)


Measured memory_bytes: 124568
/* When Talent doesn't work, Hard work beats Talent*/

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include"bits/stdc++.h"

using namespace std;

#define Fast_D cout<<fixed<<setprecision(13);
#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define nl "\n"
#define int long long
#define double long double
#define all(v) v.begin(),v.end()
#define scanstr(s) cin>>ws; getline(cin,s);

const double PI = 3.141592653589793;

void solve()
{
	int x,y,a;
	cin >> x >> y >> a;
	int d = (x + (a-1)) / a;
	int u = (y/a);
	cout << u - d + 1;
}

int32_t main()
{
	FastIO;
	Fast_D;
	solve();
	return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 1000000007;

long long div(long long a, long long b, long long c) { return b / c - (a - 1) / c; }

void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}
long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}
void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}
#define REP(i, n) for (long long i = 0; i < (n); i++)
vector<int> h, memo;

// int dp(int n) {
//     if (memo[n] != -1) {
//         return memo[n];
//     }
//     if (n == 0) {
//         return 0;
//     }
//     if (n == 1) {
//         return abs(h[1] - h[0]);
//     }
//     memo[n] = min(dp(n - 1) + abs(h[n] - h[n - 1]), dp(n - 2) + abs(h[n] - h[n - 2]));
//     return min(dp(n - 1) + abs(h[n] - h[n - 1]), dp(n - 2) + abs(h[n] - h[n - 2]));
// }
signed main() {
    long long x, y, ans = 1e9 + 10;
    cin >> x >> y;
    if (x > 8 || y > 8) {
        cout << ":(" << endl;
    } else {
        cout << "Yay!" << endl;
    }
}

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

int main(void) {
  
    char ch;
    
    while (1) {
        scanf("%c",&ch);
        if (ch == '\n') {
            break;
            }
        if(islower(ch)){
            ch = toupper(ch);
            printf("%c",ch);
        }else if(isupper(ch)){
            ch = tolower(ch);
            printf("%c",ch);
        }else{
              printf("%c",ch);
    }
        
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 524
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	int N, D, X;
	cin >> N >> D >> X;
	vector<int>A(N);
	rep(i, N) {
		cin >> A[i];
	}
	int SUM = 0;
	rep(i, N) {
		SUM +=( (D - 1) / A[i] + 1);
	}
	cout << SUM + X << endl;
}

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

int main(void) {
	char text[3][10];
  
	for(int i=0; i<3; i++){
		fgets(text[i], sizeof(text), stdin);
	}

	for(int i=0; i<=2; i++){
		printf("%c",  text[i][i]);
	}
	return 0;
}

Measured memory_bytes: 128