akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
using namespace std;

int main(){
	int input[5];
	for(int i=0; i < 5; i++) cin >> input[i];
	sort(input, input+5);
	for(int i = 4; 0 <= i; i--){
		if(i != 4) cout << ' ';
			cout << input[i];
	}
	cout << endl;
}

Measured memory_bytes: 1176
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;

double distance(double a,double b,double c,double d){
  double dis=sqrt(pow(c-a,2)+pow(d-b,2));
  return dis;
}

int main(){
  double x1,x2,y1,y2;
  cin >> x1 >> y1 >> x2 >> y2;

  cout << fixed << setprecision(5) << distance(x1,y1,x2,y2) << endl;

  return 0;
}



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

ll n , w;
pair <ll , ll> p [100];

ll dp [100][100000];

ll f (ll , ll);

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie (0);
    cout.tie (0);

    memset (dp , -1 , sizeof dp);

    cin >> n >> w;
    for (ll i=0; i<n; ++i)
        cin >> p[i].first >> p[i].second;

    cout << f (0 , 0);

    return 0;
}

ll f (ll indx , ll weight)
{
    if (indx == n)
        return 0;

    if (dp [indx][weight] != -1)
        return dp [indx][weight];

    ll ans1 = -1 , ans2;
    if (weight + p[indx].first <= w)
        ans1 = p[indx].second + f (indx+1 , weight + p[indx].first);

    ans2 = f (indx+1 , weight);

    return dp [indx][weight] = max (ans1 , ans2);
}

Measured memory_bytes: 78336
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ITP1_8_D
{
    class Program
    {
        static void Main(string[] args)
        {
            var target = Console.ReadLine();
            var word = Console.ReadLine();

            //target = target + target.Substring(0, word.Length - 1);
            //var find = target.Contains(word);
            //Console.WriteLine(find ? "Yes" : "No");

            var index = 0;
            for (var h = 0; h < target.Length; ++h)
            {
                index = 0;
                for (var i = 0; i < word.Length; ++i)
                {
                    var charIndex = (h + i) % target.Length;
                    if (target[charIndex] != word[index])
                    {
                        break;
                    }
                    ++index;
                }

                if (index == word.Length)
                {
                    break;
                }
            }

            Console.WriteLine((index == word.Length) ? "Yes" : "No");
        }
    }
}

Measured memory_bytes: 17540
#include <bits/stdc++.h>
using namespace std;
int main() {
  int K;
  string S;
  cin >> K >> S;
  if (K < S.size()) {
     for (int i = 0; i < K; i++) {
     	cout << S[i];
     }
     cout << "..." << endl;
  } else {
  	cout << S << endl;
  }
  
}


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

int main() {
    int n;
    cin >> n;
    set<string> a;
    for(int i=0; i<n; i++) {
        string s;
        cin >> s;
        if(!(a.count(s))) a.insert(s); 
    }
    cout << a.size();
}

Measured memory_bytes: 19252
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/* clang-format off */
#define MOD 1000000007
#define INF 1000000000
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
#define __DEBUG__
#ifdef __DEBUG__
#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";
#define DEBUG(x) cout<<#x<<":"<<x<<"\n"
#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"
#endif
#ifndef __DEBUG__
#define CH_P(a) 
#define DEBUG(x) 
#define DEBUGS(v) 
#endif
/* clang-format on */

int main() {
  ll n, l, m = INF, ans=0;
  cin >> n >> l;
  REP(i, n) {
    if (abs(m) > abs(l + i)) {
      m = l + i;
    }
  }
  REP(i, n) { ans += l + i; }
  cout <<ans -m<< endl;
  return 0;
}


Measured memory_bytes: 3608
#include<stdio.h>
#include<math.h>
int main()
{
	int n,l,i,a[205],b,c,j,d;
	while(~scanf("%d%d",&n,&l))
	{
		int sum=0;
		for(i=1;i<=n;i++)
		{a[i]=l+i-1;
		sum+=a[i];
		}
		for(j=1;j<n;j++)
		 {b=fabs(a[j]);
		  c=fabs(a[j+1]);
		  if(b<c)
		  {d=a[j];
		   a[j]=a[j+1];
		   a[j+1]=d;
		  }
		}
		printf("%d\n",sum-a[n]);
	}
}

Measured memory_bytes: 128
while 0<n=gets.to_i
h={}
q=[[1,0,0],[0]*3]
a=q.map{gets.split.map &:to_i}
h[(b,f,c=q.shift)[0,2]]||=(
u,v=a[b][f,2]
u&&(u>1||u>0&&v==1?(q=[[b,u>1?f-1:f+1,c]]+q):f>n-2?(break):3.times{|i|q<<[1-b,f+i,c+1]})
c)while t=q[0]
puts t ?c:"NA"
end

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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

const string dir = "NESW";

int N;
int L[210];

int main() {
	cin >> N;
	N *= 2;
	rep(i, N) cin >> L[i];
	sort(L, L + N);

	int ans = 0;
	for (int i = 0; i < N; i += 2) {
		ans += L[i];
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define rep(i,a,b)    for(ll i=a;i<b;i++)
#define repn(i,a,b)   for(ll i=a;i>=b;i--)
#define F first
#define S second
#define qi queue<ll>
#define pii pair<ll,ll>
#define vi vector<ll>
#define si set<ll>
#define vii vector<pii>
#define mi multiset<ll>
#define mii multiset<pii>
#define MI map<ll,ll>
#define pb push_back
#define mp  make_pair
#define all(v) (v).begin(), (v).end()
#define allr(v) (v).rbegin(), (v).rend()
#define mod 998244353
#define mod2 998244353

// size_t f= str.find(string s,0); find s in str from start
// if found then (f != string::npos)
// m.insert({x,y}); m[x]=y;

int fexp(int a, int b){int ans = 1;while(b){if(b&1) ans = ans*a%mod2; b/=2;a=a*a%mod2;}return ans;}
int inverse(int a, int p){return fexp(a, p-2);}

signed main(){
    IOS
	#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	rep(i,0,5){
      int a;
      cin>>a;
      if(!a){cout<<i+1;break;}
    }
    return 0;
}

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

using namespace std;

const long MAX_SIZE = 100000000 + 1;

int main(int argc, char const *argv[])
{
    vector<bool> table(MAX_SIZE, true);
    table[0] = table[1] = false;
    for (int i = 2; i <= (int)sqrt(MAX_SIZE); i++)
    {
        int num = i;
        if (table[i])
        {
            for (int j = num * num; j < MAX_SIZE; j += num)
                table[j] = false;
        }
    }

    int n, x, primes = 0;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> x;
        if (table[x])
            primes++;
    }
    cout << primes << endl;
    return 0;
}



Measured memory_bytes: 14804
#include <bits/stdc++.h>
using namespace std;
typedef float fl;
typedef long long ll;
int n, dp[50];

int fib(int n){
    if(n == 0 || n == 1) return 1;
    if(dp[n] != 0) return dp[n];
    return dp[n] = fib(n-1) + fib(n - 2);
}


int main(){
    cin >> n;
    cout << fib(n) << endl;
    return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using P = pair<int, int>;
const int INF = 1001001001;

int main(void){
  int n, m;
  cin >> n >> m;
  vector<P> bridge(m);
  REP(i, m){
    int a, b;
    cin >> a >> b;
    a--; b--;
    bridge[i] = P(b, a);
  }
  sort(ALL(bridge));
  int ans = 0;
  int end = 0;
  REP(i, m){
    int a = bridge[i].second;
    int b = bridge[i].first;
    if(a >= end){
      end = b;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main()
{
	string s;
	cin >> s;
	int n = s.size();
	bool f = true;
	if (s[0] != 'A' || s[1] == 'C' || s[n - 1] == 'C') {
		f = false;
	}
	else {
		sort(s.begin(), s.end());
		if (s[1] != 'C' || s[2] - 'a' < 0) {
			f = false;
		}
	}
	if (f) {
		cout << "AC" << endl;
	}
	else {
		cout << "WA" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <vector>
#include <queue>
 
#define MAX_V 1024
using namespace std;
 
void get_map();
void check();
struct edge
{
  int to;
  int weight;
};
 
 
const int INF = INT_MAX/4;
vector<edge> g[2000];
int graph[MAX_V][MAX_V];
int dist[MAX_V];
int numofedge;
int vertex;
int start;
int flag=0;
 
int main()
{
  get_map();
  check();
  //for(int i=0;i<vertex;i++)
    {
      for(int j=0;j<vertex;j++)
    {
      //if(i==j)
        {
          if(graph[start][j]<INF/2 && graph[j][j]<0)
        {
          cout << "NEGATIVE CYCLE" <<endl;
          return 0;
        }
        }
    }
    }
   
    for(int i=0;i<vertex;i++)
      {
    if(graph[start][i]>=INF/2)
      {
        cout << "INF" << endl;
      }
    else
      {
    cout << graph[start][i] << endl;
      }
      }
  return 0;
}
 
int fastmin(int a, int b)
{
    int c = a-b;
  return (((c)>>31)&(c))+b;
}
 
void check()
{
  //  int next;
  //int here = start;
  //for(int i=0;i<vertex;i++)
   
  for(int k=0;k<1000;k++)//v=4
    {
      for(int i=0;i<1000;i++)
    {
      int gik= graph[i][k];
      for(int j=0;j<1000;j++)
        {

          //if(graph[i][k] !=INF && graph[k][j]!=INF)
        {
          graph[i][j]= min(gik+graph[k][j], graph[i][j]);
        }
        }
    }
    }
   
}
 
void get_map()
{
  int edge, from ,to;
  cin >> vertex >> numofedge >> start;
   
  fill(graph[0], graph[vertex], INF);
   
  for(int i=0;i<vertex;i++)
    {
      for(int j=0;j<vertex;j++)
      {
    if(i==j)
      {
        graph[i][j]=0;
      }
    /*else
      {
        graph[i][j]=INF;
        }*/
      }
    }
 
  /*for(int i=0;i<vertex;i++)
    {
      dist[i]=INF;
    }
  */
  for(int i=0;i<numofedge;i++)
    {
      cin>>from>>to;
      cin >> graph[from][to];
    }
 
  /*  for(int i=0;i<numofedge;i++)
    {
      int from, to, weight; 
      cin >> from >> to >> weight;
      g[from].push_back({to , weight});
   }
  */ 
 
  /*  for(int i=0;i<vertex;i++)
    {
      for(int j=0;j<vertex;j++)
    {
      cout << graph[i][j] << " ";
    }
      cout << endl;
      }*/
  // dist[start]=0;
   
  /*  cout << vertex << endl;
  for(int i=0;i<vertex;i++)
    {
      for(int j=0;j<vertex;j++)
    {
      cout << graph[i][j] << " ";
    }  
      cout << endl;    
      }*/
   
 
}

Measured memory_bytes: 5300
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i > (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)

/* exchange */
#define chmin(a, b) (a) = min((ll)(a), (ll)(b))
#define chmax(a, b) (a) = max((ll)(a), (ll)(b))

/* output */
#define IN(x) cin >> x
#define DE(x) cerr << (x) << " "
#define BR cerr << "\n"
#define OUT(x) cout << (x) << endl
#define FIX cout << fixed << setprecision(10)

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll ret = 0;

int main(void){
  
  IN(N);

  OUT((N>=30)?"Yes":"No");

}


Measured memory_bytes: 3592
# coding: utf-8

import sys
import math
import collections
import itertools
from inspect import currentframe
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def MI() : return map(int, input().split())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def chkprint(*args) : names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}; print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

A, B = MI()

for i in range(1,10001):
    if (math.floor(i * 0.08) == A) and (math.floor(i * 0.1) == B):
        print(i)
        break

    if i == 10000:
        print(-1)
        break


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

using namespace std;

typedef long long int ll;

const ll mod = 1e9 + 7;
const ll MAXN = 3e3 + 5;

vector < ll > p(MAXN, 0);

ll sum(ll l, ll r){
  return p[r] - p[l - 1];
}

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

  ll n;
  cin >> n;
  vector < ll > a(n + 1);
  for(int i = 1; i <= n; i++){
    cin >> a[i];
    p[i] = p[i - 1] + a[i];
  }

  if(n == 1){
    cout << a[1] << '\n';
    return 0;
  }

  vector < vector < ll > > dp(n + 1, vector < ll > (n + 1, 0));
  for(int i = 1; i <= n; i++) dp[i][i] = a[i];
  for(int i = n; i >= 0; i--){
    for(int j = i + 1; j <= n; j++){
      dp[i][j] = sum(i, j) - min(dp[i + 1][j], dp[i][j - 1]);
    }
  }

  ll x = dp[1][n], y;
  if(dp[2][n] <= dp[1][n - 1]) y = dp[2][n];
  else y = dp[1][n - 1];

  cout << x - y << '\n';
}


Measured memory_bytes: 70912
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
//#define int long long
template<typename T> inline bool chmax(T& a,T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> inline bool chmin(T& a,T b) { if (a > b) { a = b; return true; } return false; }
const int MOD = 1e9+7;

template<int mod> struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) { if((x += p.x) >= mod) x -= mod; return *this; }
    ModInt &operator-=(const ModInt &p) { if((x += mod-p.x) >= mod) x -= mod; return *this; }
    ModInt &operator*=(const ModInt &p) { x = (int)(1LL*x*p.x%mod); return *this; }
    ModInt &operator/=(const ModInt &p) { *this *= p.inverse(); return *this; }
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0) { t = a/b; a -= t*b; swap(a, b); u -= t*v; swap(u, v); }
        return ModInt(u);
    }
    ModInt pow(int e){
        long long a = 1, p = x;
        while(e > 0) {
            if (e%2 == 0) { p = (p*p)%mod; e /= 2; }
            else { a = (a*p)%mod; e--; }
        }
        return ModInt(a);
    }
    friend ostream &operator<<(ostream &os, const ModInt<mod> &p) {
        return os << p.x;
    }
    friend istream &operator>>(istream &is, ModInt<mod> &a) {
        long long x;
        is >> x;
        a = ModInt<mod>(x);
        return (is);
    }
};

struct combination {
    using mint  = ModInt<MOD>;
    vector<mint> fact, ifact;
    combination(int n) : fact(n+1), ifact(n+1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; i++) fact[i] = fact[i-1] * i;
        ifact[n] = fact[n].inverse();
        for (int i = n; i > 0; i--) ifact[i-1] = ifact[i] * i;
    }
    mint operator() (int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

using mint = ModInt<MOD>;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    
    combination C(N);
    mint ans = 0;
    
    sort(A.begin(), A.end());
    for (int i = 0; i < N; i++) {
        mint now = C(i, K-1);
        ans += now*A[i];
    }
    
    reverse(A.begin(), A.end());
    for (int i = 0; i < N; i++) {
        mint now = C(i, K-1);
        ans -= now * A[i];
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1408
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define reg(i,a,b) for(int i=((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int,int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))
#define iter(v,ite) for(auto ite=(v).begin();ite!=(v).end();ite++)
#define mimunum(v,x) distance((v).begin(),lower_bound((v).begin(),(v).end(),x))


int n;
lli dat[405][4];
map<lli,int> ds;


void l2d(lli no,lli* d){
	irep(i,4){
		d[i]=no%1000;
		no/=1000;
	}
}

lli d2l(lli* d){
	lli res=0;
	rep(i,4){
		res*=1000;
		res+=d[i];
	}
	return res;
}

lli same(lli p,lli q){
	lli dp[4],dq[4];
	l2d(p,dp);
	l2d(q,dq);
	rep(i,4){
		bool ok=true;
		rep(j,4){
			if(dp[j]!=dq[(i+j)%4])ok=false;
		}
		if(ok)return true;
	}
	return false;
}

int ty(lli* d){
	int p=4;
	if(d[0]==d[2] && d[1]==d[3]){
		p=2;
		if(d[0]==d[1])p=1;
	}
	return p;
}

lli sum(lli* d,lli p,lli q){
	lli res=1;
	rep(i,4){
		lli no=d[i];
		lli x=ds[no];
		if(same(no,p))x--;
		if(same(no,q))x--;
		rep(j,i){
			if(same(no,d[j]))x--;
		}
		if(x<=0)return 0;
		lli sd[4];
		l2d(no,sd);
		res *= x * 4 / ty(sd);
	}
	
	//rep(i,4)printf("%012lld ",d[i]);
	//printf("\n%012lld %012lld  %lld\n",p,q,res);
	return res;
}


int main(void){
	scanf("%d",&n);
	rep(i,n){
		lli d[4];
		rep(k,4)scanf("%lld",&d[k]);
		int p=ty(d);
		rep(j,4){
			lli ns=0;
			rep(k,4){
				ns*=1000;
				ns+=d[(j+k)%4];
			}
			if(j<p){
				if(ds.count(ns)==0)ds[ns]=1;
				else ds[ns]++;
			}
			dat[i][j] = ns;
		}
	}
	
	lli ua=0,da=0;
	
	rep(i,n){
		rep(j,n){
			if(i==j)continue;
			rep(pp,4){
				lli p[4];
				lli rp=dat[i][pp];
				l2d(rp,p);
				rep(qq,4){
					lli q[4];
					lli rq=dat[j][qq];
					l2d(rq,q);
					
					lli dd[4][4] = {
						{p[1],p[0],q[3],q[2]},
						{p[2],p[1],q[2],q[1]},
						{p[3],p[2],q[1],q[0]},
						{p[0],p[3],q[0],q[3]}
					};
					
					lli td[4];
					//printf("%012lld %012lld\n",rp,rq);
					rep(k,4){
						td[k] = d2l(dd[k]);
						//printf("%d .. %012lld\n",k,td[k]);
					}
					
					//ans += sum(td,rp,rq);
					
					lli ns = sum(td,rp,rq);
					
					ua += ns / (24*24*24);
					da += ns % (24*24*24);
				}
			}
		}
	}
	
	
	
	printf("%lld\n",ua*24*24+da/24);
	return 0;
}






Measured memory_bytes: 160000
n=int(input())
a,b,c,d=0,0,0,0
for _ in range(n):
    x=input()
    if x=='AC':
        a+=1
    elif x=='WA':
        b+=1
    elif x=='TLE':
        c+=1
    else:
        d+=1
print('AC x '+str(a))
print('WA x '+str(b))
print('TLE x '+str(c))
print('RE x '+str(d))

Measured memory_bytes: 9200
object Main {
  import scala.math
  def main(args: Array[String]) {
    val sc = new java.util.Scanner(System.in)
    val m,n = sc.nextInt
    val list = List.fill(n)(sc.nextInt)
    //print(list)
    //print(list)
    if (m-list.sum>0) println("No") else println("Yes")
  }
}


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

using namespace std;

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

    vector<int> p(n);
    vector<double> v(n, 0);

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

        for (int j=1; j<=p.at(i); j++) {
            v.at(i) += j;
        }
        v.at(i) /= p.at(i);
    }
    
   
    double sum_v = 0;
    double max_sum_v = 0;
    for (int i=0; i<k; i++) {
        sum_v += v.at(i);
    }
    max_sum_v = sum_v;

    for (int i=k; i<n; i++) {
        sum_v += v.at(i) - v.at(i-k);
        max_sum_v = max(max_sum_v, sum_v);
    }

    printf("%.12lf\n", max_sum_v);

    return 0;
}



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

using namespace std;

// 別解
int main() {
    // 考え方メモ
    // N < 10^5 のため、forループで全ての数を見た場合(O(N))でも、10^5 < 10^8（AtCoderの制約）を満たす
    // 全検索を行う

    int N;
    cin >> N;

    int res = 0;
    for (int i = 1; i <= N; i++) {
        if (to_string(i).length() % 2) {
            res++;
        }
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,x,y) for (int i = x; i <= y; i ++)
#define dep(i,y,x) for (int i = y; i >= x; i --)
#define sz() (int)(x.size())

using namespace std;
typedef long long LL;   

const int maxn=200000+7;

int n,a[maxn],temp[maxn],u[maxn],T[maxn*4];
LL s[maxn],K,ans;

bool cmp(int x,int y) {return s[x]<s[y];}

void init()
{
    rep(i,0,n) u[i]=i;
    sort(u,u+n+1,cmp);

    temp[u[0]]=1;
    rep(i,1,n) if (s[u[i]]!=s[u[i-1]]) temp[u[i]]=temp[u[i-1]]+1; else temp[u[i]]=temp[u[i-1]];
    rep(i,0,n) a[i]=temp[i];
}

void add(int k,int l,int r,int x)
{
    if (l==r)
        ++T[k];
    else
    {
        int mid=(l+r)>>1;
        if (x<=mid) add((k<<1),l,mid,x); else add((k<<1)|1,mid+1,r,x);
        ++T[k];
    }
}

//  my name is lzr,who is tourist?

int query(int k,int l,int r,int x,int y)
{
    if ((x<=l)&&(r<=y))
        return T[k];
    else
    {
        int mid=(l+r)>>1,ans=0;
        if (x<=mid) ans+=query((k<<1),l,mid,x,y);
        if (y>mid) ans+=query((k<<1)|1,mid+1,r,x,y);
        return ans;
    }
}

int main()
{
    scanf("%d%lld",&n,&K);
    rep(i,1,n) scanf("%lld",&s[i]),s[i]-=K;

    rep(i,1,n) s[i]+=s[i-1];

    init();

    add(1,1,n,a[n]);
    dep(i,n-1,0)
    {
        ans+=(LL)(query(1,1,n,a[i],n));
        add(1,1,n,a[i]);
    }

    printf("%lld\n",ans);

    // system("pause");
    return 0;
}

Measured memory_bytes: 7296
// noobie_corleone
#include <bits/stdc++.h>
#define mp                    make_pair
#define pb                    push_back
#define ll                    long long
#define ss                       second
#define ff                        first
#define fr(i,a,b)   for(ll i=a;i<b;i++)
#define f(i,n)                fr(i,0,n)
#define rf(i,b,a) for(ll i=b-1;i>=a;i--)
#define r(i,n)                rf(i,n,0)
#define inf                   1000000007
#define eps                   0.000000000000001
#define sz(a)                int((a).size())
#define all(c)               (c).begin(),(c).end()
#define tr(c,i)              for(typeof(c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x)         ((c).find(x) != (c).end())
#define cpresent(c,x)        (find(all(c),x) != (c).end())
#define pi                   pair<int,int>
#define pll                  pair < ll , ll >
#define endl                 '\n'
#define PI                   3.141592653589793238462643383279502884197169399375105820974944592307816406286
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef vector< int > vi;
typedef vector< vi > vvi;
int dx[8]={1,-1,0,0,-1,-1,1,1};
int dy[8]={0,0,-1,1,-1,1,-1,1};
//vector<int> adj[200010];
//vector<int> value(200010),par(200010),vis(200010,0),fi(200010,0),g(200010,0),col(200010,-1);
int myrandom (int i) { return std::rand()%i;}

int main()
{
	int n;
	cin>>n;
	vector<vector<int> > hap(n, vector<int> (3,0));
	fr(i,0,n)
	{
		fr(j,0,3)
		{
			cin>>hap[i][j];
		}
	}
	fr(i,1,n)
	{
		fr(j,0,3)
		{
			hap[i][j]+=max(hap[i-1][(j+1) % 3], hap[i-1][(j+2) % 3]);
		}
	}
	ll out=hap[n-1][0];
	fr(i,1,3)
	{
		if(hap[n-1][i]>out)
			out=hap[n-1][i];
	}
	cout<<out<<endl;
	return 0;
}


Measured memory_bytes: 5760
#include <iostream>

using namespace std;

int main()
{
    int n, m, c, count = 0;
    cin >> n >> m >> c;

    int a[n][m], b[m], source[n];
    
    for (int i = 0; i < n; i++) source[i] = 0;
    for (int i = 0; i < m; i++) cin >> b[i];
    for (int i = 0; i < n; i++) 
        for (int j = 0; j < m; j++) 
            cin >> a[i][j];

    for (int i = 0; i < n; i++) { 
        for (int j = 0; j < m; j++) 
            source[i] += a[i][j] * b[j];
        if (source[i] + c > 0) ++count;
    }

    cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)




int main() {
	int N, L;
	cin >> N >> L;
	int minn = 1000;
	int sum = 0;
	rep(i, N) {
		if (abs(minn) > abs(L + i)) {
			minn = L + i;
		}
	
		sum += L + i;

	}
	cout << sum - minn << endl;
}


Measured memory_bytes: 256
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;

enum mod = 1_000_000_007L;




void main() {
    int N, x;
    scan(N, x);
    auto a = readln.split.to!(int[]);

    long ans;

    foreach (i ; 1 .. N) {
        int d = max(a[i] + a[i - 1] - x, 0);
        ans += d;

        int t = min(d, a[i]);
        a[i] -= t;
    }

    writeln(ans);
}




void scan(T...)(ref T args) {
    auto line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x > arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x < arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

void yes(bool ok, string y = "Yes", string n = "No") {
    return writeln(ok ? y : n);
}


Measured memory_bytes: 4424
#include<bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false);
#define mod 1000000007
#define ll long long int

ll power(ll x, ll y) {
  ll res = 1;
  if (y == 0) return res;
  res = power(x, y/2);
  res = ((res%mod)*(res%mod))%mod;
  if(y%2 == 1) {
    res = (res*x)%mod;
  }
  return res;
}

ll solve(ll n, ll k) {
  vector<ll> dp(k+1, 0);
  for(ll i=k; i>0; i--) {
    ll nog = power(k/i, n);
    ll extra =0;
    for(ll j=i*2; j<= k; j+=i) {
      extra = (extra + dp[j])%mod;
    }
    dp[i] = (nog - extra)%mod;
  }
  ll res = 0;
  for(ll i=1; i<=k; i++) {
    ll sum = ((dp[i]%mod)*(i%mod))%mod;
    res = (res + sum)%mod;
  }
  return res;
}

int main() {
  FASTIO
  ll n,k; cin >> n >> k;
  cout << solve(n, k) << endl;
}

Measured memory_bytes: 4028
#include<iostream>
#include<functional>
#include<utility>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;

int n;

int main() {
	cin >> n;
	vector<string> s(n);
	for (int i = 0; i < n; i++)
	{
		cin >> s[i];
	}
	int fir = 0;// 最初がB
	int end = 0;// 最後がA
	int hantei = 0;//最初Bかつ最後B
	vector<int> conbi(n,0);//ABの組み合わせの数
	for (int i = 0; i < n; i++)
	{
		int val = 0;
		if (s[i].front() == 'B'&&s[i].back() != 'A')fir++;
		if (s[i].back() == 'A'&&s[i].front() != 'B') end++;
		if (s[i].front() == 'B'&&s[i].back() == 'A')hantei++;
		for (int j = 0; j < s[i].size(); j++)
		{
			if ((val==1)&& (s[i][j]=='B'))
			{
				conbi[i]++;
			}
			if (s[i][j] == 'A')val = 1;
			else val = 0;
		}
	}
	int ans = 0;
	for (int i = 0; i < n; i++)
	{
		ans += conbi[i];
	}
	if (end>fir)
	{
		ans += fir + hantei;
	}
	else if (end < fir) {
		ans += end + hantei;
	}
	else if(fir==0){
		ans +=max(hantei-1,0);
	}
	else {
		ans += hantei + fir;
	}
	cout << ans << endl;
}

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

using namespace std;

void prime_table(vector<int> &prime, int n) {
    if(n >= 0) prime[0] = 0;
    if(n >= 1) prime[1] = 0;
    for(int i = 2; i * i <= n; i++) {
        if(!prime[i]) continue;
        for(int j = i + i; j <= n; j += i) {
        prime[j] = 0;
        }
    }
}


int main(){
    int n;
    cin >> n;
    vector<int> table(2*n+1, 1);
    prime_table(table, 2*n);
    for(int i = n; i < 2*n; ++i){
        // cout << table[i] << " ";
        if(table[i] == 1){
            cout << i << endl;
            return 0;
        }
    }

    return 0;
}

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

int descending_compare(const void *a, const void *b){
    if (*(int*)a > *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}

int ascending_compare(const void *a, const void *b){
    if (*(int*)a < *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}


int lower_bound(int *a, int n, int key){
    int left, mid, right;
    left = 0, right = n;
    mid = (left + right)/2;
    while ((left+1 != mid || mid+1 != right) && mid != left){
        if (key > a[mid]){
            left = mid;
        }else{
            right = mid+1;
        }
        mid = (left + right)/2;
    }
    if (a[left] >= key)return left;
    if (a[mid] >= key)return mid;
    if (a[right] >= key)return right;
    return n;
}

//greatest common divisor
unsigned long  gcd(unsigned long x, unsigned long y){
    if (y == 0){ 
        return x;
    }else if (x > y){
        return gcd(y, x % y);
    }else{
        return gcd(x, y % x);
    }
}



long long factorial(int x){
    long long rtn = 1;
    int i;
    for (i = x; i > 1; i--){
        rtn = (rtn*i);
    }
    return rtn;
}



int main(void){
    int a, b, c, d;
    scanf("%d %d %d %d", &a, &b, &c, &d);
    if (a*b > c*d){
        printf("%d\n", a*b);
    }else{
        printf("%d", c*d);
    }

    return 0;

}


Measured memory_bytes: 128
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

X=gets.to_i
ans=1
2.upto(X) do|i|
  p=2
  while i**p<=X
    ans=max(ans,i**p)
    p+=1
  end
end
puts ans

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
     
#define int  long long
#define endl '\n'
const int MOD = 1e9 + 7;
const int INF = 1e18;

void solve(){
  int n;
  cin >> n;
  int ret = INF;
  for (int i = 1; i * i <= n; i++){
	  if (n % i == 0)
	    ret = min(ret, n / i + i - 2); 
	 }
  cout << ret << endl;
}

int32_t main(){
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  solve();	
}


Measured memory_bytes: 256
#include <iostream>
#include <list>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <chrono>
#include <math.h>
using namespace std;

using lli = long long int;
using Vint = std::vector<int>;
using Vlli = std::vector<lli>;
using Wint = std::vector<Vint>;
using Wlli = std::vector<Vlli>;
using Vbool = std::vector<bool>;
using Wbool = std::vector<Vbool>;
using pii = std::pair<int, int>;
using pll = std::pair<lli, lli>;
template <class T>
using Vec = std::vector<T>;

constexpr int MOD = 1e9 + 7;
constexpr int INFi = 2e9 + 1;
constexpr lli INFl = (lli)(9e18) + 1;
const vector<pii> DXDY = {std::make_pair(1, 0), std::make_pair(-1, 0), std::make_pair(0, 1), std::make_pair(0, -1)};
constexpr char BR = '\n';

#define DEBUG(x) std::cerr << #x << " = " << x << '\n';
#define FOR(i, a, b) for(int (i) = (a); (i) < (b); ++(i))
#define FOReq(i, a, b) for(int (i) = (a); (i) <= (b); ++(i))
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); --(i))
#define FORstep(i, a, b, step) for(int (i) = (a); i < (b); i += (step))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define vREP(ele, vec) for(auto &(ele) : (vec))
#define vREPcopy(ele, vec) for(auto (ele) : (vec))
#define SORT(A) std::sort((A).begin(), (A).end())
#define RSORT(A) std::sort((A).rbegin(), (A).rend())
// 座標圧縮 (for vector) : ソートしてから使うのが一般的 ; SORT(A) => COORDINATE_COMPRESSION(A)
#define COORDINATE_COMPRESSION(A) (A).erase(unique((A).begin(),(A).end()),(A).end())



template <class T> inline int argmin(std::vector<T> vec){return min_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline int argmax(std::vector<T> vec){return max_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline void chmax(T &a, T b){if(a < b) a = b;}
template <class T> inline void chmin(T &a, T b){if(a > b) a = b;}
template <class T> inline void reverseSORT(Vec<T> &Array){
  std::sort(Array.begin(), Array.end(), std::greater<T>());
}
inline int BitI(int k){return 1 << k;}
inline lli BitL(int k){return 1LL << k;}
inline void putsDouble(double d){printf("%.16lf\n", d);}
inline int toInt(const string &s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(const string &s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
template <class T> inline std::string toString(T n){
  if(n == 0) return "0";
  std::string res;
  if(n < 0){n = -n;while(n != 0){res += (char)(n % 10 + '0'); n /= 10;}
  std::reverse(res.begin(), res.end()); return '-' + res;}
  while(n != 0){res += (char)(n % 10 + '0'); n /= 10;} std::reverse(res.begin(), res.end()); return res;
}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~






int main(void){
    int a, b; scanf("%d%d", &a, &b);
    if(a >= 13) printf("%d\n", b);
    else if(a >= 6) printf("%d\n", b / 2);
    else puts("0");
    return 0;
}

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

#define lli long long int
#define mpr make_pair
#define pr pair<lli,lli>
#define pb push_back
#define vl vector<lli>
#define mp map<lli,lli>
#define all(x) x.begin(),x.end()
#define FOR(i,n) for(lli i=0;i<(lli)n;i++)
#define FOR1(i,j,n) for(lli i=j;i<(lli)n;i++)
#define mod 1000000007

lli power(lli x,lli n,lli m)
{
	lli res=1;
	while(n>0)
	{
		if(n&1) res=(res*x)%m;
		x=(x*x)%m;
		n=n>>1;
	}
	return res;
}

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    char ch;
    cin>>ch;
    if(ch>='A'&&ch<='Z')
    cout<<"A\n";
    else
    cout<<"a\n";
	
	
	
	
return 0;
}


Measured memory_bytes: 3636
#include <iostream>
//#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i = 0; i< (n);i++)
#define SORT(a) sort((a).begin(),(a).end());
#define che(a,string) cout<<string<<":"<<(a)<<endl;
#define ch(a,string) cout<<string<<":"<<(a)<<" ";
using namespace std;
typedef pair<int,int> p;
#define INF 2000000000
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 n;
long long a[100010][3];  //ai,bi,ciをそれぞれ、a[i][0],a[i][1],a[i][2]に格納

//DP テーブル
long long	dp[100010][3];//一個前にaを選んだ時のi番目の幸福度の最大値をdp[i][0] 

	int main(){
 		int n;cin>>n;
		for(int i = 0; i < n ; ++i){
			for(int j = 0 ; j<3 ;++j){
				cin>>a[i][j];
			}
		}
		for(int i = 0 ; i<n ; ++i){
			for(int j=0; j<3 ; ++j){	
				for (int k =0; k<3; ++k){
					if(j==k) continue;
						chmax(dp[i+1][k], dp[i][j]+ a[i][k]);
				}
			}
		}

		//答え
		long long ans = 0 ;
		for(int j = 0; j < 3; ++j){
			chmax(ans, dp[n][j]);
		}
		cout<<ans<<endl;
	}


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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

signed main() {
  ll a,b;
  cin >> a >> b;
  if (a>9 || b>9)
    cout << -1 << endl;
  else
    cout << a*b << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <queue>
#include <set>
#include <bitset>
#include <map>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<int, int> qii;
typedef pair<int, int> pii;

#define PI 3.14159265359
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repz(i,n) rep(i,0,n)

//int型を受け取ってその桁数を返す
int check_digits(int n) {
	int digits = 0;
	while (n != 0) {
		n /= 10;
		digits++;
	}
	return digits;
}


//最大公約数を返す関数
int gcd(int n, int m) {
	while (n != 0) {
		if (n < m) swap(n, m);
		n = n % m;
	}
	return m;
}


//2点間の距離を返す
float dis(int x1, int y1, int x2, int y2) {
	return sqrt(pow(abs(x1 - x2), 2) + pow(abs(y1 - y2), 2));
}


int main() {
	map<string, int> memo;
	int n, m;
	vector<string> s(110), t(110);
	cin >> n;
	repz(i, n)cin >> s[i];
	cin >> m;
	repz(i, m)cin >> t[i];

	repz(i, n) memo[s[i]]++;
	repz(i, m) memo[t[i]]--;

	ll max = 0;
	for (auto itr : memo) {
		if( itr.second > max) max = itr.second;
	}
	if (max < 0)max = 0;

	cout << max << endl;

	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include <stdio.h>

int main() {
  int h, w;
  while (scanf("%d%d", &h, &w), h | w) {
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        if ((i + j) % 2 == 0) printf("#");
        else printf(".");
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 2144
#include <stdio.h>

int main(){
  int n;
  long long d;
  scanf("%d%lld",&n,&d);
  int ans = 0,i=0;
  for(i;i<n;++i){
    long int x,y;
    scanf("%lld%lld",&x,&y);
    if(x*x+y*y<=d*d)ans++;
  }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 1728
// f[i]: 
// the number of combinations for women in set i and the first k men.
// k = number_of_ones(i)
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

const int maxn = 22;
const int maxtot = 2100000;
const int mo = 1e9 + 7;

int n, g[maxn][maxn], f[maxtot];

int countOnes(int x) {
    int res = 0;
    while (x > 0) {
        res += (x & 1);
        x >>= 1;
    }

    return res;
}

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
    cin >> n;
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < n; ++j)
            cin >> g[i][j];

    int tot = 1 << n;
    f[0] = 1;

    for (int i = 1; i < tot; ++i) {
        int idx = countOnes(i) - 1;
        for (int j = 0; j < n; ++j)
            if ((i & (1 << j)) && g[idx][j])
                f[i] = (f[i] + f[i - (1 << j)]) % mo;

        // printf("%d %d %d\n", i, idx, f[i]);
    }

    cout << f[tot-1] << endl;
	return 0;
}

Measured memory_bytes: 8448
N,P,*A=map(int, open(0).read().split())
o=sum(a&1 for a in A)
e=N-o

ans = 0
for i in range(1,o+1,2):
    res = 1
    for r in range(i):
        res *= o-r
        res //=r+1
    ans += res
ans*=2**e
if not P:
    ans=2**N-ans
print(ans)

Measured memory_bytes: 3064
n,m=map(int,input().split())
box=[False for _ in range(n)]
box[0]=True
ball=[1 for _ in range(n)]
for i in range(m):
    x,y=map(int,input().split())
    ball[x-1]-=1
    ball[y-1]+=1
    if(box[x-1]==True):
        box[y-1]=True
    if(ball[x-1]<=0):
        box[x-1]=False
print(box.count(True))
#print(box)
#print(ball)

Measured memory_bytes: 4752
N = int(input())
A = input()
B = input()
C = input()
cnt = 0
for i in range(N):
  if(A[i] == B[i] != C[i]):
    cnt += 1
  elif(A[i] != B[i] == C[i]):
    cnt += 1
  elif(A[i] == C[i] != B[i]):
    cnt += 1
  elif(A[i] != B[i] != C[i]):
    cnt += 2
print(cnt)

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {

		//?????£?????????
		int NumA = 0;
		int NumB = 0;

		String line = null;
		String op = null;

		try {
			//??\???????????????
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

			while (true) {
				line = br.readLine();

				if (line != null) {

					//???????????????????????????
					String[] NumList = line.split(" ", 0);

					//????????°?????£??\
					NumA = Integer.parseInt(NumList[0]);
					NumB = Integer.parseInt(NumList[2]);
					op   = NumList[1];

					//???????¢??????¨
					//System.out.println(NumA + op + NumB);

					//?????????????
					if (!op.equals("?")) {

						//????????????
						switch (op) {
						case "+":
							System.out.println(NumA + NumB);
							break;

						case "-":
							System.out.println(NumA - NumB);
							break;

						case "*":
							System.out.println(NumA * NumB);
							break;

						case "/":
							System.out.println(NumA / NumB);
							break;

						default:
							System.out.println("other");
							break;
						}
					}else{
						break;
					}
				}else{
					//System.out.println("END");
					break;
				}
				//System.out.println("???");
			}

		}catch (NumberFormatException e) {
			System.out.println(e);
		} catch (IOException e) {
			System.out.println(e);
		}

	}

}

Measured memory_bytes: 24364
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<list>
#include <cstring>
#include <functional>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF ((Int)1<<60)
#define EPS (1e-10)
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define RREP(i,n) for(int i=1; i<=(int)(n); ++i)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
typedef long long Int;
typedef pair<Int, Int> PI;
typedef pair<int, int> P;
typedef vector<double> vec;
typedef vector<vec> mat;
const int N = 100005;
//////////////////////////////

int n;
vector<int> e[N];

int dfs(int cur, int last) {
	int all = 0;
	int zero = 0;

	for(int to : e[cur]) {
		if (to == last) continue;
		int tmp = dfs(to, cur);
		if (tmp == 0) zero++;
		all += tmp;
	}
	if (zero > 1) all += (zero - 1);
	return all;
}

void solve()
{
	cin >> n;
	int root = -1;
	REP(i, n - 1) {
		int x, y; 
		cin >> x >> y;
		e[x].push_back(y); if (e[x].size() > 2) root = x;
		e[y].push_back(x); if (e[y].size() > 2) root = y;
	}
	if (root == -1) {
		cout << 1 << endl;
		return;
	}
	cout << dfs(root, -1) << endl;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(13);
	solve();
	return 0;
}

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

int main(){
  int A, B;
  char op;
  cin >> A >> op >> B;
  if(op == '+') cout << A + B << endl;
  else if(op == '-') cout << A - B << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MaxN = 1e9;

map <int, int > vis;

int main()
{
	int a, b, k;
	cin >> a >> b >> k;
	for(int i = a;i < a+k;i++){
		if(i > b) break;
		vis[i] = 1;
		cout << i << endl;
	}
	for(int i = b-k+1;i <= b;i++){
		if(i < a) continue;
		if(i > b) break;
		if(!vis[i]) cout << i << endl;
	}
	return 0;
}

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

public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int x=sc.nextInt();
        sc.close();
        for(int i=0;i<=x;i++){
            if(100*i<=x && x<=105*i){
                System.out.println(1);
                return;
            }
        }
        System.out.println(0);
        return;
    }
}

Measured memory_bytes: 23636
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

void solve() {
  int n; cin >> n;
  vector<int> a(n); rep(i, n) cin >> a[i];

  int x = 1, ans = 0;
  for (int i = 0; i < a.size(); i++) {
    if (a[i] == x) {
      x++;
    } else {
      ans++;
      a[i] = 0;
    }
  }

  int y = 1;
  for (int i = 0; i < a.size(); i++) {
    if (a[i] == 0) continue;
    if (a[i] == y) {
      y++;
    } else {
      outl(-1);
      return;
    }
  }
  if (y == 1) outl(-1);
  else outl(ans);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <iomanip>
#include <cmath>
#include <climits>

using namespace std;
using ll = long long int;

int main () {
    ll n;
    cin >> n;
    map<ll, ll> mp;
    for (size_t i = 0; i < n - 1; i++) {
      ll ai;
      cin >> ai;
      mp[ai]++;
    }

    for (size_t i = 0; i < n; i++)
    {
      if (n == i - 1) {
        cout << 0 << endl;
      } else {
        cout << mp[i + 1] << endl;
      }
    }
    
}

Measured memory_bytes: 16100