akhauriyash/Code-Regression huggingface dataset:
/*
    author:  Maksim1744
    created: 13.06.2020 15:01:50
*/

#include <bits/stdc++.h>

using namespace std;

#define ll   long long
#define ld   long double

#define mp   make_pair
#define pb   push_back
#define eb   emplace_back

#define sum(a)     ( accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a)    (*min_element((a).begin(), (a).end()))
#define maxe(a)    (*max_element((a).begin(), (a).end()))
#define mini(a)    ( min_element((a).begin(), (a).end()) - (a).begin())
#define maxi(a)    ( max_element((a).begin(), (a).end()) - (a).begin())
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())

template<typename T>             vector<T>& operator--            (vector<T>& v){for (auto& i : v) --i;            return  v;}
template<typename T>             vector<T>& operator++            (vector<T>& v){for (auto& i : v) ++i;            return  v;}
template<typename T>             istream& operator>>(istream& is,  vector<T>& v){for (auto& i : v) is >> i;        return is;}
template<typename T>             ostream& operator<<(ostream& os,  vector<T>& v){for (auto& i : v) os << i << ' '; return os;}
template<typename T, typename U> istream& operator>>(istream& is, pair<T, U>& p){is >> p.first >> p.second;        return is;}
template<typename T, typename U> ostream& operator<<(ostream& os, pair<T, U>& p){os << p.first << ' ' << p.second; return os;}
template<typename T, typename U> pair<T,U> operator-(pair<T,U> a, pair<T,U> b){return mp(a.first-b.first, a.second-b.second);}
template<typename T, typename U> pair<T,U> operator+(pair<T,U> a, pair<T,U> b){return mp(a.first+b.first, a.second+b.second);}
template<typename T, typename U> void umin(T& a, U b){if (a > b) a = b;}
template<typename T, typename U> void umax(T& a, U b){if (a < b) a = b;}

#ifdef HOME
#define TAG_LENGTH       25
#define LR_LEFT          left
#define LR_RIGHT         right
#define LR_VALUE         value
#define LR_SECOND_VALUE  mn
#include "C:/C++ libs/print.cpp"
#else
#define showl            42;
#define shows            42;
#define show(...)        42;
#define showm(...)       42;
#define showt(...)       42;
#define printTree(...)   42;
#define printGraph(...)  42;
#define printLRTree(...) 42;
#define printMatrix(...) 42;
#define printWGraph(...) 42;
#define debug     if (false)
#endif

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

    ll a, b, v, w;
    cin >> a >> v;
    cin >> b >> w;
    ll t;
    cin >> t;
    ll d = abs(a - b);
    if (w >= v) {
        cout << "NO\n";
        return 0;
    }
    cout << ((v - w) * t >= d ? "YES\n" : "NO\n");

    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<math.h>
#include<tuple>
#include<string.h>
#include <numeric> 
#include<unordered_map>
using namespace std; 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define pp1(...) "\033[1;47;35m" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define dg(x) debug() << pp1(x)
#define dg1(x) debug() << pp(x)
#define dg2(x,y) debug() << pp(x) pp(y)
#define dg3(x,y,z) debug() << pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << pp(w) pp(x) pp(y) pp(z)
#define int long long
#define all(x) x.begin() , x.end()
#define clr(x) memset(x , 0 , sizeof x);
#define sz(x) (int)x.size()
template<typename T> void db(T x ){ debug() <<">>> " <<  x; }
template<typename T> void db(T x , T y){ debug() <<">>> " <<  x <<" , "<< y; }
template<typename T> void db(T x , T y , T z){ debug() <<">>> "<< x <<" , "<< y <<" , "<< z; }
template<typename T> void db(T x , T y , T z , T a){ debug() <<">>> "<< x <<" , " << y <<" , "<< z <<" , "<< a; }
const int xx = 2e5;
const int Mod = 1e9 + 7;
const int inf = 1e18;
const int Maxn = 20010;


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

  string s;
  cin >> s;
  map<string , int > hash;
  hash["dream"] = 1;
  hash["dreamer"] = 1;
  hash["erase"] = 1;
  hash["eraser"] = 1;

  int N = sz(s);
  s += "########";
  string ans = "";
  for(int i = 0; i < N - 4; i++) {
    if(s[i] == 'd') {
      string x = s.substr(i , 7);
      if(hash[x]) {
        string m = s.substr(i + 5 , 5);
        if(m != "erase"){
          ans += x;
          i += 6;
          continue;
        }
      }
      string y = s.substr(i , 5);
      if(hash[y]) {
        ans += y;
        i += 4;
      }
    }
    else if(s[i] == 'e'){
      string x = s.substr(i , 6);
      if(hash[x]){
        ans += x;
        i += 5;
        continue;
      }
      string y = s.substr(i , 5);
      if(hash[y]){
        ans += y;
        i += 4;
      }
    }
  }
  while(s.back() == '#') s.pop_back();
  dg1(ans);
  if(s == ans){
    cout << "YES" << '\n';
  } 
  else cout << "NO" << '\n';
}

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

int main(){
    ll n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int ans = a[0];
    rep(i,n){
        ans = __gcd(ans,a[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
/**
 * @author torith
 * @date 2018-10-13
 */

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

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

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


int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,M;
    cin >> N >> M;
    char S[100000],T[100000];
    for (ll i = 0; i < N; ++i) {
        cin >> S[i];
    }
    for (ll i = 0; i < M; ++i) {
        cin >> T[i];
    }
    ll L = lcm(N,M);

    ll a = lcm(L/N,L/M);
    ll i = 1;
    while (i <= L){
        if (S[(i-1)/(L/N)] != T[(i-1)/(L/M)]){
            cout << "-1" << "\n";
            return 0;
        }
        i += a;
    }

    cout << L << "\n";

    return 0;
}



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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll L[100005];

int main()
{
    ll N, X;
    cin >> N >> X;
    REP(i, N)
    {
        cin >> L[i];
    }

    ll D = 0;
    ll ans = 1;
    REP(i, N)
    {
        D += L[i];
        if (D <= X)
            ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
# Collatz Problem
import sys

s = int(input())

a = [0 for _ in range(1000000)]

a[0] = s

def getN(wk) :
    for _ in range(1, len(wk)) :
        if wk[_ - 1] % 2 == 0 :
            wk[_] = wk[_ - 1] // 2
        else :
            wk[_] = wk[_ - 1] * 3 + 1
        for i in range(_):
            if wk[i] == wk[_] and i < _ :
                return _ + 1

print(getN(a))

Measured memory_bytes: 11032
import java.util.Scanner;
class Main {
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

      	int X = 0;
      
		int A = sc.nextInt();
		int B = sc.nextInt();
      
      	X = A - B * 2;
          
        if (X > 0) {
        	System.out.print(X);
        } else {
        	System.out.print(0);
        }
		return;
	}
}

Measured memory_bytes: 23764
//greedy is not applicable here as even if select min "diff" at each step then
//also final ans will not be optimal min possible of all answers
//eg: 30 20 50 10 50 70
//greedy: 60
//bruteforce (mainly dp): 40
import java.io.*;
import java.util.*;
public class Main{
  	/*public int minRec(int a[],int dp[],int i,int j)
    {
      if(i==n && j==n)
        	return dp[n][n];
      if(
        return Math.min( Math.abs(a[]
    }*/
	public static void main(String args[]) throws IOException{
      BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
      int n=Integer.parseInt(br.readLine().trim());
      String s[]=br.readLine().trim().split("\\s+");
      int size=s.length;
      int arr[]=new int[size];
      for(int i=0;i<size;i++)
        arr[i]=Integer.parseInt(s[i]);
      int ans=0;
      //int dp[][]=new int[][];
      //ans=minRec(a,dp,0,0);

      //if define dp[i] as "the minimum total cost to reach nth (i.e. last) stone from ith stone"
      // long dp[]=new long[size];
      // dp[n-1]=0;
      // dp[n-2]=(long)Math.abs((long)arr[n-1]-(long)arr[n-2]);
      // for(int i=n-3;i>=0;i--)
      //   dp[i]=(long)Math.min( dp[i+1]+Math.abs((long)arr[i]-(long)arr[i+1]), dp[i+2]+Math.abs((long)arr[i]-(long)arr[i+2]) );
      // System.out.println(dp[0]);
      //correct


      //if define dp[i] as "the minimum total cost to reach ith stone"
      long dp[]=new long[size];
      dp[0]=0;
      dp[1]=(long)Math.abs((long)arr[1]-(long)arr[0]);
      for(int i=2;i<n;i++)
        dp[i]=(long)Math.min( dp[i-1]+Math.abs((long)arr[i]-(long)arr[i-1]), dp[i-2]+Math.abs((long)arr[i]-(long)arr[i-2]) );
      System.out.println(dp[n-1]);
      //correct
    }
}

Measured memory_bytes: 38936
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
#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 pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define P pair<int, int>
#define V vector<int>
#define S set<int>
#define itn int
bool dbg = false;
int N;
int T;
vector<P> F;
int dp[3333][3333];
int dp2[3333][3333];
void solve() {
    sort(all(F));

    int ans = 0;
    /*
    FORR(i, 1, N) {
        FOR(j, 0, T) {
            if (F[i - 1].second > j) {
                dp[i][j] = dp[i - 1][j];
                //ans = max(ans, dp[i][j] + F[i - 1].first);
                dp2[i][j] = i;
            } else {
                dp[i][j] = dp[i - 1][j - F[i - 1].second] + F[i - 1].first;
                dp2[i][j] = dp2[i - 1][j - F[i - 1].second];
            }
        }
    }*/
    FORR(i, 1, N) {
        FOR(j, 0, T) {
            if (F[i - 1].second > j || dp[i - 1][j] + F[dp2[i - 1][j] - 1].first >= dp[i - 1][j - F[i - 1].second] + F[i - 1].first + F[dp2[i - 1][j - F[i - 1].second] - 1].first) {
                dp[i][j] = dp[i - 1][j];
                //ans = max(ans, dp[i][j] + F[i - 1].first);
                dp2[i][j] = i;
            } else {
                dp[i][j] = dp[i - 1][j - F[i - 1].second] + F[i - 1].first;

                dp2[i][j] = dp2[i - 1][j - F[i - 1].second];
            }
        }
    }


    FOR(t, 0, T) {
        if (dp2[N][t])
            ans = max(dp[N][t] + F[dp2[N][t] - 1].first, ans);
    }
    cout << ans << endl;
}


signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N >> T;
    FOR(i, 0, N) {
        int x, y;
        cin >> x >> y;
        F.pb(mp(y, x));
    }
    solve();
    return 0;
}


Measured memory_bytes: 160128
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long int64;
int MOD = 1e9 + 7;

int main() {
  //cout << fixed << setprecision(15);
  int X;
  cin >> X;

  for (int i = 1; i <= 1000; ++i) {
    int tmp = X - 100 * i;
    if (tmp < 0) break;
    if (tmp <= 5 * i) {
      cout << 1 << "\n";
      return 0;
    }
  }
  
  cout << 0 << "\n";
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define REP(i,n,m) for(int i = (n); i < (m); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cerr << v << " "; cerr << endl;
#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << v << " "; cerr << endl; } 
#define debugP(vec) for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } 

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

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

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

	double r; cin >> r;
	cout << setprecision(10) << 3.14159265358979*r*2 << endl;
}

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

    #define all(v) v.begin(),v.end()
    #define rall(v) v.rbegin(),v.rend()
    #define trav(i,a) for(auto i: a)
    #define ff first
    #define ss second
    #define eb emplace_back
    #define tc(t) ll t; cin>>t; while(t--)
    #define prec(n) fixed<<setprecission(n)
    #define mst(arr,value) memset(arr,value,sizeof(arr))
    
    const long long sz = (long long)1e4+5;
    const long long mx = (long long)2e5+5;
    const long long inf = (long long)1e18;
    const long long mod = (long long)1e9+7;
    
    #define f(i,n)     for(ll i=0;   i<n;  i++)
    #define fab(i,a,b) for(ll i=a;   i<b;  i++)
    #define fr(i,n)    for(ll i=n-1; i>=0; i--)
    #define fba(i,b,a) for(ll i=b-1; i>=a; i--)

    long long pw(long long x,unsigned long long y) { 
        if (y==0) return 1; 
        else if (y%2==0)  return pw(x,y/2)*pw(x,y/2); 
        else return x*pw(x,y/2)*pw(x,y/2);
    }

    int main() {
        ios_base::sync_with_stdio(0);
        cin.tie(NULL);
        cout.tie(NULL);
        ll n;
        cin >> n;
        ll a[n], dp[n + 1];
        f(i, n)
            cin >> a[i];
        dp[0] = 0;
        dp[1] = abs(a[0] - a[1]);;
        fab(i, 2, n) 
            dp[i] =  min(dp[i - 1] + abs(a[i - 1] - a[i]), dp[i - 2] + abs(a[i - 2] - a[i]));
        cout << dp[n - 1];
        return 0;
    }

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 100005;
char en = '\n';

bool validM(ll a) { return a >= 1 && a <= 12; }
bool validY(ll b) { return true; }
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  string s;
  cin >> s;

  ll a = stoi(s.substr(0, 2));
  ll b = stoi(s.substr(2, 2));

  map<string, ll> par;
  if (validM(a) && validY(b)) {
    par["MMYY"];
  }
  if (validY(a) && validM(b)) {
    par["YYMM"];
  }

  if (par.size() == 2) {
    cout << "AMBIGUOUS" << en;
  } else if (par.size() == 1) {
    cout << par.begin()->first << en;
  } else
    cout << "NA" << en;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef pair <int,int> ii;
typedef long long LL;
#define pb push_back
const int INF = 2147483647;
const int N = 500005;

int res, i;
string s;
char t[55];

int main() {
scanf("%d", &i);
scanf("%s", t);
s = t;
for (i=2;i<s.size();i++) if (s[i] == 'C' && s[i - 1] == 'B' && s[i - 2] == 'A') res++;
printf("%d\n", res);
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int N;
    cin>>N;
    string s = to_string(N);
    for(int i=0;i<3;i++){
        if(s[i]=='7'){
            cout<<"Yes"<<endl;
            break;
        }
        if(i==3-1){
            cout<<"No"<<endl;
        }
    }
}


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

/* Training Camp*/

int main(){
    // 入力スタンダード
    int n;
    cin >> n ;
    int modval = 1000000007;  
    
    long long sunuke = 1;
    for(int i=0; i<n; i++){
        sunuke *= (i+1);
        sunuke %= modval ;
    }

    cout << sunuke <<endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<cmath>
#include<functional>

using namespace std;

int main() {
   int N;
   cin >> N;
   int a[ N ];
   long long total = 0;
   for( int i = 0; i < N; i++ ) {
      cin >> a[ i ];
      total += a[ i ];
   }

   long long *** dp = ( long long *** ) malloc( sizeof( long long *** ) * 2 );
   for( int i = 0; i < 2; i++ ) {
      dp[ i ] = ( long long ** ) malloc( sizeof( long long ** ) * N );
      for( int j = 0; j < N; j++ ) {
         dp[ i ][ j ] = ( long long * ) malloc( sizeof( long long * ) * N );
         for( int k = 0; k < N; k++ ) {
            dp[ i ][ j ][ k ] = LONG_MAX;
         }
      }
   }

   function< long long( int, int, int )> getDp;

   getDp = [ & ]( int t, int i, int j ) -> long long {
      if( i == j ) {
         return t == 0 ? a[ i ] : 0;
      }
      if( dp[ t ][ i ][ j ] != LONG_MAX ) {
         return dp[ t ][ i ][ j ];
      }
      auto val1 = getDp( 1 - t, i + 1, j );
      auto val2 = getDp( 1 - t, i, j - 1 );
      if( t == 0 ) {
         if( val1 + a[ i ] > val2 + a[ j ] ) {
            dp[ t ][ i ][ j ] = a[ i ] + val1 ;
         } else {
            dp[ t ][ i ][ j ] = a[ j ] + val2 ;
         }
      } else {
         dp[ t ][ i ][ j ] = min( val1, val2 );
      }
      return dp[ t ][ i ][ j ];
   };
   auto x = getDp( 0, 0, N - 1 );
   cout << ( x - total + x );
   return 0;
}


Measured memory_bytes: 141440
#include "bits/stdc++.h"
#pragma warning(disable:4996)
using namespace std;
const int N = 1e5 + 5;
int visited[N];
int d[N];
vector<int> g[N];
int ans;

void dfs(int x,int depth) {
	if (visited[x])return;
	visited[x] = 1;
	int ans = 0; 
	for (auto v : g[x]) {
		dfs(v, depth + 1);
		ans = max(d[v], ans);
	}
	d[x] = ans + 1;
}

int main() {
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		g[u].push_back(v);
	}

	for (int i = 1; i <= n; i++) {
		if (!visited[i])
			dfs(i,0);
	}

	for (int i = 0; i <= n; i++)
		ans = max(ans, d[i]);

	cout << ans - 1 << endl;
}


Measured memory_bytes: 9216
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
#include <random>
#include <time.h>
#include <unordered_set>

using namespace std;
using Int = long long;

constexpr double EPS = 1e-10;
constexpr long long MOD = 998244353;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for (int i = 0;i < 60; i++) {
        if (n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

long long my_mod_pow(long long x, long long n) {
	long long ret = 1;
	for (; n > 0; n >>= 1, x = x * x % MOD) {
		if (n & 1) {
			ret = ret * x % MOD;
		}
	}
	return ret;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

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

void fastInput() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main(void) {
    Int X; cin >> X;
    Int ans = 0;
    ans += X / 500 * 1000;
    X = X % 500;
    ans += X / 5 * 5;
    X %= 5;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  cin >> N;
  string S,T;
  cin >> S >> T;
  for(int i=0;i<N;i++){
    cout << S.at(i) << T.at(i);
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cmath>
#include <numeric>
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <list>
#include <unordered_map>
#include <tuple>
#include <complex>


#define FOR(i, a, b)		for(int i = (int)(a); i < (int)(b); ++i)
#define FORE(i, a, b)		for(int i = (int)(a); i <= (int)(b); ++i)
#define REP(i, n)			FOR(i, 0, n)
#define REPE(i, n)			FORE(i, 0, n)
#define ALL(x)				(x).begin(),(x).end()
#define DEBUG_DC(x)			cout << #x << ": " << x << endl
#define VEC_TYPE			int	
#define INF					1e5+1

using namespace std;
typedef long long ll;
typedef vector<VEC_TYPE> vdef;
typedef vector<vdef> vvdef;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmaxE(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; }
template<class T> inline bool chminE(T& a, T b) { if (a >= b) { a = b; return 1; } return 0; }
template<typename T> inline T mygcd(T a, T b) { return b ? mygcd(b, a%b) : a; }
template<typename T> inline T mylcm(T a, T b) { return a * b / mygcd(a, b); }


int main()
{
	int n, x;
	cin >> n >> x;
	int ans = 1;
	int d_prev = 0;
	int d_cur = 0;
	vdef l(n, 0);
	for (int i = 0; i < n; ++i) cin >> l[i];

	for (int i = 0; i < n; ++i)
	{
		d_cur = d_prev + l[i];
		if (d_cur <= x)
		{
			++ans;
			d_prev = d_cur;
		}
		else
		{
			break;
		}
	}

	std::cout << ans << std::endl;
	return 0;
}

Measured memory_bytes: 256
import sys
a,b,c,d = input()

for i in range(2**3):
    op = ["+"]*3
    for j in range(3):
        if (i >> j) & 1 == 1:
            op[j] = "-"
    if eval(a+op[0]+b+op[1]+c+op[2]+d) == 7:
        print(a+op[0]+b+op[1]+c+op[2]+d+'=7')
        sys.exit()

Measured memory_bytes: 9080
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define INF INT_MAX;
typedef long long ll;
using namespace std;

int main(){
  string s; cin >> s;
  bool a = false,A=true;
  int c=0;
  rep(i,s.size()){
    if(i==0){
      if(s.at(i)=='A') a = true;
    }else if(i>1&&i<s.size()-1){
      if('a'>s.at(i)||'z'<s.at(i)){
        if(s.at(i)=='C') c++;
        else A = false;
      }
    }else{
      if('a'>s.at(i)||'z'<s.at(i)){
        A =false;
      }
    }
  }

  if(a&&A&&c==1) puts("AC");
  else puts("WA");
}

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

int main(){

    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    rep (i, N) cin >> A[i];

    rep (i, N){
        bool ok = true;
        if (i < K) continue;
        if (A[i] <= A[i-K]) ok = false;
        if (ok) cout << "Yes" << endl;
        else cout << "No" << endl;
    }


    return 0;
}

Measured memory_bytes: 4048
//*** cfmasterr ***//
#include <bits/stdc++.h>

using namespace std;

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




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

using namespace std;

int number[100];
int car;
int position = 0;

int main(){
	while(cin >> car){
		if(car > 0){
			number[position] = car;
			position++;
		}else{
			position--;
			cout << number[position] << endl;
		}
	}
}

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}

int main() {
  int64_t N;
  cin>>N;
  int64_t x=N;
  string t;
  while(x){
    x--;
    t=(char)(x%26+'a')+t;
    x/=26;
  }
  cout<<t<<endl;
  return 0;
}

Measured memory_bytes: 3636
x = int(input())
def prime(n):
    if n == 1:
        return 0
    elif n == 2:
        return 2
    else:
        if n%2 == 0:
            return 0
        for i in range(3,int(n**0.5)+1):
            if n%i == 0:
                return 0
        return n
for i in range(x,2*10**5+1):
    if prime(i):
        print(i)
        break

Measured memory_bytes: 3060
import sys

def solve():
    while True:
        try:
            a, b = map(int, sys.stdin.readline().split())
            c = a + b

            if c == 0:
                print(1)
            else:
                ans = 0

                while c > 0:
                    ans += 1
                    c //= 10

                print(ans)

        except:
            return

if __name__ == '__main__':
    solve()

Measured memory_bytes: 7628
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl '\n'
#define ft first
#define sd second
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;
typedef pair<double, double> pdd;
typedef pair<long long, long long> pll;
// scanf("%d %d %d %d", &w, &b, &d, &s); %lld
// printf("%d\n", points);
// const double PI = acos(-1);

int main()
{
    #ifdef LOCAL
    freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    #else
        fastIO;
    #endif
        int a, b, ans = -1;
        float x, y;
        cin >> a >> b;
        for(int i = 1; i<=1300; i++){
            x = (i*1.0)*0.08;
            y = (i*1.0)*0.1;
            if((int)x == a && (int)y == b){
                ans = i;
                break;
            }
        }
        cout << ans << endl;
        return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#include<bitset>
#include<iomanip>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	string S;
	int num[3]={};
	scan(S);
	int N=S.size();
	rep(i,N){
		num[S[i]-'a']++;
	}
	int nummax=0,nummin=INF;
	rep(k,3){
		nummax=max(nummax,num[k]);
		nummin=min(nummin,num[k]);
	}
	if(nummax-nummin<=1) prin("YES");
	else prin("NO");
	return 0;
}


Measured memory_bytes: 512
'use strict';
(function(input){
  input=input.trim().split(/\s+/).map(x=>x-0);
  const r=input[0];
  const D=input[1];
  let x=input[2];
  let ans=new Array(10);
  for(let i=0;i<10;i++){
    x=r*x-D;
    ans[i]=x;
  }
  
  console.log(ans.join('\n'));
})(require('fs').readFileSync('/dev/stdin','utf8'));


Measured memory_bytes: 18248
#define LOCAL
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second	
#define db 0
#define EPS (1e-7)    //0.0000001 the value
#define PI (acos((ld)-1.0))
#define MAXN (300006)
#define ll long long int 
#define ld long double
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for(ll ii = ss; ii < (ll)ee; ++ii)
#define space " "
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ((ll)x.size())
#define ph push
#define btinpct(x) __builtin_popcountll((x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
string to_string(char c) {string s(1,c);return s;}string to_string(bool b){return (b ? "true" : "false");}template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}template <typename A>string to_string(A v) {bool first = true;string res = "{";for (const auto &x : v) {if (!first) {res += ", ";}first = false;res += to_string(x);}res += "}";return res;}void degug_out() { cerr << endl; }template <typename Head, typename... Tail>void degug_out(Head H, Tail... T) {cerr << " " << to_string(H);degug_out(T...);}
#ifdef LOCAL
#define degug(...) cerr << "[" << #__VA_ARGS__ << "]:", degug_out(__VA_ARGS__)
#else
#define degug(...) 42
#define cerr if(0)cout
#endif
string A;
const ll MOD=1e9+7;
ll qexp(ll x, ll e){
	if(e==0)return 1;
	ll half=qexp(x,e/2);
	half*=half;half%=MOD;
	if(e&1)half*=x,half%=MOD;
	return half;
}
void five() {
	ll co=0;
	for(ll i=0;i<=5;++i){
		for(ll j=0;j<=5;++j){
			if(i+j<=5&&(i+j)==(i^j)){
				// cerr<<i<<' '<<j<<'\n';
				co++;
			}
		}
	}
	cerr<<"ans: "<<co<<'\n';
}
int main()
{
	FAST
	cin>>A;
	ll ones=0,ans=0;
	FOR(i,0,A.size())if(A[i]=='1'){
		ans+=(qexp(2,ones) * qexp(3,siz(A)-i-1));
		ans%=MOD;
		++ones;
	}	
	ans+=qexp(2,ones);ans%=MOD;
	cout<<ans<<'\n';
	// five();
}


Measured memory_bytes: 512
#include<stdio.h>
#include<string.h>
int main()
{
	char s[100005];
	scanf("%s",s);
	int i,n=strlen(s);
	int ans1,ans2;
	ans1=ans2=0;
	for(i=0;i<n;i++)
	{
		if(i%2==0)
		{
			if(s[i]=='0')
				ans1++;
			else
				ans2++;
		}
		else
		{
			if(s[i]=='1')
				ans1++;
			else
				ans2++;
		}
	}
	if(ans1<ans2)
		printf("%d\n",ans1);
	else
		printf("%d\n",ans2);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <string>
#include <random>
using namespace std;
typedef long long ll;
const int maxn = 100005;

int c[5];

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "w", stdout);
#endif
  for (int i=0;i<3;i++){
    int x,y;
    cin>>x>>y;
    c[x]++;
    c[y]++;
  }
  bool fail = false;
  for(int i=1;i<=4;i++)if(c[i]>2)fail=true;
  if(fail)cout<<"NO"<<endl;
  else cout<<"YES"<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		String S=stdIn.next();
		int N=S.length();
		String h="";
		int z=0,cou=0,min=0;
		while(z<N){
			if(z%2==0)
				h="0";
			else
				h="1";
			if(S.substring(z,z+1).equals(h)){
				
			}
			else
				cou++;
			z++;
		}min=cou;z=0;cou=0;
		while(z<N){
			if(z%2==0)
				h="1";
			else
				h="0";
			if(S.substring(z,z+1).equals(h)){
				
			}
			else
				cou++;
			z++;
		}
		if(cou<=min)
			System.out.println(cou);
		else
			System.out.println(min);
	}
}

Measured memory_bytes: 35664
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
using namespace std;
int main(void)
{
    int A, B;
    cin >> A >> B;
    string ans;
    if (A <= 8 && B <= 8)
        ans = "Yay!";
    else
        ans = ":(";
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
from copy import deepcopy
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions
from operator import itemgetter
import itertools
import copy


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


def gcd(a, b):
    while(b != 0):
        a, b = b, a % b
    return a


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
n = int(input())
xyh = [tuple(map(int, input().split())) for _ in range(n)]
# print(xyh)


def get_H(Cx, Cy):
    for x, y, h in xyh:
        if h == 0:  # 高度が0のときは何もしない
            continue
        H = abs(x-Cx)+abs(y-Cy)+h  # H-|X-Cx|-|Y-Cy|=hの式変形
        if h >= 1:
            return H


def check(Cx, Cy, H):
    for x, y, h in xyh:
        if h != max(H-abs(x-Cx)-abs(y-Cy), 0):
            return False
    return True


for Cx in range(101):
    for Cy in range(101):
        H = get_H(Cx, Cy)
        if (check(Cx, Cy, H)):
            print(Cx, Cy, H)
            quit()


Measured memory_bytes: 79180
#include<bits/stdc++.h>
using namespace std;
#define NL            "\n"
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
int main()
{
    _SAD()
    int n,ans=0;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    while(1)
    {
        int cnt=0;
        for(int i=0;i<n;i++)
        {
           if(a[i]%2==0)
           {
               a[i]/=2;
               cnt++;
           }
           else
           {
               break;
           }
        }
        if(cnt==n)
        {
            ans++;
        }
        else
        {
            break;
        }
    }
    cout<<ans<<NL;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
#define REP(i, n) for(int i=0; i<n; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
using P = pair<int, int>;
const int inf = 1e9;
const ll INF = 1e18;
const ll mod = 1e9+7;

struct edge{
    int to;
    int cost;
};
using graph = vector<vector<edge>>;

int main(){
    str s; cin >> s;
    bool aorbonly = false;
    if(s[0] == 'A' && s[1] == 'A' && s[2] == 'A') aorbonly = true;
    if(s[0] == 'B' && s[1] == 'B' && s[2] == 'B') aorbonly = true;
    if(aorbonly) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(d)]
k = [-1] * 26
for i in range(d):
    res = -100000000
    p = 0
    for j in range(26):
        tmp = 0
        tmp += s[i][j]
        for x in range(26):
            if x == j:
                continue
            tmp -= c[x] * (i - k[x] + 6)
        if res < tmp:
            res = tmp
            p = j
    k[p] = i
    print(p + 1)


Measured memory_bytes: 74220
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"
using namespace std;
int main()
{
  int a, b, c, d;
  cin>>a>>b>>c>>d;
  while(1)
  {
      c = c-b;
    if( c<=0 )
    {
      cout<<"Yes";
      break;
    }
    a= a-d;
    if(a<=0)
    {
      cout<<"No";
      break;
    }
    
    
    
  }
 
}

Measured memory_bytes: 3632
N = int(input())
S = []
for i in range(N):
    S.append(input())
c0 = 0
c1 = 0
c2 = 0
c3 = 0

for i in range(N):
    if S[i] == "AC":
        c0 = c0 + 1
    elif S[i] == "WA":
        c1 = c1 + 1
    elif S[i] == "TLE":
        c2 = c2 + 1
    else:
        c3 = c3 + 1

print("AC x " +str(c0))
print("WA x " +str(c1))
print("TLE x " +str(c2))
print("RE x " +str(c3))


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

using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;

#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second
//#define int long long
template<class T, class U>bool chmax(T &a, const U &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T, class U>bool chmin(T &a, const U &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>void println(T a){if(cout.precision()!=12)cout<<setprecision(12);cout<<a<<endl;}
//lambda: [](int x, int y){return x<y;}

signed main(void){
    int n;cin>>n;
    set<ll> a;
    rep(i,n){
        ll t;cin>>t;
        a.insert(t);
    }
    if(a.size()==n){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }


    return 0;
}


Measured memory_bytes: 9600
#include<cstdio>
#include<stack>
#include<algorithm>
#define REP(i,a,n) for(int i = a;i < n;i++)
#define rep(i,n) REP(i,0,n)
#define fir first
#define sec second
using namespace std;
int main(void){
   stack<pair<int,int> >go;
   int n;
   pair<int,int>in;
   pair<int,int>out;

   while(scanf("%d",&n),n){
      int col;scanf("%d",&col);
      in.fir = col; in.sec = 1;
      rep(i,n-1){
         scanf("%d",&col);
         if(in.fir == col) in.sec += 1;
         else{
            if(i%2 == 0){
               if(go.empty()){
                  in.fir = col;
                  in.sec += 1;
               }
               else{
                  out = go.top(); go.pop();
                  in.fir = col;
                  in.sec += out.sec+1;
               }
            }
            else{
               go.push(in);
               in.fir = col; in.sec = 1;
            }
         }
      }
      go.push(in);

      int cnt = 0;
      while(go.size()){
         out = go.top(); go.pop();
         if(out.fir == 0) cnt += out.sec;
      }
      printf("%d\n",cnt);
   }
}

Measured memory_bytes: 1036
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
int main() {
    long long a,b,c;
    cin >> a;
    cin >> b;
    cin >> c;
    string str = "No";
    if(a+b-c<0) {
        if ( (a+b-c)*(a+b-c) - 4*a*b > 0) {
            str = "Yes";
        }
    }
    cout << str << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> //ABC 131_a
using namespace std;
char S[5];
int main(){
    for(int i=1;i<=4;i++){
    	cin>>S[i];
	}
	if(S[1]==S[2]||S[2]==S[3]||S[3]==S[4])
		cout<<"Bad";
	else 
		cout<<"Good";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>
#include <functional>

using namespace std;
#define ALL(x)              (x).begin(),(x).end()
typedef long long           ll;
#define REP(i, n)           for (ll i = 0 ; i < (ll)n ; ++i)
#define REPN(i, m, n)       for (ll i = m ; i < (ll)n ; ++i)
#define INF                 (ll)2e9
#define MOD                 (1000 * 1000 * 1000 + 7)
#define Ceil(x, n)          (((((x))+((n)-1))/n))
#define CeilN(x, n)         (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)        ((x)-(x)%(n))
#define IsOdd(x)            (((x)&0x01UL) == 0x01UL)
#define IsEven(x)           (!IsOdd((x)))
#define M_PI                3.14159265358979323846
typedef pair<ll, ll>	    P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
int main()
{
	ll N, M;
	cin >> N >> M;
	vector<ll> A(M);
	REP(i, M) cin >> A[i];
	ll sumVal = accumulate(ALL(A), 0);
	N -= sumVal;
	
	N = max((ll)-1, N);

	cout << N << endl;
	return 0;
}


Measured memory_bytes: 3700
from itertools import accumulate


def get_primes_til(n):
    primes = [True] * (n + 1)
    primes[0] = False
    primes[1] = False
    for i in range(2, int(n ** .5) + 1):
        for j in range(2 * i, n + 1, i):
            primes[j] = False
    return {i for i in range(2, n + 1) if primes[i]}


N_MAX = 10 ** 5
primes = get_primes_til(N_MAX)
is_2017_like = list(accumulate([i in primes and (i + 1) // 2 in primes for i in range(N_MAX + 1)]))
for _ in range(int(input())):
    l, r = map(int, input().split())
    print(is_2017_like[r] - is_2017_like[l - 1])


Measured memory_bytes: 7628
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}

template<class D>
struct segtree_simple{
	int N;
	vector<D> val;

	segtree_simple(){}
	segtree_simple(int n){
		N=1;
		while(N<n) N*=2;
		val.assign(N*2,D::e());
	}
	segtree_simple(const vector<D>& ds){
		int n = ds.size();
		N=1;
		while(N<n) N*=2;
		val.assign(N*2,D::e());
		rep(i,n) val[i+N] = ds[i];
		for(int i=N-1;i>0;i--) val[i] = val[i*2] + val[i*2+1];
	}
	void assign(int k,D d){
		k+=N;
		val[k]=d;
		k/=2;
		while(k){
			val[k] = val[k*2] + val[k*2+1];
			k/=2;
		}
	}
	D query(int a,int b){		//non-commutative & unrecursive
		D L = D::e() , R = D::e();
		a+=N,b+=N;
		while(a<b){
			if(a&1) L = L + val[a++];
			if(b&1) R = val[--b] + R;
			a/=2,b/=2;
		}
		return L+R;
	}
	// D query(int a,int b){
	// 	return query(a,b,0,N,1);
	// }
	// D query(int a,int b,int l,int r,int k){
	// 	if(b<=l||r<=a) return D::e;
	// 	if(a<=l&&r<=b) return val[k];
	// 	return query(a,b,l,(l+r)/2,k*2) + query(a,b,(l+r)/2,r,k*2+1);
	// }
};

struct Dmin{		//(int,min,inf)
	int x;
	Dmin(){}
	Dmin(int x):x(x){}
	static Dmin e(){
		return Dmin(1e9);
	}
	Dmin operator+(const Dmin& r) const {
		return Dmin(min(x,r.x));
	}
	friend ostream& operator<<(ostream& o,const Dmin& d){return o<<d.x;}
};

using D = Dmin;

int N;
int a[200000];
int ia[200000];
typedef pair<int,int> P;

segtree_simple<D> seg[2];

map<P,vector<P>> nxt;

P solve(int l,int r){
	if(l==r) return P(1e9,1e9);

	int v = seg[l%2].query(l,r).x;
	int p = ia[v];
	int u = seg[(l+1)%2].query(p,r).x;
	int q = ia[u];
	P v1 = solve(l,p);
	P v2 = solve(p+1,q);
	P v3 = solve(q+1,r);
	nxt[P(v,u)].pb(v1);
	nxt[P(v,u)].pb(v2);
	nxt[P(v,u)].pb(v3);
	return P(v,u);
}

int main(){
	cin>>N;
	rep(i,N){
		cin>>a[i];
		a[i]--;
		ia[a[i]] = i;
	}

	rep(t,2){
		vector<D> vs;
		rep(i,N) vs.pb(D(a[i]));
		rep(i,N/2) vs[i*2+(t^1)] = D::e();
		seg[t] = segtree_simple<D>(vs);
	}

	P b = solve(0,N);
	priority_queue<P,vector<P>,greater<P>> que;
	que.push(b);
	while(!que.empty()){
		P p = que.top();que.pop();
		if(p.fs==1e9) break;
		cout<<p.fs+1<<" "<<p.sc+1<<" ";
		for(P q:nxt[p]) que.push(q);
	}
	puts("");
}


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

using namespace std;

#define MAX_H 60
#define MAX_W 60
#define INF 1e9

int H,W,N,ix,iy,ox,oy;
bool wall[MAX_H][MAX_W][4],a[MAX_H][MAX_W][4];
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};

struct P{
  int x,y;
  P(int x,int y) : x(x),y(y) {}
};

inline bool inField(int x,int y){
  return (0 <= x && x < W && 0 <= y && y < H);
}

int bfs(){
  int d[MAX_H][MAX_W];
  for(int i = 0 ; i < H ; i++){
    for(int j = 0 ; j < W ; j++){
      d[i][j] = INF;
    }
  }
  d[iy][ix] = 0;
  queue<P> Q;
  Q.push(P(ix,iy));
  queue<int> step;
  step.push(0);

  while(!Q.empty()){
    P p = Q.front(); Q.pop();
    int s = step.front(); step.pop();
    int x = p.x, y = p.y;
    if(x == ox && y == oy){ return d[oy][ox]; }
    for(int i = 0 ; i < 4 ; i++){
      int nx = x + dx[i], ny = y + dy[i];
      if(wall[y][x][i]){ continue; }
      if(!inField(nx,ny)){ continue; }
      if(d[y][x]+1 < d[ny][nx]){
	d[ny][nx] = d[y][x]+1;
	Q.push(P(nx,ny));
	step.push(s+1);
      }
    }
  }
  return -1;
}

int main(){
  cin >> W >> H >> N;
  for(int i = 0 ; i < N ; i++){
    int sx,sy,dx,dy;
    cin >> sx >> sy >> dx >> dy;
    if(sx > dx){ swap(sx,dx); }
    if(sy > dy){ swap(sy,dy); }
    bool t = false,y = false;
    if(sx != dx){ y = true; }
    if(sy != dy){ t = true; }
    if(y){
      for(int j = sx ; j < dx ; j++){
	for(int k = sy ; k <= dy ; k++){
	  if(k-1 >= 0){
	    wall[k-1][j][3] = true;
	    a[k-1][j][3] = true;
	  }
	  wall[k][j][1] = true;
	  a[k][j][1] = true;
	}
      }
    }
    if(t){
      for(int j = sx ; j <= dx ; j++){
	for(int k = sy ; k < dy ; k++){
	  if(j-1 >= 0){
	    wall[k][j-1][2] = true;
	    a[k][j-1][2] = true;
	  }
	  wall[k][j][0] = true;
	  a[k][j][0] = true;
	}
      }
    }
  }
  int res = 0;
  cin >> ix >> iy >> ox >> oy;
  int dist = bfs();
  for(int x = 0 ; x <= W+1 ; x++){
    for(int y = 0 ; y <= H+1 ; y++){
      int xx = x-1,yy = y;
      if(xx >= 0){ wall[yy][xx][2] = wall[y][x][0] = true; }
      res = max(res,bfs()-dist);
      if(xx >= 0){
	wall[yy][xx][2] = a[yy][xx][2];
	wall[y][x][0] = a[y][x][0];
      }
    }
  }
  for(int x = 0 ; x <= W+1 ; x++){
    for(int y = 0 ; y <= H+1 ; y++){
      int xx = x,yy = y-1;
      if(yy >= 0){ wall[yy][xx][3] = wall[y][x][1] = true; }
      res = max(res,bfs()-dist);
      if(yy >= 0){
	wall[yy][xx][3] = a[yy][xx][3];
	wall[y][x][1] = a[y][x][1];
      }
    }
  }
  cout << res << endl;
  return 0;
}

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

#define int long long

using namespace std;

#ifdef LOCAL 
#include "/media/brayand/BrayanD/debugger.h"
#else
template<typename T, typename... Args>
void db(T &data, Args... args){}
#endif

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

    int N;
    cin >> N;

    string cad;
 	cin >> cad;

 	int tot1 = 0, tot2 = 0;

 	for(int i = 0 ; i < N ; i++)
 	{
 		if(cad[i] == 'R')tot1++;
 		else tot2++;
 	}

 	int res = min(tot1,tot2);
 
 	int c1 = 0, c2 = 0;

 	for(int i = 0 ; i < N-1 ; i++)
 	{
 		if(cad[i] == 'R')c1++;
 		else c2++;

 		int t1 = tot1 - c1;
 		int t2 = tot2 - c2;

 		int m = min(c2,t1);

 		res = min(res,m + (c2-m) + (t1-m));
 	}

 	cout << res << '\n';

    return 0;
}

Measured memory_bytes: 3776