akhauriyash/Code-Regression huggingface dataset:
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

map<int, int> nmap;

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

	int N;
	int h[110];
	cin >> N;
	rep(i, 0, N)
	{
		cin >> h[i];
	}

	int ans = 0;
	while (true)
	{
		bool flag = false;

		int l = -1, r = 0;
		for (r = 0; r < N; r++)
		{
			if (l == -1 && h[r] > 0)
			{
				l = r;
				flag = true;
			}
			if (l != -1 && h[r] == 0)
			{
				ans++;
				rep(i, l, r)
				{
					h[i]--;
				}
				l = -1;
			}
		}
		if (l != -1 && h[r-1] > 0)
		{
			ans++;
			rep(i, l, r)
			{
				h[i]--;
			}
			l = -1;
		}

		if (!flag)
		{
			break;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	char a,b,c,d,e,f;
	scanf(" %c %c %c",&a,&b,&c);
	scanf(" %c %c %c",&d,&e,&f);
	if(a==f&&c==d&&b==e)
	{
		printf("YES");
	}
	else
		printf("NO");
}

Measured memory_bytes: 256
n, m, s, t = map(int, input().split())
s-=1
t-=1
G = [[] for i in range(n)]
for i in range(m):
    u,v,a,b=map(int,input().split())
    G[u-1].append((v-1,a,b))
    G[v-1].append((u-1,a,b))

V=10**15
ans=[0]*n
from heapq import heappush,heappop
def dijkstra(u,k):
    D=[10**18]*n
    q=[(0,u)]
    D[u]=0
    while q:
        d,u=heappop(q)
        if D[u]<d: continue
        for v ,a ,b in G[u]:
            w=b if k else a
            if d + w < D[v]:
                D[v]=d+w
                heappush(q,(d+w,v))
    return D
D1=dijkstra(s,0)
D2=dijkstra(t,1)
tmp=1e18
for i in reversed(range(n)):
    tmp=min(tmp,D1[i]+D2[i])
    ans[i]=10**15-tmp
print(*ans,sep="\n")



Measured memory_bytes: 110660
#include<bits/stdc++.h>
#define mo 1000000007
using namespace std;
int bc[1<<15],f[1<<15],des[15];
int main()
{
	int n,m,d=1;scanf("%d%d",&n,&m);
	while (m--)
	{
		int u,v;scanf("%d%d",&u,&v);u--;v--;
		des[u]|=(1<<v);d=d*2%mo;
	}
	for (int i=1;i<(1<<n);i++) bc[i]=bc[i>>1]+(i&1);
	f[0]=1;
	for (int s=1;s<(1<<n);s++) if ((s&1)==((s>>1)&1))
	for (int t=s;t;t=(t-1)&s) if ((t&1)==((t>>1)&1))
	{
		int js=1;
		for (int i=0;i<n;i++) if ((1<<i)&s)
		{
			if ((1<<i)&t) js=(long long)js*(1<<bc[des[i]&(s-t)])%mo;
			else js=(long long)js*((1<<bc[des[i]&t])-1)%mo;
		}
		f[s]=(f[s]+(long long)js*f[s-t])%mo;
	}
	printf("%d\n",(d+mo-f[(1<<n)-1])%mo);
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main() {
    string S;cin>>S;
    int size=S.size();
    bool can=true;
    if(S[0]!='A'){
        can= false;
    }
    int count=0;
    int C=0;
    for(int i=2;i<=size-2;i++){
        if(S[i]=='C'){
            C=i;
            count++;
        }
    }
    if(count!=1){
        can=false;
    }
    for(int i=1;i<=size-1;i++){
        if(i!=C){
            if(S[i]<97||122<S[i]){
                can=false;
            }
        }
    }
    if(can){
        cout<<"AC";
    }
    else{
        cout<<"WA";
    }
    return 0;
}

Measured memory_bytes: 256
N = int(input())
a = [int(i) for i in input().split()]

print(' '.join(str(x) for x in a))
for i in range(1,N):
	v = a[i]
	j = i - 1
	while j >= 0 and a[j] > v:
		a[j+1] = a[j]
		j -= 1
	a[j+1] = v
	print(' '.join(str(x) for x in a))

Measured memory_bytes: 7700
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

signed main(){
    
    string s; cin >> s;
    for(int i = 0; i < 3; i++){
        if(s[i] == s[i + 1]){
            cout << "Bad" << endl;
            return 0;
        }
    }

    cout << "Good" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int main(int argc, char *argv[])
{
	int n;
	cin>>n;
	if(n<1200)
		printf("ABC\n");
	else if(n<2800&&n>=1200)
		printf("ARC\n");
	else if(n>=2800)
		printf("AGC\n");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int INF = 987654321;
const int MOD = (int)1e9+7;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
int dy[4] = {-1, 0, 1, 1};
int dx[4] = {0, 1, 0, 1};

int n, m;
vi adj[600];
double dp[600];

double cal(int block) {
	per(i,0,n) {
		if(i == n-1) {
			dp[i] = 0;
			continue;
		}
		double maxi = -1;
		double sum = 0;
		rep(j,0,sz(adj[i])) {
			sum += dp[adj[i][j]];
			if(maxi < dp[adj[i][j]]) {
				maxi = dp[adj[i][j]];
			}
		}

		int cnt = sz(adj[i]);
		if(block == i && sz(adj[i]) > 1) {
			sum -= maxi;
			cnt--;
		}

		dp[i] = (sum/cnt)+1;
	}
	return dp[0];
}

void solve() {
	rep(i,0,600) {
		dp[i] = -1;
	}

	double ret = cal(-1);
	rep(i,0,n) {
		ret = min(ret, cal(i));
	}

	cout << fixed << setprecision(10) << ret << endl;
}

int main(void) {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//freopen("in.txt", "r", stdin);
	cin >> n >> m;
	rep(i,0,m) {
		int s, t;
		cin >> s >> t;
		adj[s-1].pb(t-1);
	}
	solve();
	return 0;
}

Measured memory_bytes: 1408
#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
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=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	string S,T;
	scan(S>>T);
	int ans=0;
	int N=S.size();
	rep(i,N){
		if(S[i]!=T[i]) ans++;
	}
	prin(ans);
	return 0;
}


Measured memory_bytes: 3864
import heapq
n,m = map(int,input().split())
a = [int(x) * -1 for x in input().split()]

a = sorted(a)

for i in range(m):
    off = -1 * heapq.heappop(a) // 2
    heapq.heappush(a,-1*off)

print(-1*sum(a))

Measured memory_bytes: 14180
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass : Scanner
{
    static void Main()
    {
        var (N, M) = ReadTuple<int,int>();
        var xyz = new long[N][];
        for (int i = 0; i < N; i++)
        {
            xyz[i] = RLongs();
        }
        long ans = 0;
        for (int i = 0; i < (1<<3); i++)
        {
            long[] scores = new long[N];
            for (int j = 0; j < N; j++)
            {
                long s = 0;
                for (int k = 0; k < 3; k++)
                {
                    if ((i & (1 << k)) > 0) s += xyz[j][k];
                    else s -= xyz[j][k];
                }
                scores[j] = s;
            }

            Array.Sort(scores);
            long sum = 0;
            for (int j = N - 1; j >= N-M; j--)
            {
                sum += scores[j];
            }
            ans = Math.Max(ans, sum);
        }
        WriteLine(ans);
    }
}



class Scanner
{
    public static string RString() => Console.ReadLine();
    public static int RInt() => ReadTuple<int>();
    public static long RLong() => ReadTuple<long>();
    public static double RDouble() => ReadTuple<double>();

    public static string[] RStrings() => Console.ReadLine().Split();
    public static int[] RInts() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
    public static long[] RLongs() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
    public static double[] RDoubles() => Array.ConvertAll(Console.ReadLine().Split(), double.Parse);
    public static int[] RInts(Func<string, int> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static long[] RLongs(Func<string, long> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static double[] RDoubles(Func<string, double> func) => Console.ReadLine().Split().Select(func).ToArray();
    //public static string[] RStrings(Func<string, string> func) => Console.ReadLine().Split().Select(func).ToArray();

    public static T1 ReadTuple<T1>()
    {
        var r = RString();
        var r1 = (T1)Convert.ChangeType(r, typeof(T1));
        return r1;
    }
    public static (T1, T2) ReadTuple<T1, T2>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        return (r1, r2);
    }
    public static (T1, T2, T3) ReadTuple<T1, T2, T3>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        return (r1, r2, r3);
    }
    public static (T1, T2, T3, T4) ReadTuple<T1, T2, T3, T4>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        var r4 = (T4)Convert.ChangeType(r[3], typeof(T4));
        return (r1, r2, r3, r4);
    }
}


Measured memory_bytes: 27900
#include<bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,i;
  cin>>A>>B;
  int cnt = 0;

  for (i=A;i<=B;i++){
    if(i/10000 == i%10){
      if((i/1000)%10 == (i/10)%10){
        cnt++;
      }
    }
  }
  cout << cnt << endl;
}

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


void fill(int pre, int len, string str){
    
    if (len == 0){
        cout << str << endl;
        return;
    }

    for (int i = 0; i <= pre; i++){
        str.push_back('a'+i); 
        fill(pre, len-1, str);
        str.pop_back();
    }
    
    str.push_back('a'+(pre+1));
    fill(pre+1, len-1, str);
    str.pop_back();

    return;
}


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

    string str="";
    fill(-1, n, str);


    return 0;
}


Measured memory_bytes: 1536
#include <stdio.h>
#include <math.h>

#define PI 3.141592653589

double distance(double x1, double y1, double x2, double y2);

int main(void){
  double a, b, c, s, l, h;

  scanf("%lf%lf%lf", &a, &b, &c);
  h = b * sin(PI * c / 180);
  l = a + b + distance(a, 0, b * cos(PI * c / 180), b * sin(PI * c / 180));
  s = a * h / 2;
  printf("%f\n%f\n%f\n", s, l, h);
  return 0;
}


double distance(double x1, double y1, double x2, double y2){
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1- y2));
}

Measured memory_bytes: 648
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include<queue>
#include<set>
using namespace std;

int main()
{
  int n, h, k = 0, attack = 0, damage = 0;
  cin >> n >> h;
  vector<int> a(n, 0);
  vector<int> b(n, 0);

  for (int i = 0; i < n; i++)
  {
    cin >> a[i];
    cin >> b[i];
  }

  sort(a.begin(), a.end());
  int a_max = a.back();
  int a_min = a.front();

  sort(b.begin(), b.end());
  int b_max = b.back();
  int b_min = b.front();

  for (int i = n - 1; i >= 0; i--)
  {
    if(b[i] > a_max)
    {
      attack++;
      damage += b[i];
      if(damage >= h)
      {
        cout << attack << endl;
        exit(0);
      }
    }
  }

  // cout << "attack:" << attack;
  // cout << " damage:" << damage << endl;

  while (damage < h)
  {
    attack++;
    damage += a_max;
  }

  cout << attack << endl;

}


Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <string>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>

const long long INF = 1000000007;

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int , pii> piii;
typedef pair<pii, pii> piiii;


int idx[22];
int n;
int dp[10000001];
int arr[22][22];
int visit[10000001];

int dd(int x) {
	if (x == 0) return 1;
	if (dp[x]>=0) return dp[x];
	vector<int> v;
	int rt = 0;
	int tmp = x;
	int m = 0;
	int cnt = 0;
	while (tmp > 0) {
		if (tmp % 2) {
			m += tmp % 2;
			v.push_back(cnt);
		}
		cnt++;
		tmp /= 2;
	}
	while (!v.empty()) {
		int cur = v.back();
		v.pop_back();
		if (arr[m][cur + 1]) {
			if (dp[x - idx[cur]]<0) rt = (rt + dd(x - idx[cur])) % INF; 
			else rt = (rt + dp[x - idx[cur]]) % INF;
		}
	}
	dp[x] = rt;
	return rt;
}

int main() {
	scanf("%d", &n);
	int x = 1;
	for (int i = 0; i < n; i++) {
		idx[i] = x;
		x *= 2;
	}
	for (int i = 0; i < x; i++) {
		dp[i] = -1;
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) scanf("%d", &arr[i][j]);
	}
	printf("%d", dd(x-1));
}


Measured memory_bytes: 10496
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
MOD = 1000000007
def POW(x, y): return pow(x, y, MOD)
def INV(x, m=MOD): return pow(x, m - 2, m)
def DIV(x, y, m=MOD): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())

N=II()
inl = [LI() for i in range(N)]
inl.sort(key=lambda x: x[2], reverse=True)

st=set()
prevset=set()
for x,y,h in inl:
    st = set()
    for i in range(101):
        for j in range(101):
            abso = abs(x-i)+abs(y-j)
            if not h == 0:
                st.add((i,j, h+abso))
            else:
                for k in range(1, abso+1):
                    st.add((i,j, k))

    prevset = st if not prevset else st.intersection(prevset)
    if len(prevset) == 1:
        break

print(*prevset.pop())


Measured memory_bytes: 137792
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#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 IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int N, M; 
  cin >> N >> M;

  if(N%2){
    REP(i, M){
      cout << i+1 << " " << N-i << "\n";
    }
  }else{
    REP(i, M){
      if(i < M/2){
        cout << i+1 << " " << N/2-i-1 << "\n";
      }else{
        cout << N/2+i-M/2 << " " << N-(i-M/2)-1 << "\n";
      }
    }
  }

  return 0;
}

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

typedef long long s64;
const int inf=1e9;
s64 s;
int c(s64 x)
{
	int ans=0;
	while(x%2==0){++ans;x/=2;}
	return ans;
}
int f(int a)
{
	int ans=0;
	while((s64)a*3!=s&&a%2==0)
	{
		++ans;
		a=s/2-a/2;
	}
	return a%2?ans:inf;
}

int main()
{
	//freopen("1.in","r",stdin);
	int a,b,c;
	cin>>a>>b>>c;
	s=(s64)a+b+c;
	int ans=min(min(f(a),f(b)),f(c));
	if(ans==inf)puts("-1");
	else cout<<ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int n,x,mn=1e6,m,sum=0,i;
    cin>>n>>x;
    for (i=0;i<n;i++)
    {
        cin>>m;
        sum+=m;
        mn=min(mn,m);
    }
    int ans=n;
    x-=sum;
    ans+=x/mn;
    cout<<ans<<endl;
}

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

using namespace std;
typedef long long ll;

const int mod=1000000007;
const ll oo=1e18;
int dx[8]={1,-1,0,0,1,-1,1,-1};
int dy[8]={0,0,1,-1,1,-1,-1,1};
const int N=102050;
bool srt(pair<int,int>a,pair<int,int>b){
    return a.first!=b.first?a.first>b.first:a.second<b.second;
}

int main(){
    int n;
    cin>>n;
    int mn=1e9;
    for(int i=1;i<=n-1;i++){
        int a=i,b=n-i;
        int s=0;
        //cout<<a<<' '<<b<<' ';
        while(a>0){
            s+=(a%10);
            a/=10;
        }
        while(b>0){
            s+=(b%10);
            b/=10;
        }
        mn=min(mn,s);
    }
    cout<<mn<<endl;
    return 0;
}


Measured memory_bytes: 256
input();a,b1,b2,b4=list(map(int,input().split())),0,0,0
for i in a:
  if i%2!=0: b1+=1
  elif i%4==0: b4+=1
  else: b2+=1
print('Yes'if b1<=b4 else'No'if b2 else'Yes'if b1<=b4+1 else'No')

Measured memory_bytes: 19988
def main():
    N, K = list(map(int, input().split()))
    D = set(map(int, input().split()))
    ok_set = set([i for i in range(0,10)]) - D
    ok_list = list(ok_set)
    # print(ok_list)

    def is_ok(num):
        ans = True
        for si in str(num):
            n = int(si)
            if n not in ok_list:
                ans = False
        return ans

    for ni in range(N, 10 ** 9):
        if is_ok(ni):
            print(ni)
            break



if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll, ll> pii;
const int maxn = 2e5 + 10;
const int INF = 0x3f3f3f3f;
const ll inf = 1e18;
const ll mod = 1000000007;
string s, t;
map<string, int>mp;
int main() {
	cin >> s >> t;
	cin >> mp[s] >> mp[t];
	string u;
	cin >> u;
	mp[u]--;
	cout << mp[s] << ' ' << mp[t] << endl;
	return 0;
};

Measured memory_bytes: 256
import fractions
from functools import reduce

def lcm_2val(x, y):
  return (x * y) // fractions.gcd(x, y)

def lcm(numbers):
  return reduce(lcm_2val, numbers, 1)

N = int(input())
T = []
for _ in range(N):
  T.append(int(input()))

print(lcm(T))

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

using namespace std;

int A,B,C,PAV;

int main() {
    cin>>A>>B>>C;
    PAV=A-B;
    {if(PAV>C)
     cout<<0<<endl;
     else if(PAV<C)
     cout<<C-PAV<<endl;
     else
     cout<<0<<endl;
    }
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
typedef   long long int ll;
typedef unsigned long long int sll;
typedef  double ld;
#define A 1000000007ll
#define B 998244353ll
#define C 1000000000000000000ll
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define oset tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define br break
#define PI 3.14159265358979323

int main() 
{
    FAST;
    ll n,k;
    cin>>n>>k;
    ll a[n+1];
    a[0]=-1;
    for(int i=1;i<=n;i++)
    	cin>>a[i];
    ll c=1,x=0;
    set<ll> s;
    while(k>0)
    {
    	if(s.find(c)!=s.end())
    		break;
    	s.insert(c);
    	c=a[c];
    	k--;
    }
    ve<ll> v;
    s.clear();
    while(s.find(c)==s.end())
    {
    	v.pub(c);
    	s.insert(c);
    	c=a[c];
    	x++;
    }
    cout<<v[(k%x)];
    //cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}

Measured memory_bytes: 14556
import sys
n, m = map(int, input().split())
a_list = sum([input().split() for i in range(n)], [])
b_list = sum([input().split() for i in range(m)], [])
for b in b_list:
    for a in a_list:
        if b not in a:
            print('No')
            sys.exit()
print('Yes')


Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int sx,sy,tx,ty;
    cin >> sx >> sy >> tx >> ty;

    for (int _=sx; _<tx; _++) cout << 'R';
    for (int _=sy; _<ty; _++) cout << 'U';

//    cout << endl;

    cout << 'R';
    for (int _=ty; _>sy-1; _--) cout << 'D';
    for (int _=tx+1; _>sx; _--) cout << 'L';
    cout << 'U';

//    cout << endl;


    for (int _=sy; _<ty; _++) cout << 'U';
    for (int _=sx; _<tx; _++) cout << 'R';

//    cout << endl;


    cout << 'U';
    for (int _=tx; _>sx-1; _--) cout << 'L';
    for (int _=ty; _>sy-1; _--) cout << 'D';
    cout << 'R';
}

Measured memory_bytes: 888
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
#include<cstdio> 
using namespace std;
int main(){
    int a;
    cin>>a;
    if(a<1200)
       cout<<"ABC";
    if(1200<=a&&a<2800)
       cout<<"ARC";
    if(2800<=a)
       cout<<"AGC";
    system("pause");
    return 0;
} 

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

int main() {
  
  int n;
  string s;
  cin >> n >> s;
  string a= "Yes";
  
  for(int i=0; i<n/2; i++){
   
    if(s.at(i) ==s.at(i+n/2)){
      continue;
    }
    else{
      a = "No";
    }
  }
   if(n%2 == 1){
      a = "No";
   }
  
  cout << a << endl;
  
}

Measured memory_bytes: 764
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

vector<vector<int>> G;

// 頂点xを始点としたときの最長経路長
int dp[100005];

int rec(int x) {
  if (dp[x] != -1) {
    return dp[x];
  }
  int ret = 0;
  for (int i = 0; i < (int)G[x].size(); i++) {
    int nx = G[x][i];
    ret = max(ret, rec(nx) + 1);
  }
  return dp[x] = ret;
}

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

  G.assign(n, vector<int>());

  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    G[x - 1].push_back(y - 1);
  }

  for (int i = 0; i < n; i++) {
    dp[i] = -1;
  }

  int ans = 0;
  for (int x = 0; x < n; x++) {
    ans = max(ans, rec(x));
  }
  cout << ans << endl;

  return 0;
}

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

typedef long long ll;

int main(){
    int N;  cin >> N;
    vector<ll> A(N+1), S(N+1);
    A[0] = 0;  S[0] = 0;
    for(int i=1; i<=N; i++){
        cin >> A[i];
        S[i] = S[i-1] + A[i];
    }

    sort(S.begin(), S.end());
    ll ans = 0;
    ll cnt = 0;
    for(int i=0; i<=N; i++){
        cnt++;
        if(i==N || (i<N && S[i+1] != S[i])){
            ans += cnt*(cnt-1)/2;
            cnt = 0;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3328
/*

*/
#include<iostream>
#include<iomanip>
#include<ios>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<string>
#include<algorithm>
#include<utility>
#include<math.h>
#include<cstdlib>
#define rep(i, n) for(int i=0;i<n;i++)
#define repb(i, a, b) for(int i=a;i<b;i++)
#define MAX_N 10000

using namespace std;
typedef pair<int, int> P;
typedef long long int ll;

const int INF = 1<<30;
const ll MOD = ll(1e9+7);

int main(){
  int n, m;cin>>n>>m;
  vector<int> a(n);
  int sum=0;
  rep(i, n){
    cin>>a[i];sum+=a[i];
  }
  sort(a.begin(), a.end(), greater<int>());
  cout<<(a[m-1]*4*m>=sum?"Yes":"No")<<endl;
  // system("read -n 1 -s -p \"Press any key to continue...\"");
}


Measured memory_bytes: 3616
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(){
    int N;
    long long ans=0;
    cin>>N;
    vector<int> A(N);
    vector<int> B(N);
    vector<int> C(N);

    for(int j=0;j<N;j++){cin>>A[j];}
    for(int j=0;j<N;j++){cin>>B[j];}
    for(int j=0;j<N;j++){cin>>C[j];}
    sort(A.begin(),A.end());
    sort(C.begin(),C.end());

    for(int i=0;i<N;i++){
        auto itr_a = lower_bound(A.begin(),A.end(),B[i]);
        auto itr_c = upper_bound(C.begin(),C.end(),B[i]);
        ans += (itr_a-A.begin())*(C.end()-itr_c);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1408
package main

import (
	"fmt"
	"math"
)

func main() {
	var n float64
	fmt.Scan(&n)
	cnt := 0
	for c := float64(n - 1); c >= 1; c-- {
		max := math.Floor(math.Sqrt(n - c))
		for a := float64(1); a <= max; a++ {
			b := (n - c) / a
			if b == math.Floor(b) {
				cnt++
				if a != b {
					cnt++
				}
			}
		}
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 1792
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	x := getNextInt(scanner)
	if x >= 30 {
		fmt.Fprintln(writer, "Yes")
		return
	}
	fmt.Fprintln(writer, "No")
}


Measured memory_bytes: 1812
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

class UnionFind {
private:
    int sz;
    vector<int> par, nrank;
public:
    UnionFind(){}
    UnionFind(int node_size) : sz(node_size), par(sz), nrank(sz, 0){
        iota(par.begin(), par.end(), 0);
    }
    int find(int x){
        if(par[x] == x) return x;
        else return par[x] = find(par[x]);
    }
    void unite(int x,int y){
        x = find(x), y = find(y);
        if(x == y) return;
    	if(nrank[x] < nrank[y]) swap(x,y);
        par[y] = x;
        if(nrank[x] == nrank[y]) nrank[x]++;
    }
    bool same(int x,int y){
        return find(x) == find(y);
    }
};

int main(){
    int n,m,k;
    cin >> n >> m >> k;
    priority_queue<pair<ll,pair<int,int> >,vector<pair<ll,pair<int,int> > >,greater<pair<ll,pair<int,int> > > > pq;
    int cnt = 0;
    rep(i,n){
        int c;
        cin >> c;
        if(c==0){
            cnt++;
        }else{
            pq.push(MP(0LL,MP(i,n+c-1)));
        }
    }
    rep(i,m){
        int a,b;
        ll w;
        cin >> a >> b >> w;
        a--;b--;
        pq.push(MP(w,MP(a,b)));
    }
    UnionFind uf(n+k);
    ll res = 0;
    int s = n+k;
    while(!pq.empty()){
        auto x = pq.top();
        pq.pop();
        ll w = x.first;
        int a = x.second.first;
        int b = x.second.second;
        if(!uf.same(a,b)){
            uf.unite(a,b);
            res += w;
            s--;
            if(s<=cnt+1)break;
        }
    }
    cerr << s << " " << cnt << endl;
    if(s<=cnt+1){
        cout << res << endl;
    }else{
        cout << -1 << endl;
    }
    return 0;
}

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

int main(){
    string s;
    cin >> s;
    for(char c = 'a'; c <= 'z'; c++){
        int cnt = 0;
        for(int i = 0; i < s.size(); i++){
            if(s[i] == c) cnt++;
        }
        if(cnt == 0){
            cout << c << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define F first
#define S second
#define OUT(x) cout << (x) << "\n"
using namespace std;
using point = pair< int,int >;
using ll = long long;

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

    int c5 = 0, c7 = 0;

    c5 += a == 5; c7 += a == 7;
    c5 += b == 5; c7 += b == 7;
    c5 += c == 5; c7 += c == 7;

    OUT(c5 == 2 && c7 == 1 ? "YES" : "NO");

    return 0;
}

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

int main()
{
    int N;
    cin >> N;
    priority_queue<double, vector<double>, greater<double> > V;
    for (int i = 0; i < N; ++i){
        int v;
        cin >> v;
        V.push(v);
    }

    for (int i = 0; i < N - 1; ++i){
        double x, y;
        x = V.top();
        V.pop();
        y = V.top();
        V.pop();
        double n = (x + y) / 2;
        V.push(n);
    }

    double ans = V.top();
    cout << fixed << ans << endl;

    return 0;
}

Measured memory_bytes: 256
///Astalavista Code........~CodeSlayer007
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define Br cout<<endl
#define pb push_back
#define mp make_pair
#define fe first
#define se second
#define int long long
#define double long double
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define PT(x) cout << (x) << endl
#define PTT(x) cout << (#x) << " is " << (x) << endl
#define SPD_emergency ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
int M = 1e18;
const int N = 1e6 + 10;
const int IM = 1e15 + 37;
const int PI = 3.14159265;
void PV(vi v) { for (int i = 0 ; i < v.size() ; i++) cout << v[i] << " "; cout << endl;}
void PA(int v[], int n, int x = 0) { for (int i = x ; i < n + x; i++)cout << v[i] << ' ' ; cout << endl;}
void IN(int a[], int n, int x = 0) {for (int i = x; i < n + x; i++)cin >> a[i];}
inline void PP(int n) { cout << n << " ";}
inline void PP(int n, int m) { cout << n << " " << m << endl;}
inline void PP(int n, int m, int q) {  cout << n << " " << m << " " << q << endl;}
inline void PP(int n, int m, int q, int u) {  cout << n << " " << m << " " << q << " " << u << endl;}
inline void op() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
// <-------------------------------------------------------------------------------------------------------------------------------------------------------------------------> Ignore This--> setprecision memset substr pop_back  insert tuple first second push_back string continue make_pair break deque stack queue sort reverse accumulate  count lower_bound upper_bound next_permutation copy_n __builtin_popcount make_tuple
// <========================================================================================================================================================================

int a, b;
signed  main() {
    SPD_emergency
   
    int i, j, x, y, u, l;
    // int t; cin >> t; while (t--)
    {   i = j = x = y = u = l = 0;

        int n;
        cin >> n;
        map<int, int> m;
        for (i = 2; i * i <= n; i++) {
            if (n % i == 0 && m[i] == 0) {
                j = 0;

                while (n % i == 0 ) { //PT(j)
                    j++;
                    n = n / i;
                }
                u = 1;
                y = 2;
                while (u <= j) { //PT(u);
                    u = u + y;
                    y++;
                    x++;
                }
            }
        }
        if (n > 1 && m[n] == 0) {
            x++;
        }
        PT(x);



        /**/

    }


    return 0;
}

Measured memory_bytes: 3652
N=int(input())
A=list(map(int,input().split()))
A=[0]+A
F=0
E=0
S=0
ans=0
#print(A)
for i in range(10**6):
    if F==E:
        
        ans+=(F-E+1)
        S=A[F+1]
        F+=1
        if F==N:
            break
    elif S^A[F+1]==S+A[F+1]:
        
        ans+=(F-E+1)
        S^=A[F+1]
        F+=1
        if F==N:
            break
    else:
        
        S^=A[E+1]
        E+=1
    #print(F,E,S,ans)
print(ans)

Measured memory_bytes: 24584
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=2e5+5;
int a[maxn];
int main()
{
    int n;
    scanf("%d",&n);
    int num=0;
    int Min=0x3f3f3f3f;
    for(int i=0; i<n; i++)
    {
        scanf("%d",&a[i]);
        if(a[i]<Min)num++;
        Min=min(a[i],Min);
    }
    printf("%d",num);
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define inf 0x3f3f3f3f
#define lowb(x) (x & (-x))
#define lson (id << 1)
#define rson (id << 1 | 1)
#define maxm
#define maxn

int main()
{
    int n, m;

    scanf("%d%d", &n, &m);
    int tmp = n - m;
    printf("%lld\n", (tmp * 100 + 1900 * m) * (1ll << m));
}



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

#define SUPERFRIENDNUM 100000
#define AIDA 100

unsigned int friendInfo[SUPERFRIENDNUM][2];

unsigned int CheckAida(unsigned int maxFriend, unsigned char count, unsigned int N) {
	unsigned int i = maxFriend + 2;
	unsigned int okPeople = 0;
	for (unsigned int j = 0; j < N && okPeople<i; j++) {
		if (friendInfo[j][0] <= i && friendInfo[j][1] >= i) {
			okPeople++;
		}
	}
	if (okPeople >= i - 1) {
		count++;
		maxFriend = i - 1;
		if (count < AIDA) {
			maxFriend = CheckAida(maxFriend, count, N);
		}
	}
	return maxFriend;
}


int main() {
	//データ入力部
	unsigned int N = 0;
	cin >> N;
	unsigned int min = SUPERFRIENDNUM+1;
	unsigned int max = 1;
	unsigned int minMax = 1;
	for (unsigned int i = 0; i < N; i++) {
		cin >> friendInfo[i][0] >> friendInfo[i][1];
		if (min > friendInfo[i][0]) {
			min = friendInfo[i][0];
		}
		if (minMax < friendInfo[i][0]) {
			minMax = friendInfo[i][0];
		}
		if (max < friendInfo[i][1]){
			max = friendInfo[i][1];
		}
	}
	if (max > N + 1) {
		max = N + 1;
	}

	//計算部
	unsigned int maxFriend = 0;
	unsigned int okPeople = 0;
	//Max何人まで許されるかな
	for (unsigned int i = min; i <= max; i+=AIDA) {
		//皆に聞いていく
		okPeople = 0;
		for (unsigned int j = 0; j < N && okPeople<i; j++) {
			if (friendInfo[j][0] <= i && friendInfo[j][1] >= i) {
				okPeople++;
			}
		}
		if (okPeople >= i - 1) {
			maxFriend = i - 1;
		}
		if (minMax < i && okPeople < i - 1) {
			break;
		}
	}
	maxFriend = CheckAida(maxFriend, 0, N);
	

	cout << maxFriend << endl;
}


Measured memory_bytes: 3892
#pragma warning(disable:4996)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define MAX_STRING 30

	int anTime[100001];
	int anX[100001];
	int anY[100001];

int main() {
	char sInput[MAX_STRING+1]="";
	char* psInput;

	int i=0;
	int nPointNumber=0;
	int nFailed=0;
	int nTimeCounter=1;
	int nLeftTime=0;
	int nXDistance=0;
	int nYDistance=0;
	int nSumDistance=0;
	int nTempNumber=0;

	// read line 1
	gets(sInput);
	nPointNumber = atoi(sInput);

	anTime[0]=0;
	anX[0]=0;
	anY[0]=0;

	// read line 2 ~
	for (i=1;i<=nPointNumber;i++){
		gets(sInput);
		psInput = strtok(sInput," ");
		anTime[i] = atoi(psInput);
		psInput = strtok(NULL," ");
		anX[i] = atoi(psInput);
		psInput = strtok(NULL," ");
		anY[i] = atoi(psInput);
	}

	while(nFailed==0 && nTimeCounter<=nPointNumber){
		nLeftTime=anTime[nTimeCounter]-anTime[nTimeCounter-1];
		nXDistance=abs(anX[nTimeCounter]-anX[nTimeCounter-1]);
		nYDistance=abs(anY[nTimeCounter]-anY[nTimeCounter-1]);
		nSumDistance=nXDistance+nYDistance;

		if ( nLeftTime < nSumDistance ){
			nFailed=1;
		} else {
			nTempNumber = nLeftTime - nSumDistance;
			if ( nTempNumber % 2 == 1 ){
				nFailed=1;
			} 
		}

		nTimeCounter++;
	}


	if (nFailed>0){
		printf("No\n");
	} else {
		printf("Yes\n");
	}

    return 0;
}

Measured memory_bytes: 1280
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = a[0] + sum(b)
c = ans

for i in range(n-1) :
    c = c - b[i] + a[i+1]
    ans = max(ans, c)

print(ans)

Measured memory_bytes: 3060
#pragma GCC optimize("O4")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define MOD (ll)(1e9+7)
#define INF (1e17)
#define int ll
#define EPS (1e-6)
#define DB(x) #x<<" "<<x<<" "
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) { return a/gcd(a,b)*b; }
int fpow(int b,int p){
	b%=MOD;
	int ans=1;
	while(p>0){
		if(p&1) ans=(ans*b)%MOD;
		p/=2;
		b=(b*b)%MOD;
	}
	return ans;
}

int32_t main() {
#ifdef LOCAL_TEST
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\input.in","r",stdin);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\output.out","w",stdout);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\error.out","w",stderr);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);

	//code...
	int n,d,a; cin>>n>>d>>a;
	vector<pii> v(n);
	for(auto &i:v) cin>>i.F>>i.S;
	sort(all(v));
	queue<pii> bang;
	int ans=0,now=0;
	for(auto &i:v){
		while(!bang.empty() && bang.front().F<i.F-d*2){
			now-=bang.front().S;
			bang.pop();
		}
		i.S=max(0ll,i.S-now*a);
		int x=(i.S+a-1)/a;
		bang.emplace(i.F,x);
		ans+=x;
		now+=x;
		//cerr<<DB(i.F)<<DB(i.S)<<DB(x)<<"\n";
	}
	cout<<ans<<"\n";
	return 0;
}


Measured memory_bytes: 6656
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <string.h>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
int main(void){
   char s[6];
   cin>>s;
   for(int i=0;i<strlen(s)-1;i++){
       if(s[i]=='A'&&s[i+1]=='C'){
           cout<<"Yes\n";
           return 0;
       }
       
   }
    cout<<"No\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lint long long int
#define ulint unsigned long long int
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(int i=0;i<(n);i++)
#define fori(a,b,i) for(int i=(a);i<=(b);i++)
#define ford(a,b,i) for(int i=(a);i>=(b);i--)
#define INF 0x3f3f3f3f
#define mod 1000000007
#define fir first
#define sec second
#define pb push_back
#define mp make_pair
#define fastm_fast ios_base::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL)
using namespace std;
int main()
 {
 fastm_fast;
 
 int n;
 cin >> n;
 std::vector<int> v,u;
 loop(i, n)
    {
        int temp;
        cin >> temp;
        v.pb(temp);
    }
loop(i,n)
    {
        int tmp;
        cin >> tmp;
        u.pb(tmp);
    }
vector<int> c;
c=v;
sort(c.begin(),c.end());
int p1 = 0;
int p2 = 0;
while(1)
    {
        p1++;
        if(c==v)
            break;
        next_permutation(c.begin(),c.end());
    }
sort(c.begin(),c.end());
while(1)
    {
        p2++;
        if(c==u)
            break;
        next_permutation(c.begin(),c.end());
    }
cout<<abs(p1-p2);
  return 0;
 }



Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll ;
typedef double db;
typedef unsigned long long ull ;
const double PI = acos(-1) ;

#define pf		  	printf
#define sf			  scanf
#define pb(a)         push_back(a)
#define for0(i,n)          for(int i=0;i<n;i++)
#define for1(i,n)          for(int i=1;i<=n;i++)
#define forab(i,a,b)       for(int i=a;i<=b;i++)
//#define gcd(a, b)     __gcd(a, b)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
//#define abs(x)		fabs(x)
#define pcase(z,x)     cout<<"Case "<<z<<": "<<x<<"\n"
#define CIN	ios_base::sync_with_stdio(0); cin.tie(0)
#define max 1000000000000000000

using namespace std;

int main()
{
    CIN;
    int n;
    ll l=1,m;
    double s=1;
    cin>>n;
    while(n--)
    {
    	cin>>m;
    	l*=m;
    	s*=m;

    }
    if(l>max|| s>max)pf("-1\n");
    else pf("%lld\n",l);
    
    //else cout<<"-1"<<nw;
    return 0;
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
#define sort_(a) sort(a.begin(), a.end())
#define sum(a) accumulate(a.begin(), a.end(), 0)
#define rep(i, n) for (int i = 0; i < n; ++i)
typedef long long unsigned int ll;
const long mod = 1e9 + 7;

int main(void) {
#ifdef DEBUG
  freopen(".testcase", "r", stdin);
#endif

  ios_base::sync_with_stdio(false);
  cin.tie(0);

  int N;
  cin >> N;
  cout << N / 3 << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
 
using namespace std;
 
typedef long long Int;
 
Int n;
Int MOD;
Int ans;
Int dp[3100][3100];
Int frac[108000];
Int rfrac[108000];
Int pow(Int a, Int b){
	if(b == 0)return 1;
	Int res = pow(a, b / 2);
	res *= res;res %= MOD;
	if(b % 2 == 1)res *= a;
	return res % MOD;
}
 
Int rev(Int x){
	return pow(x, MOD-2);
}
 
Int C(Int n, Int k){
	return frac[n] * rfrac[n-k]  % MOD * rfrac[k] % MOD;
}
 
 
Int powpow2(int x){
	Int res = 2;
	while(x--){
		res *= res;
		res %= MOD;
	}
	return res;
}
 
 
Int hoge(Int k){
	Int ans = 0;
	Int pp = powpow2(n-k);
	Int poyo = 1;
	Int pupu = pow(2,(n-k));
	for(int i = 0;i <= k;i++){
		ans += dp[k][i] * poyo % MOD * pp % MOD;ans %= MOD;
		poyo *= pupu;poyo %= MOD;
	}
	return ans * C(n, k) % MOD;
}
 
int main(){
	dp[0][0] = 1;
	cin >> n >> MOD;
	for(int i = 0;i <= 3000;i++){
		if(i == 0)frac[i] = 1;
		else frac[i] = frac[i-1] * i % MOD;
		rfrac[i] = rev(frac[i]);
	}
	ans = powpow2(n);
	for(int i = 1;i <= 3000;i++){
		for(int j = 0;j <= 3000;j++){
			dp[i][j] += dp[i-1][j] * (j+1) % MOD;
			if(j) dp[i][j] += dp[i-1][j-1];
			dp[i][j] %= MOD;
		}
	}
	
	for(int i = 1;i <= n;i++){
		if(i % 2 == 1)ans -= hoge(i);
		else ans += hoge(i);
		ans %= MOD;
	}
	if(ans < 0)ans += MOD;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 74496
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if(n>=400&&n<=599){
        cout<<8<<endl;
    }
    else if(n>=600&&n<=799){
        cout<<7<<endl;
    }
    else if(n>=800&&n<=999){
        cout<<6<<endl;
    }
    else if(n>=1000&&n<=1199){
        cout<<5<<endl;
    }
    else if(n>=1200&&n<=1399){
        cout<<4<<endl;
    }
    else if(n>=1400&&n<=1599){
        cout<<3<<endl;
    }
    else if(n>=1600&&n<=1799){
        cout<<2<<endl;
    }
    else if(n>=1800&&n<=1999){
        cout<<1<<endl;
    }


}


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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> city(n, 0);
  int a, b;

  for(int i=0; i<m; ++i) {
      cin >> a >> b;
      city.at(a-1)++;
      city.at(b-1)++;
  }

  for(int i = 0; i < n; ++i) {
      cout << city.at(i) << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
//#define int long long int
using namespace std;


int main(){

 int A,B,M; cin>>A>>B>>M;
 vector <int> a,b;

 int ans = 1000000;

 for(int i=0;i<A;i++){
   int aa; cin>>aa;
   a.push_back(aa);
 }


 for(int i=0;i<B;i++){
   int aa; cin>>aa;
   b.push_back(aa);
 }

 for(int i=0;i<M;i++){
   int x,y,c; cin>>x>>y>>c;
   int now = a[x-1] + b[y-1] - c;
   ans = min(ans,now);
 }

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

 ans = min(ans,a[0] + b[0]);

 cout<<ans<<endl;



  return 0;
}

Measured memory_bytes: 1400
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

x=int(input())
print(int(not x))

Measured memory_bytes: 61684
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main(){
  int a, b;
  string s;
  cin >> a >> b >> s;

  for(int i = 0; i < a; i++){
    if(!isdigit(s[0])){
      cout << "No" << endl;
      return 0;
    }
  }
  if(s[a]!='-'){
    cout << "No" << endl;
    return 0;
  }
  for(int i = a+1; i < s.size(); i++){
    if(!isdigit(s[i])){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
/* #define int long long */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repa(i, s, n) for(int i = s; i < (int)n; i++)
using namespace std;
using ll = long long;
typedef vector<int> vi;
typedef pair<int, int> P;
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


signed main(){
    int n, k;
    cin >> n >> k;
    long double ans = 0;
    for(int i = 1; i <= n; i++){
        int tmp = i;
        int num = 0;
        long double div_n = 1.0/n;
        while(tmp < k){
            tmp *= 2;
            div_n /= 2;
        }
        ans += div_n;
    }

    printf("%.12Lf\n", ans);

}

Measured memory_bytes: 3760