akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    
    int n;
    cin >> n;
    
    vector<int> a(n, 0);
    
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
    }
    
    sort(a.begin(), a.end());
    
    bool f = 1;
    
    int alice = 0;
    int bob = 0;
    
    for (int i = n - 1; i >= 0; --i)
    {
        if (f)
        {
            alice += a[i];
            f = 0;
        }
        else
        {
            bob += a[i];
            f = 1;
        }
    }
    
    cout << alice - bob << endl;
    
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <functional>
#include <cstring>
#include <array>
#include <vector>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
#include <complex>
#include <bitset>
#define full(c) c.begin(), c.end()
#define vector2d(name,type,h,w,init) vector<vector<type>> name(h,vector<type>(w,init)) 
const int PRIME = 1000000007;
const int INF = (int) 1e9;
const int INT_INF = 2147483647;
const long long int LL_INF = 9223372036854775807;
const double PI = acos(-1);
const double EPS = 0.0001;
typedef unsigned long long int ull;
typedef long long int ll;
using namespace std;

int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);
	const int TOP = 100000;
	int n;
	cin >> n;
	vector<bool> can(TOP, false);
	can[0] = true;
	for (int k = 0; k < n; k++) {
		int a;
		cin >> a;
		for (int i = TOP; i >= a; i--) {
			if (can[i - a]) can[i] = true;
		}
	}
	for (int i = TOP; i >= 0; i--) {
		if (i == 0) {
			cout << 0 << endl;
			break;
		}
		if (i % 10 != 0 && can[i]) {
			cout << i << endl;
			break;
		}
	}
	return 0;
}


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

namespace ProoblemE
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            var height = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var memodiff = new Dictionary<long, long>();
            var memosum = new Dictionary<long, long>();

            long ans = 0;
            for(int i = 0; i < N; i++)
            {

                if (memosum.ContainsKey(height[i] + i + 1))
                {
                    memosum[height[i] + i + 1]++;
                }
                else
                {
                    memosum.Add(height[i] + i + 1, 1);
                }
                if(memosum.ContainsKey((i + 1) - height[i]))
                ans += memosum[(i + 1) - height[i]];
            }

            Console.WriteLine(ans);
        }
    }
}


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


#define endl "\n"

#define rks ios_base::sync_with_stdio(false); cin.tie(NULL);





int main (){

int x;cin>>x;
while(true){

if(x>=1000){
    x = x-1000;
if(x==0){
    cout<<x<<endl;
    break;
}
}else{
x = 1000-x;
cout<<x<<endl;
break;
}
}
}












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

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

  int ans=0;
  for (int i=0; i<=a; i++) {
    for (int j=0; j<=b; j++) {
      for (int k=0; k<=c; k++) {
	if (500*i+100*j+50*k == x) ans++;
      }
    }
  }

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

Measured memory_bytes: 256
#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, M;

int main() {
  cin >> N >> M;
  if (M >= 2 * N) {
    ll rest = M - 2 * N;
    cout << N + rest / 4;
    return 0;
  }

  cout << M / 2;
}


Measured memory_bytes: 3680
#include <stdio.h>

//int judge(int * ,int );

int main(){

  int i,j,m,n;
  int a[100005],b[50005];
  int le,mid,ri,key=0;
  int cnt=0,flag=0;
  int num,tmp;

   


  
  scanf("%d",&m);
  for(i=0;i<m;i++){
    scanf("%d",&a[i]);
  }

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&b[i]);
  }


  /*
 
  for(i=0;i<m;i++){
 
      for(j=m-1;j >= i+1;j--){     
	if(a[j-1] > a[j]){
	  tmp = a[j-1];
	  a[j-1]=a[j];
	  a[j]=tmp;
	
	}
      }
  
    }
  */
  
  for(j=0;j<n;j++){
    le=0;
    ri=m;
    key =b[j];

    //   printf("あああ\n");
    while(le < ri ){
      mid=(le+ri)/2;
      
      if(key == a[mid]){
        cnt++;
	//	printf("あああhoge\n");
	break;
      }
      
      if(key > a[mid]){
        le  = mid+1;
	//	printf("いいいhoge\n");
	continue;
      }

      if(key < a[mid]){
        ri = mid;
	//  printf("うううhoge\n");
	continue;
      }
      mid=(le+ri)/2; 
    }
    
  }

  printf("%d\n",cnt);


  
  return 0;
}



Measured memory_bytes: 2308
import scala.math.BigInt

object Main extends App {
  
  val sc = new java.util.Scanner(System.in)
  val a, b, c, k = BigInt(sc.nextLong())
  val max = BigInt(1000000000000000000L)
  val ret = a - b
  if (ret > max) {
    println("Unfair")
  } else if (k % 2 == 0) {
    println(ret)    
  } else {
    println(-ret)
  }

}

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

int main() {
  int N, M, P, Q;
  cin >> N;
  int sum = 0;
  M = 100000000;
  P = N;
  
  for(int i=8; i >= 0;i--){
    Q = P % M;
    P /= M; 
    sum += P;
    P = Q;
    M /= 10;
  }
  if(N%sum == 0 )
    cout << "Yes" << endl;
  else
    cout << "No" << endl; 
}  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;
 
int main() {
  int n, ans=0, c;
  cin >> n;
  c = n;
  while(n > 0) {
    ans += n % 10;
    n -= n%10;
    n /= 10;
  }
  if(c % ans == 0) cout << "Yes";
  else cout << "No";
}


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

int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  int N;
  cin>>N;
  int X[N],Y[N];
  for (int i=0; i<N; i++) {
    cin>>X[i];
    Y[i]=X[i];
  }
  sort(Y,Y+N);
  for (int i=0; i<N; i++) {
    cout<<(X[i]<Y[N/2]?Y[N/2]:Y[N/2-1])<<endl;
  }
  return 0;
}

Measured memory_bytes: 3712
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
  int n;
  vector<int> a;
  vector<int> b;
  vector<int> c;
  cin >> n;
    for(int i=0;i<n;i++)
  {
      int p;
      cin >> p;
      a.push_back(p);
    }
    for(int i=0;i<n;i++)
  {
      int p;
      cin >> p;
      b.push_back(p);
    }
      for(int i=0;i<n-1;i++)
  {
      int p;
      cin >> p;
      c.push_back(p);
    }
  
  int ret =0;
  int last =-1;

  for(int i=0;i<n;i++)
  {
    int d = a[i];
    ret +=b[d-1];
    
    if(last+1==d)
    {
      ret+=c[last-1];
    }
    
    last = d;
  }
  cout << ret;
	return 0;
}

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

int main() {
  int n, k, flag=0;
  cin>>n;
  int a[n];
  rep(i,n){
    cin>>k;
    a[i]=k;
  }
  for(int i=1; i<n-1; i++){
    if((a[i]-a[i+1])*(a[i]-a[i-1])<0)
      flag++;
  }
  cout<<flag<<endl;
  
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
int main(void){
    int n;
    long maxv, buy, sell;
    
    scanf("%d", &n);
    scanf("%ld", &buy);
    for (int i = 1; i < n; i++){
        scanf("%ld", &sell);
        if (i == 1) maxv = sell - buy;
        else maxv = max(maxv, sell - buy);
        buy = min(buy, sell);
    }
    printf("%d\n", maxv);
    return 0;
}

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

using namespace std;
using ll = long long;
#define int ll
using PII = pair<int, int>;
template <typename T> using V = vector<T>;
template <typename T> using VV = vector<V<T>>;
template <typename T> using VVV = vector<VV<T>>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll INF = (1LL<<60);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

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

  int n, m;
  cin >> n >> m;
  V<int> a(m), b(m);
  map<PII, int> mp;
  REP(i, m) cin >> a[i] >> b[i], mp[{a[i], b[i]}]++;

  V<int> x(n+1, m);
  x[0] = x[1] = 0;
  for(auto i: mp) {
    PII p = i.first; int cnt = i.second;
    for(int j=p.second-p.first; j<=n; j+=p.second) {
      x[j] -= cnt*(p.second);
    }
    // cout << i << " " << x << endl;
  }

  x[1] = 0;
  REP(i, m) {
    x[1] += (a[i]+1) % b[i];
  }

  FOR(i, 1, n+1) x[i] += x[i-1];
  FOR(i, 1, n+1) cout << x[i] << endl;

  return 0;
}



Measured memory_bytes: 11272
n, m = list(map(int, input().split(' ')))

bads = {}
for i in range(m):
    bads[int(input())] = None

dp = [1]
if 1 not in bads:
    dp.append(1)
else:
    dp.append(0)
for i in range(2, n+1):
    dp.append(0)
    if i-1 not in bads:
        dp[i] += dp[i-1]
    if i-2 not in bads:
        dp[i] += dp[i-2]
    dp[i] %= 1000000007

print(dp[-1])


Measured memory_bytes: 59992
/*The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/

//PRABHJOT SINGH A.K.A. PRABHI
//~~~~~conquizztador~~~~~


#include<bits/stdc++.h>
using namespace std;
using lli = long long int;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
const int MOD = 1000000007;
const int MOD1 = 998244353;
const int maxn = 100010;
const int lim = (int)1e9;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n=0;lli res=0ll;
	cin>>n;
	auto GET=[&](int m)
	{
		return 1ll*m*(m+1)/2;
	};
	for(int i=1;i<=n;++i)
	{
		int d=n/i;
		res+=1ll*i*GET(d);
	}
	cout<<res<<endl;
}

Measured memory_bytes: 3648
#include<cstdio>
typedef long long LL;

LL n,x;

LL Gcd(LL a,LL b) {
	if(b==0)
		return -a;
	else
		return Gcd(b,a%b)+(a/b)*2*b;
}
int main() {
	scanf("%lld %lld",&n,&x);
	printf("%lld\n",Gcd(n-x,x)+n);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define sz(x) (int)x.size()
#define int long long
typedef pair<int,int>pii;
const int mxN=105,mxM=1e5+5,M=1e9+7;
int mod(int a){int ret=a%M;if(ret<0)ret+=M;return ret;}
int n,m,v[mxN];
int dp[mxN][mxM];

//did u check when n=1?
//is mxN correct?
int solve(int i,int res){
    if(res==0)return 1;
    if(i==n)return 0;
    int ans=0;
    for(int j=0;j<=min(v[i],res);j++){
        ans+=solve(i+1,res-j);
    }
    return dp[i][res]=ans;
}
int32_t main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>m;
    for(int i=0;i<n;i++)cin>>v[i];
    //solve(0,m);
    for(int i=n-1;i>=0;i--){
        for(int j=m;j>=0;j--){
            if(i==n-1){
                if(j<=v[i])dp[i][j]=1;
            }
            dp[i][j]=mod(dp[i][j]+(dp[i+1][j-min(j,v[i])]-dp[i+1][j+1])); 
            dp[i][j]=mod(dp[i][j]+dp[i][j+1]);
            
        }
    }
    cout<<mod(dp[0][m]);

}

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

#define ll long long int
#define inv(name,Type,size) vector<Type> name(size);for(int index=0;index<size;index++) cin>>name[index];
#define F(a,n,i) for(int i=a;i<n;i++)
#define FLL(a,n,i) for(long long int i=a;i<n;i++)
#define pb push_back
#define endl "\n"
#define mod 1000000007
#define modpro 99824435
#define all(x) (x).begin(),(x).end()
const int d8i[8]={-1,0,1,0,-1,1,1,-1},d8j[8]={0,1,0,-1,1,1,-1,-1};


void solve(){
	int n;
	cin>>n;
	cout<< (n>=30?"Yes":"No");
}

int main()
{
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  
  //int t;cin>>t;while(t--) solve(),cout<<endl;
  solve();
}



Measured memory_bytes: 3648
#include <stdio.h>

#define MAX 101

int main()
{
	int x = 0, y = 0;
	int i, j, flag;
	char c_str[MAX][MAX] = {};
	
	while ( scanf( "%d %d", &y, &x ) == 2 ) {
		if ( x == 0 && y == 0 ) { break; }
		for ( i = 0 ; i < y ; i++ ) {
			scanf( "%s", c_str[i] );
		}
		
		i = 0; j = 0; flag = 0;
		while ( flag == 0 ) {
			if ( c_str[i][j] == '>' ) {
				c_str[i][j] = 1;
				j++;
			} else if ( c_str[i][j] == '<' ) {
				c_str[i][j] = 1;
				j--;
			} else if ( c_str[i][j] == '^' ) {
				c_str[i][j] = 1;
				i--;
			} else if ( c_str[i][j] == 'v' ) {
				c_str[i][j] = 1;
				i++;
			} else if ( c_str[i][j] == '.' ) {
				flag = 1;
			} else if ( c_str[i][j] == 1 ) {
				flag = 2;
			}
		}

		if ( flag == 1 ) {
			printf( "%d %d\n", j, i );
		} else if ( flag == 2 ) {
			printf( "LOOP\n" );
		}
	}
	return 0;
}



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

int main() {
	int n;
	while (scanf("%d", &n), n) {
		int m; scanf("%d", &m);
		string s; cin >> s;
		int ans = 0;
		char want = 'I';
		int cnt = 0;
		rep(i, m) {
			if (s[i] == want) {
				cnt++;
				if (s[i] == 'I')want = 'O';
				else want = 'I';
			}
			else {
				if (cnt > 2 * n)ans += (cnt - 2 * n + 1) / 2;
				want = 'I'; cnt = 0;
				if (s[i] == 'I')i--;
			}
		}
		if (cnt > 2 * n)ans += (cnt - 2 * n + 1) / 2;
		cout << ans << endl;
	}
	return 0;
}

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

#define fr first
#define sc second
#define mk make_pair
#define pb push_back

using namespace std;

typedef long long ll;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;
typedef vector <ll> vll;
typedef vector <int> vii;
typedef vector <pll> vpll;
typedef vector <pii> vpii;
const int N = 1e5 + 5;
const int inf = 1e9 + 7;

int a[N];

void solve() {
	int n, q;
	ll sum = 0;
	cin >> n;
	for (int i = 1; i <= n; i ++) {
		int num;
		cin >> num;
		a[num] ++;
		sum += num;
	} 
	cin >> q;
	for (int i = 1; i <= q; i ++) {
		int num1, num2;
		cin >> num1 >> num2;
		sum -= a[num1] * 1ll * num1;
		sum += a[num1] * 1ll * num2;
		a[num2] += a[num1];
		a[num1] = 0;
		cout << sum << endl;
	}
}

int main() {
	ios::sync_with_stdio(0);
	int tests = 1;
//	cin >> tests;
	while (tests --)
		solve();
	return 0;
}









Measured memory_bytes: 4028
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <cassert>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
#define pi 3.141592653589793
using namespace std;
int saidaikouyakusuu(int a,int b){
    if(b==0) return a;
    return saidaikouyakusuu(b,a%b);
}
int saisyoukoubaisuu(int a,int b){
    return a*b/saidaikouyakusuu(a,b);
}
int n,m,cnt=0,aa[220000],ans=0;
pair<int,int> pp[220000];
string s,sa[220000],sb[220000];
char c;
queue<int> que;
signed main(){
    cin>>n;
    rep(i,n){
        cin>>sa[i];
    }
    cin>>m;
    rep(i,m){
        cin>>sb[i];
    }
    rep(i,n){
        cnt=0;
        rep(j,n){
            if(sa[i]==sa[j]){
                cnt++;
            }
        }
        rep(j,m){
            if(sa[i]==sb[j]){
                cnt--;
            }
        }
        ans=max(ans,cnt);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 17332
/*author : Yashvardhan
Saturday, January 12, 2019
*/
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

#define int ll
#define pb push_back
#define vi vector<int>
#define pi pair<int,int>
#define vpi vector<pi>
#define ff first
#define ss second

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("O2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS

#ifdef __APPLE__
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << "  ";
	__f(comma + 1, args...);}
#else
#define debug(...)
#endif

template <typename T> ostream& operator << (ostream& os,const vector<T>& v){for(int i=0;i<v.size();++i) os<<v[i]<<" ";return os;} 
template <typename T> ostream& operator << (ostream& os,const set<T>& v){for(auto it:v) os<<it<<" ";return os;} 
template <typename T, typename S> ostream& operator << (ostream& os, const pair<T,S>& v) {os<<v.ff<<" "<<v.ss;return os;}

const int mod = 1e9 + 7;
const int inf = 2e18;
const int ninf = -2e18;

int dp[101][100005];
int wi[101];
int vs[101];

int pow(int a, int b, int m)
{
	int ans = 1;
	while (b)
	{
		if (b & 1)
			ans = (ans * a) % m;
		b /= 2;
		a = (a * a) % m;
	}
	return ans;
}

int solve(int n,int w){
	if(dp[n][w] != -1) return dp[n][w];
	if(w == 0 || n == 0) return dp[n][w] = 0;
	if(wi[n] > w) return dp[n][w] = solve(n-1,w);
	else return dp[n][w] = max(solve(n-1,w),vs[n]+solve(n-1,w-wi[n]));
}

signed main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef __APPLE__
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		freopen("error.txt","w",stderr);
	#endif

	time_t t1, t2;
	t1 = clock();
	
	int n,w1;
	cin>>n>>w1;

	for(int i = 1; i <= n ; i++){
		int w,v;
		cin>>w>>v;
		wi[i] = w; vs[i] = v;
	}
	
	for(int i = 0; i < 101 ; i++){
		for(int j = 0;j<=100000;j++){
			dp[i][j] = -1;
		}
	}

	cout<<solve(n,w1)<<endl;
	t2 = clock();
	cerr<<endl<<t2-t1<<endl;
	
	return 0;
}



Measured memory_bytes: 79232
#include <bits/stdc++.h>
        using namespace std;
        #define int long long int
        #define pb push_back
        #define mk make_pair
        #define ft first
        #define sc second
        #define ppb pop_back
        #define sz size
        #define forn(i,a,n) for(i=a;i<n;i++)
        #define M 998244353 
        #define inf 2e18

        bool compare(pair<int,int> a,pair<int,int> b){
            if(a.first==b.first)
                return a.second<b.second;
            return a.first<b.first;
        }

        signed main() {
 
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        
        map<int,int> m;
        int n,k,d;
        cin>>n>>k;
        while(k--){
            cin>>d;
            int a;
            for(int i=0;i<d;i++){
                cin>>a;
                m[a]=1;
            }
        }
        int ans=0;
        for(int i=1;i<=n;i++){
            if(m[i]==0)ans++;

        }
        cout<<ans;
        return 0;
    }

Measured memory_bytes: 3656
#include<stdio.h>
#define N 100000
#define Q 50000
int binarySearch(int);
int n,S[N];
int main()
{
  int q,i,j,count=0,T[Q],key;

  scanf("%d",&n);
  for(i=0;i<=n-1;i++){
    scanf("%d",&S[i]);
}

  scanf("%d",&q);
  for(j=0;j<=q-1;j++){
    scanf("%d",&T[j]);
    if(binarySearch(T[j])==1)
    count++;
}
 
 
 printf("%d\n",count);
 return 0;
}
int binarySearch(int key)
{
  int left=0,right=n,mid;
  while(left<right){
    mid=(left+right)/2;
    if(S[mid]==key){
     return 1;
    }
    else if(key<S[mid]){ 
     right=mid;
    }
    else if(key>S[mid]){
     left=mid+1;
    }
  }
  
return 0;
}

Measured memory_bytes: 1184
#include <vector>
#include <numeric>
#include <functional>
#include <iostream>
using namespace std;
int a[30][100100];
int main() {
    int n, k; cin >> n >> k;
    for (int i = 0; i < n; i++) cin >> a[0][i], a[0][i]--;
    for (int e = 1; e < 30; e++)
        for (int i = 0; i < n; i++) a[e][i] = a[e-1][a[e-1][i]];
    int kth[n];
    iota(kth, kth+n, 0);
    for (int e = 29; e >= 0; e--)
        if ((k >> e) & 1)
            for (int i = 0; i < n; i++) kth[i] = a[e][kth[i]];
    if (count(kth, kth+n, 0) == n) {
        cout << "0\n";
        return 0;
    }
    int dist[n];
    fill(dist, dist+n, -1);
    dist[0] = 0;
    function<int(int)> calc_dist = [&](int i) {
        if (dist[i] >= 0) return dist[i];
        else return dist[i] = 1 + calc_dist(a[0][i]);
    };
    for (int i = 1; i < n; i++) {
        calc_dist(i);
    }
    if (all_of(dist, dist+n, [&k](int d) { return d <= k; })) {
        cout << "1\n";
        return 0;
    }

    vector<int> adj[n];
    for (int i = 1; i < n; i++) adj[a[0][i]].push_back(i);
    pair<int, int> dp[n];
    int ans = a[0][0] == 0 ? 0 : 1;
    function<int(int)> dfs = [&](int i) {
        int height = 1;
        for (int j : adj[i]) height = max(height, 1 + dfs(j));
       if (height == k && i != 0 && a[0][i] != 0) { ans++; return 0; }
        else return height;
    };
    dfs(0);
    cout << ans << endl;
}


Measured memory_bytes: 31760
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,num=1;
ll ans=0,dp[200009][93];
int main()
{
    scanf("%d",&n);
    map<pair<int,int>,int>ma;
    for(int i=1; i<=9; i++)
        for(int j=0; j<=9; j++)
            ma[make_pair(i,j)]=num++;
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=90; j++)
            dp[i][j]=dp[i-1][j];
        int tmp=i,p;
        while(tmp)
        {
            p=tmp%10;
            tmp/=10;
        }
        dp[i][ma[make_pair(p,i%10)]]++;
    }
    for(int i=1;i<=n;i++)
    {
        int tmp=i,p;
        while(tmp)
        {
            p=tmp%10;
            tmp/=10;
        }
        ans+=dp[n][ma[make_pair(i%10,p)]];
        //printf("dp=%lld\n",dp[n][ma[make_pair(p,i%10)]]);
        //printf("%d %d\n",p,i%10);
    }
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 145536
//shara's here
//私は大きな男の子
//SPEEEEEEEEEED IS KEEEEEEEEEEY
#include <bits/stdc++.h>
using namespace std;
//fold
typedef double w;
typedef string s;
typedef long long ll;
typedef long double ld;
const ll INF = 1e18 + 10;
const ll MINF = -(1e18 + 10);
#if defined(BANYANYA)
#include "/home/xsharawi/Desktop/cpp/debug.hpp"
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define pb push_back
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
//endfold
int main(){
	s ss;
	cin>>ss;
	ll n=(ll)(ss.size());
	for(ll i=0;i<n;i++){
		ss[i]='x';
		}
		cout<<ss<<endl;























return 0;}
/*
███████████████████████████████████████████████████
███████████████████████████████████████████████████
██████████████████████████████████▀████████████████
██████████████████████████████████░▀███████████████
██████████████████████████████▌███░░░▀▀████████████
██▀████████████████████▐██████░▐██░░░░░░▀▀█████████
██░████████████████████▐█████▌░██▌▄░░░░▄▄░▄████▀███
█▌░███████████████████▀░█████░░░█░░░▄████░░███▀▐███
█▌░▐██████████████████░░████▌░░░▀░░▀███▀▀░▐███▄████
██░▀██████████████▌▐█▐▄▄████▌░░░░░░░░░░░░░▌████████
███░███████████████▀░▄▄██▀█▐░░░░░░░░░░░░░░▐████████
███▄░██████████████▄░░░░░░▀▀▀░░░░░░░░░░░░░█▐███████
████▄░██████████████████▄▄▄▄▄▄▐▄░░░░░░░░░░░████████
█████▄█████████████████▀▀▀▀▀▀░░░░░░░░░░░░░░████████
████████████████████████▄░░░░░░░░░░░░░░░▄░░████████
██████████████████████████▄▄▄░░░░░░░░░▄█░▄█████████
████████████████████████████████▄░░░░██▄███▀░░▀████
█████████████████████████████▀█████▄███▀▀▀░░▄▄░████
████████████████████████████▀░░▀░░▀▀░░░░▄▄▄██▀░░▀▀█
███████████████████████████▌░░░░░░░░░░░███████░░░▄█
███████████████▄░▀████████▀░░░░░░▀░░░░███████▌░░░██
███▄▄████████████▄░▀██████▄░░░░░█░░░░████████░░░▀▀
░▀█████████████████▄░▀█████░░░░██░░░░▀██████░░░░░▄█
▐█▄▀█████████████████▄░▀████░░░██▌░░░▐████▀░░░░▄███
▐███▄▀▀█████████████████▄░▀▀░░░░▀██▌▄█▀▀░░░▄▄██████
▀▀▀▀▀░░░▀▀▀▀▀░░░▀▀▀▀▀▀▀▀▀▀▀░░░░░░░▀▀░░░░░░▀▀▀▀▀▀▀▀▀
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define INF 1e9
#define all(v) v.begin(), v.end()
typedef long long ll;

bool G[10][10];

int main(){
  int n, m; cin >> n >> m;
  rep(i, m){
    int a, b; cin >> a >> b;
    a--, b--;
    G[a][b] = true;
    G[b][a] = true;
  }

  vector<int> ord(n);
  rep(i, n) ord[i] = i;

  int res = 0;
  do{
    if(ord[0] != 0) break;
    bool ok = true;
    rep(i, n-1){
      if(!G[ord[i]][ord[i+1]]){
        ok = false;
        break;
      }
    }
    if(ok) res++;
  }while(next_permutation(all(ord)));

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
n = int(input())

a = str(n)
result = 0

if len(a) == 1:
    result += n
else:
    result += 9
    i = 3
    while i <= len(a)-1:
        result += 10**i - 10**(i-1)
        i += 2
    if len(a)%2 == 1:
        result += n - 10**(len(a)-1)+1
print(result)

Measured memory_bytes: 3060
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include<memory>
#include<cmath>
#include<stack>
#include<tuple>
#include<numeric>
#include<cassert>

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define pb push_back
#define DEBUG false

using namespace std;

using ll = long long;
using P = pair<int,int>;

const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll LINF=1LL<<60;
const int MAX_N = 200005;
const ll lmod = 1e9+7;

int dp[1<<26];
int a[MAX_N]; //[0,i)のハッシュ値
int C = 26;
string S;

int main(){
  cin >> S ;
  int N = S.size();
  rep(i,N){
    int b = S[i] - 'a';
    a[i+1] = a[i] ^ (1<<b);
  }
  fill(dp,dp+(1<<26),INF);
  dp[0] = 0;
  REP(i,1,N+1){
    rep(j,C){
      int bit = 1<<j;
      dp[a[i]] = min(dp[a[i]],dp[a[i]^bit]+1);
    }
  }
  cout << max(1,dp[a[N]]) << endl;
  return 0;
}


Measured memory_bytes: 263556
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define each(a,x) for(auto a : (x))
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) ((a) = min((a),(b)))
#define chmax(a,b) ((a) = max((a),(b)))
#define in_range(x,l,r) ((l)<=(x) && (x)<(r))
#define fs first
#define sc second
#define pb push_back
#define sz size() 
#define MP make_pair
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
 
const static int INF = 1e8;
const static D EPS = 1e-8;
 
int integer(int &ia, const string &a){
  int ans = 0;
  while(isdigit(a[ia])){
    ans = ans*10 + (a[ia++]-'0');
  }
  return ans;
}
 
void merge(int &ia, int &ib, const string &a, const string &b){
  cout << "[";
  ia++; ib++;
 
  //cerr << a.substr(ia) << " " << b.substr(ib) << endl;
  int A = integer(ia,a);
  int B = integer(ib,b);
  //cerr << A << " " << B << endl;
  cout << A+B;
 
  cout << "]";
  ia++; ib++;
}
 
void inc(int &ia, const string &a){
  int k = 1;
  while(k){
    if(a[ia] == '(') k++;
    if(a[ia] == ')') k--;
    ia++;
  }
}
 
void rec(int &ia, int &ib, const string &a, const string &b){
  cout << "(";
  ia++; ib++;
  if(a[ia] == '(' && b[ib] == '('){
    rec(ia,ib,a,b);
    ia++; ib++;
  }else{
    inc(ia,a); inc(ib,b);    
  }
  cout << ")";
 
  merge(ia,ib,a,b);
 
  cout << "(";
  ia++; ib++;
  if(a[ia] == '(' && b[ib] == '('){
    rec(ia,ib,a,b);
    ia++; ib++;
  }else{
    inc(ia,a); inc(ib,b);    
  }
  cout << ")";
}
 
int main(){
  string a,b;
  cin >> a >> b;
  int ia = 0, ib = 0;
  rec(ia,ib,a,b);
  cout << endl;
}

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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n, m;
	cin>>n>>m;
	vector<int> a(m);
	for(auto &x : a){
		cin>>x;
	}
	sort(a.begin(), a.end());
	if(n >= m){
		cout<<0<<endl;
		exit(0);
	}
	int ans = a.back() - a[0];
	for(int i = 1; i < m; i++){
		a[i - 1] = a[i] - a[i - 1];
	}
	a.pop_back();
	sort(a.rbegin(), a.rend());
	for(int i = 0; i + 1 < n; i++){
		ans -= a[i];
	}
	cout<<ans<<endl;


	return 0;
}

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

using namespace std;
typedef long long ll;

map<vector<int>, ll> mp;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    vector<int> cnt(26);
    for (auto x : s) {
      cnt[x - 'a']++;
    }
    mp[cnt]++;
  }
  ll answer = 0;
  for (auto x : mp) {
   answer += x.second * (x.second - 1) / 2;
  }
  printf("%lld\n", answer);
  return 0;
}


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

const int MOD = 1000000007;
const int INF = 1e9;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

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

//最大公約数 
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

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

int main(){
int N;
cin >> N;
vector<ll>H(N);
REP(i, N) cin >> H.at(i);
bool flag = true;
for(int i = N - 1; i > 0; i--){ 
   if(H.at(i) < H.at(i - 1)) H.at(i - 1)--;
   if(H.at(i) < H.at(i - 1)) {
     flag = false;
     break;
   }

}

if(flag) yes;
else no;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define INF (1LL<<30)

int H, W, K;
vector<vector<bool>> grid;

int greed(int bit) {
  int ans = __builtin_popcountll(bit);
  vector<int> count(H);
  for (int w = 0; w < W; ++w) {
    int c = 0;
    int count1 = 0;
    for (int h = 0; h < H; ++h) {
      if(grid[h][w]) count1++;
      if (h==H-1 || bit & (1<<h)) {
        if(count1 > K) return INF;
        count[c] += count1;
        count1=0;
        if(count[c] > K) {
          fill(count.begin(), count.end(), 0);
          w--;
          ans++;
          break;
        }
        c++;
      }
    }
  }
  return ans;
}


signed main() {
  cin >> H >> W >> K;
  grid.resize(H);
  for(auto &g : grid) g.resize(W);
  for(int h=0; h<H; h++) {
    string line; cin >> line;
    for(int w=0; w<W; w++) grid[h][w] = line[w] == '1';
  }

  int ans = INF;
  for (int bit = 0; bit < (1<<(H-1)); ++bit) {
    ans = min(ans, greed(bit));
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h> 
#include<iostream> 
#include<string.h>
#include<cstring>
#include<string>
#include<math.h>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<queue>
#include<set>
#define cuttime ios::sync_with_stdio(false)
#define swap(x, y) x ^= y, y ^= x, x^= y
#define INF 0x3f3f3f3f
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define dep(i,a,b) for(int i=(a);i>=(b);--i)
#define scan1(x) scanf("%d",&x)
#define scan2(x,y) scanf("%d%d",&x,&y)
#define scan3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define scanll1(x) scanf("%lld",&x)
#define scanll2(x,y) scanf("%lld%lld",&x,&y)
#define scanll3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z)
#define lowbit(x) (x&(-x))
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int N=2e5+20;
const int MAX=10000007;
inline int read() {
    char c=getchar();int x=0,f=1;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0',c=getchar();}
    return x*f;
}

inline void out(int x) {   
	if(x>9) out(x/10);   
	putchar(x%10+'0'); 
} 
char s[20];
int main(){
	cin>>s+1;
	int len=strlen(s+1);
	for(int i=1;i<=len;++i){
		if(s[i]=='7'){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

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

using namespace std;

#define openin freopen("input.txt","r",stdin)
#define openout freopen("output.txt","w",stdout)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long
#define mod 1000000007
#define ff first
#define ss second
#define pb push_back
#define mp make_pair

int main()
{
    fast;
    //openin;
    //openout;

    int n;
cin>>n;
cout<<n*(n+1)/2<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <queue>
#include <cstdio>
using namespace std;

const int INF = 0x3f3f3f3f;
const int MAXN = 5e5 + 5;

template<typename _T>
void read( _T &x )
{
	x = 0;char s = getchar();int f = 1;
	while( s > '9' || s < '0' ){if( s == '-' ) f = -1; s = getchar();}
	while( s >= '0' && s <= '9' ){x = ( x << 3 ) + ( x << 1 ) + ( s - '0' ), s = getchar();}
	x *= f;
}

template<typename _T>
void write( _T x )
{
	if( x < 0 ){ putchar( '-' ); x = ( ~ x ) + 1; }
	if( 9 < x ){ write( x / 10 ); }
	putchar( x % 10 + '0' );
}

template<typename _T>
_T MIN( const _T a, const _T b )
{
	return a < b ? a : b;
}

template<typename _T>
_T MAX( const _T a, const _T b )
{
	return a > b ? a : b;
}

struct edge
{
	int to, nxt;
}Graph[MAXN << 1];

priority_queue<int, vector<int>, greater<int> > q;

int mn[MAXN << 2];

int seq[MAXN], ans[MAXN];
int A[MAXN], P[MAXN], head[MAXN], deg[MAXN];
int N, K, cnt;

void addEdge( const int from, const int to )
{
	Graph[++ cnt].to = to, Graph[cnt].nxt = head[from];
	head[from] = cnt, deg[to] ++;
}

void upt( const int x ) { mn[x] = MIN( mn[x << 1], mn[x << 1 | 1] ); }

void build( const int x, const int l, const int r )
{
	if( l > r ) return ; mn[x] = INF;
	if( l == r ) return ;
	int mid = l + r >> 1;
	build( x << 1, l, mid );
	build( x << 1 | 1, mid + 1, r );
}

void update( const int x, const int l, const int r, const int p, const int v )
{
	if( l == r ) { mn[x] = v; return ; }
	int mid = l + r >> 1;
	if( p <= mid ) update( x << 1, l, mid, p, v );
	else update( x << 1 | 1, mid + 1, r, p, v );
	upt( x );
}

int query( const int x, const int l, const int r, const int segL, const int segR )
{
	if( segL <= l && r <= segR ) return mn[x];
	int mid = l + r >> 1, ret = INF;
	if( segL <= mid ) ret = MIN( ret, query( x << 1, l, mid, segL, segR ) );
	if( mid < segR ) ret = MIN( ret, query( x << 1 | 1, mid + 1, r, segL, segR ) );
	return ret;
}

int query( const int l, const int r ) { return query( 1, 1, N, MAX( 1, l ), MIN( N, r ) ); }

int main()
{
	read( N ), read( K );
	for( int i = 1 ; i <= N ; i ++ ) read( P[i] ), A[P[i]] = i;
	build( 1, 1, N );
	for( int i = N ; i ; i -- )
	{
		int pre = query( A[i] - K + 1, A[i] ),
			nxt = query( A[i], A[i] + K - 1 );
		if( pre < INF ) addEdge( A[i], A[pre] );
		if( nxt < INF ) addEdge( A[i], A[nxt] );  
		update( 1, 1, N, A[i], i );
	}
	for( int i = 1 ; i <= N ; i ++ )
		if( ! deg[i] ) q.push( i );
	int u, v, tot = 0;
	while( ! q.empty() )
	{
		u = seq[++ tot] = q.top(), q.pop();
		for( int i = head[u] ; i ; i = Graph[i].nxt )
			if( ! ( -- deg[v = Graph[i].to] ) )
				q.push( v );
	}
	for( int i = 1 ; i <= N ; i ++ ) ans[seq[i]] = i;
	for( int i = 1 ; i <= N ; i ++ ) write( ans[i] ), putchar( '\n' );
	return 0;
}

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

using namespace std;

const int maxv = 100000;
const long long INF = ( 1 << 31 ) - 1;
long long T[4*maxv + 1];
int a, b, q;
int Q, N;
long long v;

long long update( int ini, int fin, int nd, int x, long long v ){
	

	if( x < ini || x > fin )
		return T[nd];

	if( ini == fin ){
		T[nd] = v;
		return T[nd];
	}
		
	int l = nd << 1;
	int r = l | 1;
	int m = ( ini + fin ) >> 1;

	long long n1 = update( ini, m, l, x, v );
	long long n2 = update( m + 1, fin, r, x, v );
	T[nd] = min(n1, n2);	
	return T[nd];
}

long long query( int ini, int fin, int nd, int s, int t ){
	
	if( s > fin || t < ini )
		return INF;

	if( s <= ini && fin <= t )
		return T[nd];

	int l = nd << 1;
	int r = l | 1;
	int m = ( ini + fin ) >> 1;

	long long n1 = query( ini, m, l, s, t );
	long long n2 = query( m + 1, fin, r, s, t );
	return min(n1, n2);	
}


int main( void ){
	
	//freopen("input.in", "r", stdin);
	scanf("%d%d", &N, &Q);	

	for( int i = 0; i < 4*N; ++i )
		T[i] = INF;

	for( ; Q > 0; --Q ){
		scanf("%d", &q);
		if( !q ){
			int x;
			long long v;
			scanf("%d%lld", &x, &v ),
			update( 0, N - 1, 1, x, v );
		}
		else{
			scanf("%d%d", &a, &b),
			printf("%lld\n", query( 0, N - 1, 1, min( a, b ), max( a, b ) ) );
		}
	}


	return 0;
}

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


using namespace std;
constexpr long long int mod = 1000000007;

int main() {
	long long N, K;
	cin >> N >> K;
	vector<long long>Jump(N);

	for (size_t i = 0; i < N; i++)
	{
		cin >> Jump.at(i);
		Jump.at(i)--;
	}
	vector<long long>Firstcome(N, -1);
	long long now = 0;
	long long loop_beginp = 0;
	long long loop_begin = 0, looping = 0;
	Firstcome.at(0) = 0;
	for (size_t i = 0; i < N; i++)
	{
		long long jump = Jump.at(now);
		if (Firstcome.at(jump) < 0&&Firstcome.at(now)!=K)Firstcome.at(jump) = Firstcome.at(now) + 1;//一回も訪れてなければ初訪問
		else if(Firstcome.at(jump)>=0){ loop_begin = Firstcome.at(jump), loop_beginp=jump, looping = Firstcome.at(now) + 1 - Firstcome.at(jump); break; }
		else if(Firstcome.at(now)==K){ cout << now+1; return 0; }
		now = jump;
	}
	long long ans = loop_beginp;
	for (size_t i = 0; i < abs(K - loop_begin) % looping; i++)
	{
		ans = Jump.at(ans);
	}
	cout << ans + 1;

}

Measured memory_bytes: 6428
#include <stdio.h>
int main(void){
  int a, b, c, d;
  
  scanf("%d %d %d %d",&a, &b, &c, &d);
  
  while(1){
    c-=b;
    if(c <= 0){
      printf("Yes");
      return(0);
    }
    
    a-=d;
    if(a <= 0){
      printf("No");
      return(0);
    }
  }
  
  return 0;
}

Measured memory_bytes: 1708
ROOT = 3
MOD = 998244353
roots  = [pow(ROOT,(MOD-1)>>i,MOD) for i in range(24)] # 1 の 2^i 乗根
iroots = [pow(x,MOD-2,MOD) for x in roots] # 1 の 2^i 乗根の逆元

def untt(a,n):
    for i in range(n):
        m = 1<<(n-i-1)
        for s in range(1<<i):
            w_N = 1
            s *= m*2
            for p in range(m):
                a[s+p], a[s+p+m] = (a[s+p]+a[s+p+m])%MOD, (a[s+p]-a[s+p+m])*w_N%MOD
                w_N = w_N*roots[n-i]%MOD

def iuntt(a,n):
    for i in range(n):
        m = 1<<i
        for s in range(1<<(n-i-1)):
            w_N = 1
            s *= m*2
            for p in range(m):
                a[s+p], a[s+p+m] = (a[s+p]+a[s+p+m]*w_N)%MOD, (a[s+p]-a[s+p+m]*w_N)%MOD
                w_N = w_N*iroots[i+1]%MOD
            
    inv = pow((MOD+1)//2,n,MOD)
    for i in range(1<<n):
        a[i] = a[i]*inv%MOD

def convolution(a,b):
    deg = len(a) + len(b) - 2
    n = deg.bit_length()
    N = 1<<n
    a += [0]*(N-len(a))
    b += [0]*(N-len(b))
    untt(a,n)
    untt(b,n)
    for i in range(N):
      a[i] = a[i]*b[i]%MOD
    iuntt(a,n)
    return a[:deg+1]

n,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = convolution(a,b)
print(*c)

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

#define     ll     long long int

const ll inf = 1e9 + 9;

ll soln(ll a, ll b, ll c)
{
    ll d = b * b - 4 * a * c;
    if (d < 0) {
        return -inf;
    }
    ll x = (-b + sqrt(d)) / (2 * a);
    return x;
}

int main( )
{
    ll x;
    cin >> x;
    ll n = soln(1, 1, -2 * x);
    if (n * n + n - 2 * x == 0) {
        cout << n << '\n';
    }
    else {
        n++;
        cout << n << '\n';
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    // Your code here!
    int M,D,d1,d10,count=0;
    scanf("%d %d",&M,&D);
    
    for(int m = 1; m <= M; m++)
    {
        for(int d = 1; d <= D; d++)
        {
            d10 = d/10;
            d1 = d-d10*10;
            if(d10 < 2 || d1 < 2)
            {
                
            }
            else
            {
                if(d10*d1==m)
                    count++;
            }
        }
    }
    
    printf("%d\n",count);
}


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

#define FOR(i, a, b) for(int(i)=(a);(i)<(b);(i)++)
#define REP(i, n) FOR((i), 0, (n))

#define RFOR(i, b, a) for(int(i)=(b); (i)>=(a); (i)--)
#define RREP(i, n) FOR((i), (n), 0)

#define pb push_back
#define mp make_pair 

using namespace std;

const int INF=INT_MAX/4;
const int MOD=1000000007;
const double EPS=1e-14;

const bool debug_flag=true;

void debug(string str){
	if(debug_flag){
		cout<<str<<endl;
	}
}

void debugs(string str){
	if(debug_flag){
		cout<<str;
	}
}

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout.precision(10);

	long N, A, B;
	cin>>N>>A>>B;
	if(A>B){
		cout<<0<<endl;
	}else if(N==1 && A!=B){
		cout<<0<<endl;
	}else if(N<=2){
		cout<<1<<endl;
	}else{
		cout<<A+(N-1)*B-(B+(N-1)*A)+1<<endl;
	}

	return 0;
}



Measured memory_bytes: 256
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        char[] s = sc.next().toCharArray();
        int ans = 0;
        int tmp = 0;
        for(char c : s){
            if(c == 'R'){
                tmp++;
            }else{
                ans = Math.max(ans,tmp);
                tmp = 0;
            }
        }
        pw.println(Math.max(ans,tmp));
        pw.flush();
    }

    static class GeekInteger {
        public static void save_sort(int[] array) {
            shuffle(array);
            Arrays.sort(array);
        }
 
        public static int[] shuffle(int[] array) {
            int n = array.length;
            Random random = new Random();
            for (int i = 0, j; i < n; i++) {
                j = i + random.nextInt(n - i);
                int randomElement = array[j];
                array[j] = array[i];
                array[i] = randomElement;
            }
            return array;
        }
 
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }
    
    public String[] nextArray(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = next();
        return a;
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


Measured memory_bytes: 25416
S = input()
N = len(S)
flag = True

#print(S[::-1])

if S != S[::-1]:
    flag = False

SS = S[0:(N-1)//2]
if SS != SS[::-1]:
    flag = False

SS = S[(N+3)//2:-1]
if SS != SS[::-1]:
    flag = False

if flag:
    print("Yes")
else:
    print("No")


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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 505;
int n, c, ans;
int a[N][N], d[33][33];
int cost[3][31];

int main() {
    ans = 0x3f3f3f3f;
    cin >> n >> c;
    for (int i = 1; i <= c; ++i) {
        for (int j = 1; j <= c; ++j) {
            cin >> d[i][j];
        }
    }
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            cin >> a[i][j];
        }
    }
    for (int k = 1; k <= c; ++k) {
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < n; ++j) {
                cost[(i + j) % 3][k] += d[a[i][j]][k];
            }
        }
    }
    for (int i = 1; i <= c; ++i) {
        for (int j = 1; j <= c; ++j) {
            for (int k = 1; k <= c; ++k) {
                if (i == j || j == k || i == k) continue;
                ans = min(ans, cost[0][i] + cost[1][j] + cost[2][k]);
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4612
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <cfloat>
#define zero(x) (((x)>0?(x):-(x))<eps)

#define pause cout << " press ansy key to continue...",  cin >> chh
#define file_r(x) freopen(x,  "r",  stdin)
#define file_w(x) freopen(x,  "w",  stdout)
#define lowbit(x) ((x) & (-x))
#define repit(i, c) for (__typeof__((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repe(i, u) for (int i = head[u]; i != -1; i = nxt[i])
#define repd(i, n) for (int i = (n - 1); i >= 0; i--)
#define FOR(i, n, m) for (int i = (n); i <= (m); i++)
#define FORD(i, n, m) for (int i = (n); i >= (m); i--)
#define pb push_back
#define X first
#define Y second
#define ins insert
#define rb rbegin
#define be begin
#define er erase
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define SZ(c) (c).size()
#define ALL(c) (c).begin(), (c).end()
#define sqr(r) ((r) * (r))
#define dis(x1, y1, x2, y2) (((x1) - (x2)) * ((x1) - (x2)) + ((y1) - (y2)) * ((y1) - (y2)))
#define FASTIO ios::sync_with_stdio(false);cin.tie(0)

#define sc(x) cout << #x" = " << x << endl, system("pause")
#define sc2(x, y) cout << #x" = " << x << " " << #y" = " << y << endl, system("pause")
#define sc3(x, y, z) cout << #x" = " << x << " " << #y" = " << y << " " << #z" = " << z << endl, system("pause")
#define sc4(x, y, z, w) cout << #x" = " << x << " " << #y" = " << y << " " << #z" = " << z << " " << #w" = " << w << endl, system("pause")

#define in(n) scanf("%d", &n)
#define in2(n, m) scanf("%d %d", &n, &m)
#define in3(x, y, z) scanf("%d %d %d", &x, &y, &z)

using namespace std;
int chh;

typedef vector<int> vi;
typedef set<int> si;
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<int, pii> pi3;
typedef vector< pair<int, int> > vpii;
typedef long long LL;

const int N = 100005;

int n;
int a[N];
LL sum, tmp;

bool ok() {
    if (sum % tmp) return 0;
    LL d, t = sum / tmp;
    FOR (i, 2, n) {
        d = a[i] - a[i - 1];
        if ((t - d) % n) return 0;
        if (t - d < 0) return 0;
    }
    d = a[1] - a[n];
    if ((t - d) % n) return 0;
    return 1;
}

int main() {
    bool flag;
    while (~in(n)) {
        sum = 0;
        FOR (i, 1, n) {
            in(a[i]);
            sum += a[i];
        }
        tmp = (LL) n * (1 + n) / 2;
        flag = ok();
        puts(flag ? "YES" : "NO");
    }
    return 0;
}


Measured memory_bytes: 640