akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0; i<n; i++)cin>>a.at(i);

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

  vector<int> ans(a.at(n-1)+1, 0);

  for(int i=0; i<n; i++){
    if(a.at(i)==0){
      ans.at(0)++;
      if(a.at(n-1)!=0)ans.at(1)++;
    }else if(a.at(i)==a.at(n-1)){
      if(a.at(n-1)!=0)ans.at(a.at(n-1)-1)++;
      ans.at(a.at(n-1))++;
    }else{
      ans.at(a.at(i)-1)++;
      ans.at(a.at(i))++;
      ans.at(a.at(i)+1)++;
    }
  }
  
  sort(ans.begin(), ans.end());
  
  cout<<ans.at(a.at(n-1))<<endl;
}


Measured memory_bytes: 1024
# include<iostream>
# include<vector>

using namespace std;

int main(){
  int n, ans=0;
  cin >> n;
  vector<int> a(n+1);
  vector<int> b(n+1);
  vector<int> c(n);

  for(int i=1; i<=n; ++i)
    cin >> a[i];
  for(int i=1; i<=n; ++i)
    cin >> b[i];
  for(int i=1; i<n; ++i)
    cin >> c[i];

  for(int i=1; i<=n; ++i){
    ans += b[a[i]];
    if((a[i] + 1) == a[i+1])
      ans += c[a[i]];

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

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

int main(){
    char s[6];

    // ページ数
    cin >> s;

    if((s[2]==s[3])&&(s[4]==s[5])){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,D;
  int i,j,k;
  cin >> N >> D;
  vector<vector<int>> a(N,vector<int>(D));
  for(i=0;i<N;i++){
    for(j=0;j<D;j++){
      cin >> a.at(i).at(j);
    }
  }
  int s=1;
  for(i=1;i<=N;i++) s=s*i;
  vector<int> b(s);
  for(i=0;i<s;i++) b.at(i)=0;
  int t=0;
  for(i=0;i<N;i++){
    for(j=i+1;j<N;j++){
      for(k=0;k<D;k++){
        b.at(t)=b.at(t)+(a.at(i).at(k)-a.at(j).at(k))*(a.at(i).at(k)-a.at(j).at(k));
      }
      t++;
    }
  }
  t=1;
  int count=0;
  for(i=0;i<s;i++){
    for(t=1;b.at(i)>=t*t;t++){
      if(b.at(i)==t*t){
        count++;
      }
    }
  }
  cout << count << endl;
}
  
        

Measured memory_bytes: 14464
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main()
{
    string S;
    cin >> S;
    map<char, int>d;
    int s_size = S.size();
    for (int i=0; i<s_size; i++) {
        d[S[i]] += 1;
    }

    bool exist_S = false;
    bool exist_N = false;
    bool exist_W = false;
    bool exist_E = false;

    for (auto c: d) {
        if (c.first == 'E') {
            exist_E = true;
        } else if (c.first == 'W') {
            exist_W = true;
        } else if (c.first == 'N') {
            exist_N = true;
        } else if (c.first == 'S') {
            exist_S = true;
        }
    }

    if (exist_E && !exist_W) {
        cout << "No" << endl;
    } else if (exist_W && !exist_E) {
        cout << "No" << endl;
    } else if (exist_N && !exist_S) {
        cout << "No" << endl;
    } else if (exist_S && !exist_N) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
    return 0;
}

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

#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT_ON(bit, i) (bit & (1LL << i))

typedef long long LL;
template<typename T> using V = std::vector<T>;
template<typename T> using VV = std::vector<std::vector<T>>;
template<typename T> using VVV = std::vector<std::vector<std::vector<T>>>;
template<typename T> using VVVV = std::vector<std::vector<std::vector<std::vector<T>>>>;

template<class T> inline T ceil(T a, T b) { return (a + b - 1) / b; }
template<class T> inline void print(T x) { std::cout << x << std::endl; }
template<class T> inline void print_vec(const std::vector<T> &v) { for (int i = 0; i < v.size(); ++i) {  if (i != 0) {std::cout << " ";} std::cout << v[i];} std::cout << "\n"; }
template<class T> inline bool inside(T y, T x, T H, T W) {return 0 <= y and y < H and 0 <= x and x < W; }
template<class T> inline double euclidean_distance(T y1, T x1, T y2, T x2) { return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); }
template<class T> inline double manhattan_distance(T y1, T x1, T y2, T x2) { return abs(x1 - x2) + abs(y1 - y2); }
template<typename T> T &chmin(T &a, const T &b) { return a = std::min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = std::max(a, b); }
template<class T> inline std::vector<T> unique(std::vector<T> v) {
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    return v;
}
// 初項s, 交差dのn個の数列の和
long long sum_of_arithmetic_progression(long long s, long long d, long long n) {
    return n * (2 * s + (n - 1) * d) / 2;
}

const int INF = 1 << 30;
const double EPS = 1e-9;
const std::string YES = "YES", Yes = "Yes", NO = "NO", No = "No";
const std::vector<int> dy4 = {0, -1, 0, 1}, dx4 = {1, 0, -1, 0};
const std::vector<int> dy8 = { 0, -1, 0, 1, 1, -1, -1, 1 }, dx8 = { 1, 0, -1, 0, 1, 1, -1, -1 };

using namespace std;

unordered_map<int, LL> dp;
LL dfs(int i, int left, int right, const V<LL> &A) {
    if (left == right) {
        if (i % 2 == 0) {
            return A[left];
        }
        else {
            return -A[left];
        }
    }

    if (dp.find(left * 3010 + right) != dp.end()) {
        return dp[left * 3010 + right];
    }

    if (i % 2 == 0) {
        return dp[left * 3010 + right] = max(dfs(i + 1, left + 1, right, A) + A[left], dfs(i + 1, left, right - 1, A) + A[right]);
    }
    else {
        return dp[left * 3010 + right] = min(dfs(i + 1, left + 1, right, A) - A[left], dfs(i + 1, left, right - 1, A) - A[right]);
    }
}

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

	int N;
	cin >> N;
	V<LL> A(N);
	FOR(i, 0, N) {
	    cin >> A[i];
	}

    print(dfs(0, 0, N - 1, A));
	return 0;
}

Measured memory_bytes: 241752
#include <iostream>
#include <cmath>
#include <algorithm>
#include <deque>
#include <vector>
#include <map>

using namespace std;

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef pair<string,string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};

#define FOR(a,b,c) for (int (a)=(b);(a)<(c);++(a))
#define FORN(a,b,c) for (int (a)=(b);(a)<=(c);++(a))
#define FORD(a,b,c) for (int (a)=(b);(a)>=(c);--(a))
#define FORSQ(a,b,c) for (int (a)=(b);(a)*(a)<=(c);++(a))
#define FORC(a,b,c) for (char (a)=(b);(a)<=(c);++(a))
#define FOREACH(a,b) for (auto &(a) : (b))
#define REP(i,n) FOR(i,0,n)
#define REPN(i,n) FORN(i,1,n)
#define MAX(a,b) a = max(a,b)
#define MIN(a,b) a = min(a,b)
#define SQR(x) ((ll)(x) * (x))
#define RESET(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
// #define mp make_pair
// #define pb push_back
#define ALL(v) v.begin(),v.end()
#define ALLA(arr,sz) arr,arr+sz
#define SIZE(v) (int)v.size()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr,sz) sort(ALLA(arr,sz))
#define REVERSEA(arr,sz) reverse(ALLA(arr,sz))
#define PERMUTE next_permutation
#define TC(t) while(t--)

int main(){

  ll n, tmp;
  vll a;
  cin >> n;
  ll memo[n+1];
  ll ans = 0;
  REP(i,n+1){
    memo[i] = 0;
  }
  REP(i,n){
    cin >> tmp;
    if(tmp <= n){
      memo[tmp]++;
    }else{
      ans ++ ;
    }
    if(tmp > n)a.push_back(tmp);
  }



  FOR(i,1,n+1){
    if(memo[i] > i){
      ans += memo[i] - i;
    }else if (memo[i] < i){
      ans += memo[i];
    }
  }

  // REP(i,n+1){
  //   cout << memo[i] << endl;
  // }

  cout << ans << endl;;


  return 0;
}


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

int main(){
  
  for(int i=0;i<4;i++){
    int a,b;
    cin >> a >> b;
    
    if(a == 1){
    cout << 6000*b << endl;
    }
    else if(a == 2){
    cout << 4000*b<< endl;
    }
    else if(a == 3){
    cout << 3000*b<< endl;
    }
    else if(a == 4){
    cout << 2000*b<< endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define INF 1e9
#define all(v) v.begin(), v.end()
#define rall(v) v.begin(), v.end(), std::greater<int>()
#define rep(i, n) for(int i = 0; i < n; i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define max(v) *max_element(v.begin(), v.end())
#define min(v) *min_element(v.begin(), v.end())
using namespace std;

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

    long long h, cnt = 0, mon = 1, ans = 0;
    cin>>h;
    while(h > 0){
        if(h > 1){
            ans += mon;
            h /= 2;
            mon *= 2;
        }
        else{
            ans += mon;
            break;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# Shell sort


def insertionSort(A, n, g):
    """ 間隔Gの挿入ソート """
    global count
    for i in range(g, n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j + g] = A[j]
            j -= g
            count += 1
        A[j + g] = v


def shellSort(A, n):
    # 数列Gn=3G(n-1)+1 を生成
    G = []
    h = 1
    while h <= n:
        G.append(h)
        h = 3 * h + 1

    G.reverse()
    print(len(G))
    print(*G)

    for i in range(len(G)):
        insertionSort(A, n, G[i])


n = int(input())
A = [int(input()) for i in range(n)]

count = 0
shellSort(A, n)

print(count)
for i in range(n):
    print(A[i])



Measured memory_bytes: 45520
#include <algorithm>
#include <iostream>
#include <vector>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

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

    int n, k;
    cin >> n >> k;

    vector<int> h(n);
    REP(i, n) cin >> h[i];

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

    long long sum = 0;
    REP(i, n - k) sum += h[i];

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


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

const int maxn = 200000+10;
char str[maxn];
queue<int> q;
int main()
{
    long long ans=0;
    cin>>str+2;
    int cnt=0;
    int l=strlen(str+2);
    for(int i=2;i<l+2;++i)
    {
        if(str[i]=='A')
            q.push(1);
        else if(str[i]=='B'){
            if(str[i+1]!='C')
                q.push(-l);
        }else{
            if(str[i-1]=='B')   q.push(0);
            else q.push(-l);
        }
    }
    while(!q.empty())
    {
        cnt=max(0,cnt+q.front());
        if(q.front()==0)    ans=ans+cnt;
        q.pop();
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;

int main(int argc, char *argv[]) {

	int D; cin >> D;

	vector<int> c(26,0);
	vector<vector<int>> s(D,vector<int>(26,0));
	vector<int> t(D,0);

	for (int i = 0; i < 26; i++) {
		cin >> c[i];
	}

	for (int i = 0; i < D; i++) {
		for (int j = 0; j < 26; j++) {
			cin >> s[i][j];	
		}
	}

	for (int i = 0; i < D; i++) {
		cin >> t[i];
	}

	int M; cin >> M;

	for (int k = 0; k < M; k++) {
		//cin >> d[k] >> q[k];
		vector<int> last(26,0);
		int d,q; cin >> d >> q;
		t[d-1] = q;
		int ans = 0;
		for (int i = 0; i < D; i++) {
			ans += s[i][t[i]-1];	
			last[t[i]-1] = i+1;
			for (int j = 0; j < 26; j++) {
				ans -=	c[j] * ((i+1) - last[j]) ;
			}
		}
		cout << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define IO std :: ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define double long double
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define nl '\n'
#define yy "YES\n"
#define nn "NO\n"
#define mp map
#define ump unordered_map
#define ve vector
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define setp(x) setprecision(x)
#define f first
#define s second
#define inf LONG_MAX
#define mod 1000000007
const int N = 2000005;
int fact[N];
using namespace std;

int power(int a,int b)
{
    int ans = 1;
    while(b)
    {
        if(b & 1)
            ans = (ans * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans;
}

int modInv(int a,int b)
{
    return (a * power(b,mod - 2)) % mod;
}

void calc()
{
    fact[0] = 1;
    for(int i = 1; i<N; i++)
        fact[i] = (fact[i - 1] * i) % mod;
}

int ncr(int n,int r)
{
    int a = fact[n];
    int b = (fact[n - r] * fact[r]) % mod;
    return modInv(a,b);
}

signed main()
{
        IO;
        int r1,r2,c1,c2;
        calc();
        //cin >> a;
      //  cout << fact[a];
        //cin >> a >> b;
        //cout << power(a,b);
        cin >> r1 >> c1 >> r2 >> c2;
        int answer = (ncr(c2+r2+2,r2+1) - ncr(r1+c2+1,r1) - ncr(r2+c1+1,r2+1) + ncr(r1+c1,r1) + 2 * mod ) % mod;
        cout << answer;
        return 0;
}


Measured memory_bytes: 15872
import sys

def resolve():
    N = int(input())
    ans = 0
    if N >= 100000:
        ans = 90909
    elif N >= 10000:
        ans = 909 + N - 10000 + 1
    elif N >= 1000:
        ans = 909
    elif N >= 100:
        ans = 9 + N - 100 + 1
    elif N >= 10:
        ans = 9
    else:
        ans = N
    print(ans)


if __name__ == "__main__":
    resolve()


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

int main() {
  int n,temp,sum;
  cin>>n;
  temp = n;
  while(temp>0){
    sum += temp % 10;
    temp /= 10;
  }
  if(n%sum==0) cout<<"Yes";
  else cout<<"No";
}

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

int n;

int par[5000], a[5000];

void init() {
	for (int i = 0; i < n; ++i)
		par[i] = i;
}

int find(int x) {
	if (par[x] == x)
		return x;
	else
		return par[x] = find(par[x]);
}

void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)
		return;
	if (a[x] < a[y]) {
		par[y] = x;
		//std::cout << "called" << std::endl;
	}
	else {
		par[x] = y;
		//std::cout << "call" << std::endl;
	}
}

bool same(int x, int y) {
	return find(x) == find(y);
}

std::unordered_map<std::string, int> index;

int main() {
	int m;
	std::cin >> n;
	std::string str;
	for (int i = 0; i < n; ++i) {
		std::cin >> str >> a[i];
		index.emplace(str, i);
	}
	init();
	std::string _a, _b;
	int x, y;
	std::cin >> m;
	for (int i = 0; i < m; ++i) {
		std::cin >> _a >> _b;
		x = index[_a];
		y = index[_b];
		if (!same(x, y))
			unite(x, y);
	}
	int sum = 0;
	for (int i = 0; i < n; ++i) {
		sum += a[find(i)];	
	}
	std::cout << sum << std::endl;
	//system("pause");
	return 0;
}

Measured memory_bytes: 3808
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <iomanip>
using namespace std;
typedef long long ll;

int main() {
    ll n, k;
    cin >> n >> k;
    ll a[n + 5], f[n + 5];
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> f[i];
    sort(a, a + n);
    sort(f, f + n, greater<ll>());

    ll ng = -1, ok = 1e18;
    while (ok - ng > 1) {
        ll mid = (ng + ok) / 2, l = k;
        for (int i = 0; i < n; i++) {
            l -= max(0ll, a[i] - mid / f[i]);
        }
        if (l >= 0) ok = mid;
        else ng = mid;
        //cout << mid << " " << l << endl;
    }

    cout << ok << endl;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch Backfront | diff Backfront.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address Backfront.cpp && ./a.out

/*
 
 4/2/2020
 
 21:17-
 
 */

const int MAX_N=1e6+1;
LL A[MAX_N];
int N;

void solve() {
  VI pos(N);
  REP(i,N)pos[A[i]-1]=i;
  int res=0;
  int i=0;
  while(i<N) {
    int j=i+1;
    while(j<N&&pos[j]>pos[j-1]) ++j;
    SMAX(res,j-i);
    i=j;
  }
  cout<<N-res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>N;
  REP(i,N) cin>>A[i];
  solve();
  
  return 0;
}


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

int solve(multimap<int,bool> &record,int ts,int te){
  int d=0,sum=0,start=0;
  for(multimap<int,bool>::iterator it=record.begin();it!=record.end();++it){
    if(!d&&it->second)start=it->first;
    if(it->second)++d;
    else --d;
    if(!d){
      int st,en;
      st=(ts>start)?ts:start;
      en=(te<it->first)?te:it->first;
      sum+=(en-st>0)?en-st:0;
    }
  }
  return sum;
}

int main(void){
  int n,m;
  while(cin>>n>>m,n||m){
    int r,q;
    cin>>r;
    vector<multimap<int,bool> > record(m);
    for(int i=0,t,a,b,s;i<r;++i){
      cin>>t>>a>>b>>s;
      record[b-1].insert(make_pair(t,((s)?true:false)));
    }
    cin>>q;
    for(int i=0,ts,te,a;i<q;++i){
      cin>>ts>>te>>a;
      cout<<solve(record[a-1],ts,te)<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1688
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, N=0;
  cin >> A >> B;
  for(int K=A; K<=B; K++){
    if(K/10000 == (K%10)){
      if((K%10000)/1000 == (K%100)/10){
        N = N + 1;
      }
    }
  }
  cout << N << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int n, i, j, k, l, cnt, m;
    while(scanf("%d", &n) != EOF){
        cnt = 0;
        for(i=0; i<10; i++){
            for(j=0; j<10; j++){
                for(k=0; k<10; k++){
                    for(l=0; l<10; l++){
                        //m=i+j+k+l;
                        if(i+j+k+l==n) cnt++;
                    }
                }
            }
        }
    printf("%d\n", cnt);
    }
    return 0;
}

Measured memory_bytes: 596
N = int(input())
P = tuple([i for i in map(int,input().split())])
Q = tuple([i for i in map(int,input().split())])

nums = [i+1 for i in range(N)]
import itertools
count = 0
for v in itertools.permutations(nums,N):
  count += 1
  if v == P:
    a = count
  if v == Q:
    b = count
    
print(abs(a-b))


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t=1;
    //cin>>t;
    while(t--)
    {
        int l=0,ans=0;
        string s;
      cin>>s;
      while(l<s.size()){
            int k=0;
        while(l<s.size()&&s[l]=='R') l++,k++;
        ans=max(ans,k);
        l++;
      }
      cout<<ans;
    }
}


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

using namespace std;
const int N = 1e5 + 5;
typedef long long ll;

int cnt[30] = {0};
char str[N];
bool up[30];

int main() {
    scanf("%s", str);
    int len = strlen(str);
    for(int i = 0; i < len; i++) {
        up[str[i] - 'a'] = true;
        cnt[str[i] - 'a']++;
    }

    int tp = 0;
    for(int i = 0; i < 26; i++) {
        if(up[i]) tp++;
    }

    if(tp == 2) {
        printf("Second");
        return 0;
    }

    int remain = len - 2;
    if(len & 1) {
        if(str[0] == str[len - 1]) printf("Second");
        else printf("First");
    }
    else {
        if(str[0] == str[len  - 1]) printf("First");
        else printf("Second");
    }

    return 0;
}


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

  void LCS(int m, int n )
  {
     int L[m+1][n+1];
     for (int i=0; i<=m; i++)
     {
       for (int j=0; j<=n; j++)
       {
         if (i == 0 || j == 0)
           L[i][j] = 0;
         else if (s1[i-1] == s2[j-1])
           L[i][j] = L[i-1][j-1] + 1;
         else
           L[i][j] = max(L[i-1][j], L[i][j-1]);
       }
     }
     int index = L[m][n];
     string str;
     int i = m, j = n;
     while (i > 0 && j > 0)
     {
        if (s1[i-1] == s2[j-1])
        {
            str += s1[i-1]; 
            i--; j--; index--;     
        }
        else if (L[i-1][j] > L[i][j-1])
           i--;
        else
           j--;
     }
     if(str.length() == 0) {
      cout<<' ';
     }
     else {
      reverse(str.begin(),str.end());
      cout<<str;
     }
  }

  int main()
  {
    cin>>s1>>s2;
    LCS(s1.length(), s2.length());
    return 0;
  }

Measured memory_bytes: 35456
def binary_search(list, item):
    low = 0
    high = len(list)
    
    while low < high:
        mid = (low + high)//2
        if list[mid] < item:
            low = mid+1
        else:
            high = mid
    return low
  
N = int(input())
L = list( map(int, input().split()) )

L.sort()

count = 0
for a in range(0, len(L)-2):
    for b in range(a+1, len(L)-1):
        count += binary_search(L[b+1:], L[a]+L[b])
print(count)


Measured memory_bytes: 50652
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define c(P)        cout<<P<<"\n"
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define F           first
#define S           second
#define mem(a,val)  memset(a,val,sizeof(a))
#define fr(i,x,n)   for(ll i=x;i<n;i++)
#define frr(i,x,n)  for(ll i=n-1;i>=x;i--)
using namespace std;


const ll N   =  500005;
const ll mod = 1e9 + 7;



void solve(){

  ll x=0,y=0,c=0,ans=0;
  ll n,m,k;
  cin>>n>>m>>k;
 x = ((n)/(m+k));
  c(x*m + min(m,n -x*(m+k)));
}

signed main(){
     
  ios_base::sync_with_stdio(false);   
  cin.tie(NULL);
  ll T=1;
  //cin>>T;
  while(T--){
  solve();
  }
  return 0;
}


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

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

using namespace std;

int main()
{
    string s;
    cin >> s;

    int check_C = -1, check_F = -1;
    for(int i = 0; s[i]; i++){
        if(s[i] == 'C') check_C = i;
        if(s[i] == 'F') check_F = i;
    }
    if(check_C > -1 && check_F > -1 && check_C < check_F) cout << "Yes";
    else cout << "No";
    cout << endl;
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  double n,m,d;
  cin>>n>>m>>d;
  double ans;
  if(d==0)ans=(m-1)/n;
  else ans=(m-1)*2*(n-d)/(n*n);
  cout<<fixed<<setprecision(10)<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n - 1); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
using namespace std;
using P = pair<int, int>;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int dist[1000][1000];
string grid[1000];
int h, w, sy, sx, gy, gx;
const int INF = (1 << 30);

int main() {
  cin >> h >> w;
  cin >> sy >> sx;
  sy--, sx--;
  cin >> gy >> gx;
  gy--; gx--;
  rep(i, h){
    rep(j, w){
      dist[i][j] = INF;
    }
  }
  rep(i, h) cin >> grid[i];
  dist[sy][sx] = 0;
  deque<P> que;
  que.push_front(P(sy, sx));
  while (!que.empty()){
    P p = que.front();
    que.pop_front();
    int cy = p.first, cx = p.second;
    for (int i = 0; i < 4; i++){
      int ny = cy + dy[i], nx = cx + dx[i];
      if (ny < 0 || h <= ny || nx < 0 || w <= nx)continue;
      if(grid[ny][nx] == '#')continue;
      if(dist[ny][nx] <= dist[cy][cx])continue;
      dist[ny][nx] = dist[cy][cx];
      que.push_front(P(ny, nx));
    }
    for (int i = cy -2; i <= cy + 2; i++){
      for (int j = cx - 2; j <= cx + 2; j++){
        if (i < 0 || h <= i || j < 0 || w <= j)continue;
        if(grid[i][j] == '#')continue;
        if(dist[i][j] <= dist[cy][cx] + 1)continue;
        dist[i][j] = dist[cy][cx] + 1;
        que.push_back(P(i, j));
      }
    }
  }
  if(dist[gy][gx] ==INF){
    cout << -1 << endl;
  }else{
    cout << dist[gy][gx] << endl;
  }
}


Measured memory_bytes: 9404
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String[] s = sc.next().split("");
		int west = 0;
		int east = 0;
		int[] westInfo = new int[n];
		for(int i =0;i <n;i++) {
			if(s[i].equals("W")) {
				west++;
			}else {
				east++;
			}
			westInfo[i] = west;
		}
		int[] turnInfo = new int[n];
		for(int i =0;i < n;i++) {
			//リーダーより西に居て西を向いてる人
			int wester = westInfo[i];
			if(s[i].equals("W")) {
				wester--;
			}
			//リーダーより東に居て東を向いてる人
			int easter = east - ((i+1) - westInfo[i]);
			turnInfo[i] = wester + easter;
		}
		int answer = Integer.MAX_VALUE;
		for(int i = 0;i < n;i++) {
			if(answer > turnInfo[i]) {
				answer = turnInfo[i];
			}
		}
		System.out.println(answer);

	}
}

Measured memory_bytes: 53440
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define dfor(i,a,b) for(int i=(a);i>=(b);i--)
#define ll long long
#define ull unsigned long long
#define MOD  1000000007
#define MAX  1e9
#define pb   push_back
#define F    first
#define S    second


int main() {
	int n;
	cin>>n;
	int a[n];
	rep(i,n){
		cin>>a[i];
	}
	int p=1,sum=0;
	rep(i,n){
		FOR(j,i+1,n){
			sum += a[i]*a[j];
		}
	}
	cout<<sum;
	
}

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

typedef long long ll;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

const int N = 100005;
vector<int> g[N];
int cnt[N];
// P es[N];
vector<P> es;
int col[N];
int deg[N];

void dfs(ll v,ll pre){
  cnt[v]=1;
  for(ll nv : g[v]){
    if(nv==pre)continue;
    dfs(nv,v);
    cnt[v]+=cnt[nv];
  }
}

void ddfs(ll v,ll pre,ll c){
  col[v]=c;
  for(ll nv : g[v]){
    if(nv==pre)continue;
    ddfs(nv,v,c);
  }
}

bool solve(){
  int n,x,y;
  scanf("%d%d%d", &n, &x, &y);
  x--; y--;

  // memset(deg,0,sizeof(deg));

  rep(i,n-1){
    int a,b;
    scanf("%d%d", &a, &b);
    a--;b--;
    g[a].push_back(b);
    g[b].push_back(a);
    // es[i] = {a,b};
    es.push_back({a,b});
    deg[a]++;
    deg[b]++;
  }

  if(n==2) return true;
  if(n%2==1) return false;

  dfs(0,-1);
  memset(col,-1,sizeof(col));
  rep(i,n-1){
    ll a=es[i].fi, b=es[i].se;
    if(cnt[a]<cnt[b]) swap(a,b);
    if(cnt[b]==n-cnt[b]){
      ddfs(a,b,0);
      ddfs(b,a,1);
      deg[a]--;
      deg[b]--;
      break;
    }
  }

  if(col[x]==col[y]) return false;

  int cnt1[2] = {0,0};
  rep(i,n){
    if(deg[i]>2) return false;
    if(deg[i]==1) cnt1[col[i]]++;
  }

  if(cnt1[0]!=2 || cnt1[1]!=2) return false;

  return (deg[x]==1 && deg[y]==1);
}

int main(){
  if(solve()) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}



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

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

int main(){
  
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i=0;i<N;i++){
    cin >> A[i];
  }
  
  vector<int> Lgcd(N);
  vector<int> Rgcd(N);
  
  for (int i=0;i<N;i++){
    if (i==0) Lgcd[0] = A[0];
    else Lgcd[i] = gcd(Lgcd[i-1],A[i]);
  }
  for (int i=N-1;i>=0;i--){
    if (i==N-1) Rgcd[N-1] = A[N-1];
    else Rgcd[i] = gcd(Rgcd[i+1],A[i]);
  }
  
  int ans = 0;
  
  for (int i=0;i<N;i++){
    ans = max(ans,gcd(Lgcd[i-1],Rgcd[i+1]));
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 1536
#include <iostream>
#define int long long
using namespace std;

int n, x;
int Pcnt[51];
int Bcnt[51];
int maisu[51];

signed main() {
	int i;
	
	cin >> n >> x;
	
	Pcnt[0] = 1; maisu[0] = 1;
	for (i = 1; i <= n; i++) {
		Pcnt[i] = 2 * Pcnt[i - 1] + 1;
		Bcnt[i] = 2 * Bcnt[i - 1] + 2;
		maisu[i] = Pcnt[i] + Bcnt[i];
	}
	
	int remX = x;
	int ans = 0;
	for (i = n; i >= 0; i--) {
		if (i == 0) { if (remX > 0) { ans++; remX--; } break; }
		remX--; if (remX == 0) { break; } //B
		if (remX <= maisu[i - 1]) { continue; }
		remX -= maisu[i - 1]; ans += Pcnt[i - 1];
		remX--; ans++; if (remX == 0) { break; } //P
		if (remX <= maisu[i - 1]) { continue; }
		remX -= maisu[i - 1]; ans += Pcnt[i - 1];
		remX--; if (remX == 0) { break; } //B
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;using pll=pair<ll,ll>;using pld=pair<ld,ld>;
const ll INF=1LL<<60;void solve();int main(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();}
#define fi first
#define se second
#define SELECTOR(_1,_2,_3,_4,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep2,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(ll i=0;i<n;++i)
#define _rep1(i,k,n) for(ll i=k;i<n;++i)
#define _rep2(i,k,n,d) for(ll i=k;d!=0&&d>0?i<n:i>n;i+=d)
template<class T> vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_v(size_t a,Ts... ts){return vector<decltype(make_v(ts...))>(a,make_v(ts...));}
template<class T> inline bool chmax(T &a,const T &b){if(a<b){a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a,const T &b){if(a>b){a=b; return 1;} return 0;}
template<class T> void contout(const T &v){for(auto it=v.begin();it!=v.end();++it,cout<<(it!=v.end()?" ":"\n"))cout<<*it;}

const long long MOD = 1000000007;

void solve(){
  ll h,w; cin>>h>>w;
  auto dp=make_v(h,w,0);
  dp[0][0]=1;
  vector<string> grid(h);
  rep(i,h) cin>>grid[i];
  rep(i,h)rep(j,w){
    if(i+1<h&&grid[i+1][j]!='#') {
      dp[i+1][j]+=dp[i][j];
      dp[i+1][j]%=MOD;
    }
    if(j+1<w&&grid[i][j+1]!='#') {
      dp[i][j+1]+=dp[i][j];
      dp[i][j+1]%=MOD;
    }
  }
  cout<<dp[h-1][w-1]%MOD<<"\n";
}

Measured memory_bytes: 5248
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
ll dp[300000];
/* RMQ：[0,n-1] について、区間ごとの最小値を管理する構造体
    update(i,x): i 番目の要素を x に更新。O(log(n))
    query(a,b): [a,b) での最小の要素を取得。O(log(n))
*/
template <typename T>
struct RMQ {
    const T INF = numeric_limits<T>::max();
    int n;         // 葉の数
    vector<T> dat; // 完全二分木の配列
    RMQ(int n_) : n(), dat(n_ * 4, INF) { // 葉の数は 2^x の形
        int x = 1;
        while (n_ > x) {
            x *= 2;
        }
        n = x;
    }

    void update(int i, T x) {
        i += n - 1;
        dat[i] = x;
        while (i > 0) {
            i = (i - 1) / 2;  // parent
            dat[i] = min(dat[i * 2 + 1], dat[i * 2 + 2]);
        }
    }

    // the minimum element of [a,b)
    T query(int a, int b) { return query_sub(a, b, 0, 0, n); }
    T query_sub(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) {
            return INF;
        } else if (a <= l && r <= b) {
            return dat[k];
        } else {
            T vl = query_sub(a, b, k * 2 + 1, l, (l + r) / 2);
            T vr = query_sub(a, b, k * 2 + 2, (l + r) / 2, r);
            return min(vl, vr);
        }
    }
};
int main(){
    ll n,k;
    cin >> n >> k;
    vector<ll> a(n);
    for(int i = 0;i < n;i++)cin >> a[i];
    for(int i = 0;i < n;i++)dp[i] = 0;
    dp[0] = 1;
    vector<ll> sum;
    sum.push_back(a[0]);
    RMQ<ll> r(300001);
    for(int i = 0;i < 300001;i++)r.update(i,0);
    r.update(a[0],-1);
    for(int i = 1;i < n;i++){
        ll now = 0;
        now = r.query(a[i] - k,a[i] + k + 1) * -1;
        r.update(a[i],(now + 1) * -1);
        dp[i] = now + 1;
    }
    ll res = 0;
    for(int i = 0;i < n;i++){
        res = max(res,dp[i]);
    }
    cout << res << endl;
}

Measured memory_bytes: 17260
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int n,a[200000],ans;
int read()
{  int f=1,x=0;
   char ch=getchar();
   for(;ch>'9'||ch<'0';ch=getchar()) if(ch=='-') f=-1;
   for(;ch<='9'&&ch>='0';ch=getchar()) x=x*10+ch-'0';
   return x;
}
int main()
{    int i,j,Max,Min;
    n=read();
    for(i=0;i<n;i++)a[i]=read();
    Max=a[0],Min=a[0];
    for(i=0;i<n;i++)
    {   if(Min>=a[i]){Min=a[i];ans++;continue;}
        if(Max<a[i]){Max=a[i];continue;}
        //for( j=0;j<i;j++)
        //{    if(a[j]>Max)Max=a[j];
        //     if(a[j]<Min)Min=a[j];
         //    if(Max<a[i])break;
        //}

       // if(j==i)ans++;
    }
    printf("%d",ans);

    return 0;
}


Measured memory_bytes: 1024
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#pragma region header
#include <bits/stdc++.h>
#define all(a) begin(a), end(a)
#define mp make_pair
#define rep1(i, n) for (decltype(+n) i = 0; i < (n); i++)
#define rrep1(i, n) for (auto i = n - 1; i > static_cast<decltype(i)>(-1); i--)
#define rep2(i, a, b) for (auto i = (a); i < (b); i++)
#define rrep2(i, a, b) for (auto i = b - 1; i >= a; i--)
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_MACRO(__VA_ARGS__, rep2, rep1) (__VA_ARGS__)
#define rrep(...) GET_MACRO(__VA_ARGS__, rrep2, rrep1) (__VA_ARGS__)
#define each(i, a) for (auto &&i : (a))
using namespace std;

using vi = vector<int>;

template <class T>
void COUT(const T &x) { cout << x << endl; }

constexpr int lshift(const int &x) noexcept { return 1ll << x; }

#pragma endregion header

void solve(int N, vi a, vi b) {
  int ans = 0;
  vi t(29, 1), u(29);
  rep(i, 28) t[i + 1] = t[i] << 1;
  rep(i, 29) u[i] = t[i] * 2 - 1;
  rrep(k, 29) {
    each(x, a) x &= u[k];
    each(x, b) x &= u[k];
    sort(all(b));
    bool odd = false;
    int t1 = t[k], t2 = t[k] * 2, t3 = t[k] * 3, t4 = t[k] * 4;
    each(x, a) odd ^= ((lower_bound(all(b), t4 - x) - lower_bound(all(b), t3 - x)) ^ (lower_bound(all(b), t2 - x) - lower_bound(all(b), t1 - x))) & 1;
    if(odd) ans += lshift(k);
  }
  COUT(ans);
}


#pragma region main
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  int N;
  cin >> N;
  vi a(N);
  for(int i = 0 ; i < N ; i++){
    cin >> a[i];
  }
  vi b(N);
  for(int i = 0 ; i < N ; i++){
    cin >> b[i];
  }
  solve(N, move(a), move(b));
}
#pragma endregion main


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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) {
    return stream << p.first << " " << p.second;
}
template <typename T>
void print(const vector<T> vec) {
    unsigned int len = vec.size();
    rep (i, len - 1)
        cout << vec[i] << ' ';
    cout << vec[len - 1] << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}
template <typename T>
T sum_(vector<T> vec, T init = 0) {
    return std::accumulate(all(vec), T(init));
}

template <typename T>
void init(vector<T>& v) {
    rep (i, v.size())
        cin >> v[i];
}

template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) {
    assert(v.size() == w.size());
    rep (i, v.size())
        cin >> v[i] >> w[i];
}

// clang-format off
template<typename T>
bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    print(max(c - (a - b), 0LL));

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int h,w,n,j=-1,color=1;
int main(void){
    cin>>h>>w>>n;
    int a[n+1],ans[h][w];
    for(int i=0;++i-1-n;)cin>>a[i];
    for(int i=-1;++i-h;){
        for(;(j+=(i%2)*-2+1)>-1&&j<w;){
            ans[i][j]=color;
            if(!--a[color])++color;
        }
    }
    for(int i=-1;++i-h;){
        cout<<ans[i][0];
        for(j=0;++j-w;)cout<<' '<<ans[i][j];
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int H, W;
char S[112];

int main(void) {
	scanf("%d%d", &H, &W);
	for (int i = 0; i < H; ++i) {
		scanf("%s", &S);
		printf("%s\n%s\n", S, S);
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <queue>
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(){
    ll a,b; cin>>a>>b;
    if(a+b==15){
        cout<<'+'<<endl;
    }else if(a*b==15){
        cout<<'*'<<endl;
    }else{
        cout<<'x'<<endl;
    }
}

Measured memory_bytes: 256
package main

import "fmt"

type point struct{ x, y int }

func main() {
	var n int
	fmt.Scan(&n)
	xs := make([]int, n)
	ys := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&xs[i], &ys[i])
	}

	vectors := make(map[point]int, n*n)
	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			dx := xs[j] - xs[i]
			dy := ys[j] - ys[i]
			if dx < 0 {
				dx = -dx
				dy = -dy
			} else if dx == 0 && dy < 0 {
				dx = -dx
				dy = -dy
			}

			v := point{x: dx, y: dy}
			vectors[v]++
		}
	}

	ctMax := 0
	for _, ct := range vectors {
		if ct > ctMax {
			ctMax = ct
		}
	}

	fmt.Println(n - ctMax)
}


Measured memory_bytes: 640
import java.util.Scanner;

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

        int N = sc.nextInt();

        System.out.println(solve(N) ? "Yes" : "No");

        sc.close();
    }

    static boolean solve(int N) {
        for (int i = 0; i * 4 <= N; ++i) {
            if ((N - i * 4) % 7 == 0) {
                return true;
            }
        }

        return false;
    }
}

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

int main() {
    int n, l;
    cin >> n >> l;
    vector<string> s(n);
    for (int i = 0; i < n; i++) cin >> s[i];

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

    string ans;
    for (int i = 0; i < n; i++) ans += s[i];
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int s, w;
	cin >> s >> w;
	if(w>=s) cout << "unsafe";
	else cout << "safe";
    return 0;
}

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

using namespace std;
using ull = unsigned long long;

const ull lim = (ull)1e18;

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

    vector<ull> inputs(N);
    for(int i=0; i<N; i++){
        cin >> inputs.at(i);
        if(inputs.at(i) == 0){
            cout << 0 << endl;
            return 0;
        }
    }


    ull sum=1;
    for(int i=0; i<N; i++){
        ull in = inputs.at(i);
        ull pre = sum;
        sum = sum * in;
        if(pre > sum || sum>lim){
            cout << -1 << endl;
            return 0;
        }
    }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 4000
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <climits>
#include <map>
#include <functional>
#include <cmath>
#include <cassert>
#include <boost/math/common_factor.hpp>

using namespace std;

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

    vector<long> t(n); for (int i = 0; i < n; i++) cin >> t[i];
    cout << accumulate(t.begin(), t.end(), 1L,
                       [](long a,long b) {
                           return boost::math::lcm(a,b);
                       });
    cout << endl;
    return 0;
}

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

using namespace std;
const int N = 1e5 + 3;
int main() {
#ifndef ONLINE_JUDGE
//	freopen("input.in", "r", stdin);
//	freopen("output.out", "w", stdout);
#endif
	int a, b;
	cin >> a >> b;
	cout << max(a * b, max(a - b, a + b));
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a,b) ((a<b)?a:b)
#define _max(a,b) ((a<b)?b:a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a)?1:-1)
#define SORT(v) sort(v.begin(),v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380


int main()
{
	cout << fixed << setprecision(10);

	int h, w, k;
	cin >> h >> w >> k;

	vector<string> c(h);
	REP(i, h)
	{
		cin >> c[i];
	}
	int ans = 0;

	REP(i, 1 << h)
	{
		REP(j, 1 << w)
		{
			int cnt = 0;
			REP(x, w)
			{
				REP(y, h)
				{
					if (c[y][x] != '#')continue;
					if (((1 << x) & j) != 0)continue;
					if (((1 << y) & i) != 0)continue;
					cnt++;
				}
			}

			if (cnt == k)ans++;

		}
	}

	cout << ans;
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

ll calc(ll a) {

    if(a <= 0) {
        return 0;
    }

    a++;
    ll ans = 0;
    rep(i, 50) {
        ll loop = (1LL << (i+1));
        ll cnt = (a/loop)*(loop/2);
        cnt += max(0LL, (a%loop) - (loop/2));

        if(cnt%2 == 1) {
            ans += (1LL << i);
        }
    }

    return ans;
}

int main() {
    ll a, b;
    cin >> a >> b;
    ll ans = calc(b)^calc(a-1);

    cout << ans;

    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#!/user/bin/env pypy3
import sys
from typing import Tuple


def fast_input():
    return sys.stdin.readline()[:-1]


def solve(num: int, amount: int) -> Tuple[int, int, int]:
    for count_10000 in range(0, num + 1):
        for count_5000 in range(0, num - count_10000 + 1):
            count_1000 = num - (count_10000 + count_5000)
            total = count_10000 * 10000 \
                        + count_5000 * 5000 \
                        + count_1000 * 1000
            if total == amount:
                return count_10000, count_5000, count_1000
    return -1, -1, -1


def main():
    n, y = list(map(int, fast_input().split()))
    result = solve(n, y)
    print(*result)


main()


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

int main() {
  int N, M;
  cin >> N >> M;
  vector<pair<ll, int>> AB(N);
  for (int i = 0; i < N; i++)
  {
    cin >> AB[i].first >> AB[i].second;
  }
  sort(AB.begin(), AB.end());
  ll ans = 0;
  int cnt = 0;
  for (int i = 0; i < N; i++)
  {
    if (cnt + AB[i].second >= M) {
      ans += AB[i].first * (M - cnt);
      break;
    } else
    {
      cnt += AB[i].second;
      ans += AB[i].first * AB[i].second;
    }
  }
  cout << ans << endl;
  return 0;
}


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

namespace program
{
    class Program
    {
        static void Main()
        {
            int[] S = Input.ScanIntArray();
          Console.WriteLine((S[0]<=S[2]) && (S[2]<=S[1]) ? "Yes" : "No");
        }
    }

    static class Input
    {
        static public int ScanInt() { return int.Parse(Console.ReadLine()); }
        static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
        static public long ScanLong() { return long.Parse(Console.ReadLine()); }
        static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
        static public int[] ScanIntArray() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); }
        static public uint[] ScanUintArray() { return Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray(); }
        static public long[] ScanLongArray() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray(); }
        static public ulong[] ScanUlongArray() { return Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray(); }

        static public string ScanStr() { return Console.ReadLine(); }
        static public string[] ScanStrArray() { return ScanStr().Split(' '); }
    }

    static class MyMath
    {
        public static int GCD(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static ulong GCD(ulong a, ulong b)
        {
            Func<ulong, ulong, ulong> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static int LCM(int a, int b)
        {
            return a * b / GCD(a, b);
        }
        public static ulong LCM(ulong a, ulong b)
        {
            return a * b / GCD(a, b);
        }
    }
}


Measured memory_bytes: 13268