akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <vector>
#include <stack>
#include <functional>
#include <numeric>
#include <complex>
#include <queue>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <assert.h>
#include <cstring>
#include <sstream>
#include <string>
#include <algorithm>
 
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define X first
#define Y second
#define pb(x) push_back(x)
#define FOR(k, n) for (int k = 0; k < n; k++)
#define FORN(k, s, n) for (int k = s; k < n; k++)
#define debug(x) printf("%s = %d\n", #x, x)
#define debug2(x, y) printf("%s = %d, %s = %d\n", #x, x, #y, y)
#define debug3(x, y, z) printf("%s = %d, %s = %d, %s = %d\n", #x, x, #y, y, #z, z)
#define debug4(x, y, z, t) printf("%s = %d, %s = %d, %s = %d, %s = %d\n", #x, x, #y, y, #z, z, #t, t)
 
#pragma warning(disable : 6031)
#pragma warning(disable : 4101)
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;
typedef complex<double> cd;
 
const int INF = 1e9;
const long long LINF = 1e18;
const double PI = acos(-1);
 
// Solution

const int MAXN = 100005;

ll n, m, res, A[MAXN];
multiset<ll, greater<ll>> M;

int main() {
    scanf("%lld%lld", &n, &m);

    for (int i = 0; i < n; i++) {
        scanf("%lld", &A[i]);
        M.insert(A[i]);
    }

    while (m > 0) {
        m--;
        M.insert(*M.begin()/2);
        M.erase(M.begin());
    }

    res = accumulate(M.begin(), M.end(), 0ll, [](ll acc, ll cur) { return acc + cur; });
    printf("%lld\n", res);
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;

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

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

  string result;
  if (s[0] != 'A') {
    result = "WA";
  } else {
    int cCount = 0;
    for (int i = 2; i <= (s.size() - 2); i++) {
      if (s[i] == 'C') {
        cCount++;
      }
    }
    if (cCount != 1) {
      result = "WA";
    } else {
      result = "AC";
      for (char c : s) {
        if (c == 'A' || c == 'C') {
          continue;
        } else {
          if (isupper(c)) {
            result = "WA";
            break;
          }
        }
      }
    }
  }
  cout << result << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <random>
#include <ctime>
#include <bitset>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <climits>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define ld long double
#define ull unsigned long long
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fast_io cout.tie(0), cin.tie(0), ios_base::sync_with_stdio(0)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("Ofast")
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ld eps = (ld)1 / 1e6;
ll inf = LLONG_MAX, mod1 = 1e9 + 7, mod2 = 998244353;
ll sqr(ll a) { return a * a; }
ll qb(ll a) { return a * a * a; }
ll gcd(ll a, ll b) { return !a ? b : gcd(b % a, a); }
ll binpow(ll a, ll b, ll mod) { return b ? (b % 2 ? (a * (sqr(binpow(a, b / 2, mod)) % mod)) % mod : sqr(binpow(a, b / 2, mod)) % mod) : 1; }
ll binmult(ll a, ll b, ll mod) { return b ? (b % 2 ? (2 * binmult(a, b / 2, mod) + a) % mod : (2 * binmult(a, b / 2, mod)) % mod) : 0; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main()
{
    fast_io;
    ld d, t, c;
    cin >> d >> t >> c;
    cout << (d / c <= t ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 3740
import java.util.Arrays;
import java.util.Scanner;

public class Main {

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

        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] H = new int[N + 1];
        for (int i = 1; i <= N; i++) {
            H[i] = sc.nextInt();
        }

        boolean[] isGood = new boolean[N + 1];
        Arrays.fill(isGood, true);
        isGood[0] = false;

        for (int i = 0; i < M; i++) {
            int A = sc.nextInt();
            int B = sc.nextInt();

            if (H[A] <= H[B]) {
                isGood[A] = false;
            }

            if (H[B] <= H[A]) {
                isGood[B] = false;
            }
            
        }
        sc.close();

        int count = 0;
        for (boolean good : isGood) {
            if (good) {
                count++;
            }
        }

        System.out.println(count);

    }

}


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

int main(){
    int N,i,count=0;
    char *s;
    cin >> N;
    s = new char[N];
    for(i=0;i<N;i++){
        cin >> s[i];
        if(s[i]=='R'){
            count++;
        }
    }
    if(count>N-count){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define FOR(i,x,y) for(int i=(x),i##END=(y);i<=i##END;++i)
#define DOR(i,x,y) for(int i=(x),i##END=(y);i>=i##END;--i)
template<typename T,typename _T>inline bool chk_min(T &x,const _T y){return y<x?x=y,1:0;}
template<typename T,typename _T>inline bool chk_max(T &x,const _T y){return x<y?x=y,1:0;}
typedef long long ll;
const int N=2e5+5;
int c[N];
int a[N];
int disc[N],D;
int n;

void update(int k,int val)
{
	for(;k>0;k-=k&-k)chk_max(c[k],val);
}

int query(int k)
{
	int res=0;
	for(;k<=D;k+=k&-k)chk_max(res,c[k]);
	return res;
}

int main()
{
	scanf("%d",&n);
	FOR(i,1,n)scanf("%d",&a[i]);
	FOR(i,1,n)disc[++D]=a[i];
	std::sort(disc+1,disc+1+D);
	FOR(i,1,n)a[i]=std::lower_bound(disc+1,disc+1+D,a[i])-disc;
	int ans=0;
	FOR(i,1,n)
	{
		int res=query(a[i])+1;
		update(a[i],res);
		chk_max(ans,res);
	}
	printf("%d\n",ans);
	return 0;
}


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

int main() {
  int x;

  cin >> x;

  vector<bool> a(x * 2);

  for (int i = 0; i < x * 2; i++) {
    a[i] = true;
  }

  for (int i = 2; i < x * 2; i++) {
    if (a[i]) {
      for (int j = i * 2; j < x * 2; j += i) {
        a[j] = false;
      }
    }
  }

  int ans = x, i = x;

  while (1) {
    if (a[i]) {
      ans = i;
      break;
    }
    i++;
  }

  cout << ans;

  return 0;
}

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

Int N;
vector<Int> cnt(5, 0);
string MARCH = "MARCH";

int main(){
    cin >> N;

    rep(i,N){
        string S; cin >> S;
        rep(j,5){
            if(S[0] == MARCH[j]) cnt[j]++;
        }
    }

    Int ans = 0;
    rep(i,5){
        for(int j=i+1; j<5; j++){
            for(int k=j+1; k<5; k++){
                ans += cnt[i] * cnt[j] * cnt[k];
            }
        }
    }
    
    cout << ans << endl;

}

Measured memory_bytes: 256
using System;
class c
{
    static void Main()
    {
        var inp = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
        long a = inp[0], b = inp[1], c = inp[2];
        if (a + b + 1 < c)
        {
            Console.WriteLine(a + 2 * b + 1);
        }
        else
        {
            Console.WriteLine(b + c);
        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{   
    int N,K; cin>>N>>K;
    vint cnt(N);
    REP(i,N){
        int a; cin>>a;
        cnt[a-1]++;
    }
    sort(ALL(cnt),greater<int>());

    int ans=0;
    REP(i,K){
        ans+=cnt[i];
    }
    cout<<N-ans<<endl;

}


Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;
#define all(x) x.begin(),x.end()
const ll INF = 1e9;
const ll mod = 1e9 + 7;

int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}

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

ll lcm(ll a,ll b){
    return ((a * b == 0)) ? 0 : (a / gcd(a,b) * b);
}

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


//////////////////////////////////////////////////////////////////////////////////////

int main(){
    long long x, k, d;
    cin >> x >> k >> d;
    x = abs(x);

    long long first = min(k, x / d);
    k -= first;
    x -= first * d;

    if (k % 2 == 0){
        cout << x << endl;
    } else {
        cout << abs(x - d) << endl;
    }

    return 0;
}

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

int main() {
  long long x=0;
  cin>>x;
  long long yen=100;
  long long nen=0;
  
  while(true){
    yen*=1.01;
    nen++;
    if(yen>=x){
      break;
    }
  }
  cout<<nen;
}

Measured memory_bytes: 3636
import sys
from collections import defaultdict as dd
input = sys.stdin.readline
N = int(input())

d = dd(int)
res = 0
for i in range(1, N + 1):
  x = int(str(i)[0])
  y = int(str(i)[-1])
  d[x * (10 ** 6) + y] += 1
for i in range(1, N + 1):
  x = int(str(i)[0])
  y = int(str(i)[-1])
  res += d[y * (10 ** 6) + x]
#print(d)
print(res)

Measured memory_bytes: 41820
#include<bits/stdc++.h>
using namespace std;
#define T top()
#define E end()
#define PS push
#define Q queue
#define PP pop()
#define L0 (LL)0
#define V vector
#define ST stack
#define FI first
#define MAX 4e18
#define MIN -MAX
#define DQ deque
#define RE rend()
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define SE second
#define DL double
#define G getline
#define IN insert
#define endl "\n"
#define EM empty()
#define EE emplace
#define RB rbegin()
#define MD 1000000007
#define PSB push_back
#define PI acos(-1.00)
#define PPB pop_back()
#define PSF push_front
#define ub upper_bound
#define lb lower_bound
#define PPF pop_front()
#define EB emplace_back
#define LL long long int
#define PQ priority_queue
#define N cout<<"NO"<<endl
#define Y cout<<"YES"<<endl
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
#define UOSMOY v.C;w.C;ww.C;uu.C;uo.C;vo.C;vu.C;ab.C;bc.C;cc.C;uuu.C;a.C;b.C;c.C;u.C
V<LL>v;
V<LL>w,ab,bc;
set<LL>uo;
map<LL,LL>ww,cc,u;
V<pair<LL,LL> >uu;
map<LL,V<LL> >uuu;
map<pair<LL,LL>,LL> vo;
map<pair<LL,LL>,LL> vu;
LL ar[100];
LL dxx[]= {-1,0,1,0};
LL dyy[]= {0,1,0,-1};
LL dx[]= {2,1,-1,-2,-2,-1,1,2};
LL dy[]= {1,2,2,1,-1,-2,-2,-1};
int main()
{
//  BRR;
//  file;
    FAST;
    char ch;
    string a,b,c;
    DL x,y,d,e,f,g,h;
    LL n,m,i,j,k,p,q,o,l,s,tt=1,t,z,aa,r=0;
//    cin>>tt;
    while(tt--)
    {
        UOSMOY;
        cin>>a;
        k=0;
        for(i=0;a[i];)
        {
            if(a[i]=='R')
            {
                l=0;
                while(i<a.SZ && a[i]=='R')
                {
                    l++;
                    i++;
                }
                k=max(k,l);
            }
            else
            {
                i++;
            }
        }
        cout<<k<<endl;

    }
    return 0;
    //IN
    //AL
}


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

int main() 
{ 
    long long int n,d,a;
    cin>>n>>d>>a;
    vector<pair<long long int,long long int> > v(n);
    for(int i=0;i<n;i++){
        cin>>v[i].first>>v[i].second;
    }
    long long int sum=0,res=0;
    
    sort(v.begin(),v.end());
    queue<pair<long long int,long long int> > q;
    for(int i=0;i<n;i++){
        while(q.size()>0 && q.front().first < v[i].first){
           sum-=q.front().second;
           q.pop(); 
        }
        v[i].second-=a*sum;
        if(v[i].second <= 0) continue;
        long long int tmp=(v[i].second +a-1)/a;
        res+=tmp;
        q.push({v[i].first + 2*d,tmp});
        sum+=tmp;
    }
    cout<<res;
	return 0; 
} 


Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

int main()
{
//	cut here before submit 
//	freopen ("testcase.Petting_Cats", "r", stdin );
	int N;
	scanf ("%d", &N );
	while (N-- ){
		int x0, y0, w, h;
		scanf ("%d %d %d %d", &x0, &y0, &w, &h );
		int n;
		scanf ("%d", &n );
		int ans = 0;
		rep (i, n ){
			int x, y;
			scanf ("%d %d", &x, &y );
			if (x0 <= x && x <= x0 + w && y0 <= y && y <= y0 + h ) ans++;
		} // end rep

		printf ("%d\n", ans );
	} // end loop
		
	return 0;
}

Measured memory_bytes: 0
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())

    res = 0
    numbers = [[0] * 10 for _ in range(10)]
    for i in range(1, n + 1):
        ss = str(i)
        numbers[int(ss[0])][int(ss[-1])] += 1

    for j in range(1, 10):
        for k in range(1, 10):
            res += numbers[j][k] * numbers[k][j]

    print(res)


if __name__ == '__main__':
    resolve()


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

int main(){
  int N;
  cin >> N;
  bool a=false;
  for(int i=0;i<9;i++){
    for(int j=0;j<9;j++){
      if(N==(i+1)*(j+1)){
        cout << "Yes" << endl;
        a=true;
        break;
      }
    }
    if(a){
      break;
    }
  }
  if(!a){
    cout << "No" << endl;
  }
}
    
    

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

int main() {
  int X;
  cin >> X;
  vector <bool > expo(X+1);
  expo[1] = 1;
  for(int b=2;b<=X;b++){
    int v = b*b;
    while(v<=X){
      expo[v] = 1;
      v *= b;
    }
  }
  for(int i=X;i>=1;i--) if(expo[i]){
  cout <<i<<endl;
  return 0;
  }
}


Measured memory_bytes: 256
#include<algorithm>//sort(all(変数),greater<型名>())　で降順に
#include<bits/stdc++.h>
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric> //xとyの最大公約数は__gcd(x,y),xとyの最小公倍数は(x*y)/__gcd
#include<queue>//priority_queue<型名> 変数：優先度付きキュー　最大値の探索が早い
#include<set>
#include<stack>
#include<string>
#include<vector>
#define rep0(i,n)  for(ll i=0; i<n; i++)
#define rrep0(i,n) for(ll i=n-1; 0<=i; i--)
#define rep1(i,n)  for(ll i=1; i<=n; i++)
#define rrep1(i,n) for(ll i=n; 1<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF 1e18
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
  int n,weight;  cin >> n >> weight;
  vi w(n),v(n);
  rep0(i,n)cin >> w[i] >> v[i];
  vector<vll> dp(n+1,vll(1e5+1,INF));
  dp[0][0] = 0;
  rep1(i,n){
    rep0(j,1e5+1){
      dp[i][j] = dp[i-1][j];
      if(j-v[i-1] >= 0) chmin(dp[i][j],dp[i-1][j-v[i-1]]+w[i-1]);
    }
  }
  // rep0(i,10)cout << dp[n][i] <<" ";
  ll ans = 0;
  rep0(i,1e5+1){
    if(dp[n][i] <= weight){
      ans = i;
    }
  }
  cout << ans;
}


Measured memory_bytes: 80256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
#define mod 1e9 + 7;
ll gcd(ll x, ll y)
{
	ll r;
	while ((r = x % y) != 0)
	{
		x = y;
		y = r;
	}
	return y;
}
ll lcm(ll x, ll y)
{
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x * y);
}

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

	ll b, c , n, k = 0,ans = 0;
	string s;
	cin >> b;
	if (b < 1200) cout << "ABC"<< endl;
	else if (b < 2800) cout << "ARC" << endl;
	else cout << "AGC" << endl;
	return 0;
}

Measured memory_bytes: 256
N, K = gets.split(" ").map(&:to_i)
S = gets.chomp.split(//)

O = []
E = []
e = 0
o = 0
ix = 0
while ix < S.size
  o = 0
  while ix < S.size && S[ix] == '1'
    o += 1
    ix += 1
  end
  O << o
  break if ix >= S.size

  e = 0
  while ix < S.size && S[ix] == '0'
    e += 1
    ix += 1
  end
  E << e
end
O << 0 if O.size == E.size

if E.size <= K
  v = O.inject(0, &:+) + E.inject(0, &:+)
  puts v
  exit
end

sum = 0
(0..K).each do |i|
  sum += O[i]
end
(0...K).each do |i|
  sum += E[i]
end

max = sum
(K...E.size).each do |i|
  sum -= (O[i - K] + E[i - K])
  sum += (O[i + 1] + E[i])
  max = [max, sum].max
end
p max


# arr = []
# E.size.times do |i|
#   arr[i] = O[i] + E[i] + O[i + 1]
# end

# (K - 1).times do |k|
#   k += 1
#   arr2 = Array.new(E.size, 0)
#   (k...E.size).each do |i|
#     arr2[i] = arr[i - 1] + E[i] + O[i+1]
#   end
#   arr = arr2
# end
# puts arr.max


Measured memory_bytes: 10492
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).bigin(), (c).end())

typedef long long ll;

int main()
{
    int n, a[110];
    cin >> n;
    REP(i, n)
    cin >> a[i];

    int ans = 0;
    int i = 0;
    while (i < n - 1)
    {
        if (a[i] == a[i + 1])
        {
            ans++;
            i++;
        }
        i++;
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <limits>
#include <sstream>
#include <fstream>
#include <climits>
#include <map>
#include <numeric>
#include <functional>

typedef signed char        int8;
typedef short              int16;
typedef int                int32;
typedef long long          int64;
typedef unsigned char      uint8;
typedef unsigned short     uint16;
typedef unsigned int       uint32;
typedef unsigned long long uint64;

int main(void) {
  int s, w;
  std::cin >> s >> w;
  std::cout << (w >= s ? "unsafe" : "safe") << std::endl;

  return 0;
}


Measured memory_bytes: 3624
// Problem : C - Guess The Number
// Contest : AtCoder - AtCoder Beginner Contest 157
// URL : https://atcoder.jp/contests/abc157/tasks/abc157_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

//Macros

#define ll long long
#define db long double
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define inf 1e10
#define PI acos(-1.0)
#define int long long
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 100005

//Solution

vi digs(int x){
    vi ret;
    if(x == 0){
        ret.pb(0);
        return ret;
    }
    while(x){
        ret.pb(x%10);
        x /= 10;
    }
    reverse(all(ret));
    return ret;
}

void solve(){
    int n,m;
    cin>>n>>m;
    vii p(m);
    for(int i=0;i<m;i++) cin>>p[i].fi>>p[i].se;
    for(int i=0;i<1000;i++){
        vi d = digs(i);
        bool ok = true;
        ok &= (sz(d) == n);
        for(int j=0;j<m;j++) ok &= (d[p[j].fi-1] == p[j].se);
        if(ok){
            cout<<i<<endl;
            return;
        }
    }
    cout<<-1<<endl;
}

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int tests;
    //cin>>tests;
    tests = 1;
    while(tests--){
        solve();
    }
    return 0;
}

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define Rep(i,n) for(int i = 1; i <= n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
template<class T> using V = vector<T>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


struct Sieve { // 篩
    int n;
    vector<int> f, primes;
    Sieve(int n=1):n(n), f(n+1) {
        f[0] = f[1] = -1;
        for (ll i = 2; i <= n; ++i) {
            if (f[i]) continue;
            primes.push_back(i);
            f[i] = i;
            for (ll j = i*i; j <= n; j += i) {
                if (!f[j]) f[j] = i;
            }
        }
    }
    bool isPrime(int x) { return f[x] == x;} // 素数判定
    vector<int> factorList(int x) { // 素因数列挙
        vector<int> res;
        while (x != 1) {
            res.push_back(f[x]);
            x /= f[x];
        }
        return res;
    }
    vector<P> factor(int x) { // 素因数分解 int        
        vector<P> res;
        for(int p : primes) {
            int y = 0;
            while(x % p == 0) x /= p, y++;
            if(y != 0) res.emplace_back(p,y);
        }
        return res;
    }
    vector<pair<ll, int>> factorll(ll x) { // 素因数分解 long long 
        vector<pair<ll, int>> res;
        for(int p : primes) {
            int y = 0;
            while(x % p == 0) x /= p, y++;
            if(y != 0) res.emplace_back(p,y);
        }
        if(x != 1) res.emplace_back(x,1);
        return res;
    }
};


int main(){
    ll n, p;
    cin >> n >> p;
    Sieve s(200000);

    auto ps = s.factorll(p);
    ll ans = 1;
    for(auto p : ps) {
        int cnt = p.se;
        while(cnt >= n) {
            ans *= p.fi;
            cnt -= n;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4372
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef long double ld;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define ve vector
#define bb break
#define cc continue
#define rem 1000000007
#define PI 3.141592653589793238462643383279502
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
    x = x % p;  // Update x if it is more than or 
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
} 
struct point
{
    ll x,y;
};
int main()
{
    FAST
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    ll x;
    cin>>x;
    ll a=x/500;
    ll ans=1000*a;
    x-=a*500;
    a=x/5;
    ans+=a*5;
    cout<<ans<<"\n";
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<queue>
#include<stack>
#include<cstring>
#include<string>
using namespace std;
typedef long long LL;
stack<char> q;
int main(){
	string s,a;
	cin >> s;
	for(int i = 0;i < s.size();i++){
		if(s[i]=='B'){
			if(q.empty());
			else q.pop();
			}
		else q.push(s[i]);
		}
		while(!q.empty()){
			a += q.top();
			q.pop();
			}
		for(int i = a.size() - 1;i >= 0;i--) cout << a[i];
			cout << endl;
		return 0;
	}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
    var nums [3]int
    var sorted [3]int

    fmt.Scanf("%d %d %d", &nums[0], &nums[1], &nums[2])

    for i :=0; i < len(nums)-1; i++ {
        min := nums[i]
        for j :=i+1; j < len(nums); j++ {
            if min > nums[j] {
                min, nums[j] = nums[j], min
            }
        }
        sorted[i] = min
    }
    sorted[len(sorted)-1] = nums[len(nums)-1]

    fmt.Printf("%d %d %d\n", sorted[0], sorted[1], sorted[2])
}


Measured memory_bytes: 1176
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cin;
using std::cout;
using std::endl;

int main(void) {
    cout << std::fixed << std::setprecision(10);
    cin.tie(0);
    std::ios::sync_with_stdio(false);
    int n, a, b;
    cin >> n;
    if (n == 1) {
        cout << "Hello World" << endl;
    } else {
        cin >> a >> b;
        cout << a + b << endl;
    }

    return 0;
}


Measured memory_bytes: 888
s = input()
t = s[2:-1]
if s[0]=='A' and t.count('C')==1:
  c = 0
  for i in s:
    if ord('A')<=ord(i)<=ord('Z'):
      c += 1
  if c==2:
    print('AC')
  else:
    print('WA')
else:
  print('WA')

Measured memory_bytes: 3060
N = int(input())
A = []
for i in range(2):
    A.append(list(map(int, input().split())))

p1 = [0]
p2 = [0]
for i in range(N):
    p1.append(p1[i] + A[0][i])
    p2.append(p2[i] + A[1][N-i-1])

ans = 0
for i in range(1, N+1):
    ans = max(ans, p1[i]+p2[N+1-i])
print(ans)

Measured memory_bytes: 3064
h,w=map(int,input().split())
mine=[]
for _ in range(h):
    s=list(input())
    mine.append(s)

def check(a):
    d=[-1, 0, 1]
    for i in range(h):
        for j in range(w):

            count=0
            if not a[i][j]=="#":
                for x in d:
                    posx=j+x
                    for y in d:
                        posy=i+y
                        if posx>=0 and posx<w and posy>=0 and posy<h and a[posy][posx]=="#":
                            count+=1
                a[i][j]=count
    return a

mine=check(mine)
for i in mine:
    print(*i, sep="")


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

ans = sum(B)
for i in range(N-1):
  if A[i]+1 == A[i+1]:
    ans += C[A[i]-1]
print(ans)

Measured memory_bytes: 9192
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
typedef long long LL;

int main() {
  int A, B, C; std::cin >> A >> B >> C;
  if (A > B && A > C && C > B) std::cout << "Yes" << std::endl;
  else if (A < B && A < C && C < B) std::cout << "Yes" << std::endl;
  else std::cout << "No" << std::endl;
}


Measured memory_bytes: 256
_,*a=map(str.split,open(0))
U,R,D,L=S="URDL"
d={i:[]for i in S}
for*z,u in a:d[u]+=[*map(int,z)],
N,P,M=9e9,"x+y,","x-y,"
for A,B,S in(U,D,"x,y,"),(R,L,"y,x,"),(R,U,P+M),(D,L,P+M),(U,L,M+P),(R,D,M+P):
 n=p=-9e9
 for x,y,r in sorted(eval(f"[({S}Q)for P,Q in[(A,1),(B,0)]for x,y in d[P]]")):
  if r:n,p=x,y
  elif x==n:N=min(N,(y-p)*5)
print(["SAFE",N][N<9e9])

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

int main()
{

    int N;
    cin >> N;

    vector<string> S(N);
    for (int i = 0; i < N; i++)
    {
        cin >> S.at(i);
    }

    int countAC = 0;
    int countWA = 0;
    int countTLE = 0;
    int countRE = 0;

    string s;
    for (int i = 0; i < N; i++)
    {
        s = S.at(i);
        if (s == "AC")
        {
            countAC++;
        }
        else if (s == "WA")
        {
            countWA++;
        }
        else if (s == "TLE")
        {
            countTLE++;
        }
        else if (s == "RE")
        {
            countRE++;
        }
    }

    cout << "AC x " << countAC << endl;
    cout << "WA x " << countWA << endl;
    cout << "TLE x " << countTLE << endl;
    cout << "RE x " << countRE << endl;

    return 0;
}

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

typedef unsigned __int128 ll;

const long long int MAX_S=1e10;
long long int cubed_s=1;
vector<ll> prime;
vector<ll> cube_prime;

ll get_norm(ll num){
  for(int i=0;i<cube_prime.size();i++){
    while((num%cube_prime[i])==0) num/=cube_prime[i];
  }
  return num;
}

int main(){
  int n;
  cin>>n;
  vector<ll> a(n);
  for(int i=0;i<n;i++){
    long long int buf;
    cin>>buf;
    a[i]=buf;
  }
  
  while(cubed_s*cubed_s*cubed_s<=MAX_S) cubed_s++;
  vector<int> is_prime(1e5+1,1);
  int size_cube=0;
  is_prime[0]=is_prime[1]=0;
  for(int i=0;i<=1e5;i++){
    if(is_prime[i]){
      if(i>cubed_s && size_cube==0) size_cube=prime.size();
      prime.push_back(i);
      for(int j=2*i;j<=1e5;j+=i){
	is_prime[j]=false;
      }
    }
  }
  cube_prime.resize(size_cube);
  set<ll> prime_set;
  for(int i=0;i<prime.size();i++) prime_set.insert(prime[i]);
  for(int i=0;i<cube_prime.size();i++){
    cube_prime[i]=prime[i]*prime[i]*prime[i];
  }
  vector<ll> norm(n);
  for(int i=0;i<n;i++){
    norm[i]=get_norm(a[i]);
  }

  map<ll,ll> square_prime;
  for(int i=0;i<prime.size();i++){
    square_prime[prime[i]*prime[i]]=prime[i];
  }
  vector<ll> couple(n);
  for(int i=0;i<n;i++){
    ll num=norm[i];
    couple[i]=1;
    for(int j=0;j<cube_prime.size();j++){
      int cnt=0;
      while(num%prime[j]==0){

	num/=prime[j];
	cnt++;

      }
      
      if(cnt==1) couple[i]*=prime[j]*prime[j];
      if(cnt==2) couple[i]*=prime[j];
      
    }
    if(num!=1){
      if(square_prime.count(num)){
	couple[i]*=square_prime[num];

      }
      else if(prime_set.count(num)){
	couple[i]*=num*num;
      }
      else{
	couple[i]=-1;
      }
    }
    
    
  }

  set<ll> checked;
  long long int res=0;
  map<ll,long long int> norm_cnt;

  for(int i=0;i<n;i++){
    norm_cnt[norm[i]]++;
  }


  for(int i=0;i<n;i++){
    if(checked.count(norm[i])) continue;
    if(norm[i]==1){
      res++;
      checked.insert(1);
    }
    else{
      if(couple[i]==-1){
	res++;
      }
      else if(norm[i]==couple[i]){
	res++;
	checked.insert(norm[i]);
      }
      else{
	res+=max(norm_cnt[norm[i]],norm_cnt[couple[i]]);
	checked.insert(norm[i]);
	checked.insert(couple[i]);
      }
    }
  }
  
  cout<<res<<endl;
  return 0;

}


Measured memory_bytes: 29948
n = int(input())
a = list(map(int, input().split()))
s = abs(a[0])

for i in range(n - 1):
    s += abs(a[i] - a[i + 1])
s += abs(a[n - 1])

for i in range(n):
    if i == 0:
        print(s + abs(0 - a[i + 1]) - (abs(0 - a[i]) + abs(a[i] - a[i + 1])))
    elif i == n - 1:
        print(s + abs(a[i - 1] - 0) - (abs(a[i - 1] - a[i]) + abs(a[i])))
    else:
        print(s + abs(a[i - 1] - a[i + 1]) - (abs(a[i - 1] - a[i]) + abs(a[i] - a[i + 1])))


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


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

    int n;
    cin >> n;
    vector<int> d(n);
    rep (i, n) cin >> d[i];
    int ans=0;
    for (int i=0; i<n; ++i) {
        for (int j=i+1;j<n;++j) {
            ans += d[i]*d[j];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3548
#include<stdio.h>
main()
{
    int a, b;
    while(scanf("%d %d",&a, &b)==2)
    {
        if(a<b)
        {
           printf("a < b\n");
        }

            else if(a>b)
            {
               printf("a > b\n");
            }

            else
            {
               printf("a == b\n");
            }


    }
    return 0;

}



Measured memory_bytes: 2040
#include<stdio.h>
#include<iostream>
using namespace std;

int main(){
    int a,b,c;
    
    scanf("%d %d %d",&a,&b,&c);
    
    c=c-b;
    b=b-a;
    
    if(c>0 && b>0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3168
#include<stdio.h>
#define N 50

int main(void)
{
  int m[N], f[N], r[N], score[N] = {0};
  int i, cnt = 0;

  for(i = 0; i < N; i++) {
    scanf("%d %d %d", &m[i], &f[i], &r[i]);
    if(m[i] == -1 && f[i] == -1 && r[i] == -1) {
      break;
    }
    score[i] = m[i] + f[i];
    cnt++;
  }

  char res[cnt];

  for(i = 0; i < cnt; i++) {
    if(m[i] == -1 || f[i] == -1) printf("F\n");
    else if(score[i] < 30) printf("F\n");
    else if(score[i] >= 30 && score[i] < 50 && r[i] < 50) printf("D\n");
    else if(score[i] >= 30 && score[i] < 50 && r[i] >= 50) printf("C\n");
    else if(score[i] >= 50 && score[i] < 65) printf("C\n");
    else if(score[i] >= 65 && score[i] < 80) printf("B\n");
    else printf("A\n");
  }

  return 0;
}

Measured memory_bytes: 584
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

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

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;

const int N = 1e4 + 10;
bool dp[N];

int main() {
  int n;
  scanf("%d", &n);
  int m = 0;
  dp[0] = true;
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    m += x;
    for (int j = m; j >= x; --j) {
      dp[j] |= dp[j - x];
    }
  }
  int ret = 0;
  for (int i = m; i >= 0; --i) {
    if (i % 10 && dp[i]) {
      ret = max(ret, i);
    }
  }
  printf("%d\n", ret);
  return 0;
}


Measured memory_bytes: 256
D, N = map(int, input().split())

if D == 0:
	if N  == 100:
		print(101)
	else:
		print(N)
elif D == 1:
	if N == 100:
		print(10100)
	else:
		print(N * 100)
else:
	if N == 100:
		print(1010000)
	else:
		print(N * 10000)

Measured memory_bytes: 3060
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

N,A,B = inputIL()
h = inputILs(N)

h.sort()

def count_turn(l,x):
  count = 0
  for i in l:
    count += (i+(x-1))//x
  return count




from bisect import bisect

def is_ok(n):
  h_n = [i-B*n for i in h]
  h_n = h_n[bisect(h_n,0):]
  if n>=count_turn(h_n,A-B):
    return True
  else:
    return False

def meguru_bisect(ng, ok):
  while (abs(ok - ng) > 1):
    mid = (ok + ng) // 2
    if is_ok(mid):
      ok = mid
    else:
      ng = mid
  return ok

ok = h[-1]//B+1
ng = 0
  
print(meguru_bisect(ng, ok))

Measured memory_bytes: 158624
#include <iostream>
#include <vector>
#include <cstdlib>  
#include <algorithm>
#include <string>

using namespace std;
 
int main() {
    double a ;
    cin >>a;
    int gu;
    if(gu%2 == 0) gu = a/2;
    else gu = a/2-1;
    cout<<(a-gu)/a;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 


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

    vector< vector<int> > orders(N);
    for (int i = 0; i < N; ++i) {
        orders[i].resize(N-1);
        for (int j = 0; j < N-1; ++j) {
            cin >> orders[i][j];
            --orders[i][j];
        }
        reverse(orders[i].begin(), orders[i].end());
    }

    set<int> checkTarget;
    for (int i = 0; i < N; ++i) {
        checkTarget.insert(i);
    }

    int r = N * (N-1) / 2;
    int d = 0;
    while (0 < r) {
        ++d;
        set<int> bookedPlayers;
        for (int i : checkTarget) {
            if (!orders[i].empty() && bookedPlayers.find(i) == bookedPlayers.end()) {
                int o = orders[i].back();
                if (bookedPlayers.find(o) == bookedPlayers.end()) {
                    if (orders[o].back() == i) {
                        bookedPlayers.insert(i);
                        bookedPlayers.insert(o);
                        orders[i].pop_back();
                        orders[o].pop_back();
                        --r;
                    }        
                }
            }
        }
        if (bookedPlayers.empty()) {
            d = -1;
            r = -1;
        } else {
            checkTarget.swap(bookedPlayers);
        }
    }

    cout << d << endl;

    return 0;
}


Measured memory_bytes: 4224
#include<iostream>
using namespace std;
int main(){
  int h,u;cin>>h>>u;
  string board[50];
  for(int i=0;i<h;i++)cin>>board[i];
  int dx[8]={1,0,-1,0,1,-1,-1,1};
  int dy[8]={0,1,0,-1,1,1,-1,-1};
  for(int i=0;i<h;i++){
    for(int j=0;j<u;j++){
      if(board[i][j]=='#')continue;
      int num=0;
      for(int d=0;d<8;d++){
        int ni=i+dy[d];
        int nj=j+dx[d];
        if(ni<0 or h<=ni)continue;
        if(nj<0 or u<=nj)continue;
        if(board[ni][nj]=='#')num++;
      }
      board[i][j]=char(num+'0');
    }
  }
  for(int i=0;i<h;i++)cout<<board[i]<<endl;
  return 0;
}


Measured memory_bytes: 256
#pragma region Macros
#include <bits/stdc++.h>
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll;
#pragma endregion
int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);

	int N, M;
	cin >> N >> M;

	if (N == M)
	{
		cout << "Yes" << '\n';
	}
	else
	{
		cout << "No" << '\n';
	}


	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cassert>
#include <bitset>
using namespace std;
typedef long long LL;

int main(void)
{
	int n;
	scanf("%d", &n);
	printf("%d\n", n * 32);
	return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define show(x) cout << #x << " = " << x ln
#define dbg(x) cout<<#x"="<<x ln

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

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int a, b;

int main() {
	cin >> a >> b;
	if (a%3==0 || b%3==0 || (a+b)%3==0) cout << "Possible" << ln;
	else cout << "Impossible" << ln;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <algorithm>
#include <set>
#include <string>
#include <queue>

using namespace std;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i) ++)

typedef long long ll;

int main(void){
    ll N, A, B, C, D;
    cin >> N >> A >> B >> C >> D ;
    rep(i, N){
        ll r = D * i - C * (N - 1 - i);
        ll l = C * i - D * (N - 1 - i);
        if(B - A <= r && l <= B - A){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;

    return 0;
}


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

//Union Find tree
struct UnionFind {
    vector<int> par;//parent of node
    vector<int> size;//element count

    //constructor
    UnionFind(int N) {
        par.resize(N);
        size.resize(N);
        for(int i = 0; i < N; i++) {
            par[i] = i;
            size[i] = 1;
        }
    }

    int root(int x){
        if(x == par[x])return x;
        return par[x] = root(par[x]);
    }
    
    void unite(int x, int y){
        if(root(x) == root(y)){
            return;
        }

        size[root(y)] += size[root(x)];
        par[root(x)] = root(y);
    }
    
    bool same(int x, int y){
        return root(x) == root(y);
    }

    int getSize(int x){
        return size[root(x)];
    }
};

int main(){
    long long N,M;

    cin >> N >> M;

    int A[M],B[M];
    for (int i = 0; i < M; i++) {
        cin >> A[i] >> B[i];
        A[i]--;
        B[i]--;
    }

    UnionFind uf(N);
    long long ans[M];
    ans[M-1] = N * (N-1) / 2;
    for(int i = M-1; i > 0; i--) {
        ans[i-1] = ans[i];
        if(!uf.same(A[i],B[i])){
            ans[i-1] = ans[i] - (uf.getSize(A[i]) * uf.getSize(B[i]));
            uf.unite(A[i],B[i]);
        }
    }

    for(int i = 0; i < M; i++) {
        cout << ans[i] << endl;
    }
    
    return 0;
}

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

using namespace std;

/*-------------------------------*/
#define FOR(i, a, b) for(int i = (a); i < (b); i++)  //a~(b - 1)?????§
#define all(i) (i).begin(),(i).end() //??¨??????(sort??¨???)
#define mp make_pair //mp(OO, OO)??¨???:::pint??¨???

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef vector<long long> llv;
typedef vector<pint> vpint;
/*-------------------------------*/

int main(void)
{
  int n; cin >> n;
  int dp[45] = {};
  dp[0] = 1; dp[1] = 1;

  FOR(i, 2, 45){
    dp[i] = dp[i - 1] + dp[i - 2];
  }
  cout << dp[n] << endl;
  return 0;
}

Measured memory_bytes: 1160
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;

import static java.lang.Math.max;




public class Main {

  

    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        Map<String,Integer> map = new HashMap<>();
        map.put("AC",0);
        map.put("WA",0);
        map.put("TLE",0);
        map.put("RE",0);

        while(n-->0){

            String word = sc.next();
            map.put(word,map.get(word)+1);

        }
        System.out.println("AC "+"x "+map.get("AC"));
        System.out.println("WA "+"x "+map.get("WA"));
        System.out.println("TLE "+"x "+map.get("TLE"));
        System.out.println("RE "+"x "+map.get("RE"));
    }

}

Measured memory_bytes: 58088
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    ll W,H,x,y;
    int hantei=0;
    cin >> W >> H >> x >> y;
    if(W == x*2 && H == y*2) hantei =1;
    cout << fixed << setprecision(10) << W*H/2.0 << " " << hantei << endl;
}

Measured memory_bytes: 256