akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtcoderTemplateForCSharp
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());

            var a = new List<int>();

            a.AddRange(Console.ReadLine().Split(' ').Select(x => int.Parse(x)));

            var ans = a.Sum() - a.Count();

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13396
import heapq

N,M = (int(x) for x in input().split())
X = list(map(int, input().split()))
if N >= M:
    print('0')
else:
    heapq.heapify(X)
    t1 = heapq.heappop(X)
    diff = []
    for i in range(M-1):
        t2 = heapq.heappop(X)
        diff.append(t2-t1)
        t1 = t2
    heapq.heapify(diff)
    ans = 0
    for i in range(M-N):
        ans += heapq.heappop(diff)
    print(ans)

Measured memory_bytes: 20704
l = int(input())

p = 0
while True:
    if 2**p > l:
        p -= 1
        break
    else:
        p += 1
        
n = p+1
m = 2*p
ans = []
for i in range(1, n):
    ans.append([i, i+1, 0])
    ans.append([i, i+1, 2**(i-1)])
    
while l > 2**p:
    for i in range(n-1, 0, -1):
        if l-2**(i-1) >= 2**p:
            ans.append([i, n, l-2**(i-1)])
            l = l-2**(i-1)
            m += 1
            break

print(n, m)
for a in ans:
    print(' '.join(list(map(str, a))))


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

#define MAXN 100010
#define ll long long

using namespace std;

string s; 
int n;

int main() {
	scanf("%d", &n);
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		s[i] = ((s[i] + n - 65) % 26 + 65);
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
function Main(input) {
    input = input.trim().split("\n");
    var N = parseInt(input[0],10);

    var tmp = [];
    for(var i = 0; i < N; i++){
        tmp[i] = input[i+1].split(" ")[0] + (999 - parseInt(input[i+1].split(" ")[1],10)) + "," + (i+1);
    }
    tmp.sort();

    for(var i = 0; i < N; i++){
        console.log(tmp[i].split(",")[1]);
    }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    import os
    import re
    with open(__file__) as f:
        source = f.read().split('###''nbacl')
    for s in source[1:]:
        s = re.sub("'''.*", '', s)
        sp = s.split(maxsplit=1)
        if os.path.dirname(sp[0]):
            os.makedirs(os.path.dirname(sp[0]), exist_ok=True)
        with open(sp[0], 'w') as f:
            f.write(sp[1])
    from nbmodule import cc
    cc.compile()
import numpy as np
from numpy import int64
from nbmodule import solve


f = open(0)
N, M = [int(x) for x in f.readline().split()]
AB = np.fromstring(f.read(), dtype=int64, sep=' ').reshape((-1, 2))
ans = solve(N, AB)
print(ans)

'''
###nbacl nbmodule.py
import numpy as np
from numpy import int64
from numba import njit
from numba.types import i8
from numba.pycc import CC
import nbacl.dsu as dsu
cc = CC('nbmodule')


@cc.export('solve', (i8, i8[:, ::1]))
def solve(N, AB):
    t = np.full(N, -1, dtype=int64)
    for i in range(AB.shape[0]):
        dsu.merge(t, AB[i, 0] - 1, AB[i, 1] - 1)
    ret = 0
    for _ in dsu.groups(t):
        ret += 1
    return ret - 1

if __name__ == '__main__':
    cc.compile()

###nbacl nbacl/dsu.py
import numpy as np
from numpy import int64
from numba import njit


@njit
def dsu(t):
    t = -1


@njit
def merge(t, x, y):
    u = leader(t, x)
    v = leader(t, y)

    if u == v:
        return u

    if -t[u] < -t[v]:
        u, v = v, u

    t[u] += t[v]
    t[v] = u

    return u


@njit
def same(t, x, y):
    return leader(t, x) == leader(t, y)


@njit
def leader(t, x):
    if t[x] < 0:
        return x
    t[x] = leader(t, t[x])
    return t[x]


@njit
def size(t, x):
    return -t[leader(t, x)]


@njit
def groups(t):
    for i in range(t.shape[0]):
        if t[i] < 0:
            yield i

'''

Measured memory_bytes: 29748
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
//#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rev(i,b,a) for (ll i = b - 1; i >= a; i--)
#define all(v) v.begin(), v.end()
#define maxe(v) *max_element(v.begin(), v.end())
#define mine(v) *min_element(v.begin(), v.end())
#define pb push_back
#define pf push_front
#define rem 1000000007
#define cont continue
//#define minn 999999999
//#define maxx 0
int longest_palindrome_prefix(const string &s)
{
    string kmprev = s;
        std::reverse(kmprev.begin(), kmprev.end());
        string kmp = s + "#" + kmprev;

        vector<int> lps(kmp.size(), 0);   // lps[i] = longest suffix length for substring kmp[0..i] where the suffix == prefix
        for (int i = 1; i < (int)lps.size(); ++i)
        {
            int prev_idx = lps[i - 1];

            while (prev_idx > 0 && kmp[i] != kmp[prev_idx])
            {
                prev_idx = lps[prev_idx - 1];
            }

            lps[i] = prev_idx + (kmp[i] == kmp[prev_idx] ? 1 : 0);
        }

        // after KMP's LPS preprocessing, the last index of the LPS array will contain the longest palindrome prefix' length!
        return lps[lps.size() - 1];

}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin>>s;
    ll flag1=0,flag2=0,flag3=0;
    ll n=s.size();
    rep(i,0,n)
    {
        if( s[i]!=s[n-i-1] )
        {
            flag1=1;
            break;
        }
    }
    rep(i,0,(n-1)/2)
    {
        if( s[i]!=s[(n-1)/2-i-1] )
        {
            flag2=1;
            break;
        }
    }
    rep(i,n/2+1,n)
    {
        if( s[i]!=s[n-i-1] )
        {
            flag3=1;
            break;
        }
    }
    if( flag1==0 && flag2==0 && flag3==0 )
    {
        cout<<"Yes";
    }
    else 
    cout<<"No";
}


Measured memory_bytes: 256
#include<bitset>
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define rep1n(i, n) for(int i=1;i<=(int)(n);i++)
#define all(t) t.begin(), t.end()
#define rall(t) t.rbegin(), t.rend()
#define mat(type, row, col, init) vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout<<(cond? "Yes":"No")<<endl;
#define YES(cond) cout<<(cond? "YES":"NO")<<endl;
int main() {
	ll n, m;
	cin >> n >> m;
	ll ans;
	if (n > m)swap(n, m);
	if (n == 1) {
		if (m == 1) ans = 1;
		else ans = max((ll)0, m - 2);
	}
	else {
		if (n - 2 > 0 && m - 2 > 0) ans = max(0LL, (n - 2)*(m - 2));
		else ans = 0;
	}
	cout << ans << endl;

	return 0;
}





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

#define pb emplace_back
#define fi first
#define se second
#define m_p make_pair
#define vi vector<int>
#define pi pair<int, int>
#define mem(a,b) memset(a,b,sizeof(a))
#define el cout<<endl
#define sz(a) (int)a.size()
const int mod = (int)1e9+7;
typedef long long int ll;

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
const int N = (int)1e5+5;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int x,n;
	cin>>x>>n;
	int ans1=1000,ans2=1000, mn1=10000, mn2=10000;
	int b[105]={0};
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		b[a]++;
	}	
	for(int i=x;i>=0;i--){
		if(b[i]==0){
			ans1 = i;
			mn1 = abs(x-i);
			break;
		}
	}
	for(int i=x+1;i<=101;i++){
		if(b[i]==0){
			ans2 = i;
			mn2 = abs(x-i);
			break;
		}
	}
	if(mn1<mn2) cout<<ans1;
	else if(mn1>mn2) cout<<ans2;
	else cout<<min(ans1,ans2);
	el;
}

ll power(ll a,ll b, ll md=mod){
	ll r=1;
	while(b){
		if(b%2) 
			r=(r*a)%md;
		a=(a*a)%md;
		b>>=1;
	}
	return r;
}

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

int main()
{
    int n;
    int i, count = 0, ans;
    
    cin >> n;
    
    int a[n];
    
    for(i = 0; i < n; i++) {
        cin >> a[i];
    }
    
    sort(a, a+n);
    
    for(i = 0; i < n-1; i++) {
        if(a[i] == a[i+1]) {
            count++;
        }
    }
    
    if(count % 2 == 0) {
        ans = n - count;
    } else {
        ans = n - (count + 1);
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 640
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))



X, N = input_int()

P=many_int()

from collections import defaultdict
dicts = defaultdict(bool)
for p in P:
    dicts[p] = True



def serach(X, dicts):
    for i in range(100):
        min_val =X-i
        max_val = X+i
        
        if (not dicts[min_val]):
            return min_val
        if (not dicts[max_val]):
            return max_val
            



if X not in P:
    print(X)
else:
    print(serach(X, dicts))

Measured memory_bytes: 9468
def main():
    N = int(input())
    prices = []
    ans = 0
    for i in range(N):
        prices.append(int(input()))
    prices = sorted(prices)
    for j in range(N):
        if j == N-1:
            ans += prices[j]//2
        else:
            ans += prices[j]
    print(ans)
main()


Measured memory_bytes: 3060
#include<bits/stdc++.h>
//#include<tr1/unordered_map>
#pragma GCC optimize ("Ofast")
#define ll long long
#define pll pair<long long,long long>
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define forn(i, n) for(int i=0; i<int(n); i++)
#define Forn(i, n) for(int i=1; i<=int(n); i++)

using namespace std;

/*#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;*/

int main()
{
    cin.tie(0);ios_base::sync_with_stdio(false);
    int k;
    cin >> k;
    ll ans = 0;
    Forn(i, k) Forn(j, k) Forn(h, k)
    {
        ans += __gcd(__gcd(i, j), h);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3660
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <array>
#include <bitset>
using namespace std;

typedef long long ll;
const ll mod=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<n+1;i++)
int main(){
    int N;
    ll A,B,X,x;
    cin>>N;
    cin>>A>>B>>X;
    ll ans=0;
    
    rep(i,N-1) {
        cin>>x;
        ans+=min((x-X)*A,B);
        X=x;
    }
    cout<<ans<<endl;
    return 0;

}

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

vector<int> m;
int N, X;
int main() {
  cin >> N >> X;
  for(int i = 0; i < N; i++) {
    int mi; cin >> mi; m.push_back(mi);
  }
 
  int total = 0;
  for(int i = 0; i < N; i++) {
    X -= m[i];
    total++;
  }
  sort(m.begin(), m.end());
  while(true) { 
    X -= m[0];
    if(X < 0) break;
    total++;
  }
  cout << total << endl;
}

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

int n, i, j, k;
bool v[100005];
string a, b[4] = {"dream", "erase", "dreamer", "eraser"};
int main()
{
	cin >> a;
	v[a.size()] = 1;
	for (i = a.size() - 1; i >= 0; i--) {
		for (j = 0; j < 4; j++) {
			if (i + b[j].size() > a.size()) continue;
			if (a.substr(i, b[j].size()) == b[j] && v[i + b[j].size()]) break;
//			for (k = 0; k < b[j].size(); k++) {
//				if (a[i + k] != b[j][k]) break;
//			}
//			if (k == b[j].size() && v[i + b[j].size()]) break;
		}
		if (j < 4) v[i] = 1;
	}
	cout << (v[0] ==1 ? "YES" : "NO");
    return 0;
}


Measured memory_bytes: 512
// Copyright (C) 2017 Sayutin Dmitry.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; version 3

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; If not, see <http://www.gnu.org/licenses/>.

#include <iostream>
#include <vector>
#include <stdint.h>
#include <algorithm>
#include <set>
#include <map>
#include <array>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <string>
#include <assert.h>
#include <iterator>
#include <cstdint>
#include <cinttypes>
#include <string.h>
#include <random>
#include <numeric>
#include <tuple>


using std::cin;
using std::cout;
using std::cerr;

using std::vector;
using std::map;
using std::array;
using std::set;
using std::string;

using std::pair;
using std::make_pair;

using std::min;
using std::abs;
using std::max;

using std::unique;
using std::sort;
using std::generate;
using std::reverse;
using std::min_element;
using std::max_element;

#ifdef LOCAL
#define LASSERT(X) assert(X)
#else
#define LASSERT(X) {}
#endif

template <typename T>
T input() {
    T res;
    cin >> res;
    LASSERT(cin);
    return res;
}

template <typename IT>
void input_seq(IT b, IT e) {
    std::generate(b, e, input<typename std::remove_reference<decltype(*b)>::type>);
}

#define SZ(vec)         int((vec).size())
#define ALL(data)       data.begin(),data.end()
#define RALL(data)      data.rbegin(),data.rend()
#define TYPEMAX(type)   std::numeric_limits<type>::max()
#define TYPEMIN(type)   std::numeric_limits<type>::min()

#define pb push_back
#define eb emplace_back


int main() {
    std::iostream::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    
    // code here.
    int n = input<int>();
    int k = input<int>();

    vector<pair<int, int>> lst(n);
    for (int i = 0; i != n; ++i) {
        lst[i].first = input<int>();
        lst[i].second = input<int>();
    }

    int64_t ans = 0;
    for (int i = 30; i >= 0; --i)
        if (k & (1 << i)) {
            int mask = k;
            mask ^= (1 << i);
            mask |= ((1 << i) - 1);

            int64_t res = 0;
            for (auto p: lst)
                if ((p.first & mask) == p.first)
                    res += p.second;
            ans = max(ans, res);
        }

    int64_t res = 0;
    for (auto p: lst)
        if ((p.first & k) == p.first)
            res += p.second;
    ans = max(ans, res);
    
    cout << ans << "\n";
    
    return 0;
}


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

int main() {
  int A, B ,C ,D;
  cin >> A >> B >> C >> D;
  if ((A+B) > (C+D)) {
    cout << "Left" << endl;
  }
  else if((A+B) == (C+D)){
    cout << "Balanced" << endl;
  }
  else{
    cout << "Right" << endl;
  }
}


Measured memory_bytes: 256
#Bellman-FordだとTLEになる(はず)
V,E,r = map(int, input().split())
edges = []
for _ in range(E):
    tmp = [int(x) for x in input().split()]
    edges.append(tmp)

d = [float('inf') for _ in range(V)]
d[r] = 0

for _ in range(V-1):
    count = 0
    for x in edges:
        s,t,w = x
        if d[t] > d[s] + w:
            count += 1
            d[t] = d[s] + w
    if count == 0:
        break

for x in d:
    if x == float('inf'):
        print('INF')
    else:
        print(x)


Measured memory_bytes: 108672
// Copyright 2019 yaito3014
#include "bits/stdc++.h"
using namespace std;

int main() {
  cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false);
  string S, T, U;
  int A, B;
  cin >> S >> T;
  cin >> A >> B;
  cin >> U;
  if (S == U)--A;
  else --B;
  cout << A << " " << B << endl;
}

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

int main() {
  int a, b, c, k; std::cin >> a >> b >> c >> k;
  int sum = 0;
  sum += std::min(a, k);
  k = std::max(k-a, 0);
  k = std::max(k-b, 0);
  sum -= std::min(c, k);
  std::cout << sum << std::endl;
  
  return 0;
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define ENDL '\n'
#define all(a) begin(a), end(a)
#define sz(a) (int)(a.size())
#define deb(a) cout << #a << ": " << a << ENDL;
#define fore(i, a, b) for(int i(a), ThkMk(b); i < ThkMk; ++i)
#define _ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

typedef long long lli;
typedef pair<lli, lli> ii;
typedef long double ld;
typedef vector<lli> vi;

int main()
{   _
    int h, w, k; cin >> h >> w >> k;
    vector<string> mat(h); fore(i, 0, h) cin >> mat[i];
    int ans = 0;
    fore(i, 0, (1 << (h))) {
        fore(j, 0, (1 << (w))){
            int cnt = 0;
            fore(r, 0, h) {
                if((1 << r) & i) continue;
                fore(c, 0, w) {
                    if((1 << c) & j) continue;
                    cnt += mat[r][c] == '#';
                }
            }
            ///deb(cnt);
            ans += cnt == k;
        }
    }
    cout << ans << ENDL;
    return 0;
}


Measured memory_bytes: 3652
l = [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]
print(l[int(input()) -1])

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<deque>
#include<cmath>
#define rep(i,n) for(int i = 0;i<n;i++)
#define _GLIBCXX_DEBUG
using ll = long long; 
using namespace std;

int main() {
    string s;
    cin >> s;
    int n = s.size()-1;
    long long ans = 0;
    for(int bit = 0;bit<(1<<n);bit++) {
        long long tmp = 0;
        for(int i = 0;i<n;i++) {
            tmp *= 10;
            tmp += s[i] - '0';
            if(bit & (1<<i)) ans += tmp,tmp = 0;
        }
    tmp *= 10;
    tmp += s.back() - '0';
    ans += tmp;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;

int main(){
    int N;cin>>N;
    map<int,int> mp;
    int A;
    for(int i=0;i<N;i++){
        cin>>A;
        mp[A-1]++;mp[A]++;mp[A+1]++;
    }
    int ans=0;
    for(auto itr=mp.begin();itr!=mp.end();itr++)
        ans=max(ans,itr->second);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4736
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

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

template<typename T>
map<T, T> primeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

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;
}


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)


int main() {
	ll n, m,ans=0;
	cin >> n >> m;
	if (n >= m) {
		outn(0);
		return 0;
	}

	vll x(m);
	vector < pair<ll, vll> > y(m-1);
	rep(i, 0, m) {
		cin >> x[i];
	}
	sort(x.begin(), x.end());

	rep(i, 0, m - 1) {
		vll tmp(2);
		tmp[0] = x[i];
		tmp[1] = x[i + 1];
		y[i] = make_pair(x[i + 1] - x[i], tmp);
	}

	sort(y.begin(), y.end());
	rep(i, 0, m - n) {
		ans += y[i].second[1] - y[i].second[0];
	}


	outn(ans);

	return 0;

}


Measured memory_bytes: 7296
import java.io.BufferedReader
import java.io.BufferedWriter

fun solve(c: Case) {
    val (d, t, s) = c.intList()
    c.println(if (d <= t * s) "Yes" else "No")
}

class Case(
    private val input: BufferedReader = System.`in`.bufferedReader(),
    private val out: BufferedWriter = System.out.bufferedWriter()
) {
    fun exec(fn: (Case) -> Unit) =
        input.use { out.use { Thread(null, { fn(this) }, "solve", 64 * 1024 * 1024).also { it.start() }.join() } }

    fun println(c: CharSequence?) = out.appendln(c)
    fun string(): String = input.readLine().trimEnd()
    fun long(): Long = input.readLine().toLong()
    fun intList(): List<Int> = input.readLine().split(" ").map { it.toInt() }
    fun longList(): List<Long> = input.readLine().split(" ").map { it.toLong() }
}

fun main() = Case().exec(::solve)


Measured memory_bytes: 36748
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import kotlin.math.max

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val n = readInteger()
    val dList = readIntegerList()
    val dMap = elementCountMap(dList)

    val m = readInteger()
    val tList = readIntegerList()
    val tMap = elementCountMap(tList)

    for (e in tMap) {
        val dCount = dMap.getOrDefault(e.key, 0)
        if (dCount < e.value) {
            out.print("NO")
            return
        }
    }
    out.println("YES")
}

/** O(n) */
fun <T>elementCountMap(list: List<T>): Map<T, Int> {
    val countMap = mutableMapOf<T, Int>()
    for (e in list) {
        countMap[e] = (countMap[e] ?: 0) + 1
//        countMap.merge(e, 1) { oldValue, value -> oldValue + value }
    }
    return countMap
}


fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


Measured memory_bytes: 88292
#include <iostream>
using namespace std;
static const int64_t MOD = 1e9 + 7;
template<class T>
T pow(T x, T n, const T& p) {
    T ret = 1;
    while (n > 0) {
        if (n & 1) ret = (ret * x) % p;
        x = (x * x) % p;
        n >>= 1;
    }
    return ret;
}
template <class T>
T comb(T a, T b, const T& p) {
    T ret = 1;
    for (T i = b; i >= 1; i--) ret = (ret * i) % p;
    ret = pow(ret, p - 2, p);
    for (T i = a; i >= a - b + 1; i--) ret = (ret * i) % p;
    return ret;
}
int main() {
    int64_t n, a, b;
    cin >> n >> a >> b;
    auto t = pow((int64_t)2, n, MOD) - comb(n, a, MOD) - comb(n, b, MOD) - 1;
    while (t < 0) t += MOD;
    cout << t << endl;
}

Measured memory_bytes: 256
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import minimum_spanning_tree

N, *XY = map(int, open(0).read().split())

XY = list(enumerate(zip(*[iter(XY)] * 2)))
X = sorted(XY, key=lambda x: x[1][0])
Y = sorted(XY, key=lambda x: x[1][1])

E = {(i1, i2, min(abs(x1 - x2), abs(y1 - y2))) for (i1, (x1, y1)), (i2, (x2, y2)) in zip(X, X[1:])} \
  | {(i1, i2, min(abs(x1 - x2), abs(y1 - y2))) for (i1, (x1, y1)), (i2, (x2, y2)) in zip(Y, Y[1:])}

R, C, V = zip(*E)
G = csr_matrix((V, (R, C)), shape=(N, N))

ans = minimum_spanning_tree(G, overwrite=True).astype(int).sum()
print(ans)

Measured memory_bytes: 91724
import Data.List
import Data.Array.Unboxed
import Debug.Trace
import Data.ByteString.Char8 as BC (words, getLine, readInt)
import Data.Maybe (fromJust)

main = do
  n <- fst . fromJust . BC.readInt <$> BC.getLine
  a <- sort . map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
  b <- sort . map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
  c <- sort . map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
  let arrA = listArray (0, n-1) a :: UArray Int Int
      arrC = listArray (0, n-1) c :: UArray Int Int
  print $ count arrA arrC b

count :: UArray Int Int -> UArray Int Int -> [Int] -> Int
count a c b = sum $ map (\x -> (lt a x) * (gt c x)) b

lt :: UArray Int Int -> Int -> Int
lt a b = (+1) $ upperBound b a

gt :: UArray Int Int -> Int -> Int
gt a b = ((+1) . snd . bounds $ a) - (lowerBound b a)

--[lb, ub) x未満のmax
upperBound :: Int -> UArray Int Int -> Int
upperBound x xs = innerUB (0-1) ((+1) . snd $ bounds xs) x xs

innerUB :: Int -> Int -> Int -> UArray Int Int -> Int
innerUB lb ub x xs
  | ub - lb > 1 = let mid = lb + (ub - lb) `div` 2
                   in if (xs ! mid) < x then innerUB mid ub x xs
                                        else innerUB lb mid x xs
  | otherwise   = lb

--(lb, ub] xより大きいmin
lowerBound :: Int -> UArray Int Int -> Int
lowerBound x xs = innerLB (0-1) ((+1) . snd $ bounds xs) x xs

innerLB :: Int -> Int -> Int -> UArray Int Int -> Int
innerLB lb ub x xs
  | ub - lb > 1 = let mid = lb + (ub - lb) `div` 2
                   in if (xs ! mid) > x then innerLB lb mid x xs
                                        else innerLB mid ub x xs
  | otherwise   = ub


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

typedef long long int ll;
typedef long double ld;

//****************************************************                
#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define rlp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll,ll> 
#define vpll vector<pll>
#define all(X) X.begin(),X.end()
#define endl "\n" //comment it for interactive questions
#define trace1(a) cerr << #a << ": " << a << endl;
#define trace2(a,b) cerr << #a << ": " << a << " " << #b << ": " << b << endl;
#define trace3(a,b,c) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << endl;
#define trace4(a,b,c,d) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << #d << ": " << d << endl;
#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
        //*******************************************************
//Some Functions

const ll MOD = (ll)1e9+7; //change it for other mods

ll powmod(ll a,ll b)
{
   ll res = 1;
   while(b > 0) {
      if(b & 1) res = (res * a) % MOD;
      a = (a*a)%MOD;
      b = b >> 1; 
  }
  return res % MOD;
}

void solve(ll testnum)
{
    ll n,x,t;
    cin >> n >> x >> t;
    cout << ((n + x - 1)/x)*t << "\n"; 
}

int main()
{
    FAST_IO;
    #ifdef STIO 
      freopen("input.txt" , "r", stdin);
      freopen("output.txt" , "w", stdout);
    #endif
    ll t = 1;
    // cin >> t;
    for (ll i = 1; i <= t; i++) {
        // cout << "Case #" << i << ": ";
        solve(i);
    }
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

#define MAX_V 1000000

const int MAX_L = 1000001;
const int MAX_SQRT_B = 1000001;
bool is_prime_array[MAX_L];
bool is_prime_small[MAX_SQRT_B];

map<int, int> res;
bool is_prime(int n) {
	for(int i = 2; i * i <= n; i++) {
		if(n % i == 0) return false;
	}
	return n != 1;
}

void prime_factor(int n) {
	for(int i = 2; i * i <= n; i++) {
		while(n % i == 0) {
			++res[i];
			n /= i;
		}
	}
	if(n != 1) res[n]++;
}

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

	int N;
	cin >> N;
	rep(i, 2, N + 1) prime_factor(i);
	int d[5];
	memset(d, 0, sizeof(d));

	for(map<int, int> :: iterator it = res.begin(); it != res.end(); it++) {
		if(it->second >= 2) d[0]++;
		if(it->second >= 4) d[1]++;
		if(it->second >= 14) d[2]++;
		if(it->second >= 24) d[3]++;
		if(it->second >= 74) d[4]++;
	}

	ll rsl = 0;
	rsl += d[4];
	rsl += (d[3] * (d[0] - 1));
	rsl += (d[2] * (d[1] - 1));
	rsl += (((d[1] * (d[1] - 1)) / 2) * (d[0] - 2));

	cout << rsl << endl;

}


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

static const int INF = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

map<int, int> prime_factor(int n, map<int, int> &ret)
{
    for(int i = 2; i * i <= n; i++){
        while(n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if(n != 1) ret[n]++;
    return(ret);
}
int main() {
    int n;
    cin >> n;
    map<int, int> p;
    for (int i = 2; i <= n; ++i) {
        prime_factor(i, p);
    }
    ll ans = 1;
    for (auto &&x : p) {
        ans = (ans * (x.second+1)) % INF;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		int h = sc.nextInt();
		int w = sc.nextInt();
		int[][] board = new int[h][w];
		for(int i = 0; i < h; i++) {
			String s = sc.next();
			for(int j = 0; j < w; j++) {
				board[i][j] = (s.charAt(j) == '#') ? 1 : 0;
			}
		}
		int cnt = 0;
		for(int y = 0; y < h; y++) {
			for(int x = 0; x < w; x++) {
				if(board[y][x] == 1) {
					cnt++;
				}
			}
		}
		if(cnt == h+w-1) {
			System.out.println("Possible");
		} else {
			System.out.println("Impossible");
		}
	}
}


Measured memory_bytes: 35620
#include <cstdio>
#include <algorithm>
#include <map>
using namespace std;
int n;
map<int,int> m;
int main(){
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        int a;
        scanf("%d",&a);
        m[a]++;
    }

    int ans = 0;
    for(auto p : m){
        ans += p.second - (p.first <= p.second ? p.first : 0);
    }
    printf("%d\n", ans);

}


Measured memory_bytes: 4736
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    int s;
    cin >> s;
    int h = s / 3600;
    int m = (s - h * 3600) / 60;
    int sec = s % 60;
    cout << h << ":" << m << ":" << sec << "\n";

    return 0;
}


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

char wc(int n) {
  char c;
  if(n>12)
    c = 'N';
  else if(n>0)
    c = 'A';
  else
    c = 'N';
  return c;
}

int main() {
  string S;
  int a,b;
  char wa, wb;
  cin >> S;
  a = (S[0]-'0')*10 + (S[1]-'0');
  b = (S[2]-'0')*10 + (S[3]-'0');
  wa = wc(a);
  wb = wc(b);
  
  if(wa=='A' && wb=='A')
    cout << "AMBIGUOUS";
  else if(wa=='A' && wb=='N')
    cout << "MMYY";
  else if(wa=='N' && wb=='A')
    cout << "YYMM";
  else
    cout << "NA";
  cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}

long long gcd(long long a, long long b) {return b ? gcd(b, a % b) : a;}
long long lcm(long long m, long long n ){if((0 == m )||( 0 == n ))return 0;
    return ((m / gcd(m, n)) * n);
}
signed main(){
    int n,x; cin >> n >> x;
    vector<int>v(n);
    erep(e,v) cin >> e;
    int ans = 1;
    if(n == 1){
        cout << abs(x - v.back()) << endl;
        return 0;
    }
    v.push_back(x);
    sort(all(v));
    vector<int>dp;
    rep(i,v.size())if(i)dp.push_back(v[i]- v[i-1]);
    rep(i,dp.size())if(i)ans = gcd(ans,dp[i]); else ans = dp[i];
    cout << ans << endl;
}




Measured memory_bytes: 2800
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

public class Main {
    public void solve(BufferedReader stdin, PrintWriter stdout) throws NumberFormatException, IOException {
        int n = Integer.parseInt(stdin.readLine());
        long[] a = Pattern.compile(" ").splitAsStream(stdin.readLine()).mapToLong(Long::parseLong).toArray();

        long[] c = new long[n + 1];
        for (int i = 0; i < n; i++) c[i + 1] = c[i] + a[i];
        Map<Long, Long> d = Arrays.stream(c).boxed().collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
        long ans = d.values().stream().mapToLong(v -> v * (v - 1) / 2).sum();
        stdout.println(ans);
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter stdout = new PrintWriter(System.out, false);
        new Main().solve(stdin, stdout);
        stdout.flush();
    }
}


Measured memory_bytes: 57316
/*input
ULURU
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define sz(_a) (ll)(_a.size())
#define FILL(n) memset(n,0,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
const ll maxn=100005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;

ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}
ll sub(ll x,ll y){
    return (x % MOD - y % MOD + MOD) % MOD;
}
ll mult(ll a,ll b) 
{ 
    return ((a%MOD)*(b%MOD))%MOD;
} 

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string a;
    cin>>a;
    bool wk=true;
    REP(i,a.length()){
        if(i%2==0 and a[i]=='L') wk=false;
        if(i%2==1 and a[i]=='R') wk=false;
    }
    if(wk) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 256
n = int(input())
xy = [[] for _ in range(n)]
for i in range(n):
    a = int(input())
    for j in range(a):
        x,y = map(int, input().split())
        xy[i].append([x - 1, y])

def A(s):
    count = 0
    for j in range(n):
        if s[j] == 1:
            count += 1
            for k in range(len(xy[j])):
                if s[xy[j][k][0]] != xy[j][k][1]:
                    return 0
    return count

ans = 0

for i in range(2 ** n):
    ss = []
    for h in range(n):
        if ((i >> h) & 1):
            ss.append(1)
        else:
            ss.append(0)
    ans = max(ans, A(ss))

print(ans)

Measured memory_bytes: 48220
n = int(input())
t_point = 0
h_point = 0
for i in range(n):
    t_card, h_card = input().split()
    if t_card > h_card:
        t_point += 3
    elif t_card < h_card:
        h_point += 3
    elif t_card == h_card:
        t_point += 1
        h_point += 1
    else:
        pass
print("{} {}".format(t_point, h_point))


Measured memory_bytes: 5600
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std; using ll=long long; const ll LNF=1e18; const int INF = 1e9+1; const ll M = 1e9+7;
typedef pair<int,int> P;

int main() {
  int n; ll k; cin>>n>>k;
  int a[n]; for(int i=0;i<n;i++){cin>>a[i]; a[i]--;}

  ll pc[n]; fill(pc,pc+n,-1); pc[0]=0;
  int ii = 0, jj=a[0], tt = 1;
  while(pc[jj]==-1) {
    //cout <<ii<<" "<<jj<<endl;
    if (tt == k) {
      cout<<jj+1<<endl;
      return 0;
    }
    pc[jj]=tt, ii=jj, jj=a[jj];
    tt++;
  }
  //cout<<ii<<" " <<jj<<endl;
  if (tt == k) {
    cout<<jj+1<<endl;
    return 0;
  }
  if (ii == jj) {
    cout << ii+1 << endl;
    return 0;
  }
  //for(int i=0;i<n;i++) cout<<pc[i]<<" "; cout <<endl;
  
  ll o = pc[ii] - pc[jj] + 1;
  ll p = pc[jj];
  k -= p; k %= o;
  /*
  cout << p << " + " << o << " * x"<< endl;
  for(int kk=p;kk<20;kk++) {
    k=kk;
    k -= p;
    k %= o;
    cout << "@" << k <<":";
    int j=jj;
    for(int i=0;i<k;i++) {
      j=a[j];
    }
    cout<<j+1<<" ";//endl;
  }
  */


  //cout << o << " " << pc[ii] << " " << pc[jj] <<" "<<k<<" "<<ii<<" "<<jj<< endl;

  int j=jj;
  for(int i=0;i<k;i++) {
    j=a[j];
  }
  cout<<j+1<<endl;
  
}

Measured memory_bytes: 5980
#include <iostream>
#include <vector>
#include <cmath>

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

using namespace std;

int main() {
    string s;
    cin >> s;
    if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3])cout << "Bad";
    else
    {
        cout << "Good";
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;
typedef pair<int,int> pii;
vector<vector<pii> > G;
int depth[100100];
int color[100100];

int dfs(int v,int p,int d){
    depth[v]=d;
    if(d%2==0)color[v]=0;
    else color[v]=1;
     
    for(int i=0;i<G[v].size();i++){
        if(G[v][i].first==p)continue;
        dfs(G[v][i].first,v,d+G[v][i].second);
    }
}

int main(){
    int N;cin >> N;
    G.resize(N);
    rep(i,N-1){
        int u,v,w;cin >> u >> v >> w;
        u--;v--;

        G[u].push_back(make_pair(v,w));
        G[v].push_back(make_pair(u,w));
    }
    dfs(0,-1,0);
    rep(i,N)cout << color[i] << endl;
    return 0;
}

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

int a[200010];

int main()
{
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        for(int i=1;i<=n;i++)
            scanf("%d",&a[i]);

        if(n%2)
        {
            for(int i=n;i>=1;i-=2)
            {
                printf("%d ",a[i]);
            }
            for(int i=2;i<=n;i+=2)
            {
                printf("%d ",a[i]);
            }
            printf("\n");
        }
        else
        {
            for(int i=n;i>=1;i-=2)
            {
                printf("%d ",a[i]);

            }
            for(int i=1;i<=n;i+=2)
            {
                printf("%d ",a[i]);
            }
                        printf("\n");

        }
    }
}


Measured memory_bytes: 2944
from fractions import gcd

A, B, C, D = map(int, input().split())
C_div = B // C - (A - 1) // C
D_div = B // D - (A - 1) // D
CD = C * D // gcd(C, D)
CD_div = B // CD - (A - 1) // CD
print(B - A + 1 - C_div - D_div + CD_div)


Measured memory_bytes: 66156
N = int(input())
A = list(map(int, input().split()))
flag = True

for i in range(N):
    if A[i] % 2 == 0 and (A[i] % 3 != 0 and A[i] % 5 != 0):
        flag = False
        break

print("APPROVED" if flag else "DENIED")

Measured memory_bytes: 3060
from sys import stdin

n, m = list(map(int, stdin.readline().rstrip().split()))
stack = set(range(1, m+1))
for i in range(n):
	a = list(map(int, stdin.readline().rstrip().split()))
	k = a.pop(0)
	stack = set(a) & stack

print(len(stack))

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin>>s;
    s = "0"+s;
    int d0=0,d1=1e8;
    string t;
    RFOR(i,s.size()-1,0){
        int ld0 = d0;
        int ld1 = d1;
        d0 = INT_MAX;
        d1 = INT_MAX;
        int d = s[i]-'0';
        rep(j,10){
            if (j<d){
                chmin(d1,ld0+2*j+10-d);
            }else{
                chmin(d0,ld0+2*j-d);
            }
            if (j-1<d){
                chmin(d1,ld1+2*j+9-d);
            }else{
                chmin(d0,ld1+2*j-1-d);
            }
        }
    }
    cout<<min(d0,d1)<<endl;
    return 0;
}


Measured memory_bytes: 2332
#include <iostream>

int main() {
    int a, b;

    std::cin >> a >> b;

    if (a > b) {
        if (b == 1) {
            std::cout << "Bob\n";
        }
        else {
            std::cout << "Alice\n";
        }
    }
    else if (a < b) {
        if (a == 1) {
            std::cout << "Alice\n";
        }
        else {
            std::cout << "Bob\n";
        }
    } else {
        std::cout << "Draw\n";
    }
    return 0;
}


Measured memory_bytes: 256
S = input()

Z = []
X = len(S)

i = 0
while i  < X :
    if S[i] == "0":
        Z.append(0)
    elif S[i] == "1":
        Z.append(1)
    elif S[i] == "B":
        if len(Z)== 0:
            pass
        else:
            Z.pop()
    i += 1

i = 0
X = len(Z)
while i < X:
    print(Z[i] , end ="")
    i +=1

Measured memory_bytes: 9108
n, a, b, c = map(int, input().split())
l = [int(input()) for _ in range(n)]
INF = 10 ** 9

# 足し算の可換性を用いる（延長/短縮 と合成は順序によらない）
# 合成を先にし 延長/短縮 は後でやる
# n本の竹に対し「a/b/cに使う + 使わない」の4パターンがある
# 4^8 = 65536


def dfs(l_index, aa, bb, cc):
    # 終端処理
    if l_index == n:
        return abs(a - aa) + abs(b - bb) + abs(c - cc) \
               - 30 if min(aa, bb, cc) > 0 else INF
    # -30するのは最初の1本目の合成のペナルティを余分に足してたから
    rtrn0 = dfs(l_index + 1, aa, bb, cc)
    rtrn1 = dfs(l_index + 1, aa + l[l_index], bb, cc) + 10
    rtrn2 = dfs(l_index + 1, aa, bb + l[l_index], cc) + 10
    rtrn3 = dfs(l_index + 1, aa, bb, cc + l[l_index]) + 10
    return min(rtrn0, rtrn1, rtrn2, rtrn3)


print(dfs(0, 0, 0, 0))


Measured memory_bytes: 3064
def main():
    s = input()
    
    ans = 0
    for i in range(len(s)):
        cur = 0
        for j in range(i, len(s)):
            if s[j] in {'A', 'C', 'G', 'T'}:
                cur += 1
            else:
                break
                
            ans = max(cur, ans)
    
    print(ans)
    
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
#include <iostream>
#include <queue>
#include <climits>
#include <cstdlib>
#define H 60
#define W 30
#define SC signed char
#define INF INT_MAX
#define GOAL 10
#define LABEL_X -1
#define DEBUG false
using namespace std;

int cost[H][W];
SC s[H][W];

int mv[9][2] = { // 右足の移動範囲( isL=falseの時 )
  {1,-2},{1,-1},{1,0},{1,1},{1,2},
  {2,-1},{2,0},{2,1},
  {3,0}
};

int w,h;
struct P{
  SC lx,ly, rx,ry;
  bool isL; // 左足を動かすしたあとtrue
  int cost; // 経過時間
};

void pr(P p ){
  cout << "("<<(int)p.lx<<","<<(int)p.ly<<") ("
       <<(int)p.rx<<","<<(int)p.ry<<") "
       << "cost=" << p.cost;
  if( p.isL ) cout << " left" << endl;
  else        cout << " right"<< endl;
}
void prCost(){
  for( int i=0;i<h;i++ ){
    for( int j=0;j<w;j++ ){
      cout.width(11);
      cout << cost[i][j];
    }
    cout << endl;
  }
}


int main(){
  queue<P> qu;
  P p, q;

  while( cin>>w >> h && (h||w) ){
    p.lx=SCHAR_MAX; p.ly=SCHAR_MAX;
    p.isL=true; p.cost=0;

    while( !qu.empty() ) qu.pop();

    for( int i=0;i<h;i++ )
      for( int j=0;j<w;j++ )
	cost[i][j] = INT_MAX;



    for( int i=0;i<h;i++ )
      for( int j=0;j<w;j++ ){
	char c;
	cin >> c;
	switch( c ){
	case 'S' : s[i][j] = 0;
	  p.rx=j; p.ry=i; p.lx=-1; p.isL=false;
	  qu.push( p );
	  p.lx=j; p.ly=i; p.rx=-1; p.isL=true;
	  qu.push( p );
	  break;
	case 'T' : 
	  s[i][j] = GOAL;
	  break;
	case 'X' : s[i][j] = LABEL_X; break;
	default :  s[i][j] = c-'0';   break;
	}
      }

    int ans=INT_MAX, x,y;
    while( !qu.empty() ){
      p=qu.front(); qu.pop();
      //      pr( p );

      if( p.lx==p.rx && p.ly==p.ry ) continue;

      if( p.isL ){ x=p.lx; y=p.ly; }
      else {       x=p.rx; y=p.ry; }

      if( x<0 || x>=w ) continue;
      if( y<0 || y>=h ) continue;

      if( s[y][x]==LABEL_X ) continue; // 'X'
      
      // goal
      if( s[y][x]==GOAL ){
	if( ans > p.cost ){
	  ans = p.cost;
	  if( DEBUG ){
	    cout << "*************************"<< endl;
	    pr( p );
	  }
	}
	continue;
      }

      p.cost += s[y][x];
      if( p.isL ){ // 左足をs[y][x] に置いたときの最小コスト
	if( p.cost >= cost[y][x] ) continue;
	cost[y][x] = p.cost;
      }

      if( DEBUG ){
	pr( p );
	prCost();
      }
      q=p;
      if( p.isL ){ // 次に右足を動かす
	q.isL=false;
	for( int i=0;i<9;i++ ){
	  q.rx = x + mv[i][0];
	  q.ry = y + mv[i][1];
	  qu.push( q );
	}
      }else{     // 次に左足を動かす
	q.isL=true;
	for( int i=0;i<9;i++ ){
	  q.lx = x - mv[i][0];
	  q.ly = y + mv[i][1];
	  qu.push( q );
	}
      }
    }
    if( ans==INT_MAX ) ans = -1;
    cout << ans << endl;

    //    break;

  }
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#include <time.h>
using namespace std;
#include <math.h>
// to increase precision
// std::cout<<std::fixed;
// 	std::cout<<std::setprecision(6)<<z;
//clock_t tStart = clock();
//printf("Time taken: %.9fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
#define maxn 100000

#define ll long long int



int main(){
	int n;
	cin>>n;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	int i=0;
	long long int mon=1000;
	while(i<n-1){
		while(i+1 < n && a[i]>=a[i+1]){
			i++;
		}
		long long int st=mon/a[i];
		int res= mon-st*a[i];
		while(i+1 < n && a[i+1] >=a[i]){
			i++;
		}
		mon=(res+st*a[i]);
	}

	cout<<mon<<endl;

}


Measured memory_bytes: 3624