akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//STANDARD DATA TYPES
#define ll long long
#define llu unsigned long long
#define ld long double
//ADV DATA TYPES
#define pii pair < int , int >
#define pll pair < ll, ll >
#define mp make_pair
#define ff first
#define ss second
//C ++ DS
#define vi vector < int >
#define vll vector < ll >
#define pb push_back
#define pf push_front
#define iter :: iterator
#define all(x) x.begin(),x.end()

//priority_queue < pii, vector < pii >, greater < pii > > pq;
//lower_bound(v.begin(),v.end(),20);//for any sorted container
//CONSTANTS
#define MOD (int)(1e9+7)
#define INF 0x3f3f3f3f
#define MAXN (int)(3001)
//MOD OPERATIONS
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
inline ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
inline ll addmod(ll a, ll val, ll p = MOD) {{if ((a = (a + val)) >= p) a -= p;} return a;}
inline ll submod(ll a, ll val, ll p = MOD) {{if ((a = (a - val)) < 0) a += p;}return a;}
inline ll mult(ll a, ll b, ll p = MOD) {return (ll) a * b % p;}
//DEBUG
#define shout()  {cout << "I'm Here...!!!" << endl;}
#define dbg(x) { cout<< #x << ": " << (x) << endl; }
#define dbg2(x,y) { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) << endl; }
ll dp[MAXN][MAXN],prefix_sum[MAXN];
//dp[i][j]-no of ways to satisfy inequality upto i places with numbers 1 to i and last no j(<=i).
//note to satisfy a inequality of i places any i distinct numbers will have same answer as only comparision matters not value
//so dp[i][j] will be dependent on dp[i-1][k] (k<=i-1)
//in i-1 places any number >=j will be increased by one virtually 
//thus if last number k is <j it will stay same else will be k+1 and then based on ith comparision answer will be decided
char s[MAXN];
int main()
{
	fastio;
	int n,l,r;cin>>n;
	for(int i=1;i<n;i++)cin>>s[i];
	dp[1][1]=1;
	for(int i=2;i<=n;i++)
	{
		memset(prefix_sum,0,sizeof(prefix_sum));
		for(int j=1;j<i;j++)
			prefix_sum[j]=addmod(prefix_sum[j-1],dp[i-1][j]);
		for(int j=1;j<=i;j++)
		{
			if(s[i-1]=='<'){
				l=1;r=j-1;
			}
			else
			{
				l=j;r=i-1;
			}
			if(l>r)continue;
			dp[i][j]=addmod(dp[i][j],submod(prefix_sum[r],prefix_sum[l-1]));	

			/*for(int k=1;k<i;k++)
			{
				int real=k,virt;
				if(real<j)virt=real;
				else virt=real+1;
				if((s[i-1]=='<'&&virt<j)||(s[i-1]=='>'&&virt>j))
				{
					dp[i][j]=addmod(dp[i][j],dp[i-1][k]);
				}
			}*/
		}
	}
	ll res=0;
	for(int i=1;i<=n;i++)
	{
		res=addmod(res,dp[n][i]);
	}	
	cout<<res<<endl;
}


Measured memory_bytes: 68992
#include <iostream>
using namespace std;
int main(void){
    int H,W;
    while(true){
        cin >> H >> W;
        if(H==0 && W==0){
            break;
        }
        for(int j=0;j<H;j++){
            for(int i=0;i<W;i++){
                cout << '#';
            }
            cout << endl;
        }
        cout << endl; 
    }  
}



Measured memory_bytes: 3076
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
int main() {
	ll N;
	ll T;
	ll t[200001];
	ll tx[200001];
	ll ans = 0;
	cin >> N >> T;
	for (ll i = 0; i < N; ++i) {
		cin >> t[i];
	}
	for (ll i = 0; i < N - 1; ++i) {
		tx[i + 1] = t[i + 1] - t[i];
	}
	for (ll i = 1; i < N; ++i) {
		if (tx[i] < T) {
			ans += tx[i];
		}
		else {
			ans += T;
		}
	}
	ans += T;
	cout << ans << endl;
	return 0;
}


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

using namespace std;
#define ull unsigned long long
#define si short int
#define ll long long
#define pii pair<int, int>

/*-----------------------------------------------------MATH------------------------------------------------*/
inline ll gcd(ll a, ll b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}

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

inline int pwm(ll xx, ll pow, int MD) {
    if (pow < 0) { pow = pow % (MD - 1) + MD - 1; }
    ll mlt = 1;
    while (pow) {
        if (pow & 1) {
            mlt *= xx;
            mlt %= MD;
        }
        xx *= xx;
        pow >>= 1;
        xx %= MD;
    }
    return (int) mlt;
}

inline ll gcdex(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll xx, yy;
    ll gc = gcdex(b, a % b, yy, xx);
    x = xx;
    y = yy - (a / b) * xx;
    return gc;
}

inline int inv(ll r, int _mod) { return pwm(r % _mod, _mod - 2, _mod); }

/*-----------------------------------------------------MATH------------------------------------------------*/

const int inf = 1e9;
const int MAXN = 2e5 + 10;
ll mod = 1e9;
vector<int> c(18, 0);
vector<int> ans;
vector<int> fact;
int getnum(vector<int> &a, int n){
    int delta=0;
    vector<bool> was(n, false);
    for(int i=0;i<a.size();i++){
        int h=0;
        for(int j=1;j<a[i];j++){
            if(!was[j]) h++;
        }
        delta+=h*fact[n-i-1];
        was[a[i]]=true;
    }
    return delta;
}
void solve() {
    int n;
    cin>>n;
    fact.resize(100);
    fact[0]=1;
    for(int i=1;i<n+1;i++){
        fact[i]=fact[i-1]*i;
    }
    vector<int> p(n);
    vector<int> q(n);
    for(int i=0;i<n;i++) cin>>p[i];
    for(int i=0;i<n;i++) cin>>q[i];
    int a = getnum(p, n);
   // cout<<a<<endl;
    int b = getnum(q, n);
   // cout<<b<<endl;
    cout<<abs(a-b);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n = 1;
    for (int i = 0; i < n; i++) solve();
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(Console.ReadLine().Contains("9") ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin(), v.end()
#define pb push_back
#define fi first
#define se second
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N = 500010;
ll A, B, C, D, E, F, G, H, X, Y, Z, P, Q, M, N, T, R, K, W, L, ANS;
string S, S1, S2;
using p = pair<double, double>;

using p = pair<double, double>;
vector<p> V;

double dot(p a, p b) { return a.first * b.first + a.second * b.second; }

double norm(p a) { return sqrt(a.first * a.first + a.second * a.second); }

p operator+(p a, p b) { return p(a.first + b.first, a.second + b.second); }

p operator-(p a, p b) { return p(a.first - b.first, a.second - b.second); }
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    rep(i, N) {
        cin >> X >> Y;
        if(X != 0 || Y != 0)
            V.push_back({X, Y});
    }

    N = V.size();

    sort(all(V), [](auto const &A1, auto const &A2) { return atan2(A1.second, A1.first) > atan2(A2.se, A2.fi); });

    p SUM = {0, 0};
    rep(i, N) { SUM = SUM + V[i]; }

    vector<p> RUISEKI;
    p NOW = {0, 0};
    RUISEKI.push_back(NOW);
    rep(i, N) {
        NOW = NOW + V[i];
        RUISEKI.push_back(NOW);
    }

    double ANS = 0;

    rep(i, N) {
        rep(j, i + 1) {
            ANS = max({norm(RUISEKI[i + 1] - RUISEKI[j]), norm(SUM - (RUISEKI[i + 1] - RUISEKI[j])), ANS});
        }
    }

    cout << setprecision(15) << ANS << endl;
}

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

// 最大公約数
int64_t gcd(int64_t a, int64_t b) {
  return b != 0 ? gcd(b, a % b) : a;
}

// 最小公倍数
int64_t lcm(int64_t a, int64_t b) {
  return a * b / gcd(a, b);
}

struct UnionFind {
  vector< int > data;
 
  UnionFind(int sz) {
    data.assign(sz, -1);
  }
 
  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }
 
  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }
 
  int size(int k) {
    return (-data[find(k)]);
  }
};

int main(){
  int64_t h,w;
  cin >> h >> w;
  vector<vector<char>> vec(h, vector<char>(w));
  rep(i,h){
    rep(j,w){
      cin >> vec.at(i).at(j);
    }
  }
  rep(i,h){
    bool chk = false;
    rep(j,w){
      if (vec.at(i).at(j) == '#'){
        chk = true;
        break;
      }
    }
    if (!chk){
      vec.at(i).at(0) = '1';
    }
  }
  rep(j,w){
    bool chk = false;
    rep(i,h){
      if (vec.at(i).at(j) == '#'){
        chk = true;
        break;
      }
    }
    if (!chk){
      if (j==0 && vec.at(0).at(0) == '1'){
        vec.at(0).at(j) = '3';
      }else if (j==0){
        vec.at(0).at(j) = '2';
      }else{
        vec.at(0).at(j) = '1';
      }
    }
  }
  int cnt = 0;
  rep(i,h){
    rep(j,w){
      if (i!=0 && j==0 && cnt > 0){
        cout << endl;
        cnt = 0;
      }
      if (i == 0){
        if (vec.at(0).at(0) == '3' || vec.at(0).at(0) == '1'){
        }else{
          if(vec.at(0).at(j) != '1'){
            cout << vec.at(i).at(j);
            cnt++;
          }
        }
      }else if (j == 0){
        if (vec.at(0).at(0) == '3' || vec.at(0).at(0) == '2'){
        }else{
          if(vec.at(i).at(0) != '1'){
            cout << vec.at(i).at(j);
            cnt++;
          }
        }
      }else if(vec.at(i).at(0) != '1' && vec.at(0).at(j) != '1'){
        cout << vec.at(i).at(j);
        cnt++;
      }
    }
  }
  cout << endl;
  return 0;
}



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

int main()
{
    int a, b, c;
    std::cin >> a >> b >> c;

    if (c <= (a + b)) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
def resolve():
    s=[0,0,0,0]
    for i in range(3):
        a,b = map(lambda x: int(x)-1,input().split())
        s[a]+=1
        s[b]+=1
    for i in s:
        if i==3:
            print("NO")
            return
    print("YES")

resolve()

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

int main() {
  int n;
  int F[110][15];
  int P[110][15];

  cin >> n;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 10; ++j) {
      cin >> F[i][j];
    }
  }

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

  int ans = -1001001001;
  for (int bit = 1; bit < (1 << 10); ++bit) {
    int sum = 0;
    for (int i = 0; i < n; ++i) {
      int cnt = 0;
      for (int j = 0; j < 10; ++j) {
        if (bit & (1 << j) && F[i][j]) cnt++;
      }
      sum += P[i][cnt];
    }

    ans = max(ans, sum);
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    int n, m;
    cin >> n >> m;
    cout << (n-1)*(m-1) << endl;
}

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


int main(){
    int n,m;
    cin >> n >> m;
    vector<pair<int,int>> v(n);
    vector<int> u(n);
    rep(i,n){
        int x,y;
        cin >> x >> y;
        v[i] = {x,y};
    }
    sort(v.begin(),v.end());
    ll ans=0;
    rep(i,n){
        if (m - v[i].second >= 0){
            ans+=(ll)(v[i].first)*v[i].second;
            m-=v[i].second;
        }else{
            ans+=(ll)(v[i].first)*m;
            break;
        }
        //cout << ans << endl;
        //cout << m << endl;
        //ans+=(ll)v[i].first*v[i].second
    }
    cout << ans << endl;
    
    
}


Measured memory_bytes: 1408
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  long long i, o, t, j, l, s, z;
  cin >> i >> o >> t >> j >> l >> s >> z;
  long long ans = l / 2 * 2 + j / 2 * 2 + i / 2 * 2 + o;
  if (l >= 1 && j >= 1 && i >= 1) {
    ans = max(ans, (l - 1) / 2 * 2 + (j - 1) / 2 * 2 + (i - 1) / 2 * 2 + 3 + o);
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define _for(i,a,b) for(int i = (a);i<(b);i++)
#define endl  '\n'
#define inf 0x3f3f3f3f
#define ull unsigned long long  
using namespace std;
const int mod=1e9+7;
const int MAX=2e5+7;
const double pi=6.28318530717958623200;
//ll a[MAX];
int main()
{
 	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 	double r;
 	cin>>r;
 	cout<<fixed<<setprecision(20)<<r*pi;
 	
}

Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define REP3(i,x,n) for(int i=x; i>(n); i--)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
#define MAX 1000000

int N,K;
ll T[MAX];

int check(ll P){
    int i = 0;
    for (int j = 0; j < K; j++)
    {
        ll s = 0;
        while(s+T[i]<=P){
            s +=T[i];
            i++;
            if(i==N){return N;}
        }
    }
    return i;
}

int BNF(){
    ll left = 0;
    ll right = 100000*10000;
    ll mid;
    while(right-left>1){
        mid = (left+right)/2;
        int v = check(mid);
        if(v>=N){
            right = mid;
        }else{
            left = mid;
        }
    }
    return right;
}


int main(){
    cin >> N >> K;
    REP(i,N){
        cin >> T[i];
    }
    ll ans = BNF();
    cout << ans << endl;
    return 0;
}


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

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

    map<string, int> ans;
    for (int i = 0; i < N; i++) {
        string S;
        cin >> S;
        if (ans.count(S)) {
            ans.at(S);
        }
        else {
            ans[S] = 1;
        }
    }

    cout << ans.size() << endl;

    return 0;
}

Measured memory_bytes: 19236
// ABEY SAALE
// QUESTION KHUD KR SOLUTION KYU DEKH RHA H
 
 
 
 
 
 
 
 
//MAAF KIJIYEGA ME GUSSE ME IDHAR UDHAR NIKAL JATA HU
#include<bits/stdc++.h>
#define mod 1000000007
#define fr first
#define se second
#define endl "\n"
#define ll long long
#define PI 3.1415926535 
#define pb push_back
#define mpr make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define senky_bansal ios_base::sync_with_stdio(false);
#define IIIT_ALLAHABAD    cin.tie(NULL);cout.tie(NULL);
using namespace std;

ll fac[2000005];
void pre(){ fac[0]=1; fac[1]=1; for(int i=2;i<200005;i++) fac[i]=(i*fac[i-1])%mod;}
ll power(ll a,ll b){ll res=1;while(b){if(b&1) res=(res*a)%mod;a=(a*a)%mod;b=b/2;}return res%mod;}
ll ncr(ll n,ll r){return ((fac[n]*power(fac[r],mod-2))%mod*power(fac[n-r],mod-2))%mod;}
// DEKHIYE JI  WALID JO THE ABBA HAMARE WO YEH function CHHOD KR GYE THE

signed main()
{   



      
      senky_bansal
      IIIT_ALLAHABAD
      
      // pre();
      ll t;
      // cin>>t;
      t=1;
      while(t--)
      { 
         
         ll n;
         cin>>n;
         ll h1 = n/3;
         ll h2 = n/5;
         ll h3 = n/15;
         ll p1 = (n*(n+1))/2;
         ll p2 = 3*((h1*(h1+1))/2);
         ll p3 = 5*((h2*(h2+1))/2);
         ll p4 = 15*((h3*(h3+1))/2);
         ll ans = p1-p2-p3+p4;
         cout<<ans<<endl;
         

      }
      






}



























Measured memory_bytes: 3612
#include <bits/stdc++.h>
typedef long long int ll;
# define pi 3.14159265358979323846 
using namespace std;


int main() {
	// your code goes here
	int n;
	cin>>n;
	vector<int>ans(n,0);
	for(int i=1;i<n;i++)
	{
	    int x;
	    cin>>x;
	    x--;
	    ans[x]++;
	}
	for(int i=0;i<n;i++)
	cout<<ans[i]<<"\n";
	
	
	
	return 0;
}


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

int main()
{
ll n ;
cin >> n ;
vector<ll> s(n);
rep(i, n){
  cin >> s[i];
}
ll c=1;
while(c<n/2){
  set<ll> see;
  ll temp=0;
  ll now=c;
  while(see.find(now)==see.end()&&see.find(n-now-1)==see.end()){
    temp+=s[now];
    temp+=s[n-now-1];
    see.insert(now);
    if(see.find(n-now-1)==see.end())see.insert(n-now-1);
    else break;
    now+=c;
    ans=max(ans,temp);
    if(n-now-1<c)break;
  }
  c++;
}
cout << ans << endl;
return 0;
}


Measured memory_bytes: 5760
import sys

n = int(sys.stdin.readline().rstrip())
*p, = map(int, sys.stdin.readline().split())
*q, = map(int, sys.stdin.readline().split())

factorial = [1] * (n + 1)
for i in range(n): factorial[i+1] = factorial[i] * (i + 1)

def main():
    d = 0
    a = [0] * (n + 1); b = [0] * (n + 1)
    for i in range(n - 1):
        a[p[i]] = b[q[i]] = 1
        c1 = c2 = 0
        for j in range(1, p[i]): c1 += a[j]
        for j in range(1, q[i]): c2 += b[j]
        d += ((q[i] - c2) - (p[i] - c1)) * factorial[n-(i+1)]
    print(abs(d))

if __name__ ==  '__main__':
    main()

Measured memory_bytes: 3064
import java.util.*;
public class Main {

    public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
	    int n = sc.nextInt();

	    ArrayList<Integer> h = new ArrayList<Integer>();
	    for(int i = 0; i < n; i++){
	        int tmpH = sc.nextInt();
	        h.add(tmpH);
        }

	    int ans = 0;
	    int tmp = 0;
	    for(int i = 0; i < h.size(); i++){

            if(i == n - 1){
                ans = Math.max(ans, tmp);
                break;
            }

	        if(h.get(i) >= h.get(i + 1)){
	            tmp++;
            } else {
	            ans = Math.max(ans, tmp);
	            tmp = 0;
            }

        }

        System.out.println(ans);

    }
}


Measured memory_bytes: 59204
// https://atcoder.jp/contests/abc170/tasks/abc170_d

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;

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

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

template <typename T>
inline ll len(V<T> arr) {
  return arr.size();
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve();

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

void solve() {
  ll N;
  cin >> N;

  VL as(N);
  rep(i, N) cin >> as[i];

  ll MAX = 1e6;
  V<bool> satisfied(MAX + 1, true);
  VL num_cts(MAX + 1, 0);

  sort(all(as));

  for (auto a : as) {
    ++num_cts[a];
    if (!satisfied[a]) continue;
    unless(num_cts[a] == 1) continue;

    for (ll m = 2 * a; m <= MAX; m += a) {
      satisfied[m] = false;
    }
  }

  ll res = 0;
  for (auto a : as) {
    if (num_cts[a] == 1 && satisfied[a]) res++;
  }

  cout << res << "\n";
}


Measured memory_bytes: 12700
#include <stdio.h>

int main(){
   long h,s;
   int n,i,a;
 
   scanf("%ld %d",&h,&n);
   s=0;
   for (i=0;i<n;i++) {
      scanf("%d",&a);
      s+=a;
   }
   if (h<=s) puts("Yes");
   else      puts("No");
   return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef long long lli;
typedef long double ld;
typedef pair<lli, lli > plli;
typedef vector<lli> vlli;
typedef vector<plli > vplli;

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define lcm(a, b) ((a * b) / gcd(a, b))
#define sqr(x) (x)*(x)
#define all(a) a.begin(),a.end()
#define UN(v) sort(all(v)), v.resize(unique(all(v))-v.begin())

#define endl '\n'

const long long INF = 100000000000000000;
const long long MOD = 1000000007;
const long long MAXN = 100005;

lli dx[]={0,0,-1,1,-1,-1,1,1};
lli dy[]={1,-1,0,0,1,-1,-1,1};

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

void solve() {
    lli n;
    cin >> n;

    lli h[n];

    for (int i = 1; i <= n; ++i) {
        cin >> h[i];
    }

    for (auto i = n - 1; i > 0; --i) {
        if (h[i] <= h[i + 1]) continue;

        h[i] -= 1;

        if (h[i] > h[i + 1]) {
            cout << "No" << endl;
            return;
        }
    }

    cout << "Yes" << endl;
}

int main()
{
    IOS;
    lli t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int h,w;
string s[2001];
int tot[2001][2001];
int main(){
    cin>>h>>w;
    rep(i,h) cin>>s[i];
    int l=0,r=0;
    rep(j,w){
        l=0,r=0;
        rep(i,h){
            if(s[i][j]=='.') ++l;
            else l=0;
            if(s[h-i-1][j]=='.') ++r;
            else r=0;
            tot[i][j]+=l;
            tot[h-i-1][j]+=r;
        }
    }
    rep(i,h){
        l=0,r=0;
        rep(j,w){
            if(s[i][j]=='.') ++l;
            else l=0;
            if(s[i][w-j-1]=='.') ++r;
            else r=0;
            tot[i][j]+=l;
            tot[i][w-j-1]+=r;
        }
    }
    int mx=0;
    rep(i,h)rep(j,w) mx=max(mx,tot[i][j]);
    cout<<mx-3<<endl;
    return 0;
}


Measured memory_bytes: 19968
#include<bits/stdc++.h>
using namespace std;
signed main(){
    int n;
    cin>>n;
    int a[n+2],b[n+2],sum=0;
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
    }
    for(int i=0;i<n-1;i++){
        if(a[i]==b[i]){
            if(a[i+1]==b[i+1]){
                if(a[i+2]==b[i+2]){
                    cout<<"Yes\n";
                    return(0);
                }
            }
        }
    }
    cout<<"No\n";
    return(0);
}

Measured memory_bytes: 3628
package main

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

// print
func p(input interface{}) {
	fmt.Println(input)
}

// test
func Test_solve() {
	input := `
0 0 2 0
5
-1 1
-1 -1
-1 0
0 0
3 0

`
	input = strings.Trim(input, "\n")

	solve(bufio.NewScanner(strings.NewReader(input)))
}

//
func subVector(p1, p2 []float64) []float64 {
	return []float64{
		p1[0] - p2[0],
		p1[1] - p2[1],
	}
}

//
func dotVector(p1, p2 []float64) float64{
	return p1[0] * p2[0] + p1[1] * p2[1]
}

//
func crossVector(p1, p2 []float64) float64{
	return p1[0] * p2[1] - p1[1] * p2[0]
}

//
func absVector(p []float64) float64 {
	return math.Sqrt(p[0] * p[0] + p[1] * p[1])
}

//
func norrmalize(p []float64) float64 {
	return p[0] * p[0] + p[1] * p[1]
}

//
// 1: p1-p2より反時計周り側にp3
// 2: p1-p2より時計周り側にp3
// 3: p1-p2直線上、p2の先にp3
// 4: p1-p2直線上、p1の前にp3
// 5: p1-p2線分上にp3
func checkClockWise(p1, p2, p3 []float64) int {
	p1p2 := subVector(p2, p1)
	p1p3 := subVector(p3, p1)
	if crossVector(p1p2, p1p3) > 0.0 {
		return 1
	} else if crossVector(p1p2, p1p3) < 0.0 {
		return 2
	} else if dotVector(p1p2, p1p3) < 0.0 {
		return 4
	} else if norrmalize(p1p2) < norrmalize(p1p3) {
		return 3
	}
	return 5
}

// solve
func solve(sc *bufio.Scanner) {
	sc.Scan()
	elements := strings.Split(sc.Text(), " ")
	p1 := make([]float64, 2)
	p2 := make([]float64, 2)

	pStr, _ := strconv.Atoi(elements[0])
	p1[0] = float64(pStr)
	pStr, _ = strconv.Atoi(elements[1])
	p1[1] = float64(pStr)
	pStr, _ = strconv.Atoi(elements[2])
	p2[0] = float64(pStr)
	pStr, _ = strconv.Atoi(elements[3])
	p2[1] = float64(pStr)

	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())

	for i := 0; i < n; i++ {
		sc.Scan()
		elements = strings.Split(sc.Text(), " ")

		p3 := make([]float64, 2)

		pStr, _ := strconv.Atoi(elements[0])
		p3[0] = float64(pStr)
		pStr, _ = strconv.Atoi(elements[1])
		p3[1] = float64(pStr)

		result := checkClockWise(p1, p2, p3)

		word := ""
		switch result {
		case 1: word = "COUNTER_CLOCKWISE"
		case 2: word = "CLOCKWISE"
		case 3: word = "ONLINE_FRONT"
		case 4: word = "ONLINE_BACK"
		case 5: word = "ON_SEGMENT"
		}

		fmt.Printf("%s\n", word)
	}
}

// main
func main() {

	//Test_solve()
	solve(bufio.NewScanner(os.Stdin))
}



Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define INF 9223372036854775807LL
#define mod 1000000007
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define lol long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  lol n,a,b,c,d;
  string s,w;
  cin >>a>>b;
  c=a/2;
  lol ans=0;
  if(a==1||b==1) cout <<"1\n";
  else{
    if(a%2==0||b%2==0){
      ans=a*b/2;
    }else{
      ans=a*b/2+1;
    }
    cout <<ans<<'\n';
  }
  return (0);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	string s,t; cin >> s >> t;
	for(int i=0;i<n;i++){
		cout << s[i] << t[i];
	}
	cout << endl;
}


Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+5;
char s[N];
int n,a[N],b[N];
int solve(int mx)
{
    int add=0;
    for(int i=1;i<=n;i++)
        if(s[i]!='?') b[i]=s[i]=='1'?1:-1;
        else
        {
            if(a[i]+add+2<=mx)
                b[i]=1,add+=2;
            else b[i]=-1;
        }
    for(int i=1;i<=n;i++) b[i]+=b[i-1];
    int mn=0;mx=0;
    for(int i=1;i<=n;i++)
        mn=min(mn,b[i]),mx=max(mx,b[i]);
    return mx-mn;
}
int main()
{
    scanf("%s",s+1);
    n=strlen(s+1);
    for(int i=1;i<=n;i++) a[i]=a[i-1]+(s[i]=='1'?1:-1);
    for(int i=n-1;i>=1;i--) a[i]=max(a[i],a[i+1]);
    int ans=min(solve(a[1]),solve(a[1]+1));
    ans=min(ans,solve(a[1]+2));
    ans=min(ans,solve(a[1]+3));
    ans=min(ans,solve(a[1]+4));
    printf("%d\n",ans);
}


Measured memory_bytes: 12612
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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 inf = INT_MAX;
const int MOD = 1000000007;
const long long INF = LLONG_MAX;

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

ll n;
ll csum[101010];

int main() {
  cin >> n;
  repe(i, 1, n) {
    ll a;
    cin >> a;
    csum[i] = csum[i - 1] + a;
  }

  ll ans = 0;
  ll inc = 0;
  repe(i, 1, n) {
    ll cur = csum[i] + inc;
    if (i % 2 == 1) {
      if (cur <= 0) {
        ans += 1 - cur;
        inc += 1 - cur;
      }
    } else {
      if (cur >= 0) {
        ans += cur + 1;
        inc -= cur + 1;
      }
    }
  }

  ll ans2 = 0;
  ll inc2 = 0;
  repe(i, 1, n) {
    ll cur = csum[i] + inc2;
    if (i % 2 == 1) {
      if (cur >= 0) {
        ans2 += cur + 1;
        inc2 -= cur + 1;
      }
    } else {
      if (cur <= 0) {
        ans2 += 1 - cur;
        inc2 += 1 - cur;
      }
    }
  }

  cout << min(ans, ans2);
}


Measured memory_bytes: 4340
#include <bits/stdc++.h>
 
#define pii pair<int, int>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long 
#define ull unsigned long long 
#define ld long double
#define sz(v) int(v.size())
#define all(v) v.begin(), v.end()
 
#define y1 what

using namespace std;
 
const int N = (int) 1e5 + 10;
const int M = (int) 101;
const ll big =  (1LL << 51);
const ll LINF = (ll) 1e18;
const int INF = (int) 1e9 + 7;
const int INF1 = (int) 1e9 + 3;
const double EPS = (double) 1e-6;
const double PI =  3.14159265359;

int f(int x) {
  int ans = 1;
  for (int i = 1; i <= x; i++) ans = ans * 1ll * i % INF;
  return ans;
}

int main() {
    #define fn "balls"
    #ifdef witch
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #else
//        freopen(fn".in", "r", stdin);
//        freopen(fn".out", "w", stdout);
    #endif
    srand(time(0));
    int n, m;
    cin >> n >> m;
    // first monkey
    if (abs(n - m) > 1) {
      cout << 0;
      return 0;
    }
    if (n == m) {
      cout << 2LL * f(n) * f(m) % INF;
    } else {
      cout << f(n) * 1ll * f(m) % INF;
    }
    return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

string s;
string t;

int main() {
    cin >> s;
    for (char c : s) {
        if (c == 'T' && !t.empty() && t.back() == 'S') {
            t.pop_back();
        } else {
            t.pb(c);
        }
    }
    cout << (int)t.length() << endl;
    return 0;
}


Measured memory_bytes: 1152
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			A();
		}

		public static void A()
		{
			Scanner cin = new Scanner();
			int n = cin.Int();
			int k = cin.Int();
			string s = cin.Next();
			StringBuilder sb = new StringBuilder();
			for (int i = 0; i < n; ++i) {
				if (i == k - 1) {
					if (s[k - 1] == 'A') {
						sb.Append("a");
					} else if (s[k - 1] == 'B') {
						sb.Append("b");
					} else {
						sb.Append("c");
					}
				} else {
					sb.Append(s[i]);
				}
			}

			Console.WriteLine(sb.ToString());
			
		}
	}

	public class Scanner
	{
		string[] s;
		int i;

		char[] cs = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string Next()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return Next();
			i = 0;
			return s[i++];
		}

		public int Int()
		{
			return int.Parse(Next());
		}
		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long Long()
		{
			return long.Parse(Next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double Double()
		{
			return double.Parse(Next());
		}


		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}
	}
}



Measured memory_bytes: 11092
#include <stdio.h>

int main(){
  int num,cnt=0,i,tmp,j,minj;
  
  scanf("%d",&num);
  
  int array[num];
  
  for(i=0;i<num;i++)scanf("%d",&array[i]);
  
  for(i=0;i<num;i++){
    minj=i;
    for(j=i;j<num;++j){
      if(array[j]<array[minj]) {
	
	minj = j;
      }
    }

    if(minj != i){
      tmp=array[i];
      array[i]=array[minj];
      array[minj]=tmp;
      cnt++;
    }
  }
  
  for(i=0;i<num-1;i++)printf("%d ",array[i]);
  printf("%d\n%d\n",array[num-1],cnt);
  
  return 0;
  
}




Measured memory_bytes: 2104
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <map>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n) + 1; i++)
#define all(vecto) vecto.begin(), vecto.end()
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
typedef long long ll;

void ans(bool qus)
{
    if (qus == true)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

void Ans(bool qust)
{
    if (qust == true)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

////////////////---START---////////////////

bool check(vector<int> vec, int n)
{
    int count = 0;
    int cnt = 0;
    rep(i, n)
    {
        if (vec.at(i) != i + 1)
        {
            count++;
        }
        if ((vec.at(vec.at(i) - 1) == i + 1) && ((i + 1) != vec.at(i)))
        {
            cnt++;
        }
    }
    if (count == 0)
    {
        return true;
    }
    else if (count > 2)
    {
        return false;
    }
    
    else if (cnt == 2)
    {
        return true;
    }
    else
        return false;
}

int main()
{
    int n;
    cin >> n;
    vector<int> vec(n);
    rep(i, n)
    {
        cin >> vec.at(i);
    }
    Ans(check(vec, n));
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MAX=1e18;
ll mod=1e9+7;
#define pb push_back
#define se second
#define fi first
#define maxe max_element
#define mine min_element
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define boost  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
vector<int> graph[205];
int color[205];
int nCk[100][100];
bool bipartite_jugding(int v, int c){
    color[v] = c;
    for(int i = 0; i < graph[v].size(); ++i){
        if(color[graph[v][i]] == c) return false;
        if(color[graph[v][i]] == 0 && !bipartite_jugding(graph[v][i], -c)){
            return false;
        }
    }
    return true;
}

 void combi() {
	for (int i = 0; i <= 99; ++i) nCk[i][0] = 1;
	for (int i = 1; i <= 99; ++i) for (int j = 1; j <= i; ++j) {
		nCk[i][j] = (nCk[i-1][j] + nCk[i-1][j-1]) % mod;
	}
}

long long expo(ll x,ll n,ll M)
{

    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return expo((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*expo((x*x)%M,(n-1)/2,M))%M;

}

void solve()
{
    string s1="",s2="";
   int n,m;
   cin>>n>>m;
       string ans="";
       for(int i=0;i<max(n,m);i++)
        ans+=(min(n,m)+'0');
       cout<<ans;


}

int main(){
    boost;
  solve();
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
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 FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const int N = 50;
int n, m, q, a[N], b[N], c[N], d[N], x[N], ans;

void dfs(int i){
    if (i == n){
        // REP(j,n) cout << x[j] << " ";
        // cout << endl;
        int s = 0;
        REP(j,q){
            if (x[b[j]] - x[a[j]] == c[j]) s += d[j];
        }
        chmax(ans, s);
        return;
    }
    int low = 0;
    if (i > 0){
        low = x[i - 1];
    }
    FOR(p,low,m-1){
        x[i] = p;
        dfs(i + 1);
    }
}

int main(void){
    cin >> n >> m >> q;
    REP(i,q){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--;
        b[i]--;
    }
    dfs(0);
    cout << ans << endl;
    return 0;
}


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

class Program
{
    static void Main(string[] args)
    {
        var sol = new Solve();
        sol.Exec();
    }
}

class Solve
{
    public void Exec()
    {
        var L = decimal.Parse(Console.ReadLine());
        var div = L / 3;
        Console.WriteLine(div * div * div);
    }
}


Measured memory_bytes: 11092
import itertools as itr

def get_val(c, x_list, y_list):
    cnt = 0
    for y in range(len(c)):
        if y_list[y] == 0: # その行が塗りつぶされていなければ入る
            for x in range(len(c[y])):
                if (x_list[x] == 0) and (c[y][x] == '#'):
                    cnt += 1
    return (cnt)

h,w,k = list(map(int,input().split(' ')))

c_tmp = []
for i in range(h):
    c_tmp.append(input())

ans = 0
for y in list(itr.product([0,1], repeat=h)):
    for x in list(itr.product([0,1], repeat=w)):
        if get_val(c_tmp, x, y) == k:
            ans += 1
print(ans)

Measured memory_bytes: 9220
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

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;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1'000'000'007;
const ll inf=1'000'000'000'000'000'00;
const int INF=1'000'000'000;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    string s;
    cin>>s;
    rep(S,1<<3){
        int now=s[0]-'0';
        string t;
        t+=s[0];
        rep(i,3){
            if(S & (1<<i)){
                now+=s[i+1]-'0';
                t+='+';
                t+=s[i+1];
            }else{
                now-=s[i+1]-'0';
                t+='-';
                t+=s[i+1];
            }
        }
        if(now==7){
            cout<<t<<"=7"<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int x = sc.nextInt();
        int min = 999999999;
        int[][] book = new int[n][m+1];
        int[] us = new int[m];
        boolean[] buy = new boolean[n];

        for(int i=0;i<n;i++){
            buy[i] = false;
        }

        for(int i=0;i<n;i++){
            for(int j=0;j<m+1;j++){
                book[i][j] = sc.nextInt();
            }
        }

        for(int i=0;i<Math.pow(2,n)-1;i++){
            plus(buy,buy.length-1);
            int sum = 0;
            for(int j=0;j<m;j++){
                us[j] = 0;
            }
            for(int j=0;j<n;j++){
                if(buy[j]){
                    sum += book[j][0];
                    for(int k=0;k<m;k++){
                        us[k] += book[j][k+1];
                    }
                }
            }

            boolean ok = true;
            for(int j=0;j<m;j++){
                if(us[j]<x){
                    ok = false;
                    break;
                }
            }
            if(ok && sum<min){
                min = sum;
            }

        }
        if(min!=999999999){
            System.out.println(min);
        } else{
            System.out.println(-1);
        }
    }

    static boolean[] plus(boolean[] b,int idx){
        if(idx == -1)
            return b;
        if(b[idx]){
            b[idx] = false;
            plus(b,idx-1);
        }else {
            b[idx] = true;
        }
        return b;
    }
}


Measured memory_bytes: 37436
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include <iomanip>
#include<cmath>
#include<stdio.h>
#include<map>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ll long long
#define sort(s) sort(s.begin(),s.end())
#define r(s) reverse(s.begin(),s.end())
#define please return
constexpr auto AC = 0;
using namespace std;
int main() {
	ll a, b;
	ll ans = 0;
	cin >> a >> b;
	vector<ll> s(a);
	rep(i, a) {
		cin >> s[i];
	}
	sort(s);
	

		rep(i, a - b)ans += s[i];
		cout << ans << endl;
	
	please AC;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
using namespace std;
const int N = 200005;
int a[N];
int main() {
    int n, X = 0;
    cin >> n;
    for(int i = 1; i <= n; ++i) {
        scanf("%d",&a[i]);
        X ^= a[i];
    }
    for(int i = 1; i <= n; ++i) {
        printf("%d ",X^a[i]);
    }
return 0;
}

Measured memory_bytes: 4480
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin>>S;
  int size=S.size();
  bool ans=true;
  for(int i=0;i<size;i++){
    for(int j=0;j<size;j++){
      if(i!=j&&S.at(i)==S.at(j)){
        ans=false;
      }
    }
  }
  if(ans) cout<<"yes"<<endl;
  else cout<<"no"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
 
using namespace std;

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

//START OF CODE ->->->->->->->

void solve()
{
    string s;
    cin>>s;

    if ( s == "Sunny" )
    {
        cout<<"Cloudy"<<endl;
    }
    else if ( s == "Cloudy" )
    {
        cout<<"Rainy"<<endl;
    }
    else
    {
        cout<<"Sunny"<<endl;
    }
}

//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int n,m,S;
int a[20],fac[1<<16],ifac[1<<16];
int dp[20][1<<16],bit[1<<16];

int ksm(int x,int y){
	int res=1;
	while(y){
		if(y&1) res=1ll*res*x%mod;
		x=1ll*x*x%mod,y/=2;
	}
	return res;
}

int C(int x,int y){
	if(x<y) return 0;
	int res=1ll*fac[x]*ifac[y]%mod*ifac[x-y]%mod;
	return res;
}

int main(){
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++) scanf("%d",&a[i]);
	S=1<<n;
	fac[0]=1;
	for(int i=1;i<S;i++) fac[i]=1ll*fac[i-1]*i%mod;
	ifac[S-1]=ksm(fac[S-1],mod-2);
	for(int i=S-2;i>=0;i--) ifac[i]=1ll*(i+1)*ifac[i+1]%mod;
	bit[0]=0;
	for(int i=1;i<S;i++) bit[i]=bit[i/2]+i%2;
	dp[m+1][0]=1;
	for(int i=m;i>=1;i--){
		for(int j=0;j<S;j++){
			int T=(S-1)^j;
			for(int k=1;k<S;k*=2){
				if((T&k)) (dp[i][j|k]+=1ll*C(S-a[i]-j,k-1)*dp[i+1][j]%mod*fac[k]%mod)%=mod;
			}
			(dp[i][j]+=dp[i+1][j])%=mod;
		}
	}
	for(int i=0;i<S;i++) dp[1][i]=1ll*dp[1][i]*fac[S-1-i]%mod;
	for(int i=S-1;i>=0;i--){
		int T=(S-1)^i;
		int now=T;
		while(now){
			(dp[1][i]+=mod-dp[1][i|now])%=mod;
			now=(now-1)&T;
		}
	}
	printf("%d\n",1ll*S*dp[1][0]%mod);
	
	return 0;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;


ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}


int main(){FIN

    vll a(3); REP(i,3) cin>>a[i];
    VSORTR(a);
    cout<<10*a[0]+a[1]+a[2]<<endl;

    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    char S[3];
    cin >> S[0] >> S[1] >> S[2];
    char a[] = {'a', 'b', 'c'};
    char b[] = {0, 0, 0};
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3;j++)
        {
            if (S[i] == a[j]){
                b[j] = 1;
            }
        }
    }
    if( b[0] + b[1] + b[2] == 3){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
    cout << endl;
}

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

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

    int64_t N;
    cin >> N;
    int64_t a, r = 1, ee = 1e18;
    vector<int64_t> arr;
    bool z = 0;
    for (int i = 0; i < N; ++i) {
    	cin >> a;
    	if (a == 0) {
    		z = 1;
    	}
    	arr.push_back(a);
    }
    if (z) {
    	cout << 0 << endl;
    	return 0;
    }
    for (int64_t a : arr) {
    	if (a > ee/r) {
    		cout << -1 << endl;
    		return 0;
    	}
    	r *= a;
    }
    cout << r << endl;
}

Measured memory_bytes: 4280
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

// inf
constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());

    int ans = 0;
    for (int i = 0; i <= a.back(); ++i) {
        auto itl = lower_bound(a.begin(), a.end(), i);
        auto itr = upper_bound(a.begin(), a.end(), i + 2);
        ans = max(ans, (int)(itr - itl));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640