akhauriyash/Code-Regression huggingface dataset:
// abc167_f
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N;
    cin >> N;
    vector<string> S(N);
    REP(i, N) cin >> S[i];

    vector<P> A; // (((, )(((
    vector<P> B; // ))), )))(
    REP(i, N){
        int l=0, r=0; // ), (
        REP(j, S[i].size()){
            if (S[i][j] == '('){
                r++;
            } else {
                if (r > 0){
                    r--;
                } else{
                    l++;
                }
            }
        }
        if (r - l > 0){
            A.emplace_back(l, r);
        } else {
            B.emplace_back(r, l);
        }
    }

    sort(ALL(A));
    sort(ALL(B));

    // ), (
    int tmp = 0; // (( が何
    REP(i, A.size()){

        if (A[i].first > tmp){ // (( を　)) が超えたらだめ
            print("No");
            return 0;
        }
        tmp += A[i].second - A[i].first; // ()))
//        print(i, A[i], tmp);
    }

    // (, )
    int tmp2 = 0;
    REP(i, B.size()){

        if (B[i].first > tmp2){ // )) を　(( が超えたらだめ
            print("No");
            return 0;
        }
        tmp2 += B[i].second - B[i].first; // ()))
//        print(i, B[i], tmp);
    }

    if (tmp == tmp2){
        print("Yes");
    } else {
        print("No");
    }

//    ll r = 0;
//    ll l = 0;
//    REP(i, N){
//
//
//        if (A[i].first == 0){  // ( だけ
//            r += A[i].second;
//        } else if (A[i].second == 0)  {// ) だけ
//            l += A[i].first;
//        } else {
//
//        }
//    }

    return 0;
}


Measured memory_bytes: 42448
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <set>
#include <queue>
#include <map>
#include <numeric>
using namespace std;
typedef long long int ll;

ll mod=1e9+7;

ll mod_pow(ll a,ll b){
	a%=mod;
	if(b==0)return 1;
	if(b==1)return a;
	ll res=mod_pow(a,b/2)%mod;
	res*=res; res%=mod;
	if(b%2)res*=a;
	return res%mod;
}

struct perm{
private:
	int sz;
	vector<ll> p,invp;
public:
	perm(int n){
		sz=n+1;
		p.resize(sz),invp.resize(sz);
		p[0]=1;
		for(int i=1;i<=sz-1;i++){
			p[i]=p[i-1]*i%mod;
		}
		invp[sz-1]=mod_pow(p[sz-1],mod-2);
		for(int i=sz-2;i>=0;i--){
			invp[i]=invp[i+1]*(i+1)%mod;
		}
	}
	ll comb(ll x,ll y){
		if(x<y||y<0)return 0;
		return (p[x]*invp[x-y]%mod)*invp[y]%mod;
	}
};
perm p(1e7);

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	if(a[0]){
		cout << -1 << endl;
		return 0;
	}
	for(int i=0;i<n-1;i++){
		if(a[i+1]-a[i]>1){
			cout << -1 << endl;
			return 0;
		}
	}
	ll ans=0;
	for(int i=0;i<n-1;i++){
		if(a[i+1]-a[i]==1){
			ans++;
		}
		else{
			ans+=a[i+1];
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 157440
s = list(input())
t = list(input())
S = len(s)
T = len(t)

dp = [[0] * (S+1) for _ in range(T+1)]

for i in range(T):
    for j in range(S):
        if s[j] == t[i]:
            dp[i+1][j+1] = dp[i][j] + 1
        else:
            dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1])


ans = []

while T != 0 and  S != 0:
    if dp[T][S] != dp[T-1][S]:
        if dp[T][S] != dp[T][S-1]:
            ans.append(s[S-1])
            T -= 1
            S -= 1
        else:
            S -= 1
    else:
        T -= 1

    
print("".join(ans[::-1]))


Measured memory_bytes: 112348
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
class Range {
    using T = long long;
    class Iterator {
        T val, step, diff;
    public:
        Iterator(T v, T s, T d): val(v), step(s), diff(d) {}
        T operator*() { return val + diff; }
        bool operator!=(const Iterator &itr) { return step > 0 ? val < itr.val : val > itr.val; }
        Iterator operator++() { val += step; return *this; }
    };
    Iterator _begin, _end;
public:
    Range(T b, T e, T s, T d): _begin(b, s, d), _end(e, s, d) {
        if (s < 0) { _begin = Iterator(e - 1, s, d); _end = Iterator(b - 1, s, d); }
    }
    Range(T b, T e, T s): Range(b, e, s, 0) {}
    Range(T b, T e): Range(b, e, 1, 0) {}
    Range(T e): Range(0, e, 1, 0) {}
    Iterator begin() { return _begin; }
    Iterator end() { return _end; }
};
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s, t;
    cin, s, t;
    cout << (s == t.substr(0, t.size() - 1) ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 3652
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
 
static const double EPS = 1e-8;

static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

// <TREE> := (<LEAF><OPE><LEAF>)
// <LEAF> := (<TREE>) | <NUMBER>

P tree(const string& expr,int sweets[16],int pos);
P leaf(const string& expr,int sweets[16],int pos);

P tree(const string& expr,int sweets[16],int pos){
  int set = 0;
  if(expr[pos] == '('){
    P r1 = leaf(expr,sweets,pos + 1);
    pos = r1.first;
    char ope = expr[pos];
    P r2 = leaf(expr,sweets,pos+1);
    if(ope == 'A'){
      set |= (r1.second & r2.second);
    }
    else if(ope == 'O'){
      set |= (r1.second | r2.second);
    }
    else if(ope == 'X'){
      set |= (r1.second ^ r2.second);
    }
    pos = r2.first;
  }
  return P(pos,set);
}

P leaf(const string& expr,int sweets[16], int pos){
  if(expr[pos] == '('){
    P r = tree(expr,sweets,pos);
    pos = r.first + 1;
    return P(pos,r.second);
  }
  else{
    return P(pos+1,sweets[expr[pos] - '0']);
  }
}

int dfs(string expr,int sweets[16],int pos,int N){
  if(pos >= expr.size()){
    P r = tree(expr,sweets,0);
    if(r.second == (1<<4) - 1){
      return 1;
    }
    else{
      return 0;
    }
  }

  int res = 0;
  const char ope[] = {'A','O','X'};
  if(expr[pos] == ' '){
    for(int i = 0; i < 3; i++){
      expr[pos] = ope[i];
      res += dfs(expr,sweets,pos+1,N);
    }
  }
  else{
    res += dfs(expr,sweets,pos+1,N);
  }
  return res;
}

int main(){
  string expr;
  while(getline(cin,expr)){
    if(expr == "END") break;
    int N;
    string N_str;
    getline(cin,N_str);
    N = atoi(N_str.c_str());
    int sweets[16];
    for(int i = 1; i <= N; i++){
      int bit = 0;
      string flag_str;
      getline(cin,flag_str);
      for(int j = 0; j <= 6; j+=2){
        if(flag_str[j] - '0'){
          bit |= (1<<(j/2));
        }
      }
      sweets[i] = bit;
    }
    printf("%d\n",dfs(expr,sweets,0,N));
  }
}

Measured memory_bytes: 1220
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
#define INF 1LL<<60
#define PI acos(-1)
typedef long long ll;
typedef pair<int, int> p_ii;

char grid[110][110];
int main() {
	
	set<int> c;
	int h, w;
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> grid[i][j];
		}
	}

	for (int i = 0; i < h; i++) {
		bool flag = true;
		if (!flag)continue;
		for (int j = 0; j < w; j++) {
			if (grid[i][j] == '#') {
				flag = false;
				break;
			}
		}
		if (flag) {
			c.insert(i);
			for (int j = 0; j < w; j++) {
				if (grid[i][j] == '.') {
					grid[i][j] = '*';
				}
			}
		}
	}
	for (int i = 0; i < w; i++) {
		bool flag = true;
		if (!flag)continue;
		for (int j = 0; j < h; j++) {
			if (grid[j][i] == '#') {
				flag = false;
				break;
			}
		}
		if (flag) {
			for (int j = 0; j < h; j++) {
				if (grid[j][i] == '.') {
					grid[j][i] = '*';
				}
			}
		}
	}

	for (int i = 0; i < h; i++){
		bool update = true;
		for (int j = 0; j < w; j++) {
			if (grid[i][j] != '*'){
				cout << grid[i][j];
			}
		}
		if(c.count(i)==0)cout << endl;
	}

	return 0;
}

Measured memory_bytes: 256
s = input()
q = int(input())
qs = [input().split() for i in range(q)]
n = False
left= right = ""
for operation in qs:
    if operation[0] == '1':
        n = not n
    if operation[0] == '2':
        t , f, c = operation
        f = int(f)
        if n:
            f = 1 if f != 1 else 2
        if f == 1:
            left=c+left
        elif f == 2:
            right+=c
s = left+s+right
print(s[::-1] if n else s)

Measured memory_bytes: 41204
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int W;

	while (true)
	{
		cin >> W;

		if (W == -1) { break; }

		int money = 1150;

		if (W > 10)
		{
			money += min(W - 10, 10) * 125;
		}
		if (W > 20)
		{
			money += min(W - 20, 10) * 140;
		}
		if (W > 30)
		{
			money += (W - 30) * 160;
		}

		cout << 4280 - money << endl;
	}

	return 0;
}

Measured memory_bytes: 2972
from itertools import permutations
import math

n = int(input())
arr = [tuple(map(int, input().split())) for _ in range(n)]
total = 0
for v in permutations(arr, n):
    d = 0
    for i in range(n-1):
        x1, y1 = v[i]
        x2, y2 = v[i+1]
        d += math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
    total += d
print(total / math.factorial(n))



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

int main() {

  double PI = 3.141592653589793;

  double A, B, H, M;
  cin >> A >> B >> H >> M;

  double angleH = 360 * H / 12;
  double angleM = 360 * M / 60;

  angleH += 30 * M / 60;

  double angle = 0;

  if (0 <= angleH && angleH < 90) {
    
    if (0 <= angleM && angleM < 90) {
      angle = max(angleH - angleM, angleM - angleH);
    } else if (90 <= angleM && angleM < 180) {
      angle = angleM - angleH;
    } else if (180 <= angleM && angleM < 270) {
      angle = min(angleH + (360 - angleM), angleM - angleH);
    } else {
      angle = angleH + (360 - angleM);
    }

  } else if (90 <= angleH && angleH < 180) {

    if (0 <= angleM && angleM < 90) {
      angle = angleH - angleM;
    } else if (90 <= angleM && angleM < 180) {
      angle = max(angleM - angleH, angleH - angleM);
    } else if (180 <= angleM && angleM < 270) {
      angle = angleM - angleH;
    } else {
      angle = min(angleH + (360 - angleM), angleM - angleH);
    }
    
  } else if (180 <= angleH && angleH < 270) {

    if (0 <= angleM && angleM < 90) {
      angle = min(angleM + (360 - angleH), abs(angleH - angleM));
    } else if (90 <= angleM && angleM < 180) {
      angle = angleH - angleM;
    } else if (180 <= angleM && angleM < 270) {
      angle = max(angleM - angleH, angleH - angleM);
    } else {
      angle = angleM - angleH;
    }

  } else {

    if (0 <= angleM && angleM < 90) {
      angle = angleM + (360 - angleH);
    } else if (90 <= angleM && angleM < 180) {
      angle = min(angleM + (360 - angleH), angleH - angleM);
    } else if (180 <= angleM && angleM < 270) {
      angle = angleH - angleM;
    } else {
      angle = max(angleM - angleH, angleH - angleM);
    }
    
  }

  double radian =(double) angle * PI / 180.0;
  double answer =(double) A * A + B * B - ((double)2 * A * B * cos(radian));

  printf("%.20f", sqrt(answer));

  return 0;

}

Measured memory_bytes: 4156
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
	cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
	cout << head;
	if (sizeof...(tail) != 0) cout << " ";
	print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
	for (auto& a : vec) {
		cout << a;
		if (&a != &vec.back()) cout << " ";
	}
	cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
	for (auto& vec : df) {
		print(vec);
	}
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	auto S = IN<string>();
	print("2018"+S.substr(4, 6));
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


Measured memory_bytes: 256
#include <cstdio>
#include <vector>

using namespace std;

int main() {
    int n, c, ans = 0;
    scanf("%d", &n);
    vector<int> v(n);
    for (int i = 0; i < n; ++i) scanf("%d", &v.at(i));
    for (int i = 0; i < n; ++i) {
        scanf("%d", &c);
        ans += max(0, v.at(i) - c);
    }
    printf("%d\n", ans);
    return 0;
}


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

int fib[45];

int main()
{
    int N;
    cin >> N;

    for (int i = 0; i <= N; i++)
    {
        if (i < 2)
        {
            fib[i] = 1;
        }
        else
        {
            fib[i] = fib[i - 2] + fib[i - 1];
        }
    }

    cout << fib[N] << endl;
    return 0;
}


Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n;
    cin>>n;
    ll ac=0,wa=0,tle=0,re=0;
    while(n--)
    {
        string s;
        cin>>s;
        if(s=="AC")
        {
            ac++;
        }
        else if(s=="WA")
        {
            wa++;
        }
        else if(s=="TLE")
        {
            tle++;
        }
        else
        {
            re++;
        }
    }
    //for(int i=0;i<4;i++)
    //{

    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re<<endl;
    return 0;
}


Measured memory_bytes: 3636
import java.util.Scanner;

class Main {
    public static void main (String args[]) {
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	int S[] = new int[n];
	for(int i = 0;i < n;i++) S[i] = sc.nextInt();
	int q = sc.nextInt();
	int T[] = new int[q];	
	for(int i = 0;i < q;i++) T[i] = sc.nextInt();
	int cnt = 0;
	for(int i = 0;i < q;i++){
		int left = 0;
		int right = S.length;
		int mid = 0; 
		while(left < right){
		    mid = (left + right) / 2;
		    if(T[i] == S[mid]){
			cnt++;
			break;
		    }
		    if(T[i] > S[mid]){
			left = mid + 1;
		    }
		    else if(T[i] < S[mid]){
			right = mid;
		    }
		}
	}
	System.out.println(cnt);
    }
}



Measured memory_bytes: 67736
import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]

def main():
    n,m = i_map()
    l = []
    for i in range(m):
        p,y = i_map()
        l.append([i,p,y,0])

    l.sort(key = lambda x :(x[1], x[2]))
    ken = l[0][1]
    cnt = 1

    for i in l:
        if i[1] == ken:
            i[3] = cnt
            cnt += 1
        else:
            i[3] = 1
            cnt = 2
            ken = i[1]
    l.sort(key = lambda x:x[0])

    ans = []
    for i in l:
        ans.append(str(i[1]).zfill(6) + str(i[3]).zfill(6))
    for i in ans:
        print(i)

if __name__=="__main__":
    main()


Measured memory_bytes: 39372
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int i = 0, i_len = n; (i) < (i_len); ++(i))
#define repp(i,n) for(int i = 1, i_len = n; (i) <= (i_len); ++(i))
#define per(i,n) for(int i = n-1; (i) >= 0; --(i))
#define perr(i,n) for(int i = n; (i) > 0; --(i))
#define sz(x) ((int)(x).size())
#define popcnt __builtin_popcount
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).begin(),(v).end(),greater<>()
#define debug(x) cerr << #x << ':' << x << '\n'
#define Pi 3.1415926535
#define MOD 1000000007
using namespace std;
using ll = long long;
using pint = pair<int,int>;
using itn = int;
using vint = vector<int>;
template<class T,class S> inline bool chmax(T& a, S b){if(a<b){a = b; return true;} return false;}
template<class T,class S> inline bool chmin(T& a, S b){if(a>b){a = b; return true;} return false;}
template<class T> T gcd(T a, T b){return b?gcd(b,a%b):a;}
template<class T> T lcm(T a, T b){return a*b/gcd(a,b);}
void yes(){cout << "Yes" << '\n';}
void no(){cout << "No" << '\n';}

int solve(){
    int n, m; cin >> n >> m;
    vector<int> h(n); rep(i,n) cin >> h[i];
    vector<int> mx(n,0);

    rep(i,m){
        int a, b;
        cin >> a >> b;
        --a; --b;
        chmax(mx[a], h[b]);
        chmax(mx[b], h[a]);
    }

    int ans = 0;
    rep(i,n){
        if(h[i]>mx[i]) ++ans;
    }

    cout << ans << endl;

    return 0;
}

int main(){
    cin.tie(0);
    cout << fixed << setprecision(10);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}


Measured memory_bytes: 3980
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=2005;
const int MOD=924844033;

int n,k,jc[N],a[N];
LL f[N][N][2][2];
bool vis[N];

int main()
{
    scanf("%d%d",&n,&k);
    jc[0]=1;
    for (int i=1;i<=n;i++) jc[i]=(LL)jc[i-1]*i%MOD;
    int tot=0;
    for (int i=1;i<=n;i++)
        if (!vis[i])
        {
            a[++tot]=i;
            for (int j=i+k;j<=n;j+=k) vis[j]=1,a[++tot]=j;
        }
    f[0][0][0][0]=1;a[0]=-k-1;a[n+1]=k-1;
    for (int i=1;i<=n;i++)
    {
        f[i][0][0][0]=1;
        for (int j=1;j<=i;j++)
        {
            f[i][j][0][0]=(f[i-1][j][1][0]+f[i-1][j][0][0]+(a[i]-a[i-1]==k)*f[i-1][j-1][0][0])%MOD;
            f[i][j][0][1]=(a[i+1]-a[i]==k)*(f[i-1][j-1][1][0]+f[i-1][j-1][0][0])%MOD;
            f[i][j][1][0]=(f[i-1][j][0][1]+f[i-1][j][1][1]+(a[i]-a[i-1]==k)*f[i-1][j-1][0][1])%MOD;
            f[i][j][1][1]=(a[i+1]-a[i]==k)*(f[i-1][j-1][0][1]+f[i-1][j-1][1][1])%MOD;
        }
    }
    int ans=0;
    for (int i=0;i<=n;i++)
    {
        int s=(f[n][i][0][0]+f[n][i][0][1]+f[n][i][1][0]+f[n][i][1][1])%MOD;
        if (i&1) (ans+=MOD-(LL)s*jc[n-i]%MOD)%=MOD;
        else (ans+=(LL)s*jc[n-i]%MOD)%=MOD;
    }
    printf("%d",ans);
    return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int64_t> lucas(n + 1);
    lucas[0] = 2;
    lucas[1] = 1;
    for (int i = 2; i <= n; i++) lucas[i] = lucas[i - 1] + lucas[i - 2];
    cout << lucas[n] << "\n";
}


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

void Main()
{
	ll H, W; cin >> H >> W;
	if (H % 3 == 0 || W % 3 == 0) {
		cout << 0 << endl;
		return;
	}
	ll res = 1e18;
	REP(i,1,H) {
		ll a = (W * i);
		ll b = (H - i) * (W / 2);
		ll c = (H - i) * (W - (W / 2));
		ll tmp = max(a,max(b,c)) - min(a,min(b,c)); 
		// cout << tmp << endl;
		res = min(res, tmp);
	}
	REP(i,1,W) {
		ll a = (H * i);
		ll b = (W - i) * (H / 2);
		ll c = (W - i) * (H - (H / 2));
		ll tmp =  max(a,max(b,c)) - min(a,min(b,c));
		// cout << tmp << endl;
		res = min(res, tmp);
	}
	res = min(res,min(H,W));
	cout << res << endl;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 256
ps=[]
while True:
    p, s= map(int, input().split(","))
    if p==s==0: break
    ps.append((p, s))
o= sorted(set(s for p, s in ps), reverse=True)
zo= dict(zip(o, [i+1 for i in range(len(o))]))
while True:
    try:
        q= int(input())
        for p, s in ps:
            if p== q: print(zo[s])
    except:
        break

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

long long INF = 1LL<<60;

long long P[110][11];

int main() {

  int N;
  cin >> N;

  vector<set<int>> F(10);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 10; j++) {
      int f;
      cin >> f;
      if (f == 1) {
        F[j].insert(i);
      }
    }
  }

  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 11; j++) {
      cin >> P[i][j];
    }
  }

  long long answer = 0 - INF;

  for(int bits = 1; bits < (1 << 10); bits++) {

    long long answer_ = 0;
    
    vector<int> count(N);

    for (int i = 0; i < 10; i++) {
      if (bits >> i & 1) {
        set<int> stores = F[i];
        for (auto item:stores) {
          count[item]++;
        }
      }
    }

    for (int i = 0; i < N; i++) {
      answer_ += P[i][count[i]];
    }

    answer = max(answer, answer_);
    
  }

  cout << answer << endl;

  return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;

 
lint fac[MAX], finv[MAX], inv[MAX];

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }

    // 素数である
    return 1;
}

   

int main(){
 lint A,B,C;
 string s,k;
 vector <char> l;
 cin>>A>>s>>k;
rep(i,s.size()){
    l.push_back(s[i]);
       l.push_back(k[i]);

}
rep(i,l.size()){
    cout<<l[i];
}
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
int n;
int f[100][5][2];
int p[100][11];
scanf("%d",&n);
for(int i=0;i<n;i++){
	for(int j=0;j<5;j++){
		for(int k=0;k<2;k++){
			scanf("%d",&f[i][j][k]);
		}
	}
}
for(int i=0;i<n;i++){
	for(int j=0;j<11;j++){
		scanf("%d",&p[i][j]);
	}
}
int x=-2;
for(int i=0;i<9;i++){
	x=x*10;
}
int l=1;
for(int i=0;i<10;i++){
	l=l*2;
}
for(int i=1;i<l;i++){
	int c[n];
	for(int j=0;j<n;j++){
		c[j]=0;
	}
	int m=i;
	for(int j=0;j<5;j++){
		for(int k=0;k<2;k++){
			for(int q=0;q<n;q++){
				if(f[q][j][k]==1){
					c[q]=c[q]+m%2;
				}
			}
			m=m/2;
		}
	}
	int y=0;
	for(int j=0;j<n;j++){
		y=y+p[j][c[j]];
	}
	if(x<y){
		x=y;
	}
}
printf("%d\n",x);

}

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

char rot(char c, int n) {
    char x = c + n;
    if (x - 'Z' > 0) x -= 26;
    return x;
}


int main() {
    int n;
    string s;

    cin >> n >> s;

    for (int i = 0; i < s.size(); i++) s[i] = rot(s[i], n);

    cout << s << endl;

    return 0;
}


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


using namespace std;

void func148b (){
	int n;
	string s, t;
	cin >> n;
	cin >> s;
	cin >> t;
	for (int i = 0; i < n; i++) cout << s[i] << t[i];
	cout << "\n";
}

int main()
{
	func148b();
	return 0;	
}



Measured memory_bytes: 256
import numpy as np
# 実行時間が遅いのでは早くする

N,K,Q = map(int,input().split())
# Q門について成果した人の番号
ans_list=[int(input()) for _ in range(Q)]
# 参加者ごとに正解した数
answer_num=[0 for _ in range(N)]

for ans_person in ans_list:
    answer_num[ans_person-1] += 1

for an in answer_num:
    # 持ち点から(問題数-正解数)を引いた数が残りの得点である
    if K-(Q-an) > 0:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 17664
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

const int N = 1e3 + 10, M = 2e4 + 10;
ll dp[N][M + 1];
int main() {
  ios::sync_with_stdio(false);
  // cin.tie(NULL);

  int n;
  cin >> n;
  tuple<int,int,int> a[N];
  for (int i = 1; i <= n; i++) {
    int w, s, v;
    cin >> w >> s >> v;
    a[i] = make_tuple(w, s, v);
  }
  sort(a + 1, a + n + 1, [](auto &x, auto &y){
    return get<0>(x) + get<1>(x) < get<0>(y) + get<1>(y);
  });
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= M; j++) {
      dp[i][j] = -1e18;
    }
  }
  dp[0][0] = 0;
  for (int i = 1; i <= n; i++) {
    int w, s, v;
    tie(w, s, v) = a[i];
    for (int j = 0; j <= M; j++) {
      dp[i][j] = dp[i - 1][j];
      if (j >= w && j - w <= s)
        dp[i][j] = max(dp[i][j], dp[i - 1][j - w] + v);
    }
  }
  ll ans = 0;
  for (int i = 0; i <= M; i++) {
    ans = max(ans, dp[n][i]);
  }
  cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 158080
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

// s[i:], s[j:] が何文字目まで一致するか
// 0 <= i < j < |S|
int solve(string &s, vector<vector<int>> &memo, int i, int j) {
  if (i >= s.size() || j >= s.size() || s[i] != s[j]) {
    return 0;
  }

  if (memo[i][j] < 0) {
    memo[i][j] = min(j - i, solve(s, memo, i + 1, j + 1) + 1);
  }

  return memo[i][j];
}

int main(int argc, const char *argv[]) {
  int n;
  string s;
  cin >> n >> s;

  vector<vector<int>> memo(s.size(), vector<int>(s.size(), -1));
  int ans = 0;
  for (int i = 0; i < s.size() - 1; i++) {
    for (int j = i + 1; j < s.size(); j++) {
      ans = max(ans, solve(s, memo, i, j));
    }
  }

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

Measured memory_bytes: 98560
#include "bits/stdc++.h"

using namespace std;

vector<int> v[1000];
vector<string> st(1000);

void solve(int idx,int depth){
    for(int i=0;i<depth;i++) cout<<".";
    cout<<st[idx]<<endl;
    for(int i=0;i<(int)v[idx].size();i++){
        int next=v[idx][i];
        solve(next,depth+1);
    }
    return ;
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

    int n;cin>>n;
    int k;
    cin>>k>>st[0];
    for(int i=1;i<n;i++){
        cin>>k>>st[i];k--;
        v[k].push_back(i);
    }
    solve(0,0);
}

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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
#define PI 3.14159265359 //πの値
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

 
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll A,B;
string C,D,E;
cin >> C >> D >> A >> B >> E;
if(C==E) cout << A-1 << ' ' << B;
else cout << A << ' ' << B-1;
}

Measured memory_bytes: 3612
ans={}
n=int(input())
for i in range(n):
    s=input()
    ans[s]=ans.get(s,0)+1
m=int(input())
for j in range(m):
    t=input()
    ans[t]=ans.get(t,0)-1
print(max(ans.values()) if max(ans.values())>0 else 0)

Measured memory_bytes: 3060
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <numeric>
#include <mutex>
#include <cmath>
#include <set>
#include <climits>

#define mod 1000000007
#define mp make_pair
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG

using namespace std;
using ll = long long;
using lli = long long int;
using pii = pair<int, int>;
 
 int main(){
	 int N, b;
	 string s;
	 cin >> N;
	 pair<pair<string, int>, int> a[110];
	 rep(i, N){
		 cin >> s >> b;
		 a[i] = make_pair(make_pair(s, -b), i+1);
	 }
	 sort(a, a+N);
	 rep(i, N){
		 cout << a[i].second << endl;
	 }
 }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int bj=0;
	string s;
	cin>>s;
	for(int i=0;i<=s.length()-1;i++)
	{
		if(s[i]=='C')bj=1;
		if(s[i]=='F'&&bj==1)
		{
			cout<<"Yes"<<"\n";
			return 0;
		}
	}
	cout<<"No"<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>          // printf(), putchar(), scanf()

int
main(int argc, char **argv)
{
	short puzzle[9][9];
	char check[9][9];
	int n;
	enum {none, done, dupli} state[9];

	scanf("%d", &n);
	for (int u = 0; u < n; ++u)
	{
		for (int y = 0; y < 9; ++y)
		{
			for (int x = 0; x < 9; ++x)
				scanf("%hd", &puzzle[y][x]);
		}

		for (int y = 0; y < 9; ++y)
		{
			for (int x = 0; x < 9; ++x)
				check[y][x] = ' ';
		}

		for (int x = 0; x < 9; ++x)
		{
			for (int i = 0; i < 9; ++i)
				state[i] = none;

			for (int y = 0; y < 9; ++y)
			{
				int t = puzzle[y][x] - 1;
				if (state[t] == none)
					state[t] = done;
				else
					state[t] = dupli;
			}

			for (int i = 0; i < 9; ++i)
			{
				if (state[i] == dupli)
				{
					for (int y = 0; y < 9; ++y)
					{
						if (puzzle[y][x] == i + 1)
							check[y][x] = '*';
					}
				}
			}
		}

		for (int y = 0; y < 9; ++y)
		{
			for (int i = 0; i < 9; ++i)
				state[i] = none;

			for (int x = 0; x < 9; ++x)
			{
				int t = puzzle[y][x] - 1;
				if (state[t] == none)
					state[t] = done;
				else
					state[t] = dupli;
			}

			for (int i = 0; i < 9; ++i)
			{
				if (state[i] == dupli)
				{
					for (int x = 0; x < 9; ++x)
					{
						if (puzzle[y][x] == i + 1)
							check[y][x] = '*';
					}
				}
			}
		}

		for (int y = 0; y < 9; y += 3)
		{
			for (int x = 0; x < 9; x += 3)
			{
				for (int i = 0; i < 9; ++i)
					state[i] = none;

				for (int i = 0; i < 9; ++i)
				{
					int tx = x + i % 3, ty = y + i / 3;
					int t = puzzle[ty][tx] - 1;
					if (state[t] == none)
						state[t] = done;
					else
						state[t] = dupli;
				}

				for (int i = 0; i < 9; ++i)
				{
					if (state[i] == dupli)
					{
						for (int j = 0; j < 9; ++j)
						{
							int tx = x + j % 3, ty = y + j / 3;
							if (puzzle[ty][tx] == i + 1)
								check[ty][tx] = '*';
						}
					}
				}
			}
		}

		if (u != 0)
			putchar('\n');

		for (int y = 0; y < 9; ++y)
		{
			for (int x = 0; x < 9; ++x)
				printf("%c%d", check[y][x], puzzle[y][x]);

			putchar('\n');
		}
	}

	return 0;
}

Measured memory_bytes: 1700
#include <iostream>
#include <string>
using namespace std;
int main(){
	string s,t;
	cin >> s;
	cin >> t;
	int size = s.size();
	int counter = 0;
	for(int i = 0;i < size;i++){
		if(s[i] != t[i]){
			counter ++;
		}
	}
	cout << counter;
	return 0;
}


Measured memory_bytes: 3916
#include <stdio.h>
int main(){

  int x,number;
  char num;

  while(1){

    x=0;
  
    scanf("%c",&num);
    
    if(num != '0'){
      
      while(1){

	number = num - '0';
	
	x += number;
	
	scanf("%c",&num);
	
	if(num == '\n') break;

      }

      printf("%d\n",x);
      
    } else {

      break;

    }  
	
  }

  return 0;

}
  

Measured memory_bytes: 536
#include <bits/stdc++.h>
using namespace std;
int main(){
int x,y;
for(int i=0;i<3000;i++){
cin >> x >> y;
if(x==0 && y==0){
break;
}
else if(x>y){
cout << y << " " << x << endl;
}
else{ cout << x << " " << y << endl; }
}
}



Measured memory_bytes: 3072
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
#define PB push_back
#define MP make_pair
#define st first
#define nd second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<long long>;
using ld = long double;

#define unordered_map __fast_unordered_map
template<class Key, class Value, class Hash = std::hash<Key>>
using unordered_map = __gnu_pbds::gp_hash_table<Key, Value, Hash>;

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

const int kMax = 2e6 + 100;
const int mod = 998244353;

int fact[kMax];
int inv_fact[kMax];

int PowMod(int a, int n) {
  int r = 1;
  while (n) {
    if (n & 1) { r = (ll)r * a % mod; }
    n >>= 1;
    a = (ll)a * a % mod;
  }
  return r;
}

void Preproc() {
  fact[0] = 1;
  for (int i = 1; i < kMax; ++i) {
    fact[i] = (ll)fact[i - 1] * i % mod;
  }
  inv_fact[kMax - 1] = PowMod(fact[kMax - 1], mod - 2);
  for (int i = kMax - 2; i >= 0; --i) {
    inv_fact[i] = (ll)inv_fact[i + 1] * (i + 1) % mod;
  }
}

int Binom(int n, int k) {
  if (k < 0 || k > n) { return 0; }
  int r = (ll)fact[n] * inv_fact[k] % mod;
  return (ll)r * inv_fact[n - k] % mod;
}

int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);

  Preproc();

  int n, m;
  cin >> n >> m;

  int ans = 0;

  for (int k = 0; k <= n && k <= m; ++k) {
    if (k % 2 != m % 2) { continue; }
    const int ntwos = m + (m - k) / 2;
    
    int coef = Binom(n, k);
    int nall = Binom(n + ntwos - 1, ntwos);

    const int nt = ntwos - m;
    int nbad =
      ((ll)(n - k) * Binom(n + nt - 2, nt - 1) +
       (ll)k * Binom(n + nt - 1, nt)) % mod;
    
    int ngood = (nall - nbad + mod) % mod;
    ans = (ans + (ll)coef * ngood) % mod;
  }
  cout << ans << "\n";
}



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

int main() {
  int N;
  int sum=0;
  cin >> N;

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


Measured memory_bytes: 256
from itertools import product
n,k=map(int,input().split())
if k%2==1:
    l=[i for i in range(k,n+1,k)]
    ans=len(l)**3
if k%2==0:
    l=[i for i in range(k//2,n+1,k)]
    ll=[i for i in range(k,n+1,k)]
    ans=len(l)**3+len(ll)**3
print(ans)

Measured memory_bytes: 77848
def c_pushpush(N,A):
    from collections import deque
    # insertをリストの先頭に行うと、リストの要素の再配置に時間がかかる
    b = deque([])
    n_parity = N & 1
    for i in range(N):
        if n_parity == (i + 1) & 1:
            # n,iのパリティが一致
            b.appendleft(A[i])
        else:
            b.append(A[i])
    ans = ' '.join(map(str,b))
    return ans

N = int(input())
A = [int(i) for i in input().split()]
print(c_pushpush(N,A))

Measured memory_bytes: 30020
let () =
  let f c1 c2 c3 c4 c5 c6 = c1 + c2*5 + c3*10 + c4*50 + c5*100 + c6*500 in
  let total = Scanf.scanf " %d %d %d %d %d %d\n" f in
  if total >= 1000 then Printf.printf "1\n"
  else Printf.printf "0\n"
;;

Measured memory_bytes: 2236
import java.util.Scanner;

public class Main
{

  public static void main(String[] args)
  {
    try (Scanner sc = new Scanner(System.in))
    {
      String[] tmp = sc.nextLine().split(" ");
      final int N = Integer.parseInt(tmp[0]);
      final int C = Integer.parseInt(tmp[1]);
      tmp = sc.nextLine().split(" ");
      int[] P = new int[C];
      for (int i = 0; i < C; i++)
      {
        P[i] = Integer.parseInt(tmp[i]);
      }

      System.out.println(solve(N, C, P));
    }
  }

  private static int solve(int N, int C, int[] P)
  {

    int sumCakePiace = 0;
    for (int i : P)
    {
      sumCakePiace += i;
    }

    int ret = sumCakePiace / (N + 1);

    if (sumCakePiace % (N + 1) > 0)
    {
      ret++;
    }

    return ret;
  }
}



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

namespace ConsoleApp3
{
	class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			var d = from str in Console.ReadLine().Split(' ')
					select int.Parse(str);
			var dList = new List<int>(d);
			dList.Sort();
			int count = dList[(n / 2)] - dList[(n / 2) - 1];
			Console.WriteLine(count);
		}
	}
}


Measured memory_bytes: 19168
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const double eps = 1E-18;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint operator^(const ll& t)const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

///////////////////////////

vector<mint> frac;
vector<mint> ifrac;

void init(ll N) {
	frac.assign(N + 1,1);
	ifrac.assign(N + 1,1);

	repn(i, N) {
		frac[i] = frac[i - 1] * i;
		ifrac[i] = ifrac[i - 1] / i;
	}

}


int main() {
	ll N;
	cin >> N;

	
		init(N);

		vector<mint> p(N, 0);

		for (ll i = (N + 1) / 2; i <= N - 1; i++) {
			p[i] = frac[i - 1] * frac[i] * ifrac[2 * i - N];
		}

		mint ans = 0;

		repn(i, N - 1) {
			ans += (p[i] - p[i - 1])*i;
		}

		cout << ans << endl;
	

	system("PAUSE");
}


Measured memory_bytes: 23928
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
const long long MOD=1e9+7;
// const long long MOD=998244353;
const int INF=1e9;
const long long IINF=1e18;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
const char dir[4]={'D','R','U','L'};
#define LOCAL

template<typename T>
istream &operator>>(istream &is,vector<T> &v){
    for (T &x:v) is >> x;
    return is;
}
template<typename T>
ostream &operator<<(ostream &os,const vector<T> &v){
    for (int i=0;i<v.size();++i){
        os << v[i] << (i+1==v.size()?"": " ");
    }
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const pair<T,U> &p){
    cout << '(' << p.first << ',' << p.second << ')';
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const map<T,U> &m){
    os << '{';
    for (auto itr=m.begin();itr!=m.end();++itr){
        os << '(' << itr->first << ',' << itr->second << ')';
        if (++itr!=m.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os,const set<T> &s){
    os << '{';
    for (auto itr=s.begin();itr!=s.end();++itr){
        os << *itr;
        if (++itr!=s.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}

void debug_out(){cerr << '\n';}
template<class Head,class... Tail>
void debug_out(Head&& head,Tail&&... tail){
    cerr << head;
    if (sizeof...(Tail)>0) cerr << ", ";
    debug_out(move(tail)...);
}
#ifdef LOCAL
#define debug(...) cerr << " ";\
cerr << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << '\n';\
cerr << " ";\
debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<typename T> T gcd(T x,T y){return y!=0?gcd(y,x%y):x;}
template<typename T> T lcm(T x,T y){return x/gcd(x,y)*y;}

template<class T1,class T2> inline bool chmin(T1 &a,T2 b){
    if (a>b){a=b; return true;} return false;
}
template<class T1,class T2> inline bool chmax(T1 &a,T2 b){
    if (a<b){a=b; return true;} return false;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<int> x(5); cin >> x;
    for (int i=0;i<5;++i){
        if (x[i]==0){
            cout << i+1 << '\n';
            return 0;
        }
    }
}

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

int main(void){
  vector<int> omori;
  int N,sum=0;
  cin>>N;
  omori.resize(N);
  for(int i=0;i<N;i++)cin>>omori[i];
  vector<int> a,wa1,wa2;
  a.resize(N-1);
  wa1.resize(N-1);
  wa2.resize(N-1);
  for(int j=0;j<N;j++)sum+=omori[j];

  wa1[0]=omori[0];
  wa2[0]=sum-wa1[0];

  for(int t=1;t<N-1;t++){
    wa1[t]+=wa1[t-1]+omori[t];
    wa2[t]=sum-wa1[t];
  }
  for(int b=0;b<N-1;b++){
    if(wa1[b]>=wa2[b])a[b]=wa1[b]-wa2[b];
    else a[b]=wa2[b]-wa1[b];
  }
  sort(a.begin(),a.end());
  cout<<a[0];

}


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

int main(){
  int n; cin >> n;
  int h[100010];
  for (int i = 0; i < n; i++){
    cin >> h[i];
  }
  for (int i = n - 2; i >= 0; i--){
    if (h[i] > h[i + 1]){
      if (h[i] - h[i + 1] > 1){
        cout << "No" << endl;
        return 0;
      }
      h[i]--;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 640
#include<stdio.h>

int clc(int,int);

int main(){
	int n,x,i,j,ans[100];
	
	i = 0;
	
	do{
		scanf("%d %d",&n,&x);
		
		ans[i] = clc(n,x);
		i++;
	}while(n!=0 || x!=0);
	
	for(j=0;j<i-1;j++){
		printf("%d\n",ans[j]);
	}
	return 0;
}

int clc(int n,int x){
	int i,j,k,sum,cnt;
	
	cnt = 0;
	
	for(i=1;i<=n;i++){
		for(j=i+1;j<=n;j++){
			for(k=j+1;k<=n;k++){
				sum = i + j + k;
				if(!(i==j || j==k || k==i)){
					if(sum == x){
						cnt++;
					}
				}
			}
		}
	}
	
	return cnt;
}


Measured memory_bytes: 2048
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <utility>
#include <string>
#include <cmath>
#include <set>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; ++i)
typedef long long ll;
typedef pair<int,int> pii;
int main(){
    ll a,b,c;
    cin >> a >> b >> c;
    if(a%2==0||b%2==0|c%2==0){
        cout << 0 << endl;
    }else{
        cout << min(a*b,min(b*c,c*a)) << endl;
    }
    return 0;
}

Measured memory_bytes: 764
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>

using namespace std;

void prime(vector<int> &num, int n){
    for(int i=0;i<=n;i++){
        num[i] = 1;
    }
    num[0] = 0;
    num[1] = 0;
    num[2] = 1;

    for(int i=2;i<=sqrt(n);i++){
        if(num[i] == 1){
            for(int j=2;j<=n/i;j++){
                num[i*j] = 0;
            }
        }
    }
}

int main(void){

    int n;
    cin>>n;

    vector<int> a(n);

    for(int i=0;i<n;i++){
        int b;
        cin>>b;
        a[i] = b;
    }

    sort(a.begin(), a.end());

    // for(int i=0;i<n;i++){
    //     cout<<a[i]<<" ";
    // }
    // cout<<endl;

    int count = 0;
    int piv = 1;
    int x = 1;


    for(int i=0;i<n-1;i++){
        if(a[i] == a[i+1]){
            count++;
            if(piv == 1){
                count++;
                piv = 0;
               // x++;
            }
        }else{
            piv = 1;
            x++;
        }
    }

    // cout<<count<<endl;
    // cout<<x<<endl;

    if((n-x)%2==0) cout<<x<<endl;
    else cout<<x-1<<endl;
   


}

Measured memory_bytes: 640