akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
  ll n;
  cin>>n;
  ll v[n];
  ll s=-1;
  for(ll i=0;i<n;i++){
    cin>>v[i];
    if(s==-1)
      s=v[i];
    else
      s=s^v[i];
  }
  ll a[n];
  for(ll i=0;i<n;i++)
    cout<<(s^v[i])<<" ";
  cout<<"\n";
}


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

signed main(){
string a,b;cin>>a>>b;
  a+=a;
  for(int i=0;i<b.length();i++){
    for(int j=0;j<b.length();j++){
    if(b[j]!=a[i+j])goto l;
    }
    puts("Yes");
    return 0;
    l:;
    }
  puts("No");
}


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

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <math.h>
#include <map>
#include <stack>
using namespace std;
static const int INF = 1e9+7;
// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (int i =a; i < b; i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define PI 3.14159265359

int main(){
    int n; cin >> n;
    vector<double> x(n);
    vector<string> u(n);

    double ans = 0.00000000;
    rep(i,n){
        cin >> x[i] >> u[i];
        if(u[i] == "JPY"){
            ans += x[i];
        }else{
            ans += x[i] * 380000.0;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3788
#include<iostream>
#include<cstdio>
#include<algorithm>
typedef long long ll;
const int N=2e5+5;
int n,a[N],f[N];
ll k;
int main() {
    scanf("%d%lld",&n,&k);
    for(int i=1;i<=n;i++) scanf("%d",a+i);
    std::sort(a+1,a+1+n);
    for(int i=1;i<=n;i++) scanf("%d",f+i);
    std::sort(f+1,f+1+n,std::greater<int>());
    ll l=0,r=1e12+2,mid;
    auto check=[&](ll x) {
        ll tot=k;
        for(int i=1;i<=n;i++) {
            tot-=std::max(0LL,a[i]-x/f[i]);
            if(tot<0) return false;
        }
        return true;
    };
    while(l<r) {
        mid=(l+r)>>1;
        if(check(mid)) r=mid;
        else l=mid+1;
    }
    printf("%lld",r);
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
int counter1,counter2;
counter1=0;
counter2=0;
int b;
int c=0;
int k=0;
int H,W; cin>>H>>W;
int counter=W+H+10;
int count=-1;
char a[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cin>>a[i][j];}}
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
if(a[i][j]=='#'){
counter1++;
}}}
if(W+H-1==counter1){
cout<<"Possible"<<endl;}
else{
cout<<"Impossible"<<endl;}}


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

int main(){
    int H,W;
    cin>>H>>W;
    vector<string> a(H);
    for (int i=0;i<H;i++){
        cin>>a.at(i);
    }
    
    for(int i=0;i<W+2;i++){
        cout<<'#';
    }
    cout<<endl;
    for(int i=0;i<H;i++){
        cout<<'#'<<a.at(i)<<'#'<<endl;
    }
    for(int i=0;i<W+2;i++){
        cout<<'#';
    }
    cout<<endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
using namespace std;
const int mod=1000000007;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    bool flg=true;
    rep(i,0,n-1){
        cin >> a[i];
        if((i+1)!=a[i])flg=false;
    }
    if(flg){
        puts("0");
        return 0;
    }
    int cnt = 1;
    rep(i,0,n-1){
        if(a[i]==cnt)cnt++;
    }
    cnt--;
    if(cnt==0){
        puts("-1");
        return 0;
    }
    int ans = n-cnt;

    // int l=0,r=n;
    // while(r-l >1){
    //     int c = (r-l)/2;
    //     int k = n - c;
    //     int cnt = 1;
    //     rep(i,0,n-1){

    //     }
    // }

    cout << ans << endl;
//  printf("%.10f\n",ans);

    return 0;
}

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

mp = {}
for f in range(2, 1000000):
    while n % f == 0:
        mp[f] = 1 if f not in mp else mp[f] + 1
        n //= f
if n > 1:
    mp[n] = 1

def fn(x):
    for i in range(2, 100):
        sm = i*(i+1)//2
        if x < sm:
            return i - 1

#print(mp)
#print({p:fn(mp[p]) for p in mp})
print(sum(fn(mp[p]) for p in mp))


Measured memory_bytes: 9200
n = int(input())
a = list(map(int, input().split()))
max_a = 2 ** 20
MOD = 10 ** 9 + 7

ru = [0] * (n + 1)
for i in range(n):
    ru[i + 1] = ru[i] ^ a[i]


if ru[-1] != 0:
    # 0, ru[-1], 0, ru[-1], 0, ..., ru[-1]
    dp = [0] * (max_a)
    dp[0] = 1
    tot_ex0 = 0
    for i in range(n):
        if i == n - 1:
            print(dp[0])
            exit()
        if ru[i + 1] == 0:
            dp[0] += tot_ex0
            dp[0] %= MOD
        elif ru[i + 1] == ru[-1]:
            dp[ru[i + 1]] += dp[0]
            dp[ru[i + 1]] %= MOD
            tot_ex0 += dp[0]
            tot_ex0 %= MOD
else:
    # 0, x, 0, x, 0, x, ..., 0 (x != 0)
    dp = [0] * max_a
    dq = [1] * max_a
    set_evaled = [0] * max_a
    times = 0
    ans = 0
    for i in range(n):
        if i == n - 1:
            ans = sum(dp)
            break
        elif ru[i + 1] == 0:
            # これを遅延評価する
            # for j in range(max_a):
            #     dq[j] += dp[j]
            times += 1
        else:
            dq[ru[i + 1]] += (times - set_evaled[ru[i + 1]]) * dp[ru[i + 1]]
            dq[ru[i + 1]] %= MOD
            set_evaled[ru[i + 1]] = times
            dp[ru[i + 1]] += dq[ru[i + 1]]
            dp[ru[i + 1]] %= MOD
    # 0, 0, 0, 0, 0, 0, ..., 0
    cnt_0 = sum([1 for i in range(n) if ru[i + 1] == 0])
    ans = (ans + pow(2, cnt_0 - 1, MOD)) % MOD
    print(ans)

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

using namespace std;

#define REP(i, n) for (int i=0; i<(n); ++i)
#define RREP(i, n) for (int i=(int)(n)-1; i>=0; --i)
#define FOR(i, a, n) for (int i=(a); i<(n); ++i)
#define RFOR(i, a, n) for (int i=(int)(n)-1; i>=(a); --i)

#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl;

template<class T>
ostream &operator<<(ostream &os, const vector <T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

template<class T, class U>
ostream &operator<<(ostream &os, const pair <T, U> &p) {
    return os << "(" << p.first << " " << p.second << ")";
}

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

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<int, int>;

using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;

const ll MOD = 1e9 + 7;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
const ld eps = 1e-9;


int main() {

    ll n; cin >> n; --n;

    ll tmp = 1;
    string ans;
    FOR(k, 1, 100) {
        tmp *= 26;
        if (n - tmp >= 0) {
            n -= tmp;
            continue;
        }
        REP(l, k) {
            ans += (n % 26) + 'a';
            n /= 26;
        }
        break;
    }

    reverse(ALL(ans));
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3540
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i< (n); i++)
using namespace std;
 
int main() {
  long long A, B, K;
  cin >> A >> B>> K;
  
  A = A - K;
  if (A < 0){
  	B = B + A;
    A = 0;
    if(B<0){
      B = 0;
    }
  }
    
  cout<<A<<" "<<B<<endl;
}

Measured memory_bytes: 256
using System;

public class Hello
{
    public static void Main()
    {
        Console.ReadLine().Trim();
        var s = Console.ReadLine().Trim();
        var s2 = s.Replace(" ", "");
        Console.ReadLine().Trim();
        var t = Console.ReadLine().Trim();
        var t2 = t.Replace(" ", "");
        Console.WriteLine(t2.CompareTo(s2) == 1 ? 1 : 0);
    }
}


Measured memory_bytes: 10004
#include<bits/stdc++.h>
using namespace std;
#define ll long long int

int main() {
    int N, ans=0;
    string s, t;
    cin >> s;

    char c = s[s.size()-1];


    if(c=='2' || c=='4' || c=='5' || c=='7' || c=='9')
	t="hon";
    else if(c == '3')
	t="bon";
    else
	t="pon";
	    

    cout << t << endl;
} 




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

typedef long long ll;

int main() {
    int H, W;
    int ans = 0;
    cin >> H >> W;
    vector<string>S(H);
    for (int i = 0; i < H; i++) {
        cin >> S[i];
    }
    int L[H][W];
    int R[H][W];
    int D[H][W];
    int U[H][W];
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            L[i][j] = 0;
            R[i][j] = 0;
            D[i][j] = 0;
            U[i][j] = 0;
        }
    }

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (S[i][j] == '#') {
                L[i][j] = 0;
                D[i][j] = 0;
            } else {
                if (j == 0) {
                    L[i][j] = 1;
                } else {
                    L[i][j] = L[i][j-1] + 1;
                }
                if (i == 0) {
                    D[i][j] = 1;
                } else {
                    D[i][j] = D[i-1][j] + 1;
                }
            }
        }
    }
    for (int i = H-1; i >= 0; i--) {
        for (int j = W-1; j >= 0; j--) {
            if (S[i][j] == '#') {
                R[i][j] = 0;
                U[i][j] = 0;
            } else {
                if (j == W-1) {
                    R[i][j] = 1;
                } else {
                    R[i][j] = R[i][j+1] + 1;
                }
                if (i == H-1) {
                    U[i][j] = 1;
                } else {
                    U[i][j] = U[i+1][j] + 1;
                }
            }
        }
    }

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            ans = max(ans, R[i][j]+L[i][j]+D[i][j]+U[i][j]-3);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 66944
// finish date: 2018/03/25

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vvd vector<vector<double>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define bigmod 1000000007
#define INF 1050000000
#define pii pair<int,int>


int main() {
    vi val(3);
    cin >> val[0] >> val[1] >> val[2];
    sort(val.begin(), val.end());
    int ans = 0;
    ans += (val[2] - val[0]) / 2;
    ans += (val[2] - val[1]) / 2;
    if (val[0] % 2 == val[1] % 2 && val[1] % 2 == val[2] % 2) {
        cout << ans << endl;
    } else if (val[2] % 2 != val[0] % 2 && val[2] % 2 != val[1] % 2) {
        cout << ans + 1 << endl;
    } else {
        cout << ans + 2 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iterator>

using namespace std;

int main(){
	int h, w;
	cin >> h >> w;
	vector<string> s(h);
	copy_n(istream_iterator<string>(cin), h, s.begin());
	for(int i = 0; i < w + 2; ++i){
		cout << '#';
	}
	cout << endl;
	for(int i = 0; i < h; ++i){
		cout << '#' << s[i] << '#' << endl;
	}
	for(int i = 0; i < w + 2; ++i){
		cout << '#';
	}
	cout << endl;
	return 0;
}

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

using namespace std;

void solve(void)
{
	string s;
	cin >> s;
	sort(s.begin(), s.end());
	if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3])
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


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

int main() {
	int a, b;
	cin >> a >> b;
	int loop = (b - a);
	int res = 0;
	for (int i = 1;i <loop;++i) {
		res += i;
	}
	int ans = res - a;
	cout << ans << endl;
	return 0;
}


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

typedef long long ll;
typedef pair<int,int> pri;
const int INF = 1e9 + 7;
const ll LINF = 1LL<<61;

int n, f[10][10];
ll ans;

int main(){
	scanf("%d",&n);
	for(int i = 1; i <= n; i++){
		int x = i;
		while(x>=10) x /= 10;
		++f[x][i%10];
	}
	for(int i = 1; i <= n; i++){
		int x = i;
		while(x >= 10) x /= 10;
		ans += f[i%10][x];
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

import static java.util.stream.Collectors.toList;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.nextLine();
        List<Integer> nums = Arrays.stream(sc.nextLine().split(" ")).map(Integer::valueOf).collect(toList());
        Set<Integer> visited = new HashSet<>(nums.size());

        for (Integer i : nums) {
            if (visited.contains(i)) {
                System.out.println("NO");
                return;
            } else {
                visited.add(i);
            }
        }

        System.out.println("YES");
    }
}

Measured memory_bytes: 66592
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <stdbool.h>
#define inf 1000000007

int main(void) {
	// your code goes here
	int n,i,k,j,l,max=0;
	char s[102];
	scanf("%d %s",&n,s);
	for(i=0;i<n;i++){
		int maxkari=0;
		for(j=0;j<=25;j++){
			int left=0;
			int right=0;
			for(k=0;k<=i;k++){
				if(s[k]=='a'+j) left=1;
			}
			for(k=i+1;k<n;k++){
				if(s[k]=='a'+j) right=1;
			}
			if(left==1&&right==1) maxkari++;
		}
		if (max<maxkari) max=maxkari;
	}
	printf("%d\n",max);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
 #define rep(i, n) for (int i = 0; i < (int)(n); i++)
 #define big 1000000007
 #define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
int main(){
    int k,t;
    cin>>k>>t;
    vector<int> a(t);
    rep(i,t){
        cin>>a[i];
    }
    all(a);
    Re(a);
    int ans = a[0]-1;
    for(int i=1;i<t;i++){
        ans -= a[i];
    }
    cout<<max(0,ans)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

#define ll long long
#define ldb long double
#define db double
#define str string

#define fr first
#define se second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define mp make_pair

#define pi pair<int,int>
#define pll pair<ll,ll>
#define pdb pair<db,db>
#define pldb pair<ldb,ldb>

#define vi vector<int>
#define vll vector<ll>
#define vdb vector<db>
#define vldb vector<ldb>
#define vpi vector< pi >
#define vpll vector< pll >

#define mi map<int,int>
#define mll map<ll,ll>
#define mdb map<db,db>
#define mldb map<ldb,ldb>


#define forr(i,a,b) for (int i = (a); i < (b); ++i)
#define rrof(i,a,b) for (int i = (b)-1; i >= (a); --i)


const int MOD = 1e9+7;
const ldb PI = 4*atan((ldb)1);

ll power(ll a,ll n){
	ll res=1;

	while(n){
		if(n%2)
		res*=a;
		a*=a;
		n/=2;
	}
	
	return res;
}

int main(){
	fast;
	
	int n,k;
	cin>>n>>k;
	
	ll int h[n];
	forr(i,0,n)
	cin>>h[i];	
	
	sort(h,h+n);
	ll int sum=0,l=0;
	
	for(int i=n-1;i>=0;i--){
		if(l<k)
		l++;
		
		else{
			sum+=h[i];
		}
	}	
	
	cout<<sum;	
	return 0;
}


Measured memory_bytes: 1792
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    if((a==5&&
       b==5&&
       c==7 )||(a==7&&
                b==5&&
                c==5)||(a==5&&
                        b==7&&
                        c==5)){
      System.out.println( "YES" );}
  else{System.out.println( " NO " );}
  }
}

Measured memory_bytes: 21716
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
d = sum(b)
for i in range(N-1):
  if a[i+1] - a[i] == 1:
    d += c[a[i]-1]
print(d)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define vv vector
#define pp pair
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define fastio                    \
	ios_base::sync_with_stdio(0); \
	cin.tie(0);
typedef pair<ll, ll> pll;
typedef vv<ll> vll;
typedef vv<pll> vpll;
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
//adds two more functions to set
//(1)*(set.find_by_order(k))[kth element in the sorted set]
//(2)set.order_of_key(k)[count of elements strictly less than k]
#define LG(args...)                               \
	{                                             \
		string _s = #args;                        \
		replace(_s.begin(), _s.end(), ',', ' ');  \
		stringstream _ss(_s);                     \
		err(istream_iterator<string>(_ss), args); \
		cerr << endl;                             \
	}
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << "(" << *it << ":" << a << ") ";
	err(++it, args...);
}
//:::::::::::::::::::::::::::::::::::::::::::::
const ll INF = 9e18;
const ll MOD = 1e9 + 7;
// #define dbg

int main(){
	fastio;
	ll h1, m1, h2, m2, k;
	cin>>h1>>m1>>h2>>m2>>k;
	ll ans = 
		60*(h2 - h1) + m2 - m1 - k;
		cout<<max(ans, 0ll);
}

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

int main(){
  int N;
  cin >> N;
  
  if(N % 2 == 0){
    cout << 0.5;
  }
  else{
    float n = N;
    float ans = (((n-1)/2)+ 1)/n;
   cout << ans;
  }
}

Measured memory_bytes: 256
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<string>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,a,b) for (int i=a; i<=b; i++)
#define per(i,a,b) for (int i=a; i>=b; i--)
using namespace std;
typedef long long LL;
   
inline int read() {
	int x=0,f=1; char ch=getchar();
	while (!(ch>='0'&&ch<='9')) {if (ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9') {x=x*10+(ch-'0'); ch=getchar();}
	return x*f;
}

const int N = 500010;

int n,q,D,d[N],A[N],B[N],ans[N];//What we ONLY need to judge is just a bounder -> B[i] the minimum dis if we don't want to reach the goal
   
int main() {
	
	#ifndef ONLINE_JUDGE
	//	freopen("data.in","r",stdin);
	//	freopen("data.out","w",stdout);
	#endif
	
	n=read(),D=read(); A[0]=D;
	rep(i,1,n) d[i]=read();
	int dis=D;
	rep(i,1,n) A[i]=dis=min(dis,abs(dis-d[i]));
	B[n]=1; if (A[n-1]>=B[n]) ans[n]=1;
	per(i,n-1,1) {
		if (B[i+1]<=d[i+1]/2) B[i]=B[i+1];
		else B[i]=B[i+1]+d[i+1];
		if (A[i-1]>=B[i]) ans[i]=1;
	}
	int Q=read();
	while (Q--) {
		int x=read();
		if (ans[x]) puts("YES"); else puts("NO");
	}
	
	return 0;
}

Measured memory_bytes: 9728
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
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,k;
  cin>>n>>k;

  if(n==2){
    if(k==0){
      cout<<1<<endl;
      cout<<1<<" "<<2<<endl;
      return 0;
    }else{
      cout<<-1<<endl;
      return 0;
    }
  }

  std::vector<int> u,v;
  for(int i=2;i<=n;i++){
    u.push_back(1);
    v.push_back(i);
  }
  int count=(n-2)*(n-1)/2;
  if(count<k){
    cout<<-1<<endl;
    return 0;
  }
  int l=2;
  int r=3;
  while(count>k){
    if(r>n){
      l++;
      r=l+1;
    }
    if(l>=n){
      break;
    }
    u.push_back(l);
    v.push_back(r);
    r++;

    count--;
  }
  if(count!=k){
    cout<<-1<<endl;
    return 0;
  }else{
    cout<<u.size()<<endl;
    for(int i=0;i<u.size();i++){
      cout<<u[i]<<" "<<v[i]<<endl;
    }
  }


  return 0;
}


Measured memory_bytes: 384
/******************************************************************************

                            Online C Compiler.
                Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/


#include <bits/stdc++.h>
using namespace std;
#define long long int



int main()
{
    int q=1;
   // cin>>q;
    while(q--)
    {
        int n; 
        cin>>n;
        int a[n+1];
        for(int i=1; i<=n; i++)
    cin>>a[i];
  int dp[n+1];
  dp[1]=0;
  dp[2]=abs(a[2]-a[1]);
  
  for(int i=3; i<=n; i++)
    dp[i]=min(dp[i-2]+abs(a[i]-a[i-2]),dp[i-1]+abs(a[i]-a[i-1]));
  cout<<dp[n];
    }
}


Measured memory_bytes: 1024
def display():
    s = input()
    out = []
    final = ''

    for i in range(len(s)):
        key = s[i]

        if key == '0':
            out.append('0')
        if key == '1':
            out.append('1')
        if key == 'B':
            if len(out) > 0:
                out.pop()
        
    for i in range(len(out)):
        final = final + out[i]
    
    print(final)

            

display()

Measured memory_bytes: 8984
#include <cstdio>
using namespace std;
 
const int maxn=4005;
 
int n,a,b,top;
int sta[maxn];
bool ans[maxn];
 
int read() {
    int x=0,f=1;char ch=getchar();
    for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=-1;
    for(;ch>='0'&&ch<='9';ch=getchar())x=x*10+ch-'0';
    return x*f;
}
 
int main() {
    a=read(),b=read(),n=a+b;
    if(a<=b) {puts("Impossible");return 0;}
    for(int i=1;i<=n;i++)
        if(!top)sta[++top]=i;
        else {
            printf("? %d %d\n",sta[top]-1,i-1);
            fflush(stdout);char s[3];
            scanf("%s",s+1);
            if(s[1]=='N')top--;
            else sta[++top]=i;
        }
    int honest=sta[top];
    for(int i=1;i<=n;i++) {
        printf("? %d %d\n",honest-1,i-1);
        fflush(stdout);char s[3];
        scanf("%s",s+1);
        ans[i]=(s[1]=='Y');
    }printf("! ");
    for(int i=1;i<=n;i++)
        printf("%d",ans[i]);
    return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <cstdio>
#include <map>
#include <set>
#include <utility>
#include <string>
#include <functional>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;




int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    ld md = 0, cur;
    int tot = 0, s = 0;
    set<int> water_st, sugar_st;
    int i, j;
    for(i = 0; i <= f; i++) {
        for(j = 0; j <= f; j++) {
            water_st.insert(100 * a * i + 100 * b * j);
            sugar_st.insert(c * i + d * j);
        }
    }

    for(i = 1; i <= f; i++) {
        for(j = 0; j <= i; j++) {
            int water = i - j;
            if(j * 100 <= water * e && water_st.count(water) != 0 && sugar_st.count(j) != 0) {
                cur = j / (ld)i;
                if(cur >= md) {
                    tot = i;
                    s = j;
                    md = cur;
                }
            }

        }
    }

    cout << tot << " " << s;


    return 0;
}



Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long inf=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)
#define ZERO(a) memset(a,0,sizeof(a))





//3111111111111111111111111111111

	int gcd(int a, int b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
	int findGCD(int arr[], int n) 
{ 
    int result = arr[0]; 
    for (int i = 1; i < n; i++) 
    { 
        result = gcd(arr[i], result); 
  
        if(result == 1) 
        { 
           return 1; 
        } 
    } 
    return result;
	 
}
int findMaxGCD(int arr[], int n) 
{ 
    int high = 0; 
    for (int i = 0; i < n; i++) 
        high = max(high, arr[i]); 
  
    int count[high + 1];
	ZERO(count);
    for (int i = 0; i < n; i++) 
        count[arr[i]]++; 
  
    int counter = 0; 
    for (int i = high; i >= 1; i--) 
    { 
        int j = i; 
       counter = 0; 
    
        while (j <= high) 
        { 
  
            if(count[j] >=2) 
               return j; 
  
           else if (count[j] == 1)          
                counter++;          
  
            j += i; 
  
            if (counter == 2)          
                return i; 
        } 
    } 
} 
	void solve(){
		

		ini(n);
		int a[n];

		FOR(i,0,n){
			in(a[i]);
		}
		int gcd1 = findGCD(a,n);
		int gcd2 = findMaxGCD(a,n);
		// out(gcd1,gcd2);
		if(gcd2 == 1){
			return out("pairwise coprime");
		}
		else{
			if(gcd1 == 1){
			return out("setwise coprime");
				
			}
			else{
				return out("not coprime");
			}
		}

		
		
			
			
			


				
		


		
		
		
		

		


		
		
	}



	



















int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}


Measured memory_bytes: 19192
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double r = sc.nextDouble();
        double pi =Math.PI;
        double area = r*r*pi;
        double length = 2*r*pi;
        System.out.printf("%f %f",area,length);
        sc.close();
    }
}


Measured memory_bytes: 28308
import java.util.Scanner;

class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		int[] c = new int[n];
		int ans = 0;

		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		for(int i = 0; i < n; i++) {
			b[i] = sc.nextInt();
		}
		for(int i = 0; i < n-1; i++) {
			c[i] = sc.nextInt();
		}

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

		for(int i = 0; i < n - 1; i++){
			if((a[i] + 1) == a[i + 1]){
				ans += c[a[i] - 1];
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
int main(){
        long long int n; cin >> n;
        map<string, long long int> mp;
        for (long long int x = 0; x < n; ++x){
            string s; cin >> s;
            sort(s.begin(), s.end());
            mp[s]++;
        }
        long long int ans = 0;
        for (auto x : mp){
            long long int q = x.second;
            q = q * (q - 1) / 2;
            ans += q;
        }
        cout << ans << endl;
    return 0;
}

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

int main() {
	char a[4];
	for (int i = 0; i < 4;i++)cin >> a[i];
	if (a[0] == a[1]) {
		if (a[0] != a[2] && a[2] == a[3]) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	else if (a[0] == a[2]) {
		if (a[0] != a[1] && a[1] == a[3]) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	else if (a[0] == a[3]) {
		if (a[0] != a[2] && a[1] == a[2]) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 100000007
#define SIZE 10005
#define PI 	3.14159265358979323846


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a=0,b=0,c=99999;
    REP(i,5){
        cin >> b;
        a = max(a,b);
        c = min(c,b);
    }
    cin >> b;
    cout << ((a-c<=b)?"Yay!":":(") << endl;
}

Measured memory_bytes: 256
MOD = 10**9 + 7
S = input()
d = "ABC".index
s = [0]*4
s[0] = 1
for c in S:
    if c == "?":
        s = [s[0]*3, s[1]*3 + s[0], s[2]*3 + s[1], s[3]*3 + s[2]]
        for i in range(4):s[i] %= MOD
    else:
        i = d(c)
        s[i+1] += s[i] % MOD
print(s[3] % MOD)


Measured memory_bytes: 42092
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if(a < b){
            if(b < c){
            System.out.printf("%d %d %d\n",a,b,c);
        }else if(a < c){
            System.out.printf("%d %d %d\n",a,c,b);
        }else{
            System.out.printf("%d %d %d\n",c,a,b);
        }
    }else{
        if(b < c){
            System.out.printf("%d %d %d\n",b,c,a);
        }else if(a < c){
            System.out.printf("%d %d %d\n",b,a,c);
        }else{
            System.out.printf("%d %d %d\n",c,b,a);
        }
    }
    }
}


Measured memory_bytes: 26304
#include<stdio.h>

int main(void){
	int n,m,i,j,k;
	int flg=0;
	scanf("%d%d%d",&n,&m,&k);
	
	if(k%n==0 || k%m==0) puts("Yes");
	else{
		flg=0;
		for(i=1;i<n;i++){
			for(j=1;j<m;j++){
				if((n-i)*j+i*(m-j)==k){
					//printf("pat1:i=%d, j=%d\n",i,j);
					flg=1;
					break;
				}else continue;
			}
			if(flg) break;
		}
		if(!flg){
			for(i=1;i<m;i++){
				for(j=1;j<n;j++){
					if((m-i)*j+i*(n-j)==k){
						//printf("pat2:i=%d, j=%d\n",i,j);
						flg=1;
						break;
					}else continue;
				}
				if(flg) break;
			}
		}
		if(flg) puts("Yes");
		else puts("No");
	}
	return 0;
}

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

 int main(){
    vector<vector<int>> c(3,vector<int>(3));
    vector<int> an(3);
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin >> c.at(i).at(j);
        }
    }
    an.at(0)=c[0][0]+c[1][1]+c[2][2];
    an.at(1)=c[0][1]+c[1][2]+c[2][0];
    an.at(2)=c[0][2]+c[1][0]+c[2][1];
    if(an.at(0)==an.at(1) && an.at(1)==an.at(2)){
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
 }

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int n, l ; 
  cin >> n >> l;
  long long int total = l * n + (n-1) * n /2;
  long long int apple, residual, tmp = 1000000, tmp_apple = 10000000;
  for(int i=1; i<=n; i++){
    // 自分が食べるリンゴの味
    apple = l + i -1; 
    residual = total - apple;
    if (abs(total - residual) < tmp){
      tmp = abs(total - residual);
      tmp_apple = apple;
    }
  }
  cout << total - tmp_apple << endl;
  return 0;
}
      

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.text.DecimalFormat;

public class Main{


    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        DecimalFormat df = new DecimalFormat("0.########");
        int a, b, d, r;
        double f;
        String[] st = br.readLine().split(" ");
        a = Integer.parseInt(st[0]);
        b = Integer.parseInt(st[1]);
        d = a / b;
        r = (a - ((a / b) * b));
        f = (double) a / b;
        bw.append(d + " " + r + " " + df.format(f) + "\n");
        bw.flush();
    }
}


Measured memory_bytes: 26120
#include <bits/stdc++.h>
using namespace std;
int inf = numeric_limits<int>::infinity();
 
int main(){
    int N;
    cin >> N;
    vector<int> h(N);
 
    for(int i=0; i<N; i++){
        cin >> h[i];
    }

    // init dp table
    vector<int> dp(N, inf);
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);

    for(int i=2; i<N; i++){
        dp[i] = min(dp[i-2] + abs(h[i] - h[i-2]), dp[i-1] + abs(h[i] - h[i-1]));
    }

    // 添字注意．
    cout << dp[N-1] << endl;

    return 0;
}

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

#define INF 1000000000LL

using namespace std;
using ll = long long int;

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

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  ll R; cin >> R;

  cout << 8.0 * atan(1.0) * (double)R << endl;

  return 0;
}

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

int main(void) {
	int p;
	string s;
	string front;
	string back;
	cin >> s;
	p = s.size();
	p -= 2;
	for (int i = p; i > 0; i -=2) {
		front = s.substr(0, (i / 2));
		back = s.substr((i / 2), (i / 2));
		if (front == back) {
			cout << i << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())
c=0
for i in range(0,A+1):
  Y=X-i*500
  for j in range(0,B+1):
    Y=Y-j*100
    for l in range(0,C+1):
      Y=Y-l*50
      if Y == 0:
        c += 1
        Y=Y+l*50
      else :
        Y = Y + l*50
    else :
      Y = Y+j*100
print(c)
  



Measured memory_bytes: 9100
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		// 計算
		String result = "Yay!";
		if(a > 8 || b > 8) result = ":(";
		
		
		// 出力
		System.out.println(result);
	}
}


Measured memory_bytes: 21844
import math
A, B, H, M = map(int,input().split())
T = 60 * H + M
a = (360 /60/ 12) * T
b = ((360 / 60) * T ) % 360
k = abs(a - b)
if k > 180:
    kakudo = 360 - k
else:
    kakudo = k
X = A ** 2 + B **2 - 2 * A * B * math.cos(math.radians(kakudo)) # 余弦定理
print(X ** (1/2))


Measured memory_bytes: 9508
n,m = map(int,input().split())
food = [0 for i in range(m+1)]
for i in range(n):
    a = input().split()
    for j in range(1,int(a[0])+1):
        food[int(a[j])] += 1
count = 0
for i in food:
    if i == n:
        count += 1
print(count)

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

int main(){
  string S;
  cin>>S;
  for(int i=0;i<S.length()-1;i++){
    if(S.at(i)=='A' && S.at(i+1)=='C'){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 3628
#[allow(unused_imports)]
use std::io::Write;

// {{{
#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}


macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
// }}}

fn main() {
    input! {
        a: usize,
        b: usize,
    }

    let mut v = vec![true; 4];
    v[a] = false;
    v[b] = false;
    let mut ans = 0;
    for i in 1..4 {
        if v[i] {
            ans = i;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
from random import randint

D = int(input())
C = [int(i) for i in input().split()]
S = [[int(i) for i in input().split()] for j in range(D)]

def score_calc(T):
    total = 0
    last = [0] * 26
    for i in range(1, D+1):
        t = T[i-1]
        total += S[i-1][t-1]
        last[t-1] = i
        for j in range(26):
            total -= C[j] * (i - last[j])
    return total

total = 0
last = [0] * 26
ans = []
for i in range(1, D+1):
    score = [0] * 26
    for t in range(26):
        score[t] += S[i-1][t]
        for j in range(26):
            if j != t:
                score[t] -= C[j] * (i - last[j])
    total += max(score)
    last[score.index(max(score))] = i
    ans.append(score.index(max(score))+1)

N = 20000
Q = [[randint(0, (D-1)), randint(0, 25)] for i in range(N)]
for d, q in Q:
    old = ans[d]
    ans[d] = q + 1
    if score_calc(ans) > total:
        total = score_calc(ans)
    else:
        ans[d] = old

for i in range(D):
    print(ans[i])


Measured memory_bytes: 87756
#include <stdio.h>

int main()
{
    int i, n, N, H, count = 0;
    scanf("%d %d",&H ,&N);
    int A[N];
    for(i = 0; i < N; i++){
        scanf("%d",&A[i]);
        count += A[i];
    }
    if(count >= H){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e15;
const int MOD = 1e9 + 7;

signed main() {
	string s;
	cin >> s;
	string ans;
	for (auto i : s) {
		if (i == '0')ans.push_back('0');
		else if (i == '1')ans.push_back('1');
		else {
			if (ans.size() == 0)continue;
			else ans.pop_back();
		}
	}
	cout << ans;
}

Measured memory_bytes: 256
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]


X = int(input())
p = primes(10 ** 5 + 3)
print([i for i in p if i >= X][0])


Measured memory_bytes: 4148
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <list>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <iomanip>
#define INF 2147483647

using namespace std;



int main()
{
	double a, b, C;
	double S, L, h;

	cin >> a >> b >> C;

	S = (a * b * sin(C * M_PI / 180.0)) / 2;
	L = a + b + sqrt(pow(a, 2.0) + pow(b, 2.0) - 2 * a * b * cos(C * M_PI / 180.0));
	h = b * sin(C * M_PI / 180.0);

	cout << fixed << setprecision(8) << S << " " << L << " " << h << endl;
	return (0);
}

Measured memory_bytes: 1340
#include <stdio.h>


int main()
{
	double N;
	long a;
	scanf("%lf",&N);

	if((long)N*100%108==0)a=(long)(N/1.08);
	else a = (long)(N/1.08)+1;//printf("a:%ld\n",a);
	
	if((long)((double)a*1.08)==N)
		printf("%ld\n",a);
	else printf(":(\n");
	
	//printf("%ld\n",(long)((double)a*1.08));
	return 0;
}

Measured memory_bytes: 128
/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/+---test
3 7
---+/
/+---test
4 0
---+/
/+---test
1 100
---+/

void main(string[] args) {
  long K, X;
  readf(" %d %d ", &K, &X);

  const begin = max(X - K + 1, -1000000);
  const end   = min(X + K, 1000001);

  size_t i;
  foreach (v; begin..end) {
    if (i++ != 0) " ".write;
    v.write;
  }
  writeln;
}


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

int main(){
  int n;
  double x1,y1,x2,y2,x3,y3;
  cin>>n;
  for(int i=0;cin>>x1>>y1>>x2>>y2>>x3>>y3||i<n;i++){
    double X,Y,L;
    X= ((y2-y1)*(x1*x1-x3*x3+y1*y1-y3*y3)-(y3-y1)*(x1*x1-x2*x2+y1*y1-y2*y2))/
      (2*(x2-x1)*(y3-y1)-2*(y2-y1)*(x3-x1));
    Y= ((x3-x1)*(x1*x1-x2*x2+y1*y1-y2*y2)-(x2-x1)*(x1*x1-x3*x3+y1*y1-y3*y3))/
      (2*(x2-x1)*(y3-y1)-2*(y2-y1)*(x3-x1));
    L= sqrt((X-x1)*(X-x1)+(Y-y1)*(Y-y1));
    cout<<fixed<<setprecision(3)<<X<<" "<<Y<<" "<<L<<endl;
  }
  return 0;
}

Measured memory_bytes: 1288
import math

def main():
    A, B, H, M = map(int, input().split())
    w_m = math.pi / 30
    w_h = math.pi / 360

    minutes = H * 60 + M
    
    rad_m = w_m * M
    rad_h = w_h * minutes

    rad = abs(rad_m - rad_h)

    c = math.sqrt(A ** 2 + B ** 2 - 2 * A * B * math.cos(rad))

    out = float(c)

    print(out)
main()

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

typedef long long ll;

int values[55][4];
vector <int> ans;
int n, m, q;
ll max_val = 0;

void calculate() {
  ll sum = 0;
  for (int i = 0; i < q; i++) {
    int a = (int)values[i][0];
    int b = (int)values[i][1];
    int c = (int)values[i][2];
    ll d = (ll)values[i][3];
    if (a < ans.size() && b < ans.size()) {
      if (ans[b] - ans[a] == c) {
        sum += d;
      }
    }
  }
  max_val = max(max_val, sum);
}

void generate(int faltan, int value) {
  if (ans.size() > 2) calculate();
  if (faltan == 0) return;
  for (int i = value; i <= m; i++) {
    ans.push_back(i);
    generate(faltan - 1, i);
    ans.pop_back();
  }
}


int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> q;
  for (int i = 0; i < q; i++) {
    cin >> values[i][0] >> values[i][1] >> values[i][2] >> values[i][3];
  }
  ans.push_back(-1);
  generate(n, 1);
  cout << max_val << '\n';
  return 0;
}

Measured memory_bytes: 3652
/************************************************
 * Au: Hany01
 * Prob: speech
 * Email: hany01dxx@gmail.com & hany01@foxmail.com
 * Inst: Yali High School
************************************************/

#include<bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
#define Rep(i, j) for (register int i = 0, i##_end_ = (j); i < i##_end_; ++ i)
#define For(i, j, k) for (register int i = (j), i##_end_ = (k); i <= i##_end_; ++ i)
#define Fordown(i, j, k) for (register int i = (j), i##_end_ = (k); i >= i##_end_; -- i)
#define Set(a, b) memset(a, b, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define X first
#define Y second
#define PB(a) push_back(a)
#define MP(a, b) make_pair(a, b)
#define SZ(a) ((int)(a).size())
#define ALL(a) a.begin(), a.end()
#define INF (0x3f3f3f3f)
#define INF1 (2139062143)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define y1 wozenmezhemecaia

template <typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }

template <typename T> inline T read() {
	static T _, __; static char c_;
    for (_ = 0, __ = 1, c_ = getchar(); c_ < '0' || c_ > '9'; c_ = getchar()) if (c_ == '-') __ = -1;
    for ( ; c_ >= '0' && c_ <= '9'; c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48);
    return _ * __;
}
//EOT


const int maxn = 2e3 + 5;

int n, m, a[maxn][maxn], stk[maxn], top, L[maxn], R[maxn], ans;
char str[maxn];

int main() {
	n = read<int>(), m = read<int>();
	For(i, 1, n) {
		scanf("%s", str + 1);
		For(j, 1, m) a[i][j] = (str[j] == '#');
	}
	-- n, -- m;
	For(i, 1, n) {
		For(j, 1, m) {
			a[i][j] = (((a[i][j] + a[i + 1][j] + a[i][j + 1] + a[i + 1][j + 1]) & 1) ^ 1);
			if (a[i][j]) a[i][j] += a[i - 1][j];
		}
		stk[top = 1] = 0, a[i][0] = -1;
		For(j, 1, m) {
			while (a[i][stk[top]] >= a[i][j]) -- top;
			L[j] = stk[top], stk[++ top] = j;
		}
		stk[top = 1] = m + 1, a[i][m + 1] = -1;
		Fordown(j, m, 1) {
			while (a[i][stk[top]] >= a[i][j]) -- top;
			R[j] = stk[top], stk[++ top] = j;
		}
		For(j, 1, m) chkmax(ans, (R[j] - L[j]) * (a[i][j] + 1));
	}
	printf("%d\n", max(max(ans, m + 1), n + 1));

	return 0;
}

Measured memory_bytes: 16000
#include <iostream>

using namespace std;

int main()
{
    int a[5],i,j,n;
    for(i=1; i<=5; i++)
        cin>>a[i];
    cin>>n;
    int flag=1;
    for(i=1; i<=5; i++)
        for(j=i+1; j<=5; j++)
            if(a[j]-a[i]>n)
            {
                flag=0;
                break;
            }
            if(flag)
                cout<<"Yay!";
            else
                cout<<":(";
            return 0;
}


Measured memory_bytes: 256