akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define pr(num) cout << num << endl
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 100010
#define BLACK 0
#define WHITE 1
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;


int main(void) {
    string s;
    cin >> s;
    ll ans=0;
    ll l=0, r=s.size()-1;
    
    while(l<=r) {
        if(s[l]==s[r]) {
            l++; r--;
        }else {
            if(s[l]=='x') {
                ans++;
                l++;
            }else if(s[r]=='x') {
                ans++;
                r--;
            }else {
                puts("-1");
                return 0;
            }
        }
    }
    
    pr(ans);
    
    
}

Measured memory_bytes: 512
import java.lang.Math.floor
import java.util.*

fun main(args: Array<String>) {
    val scan = Scanner(System.`in`)
    var kotlin=scan.nextLine().toLong()

    var value :Long = 100
    var count = 0
    while(value<kotlin)
    {
        var z = floor(value*0.01)
        value+=z.toLong()
        count++
    }
    println(count)
}


Measured memory_bytes: 36536
#include <bits/stdc++.h>
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)

using namespace std;

int main(){
    int n,i,j;
    long ans=0;
    cin >> n;
    int a[n+1],b[n];

    REP(i,n+1){cin>>a[i];}
    REP(j,n){cin>>b[j];}
    for(i=n-1;i>=0;i--){
        if(a[i+1]<b[i]){
            if(a[i]+a[i+1]<=b[i]){
                ans+=a[i]+a[i+1];
                a[i]=0;
            }
            else{
                ans+=b[i];
                a[i]-=b[i]-a[i+1];
            }
            
        }
        else{
            ans+=b[i];
        }
    }

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

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;

  vector<int> A(N);
  bool all_plus = true;
  bool all_minus = true;
  int minA = 1e6 + 1;
  int minApos;
  int maxA = -1e6 - 1;
  int maxApos;
  rep(i, N) {
    cin >> A[i];
    if (A[i] < minA) {
      minA = A[i];
      minApos = i;
    }
    if (maxA < A[i]) {
      maxA = A[i];
      maxApos = i;
    }
    if (A[i] < 0) all_plus = false;
    if (0 < A[i]) all_minus = false;
  }

  vector<pair<int, int>> answer;
  if (!all_plus && !all_minus) {
    if (abs(minA) < abs(maxA)) {
      rep(i, N) {
        A[i] += maxA;
        if (i != maxApos) answer.emplace_back(maxApos + 1, i + 1);
      }
      answer.emplace_back(maxApos + 1, maxApos + 1);
      all_plus = true;
    } else {
      rep(i, N) {
        A[i] += minA;
        if (i != minApos) answer.emplace_back(minApos + 1, i + 1);
      }
      answer.emplace_back(minApos + 1, minApos + 1);
      all_minus = true;
    }
  }

  if (all_plus) {
    for (int i = 0; i < N - 1; ++i) {
      answer.emplace_back(i + 1, i + 2);
    }
  } else if (all_minus) {
    for (int i = N; i > 1; --i) {
      answer.emplace_back(i, i - 1);
    }
  }

  cout << answer.size() << endl;
  for (auto a : answer) {
    cout << a.first << " " << a.second << endl;
  }
  return 0;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<vector<int>> a(3, vector<int>(3));
    for(int i = 0; i < 3; i++) {
        for(int j = 0; j < 3; j++) {
            cin >> a[i][j];
        }
    }
    vector<vector<bool>> seen(3, vector<bool>(3, 0));
    int n;
    cin >> n;
    for(int _ = 0; _ < n; _++) {
        int b;
        cin >> b;
        for(int i = 0; i < 3; i++) {
            for(int j = 0; j < 3; j++) {
                if(a[i][j] == b) {
                    seen[i][j] = true;
                }
            }
        }
    }
    // 縦
    for(int j = 0; j < 3; j++) {
        int cnt = 0;
        for(int i = 0; i < 3; i++) {
            if(seen[i][j]) {
                cnt++;
            }
        }
        if(cnt == 3) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    // 横
    for(int i = 0; i < 3; i++) {
        int cnt = 0;
        for(int j = 0; j < 3; j++) {
            if(seen[i][j]) {
                cnt++;
            }
        }
        if(cnt == 3) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    // 斜め
    int cntt = 0;
    for(int i = 0; i < 3; i++) {
        cntt += seen[i][i];
    }
    if(cntt == 3) {
        cout << "Yes" << endl;
        return 0;
    }
    if(seen[0][2] && seen[1][1] && seen[2][0]) {
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
      #define N 8

      int Q[8][8];

      int dpos[2*8-1];
      int dneg[2*8-1];

      int t[8];
      int y[8];

      void board(void){

        int i,j;

        for(i=0; i<N; i++){
          for(j=0; j<N; j++){

            if(Q[i][j]==1){
              	if(t[i]!=j) return;
            }

          }
        }

        for(i=0; i<N; i++){
          for(j=0; j<N; j++){

            if(t[i]==j){
              printf("Q");
            }

            else{
              printf(".");
            }

          }
          printf("\n");
        }
      }


      void put(int i){
        int j;

        if(i== N){
          board();
          return;
        }

        for(j=0; j<N; j++){

          if(y[j]==1 || dpos[i+j]==1 || dneg[i-j+N-1]==1)
            continue;

          t[i] = j;

          y[j] = dpos[i+j] = dneg[i-j+N-1] = 1;

          put(1+i);

          y[j] = dpos[i+j] = dneg[i-j+N-1] = 0;

        }

      }


      int main(){


        int i,num,p,q;

        scanf("%d",&num);


        for(i=0; i<num; i++){
          scanf("%d%d",&p,&q);
          Q[p][q] = 1;
        }

        put(0);

        return 0;
      }



Measured memory_bytes: 2096
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long

int main() {
	int n; cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	// +-+-...の場合
	ll res1 = 0;
	ll total = 0;
	for (int i = 0; i < n; ++i) {
		if (i & 1) { // 和が負
			if (total + a[i] < 0) {
				total += a[i];
			}
			else {
				res1 += abs(total + a[i] + 1);
				total = -1;
			}
		}
		else {
			if (total + a[i] > 0) {
				total += a[i];
			}
			else {
				res1 += abs(total + a[i] - 1);
				total = 1;
			}
		}
		// cout << res1 << " " << total << endl;
	}
	// -+-+....の場合
	ll res2 = 0;
	total = 0;
	for (int i = 0; i < n; ++i) {
		if (i % 2 == 0) { // 和が負
			if (total + a[i] < 0) {
				total += a[i];
			}
			else {
				res2 += abs(total + a[i] + 1);
				total = -1;
			}
		}
		else {
			if (total + a[i] > 0) {
				total += a[i];
			}
			else {
				res2 += abs(total + a[i] - 1);
				total = 1;
			}
		}
		// cout << res2 << " " << total << endl;
	}
	cout << min(res1, res2) << endl;
	return 0;
}

Measured memory_bytes: 640
import sys

while True:
    n, p = map(int, sys.stdin.readline().split())
    if n == 0 and p == 0:
        break
    hand = [0 for i in xrange(n)]
    cur = 0
    cur_p = p
    success = False
    while True:
        if cur_p > 0:
            hand[cur] += 1
            cur_p -= 1
            
            if hand[cur] == p:
                success = True
                print cur
                break
        else:
            cur_p = hand[cur]
            hand[cur] = 0
        cur += 1
        cur %= n

Measured memory_bytes: 4240
#include<cstdio>

int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}

int p,q,a,n,cnt;

void dfs(int v,int l,int r,int now){
	double dsum=(double)l/r;
	dsum+=(double)(n-v+1)/now;
	if((double)p/q>dsum)return;
	if(v!=0){
		int d=gcd(r,l);
		if(l/d==p && r/d==q){
			cnt++;
			return;
		}

	}
	if(v<n){
		for(int i=a/r;i>=now;i--){
			if((double)p/q<(double)(l*i+r)/(r*i))return;
			dfs(v+1,l*i+r,r*i,i);
		}
	}
}

int main(void){
	while(1){
		scanf("%d %d %d %d",&p,&q,&a,&n);
		if(p+q+a+n==0)break;
		int d=gcd(p,q);
		p/=d;
		q/=d;
		cnt=0;
		dfs(0,0,1,1);
		printf("%d\n",cnt);
	}
	return 0;
}

Measured memory_bytes: 1028
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

#pragma region _define

#define int LL
#define f(i,a,b) for(LL i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define ei else if
#define all(a) a.begin(),a.end()
#define size(s) ((LL)s.size())
#define F first
#define S second
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define int_INF 1<<29
#define ll_INF 1LL<<60
#define MOD 1000000007

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vc = vector<char>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<LL>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using mll = map<LL, LL>;
using mcl = map<char, LL>;
using vpi = vector<pi>;

#pragma endregion

#pragma region _graph

#define node 50  //グラフの最大位数　適宜変更
//bool graph[node][node]; bool visited[node] = { false };
#define link(a,b,m) f(i,0,m){cin>>a[i]>>b[i]; a[i]--; b[i]--; graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;}

#pragma endregion

void _yn(bool p) {
	p ? _y() : _n();
}

void _YN(bool p) {
	p ? _Y() : _N();
}


LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

//素数判定
bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		ret %= MOD;
	}
	return ret;
}

#pragma endregion 




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

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

	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;
	int M = max(a, max(b, max(c, max(d, e))));
	int m = min(a, min(b, min(c, min(d, e))));
	if (M - m <= k) {
		cout << "Yay!";
	}
	else {
		cout << ":(";
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define sqr(x)  ((x) * (x)) 
#define cub(x)  ((x) * (x) * (x))
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main() {
  string a; cin >> a;
  map<char,ll> m;
  FOR(i,0,a.length()-1){
    ++m[a[i]];
  }

  ll ans = 1;
  ans += a.length() * (a.length()-1) / 2;
  FOR(i,0,25){
    ans -= m[char('a' + i)] * (m[char('a' + i)] - 1) / 2;
  }

  cout << ans << endl;


}



Measured memory_bytes: 640
instr = input()
A, B, C = map(int, instr.split(" "))

score = 0
if B < C:
    score += 2 * B
    C -= B
    B = 0

    if A <= C:
        score += A
        C -= A
        A = 0

        if C > 0:
            score += 1
            C -= 1

    else:
        score += C
        C = 0
        A -= C
else:
    score += B + C
    B = C = 0

print(score)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <cstdlib> // abs(x-y)
#include <iomanip> // 出力の桁数指定
#define rep(i, n) for (int i = 0; i < (int)(n); i++) // repマクロ

using namespace std;

int main() {
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  
  rep (i, n-1) {
    if (s.at(i) == s.at(i+1))
      ans++;
  }
  cout << n - ans << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
using namespace std;
int main(){

  int n,m,e[100000],nf[200001]={};

  cin>>n>>m;
  for(int i=0;i<m;i++) cin>>e[i];
  reverse(e,e+m);
  for(int i=0;i<m;i++){
    if(nf[e[i]]) continue;
    cout<<e[i]<<endl;
    nf[e[i]]=1;
  }
  for(int i=1;i<=n;i++) if(!nf[i]) cout<<i<<endl;
  return 0;

}

Measured memory_bytes: 4264
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

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

  int n, m;
  cin >> n >> m;
  ll a[n], b[n], c[m], d[m];
  REP(i, n) cin >> a[i] >> b[i];
  REP(i, m) cin >> c[i] >> d[i];

  int ans;
  ll min, dst;
  REP(i, n){
    min = 1e10;
    REP(j, m){
      dst = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      if(dst < min){
        ans = j + 1;
        min = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      }
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

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

    int p = min(a,k);
    k = k - min(a,k);
    int q = min(k,b);
    k = k - q;
    int r = k;
    cout << p - r << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<string, string> P;

string s;

void dfs(int i, int end, const string lTemp, const string rTemp, vector<P> &x)
{
    if (i == end)
    {
        x.push_back(make_pair(lTemp, rTemp)); //wでソートしたい
        return;
    }
    string lTempAdd(lTemp + s[i]);
    string rTempAdd(s[i] + rTemp);
    dfs(i + 1, end, lTempAdd, rTemp, x);
    dfs(i + 1, end, lTemp, rTempAdd, x);
}

bool compare(const P l, const P r)
{
    return l.first == r.first ? l.second < r.second : l.first < r.first;
}

int main(void)
{
    int n;
    cin >> n;
    cin >> s;
    reverse(s.begin() + n, s.end());

    vector<P> vl;
    vector<P> vr;
    dfs(0, n, "", "", vl);
    dfs(n, 2 * n, "", "", vr);
    sort(vl.begin(), vl.end(), compare);
    sort(vr.begin(), vr.end());

    long long score = 0;
    for (auto ia = vl.begin(); ia < vl.end(); ++ia)
    {
        auto ib_upper = upper_bound(vr.begin(), vr.end(), *ia, compare);
        auto ib_lower = lower_bound(vr.begin(), vr.end(), *ia, compare);
        score += ib_upper - ib_lower;
    }

    cout << score << endl;
    return 0;
}


Measured memory_bytes: 62444
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <numeric>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
 
using namespace std;
 
#define REP(i,s,e) for(int i=(s);i<(e);i++)
#define rep(i,n) REP(i,0,n)

int main(void) {
  int N; cin >> N;
  int B = N % 100;
  int U = N / 100;

  if (1 <= B && B <= 12 && 1 <= U && U <= 12) {
    cout << "AMBIGUOUS" << endl;
  } else if (1 <= B && B <= 12 && 0 <= U && U <= 99) {
    cout << "YYMM" << endl;
  } else if (1 <= U && U <= 12 && 0 <= B && B <= 99) {
    cout << "MMYY" << endl;
  } else {
    cout << "NA" << endl;
  }
}


Measured memory_bytes: 256
import sys
l = 10**10-1
r = 10**11-1
while True:
  x = (l+r)//2
  print("? "+str(x))
  sys.stdout.flush()
  res = input()
  if res == "Y":
    r = x
  else:
    l = x
  if l+1 == r:
    break
cand = r
ansls = []
while True:
  if cand%10 == 0:
    s = cand//10
    if 1 <= s <= 10**9:
      ansls.append(s)
    cand //= 10
  else:
    break
ansls = ansls[::-1]
ln = len(ansls)
flg = 0
if len(str(ansls[0]+1)) > len(str(ansls[0])):
  flg = 1
l = -1
r = ln-1
while l+1<r:
  x = (l+r)//2
  print("? "+str(ansls[x]+1))
  sys.stdout.flush()
  if input() == "Y":
    r = x
  else:
    l = x
if flg == 1 and r == 1:
  print("? "+str(ansls[0]+1))
  sys.stdout.flush()
  if input() == "Y":
    print("! "+str(ansls[1]))
    sys.stdout.flush()
  else:
    print("! "+str(ansls[0]))
    sys.stdout.flush()
else:
  print("! "+str(ansls[r]))
  sys.stdout.flush()

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

int main() {
  int n, m;
  cin >> n;
  vector<int> t(n);
  int total = 0;
  for(int i = 0; i < n; i++) {
    cin >> t[i];
    total += t[i];
  }
  cin >> m;
  vector<int> p(m), x(m);

  for(int i = 0; i < m; i++) {
    cin >> p[i] >> x[i];
    if(x[i] <= t[p[i]-1]) {
      cout << total - (t[p[i]-1] - x[i]) << endl;
    } else {
      cout << total + (x[i] - t[p[i]-1]) << endl;
    }
  }
}

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

int main(){
    int n,ans;
    cin >> n;
    string s,t;
    cin >> s >> t;
    ans = 2*n;
    for(int i = 0;i < n;i ++){
        if(s.substr(i,n-i)==t.substr(0,n-i)) {ans = 2*n-(n-i);break;}
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <map>

using namespace std;
#define prev prev55

long long n;
int a[500000];
vector<int> graph[600000];

int dp[600000];

void dfs2(int v)
{
    vector<int> kek;
    for (auto u : graph[v])
    {
        dfs2(u);
        kek.push_back(dp[u]);
    }
    sort(kek.begin(), kek.end());
    reverse(kek.begin(), kek.end());
    for (int i = 0; i < kek.size(); i++)
    {
        dp[v] = max(dp[v], kek[i] + i + 1);
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for (int i = 2; i <= n; i++)
    {
        cin >> a[i];
        graph[a[i]].push_back(i);
    }
    dfs2(1);
    cout << dp[1];
}


Measured memory_bytes: 26368
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x;
  cin >> x;
  int i,j;
  vector<int>p;
  p.push_back(2);
  int chk = 0;
  for(i=3;i<200000;i+=2){
    chk = 1;
    for(j=0;j<p.size()&&p[j]<=sqrt(i);j++){
      if(i%p[j]==0)chk=0;
    }
    if(chk==1)p.push_back(i);
  }
  for(i=0;i<p.size();i++){
    if(p[i]>=x){
      cout<<p[i]<<endl;
      break;
  }
}
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int a = scanner.nextInt();
			int b = scanner.nextInt();
			if (a > b) {
				System.out.println(a + Math.max(a - 1, b));
			} else {
				System.out.println(b + Math.max(a, b - 1));
			}
		}
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <cstdio>
#include <vector>

using namespace std;

int main() {
  string S;
  cin >> S;
  int l = S.length();
  int count = 0;
  for (int i = 0; i < l / 2; i++) {
    if (S[i] != S[l - i - 1]) {
      count++;
    }
  } 
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int>PA;
using namespace std;
#define MAX 1000
int main(){
    string s; int ans=0;
    while(cin>>s){
        string temp=s;
        reverse(temp.begin(),temp.end());
        if(temp==s)ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3116
n,m=map(int,input().split())

global fri
fri=[]
global tab
tab=[0]*n
def run(nn):
  #print(tab)
  global cnt
  if tab[nn]:
    return
  tab[nn]=1
  cnt+=1
  for i in fri[nn]:
    que.append(i)
for i in range(n):
  fri.append([])
for i in range(m):
  a,b=map(int,input().split())
  fri[a-1].append(b-1)
  fri[b-1].append(a-1)
i=0
mx=0

while i<n:
  if tab[i]:
    i+=1
    continue
  que=[i]
  cnt=0
  while len(que)!=0:
    run(que.pop())
  mx=max(cnt,mx)
  i+=1
print(mx)

Measured memory_bytes: 119780
n = int(input())
v = list(map(int, input().split()))
sv = sorted(v)
mm = sv[-1]
p, ans = 0, 0
if n == 2:
    print(sum(sv)/n)
    exit()
else:
    ans = (sv[0]+sv[1])/2
    p = ans
for x in sv[2:-1]:
    ans = (ans+x)/2
print((ans+mm)/2)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <cmath>
#include <typeinfo>
#include <set>
#include <bitset>
using namespace std;
typedef long long ll;

int main(){
 	int a,p;
  	cin >> a;
  	cin >> p;
  	cout << (3*a+1*p)/2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>

using namespace std;

int H, W, h, w;

int main(){
    cin >> H >> W >> h >> w;
    cout << (H*W) - (h*W) - w*(H-h);


}


//g++ -std=c++14 comp.cpp; ./a.exe


Measured memory_bytes: 256
//** aman**/
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define dl          double
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b) for(int i=a;i<b;i++)
#define lb lower_bound
#define ub upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
int main(){
	long long s;cin>>s;
	cout<<"0 0 1000000000 1 ";
	if(s==1e18){
		cout<<"0 1000000000";
		return 0;
	}
	long long y=s/1000000000;
	long long x=(y+1)*1000000000-s;
	cout<<x<<" "<<y+1<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  int candy,amari;
  while(scanf("%d",&candy)!=EOF){
    amari=candy%39;
    if(amari==0)
        printf("3C39\n");
    else if(amari<10)
         printf("3C0%d\n",amari);
    else
         printf("3C%d\n",amari);
  }
   return 0;
}


Measured memory_bytes: 1916
#include <iostream>
#include <string>
#include <algorithm>
#include <climits>

using namespace std;

int a[5];
char c[5];

int main(void){
    string s;
    cin >> s;
    int sum;
    bool judge = false;
    
    for(int i = 0; i < 4; i++){
        a[i] = s[i] - '0';
    }
    
    
    for(int i = 0; i < 2; i++){
        sum = a[0];
        
        if(i % 2 == 0){
            c[0] = '+';
            sum += a[1];
        }
        else{
            c[0] = '-';
            sum -= a[1];
        }
        
        for(int j = 0; j < 2; j++){
            if(j % 2 == 0){
                c[1] = '+';
                sum += a[2];
            }
            else{
                c[1] = '-';
                sum -= a[2];
            }
            
            for(int k = 0; k < 2; k++){
                if(k % 2 == 0){
                    c[2] = '+';
                    sum += a[3];
                    
                    // cout << sum << endl;
                    
                    if(sum == 7)        judge = true;
                    sum -= a[3];
                }
                else{
                    c[2] = '-';
                    sum -= a[3];
                    
                    // cout << sum << endl;
                    
                    if(sum == 7)        judge = true;
                    sum += a[3];
                }
                
                if(judge)           break;
            }
            
            if(judge)           break;
            
            if(j % 2 == 0)          sum -= a[2];
            else                    sum += a[2];
        }
        
        if(judge)       break;
    }
    
    cout << a[0] << c[0] << a[1] << c[1] << a[2] << c[2] << a[3] << "=7" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int n,q;
	cin>>n;
	string s;
	cin>>s;
	cin>>q;
    int a[n];
    for(int i =0;i<n;i++)
      a[i]=((int)s[i]-(int)'a');
      int len = (int)sqrt(n+.0)+1; 
      int b[len][26];
      memset(b,0,sizeof(b));
      for (int i=0; i<n; ++i)
      b[i/len][a[i]]++;

    while(q--){
      int type, l, r;

      cin>>type;
      if(type==2){
      	cin>>l>>r;
      	l--;r--;
     int get[26]={0};
     int sum = 0;
    for (int i=l; i<=r; )
        if (i % len == 0 && i + len - 1 <= r) {
            
            for(int j=0;j<26;j++)
            	if(b[i/len][j]>0)
                   get[j]++;
                   
            i += len;
        }
        else {
            get[a[i]]++;
            ++i;
          }

          for(int i =0;i<26;i++)
          	if(get[i]>0)
          		sum++;
          	cout<<sum<<endl;
        }
        else
        {
             char ch;
             cin>>l>>ch;
             l--;
             b[l/len][a[l]]--;
             a[l] = ch-'a';
             b[l/len][a[l]]++;
        }
     }
}

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

using namespace std;

#define EPS (1e-7)
#define INF (1e9)


typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define rep2(i, n) for(int i = 1; i <= (n); i++)
#define all(a) begin(a),end(a)
#define endl '\n'




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


const int MOD = 1000000007;
const long double PI = (acos(-1));
const int MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];

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


void COMinit() {
   fac[0] = fac[1] = 1;
   finv[0] = finv[1] = 1;
   inv[1] = 1;
   for (int i = 2; i < MAX; i++){
       fac[i] = fac[i - 1] * i % MOD;
       inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
       finv[i] = finv[i - 1] * inv[i] % MOD;
   }
}

inline void init(vector<int>& uf) {

    iota(all(uf), 0);
}

inline int root(vector<int>& uf, int x) {

    if(uf[x] == x) {

        return x;
    }
    else {

        return uf[x] = root(uf, uf[x]);
    }
}

inline bool same(vector<int>& uf, int x, int y) {

    return root(uf, x) == root(uf, y);
}

inline void unite(vector<int>& uf, int x, int y) {

    x = root(uf, x);
    y = root(uf, y);

    if(x == y) return;

    uf[x] = y;
}

long long x, y;
void Input() {

    cin >> x >> y;
}



void Solve() {

    long long cnt = 0;
    while(x <= y) {

        cnt++;
        x = x * 2;
    }

    cout << cnt << endl;


}

int main() {

  cin.tie(0);
  ios::sync_with_stdio(false);
  Input();
  Solve();


  return 0;

}



Measured memory_bytes: 256
#include <stdio.h>

int main (void)
{
	int n,i,c=0,c1=0,c2=0,c3=0;
	char s[256];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",s);
		if(s[0]=='A'){
			c++;
		}
		if(s[0]=='W'){
			c1++;
		}
		if(s[0]=='T'){
			c2++;
		}
		if(s[0]=='R'){
			c3++;
		}
	}
	printf("AC x %d\n",c);
	printf("WA x %d\n",c1);
	printf("TLE x %d\n",c2);
	printf("RE x %d\n",c3);
	return 0;
}



Measured memory_bytes: 2168
#include<iostream>
using namespace std;
const int HMAX = 2000;
const int WMAX = 2000;
int main()
{
    int H, W;
    cin >> H >> W;
    char MAP[H+5][W+5];
    int xMAP[H+5][W+5];
    int yMAP[H+5][W+5];
    for(int i = 0; i < H; ++i) {
        cin >> MAP[i];
    }
    /*
    for(int i = 0; i < H; ++i) {
        cout << MAP[i] << endl;
    }
    */
    for(int i = 0; i < H; ++i) {
        for(int j = 0; j < W; ++j) {
            yMAP[i][j] = 0;
            if(MAP[i][j] == '.') {
                int ans = 1;
                // 右方向の走査
                int y;
                for(y = j+1; y < W; ++y) {
                    if(MAP[i][y] == '.') ++ans;
                    else break;
                }
                for(int ytmp = j; ytmp < y; ++ytmp) {
                    yMAP[i][ytmp] = ans;
                }
                j = y-1;
            }
        }
    }

    for(int j = 0; j < W; ++j) {
        for(int i = 0; i < H; ++i) {
            xMAP[i][j] = 0;
            if(MAP[i][j] == '.') {
                int ans = 1;
                //下方向の走査
                int x;
                for(x = i+1; x < H; ++x) {
                    if(MAP[x][j] == '.') ++ans;
                    else break;
                }
                for(int xtmp = i; xtmp < x; ++xtmp) {
                    xMAP[xtmp][j] = ans;
                }
                i = x-1;
            }
        }
    }
    /*
    cout << "x:" << endl;
    for(int i = 0; i < H; ++i) {
        for(int j = 0; j < W; ++j) {
            cout << xMAP[i][j] << " ";
        }
        cout << endl;
    }

    cout << "y" << endl;
    for(int i = 0; i < H; ++i) {
        for(int j = 0; j < W; ++j) {
            cout << yMAP[i][j] << " ";
        }
        cout << endl;
    }
    */
    int ans = 0;
    for(int i = 0; i < H; ++i) {
        for(int j = 0; j < W; ++j) {
            ans = max(xMAP[i][j] + yMAP[i][j], ans);
        }
    }
    cout << ans - 1 << endl;
    return 0;
}

Measured memory_bytes: 35584
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<algorithm>
#include<map>
#include<iostream>
const int maxn = 1e5 + 5;
const long long mod = 998244353;
using namespace std;
int G[maxn] , n , m;
long long ans , dp[1003][maxn];
struct node{
	int w , v;
};
node a[maxn];
long long dpr(){
	memset(dp , 0 , sizeof dp);
	for(int i = 1;i <= n;i++){
		for(int j = 1;j <= m;j++){
			dp[i][j] = dp[i - 1][j];
			if(a[i].w > j)continue;
			dp[i][j] = max(a[i].v + dp[i - 1][j - a[i].w] , dp[i - 1][j]);
		}
	}
	return dp[n][m];
}
int main(){
	cin >> n >> m;
	for(int i = 1;i <= n;i++){
		cin >> a[i].w >> a[i].v;
	}
	ans = dpr();
	printf("%lld\n",ans);
return 0;
}

Measured memory_bytes: 783872
#include <iostream>

using namespace std;

int main() {
    int k;
    string s;
    cin >> k >> s;
    int n = s.size();
    if (n <= k) {
        cout << s << endl;
    } else {
        string ans = s.substr(0, k);
        ans += "...";
        cout << ans << endl;
    }
    return 0;
}

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

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



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

  vector<queue<char>> que(3);
  rep(i,3) { 
    string s;
    cin >> s;
    rep(j,sz(s)) que[i].push(s[j]);
  }
  char now = 'a';
  for(;;) {
    if(que[now-'a'].empty()) {
      char ans = now - 'a' + 'A';
      cout << ans << endl;
      return 0;
    }
    char ne = que[now-'a'].front(); 
    que[now-'a'].pop();
    now = ne;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n+1); i++)
const long long INF = 1LL << 60;
int main(){
   int N;
   cin>>N;
   vector<int>A(N);
   rep(i,N){
       cin>>A[i];
   }
   sort(A.begin(),A.end());
   ll ans=0;
   if(N%2==0){
       rep(i,N){
           if(i<N/2){
               ans-=A[i]*2;
           }
           else{
               ans+=A[i]*2;
           }
       }
       ans+=A[N/2-1];
       ans-=A[N/2];
   }
   else{
   ll Q=0;
    rep(i,N){
      if(i<N/2){
        Q-=A[i]*2;
      }
      else{
        Q+=A[i]*2;
      }
    }
     Q-=A[N/2];
     Q-=A[N/2+1];
   rep(i,N){
       if(i<=N/2){
           ans-=A[i]*2;
       }
       else{
           ans+=A[i]*2;
       }
   }
   ans+=A[N/2-1];
   ans+=A[N/2];
     ans=max(ans,Q);
   }
   cout<<ans<<endl;
}


Measured memory_bytes: 3792
s=int(input())
t=input()
a=0
b=0
c=0
for i in range(s):
  if t[i]=='R':
    a=a+1
  elif t[i]=='G':
    b=b+1
  else:
    c=c+1
g=a*b*c
for j in range(s):
  for k in range(j+1,s):
    p=2*k-j
    if p>s-1:
      break
    if t[j]!=t[k] and t[p]!=t[k] and t[p]!=t[j]:
      g=g-1
print(g)

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

int main(){
	string s;
	int su=700;
	cin>>s;
	for(int i=0;i<3;i++){
		if(s[i]=='o') su+=100;
	}
	cout<<su<<endl;
	return 0;
}

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

d = []
for i in range(1, n+1):
  d.append(i)
  sumd = sum(d)
  if sumd == n:
    break
  if sumd > n:
    v = sumd - n
    d.remove(v)
    break
  
for dv in d:
  print(dv)
    
    
#1 2 3 4 5 6 7
#1 2   4

#1 2 3 4 5 6 7 8
#1   3 4

#1 2 3 4 5 6 7 8 9
#  2 3 4

#1 2 3 4 5 6 7 8 9 10
#1 2 3 4

#1 2 3 4 5 6 7 8 9 10 11
#1 2 3   5

#1 2 3 4 5 6 7 8 9 10 11 12
#1 2   4 5


Measured memory_bytes: 3572
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    rep(i,3){
        if(s[i]=='7'){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}


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

using namespace std;

#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
typedef long long LL;
int main(){
int A,B;
string s;
cin>>A>>B>>s;
string ret= "Yes";
REP(i,A)if(!isdigit(s[i]))ret="No";
if(s[A]!='-')ret="No";
REP(i,B)if(!isdigit(s[i+A+1]))ret="No";
cout<<ret<<endl;
}

Measured memory_bytes: 256
N = int(input())
S = input()

E = [0]*N
W = [0]*N

for i in range(len(S)):
    j = N-1-i
    if S[i] == "E" and i < N-1:
        E[i+1] = E[i] + 1
    elif i < N-1:
        E[i+1] = E[i]
    if S[j] == "W" and 0 < j:
        W[j-1] = W[j] + 1
    elif 0 < j:
        W[j-1] = W[j]
ans = float("inf")
for i in range(N):
    tmp = E[i] + W[i]
    if (N-tmp-1) < ans:
        ans = N-tmp-1
print(ans)

Measured memory_bytes: 46296
#include <bits/stdc++.h>
#define pb push_back
#define mem(a, b) memset(a, b, sizeof(a))
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const int MAXN = (1<<30);
const int maxn = 200000 + 50;
const ll mod = 1e9+7;

ll fac[maxn], inv[maxn];//fac[i] 保存阶乘，inv[i] 保存fac[i]的逆元

void add(ll &a, ll b){
    a += b;
    if(a >= mod) a -= mod;
}
//快速幂
ll pow_mod(ll a, ll p){
    ll ans = 1;
    while(p){
        if(p & 1) ans = ans * a % mod;
        a = a * a % mod;
        p >>= 1;
    }
    return ans;
}

//组合计算公式
ll C(int n, int k){
    return (fac[n] * inv[k] % mod )* inv[n-k] % mod;
}
int a[maxn], n;
int cnt[maxn];
int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    fac[0] = 1;
    for(int i = 1; i < maxn; i++) fac[i] = fac[i-1] * i % mod;
    inv[maxn - 1] = pow_mod(fac[maxn - 1], mod - 2);
    for(int i = maxn - 2; i >=0; i--) inv[i] = inv[i+1] * (i+1) % mod;
    int num;
    cin >> n;
    for(int i = 1; i <= n+1; i++)      
      cin >> a[i],cnt[a[i]]++;
    for(int i = 1; i <= n+1; i++)
      if(cnt[i] == 2){
        num = i;
        break;
      }
      int l, r;
      for(int i = 1; i <= n+1; i++){
        if(a[i] == num){
          l = i;
          break;
        }
      }
      for(int i = n+1; i >= 1; i--){
        if(a[i] == num){
          r = n+1-i+1;
          break;
        }
      }
      int t = l+r-2;
      int m = 0;
      for(int i = 1; i <= n+1; i++){
        if(m <= t){
          cout << (C(n+1, i) - C(t, m) + mod) % mod << endl;
          m++;
        }
        else cout << C(n+1, i) << endl;
      }
  return 0; 
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first 
#define se second
#define pi pair<ll,ll> 
#define pii pair<ll,pi>
#define pb push_back
#define mk make_pair
int main(){ 
  #ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
  #endif
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll a,b;
  cin>>a>>b;
  cout<<a*b<<endl;
}

Measured memory_bytes: 3652
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); i--)
#define ITER(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FIILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL) INF;

const int MAX = 666;
const int MOD = 1000 * 1000 * 1000 + 7;
const double EPS = 1e-7;




int main()
{
    string s;
    cin >> s;
    int c1 = s[0] - '0';
    int fnd = 0;
    FOR(i, 1, SZ(s))
        if (s[i] != '9')
            fnd = 1;
    if (!fnd)
        cout << SZ(s)*9 - 9 + c1 << endl;
    else
        cout << c1 - 1 + SZ(s) * 9 - 9 << endl;
    return 0;
    
}


Measured memory_bytes: 256
//#include<iostream>
//#include<algorithm>
//#include<string>
//#include <cmath>
//#include <vector>
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define REP(x,n) for(int x=0;x<n;x++)

// vector 操作 
// vector<int> data(10,5) 5が10個　data(10) 要素数10
// v.size(), v.empty(), v.insert(itr,値), v.erase(itr) (first,last),
// sort(itr), find(all(x),値),reverse(itr),accumulate(itr,0) 積算,
// v.swap
// stringも同じ itrがただの数字になる
// s.substr(n,m)n番目以降m文字取り出す　erase(n,m)も  s.find
#define vei vector<int> 
#define velli vector<long long int> 
#define pb(x) push_back(x) // 末尾にxを加える
#define pb2 pop_back() // 末尾削除
#define all(x) (x).begin(),(x).end() //イテレーター
#define be(x) (x).begin()
//auto  auto begin = v.begin()とか

// map 操作
// map<string,int> mp キー=string 値=int型  pair< , >型
// 代入:mp["abc"]=123  mp.erase(キー)
// itr = mp.begin()のとき　itr->first = key, itr->second = val
// mp.find(key) itrを返す
typedef pair<int,int> P;  //q(p.first,p.second)で定義できる？

// lcm( , ) gcd( , ) 最大公約数　最小公倍数

// 標準入力
// if(cin.eof()) break; 入力数が決まってないとき
// ifstream  whilwee(ifs>>data)
// while(cin){}
// 一行ごと　getline(cin,s)

// 浮動小数点
// cout << fixed; 以下と組fみ合わせで小数点以下n桁
// cout << setprecision(n) << 値; n桁表記
// defaultfloat

////////////// Stack //////////////

int MAX = 1000;
int top;
int s[1000];

int isEmpty(){
    return top==0;;
}

int isFull(){
    return top >= MAX - 1;
}

void push(int x) { 
    s[++top] = x;
}

int pop(){
    top--;
    return s[top+1];
}

int main (){
    int a,b;
    top = 0;
    string s2;

    int i=0;
    while(1){
        cin >> s2;
        if(cin.eof()) break;

        if(s2[0] == '+'){
            a = pop();
            b = pop();
            push(a+b);
        }else if(s2[0] == '-'){
            b = pop();
            a = pop();
            push(a-b);
        }else if(s2[0] == '*'){
            a = pop();
            b = pop();
            push(a*b);
        } else {
            int sss;
            istringstream is(s2) ;
            is >> sss;
            push(sss);
        }
    }
        cout << pop() << endl;
}


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

int main(){

    int n;
    while(1){

        int sum=0,avg=0;
     
        cin>>n;

        if( n == 0) break;

        vector<int>  point(n);

        for(int i=0; i<n; i++){

            cin>>point.at(i);
        }

        sort(point.begin(),point.end());



        for(int i = 0; i<n; i++){

         sum += point.at(i);

        }
        
        avg = (sum - point.at(0) - point.at(n-1) ) / (n -2);

        cout<<avg<<endl;
    }


    return 0;

}


Measured memory_bytes: 3108
import java.util.Scanner;
import java.util.PriorityQueue;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt(); //商品の数
    int M = sc.nextInt(); //割引券の数
    PriorityQueue pq = new PriorityQueue();
    
    for(int i=0;i<N;i++){
      int a = sc.nextInt();
      pq.add(-a);
    }
    
    for(int i=0;i<M;i++){
     int new_pd = (int)pq.poll()/2;
      pq.add(new_pd);
    }
    long ans = 0;
    while(!pq.isEmpty()){
      ans -= (int)pq.poll();
    }   
    System.out.println(ans);
  }
}



Measured memory_bytes: 58644
package main

import "fmt"

func main() {
	var X int
	fmt.Scan(&X)
	a := make([]bool, 1000000)

	for i := X; i < 1000000; i++ {
		if a[i] {
			continue
		}
		if IsPrime(i) {
			fmt.Println(i)
			return
		} else {
			a[i] = true
			for j := 2; i*j <= 100000; j++ {
				a[i*j] = true
			}
		}
	}
}

func IsPrime(n int) bool {
	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			return false
		}
	}
	return n != 1
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pci pair <char, int>
#define ppll pair <pll, pll>
#define vll vector <ll>
#define vvll vector <vll>
#define vpll vector <pll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mll map <ll, ll>
#define fastmap gp_hash_table
#define cd complex <double>
#define vcd vector <cd>
#define PI 3.14159265358979
#pragma 03
using namespace std;
using namespace __gnu_pbds;
int main(){
	fastio;
	mll a; ll n;
	cin >> n;
	for (ll i = 0; i<n; i++){
		ll ip; cin >> ip;
		if (a[ip] > 0){
			cout << "NO";
			return 0;
		}
		a[ip] = 1;
	}
	cout << "YES"; 
	return 0;	
}

Measured memory_bytes: 12800
#include <bits/stdc++.h>
#define mod 1000000007 //1e9 + 7
#define nl cout<<"\n"
// #define out cout
// #define tf cin
#define s second
#define f first
#define fr(i, n) for(int i = 0; i<n; i++)
#define lr(i, n) for(int i = n-1; i>=0; i--)
#define frr(i, j, n) for(int i = j; i<n; i++)
#define set_val -1
#define Mem(x) memset(x, set_val, sizeof(x))
#define print(x) for(auto xx: x)cout<<xx<<" "
#define FIO ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
using namespace std;
typedef long long int lli;
typedef long double lld;

lli power(lli a, lli b){
    // a^m = (a^(m/2))*(a^(m/2))
    if(b==0)return 1;
    lli p = power(a, b/2)%mod;
    p = (p*p)%mod;
    if(b%2==0)return p;
    else return (a*p)%mod;
}
lli modInverse(lli a){
    return power(a, mod-2);
}
lli modDiv(lli a, lli b){
    return (a * modInverse(b))%mod;
}
int main(){
    int t;
    cin>>t;
    cout<<(!t);
    return 0;
}

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

using namespace std;
const int maxn=10000;
int a[maxn];
int main()
{
	string s;
	cin >> s;

	for(int i = 0 ; i < s.size() ; i++)
	{
		if(s[i]=='S')
		{
			a[0]=1;
		}
		if(s[i]=='N')
		{
			a[1]=1;
		}
		if(s[i]=='E')
		{
			a[2]=1;
		}
		if(s[i]=='W')
		{
			a[3]=1;
		}
	}
	
	if(a[1] != a[0])
	{
		cout << "No";
	}
	else
	{
		if(a[2] != a[3] )
		{
			cout << "No";
		}
		else
		{
			cout << "Yes";
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
inline int read(){
    int x = 0; char c = getchar();
    while (!isdigit(c)) c = getchar();
    while (isdigit(c)) x = x * 10 + c - '0',c = getchar();
    return x;
}
template <typename T> void read(T &x){
	x = 0; int f = 1; char ch = getchar();
	while (!isdigit(ch)) {if (ch == '-') f = -1; ch = getchar();}
	while (isdigit(ch)) {x = x * 10 + ch - '0'; ch = getchar();}
	x *= f;
}
inline void write(int x){if (x > 9) write(x/10); putchar(x%10+'0'); }

const int N = 1050,K = 20 + 5,P = 1e9 + 7;
int n,k,a[K];
int fac[N],nfac[N],inv[N];
inline int C(int n,int m){ return (n<m||n<0||m<0) ? 0 : 1ll*fac[n]*nfac[m]%P*nfac[n-m]%P; }
int t[K][N];
int dp[K][N];
int main(){
	int i,j,e;
	read(n),read(k); for (i = 1; i <= k; ++i) read(a[i]);
	inv[0] = fac[0] = nfac[0] = inv[1] = fac[1] = nfac[1] = 1;
	for (i = 2; i <= n; ++i){
		fac[i] = 1ll*fac[i-1]*i%P;
		inv[i] = 1ll*(P-P/i)*inv[P%i]%P;
		nfac[i] = 1ll*nfac[i-1]*inv[i]%P;
	} 
	for (i = 1; i <= k; ++i)
	for (j = 0; j <= n; ++j) t[i][j] = 1ll*C(n-j,a[i]-j)*nfac[j]%P;
	dp[0][0] = 1;
	for (i = 1; i <= k; ++i)
	for (j = 0; j <= n; ++j){
		dp[i][j] = 0;
		for (e = 0; e <= j; ++e) dp[i][j] = (dp[i][j] + 1ll * t[i][e] * dp[i-1][j-e]) % P;
	}
	int ans = 1ll * dp[k][n] * fac[n] % P; 
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<iostream>
#include<algorithm>
#include<stack>
using namespace std;
typedef long long ll;
int main()
{
    int s[100005];
    memset(s,0,sizeof(s));
    int n,q,k;
    cin>>n>>k>>q;
    k=-k;
    k+=q;
    for(int i=0;i<q;i++)
    {
        int a;
        scanf("%d",&a);
        s[a]++;
    }
    for(int i=1;i<=n;i++)
    {
        if(s[i]>k)
            puts("Yes");
        else puts("No");
    }
    return 0;
}


Measured memory_bytes: 1024