akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
typedef struct Card_s{
  char suit;
  int value;
}Card;

void bubble( Card *a, int length ){
  for( int i = 0; i < length ; i ++ ){
    for( int j = length - 1 ; j > i; j -- ){
      if( a[j].value < a[ j - 1 ].value ){
        Card tmp = a[ j ];
        a[ j ] = a[ j - 1 ];
        a[ j - 1 ] = tmp;
      }
    }
  }
}

void selection(Card * a, int length ){
  for( int i = 0; i < length; i ++ ){
    int mini = i;
    for( int j = i + 1; j < length ; j ++ ){
      if( a[ j ].value < a[ mini ].value )
        mini = j;
    }
    if( i != mini ){
      Card tmp = a[ mini ];
      a[ mini ] = a[ i ];
      a[ i ] = tmp;
    }
  }
}

int main( void ){
  int n;
  scanf("%d\n", &n );
  Card *a = ( Card * )malloc( n * sizeof( Card ) );
  Card *b = ( Card * )malloc( n * sizeof( Card ) );
  for( int i = 0; i < n; i ++ ){
    char suit;
    int value;
    scanf("%c%d ", &suit, &value );
    a[ i ].suit = suit;
    a[ i ].value = value;
    b[ i ].suit = suit;
    b[ i ].value = value;
  }
  bubble( a, n );
  selection( b, n);
  int is_stable = 1;
  for( int i = 0; i < n ; i ++ ){
    if( a[ i ].suit != b[ i ].suit )
      is_stable = 0;
  }
  for( int i = 0; i < n - 1; i ++ )
    printf("%c%d ", a[ i ].suit, a[ i ].value );
  printf("%c%d\nStable\n", a[ n - 1 ].suit, a[ n - 1 ].value );

  for( int i = 0; i < n - 1; i ++ )
    printf("%c%d ", b[ i ].suit, b[ i ].value );
  printf("%c%d\n", b[ n - 1 ].suit, b[ n - 1 ].value );
  if( is_stable )printf("Stable\n");
  else printf("Not stable\n");
  return 0;
}








Measured memory_bytes: 2084
#include <iostream>
#include <algorithm>
#define llint long long

using namespace std;

llint x[3];

int main(void)
{
	cin >> x[0] >> x[1] >> x[2];
	
	for(int i = 0; i < 3; i++){
		if(x[i] % 2 == 0){
			cout << 0 << endl;
			return 0;
		}
	}
	
	sort(x, x+3);
	cout << x[0] * x[1] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int main(void){
    int n, x;
    
    while(cin >> n >> x){
        int count = 0;
        if(n == 0 && x == 0) return 0;
        for(int i=1; i<=n; i++){
            for(int j=2; j<=n; j++){
                for(int k=3; k<=n; k++){
                    if(i == j || j == k || i == k || i > j || j > k || i > k){
                        continue;
                    }
                    if(x == i + j + k){
                        count++;
                    }
                }
            }
        }
        cout << count << endl;
    }
    return 0;
}



Measured memory_bytes: 3096
#include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define f first
  #define s second
  #define PB push_back
  #define MP make_pair
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  #define MOD 998244353
  #define N 200005
  #define INF 1000000000000
  #define eps 1e-6


int ans[10];

int32_t main()
{



    int n,m;
    cin >> n >> m;

    unordered_map<int,int> mp;


    for(int i = 1 ; i <= m; i++)
    {
      int x,y;
      cin >> x >> y;
      if(x == 1 and y == 0 and n != 1)
      {
        cout << -1;
        return 0;
      }
      if(mp.find(x) != mp.end())
      {
        if(mp[x] != y)
        {
          cout << "-1";
          return 0;
        }
      }
      mp[x] = y;
    }

    for(auto &i : mp)
    {
      ans[i.f] = i.s;
    }

    if(n != 1)
    {

      if(mp.find(1) == mp.end())
      {
        ans[1] = 1;
      }
    }

    for(int i = 1; i <= n; i++)
    {
      cout << ans[i];

    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

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

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	int s,w;
	cin >> s >> w;
	cout << (w >= s?"unsafe":"safe") << '\n';
}


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


using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple

ll slow(ll N, ll P, string S) {
    ll ans = 0;
    REP(i, N) {
        FOR(j, i, N) {
            string sub = S.substr(i, j - i + 1);
            ll n = stoll(sub);
            if (n % P == 0) {
                // cerr << "gt: sub = " << sub << endl;
                ++ans;
            }
        }
    }
    return ans;
}

ll solve(ll N, ll P, string S) {
    reverse(ALL(S));

    // P = 2, P = 5は特別扱いする必要がある
    // 本番中は気づけなかった
    if (P == 2 || P == 5) {
        ll ans = 0;
        REP(i, N) {
            ll n = S[i] - '0';
            if (n % P == 0) {
                ans += N - i;
            }
        }
        return ans;
    }

    // 以下、Pと10は互いに素

    vector<ll> nums;
    ll base = 1;
    for(auto ch: S) {
        ll n = ch - '0';
        n *= base;
        n %= P;
        // cerr << n << " ";
        nums.pb(n);
        base *= 10;
        base %= P;
    }
    // cerr << endl;
    vector<ll> sums;
    REP(i, SIZE(nums)) {
        ll tmp = nums[i];
        if (i != 0) {
            tmp += sums.back();
        }
        tmp %= P;
        // cerr << tmp << " ";
        sums.pb(tmp);
    }
    // cerr << endl;

    map<ll, ll> counter;
    for(auto s: sums) {
        counter[s]++;
    }

    ll ans = 0;
    for(auto kv: counter) {
        auto n = kv.first;
        auto count = kv.second;
        // cout << "n, cout = " << n << "," << count << endl;
        if (n == 0) {
            ans += count * (count + 1) / 2;
        } else {
            ans += count * (count - 1) / 2;
        }
        // cout << "now ans = " << ans << endl;
    }
    return ans;
}

bool isPrime(const ll n){
    if (n <= 1){
        return false;
    }
    for(ll i = 2; i*i <= n; ++i){
        if (n % i == 0){
            return false;
        }
    }
    return true;
}

int main(void)
{
    cin.sync_with_stdio(false);
    ll N, P;
    cin >> N >> P;
    string S;
    cin >> S;
    cout << solve(N, P, S) << endl;
    return 0;

    {
        string S = "111";
        ll N = SIZE(S);

        // FOR(P, 32, 98) {
        for(ll P = 2; P < 10003; P++) {
            if (!isPrime(P)) continue;
            auto gt = slow(N, P, S);
            auto ans = solve(N, P, S);
            if (gt != ans) {
                cout << "P: " << P << endl;
                cout << "gt = " << gt << endl;
                cout << "ans = " << ans << endl;
                break;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 6408
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<iomanip>
#include <bitset>
#include<set>
using namespace std;
typedef long long ll;
const int INF=100000000;
const int MOD=1000000007;
 
int main()
{
 int m, d, ans=0;
 cin >> m >> d;
 for(int i=1;i<m+1;i++){
 	for(int j=1;j<d+1;j++){
   		int d1,d10;
   		d1=j%10;
   		d10=j/10;
   		if(i==d1*d10&&d1!=1&&d10!=1) ans++;
 	}
 }
 cout << ans;
 return 0;
}

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

using namespace std;

#define F first
#define S second

typedef pair<int, int> ii;
typedef vector<ii> vii;

int main() {
  int n, m;
  cin >> n >> m;
  vii per(m);
  for (int i=0;i<m;i++) {
  	cin >> per[i].first >> per[i].second;
  }
  
  sort(per.begin(), per.end());
  
  int res = 1, maxi = per[0].second, mini = per[0].first;
  for (int i=1;i<m;i++){
  	if (per[i].first >= maxi) {
        //cout << per[i].first << endl;
    	res++;
      	mini = per[i].first;
      	maxi = per[i].second;
    } else if (per[i].first >= mini && per[i].second <= maxi) {
     	mini = per[i].first;
      	maxi = per[i].second;
    }
  }
  
  cout << res << endl;

  
  return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#define cs ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(i,b)  for(int i=0;i<(int)(b);i++)
#define Rep(i,n) for(int i=1;i<(int)(n);i++)
#define repp(i,a,b)  for(int i=a;i<=(int)(b);i++)
#define Repp(i,a,b)  for(int i=a;i>=(int)(b);i--)
typedef long long ll;
typedef long double ld;

using namespace std;

int main(){
    cs
    int n;ll k,l=0,r=1e18;
    cin>>n>>k;
    vector<ll> v(n);
    vector<ll> vv(n);
    rep(i,n) cin>>v[i];
    rep(i,n) cin>>vv[i];
    sort(v.rbegin(),v.rend());
    sort(vv.begin(),vv.end());

    while(l<=r) {
        ll mid=(l+r)/2,dif=0;
        rep(i,n)
        if(v[i]*vv[i]>mid) 
        dif+=v[i]-mid/vv[i];

        if(dif<=k) r=mid-1;
        else l=mid+1;
    }
    cout<<l;

}

Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)

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

	for(int i = 0; i < n; i++){
		double xa,ya,ra,xb,yb,rb;
		cin>>xa>>ya>>ra>>xb>>yb>>rb;
		double dist=(ya-yb)*(ya-yb)+(xa-xb)*(xa-xb);
		// AÆBªdÈçÈ¢
		if(!EQ((ra+rb)*(ra+rb),dist)&&(ra+rb)*(ra+rb)<dist)
			cout<<0<<endl;
		// ~üªðíé
		else if(((abs(ra-rb))*(abs(ra-rb))<dist))
			cout<<1<<endl;
		else if(abs(ra-rb)*abs(ra-rb)>dist){
			// Ç¿ç©ªÉ¶Ý·é
			if(ra>rb)
				cout<<2<<endl;
			else
				cout<<-2<<endl;
		}
		else
			cout<<1<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
#define N 10000

int main(void){
  int i,num;
  double m5,m10;
  int ans[N];

  for(i=0;scanf("%lf%lf",&m5,&m10)==2;i++){
    if(m5<35.5 && m10<71.0){
      ans[i]=1;
    }else if(m5<37.5 && m10<77.0){
      ans[i]=2;
    }else if(m5<40.0 && m10<83.0){
      ans[i]=3;
    }else if(m5<43.0 && m10<89.0){
      ans[i]=4;
    }else if(m5<50.0 && m10<105.0){
      ans[i]=5;
    }else if(m5<55.0 && m10<116.0){
      ans[i]=6;
    }else if(m5<70.0 && m10<148.0){
      ans[i]=7;
    }else{
      ans[i]=8;
    }
  }
  num=i;
  for(i=0;i<num;i++){
    if(ans[i]==1) printf("AAA\n");
    if(ans[i]==2) printf("AA\n");
    if(ans[i]==3) printf("A\n");
    if(ans[i]==4) printf("B\n");
    if(ans[i]==5) printf("C\n");
    if(ans[i]==6) printf("D\n");
    if(ans[i]==7) printf("E\n");
    if(ans[i]==8) printf("NA\n");
  }
  return 0;
}

Measured memory_bytes: 0
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)
	answer := maxModSum(n)
	fmt.Println(answer)
}

func maxModSum(n int) int {
	s := 0
	for i := 1; i < n; i++ {
		s += i
	}

	return s
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const int INF=2e9;


int main() {
    ios_base::sync_with_stdio(false);

    int a,b,c;
    cin >> a >> b >> c;
    int ans=1;
    if (a!=b) {
        ++ans;
        if (c!=a && c!=b) ++ans;
    } else if (a!=c) ++ans;
    cout << ans << endl;

    return 0;   
}


Measured memory_bytes: 256
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
N = int(input())

num = [int(input())  for _ in range(N)]

n = 0
o = 0
p = 0
q = 0
r = 0
s = 0
t = 0
u = 0


for i in num:
    if i in [A[0],A[1],A[2]]:
        n += 1
for j in num:
    if j in [B[0],B[1],B[2]]:
        t += 1
for k in num:
    if k in [C[0],C[1],C[2]]:
        u += 1
for l in num:
    if l in [A[0],B[0],C[0]]:
        o += 1
for m in num:
    if m in [A[1],B[1],C[1]]:
        p += 1
for v in num:
    if v in [A[2],B[2],C[2]]:
        q += 1
for w in num:
    if w in [A[0],B[1],C[2]]:
        r += 1
for x in num:
    if x in [A[2],B[1],C[0]]:
        s += 1

if n >= 3 or o >= 3 or p >= 3 or q >= 3 or r >= 3 or s >= 3 or t >= 3  or u >= 3:
    print("Yes")
else:
    print('No')  


Measured memory_bytes: 3064
N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))
list = A
list = sorted(list)
max = list[-1]
second_max = list[-2]
cnt = A.count(max)
for i in range(N):
    if A[i] == max and  cnt == 1:
        print(second_max)
    else:
        print(max)

Measured memory_bytes: 14176
class LazySegmentTree
  attr_reader :n, :dat, :lazy

  # @param [Integer] len 区間の長さ
  def initialize(len)
    @n = 1

    @n *= 2 while @n < len
    @dat = Array.new(2 * @n - 1, 0)
    @lazy = Array.new(2 * @n - 1, 0)
  end

  # @param [Integer] l 更新範囲の左端
  # @param [Integer] r 更新範囲の右端
  # @param [Integer] x 更新する値
  def update(l, r, x)
    add(l, r, x, 0, 0, n - 1)
  end

  # @param [Integer] idx 取得したい値の箇所
  def find(idx)
    sum(idx, idx, 0, 0, n - 1)
  end

  def sum(a, b, idx, l, r)
    return 0 if r < a || b < l

    evaluate(idx, l, r)

    if a <= l && r <= b
      dat[idx]
    else
      vl = sum(a, b, idx * 2 + 1, l, (l + r) / 2)
      vr = sum(a, b, idx * 2 + 2, (l + r) / 2 + 1, r)

      vl + vr
    end
  end

  private

  # @param [Integer] a 探索範囲の左端
  # @param [Integer] b 探索範囲の右端
  # @param [Integer] x 更新する値
  # @param [Integer] idx 現在位置
  # @param [Integer] l 現在の探索範囲の左端
  # @param [Integer] r 現在の探索範囲の右端
  def add(a, b, x, idx, l, r)
    return if r < a || b < l

    if a <= l && r <= b
      @lazy[idx] += (r - l + 1) * x
      evaluate(idx, l, r)
    else
      add(a, b, x, idx * 2 + 1, l, (l + r) / 2)
      add(a, b, x, idx * 2 + 2, (l + r) / 2 + 1, r)
      @dat[idx] = dat[2 * idx + 1] + dat[2 * idx + 2]
    end
  end

  def evaluate(idx, l, r)
    return if lazy[idx] == 0

    @dat[idx] += lazy[idx]

    if r - l > 0
      @lazy[2 * idx + 1] += lazy[idx] / 2
      @lazy[2 * idx + 2] += lazy[idx] / 2
    end

    lazy[idx] = 0
  end
end

N, Q = gets.split.map(&:to_i)
lst = LazySegmentTree.new(N + 1)

Q.times do
  query = gets.split.map(&:to_i)

  if query.first == 0
    _, s, t, x = *query
    lst.update(s, t, x)
  else
    _, i = *query
    puts lst.find(i)
  end
end



Measured memory_bytes: 11216
#include<bits/stdc++.h>
using namespace std;
const int N=100005;
long long a[N],sum[50];
int main()
{
	ios::sync_with_stdio(false);
	long long n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		for(int j=0;j<=40;j++)
			if(a[i]&(1LL<<j))
				sum[j]++;
	}
	long long x=0;
	for(int i=40;i>=0;i--)
	{
		if(x+(1LL<<i)>k)
			continue;
		if(sum[i]<n-sum[i])
			x+=(1LL<<i);
	} 
	long long ans=0;
	for(int i=1;i<=n;i++)
		ans+=x^a[i];
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <time.h>
#include <queue>
#include <list>
#include <string.h>
#define sf scanf
#define pf printf
#define lf double
#define ll long long
#define p123 printf("123\n");
#define pn printf("\n");
#define pk printf(" ");
#define p(n) printf("%d",n);
#define pln(n) printf("%d\n",n);
#define s(n) scanf("%d",&n);
#define ss(n) scanf("%s",n);
#define ps(n) printf("%s",n);
#define sld(n) scanf("%lld",&n);
#define pld(n) printf("%lld",n);
#define slf(n) scanf("%lf",&n);
#define plf(n) printf("%lf",n);
#define sc(n) scanf("%c",&n);
#define pc(n) printf("%c",n);
#define gc getchar();
#define re(n,a) memset(n,a,sizeof(n));
#define len(a) strlen(a)
#define LL long long
#define eps 1e-6
using namespace std;
const double pi = 3.1415926535;
/*
https://codeforces.com/contest/1106/problems
https://codeforces.com/contest/1106/submit
*/
const ll mod = 1e9+7;
//快速幂 (a^b)%mod
//如果求逆元，则b = mod-2;
ll pow_quick(ll a,ll b){
    ll r = 1,base = a;
    while(b){
        if(b & 1){
            r *= base;
            r %= mod;
        }
        base *= base;
        base %= mod;
        b >>= 1;
    }
    return r;
}
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
long long ans;
int MOD=1e9+7;
int n;
int brr[100005];
int main()
{
    scanf("%d",&n);
    bool flag=true;
    int x;
    memset(brr,0,sizeof(brr));
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&x);
        brr[x]++;
    }
    if(n%2==0)
    {
        if(brr[0]>0)
        {
            printf("0\n");
            return 0;
        }
        for(int i=1;i<=n-1;i+=2)
        {
            if(brr[i]!=2)
            {
                printf("0\n");
                return 0;
            }
        }
    }
    else
    {
        if(brr[0]!=1)
        {
            printf("0\n");
            return 0;
        }
        for(int i=2;i<=n-1;i+=2)
        {
            if(brr[i]!=2)
            {
                printf("0\n");
                return 0;
            }
        }
    }
    ans=1;
    for(int i=1;i<=n/2;i++)
        ans=((ans%MOD)*2)%MOD;
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 640
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define IN4(P1,P2,P3,P4) cin>>(P1)>>(P2)>>(P3)>>(P4)
#define INS(I,N,V) REP((I),(N)) cin>>(V[I])
#define INS2(I,N,V1,V2) REP((I),(N)) cin>>(V1[I])>>(V2[I]);
#define INS3(I,N,V1,V2,V3) REP((I),(N)) cin>>(V1[I])>>(V2[I])>>(V3[I]);
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUTS(I,N,V) REP((I),(N)) cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
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;}

int a,b,c,d;
inline void solve(){
  IN4(a,b,c,d);
  OUT(abs(a-c)<=d||(abs(a-b)<=d&&abs(b-c)<=d)?"Yes":"No");
}

int main(int argc,char**argv){
  BEGIN
  solve();
  END
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    
    int n,m,x,a,b;
    a=0;
    b=0;
    scanf("%d %d %d",&n,&m,&x);
    int A[m];
    int ma[100]={0};
    
    for(int i=0; i<m; i++){
        scanf("%d",&A[i]);
        ma[A[i]]=1;
    }
    for(int i=1; i<x; i++){
        a+=ma[i];
    }
    for(int i=x; i<n; i++){
        b+=ma[i];
    }
    printf("%d",a<b? a:b);
}

Measured memory_bytes: 128
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    println(problem2020c(n))
}

fun problem2020c(n: Int): String {
    val map = hashMapOf<Int, Int>()
    for (x in 1..100) {
        val x2 = x * x
        for (y in 1..100) {
            val y2 = y * y
            for (z in 1..100) {
                val z2 = z * z
                if (x2 + y2 + z2 + x * y + y * z + z * x <= n) {
                    map[x2 + y2 + z2 + x * y + y * z + z * x] = map[x2 + y2 + z2 + x * y + y * z + z * x]?.plus(1) ?: 1
                }
            }
        }
    }
    val ans = IntArray(n + 1)
    for (i in 1 until n + 1) {
        ans[i] = map[i] ?: 0
    }
    return ans.drop(1).joinToString("\n")
}

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

int gcd(int a, int b){
  if(a%b==0) return b;
  else return gcd(b,a%b);
}
int main(){
  int n,x; cin>>n>>x;
  vector<int>vec(n);
  for(int i=0;i<n;i++){
    int a; cin>>a;
    vec[i]=abs(x-a);
  }
  int ans=vec[0];
  for(int i=0;i<n;i++){
    ans=gcd(ans,vec[i]);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int num[2][4],n;
    while(cin>>n,n){
        for(int i=0;i<n;i++){
            for(int j=0;j<2;j++)for(int k=0;k<4;k++)cin>>num[j][k];
            cout<<num[0][0]*num[1][0]-num[0][1]*num[1][1]-num[0][2]*num[1][2]-num[0][3]*num[1][3]<<" "
            <<num[0][0]*num[1][1]+num[0][1]*num[1][0]+num[0][2]*num[1][3]-num[0][3]*num[1][2]<<" "
            <<num[0][0]*num[1][2]-num[0][1]*num[1][3]+num[0][2]*num[1][0]+num[0][3]*num[1][1]<<" "
            <<num[0][0]*num[1][3]+num[0][1]*num[1][2]-num[0][2]*num[1][1]+num[0][3]*num[1][0]<<endl;
        }
    }
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

using P = pair<ll,ll>;

ll N;
vector<vector<int>> g;
vector<ll> X;
P memo[1024];

bool dfs(int cur){
    if(g[cur].size()==0){
        memo[cur] = mp(X[cur],0);
        return true;
    }else{
        for(int v : g[cur]) if(!dfs(v)) return false;

        ll sum = 0;
        for(auto v : g[cur]){
            sum += memo[v].fi + memo[v].se;
        }

        // curを黒にする
        // ex[i] : 子ノードをうまく黒にすれば黒の合計をiにできるか?
        vector<bool> ex(X[cur]+1,0);
        ex[0] = 1;

        for(int v : g[cur]){
            auto p = memo[v];
            vector<bool> ex2(X[cur]+1,0);
            for(int i=X[cur];i>=0;i--){
                if(ex[i]==0) continue;
                if(i+p.fi <= X[cur]) ex2[i+p.fi] = 1;    // 子ノードvは黒
                if(i+p.se <= X[cur]) ex2[i+p.se] = 1;    // 子ノードvは白
            }
            swap(ex,ex2);
        }

        // 白を最小にするためにはX[cur]以下で最大の値になるように子ノードを選択
        ll mx = -1;
        for(int i=X[cur];i>=0;i--){
            if(ex[i]){
                mx = i;
                break;
            }
        }

        if(mx == -1) return false;
        memo[cur] = mp(X[cur],sum-mx);  // {部分木で黒の合計 , 部分木で白の合計}
        return true;
    }
}


int main(){
    cin >> N;
    g.resize(N);
    X.resize(N);
    for(int i=1;i<N;i++){
        ll p;
        cin >> p;
        p--;
        g[p].pb(i);
    }
    rep(i,N){
        cin >> X[i];
    }

    if(dfs(0)){
        cout << "POSSIBLE" << endl;
        //rep(i,N) cerr << memo[i] << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
 
typedef long long ll;
typedef pair<int, int> ii;
 
int main(){
 
	int n, k;
	cin >> n >> k;
	vector<bool> unlike(10);
	rep(i, k){
		int tmp;
		cin >> tmp;
		unlike[tmp] = true;
	}
	
	
	REP(i, n, 10000000){
		int tmp = i;
		bool f = true;
		while(tmp != 0){
			if(unlike[tmp % 10]) f = false;
			tmp /= 10;
		}
		if(f){
			cout << i << endl;
			break;
		}
	}
	
	return 0;
}

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

int main()
{
	int A, B, C;
	std::string answer;
	std::cin >> A >> B >> C;
	if ((A==B&&B==C)||(A!=B&&B!=C&&A!=C))
	{
			answer = "No";
	}
	else
	{
		answer = "Yes";
	}
	std::cout << answer;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	ll a,b,k;
	cin >> a >> b >> k;
	if(a>k){
		a -= k;
		cout << a << " " << b << endl;
		return 0;
	}
	k -= a; a = 0ll;
	if(b>k){
		b -= k;
		cout << a << " " << b << endl;
		return 0;
	}
	cout << "0 0" << endl;
	return 0;
}


Measured memory_bytes: 256
object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val X, Y, Z, K = sc.nextInt()
    val A = Array.fill(X)(sc.nextLong()).sorted(Ordering.Long.reverse)
    val B = Array.fill(Y)(sc.nextLong()).sorted(Ordering.Long.reverse)
    val C = Array.fill(Z)(sc.nextLong()).sorted(Ordering.Long.reverse)

    println((for {
      i <- 0 until X
      j <- 0 until Y if (i + 1) * (j + 1) <= K
      k <- 0 until Z if (i + 1) * (j + 1) * (k + 1) <= K
    } yield A(i) + B(j) + C(k)).sorted(Ordering.Long.reverse).take(K).mkString("\n"))
  }

}



Measured memory_bytes: 112548
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    string s; cin>>s;
    ll n=s.size();
    ll ans=n*(n+1)/2;
    for(auto p:lcp_array(s,suffix_array(s))) ans-=p;
    cout<<ans<<endl;
}

Measured memory_bytes: 15660
#include<bits/stdc++.h>
#include<numeric>
using namespace std;
#define ll  long long
#define mp make_pair
#define fi first
#define se second
#define pii pair<ll,ll>
#define pb push_back
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define what_is(x) cerr << #x << " is " << x << endl;
#define mod 1000000007
// #define max INT_MAX
int main()
{
    ll int n,k,a,b;
    cin >> n >> k;
    std::vector<pair<ll int,ll int>>A(n);
    for(int i=0;i<n;i++)
    {
        cin >> a >> b;
        A[i] = {a,b};
    }
    sort(A.begin(),A.end());
    for(int i=0;i<n;i++)
    {
        // what_is(k);
        k -= A[i].second;
        if(k<=0)
        {
            cout << A[i].first;
            break;
        }
    }
}

Measured memory_bytes: 1792
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdio>
#include <cstring>
using namespace std;
#define U(v) cerr << #v << ": " << (v) << endl;

template <class T>
struct Cumsum2 {
    vector<vector<T>> a;
    Cumsum2(const vector<vector<T>>& v = {}) :
            a(v.size() + 1, vector<T>(v[0].size() + 1, 0)) {
        for (int y = 1; y < (int)a.size(); ++y)
            for (int x = 1; x < (int)a[0].size(); ++x)
                a[y][x] = v[y - 1][x - 1] - a[y - 1][x - 1] + a[y - 1][x] + a[y][x - 1];
    }
    T sum(int x, int y, int w, int h) const {
        return a[y][x] - a[y][x + w] - a[y + h][x] + a[y + h][x + w];
    }
};

int main() {
    int n, k;
    while (cin >> n >> k) {
        vector<vector<int>> bl(k * 4, vector<int>(k * 4, 0));
        auto wh = bl;
        for (int i = 0; i < n; ++i) {
            int x, y;
            char c;
            cin >> x >> y >> c;
            x %= k * 2;
            y %= k * 2;
            auto& cl = c == 'B' ? bl : wh;
            cl[y][x]++;
            cl[y + k * 2][x]++;
            cl[y][x + k * 2]++;
            cl[y + k * 2][x + k * 2]++;
        }
        Cumsum2<int> blcs(bl), whcs(wh);
        int mx = 0;
        for (int y = 0; y < k * 2; ++y)
            for (int x = 0; x < k * 2; ++x)
                mx = max(mx, blcs.sum(x, y, k, k) + blcs.sum(x + k, y + k, k, k) + whcs.sum(x + k, y, k, k) + whcs.sum(x, y + k, k, k));
        cout << mx << endl;
    }
    return 0;
}


Measured memory_bytes: 250880
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
/* map<string,int> */
/* 大文字を小文字に変換 tolower*/
/* 小文字を大文字に変換 toupper*/
 
int main () {
	int n;
	cin >> n;
	vector <int> a(n);
	vector <int> p(n);
	vector <int> q(n);
	for (int i =0;i< n ; i++) {
		a[i] = i+1;
	}
	for (int i =0;i< n ; i++) {
		cin >> p[i];
	}
	for (int i =0;i< n ; i++) {
		cin >> q[i];
	}
	int count =1;
	int d,e;
	do {
		bool f = true,g = true;
			for (int i =0;i<n;i++) {
				if (a[i] != p[i]) f = false;
				if (a[i] != q[i]) g = false;
			}
		if (f == true) {
			d = count;
		}
		if (g == true) {
			e = count;
		}
		count++;
	} while(next_permutation(a.begin(),a.end()));
	cout << abs(d-e) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <typeinfo>
#include <queue>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
vector<int> points[100001];
int arrow[100001];

void check(int node)
{
    rep(i, points[node].size())
    {
        if (arrow[points[node][i]] != -1)
            continue;
        arrow[points[node][i]] = node;
        check(points[node][i]);
    }
}

int main()
{
    ll n, m, a, b;
    cin >> n >> m;
    rep(i, n + 1)
    {
        arrow[i] = -1;
    }
    arrow[1] = 0;
    rep(i, m)
    {
        cin >> a >> b;
        points[a].push_back(b);
        points[b].push_back(a);
    }
    // check(1);
    queue<int> list;
    list.push(1);
    while (!list.empty())
    {
        int node = list.front();
        list.pop();
        rep(i, points[node].size())
        {
            if (arrow[points[node][i]] != -1)
                continue;
            list.push(points[node][i]);
            arrow[points[node][i]] = node;
        }
    }

    cout << "Yes" << endl;
    rep(i, n - 1)
    {
        cout << arrow[i + 2] << endl;
    }
}

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

int main(){
  int A, B, K;
  cin >> A >> B >> K;
  for (int i=0; i<K; i++){
    if (i%2 == 0){
      if (A%2 == 1){
        A -= 1;
      }
      A /= 2;
      B += A;
    } else {
      if (B%2 == 1){
        B -= 1;
      }
      B /= 2;
      A += B;
    }
  }
  cout << A << " " << B << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;

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

	a += b;
	int n = stoi(a);
	int m = sqrt(n);

	if (n == m * m) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

int main() {
  int a;
  cin>>a;
  if(a==25)
    cout<<"Christmas"<<endl;
  else if(a==24)
    cout<<"Christmas Eve"<<endl;
  else if(a==23)
    cout<<"Christmas Eve Eve"<<endl;
  else
    cout<<"Christmas Eve Eve Eve"<<endl;
}

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

int main() {
  int N, l, r;
  int i;
  int sum = 0;
  
  cin >> N ;
  
  for (i = 0; i < N; i++) {
    cin >> l >> r;
    sum += r - (l - 1);
  }
  cout << sum << endl;
}


Measured memory_bytes: 384
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x1 = sc.nextInt(),y1=sc.nextInt(),x2=sc.nextInt(),y2=sc.nextInt();
        int x3=x2-(y2-y1),y3=y2+(x2-x1),x4=x3-(y3-y2),y4=y3+(x3-x2);
        System.out.println(x3+" "+y3+" "+x4+" "+y4);
    }
}


Measured memory_bytes: 39760
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const int MOD = 998244353;
const ll INF = 1000000000000000000;


int main()
{
	int K, S;
	cin >> K >> S;
	int ans = 0;
	for (int x = 0; x <= K; x++) {
		for (int y = 0; y <= K; y++) {
			int num = S - x - y;
			if (num >= 0 && num <= K) ans++;
		}
	}
	cout << ans << endl;
}

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


int a, b;

void Main() {
  cin >> a >> b;

  if (a <= b) {
    rep(i, b) {
      cout << a;
    }
    cout << endl;
  } else {
    rep(i, a) {
      cout << b;
    }
    cout << endl;
  }
}

int main() {
  Main();
  return 0;
}

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

/**
 * vector<int>ar(3);
 * for(auto&e:ar){
 *     scanf("%d",&e);
 * }
 * sort(ar.begin(),ar.end())
 * int sum=accumulate(ar.begin(),ar.end(),0);
 ***/

int main(){
    double pai=3.141592653589;
    int a,chk;
    string s,s2,p;
    cin >> s >> p;
    s2=s+s;
    size_t pos = s2.find(p);
    if(pos != string::npos){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 1176
import java.util.*;

public class Main {
	static long[][] comb;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		
		final long MOD = 1000000007;
		
		int L = 2010;
		comb = new long[L][L];
		for(int i=0; i<L; i++)
			for(int j=0; j<=i; j++)
				comb[i][j] = j==0||i==j ? 1 : (comb[i-1][j]+comb[i-1][j-1])%MOD;
		
		for(int i=1; i<=K; i++)
			System.out.println((divAtoB(K-i, i) * divAtoB(N-K-(i-1), i+1))%MOD);
		
		sc.close();
	}
	
	static long divAtoB(int a, int b) {
		return a<0 || b<0 ? 0 : comb[a+b-1][b-1];
	}
}

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

int main() {
    string s, t;
    cin >> s >> t;

    unordered_map<char, int> mp;
    rep(i, s.size()) mp[s[i]]++;
    bool ok = true;
    rep(i, t.size()) {
        if (mp[t[i]] == 0) {
            ok = false;
            break;
        }
    }

    if (!ok) {
        cout << -1 << endl;
        return 0;
    }

    unordered_map<char, vector<int>> dict;
    rep(i, s.size()) {
        dict[s[i]].push_back(i);
    }

    ll ans = 0;
    int now = 0;
    rep(cur, t.size()) {

        auto tmp = upper_bound(dict[t[cur]].begin(), dict[t[cur]].end(), now-1);

        int p;
        if (tmp == dict[t[cur]].end()) {
            p = dict[t[cur]][0] + 1;
        }
        else {
            p = *tmp + 1;
        }

        // sort(dict[t[cur]].begin(), dict[t[cur]].end(), [&](const int & a, const int & b) {
        //     int n = now-1;
        //     if (n < a) {
        //         if (n < b) {
        //             return a < b;
        //         }
        //         else if (n >= b) {
        //             return true;
        //         }
        //     }
        //     else if (n == a) {
        //         return false;
        //     }
        //     else {
        //         // now > a
        //         if (n >= b) {
        //             return a < b;
        //         }
        //         else {
        //             // now < b
        //             return false;
        //         }
        //     }
        // });

        //int p = dict[t[cur]][0] + 1;
        if (now < p) {
            ans += (p - now);
        }
        else if (now == p) {
            ans += s.size();
        }
        else {
            ans += (s.size() - now) + p;
        }

        //cout << t[cur] << ", " << now << ", " << p << " / " << ans << endl;

        now = p;



    }

    cout << ans << endl;

}


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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;

#define rep(a,n) for(int a = 0;a < n;a++)
#define repi(a,b,n) for(int a = b;a < n;a++)

const ull mod = (ull)1e9 + 7;

int main(void)
{
	ll n, m;
	cin >> n >> m;	
	vector<pair<ll, string>> d(m);
	rep(i, m) {
		cin >> d[i].first >> d[i].second;
	}
	vector<ll> ws(n + 1, 0);
	vector<bool> ok(n + 1, false);
	rep(i, m) {
		auto key = d[i].first;
		if (ok[key]) {
			continue;
		}
		if (d[i].second == "WA") {
			ws[key]++;
		}
		else {
			ok[key] = true;
		}
	}
	ll oks = 0;
	ll wss = 0;
	rep(i, n + 1) {
		if (ok[i]) { 
			oks++; 
			wss += ws[i];
		}
	}
	cout << oks << " " << wss << endl;

	return 0;
}


Measured memory_bytes: 7296
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
using namespace std;
#define ll long long
#define re register
#define file(a) freopen(a".in",,"r",stdin);freopen(a".out","w",stdout)
inline int gi(){
	int f=1,sum=0;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=sum*10+ch-'0';ch=getchar();}
	return f*sum;
}
const int N=10010;
int n,k,d[N],flag[N],Max,now[N];
int main(){
	n=gi();k=gi();
	for(int i=1;i<=k;i++)d[i]=gi();
	for(int i=1;i<=k;i++)flag[d[i]]=1;
	for(int i=n;i<=100000;i++){
		int tmp=i,Flag=1;
		while(tmp){if(flag[tmp%10]){Flag=0;break;}tmp/=10;}
		if(Flag)return printf("%d\n",i),0;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

template<unsigned P> struct ModInt {
  using M = ModInt;
  unsigned v;
  ModInt() : v(0) {}
  ModInt(auto x) : v(x >= 0 ? x % P : (P - -x % P) % P) {}
  constexpr ModInt(unsigned v, int) : v(v) {}
  static constexpr unsigned p() { return P; }
  M operator+() const { return *this; }
  M operator-() const { return {v ? P - v : 0, 0}; }
  explicit operator bool() const noexcept { return v; }
  bool operator!() const noexcept { return !(bool)*this; }
  M operator*(M r) const { return M(*this) *= r; }
  M operator/(M r) const { return M(*this) /= r; }
  M operator+(M r) const { return M(*this) += r; }
  M operator-(M r) const { return M(*this) -= r; }
  bool operator==(M r) const { return v == r.v; }
  bool operator!=(M r) const { return !(*this == r); }
  M& operator*=(M r) { v = (uint64_t)v * r.v % P; return *this; }
  M& operator/=(M r) { return *this *= r.inv(); }
  M& operator+=(M r) { if ((v += r.v) >= P) v -= P; return *this; }
  M& operator-=(M r) { if ((v += P - r.v) >= P) v -= P; return *this; }
  M inv() const {
    int a = v, b = P, x = 1, u = 0;
    while (b) {
      int q = a / b;
      swap(a -= q * b, b);
      swap(x -= q * u, u);
    }
    assert(a == 1);
    return x;
  }
  M pow(auto n) const {
    if (n < 0) return pow(-n).inv();
    M res = 1;
    for (M a = *this; n; a *= a, n >>= 1) if (n & 1) res *= a;
    return res;
  }
  friend M operator*(auto l, M r) { return M(l) *= r; }
  friend M operator/(auto l, M r) { return M(l) /= r; }
  friend M operator+(auto l, M r) { return M(l) += r; }
  friend M operator-(auto l, M r) { return M(l) -= r; }
  friend ostream& operator<<(ostream& os, M r) { return os << r.v; }
  friend istream& operator>>(istream& is, M& r) { lint x; is >> x; r = x; return is; }
  friend bool operator==(auto l, M r) { return M(l) == r; }
  friend bool operator!=(auto l, M r) { return !(l == r); }
};
using Mint = ModInt<998244353>;

V<Mint> fact, ifact, inv, powB;
void init(int n, int B = 2) {
  fact.resize(n + 1);
  fact[0] = 1;
  for (int i = 1; i <= n; ++i) {
    fact[i] = i * fact[i - 1];
  }
  ifact.resize(n + 1);
  ifact[n] = 1 / fact[n];
  for (int i = n; i > 0; --i) {
    ifact[i - 1] = i * ifact[i];
  }
  inv.resize(n + 1);
  inv[1] = 1;
  for (int i = 2; i <= n; ++i) {
    int q = Mint::p() / i;
    inv[i] = -q * inv[Mint::p() - i * q];
  }
  powB.resize(n + 1);
  powB[0] = 1;
  for (int i = 0; i < n; ++i) {
    powB[i + 1] = powB[i] * B;
  }
}
Mint comb(int n, int r) {
  if (r < 0 or r > n) return 0;
  return fact[n] * ifact[r] * ifact[n - r];
}
Mint fn(int s, int k) {
  return comb(s + k - 1, s);
}

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n, m; cin >> n >> m;
  init(n + 3 * m);
  Mint res = fn(3 * m, n);
  for (int i = 2 * m + 1; i <= 3 * m; ++i) {
    res -= n * fn(3 * m - i, n - 1);
  }
  for (int i = m + 2; i <= min(n, 3 * m); i += 2) {
    res -= fn(3 * m - i >> 1, n) * comb(n, i);
  }
  cout << res << '\n';
}

Measured memory_bytes: 39296
#include <stdio.h>

int max(int a, int b) {
	if (a > b) return a;
	return b;
}

int main() {
	int ans;
	int x, t;
	scanf("%d%d", &x, &t);
	ans = max(0, x-t);
	printf("%d\n", ans);
	return 0;
}

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

using i64 = int64_t;

i64 d[31][31]={0}, color[502][502]={0};
i64 cost[3][31]={0};

int main(){
    int n, c;
    cin >> n >> c;
    for(int i=0;i<c;++i){
        for(int j=0;j<c;++j){
            cin >> d[i][j];
        }
    }
    for(int i=0;i<n;++i){
        for(int j=0;j<n;++j){
            cin >> color[i][j];
            color[i][j]--;
        }
    }

    for(int i=0;i<n;++i){
        for(int j=0;j<n;++j){
            for(int k=0;k<c;++k){
                cost[(i+j)%3][k] += d[color[i][j]][k];
            }
        }
    }

    i64 ans = LLONG_MAX;
    for(int i=0;i<c;++i){
        for(int j=0;j<c;++j){
            if(j == i)continue;
            for(int k=0;k<c;++k){
                if(k == i || k == j)continue;
                i64 sum = cost[0][i] + cost[1][j] + cost[2][k];
                ans = min(ans, sum);
            }
        }
    }

    cout << ans << endl;

    return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
#define INF 1000000000
#define pb push_back
#define sz(a) int((a).size())
#define all(c) c.begin(), c.end()
#define tr(c, i) for (typeof(c).begin() i = c.begin(); i != c.end(); i++)
#define present(c, x) (c.find(x) != c.end())
#define cpresent(c, x) (find(all(c), x) != c.end())

ll bigmod(ll a, ll b, ll m)
{

    if (b == 0)
        return 1;
    ll x = bigmod(a, b / 2, m);
    x = (x * x) % m;

    if (b % 2)
        x = (x * a) % m;
    return x;
}

ll bigsum(ll a, ll b, ll m)
{
    ll s;
    if (b == 0)
        return b;
    if (b == 1)
        return a + 1;
    if (b % 2)
    {
        b = b / 2;
        s = bigsum(a, b, m) % m;
        s = (s * bigmod(a, b + 1, m)) % m;
        return s;
    }
    else
    {
        s = bigsum(a, b - 1, m) % m;
        s = (a * s + 1) % m;
        return s;
    }
}


int main()
{

    ll n,x,t;
    cin>>n>>x>>t;

    x = ceil(n*1.0/x);
    cout<<x*t<<endl;

    
    return 0;
}

Measured memory_bytes: 3684
use proconio::*;

fn run() {
    input! {
        a: i64,
        v: i64,
        b: i64,
        w: i64,
        t: i64,
    }
    let ans = if a < b {
        a + v * t >= b + w * t
    } else {
        a - v * t <= b - w * t
    };
    let ans = if ans {
        "YES"
    } else {
        "NO"
    };
    println!("{}", ans);
}

fn main() {
    run();
}


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

int main() {
	int N;
	cin >> N;
	vector<int> a(N);
	int sum = 0;
	
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
		sum += a[i];
	}
	
	int mini = sum;
	int prefix_sum = 0;
	for (int i = 0; i < N; ++i) {
		prefix_sum += a[i];
		mini = min(mini, abs(prefix_sum - (sum - prefix_sum)));
	}
	
	cout << mini << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
	char a[10];
	int k;
	scanf("%c%c%c%c",&a[0],&a[1],&a[2],&a[3]);
	k=0;
	if(a[0]==a[1]&&a[1]==a[2])
	k=1;
	else if(a[3]==a[2]&&a[1]==a[2])
	k=1;
	if(k==0)
	printf("No\n");
	else
	printf("Yes\n");
}

Measured memory_bytes: 128
#include<cstdio>
int h,w;
bool tab[1004][1005];
long long dp[1004][1004];
const long long MOD = 1e9 + 7.01;

int main(){

	scanf("%d %d", &h, &w);
	for(int i=1;i<=h;i++){
		scanf("\n");
		for(int j=1;j<=w;j++){
			char tmp;
			scanf("%c", &tmp);
			tab[i][j] = tmp=='#'? 0:1;
		}
	}
	dp[1][1]=1;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if(!tab[i][j] || (i==1&&j==1))continue;
			dp[i][j] = dp[i-1][j] + dp[i][j-1];
			dp[i][j] %= MOD;
		}
	}

	printf("%lld\n", dp[h][w]);
}


Measured memory_bytes: 8960
//Be Name Khoda
//man az biganegan  hargez  nanalam
//ke harche kard ba man ashena kard
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma optimize O3
using namespace __gnu_pbds;
using namespace std;
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> using ordered_multiset =  tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long int LL;
typedef LL ll;
typedef long double ld;
typedef string str;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef stringstream strs;
 
#define X first
#define Y second
#define PB push_back
#define For(i,a,b) for (int i=a;i<b;i++)
#define Ford(i,a,b) for (int i=a;i>=b;i--)
#define smax(a,b) a=max(a,b)
#define smin(a,b) a=min(a,b)
#define SZ(a) ((ll)a.size())
#define ER(a) cout << #a << ' ' << a << endl
#define LB(a,n,x) (lower_bound(a,(a)+(n),x)-(a))
#define RET(x) { cout << x; exit(0); }
#define MKP make_pair
#define RETD(x) { cout << fixed << setprecision(15) << x; exit(0); }
#define GEI(x) scanf("%d",&x)
#define GEL(x) scanf("%lld",&x)
#define ALL(x) x.begin(),x.end()
const ll M=2e6+5,LG=32,SM=600+5,inf=1e18+5;
ll mod=1e9+7;

ll n,a[M];

int main()
{
    GEL(n); 
    For(i,0,n) GEL(a[i]);
    reverse(a,a+n);
    if (a[0]!=2) RET(-1);
    ll l=2,r=3;
    For(i,1,n)
    {
        //ER(l);ER(r);
        ll lp=l/a[i]+!!(l%a[i]);
        lp*=a[i];
        if (lp>r) RET(-1);
        ll rp=r/a[i]*a[i];
        rp+=a[i]-1;
        l=lp;
        r=rp;
    }
    RET(l << ' ' << r);
}

Measured memory_bytes: 1024
#include <iostream>
#include<algorithm>
#include<array>


int main(void) {

	int a = 0;
	std::cin >> a;
	if (a >= 1000) {
		std::cout << "ABD" << std::endl;
	}
	else if (a < 1000) {
		std::cout << "ABC" << std::endl;
		}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	int a[n+1];
	memset(a,0,sizeof a);
	for(int i=0;i<m;++i){
		int x,y;
		cin>>x>>y;
		++a[x];
		++a[y];
	}
	for(int i=1;i<=n;++i){
		cout<<a[i]<<"\n";
	}
	return 0;
	
}

Measured memory_bytes: 256