akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<queue>
#include<string>
using namespace std;
#define gc getchar()
#define hh putchar(10)
#define ll long long
#define mmin(a,b) (a>b?b:a)
template<class T>inline void qin(T &x){T f(1);char a;while((a=gc)<48)
(a==45)&&(f=-1);for(x=a^48;(a=gc)>47;x=(x<<3)+(x<<1)+(a^48));x*=f;}



void Main()
{
    int n,a;
    cin>>n>>a;
    cout<<(n*n-a);
}










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

Measured memory_bytes: 256
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
#define rep(i, a) for (int i = 0; i < (int)(a); i++)
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
typedef long long ll;
template<typename T>istream& operator>>(istream&i,vector<T>&v){rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const vector<T>&v){stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const vector<T>&v){if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v){return i>>v.first>>v.second;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v){return o<<v.first<<","<<v.second;}
template<typename T>bool mins(T& x,const T&y){if(x>y){x=y;return true;}else return false;}
template<typename T>bool maxs(T& x,const T&y){if(x<y){x=y;return true;}else return false;}
template<typename T>ll suma(const vector<T>&a){ll res(0);for(auto&&x:a)res+=x;return res;}

#ifdef _DEBUG
inline void dump() { cerr << endl; }
template <typename Head> void dump(Head &&head) {
  cerr << head;
  dump();
}
template <typename Head, typename... Tail>
void dump(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  dump(forward<Tail>(tail)...);
}
#define debug(...)                                                               \
  do {                                                                         \
    cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = ";                        \
    dump(__VA_ARGS__);                                                         \
  } while (false)
#else
#define dump(...)
#define debug(...)
#endif

template <typename T> struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template <typename T> using Edges = vector<edge<T>>;
template <typename T> using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template <typename T> using Matrix = vector<vector<T>>;

const ll LINF = 1LL << 60;
const int INF = 1001001001;

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

const string yes = "Yes";
const string no = "No";

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

  ll count = 0;
  ll mx = 0;
  rep(i, n) {
    ll a,b; cin >> a >> b;
    if (a==b) {
      count++;
    } else {
      count = 0;
    }
    maxs(mx, count);
  }

  if (mx >= 3) cout << yes << "\n";
  else cout << no << "\n";

  return 0;
}


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

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

    ll n;
    cin >> n;

    ll allxor = 0;
    vector<ll> a(n);
    rep(i, n){
        cin >> a[i];
        allxor ^= a[i];
    }

    rep(i, n) cout << (a[i]^allxor) << " ";
    cout << endl;



    return 0;
}

Measured memory_bytes: 4788
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<cmath>

using namespace std;

int main() {
	string s;
	cin >> s;
	long long K;
	cin >> K;
	for (int i = 0; i < K; ++i) {
		if (s[i] != '1') {
			cout << s[i] << endl;
			return 0;
		}
	}
	cout << '1' << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Adly
 */
public class Main {

    static int t;
    static int[] dp;
    static int[] a;
    static int k;

    public static int re(int i) {
        //System.out.println(i);
        if (i > 0) {
            if (i - k <= 0) {
                return dp[i] = Math.abs(a[i] - a[0]);
            }
            if (dp[i] != -1) {
                return dp[i];
            } else {
                if (dp[i] == -1) {
                    dp[i] = Integer.MAX_VALUE;
                }
                for (int j = 1; j <= k; j++) {
                    if (i - j >= 0) {
                        //System.out.println(i + " send " + (i - j));
                        //if(i==6 ||i-j ==6){
                        //}
// <editor-fold defaultstate="collapsed" desc=" less calls ">
                        if (dp[i - j] != -1) {
                            dp[i] = Math.min(Math.abs(dp[i - j] + Math.abs(a[i - j] - a[i])), dp[i]);
                        }
// </editor-fold>
                        dp[i] = Math.min(Math.abs(re(i - j) + Math.abs(a[i - j] - a[i])), dp[i]);
                    }
                }
                return dp[i];
            }
        }
        return dp[0] = Integer.MAX_VALUE;//bad path
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        StringTokenizer st = new StringTokenizer(br.readLine());
        t = Integer.parseInt(st.nextToken());
        k = Integer.parseInt(st.nextToken());
        a = new int[t];
        dp = new int[t];
        st = new StringTokenizer(br.readLine());
        for (int i = 0; i < t; i++) {
            a[i] = Integer.parseInt(st.nextToken());
            dp[i] = -1;
        }
        re(t - 1);
        //out.println(Arrays.toString(a));
        //out.println(Arrays.toString(dp));
        out.println(dp[t - 1]);
        out.flush();
    }
}
/*
10
0 0 0 0 0 0 0 0 123 23
 */


Measured memory_bytes: 49548
#include<cstdio>
#include<cstring>
#include<algorithm>
#define N 510
using namespace std;
int n, m;
char S[N], map[N][N], ans[N][N];
int main(){
	scanf("%d%d", &n, &m);
	for(int i=1; i<=n; i++){
		scanf("%s", S+1);
		for(int j=1; j<=m; j++)map[i][j]=S[j];
	}
	memcpy(ans, map, sizeof(ans));
	for(int i=1; i<=m; i++)ans[1][i]='#';
	for(int i=1; i<=m; i++)if(i&1)
		for(int j=2; j<=n-1; j++)ans[j][i]='#';
	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++)printf("%c", ans[i][j]);
		printf("\n");
	}
	printf("\n");
	memcpy(ans, map, sizeof(ans));
	for(int i=1; i<=m; i++)ans[n][i]='#';
	for(int i=1; i<=m; i++)if(!(i&1))
		for(int j=2; j<=n-1; j++)ans[j][i]='#';
	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++)printf("%c", ans[i][j]);
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1152
# vim: fileencoding=utf-8


def main():
    a, b, c, x, y = map(int, input().split())
    ans = float("inf")
    for i in range(0, max(x, y) * 2 + 1, 2):
        p = x - i // 2
        p = max(0, p)
        q = y - i // 2
        q = max(0, q)
        sum = a * p + b * q + c * i
        if ans > sum:
            ans = sum
    print(ans)


if __name__ == "__main__":
    main()


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

int main(){
    string s; cin>>s;
    int n = s.size();
    if(n%2!=0) {
        s.pop_back();
        n--;
    }
    else{
        s.pop_back();
        s.pop_back();
        n-=2;
    }
    while(true){
        if(s.substr(0,n/2)==s.substr(n/2,n/2)){
            cout << n << endl;
            return 0;
        }
        else{
            s.pop_back();
            s.pop_back();
            n-=2;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, n) for(int i = 1; i <= (int)(n); i++)
const long long INF = 1LL << 60;
int main() 
{
    int h,w;
    cin >> h >> w;
    char A[h+10][w+10];
    bool can=true;

    REP(i,h){
        REP(j,w){
            cin >> A[i][j];
        }
    }

    REP(i,h){
        REP(j,w){
            if(A[i][j]=='#' && A[i-1][j] != '#' && A[i+1][j] != '#' && A[i][j-1] != '#' && A[i][j+1] != '#'){
                can=false;
            }
        }
    }
    if(can)
        cout << "Yes" << endl;
        else
        {
            cout << "No" << endl;
        }
         

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <utility>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define all(v) v.begin(),v.end()
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int,int>;
  
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    int count[100005] = {};
    int a;
    rep(i,n){
      cin >> a;
      //   if( a != 0){
      count[a - 1]++;
      
      count[a]++;
      count[a + 1]++;
    }
    sort(count,count +100003,greater<int>());
    cout << count[0] << '\n';
    return 0;
}


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

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

    int N;
    long long W;
    
    cin >> N >> W;

    vector<long long> weight(N);
    vector<long long> value(N);

    for(int i=0;i<N;i++) cin >> weight[i] >> value[i];

    vector<long long> dp(W+1,0);


    for(int i=0;i<N;i++) {
        for(int w=W;w>=0;w--) {
            if(w-weight[i]>=0) dp[w] = max(dp[w-weight[i]]+value[i],dp[w]);
            
        }
    }

    cout << dp[W] << endl;
    



    return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

typedef long long ll;

const int MAXN = 100005;
const int MOD = 1000000007;
const ll INF = (ll)2e18;

int N;
ll A, B;
ll a[MAXN];
int dp_a[MAXN], dp_b[MAXN];
int prev_a[MAXN], prev_b[MAXN];
int last_a[MAXN], last_b[MAXN];

void load() {
  scanf("%d%lld%lld", &N, &A, &B);
	for (int i = 1; i <= N; i++)
		scanf("%lld", a + i);
}

inline int add(int x, int y) {
	x += y;
	if (x >= MOD)
		x -= MOD;
	else if (x < 0)
		x += MOD;
	return x;
}

struct fenwick {
  int f[MAXN];
  fenwick() {
    memset(f, 0, sizeof f);
  }
  void update(int x, int val) {
    for (; x < MAXN; x += x & -x)
      f[x] = add(f[x], val);
  }
  int get(int x) {
    int res = 0;
    for (; x > 0; x -= x & -x)
      res = add(res, f[x]);
    return res;
  }
  int get(int lo, int hi) {
    if (lo > hi)
      return 0;
    return get(hi) - get(lo - 1);
  }
};

fenwick F1, F2;

int solve() {
  a[++N] = INF;
  for (int i = 1; i <= N; i++) {
    prev_a[i] = upper_bound(a + 1, a + N + 1, a[i] - A) - a - 1;
    prev_b[i] = upper_bound(a + 1, a + N + 1, a[i] - B) - a - 1;
  }

  for (int i = 1; i <= N; i++) {
    last_a[i] = prev_a[i] == i - 1 ? last_a[i - 1] : i;
    last_b[i] = prev_b[i] == i - 1 ? last_b[i - 1] : i;
  }

  for (int i = 1; i <= N; i++) {
    int lo = last_b[i - 1], hi = min(prev_a[i] + 1, i - 1);
    dp_a[i] = i == 1 ? 1 : F2.get(lo, hi);
    F1.update(i, dp_a[i]);
    lo = last_a[i - 1], hi = min(prev_b[i] + 1, i - 1);
    dp_b[i] = i == 1 ? 1 : F1.get(lo, hi);
    F2.update(i, dp_b[i]);
  }

  return add(dp_a[N], dp_b[N]);
}

int main() {
	load();
	printf("%d\n", solve());
	return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
#define INF 1000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main()
{
  ll N;
  cin >> N;
  vector<ll> a(N + 1, 1);
  for (ll i = 0; i < N + 1; ++i)
  {
    if (i % 3 == 0 || i % 5 == 0)
    {
      a.at(i) = 0;
    }
  }
  ll ans = 0;
  for (ll i = 0; i < N + 1; ++i)
  {
    if (a.at(i) == 1)
    {
      ans += i;

    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 11084
/*
  2015.06.20
  InsertionSort
*/

#include <iostream>
using namespace std;

#define MAX_N 100 + 1

void insertionSort(int* a, int n);
void trace(int* a, int n);

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

  trace(a, n);
  insertionSort(a, n);

  return 0;
}

void insertionSort(int* a, int n) {
  for (int i = 1; i < n; ++i) {
    int v = a[i];
    int j = i - 1;
    while (j >= 0 && a[j] > v) {
      a[j + 1] = a[j];
      j--;
    }
    a[j + 1] = v;

    trace(a, n);
  }
}

void trace(int* a, int n) {
  for (int i = 0; i < n; ++i) {
    if (i) { cout << " "; }
    cout << a[i];
  }
  cout << '\n';
}

Measured memory_bytes: 1160
import numpy as np

D = int(input())
Cs = list(map(int, input().split()))
Ss = []
for d in range(D):
    s = list(map(int, input().split()))
    Ss.append(s)

Ss = np.array(Ss)

solution = np.argmax(Ss, axis=1)

days_till_next = np.ones_like(Ss) * (D - 1) - np.arange(D).reshape((D, 1))


def update_days_till_next(d, erase=False):
    contest = solution[d]
    delta = days_till_next[d + 1, contest] + 1 if d < D - 1 else 0
    days_till_next[d, contest] = delta
    for _d in range(d - 1, -1, -1):
        if solution[_d] == contest or _d == 0:
            days_till_next[_d:d, contest] = (d - _d) - np.arange(d - _d) + (delta if erase else 0)
            break


def update_days_till_next_old(d):
    contest = solution[d]
    if d < D - 1:
        days_till_next[d, contest] = days_till_next[d + 1, contest] + 1
    for _d in range(d - 1, -1, -1):
        if solution[_d] == contest or _d == 0:
            days_till_next[_d:d, contest] = (d - _d + 1) - np.arange(d - _d)
            break

for d in range(D - 1, -1, -1):
    update_days_till_next(d)

for _ in range(100):
    n_contests = len(Ss[0])
    days_since_last = np.zeros(n_contests)
    for d, i in enumerate(solution):
        days_since_last += 1
        new_scores = days_till_next[d] * days_since_last * Cs + Ss[d]
        new_i = new_scores.argmax()
        days_since_last[new_i] = 0
        if new_i != i:
            update_days_till_next(d, erase=True)
            solution[d] = new_i
            update_days_till_next(d)


for s in solution:
    print(s + 1)

# with open("test.out", "w") as f:
#     f.writelines("\n".join(list(map(str, solution + 1))))


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

typedef long long ll;

int n,m,k;
string words[510];
string from[255],to[255];
string season[35];

int fg[610][27];
int ac[610];

int build(){
	memset(fg,0,sizeof(fg));
	memset(ac,0,sizeof(ac));
	int root=1,size=2;
	fg[root][0]=root;
	rep(i,k){
		int cur=root;
		rep(j,season[i].size()){
			int tar=season[i][j]-'a'+1;
			if(fg[cur][tar]==0) fg[cur][tar]=size++;
			cur=fg[cur][tar];
		}
		ac[cur]|=(1<<i);
	}
	queue<int> q;
	range(i,1,27){
		if(fg[root][i]){
			fg[fg[root][i]][0]=root;
			int tar=fg[root][i];
			q.push(tar);
		}else
			fg[root][i]=root;
	}
	while(!q.empty()){
		int now=q.front();q.pop();
		range(i,1,27){
			if(fg[now][i]){
				int tar=fg[now][0];
				while(!fg[tar][i]) tar=fg[tar][0];
				fg[fg[now][i]][0]=fg[tar][i];
				ac[fg[now][i]]|=ac[fg[tar][i]];
				q.push(fg[now][i]);
			}
		}
	}
	return size;
}

const ll mod=1000000007;
map<int,int> dp[510][510][2]; // len ac words state

int main(void){
	ios::sync_with_stdio(false);
	while(cin >> n >> m >> k){
		if(n==0) break;

		rep(i,n) cin >> from[i] >> to[i];
		rep(i,n) words[2*i]=from[i];
		rep(i,n) words[2*i+1]=to[i];
		sort(words,words+2*n);
		int w=unique(words,words+2*n)-words;

		rep(i,k) cin >> season[i];
		int root=1,s=build();

		vector<int> graph[510];
		rep(i,n){
			int fi=lower_bound(words,words+w,from[i])-words;
			int ti=lower_bound(words,words+w,to[i])-words;
			graph[fi].emplace_back(ti);
		}
		rep(i,w) graph[w].emplace_back(i);

		dp[0][w][0][root]=1LL;
		rep(i,m){
			rep(j,w+1)range(k,root,s)rep(l,2){
				if(i>0&&j==w) continue;
				if(dp[i][j][l].find(k)==dp[i][j][l].end()) continue;
				for(auto &nj:graph[j]){
					int ni=i+words[nj].size();
					if(ni>m) continue;
					int nk=k,nl=l;
					rep(a,words[nj].size()){
						int tar=words[nj][a]-'a'+1;
						while(!fg[nk][tar]) nk=fg[nk][0];
						nk=fg[nk][tar];
						nl+=__builtin_popcount(ac[nk]);
						if(nl>=2) break;
					}
					if(nl>=2) continue;
					dp[ni][nj][nl][nk]+=dp[i][j][l][k];
					dp[ni][nj][nl][nk]%=mod;
				}
			}
			rep(j,w+1)rep(l,2) dp[i][j][l].clear();
		}
		int ans=0LL;
		rep(j,w+1)for(auto &i:dp[m][j][1]){
			ans+=i.second;
			ans%=mod;
		}
		cout << ans << endl;
		rep(j,w+1)rep(l,2) dp[m][j][l].clear();
	}
	return 0;
}

Measured memory_bytes: 27884
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
int a[105], b[105];
int main() {
	int n, k, ans = 0;
	cin >> n >> k;
	for(int i = 1; i <= n; i++) {
		cin >> a[i];
		if(abs(a[i] - k) > a[i])
			b[i] = a[i];
		else
			b[i] = abs(a[i] - k);
	}
	for(int i = 1; i <= n; i++)
		ans += b[i] * 2;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  ll k,n,a[200005]={},cnt=0;
  cin >> k >> n;
  for(int i=0; i<n; i++) {
    cin >> a[i];
  }
  for(int i=0; i<n-1; i++) {
    cnt=max(cnt,a[i+1]-a[i]);
  }
  cnt=max(cnt,a[0]+k-a[n-1]);
  cout << k-cnt << endl;
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.C_Challenge
{
    class ABC_090
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            long[] nm = ReadLongs();
            if (nm[0] == 2 || nm[1] == 2)
            {
                Console.WriteLine(0);
            }
            else if (nm[0] == 1 && nm[1] == 1)
            {
                Console.WriteLine(1);
            }
            else if (nm[0] == 1)
            {
                Console.WriteLine(nm[1] - 2);
            }
            else if (nm[1] == 1)
            {
                Console.WriteLine(nm[0] - 2);
            }
            else
            {
                Console.WriteLine((nm[0] - 2) * (nm[1] - 2));
            }
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

long long n,a[205][205],r;
multiset<int> s;


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

    cin>>n;
    for(int i=0;i<2*n;i++)
    {
        int x,y;
        cin>>x>>y;
        if(i<n)
            a[x][y]=1;
        else
            a[x][y]=2;
    }

    for(int j=0;j<2*n;j++)
    {
        for(int i=0;i<2*n;i++)
        {
            if(a[i][j]==1)
                s.insert(i);
            if(a[i][j]==2)
            {
                if(s.size()==0)
                    continue;
                else if(s.size()==1)
                {
                    auto it=s.lower_bound(i);
                    if(it==s.begin())
                        continue;
                    else
                    {
                        it--;
                        int b=*it;
                        r++;
                        s.erase(s.find(b));
                    }
                }
                else
                {
                    auto it=s.lower_bound(i);
                    if(it==s.begin())
                        continue;
                    else
                    {
                        it--;
                        int b=*it;
                        r++;
                        s.erase(s.find(b));
                    }
                }
            }
        }
    }
    cout<<r<<endl;

    return 0;
}


Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

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

  if (d <= t*s) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


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

#define all(x) x.begin(), x.end()

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MN = 1e5 + 5, LN = 17, INF = 0x3f3f3f3f, MOD = 1e9 + 7;

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    int a, b, h;
    cin >> a >> b >> h;
    cout << (a + b) * h / 2 << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <iostream>
#include <string>
#include<algorithm>
#include<map>
#include <vector>
#include <cassert>
#include<cmath>
using namespace std;



int main() {
	int N, R;
	cin >> N >> R;
	if (N >= 10) {
		cout << R << endl;
	}
	else {
		cout << R + 100 * (10 - N) << endl;
	}
}

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

using namespace std;

#define pb push_back

int solve(vector<int> v) {
  int size = v.size();
	int dp[size];
	dp[0] = 0;

	for (int i = 1; i < size; i++) {
		dp[i] = dp[i - 1] + abs(v[i] - v[i - 1]);
		if (i - 2 >= 0) dp[i] = min(dp[i], dp[i - 2] + abs(v[i] - v[i - 2]));
	}

	return dp[size - 1];
}

int main() {


	int num, n;

	cin >> n;

	vector<int> v;

	for (int i = 0; i < n; i++) {
		cin >> num;
		v.pb(num);
	}


	cout << solve(v) << endl;
	return 0;
}


Measured memory_bytes: 4516
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, K: int, x: "List[int]", y: "List[int]"):
    sx = sorted(x)
    sy = sorted(y)
    acc = [[0]*N for _ in range(N)]

    for i, x1 in enumerate(sx):
        for j, y1 in enumerate(sy):
            acc[i][j] = sum([True for xx, yy in zip(x, y)
                             if xx <= x1 and yy <= y1])

    m = INF

    for i, x1 in enumerate(sx[:-K+1]):
        for j, y1 in enumerate(sy[:-K+1]):
            # 始点を固定
            for x2 in sx[i+1:]:
                for y2 in sy[j+1:]:
                    # 終点を固定
                    counter = 0
                    for xx, yy in zip(x, y):
                        if (x1 <= xx <= x2) and (y1 <= yy <= y2):
                            counter += 1
                    if counter >= K:
                        flag = True
                        area = abs((y2-y1)*(x2-x1))
                        if area < m:
                            m = area
                        break   # これ以上yをあげたところで面積は増える一方なので抜ける
    print(m)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    x = [int()] * (N)  # type: "List[int]"
    y = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
    solve(N, K, x, y)


if __name__ == '__main__':
    main()


Measured memory_bytes: 48220
class Dice
    @faces = nil

    def initialize arr
        @faces = arr
    end

    def top
        @faces[0]
    end

    def rotate news
        f = @faces.dup
        case news
        when "N"
            @faces = [f[1], f[5], f[2], f[3], f[0], f[4]]
        when "E"
            @faces = [f[3], f[1], f[0], f[5], f[4], f[2]]
        when "W"
            @faces = [f[2], f[1], f[5], f[0], f[4], f[3]]
        when "S"
            @faces = [f[4], f[0], f[2], f[3], f[5], f[1]]
        end
    end

    def right top, front
        "SWSWS".each_char{|c|
            break if @faces[0] == front
            rotate c
        }
        rotate "S"
        "WWW".each_char{|c|
            break if @faces[0] == top
            rotate c
        }
        @faces[2]
    end

    def same? faces2
        return true if @faces == faces2
        "WWWWSWWWWSWWWWSWWWWSWSWWWWSSWWW".each_char{|c|
            rotate c
            return true if @faces == faces2
        }
        return false
    end
end

numbers = gets.chomp.split
dice = Dice.new numbers

numbers2 = gets.chomp.split
puts (dice.same? numbers2) ? "Yes" : "No"

Measured memory_bytes: 8644
#include<bits/stdc++.h>
using namespace std;
int main ()
  {
   long long int n,k,s;cin>>n>>k>>s;
   for (long long int i=0;i<k;i++) cout<<s<<" ";
   if (s==1000000000) {s--;
   for (long long int i=k;i<n;i++) cout<<s<<" ";
   cout<<endl;}
   else {
    for (long long int i=k;i<n;i++) cout<<s+1<<" ";
    cout<<endl;
   }
   
   
   
   
   
   
   
   
   
   
   
   
   
   
          
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long


signed main() {

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int n;
	cin >> n;

	vector<double> dp(n + 1);

	dp[0] = 1.0;

	for (int coin = 0; coin < n; ++coin) {
		double p_heads;
		cin >> p_heads;
		for (int i = coin + 1; i >= 0; --i) {
			if (i == 0) dp[i] = dp[i] * (1 - p_heads);
			else dp[i] =  dp[i - 1] * p_heads + dp[i] * (1 - p_heads);
		}
	}

	double answer = 0;
	for (int heads = n; heads >= 0; --heads) {
		int tails = n - heads;
		if (heads > tails) {
			answer += dp[heads];
		}
	}

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

Measured memory_bytes: 3804
def product(lst):
    ret = 1
    for i in lst:
        ret *= i
    return ret

def dfs(lst, index, level):
    nums = []
    for i in range(index, len(lst)):
        dn = lst[i].count(".")
        if level == dn:
            s = lst[i][level]
            if s=='+':
                nums.append(sum(dfs(lst, i+1, level+1)))
            elif s=='*':
                nums.append(product(dfs(lst, i+1, level+1)))
            else:
                nums.append(int(s))
        elif level > dn:
            break
    return nums

while True:
    n = int(input())
    if not n:
        break
    ls = [input() for i in range(n)]
    print(dfs(ls, 0, 0)[0])

Measured memory_bytes: 7676
/* 
    @author : srinathbalaji_99
*/


#include<bits/stdc++.h>

#define PB push_back
#define MP make_pair
#define endl '\n'
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define rep(i, a, b, inc) for(long long i = a; i < b; i += inc)
#define REP(i, n) rep(i, 0, n, 1)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define PLL pair<long long, long long>
#define VL vector<long long>
#define VS vector<string>
#define VLL vector<PLL>
#define VVL vector<VL>
#define MPLL map<long long, long long>
#define UMPLL unordered_map<long long, long long>
#define SETL set<long long>
#define MSETL multiset<long long>
#define GCD(a, b) __gcd(a, b)
#define LCM(a, b) (a * b)/GCD(a, b)
#define ff first
#define ss second
#define pall(a) REP(i, sizeof(a)/sizeof(a[0]))cout << a[i] << " ";cout << endl;
#define pvall(v) REP(i, v.size())cout << v[i] << " ";cout << endl;
#define gall(a, n) REP(i, n)cin >> a[i];
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

typedef unsigned long long ULL;
typedef long long LL;
typedef long double LD;


using namespace std;

void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

LL dp[100001];
//dp[i] -> 'i' stones remain, dp[i] = 1 if current player wins, else 0


int main()
{
    fast();


    LL t,n,i,j,k,x,y,c;
    cin >> n >> k;
    LL a[n];
    gall(a, n);
    dp[0] = 0;
    rep(i, 1, k + 1, 1){
        bool flag = false;
        REP(j, n){
            if(i - a[j] >= 0){
                if(dp[i - a[j]] == 0){
                    flag = true;
                    break;
                }
            }
        }
        if(flag){
            dp[i] = 1;
        }
        else{
            dp[i] = 0;
        }
    }
    // REP(i, k + 1)cout << dp[i] << " ";
    // cout << endl;
    if(dp[k]){
        cout << "First";
    }
    else{
        cout << "Second";
    }
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

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






template<unsigned long long m> class comb_perm{
private:
    int n;
    std::vector<long long> fact, fact_inv;
public:
    comb_perm(): n(0), fact(1), fact_inv(1){
        fact[0] = fact_inv[0] = 1;
    }
    comb_perm(int N): n(N), fact(N+1), fact_inv(N+1){
        fact[0] = fact[1] = fact_inv[0] = fact_inv[1] = 1;
        for(int i(2); i <= n; ++i) fact[i] = fact[i - 1] * i % m;
        for(int i(2); i <= n; ++i) fact_inv[i] = inv(fact[i]);
    }
 
    void resize(int N){
        fact.resize(N+1);
        fact_inv.resize(N+1);
        if(!n && N){
            fact[1] = fact_inv[1] = 1;
        }
        for(int i(std::max(2, n+1)); i <= N; ++i) fact[i] = fact[i - 1] * i % m;
        for(int i(std::max(2, n+1)); i <= N; ++i) fact_inv[i] = inv(fact[i], m);
        n = N;
    }
 
    long long power(long long a, unsigned long long b){
        long long ret(1);
        while(b){
            if(b & 1) ret = (ret * a) % m;
            a = (a * a) % m;
            b /= 2;
            if(ret < 0) ret += m;
            if(a < 0) a += m;
        }
        return ret;
    }
 
    long long inv(long long a){ // GCD(a, m) = 1
        return power(a, m-2);
    }
 
    long long permutation(int n, int r){
        if(n < r) return 0;
        if(n < 0 || r < 0) return 0;
        long long ret(fact[n]);
        ret = ret * fact_inv[n - r] % m;
        return ret;
    }
 
    long long combination(int n, int r){
        if(n < r) return 0;
        if(n < 0 || r < 0) return 0;
        long long ret(permutation(n, r));
        return ret * fact_inv[r] % m;
    }
 
    long long factorial(int a){
        return fact[a];
    }
 
    long long inv_factorial(int a){
        return fact_inv[a];
    }
};

int main(){
    int N; std::cin >> N;
    comb_perm<MOD> cp;
    long long ans(cp.power(10, N) - cp.power(9, N));
    ans *= 2;
    ans %= MOD;
    if(ans < 0) ans += MOD;
    ans -= cp.power(10, N) - cp.power(8, N);
    ans %= MOD;
    if(ans < 0) ans += MOD;
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORe(i, k, n) for(int i = (k); i <= (n); i++)
#define FORr(i, k, n) for(int i = (k); i > (n); i--)
#define FORre(i, k, n) for(int i = (k); i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

const int INF = 1001001001;
const int mod = 1000000007;

int main(void){
  int n;
  cin >> n;
  map<string, int> mp;
  REP(i, n){
    string s;
    cin >> s;
    mp[s]++;
  }
  vector<pair<string, int>> v;
  int mx = 0;
  for(auto p : mp) chmax(mx, p.second);
  for(auto p : mp){
    if(p.second == mx) cout << p.first << endl;
  }
  return 0;
}

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

const int mn=4e5+6;
long long d[mn],f[mn][2];

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;++i) scanf("%lld",&d[i]);
	f[1][1]=-1e18;
	for(int i=2;i<=n;++i) {
		f[i][1]=max(f[i-2][1],f[i-2][0])+d[i];
		f[i][0]=f[i-2][0]+d[i-1];
		if(i&1) f[i][1]=max(f[i][1],max(f[i-3][1],f[i-3][0])+d[i]);
	}
	printf("%lld",max(f[n][0],f[n][1]));
}

Measured memory_bytes: 8508
#include "bits/stdc++.h"
#define rep(i, j) for (int i = 0; i < j; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using ull = unsigned long long;

int gcd(int x, int y);

const int INF = 1001001001;

//mint�p�̕ϐ� (10��9��)
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

int n, m, x;
int ans = -1;
vector<int> c(0);
vector<vector<int> > a(0, vector<int>(0));

void dfs(vector<int> a_array) {
    if (a_array.size() == n) {
        int money = 0;
        vector<int> can(m, 0);
        rep(i, n) {
            if (a_array[i] == 1) {
                money += c[i];
                rep(j, m) {
                    can[j] += a[i][j];
                }
            }
            int flag = 0;
            rep(i, m) {
                if (can[i] >= x) flag++;
            }
            if (flag == m)
                if (ans == -1)
                    ans = money;
                else
                    ans = min(ans, money);
        }
    }
    else {
        rep(i, 2) {
            a_array.emplace_back(i);
            dfs(a_array);
            a_array.erase(a_array.begin() + a_array.size() - 1);
        }
    }
}
int main() {
    cin >> n >> m >> x;
    rep(i, n) {
        int num;
        cin >> num;
        c.emplace_back(num);
        vector<int> kari_array(m);
        rep(j, m) cin >> kari_array[j];
        a.emplace_back(kari_array);
    }
    vector<int> a_array(0);
    dfs(a_array);
    cout << ans << endl;
    return 0;
}
/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
int gcd(int x, int y) {
    int num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}


Measured memory_bytes: 3640
import Data.Int (Int64)

p::Int64
p = 10^9 + 7

modPow::Int64->Int64->Int64
modPow a n | n == 1 = mod a p
           | mod n 2 == 1 = mod (a * modPow a (n-1)) p
           | otherwise = mod (t * t) p
                where t = modPow a (n `div` 2)

combination::Int64->Int64->Int64
combination n m = mod (x * (modPow y (p-2))) p
                    where x = foldl1 (\acc c -> mod (acc * c) p ) [(n-m+1)..n]
                          y = foldl1 (\acc c -> mod (acc * c) p ) [1..m]
                          
subMod::Int64->Int64->Int64
subMod x y
  | x < y     = x - y + p
  | otherwise = x - y

main = do
  [n, a, b] <- map read . words <$> getLine::IO[Int64]
  print $ ((modPow 2 n) - 1) `subMod` (combination n a) `subMod` (combination n b)



Measured memory_bytes: 1020
#include <iostream>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <memory.h>
using namespace std;
const int INF = 2 << 27;
#define ll long long
typedef pair<int,int> P;

static int dp[4][500001];


int main() {
  int w;
  cin >> w;
  int ar[100];
  for(int i = 0; i < 100; i++) ar[i] = 0;
  for(int i = 0; i < w; i++) {
    ar[0]++;
    for(int j = 0; j < 100; j++) {
      if(ar[j] == 2) {
        ar[j+1]++;
        ar[j] = -1;
      }
    }
  }
  string ans = "";
  int max = 0;
  for(int i = 0; i < 100; i++) {
    if(ar[i] != 0) max = i;
  }
  for(int i = max; i >= 0; i--) {
    if(ar[i] == -1) {
      ans += "-";
    }
    else if(ar[i] == 0) {
      ans += "0";
    }
    else {
      ans += "+";
    }
  }
  cout << ans << endl;
}

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

typedef long long ll;

int main(){

    int n, k;
    cin >> n >> k;
    int arr[n];

    for(int i=0; i<n; ++i) cin >> arr[i];
    sort(arr,arr+n);
    int ans=0;
    for(int i=0; i<k; i++){
        ans+=arr[i];
    }
    cout<<ans<<'\n';
    return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>
int main()
{
int a[3][3],n,i,j,k;
  for(i=0;i<3;++i)
  {
    for(j=0;j<3;++j)
    {
    scanf("%d",&a[i][j]);
    }
  }
  scanf("%d",&n);
  
  int h[n];
  
  for(i=0;i<n;++i)
  {scanf("%d",&h[i]);}

  for(i=0;i<3;++i)
  {
    for(j=0;j<3;++j)
    {
     for(k=0;k<n;++k)
     {if(a[i][j]==h[k]) a[i][j]=0;}
    }
  }
  
  if(a[0][0]==0 && a[0][1]==0 && a[0][2]==0) printf("Yes");
  else if(a[1][0]==0 && a[1][1]==0 && a[1][2]==0) printf("Yes");
  else if(a[2][0]==0 && a[2][1]==0 && a[2][2]==0) printf("Yes");
  else if(a[0][0]==0 && a[1][0]==0 && a[2][0]==0) printf("Yes");
  else if(a[0][1]==0 && a[1][1]==0 && a[2][1]==0) printf("Yes");
  else if(a[0][2]==0 && a[1][2]==0 && a[2][2]==0) printf("Yes");
  else if(a[0][2]==0 && a[1][1]==0 && a[2][0]==0) printf("Yes");
  else if(a[0][0]==0 && a[1][1]==0 && a[2][2]==0) printf("Yes");
  else printf("No");
  

return 0;
}

Measured memory_bytes: 1700
#include <iostream>
#include <list>
int main(void){
    // Your code here!
    long a;
    std::list<long> Ilist;
    scanf("%ld",&a);
    for(long i= 1; i<=1000000;i++){
	    if(i>a){
		    break;
	    }
	    if(a%i == 0){
		    Ilist.push_back((long)i);
	    }
    }

    long min = 1000000000000000;
    for(std::list<long>::iterator it= Ilist.begin();it!=Ilist.end();it++){
	    long j = a/(*it);
	    long len = j+(*it) -2;
	    //printf("%d,%d,%d\n",(*it),j,len);
	    if(min>len){
	       // printf("min = %d\n",min);
		    min = len;
	    }
    }

    printf("%ld\n",min);
}


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

using namespace std;

int main(){
  int a,b;
  cin >> a >> b;
  int count=1;
  for(int i=0;;i++){
    if(b/count != 0)  count*=10;
    else  break;
  }
  int x=a*count+b;
  bool ans=false;
  for(int i=0;i<x;i++){
    if(i*i==x) ans=true;
  }
  if(ans) cout << "Yes" << endl;
  else  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	if c-a-b > 0 && (c-a-b)*(c-a-b) > 4*a*b {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include<stdio.h>
#include<string.h>
int main(void){
    int A,B,C,D,E,x,y,cou=0,v[3];
    char S[3],s[3],X,Y;
    scanf("%d %d %d",&A,&B,&C);
    D=100*A+B*10+C;
    if(D%4==0){
        printf("YES");
    }else{
        printf("NO");
    }
    return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
 
class Ctest {
    static void Main(string[] args) {
        int n = int.Parse(Console.ReadLine());
        var myTable = new Dictionary<string, int>();
        String wk = "";
        int max = 1;
        for (int i = 0; i < n; i++){
            wk = Console.ReadLine();
            if (myTable.ContainsKey(wk)) {
                myTable[wk]++;
                max = Max(max, myTable[wk]);
            } else {
                myTable[wk] = 1;
            }
        }
        var ans = new List<string>();
        foreach (var x in myTable) {
            if (max == x.Value) ans.Add(x.Key);
        }
        ans.Sort(StringComparer.Ordinal);
        Console.WriteLine(string.Join("\n", ans));
    }
}

Measured memory_bytes: 49400
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cmath>
#include<cctype>
#include<set>
#include<queue>
#include<vector>
#include<map>
#include<bitset>
using namespace std;
typedef long long LL;

inline int read() {
	int x=0,f=1;char ch=getchar();for(;!isdigit(ch);ch=getchar())if(ch=='-')f=-1;
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';return x*f;
}



int main() {
//	freopen("a.in", "r", stdin);
	int n =  read(), m  = read(), k = read();
	if (n == m && m == k) puts("Yes");
	else puts("No");


	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <fstream>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>

using namespace std;

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

/*
    freopen("input","r",stdin);
    freopen("output","w",stdout);
*/

int main() {
    ios::sync_with_stdio(false);
    int X[400010];
    int state = 0;
    int N, K;
    cin >> N >> K;
    for (int i = 0;i < N;i++) {
    	char c;
    	cin >> c;
    	if (c == 'A') X[i] = 0;
    	else X[i] = 1;
    }
    int add = 0;
    int loc = 0;
    int op = 0;
    while (add < N) {
    	op++;
    	int f = (X[loc] + state) % 2;
    	if (f == 0) X[loc] = 1 - X[loc]; // Change first guy.
    	else {
    		state = 1 - state;
    		add++;
    		X[loc + N] = state; // Add 'A' at very end.
    		loc++;
    	}
    	if (op == K) {
    		// End Here.
    		for (int i = 0;i < N;i++) {
    			f = loc + i;
    			if (X[f] == state) cout << 'A';
    			else cout << 'B';
    		}
    		cout << endl;
    		return 0;
    	}
    }
    int rem = K - op;
    if ((N % 2) == 0) {
    	for (int i = 0;i < N;i++) {
    		if (i % 2) cout << 'A';
    		else cout << 'B';
    	}
    	cout << endl;
    	return 0;
    }
    if (rem % 2) cout << 'B';
    else cout << 'A';
    for (int i = 1;i < N;i++) {
		if (i % 2) cout << 'B';
		else cout << 'A';
	}
    cout << endl;
    return 0;
}

Measured memory_bytes: 2048
from decimal import Decimal
a, b, c = list(map(int, input().split()))


def f(x):
    return Decimal(Decimal(x)**2 + s) / (2 * Decimal(x))


s = a * b   # √s
x = 2   # 初期値（0以外の値）
while True:
    newX = f(x)
    if abs(newX - x) < 1e-7:
        x = newX
        break
    x = newX

l = 2 * x + a + b

if l < c:
    print("Yes")
else:
    print("No")


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

int main(){
    int A=0,B=0;
    cin >> A >> B;
    vector<int> m(3);
    m.at(0)=A+B;
    m.at(1)=A-B;
    m.at(2)=A*B;
    int max=m.at(0);
    if(max<m.at(1)) max=m.at(1);
    if(max<m.at(2)) max=m.at(2);

    cout << max << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(H: int):
    ret = 0
    i = 1
    while H > 0:
        ret += i
        i *= 2
        H //= 2
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    solve(H)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#define ps(arr) \
    for(auto e: arr) cout << e << " "; \
    cout << endl;
#else
#define debug(fmt, ...)
#define ps(arr)
#endif

int main(void) {
    string str;
    cin >> str;
    int len = str.length();
    str += '0'; // for guard
    vector<int> rle;
    char prev = '<';
    int cnt = 0;
    for(int i = 0; i < len+1; i++) {
        char cur = str[i];
        if(cur == prev) {
            cnt++;
        } else {
            rle.push_back(cnt);
            cnt = 1;
        }
        prev = cur;
    }
    int size = rle.size();
    rle.push_back(0);
    ps(rle);
    int64_t sum = 0;
    for(int i = 0; i < size; i+=2) {
        int mmax = max(rle[i], rle[i+1]);
        sum += mmax;
        if(rle[i]) {
            int64_t left = rle[i]-1;
            sum += (left+1) * left/2;
        }
        if(rle[i+1]) {
            int64_t right = rle[i+1]-1;
            sum += (right+1) * right/2;
        }
    }
    cout << sum << endl;
    return 0;
}

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

int main() {
    int N, H, W;
    vector<int> A, B;
    cin >> N >> H >> W;
    int c;
    for(int i=0; i<N; i++) {
        int t,tt;
        cin >> t >> tt;
        if(t>=H && tt>=W) c++;
    }
    cout << c;
    return 0;
}


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

int main(){
    string a;
    int n;
    cin >> a;
    n = a.size();
    if(n == 2){
        if(a[0] == a[1]){
            cout << 1 << " " << 2 << endl;
        }else{
            cout << -1 << " " << -1 << endl;
        }
        return 0;
    }



    for(int i = 0;i <= n-3;i++){
        if(a[i] == a[i+1] || a[i] == a[i+2] || a[i+1] == a[i+2]){
            cout << i+1 << " " <<i+3 << endl;
            return 0;
        }
    }

    cout << -1 << " " << -1 << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
const int mod = 1e9 + 7;
int main()
{
	SPEED
	string s, t;
	int a, b;
	string u;
	cin >> s >> t;
	cin >> a >> b;
	cin >> u;

	if (s==u)
	{
		a--;
	}
	else if (t==u)
	{
		b--;
	}

	cout << a << " " << b;
	return 0;
}

Measured memory_bytes: 256