akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
int A, B, C, X, Y;
int main()
{
  cin >> A >> B >> C >> X >> Y;
  int total = 1e10; // intの最大値
  for (int i = 0; i <= 100000; i++)
  {
    total = min(total, i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B);
  }
  cout << total << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n;
    while(cin >> n, n){
        vector<int> v(n);
        for (auto &&i : v) scanf("%d", &i);
        int s = 0;
        sort(v.begin(), v.end());
        for (int i = 1; i < n-1; ++i) {
            s += v[i];
        }
        printf("%d\n", s/(n-2));
    }
    return 0;
}



Measured memory_bytes: 3252
import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt();
    if(num<1200){
      System.out.println("ABC");
    }else if(num<2800){
      System.out.println("ARC");
    }else{
      System.out.println("AGC");
    }
  }
}

Measured memory_bytes: 21076
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=1e9+7;

int main(){
    ll N,M;
    cin>>N>>M;

    if(N==1&&M==1){
        cout<<1<<endl;
        return 0;
    }

    if(N==1||M==1){
        cout<<max(0LL,max(N-2,M-2))<<endl;
        return 0;
    }

    cout<<(N-2)*(M-2)<<endl;
}



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

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int ans = min(a, k);
    k = max(0, k - a);
    k = max(0, k - b);
    if(k == 0) {
        cout << ans << endl;
    }
    else {
        cout << ans - k << endl;
    }
    return 0;
}


Measured memory_bytes: 3652
N = int(input())
T = [[-1] * N for _ in range(N)]
for i in range(N):
    for _ in range(int(input())):
        x, y = map(int, input().split())
        T[i][x - 1] = y

ans = 0
for i in range(1 << N):
    is_kind = [i >> j & 1 for j in range(N)]
    found = True
    for j in range(N):
        if not is_kind[j]:
            continue
        for k in range(N):
            if j == k or T[j][k] == -1 or T[j][k] == is_kind[k]:
                continue
            found = False
    if found:
        ans = max(ans, sum(is_kind))
print(ans)


Measured memory_bytes: 3064
import sys
S = list(map(str,input().split()))

for I in S:
    if not I.islower():
        sys.exit()
    if len(I) < 0 or len(I) > 10:
        sys.exit()

result = ""
for J in S:
    result = result + J[0:1]
print(result.upper())

Measured memory_bytes: 9052
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9+7;
#define REP(i,j,n) for(int i=j;i<n;i++)
#define rep(i,n) REP(i,0,n)


// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int x,y;
    cin >> x >> y;
    if (y%2)
    {
        cout << "No" << endl;
    }
    else
    {
        int a = -x + y/2;
        int b = 2 * x - y/2;
        if (a>=0 && b>= 0)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
        
    }
    
}


Measured memory_bytes: 3628
#include<iostream>
#include<vector>
using namespace std;
long long n,m;
struct data{
	int v;
	vector<int> c;
};
data t[200100];
long long a,b;
void tree(int x,int y)
{
	t[x].v+=y;
	y=t[x].v;
	for(int i=0;i<t[x].c.size();i++)
		tree(t[x].c[i],y);
	return ;	
}
int main()
{
	cin>>n>>m;
	for(int i=0;i<n-1;i++)
	{
		cin>>a>>b;
		t[a].c.push_back(b);
	}
	for(int i=0;i<m;i++)
	{
		cin>>a>>b;
		t[a].v+=b;
	}
	tree(1,0);
	for(int i=1;i<=n;i++)
		cout<<t[i].v<<" ";
	cout<<endl;	
} 

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

int main(){
	int a[10];
	int v1,v2;
	while(cin >> a[0]){
		char com;
		for(int i=1;i<10;i++) cin >> com >> a[i];
		cin >> com >> v1 >> com >> v2;
		int l = 0;
		for(int i=0;i<10;i++){
			l += a[i];
			a[i] *= v1+v2;
		}
		l *= v1;
		int s = 0;
		for(int i=0;i<10;i++){
			s += a[i];
			if(l<=s){
				cout << i+1 << endl;
				break;
			}
		}
	}
}

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


using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,s) for (auto i = begin(s); i != end(s); ++i)
#define itrepd(i,s) for (auto i = --end(s); i != begin(s); --i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
#define rall(f,x,...) [&](decltype(x)& whole) { return (f)(rbegin(whole), rend(whole), ##__VA_ARGS__); }(x)
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e17;
constexpr ll mod = static_cast<ll>(1e9 + 7);
std::ostream& endn(std::ostream& os) { return os.put(os.widen('\n')); }
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T, class ... Args> constexpr void mins(T& a, Args... args) { a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr void maxs(T& a, Args... args) { a = max<T>({ a,args... }); }

template<class T>
constexpr T gcd(T a, T b) {
    if (a < b) gcd(b, a);
    T r = 0;
    while ((r = a % b)) { a = b; b = r; }
    return b;
}
template<class T>
constexpr T lcm(T a, T b) {
    T g = gcd<T>(a, b);
    return a / g * b;
}


ll a, b;
void solve() {
    cin >> a >> b;

    auto l = gcd(a, b);
    ll ans = 0;
    int e = (int)ceil(sqrt(l));
    vector<ll> vec;
    reps(i, e) {
        if (l == 0)break;
        if (l % i == 0) {
            if (l / i != 1)vec.push_back(l / i);
            if (i != 1) {
                while (l % i == 0)l /= i;
            }
            ++ans;
        }
    }
    all(sort, vec);
    rep(i, vec.size()) {
        if (l == 0)break;
        if (l % vec[i] == 0) {
            if (i != 1) {
                while (l % vec[i] == 0)l /= vec[i];
            }
            ++ans;
        }
    }
    cout << ans << endn;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout << flush;
    return 0;
}


Measured memory_bytes: 256
/**
 *  Hi, I'm Arpan.
 *
*/

#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
#define inv(v)         \
    for (auto &it : v) \
        cin >> it;
#define MOD 1000000007
#define pb push_back
#define popb pop_back()
#define endl "\n"
#define fi first
#define se second
typedef priority_queue<ll, vector<ll>, greater<ll>> minheap;
typedef priority_queue<ll> maxheap;
#define sortv(v) sort(v.begin(),v.end())
#define rsortv(v) sort(v.begin(),v.end(), greater<>());

ll modPower(ll num,ll r) {
	if(r==0) return 1;
	if(r==1) return num%MOD;
	ll ans=modPower(num,r/2)%MOD;
	if(r%2==0) {
		return (ans*ans)%MOD;
	} return (((ans*ans)%MOD)*num)%MOD;
}

ll nCr(ll n, ll r) {
    ll res = 1;
    if (r > n - r) {
        r = n - r;
    }
    for(int i=0;i<r;i++) {
        res *= (n - i);
        res /= (i + 1);
    }
    return res;
}

/*******************************************/
//
void solve()
{
	int n;
	cin >> n;
	vi a(n);
	inv(a);
	int ans = 0;
	for(int i=0;i<n;i++){
		if((i+1)%2 == 1 && a[i]%2 == 1)ans++;
	}
	cout << ans;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
	//cin >> t;

    while (t--)
        solve();
    return 0;
}



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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll X; cin >> X;
    ll ng = 0, ok = X;
    ll m = (ng+ok)/2;
    while(abs(ok-ng) > 1){
        ll eval;
        if(m % 2) eval = (m/2 + 1)*6 + (m/2)*5;
        else eval = (m/2)*6 + (m/2)*5;
        if(eval >= X) ok = m;
        else ng = m;
        m = (ok+ng)/2;
    }
    cout << ok << endl;
    return 0;
}

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

int main(){
  int a,b;
  int tmp,amari;
  int gcd; 
  scanf("%d",&a);
  scanf("%d",&b);

  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  amari=b;
 
  while(amari!=0){
    amari = a % b;
    a = b;
    b = amari;
    }

  gcd = a;


  printf("%d\n",gcd);

}

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

using namespace std;

int a, b, c, d;

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

    cin >> a >> b >> c >> d;

    while(a > 0 && c > 0){
        c -= b;

        if(c <= 0) cout << "Yes\n", exit(0);

        a -= d;

        if(a <= 0) cout << "No\n", exit(0);
    }
    
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>

using namespace std;

#define INF (int)(1e9)

int main(){
  int num[3], ans = INF;
  cin >> num[0] >> num[1] >> num[2];
  sort(num, num + 3);
 
  for(int x = num[0]; x <= num[2]; ++x){
    int cand = 0;
    for(int i = 0; i < 3; ++i){
      if(x > num[i]){
        cand += (x - num[i] + 1) / 2;
        if((x - num[i]) % 2 == 1) ++cand;
      }else{
        cand += num[i] - x;
      }
    }
    ans = min(ans, cand);
  } 
  cout << ans << endl;

 return 0;
}


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

int main() {

  int x;
  cin >> x;
  
  int a,frag;
  
  while(true){
    a = 2;
    frag = 1;
    
    while(a * a <= x){
      if ( x % a == 0 ){
        frag = 0;
        break;
      }else{
        a++;
      }
    }
    if ( frag == 0 ){
      x++;
    }else{
      break;
    }
  } 
  
  cout << x << endl;
 
}


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

int main(){
	int n;
	vector<int> v(n);
	int sum = 0;
	cin >> n;
	for(int i=0; i < n; i++){
		int t;
		cin >> t;
		v[i] = t;
		sum += t;
	}
	int m;
	cin >> m;
	for (int i = 0; i<m; i++) {
		int p, x;
		cin >> p >> x;
		cout << sum - (v[p-1] - x) << endl;
	}
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#define gc getchar()
#define pc putchar
#define rep(i,x,p) for(int i = x;i <= p;++ i)
#define sep(i,x,p) for(int i = x;i >= p;-- i)
using namespace std;
const int maxN = 1e5 + 7;

int a[maxN];

inline int read() {
	int x = 0 ,f = 1;char c = gc;
	while(c < '0' || c > '9') {if(c == '-')f = -1;c = gc;}
	while(c >= '0' && c <= '9') {x = x * 10 + c - '0';c = gc;}
	return x * f;
}

void print(int x) {
	if(x < 0) {
		pc('-');
		x = -x;
	}
	if(x >= 10) print(x / 10);
	pc(x % 10 + '0');
}

int main() {
	int n,maxx = 0, minn = 1e6;
	n = read();
	rep(i,1,n) a[i] = read();
	rep(i,1,n) maxx = max(maxx,a[i]);
	rep(i,1,n) minn = min(minn,a[i]);
	if(maxx > minn + 1)  {puts("No");return 0;}
	if(maxx == minn) {
		if(minn == n - 1 || 2 * minn <= n) puts("Yes");
		else puts("No");
		return 0;
	}
	int cnt = 0;
	rep(i , 1 , n) if(a[i] == minn) cnt ++;
	if(cnt >= maxx || 2 * (maxx - cnt) > n - cnt) puts("No");
	else puts("Yes");
	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{

        int a;
        int b;
        int c;
        int cnt;
 

	// 個数のの入力
        scanf("%d %d %d",&a,&b,&c);


        if(a == b) {
          if (a == c ) {
 	    cnt = 1;
          }
        }
        if (a == b) {
          if (a != c) {
            cnt = 2;
          }
        }  

        if (a != b) {
          if (a == c) {
            cnt =2 ;
          }
        }

        if (a != b) {
          if (a != c) {
            if (b == c) {
               cnt =2 ;
            }
            else {
               cnt = 3 ;
            }
          }
        }
         
        printf("%d\n",cnt);
      
        
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 ll H,W;

vector<string> vec;
vector<ll> A{1,0,-1,0};
vector<ll> B{0,1,0,-1};
vector<ll> C{-2,-1,0,1,2};
vector<ll> D{-2,-1,0,1,2};
int main() {

  cin>>H>>W;
  ll Ch,Cw;
  cin>>Ch>>Cw;
  Ch--;
  Cw--;
  ll Dh,Dw;
  cin>>Dh>>Dw;
  Dh--;
  Dw--;
  
  vec=vector<string> (H);
  for(ll i=0;i<H;i++) {
cin>>vec[i];
  }
  
  vector<vector<ll>> note(H,vector<ll>(W,-1));
  
  deque<tuple<ll,ll,ll>> S;
  note[Ch][Cw]=0;
  S.push_back(make_tuple(Ch,Cw,0));
  
  while(!S.empty()) {
ll nh,nw,a;
    tie(nh,nw,a)=S.front();
    S.pop_front();
    
    if(note[nh][nw]==-1) {
note[nh][nw]=a;
      
    }
  
    
    
    
    for(ll i=0;i<4;i++) {
ll kh,kw;
      kh=nh+A[i];
      kw=nw+B[i];
      
      if(kh<0||kh>=H||kw<0||kw>=W) {
continue;
      }
      
      if(vec[kh][kw]=='#') {
continue;
      }
      if(note[kh][kw]!=-1) {
continue;
      }
      note[kh][kw]=a;
      S.push_front(make_tuple(kh,kw,a));
    }
    
    for(ll i=0;i<5;i++) {
for(ll j=0;j<5;j++) {
if(abs(C[i])+abs(D[j])<=1) {
continue;
}
  ll kh,kw;
  kh=nh+C[i];
  kw=nw+D[j];
 
     if(kh<0||kh>=H||kw<0||kw>=W) {
continue;
      }
      
      if(vec[kh][kw]=='#') {
continue;
      }
      if(note[kh][kw]!=-1) {
continue;
      }
  
  S.push_back(make_tuple(kh,kw,a+1));
              
}
    }
    
  }
  
cout<<note[Dh][Dw]<<endl;
  
}

    
    
    
      
      
    
  
  
  
  
  

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

// syntax sugar: `for (int i = 0; i < N; ++i)`
#define rep(i, N) for (int i = 0; i < (int)(N); ++i)
#define rep2(i, startValue, N) for (int i = (int)(startValue); i < (int)(N); ++i)
// syntax sugar: `for (int i = 0; i < N; ++i)`
#define REP(type, name, beginValue, endCondValue) \
  for (type name = beginValue; name < endCondValue; ++name)
// syntax sugar: 多次元vector
#define VECTOR_DIM3(T, name, d1, d2, d3, initValue) \
    std::vector<std::vector<std::vector<T>>> name(d1, std::vector<std::vector<T>>(d2, std::vector<int>(d3, initValue)));
#define VECTOR_DIM2(T, name, d1, d2, initValue) \
    std::vector<std::vector<T>> name(d1, std::vector<T>(d2, initValue));
#define VECTOR_DIM1(T, name, d1, initValue) \
    std::vector<T> name(d1, initValue);
#define ll long long
#define ld long double

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

  // 0または0の前後で収束
  // 2回でもとの値

  ll ans = 0;

  const ll goingtozero = x / d;
  if (goingtozero >= k) {
  // 0に近づいている途中で回数切れ
    ans = x - k * d;
    //cout << "0に近づいている途中で回数切れ" << endl;
  } else {
    k -= goingtozero;
    x -= goingtozero*d;

    //cout << "x:" << x << ",k:" << k << ",going:" << goingtozero << endl;

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

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


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

int main()
{
    int N;
    cin >> N;
    char S[N];
    cin >> S;
    int cnt;
    char now = '-';
    for (int i = 0; i < N; i++)
    {
        if (S[i] != now)
        {
            cnt++;
            now = S[i];
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(void){
    int P,Q,R;
    cin >> P >> Q >> R;
    int T;
    if((P+Q)<=(Q+R)&&(P+Q)<=(P+R)){
        T=P+Q;
    }
    if((Q+R)<=(P+Q)&&(Q+R)<=(P+R)){
        T=Q+R;
    }
    if((P+R)<=(Q+R)&&(P+R)<=(P+Q)){
        T=P+R;
    }
    cout << T;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using std::cin; using std::cout; using std::cerr; using std::endl;
const int N = 2e5 + 10;
int a[N], prev[N];
typedef long long ll;
ll f[64][N];
int g[64][N];

int main(){
	std::ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	std::memset(prev, -1, sizeof(prev)), std::memset(f, -1, sizeof(f)), std::memset(g, -1, sizeof(g));
	int n; ll kk, lim;
	cin >> n >> kk;
    lim = kk * n;
	for (int i = 0; i < n; ++i){
		cin >> a[i];
		if (prev[a[i]] != -1)
			g[0][prev[a[i]]] = i, f[0][prev[a[i]]] = i - prev[a[i]];
		prev[a[i]] = i;
	} std::memset(prev, -1, sizeof(prev));
	for (int i = 0; i < n; ++i) if (prev[a[i]] == -1) prev[a[i]] = i + n;
	for (int i = 0; i < n; ++i) if (g[0][i] == -1) g[0][i] = prev[a[i]]%n, f[0][i] = prev[a[i]] - i;
	for (int k = 1; k < 62; ++k)
		for (int i = 0; i < n; ++i)
			f[k][i] = f[k-1][i] + f[k-1][(g[k-1][i]+1)%n] + 1,
			g[k][i] = g[k-1][(g[k-1][i]+1)%n];
//	for (int k = 0; k < 4; ++k){
//		for (int i = 0; i < n; ++i)
//			cerr << f[k][i] << ' ';
//		cerr << endl;
//	}
    int i = 0, k = 0; ll x = 0;
    while(x < lim){
//    	cerr << x << ' ';
        do{
            if (x + f[k][i] < lim){
                x += f[k][i] + 1;
                i = (g[k][i] + 1)%n;
                k++;
            } else k--;
        } while(k >= 0 && x < lim);
        if (x < lim){
            cout << a[i] << ' ';
            k = 0;
            (i += 1) %= n;
            x += 1;
        }
    }
	return 0;
}

Measured memory_bytes: 153088
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
//#include<cstdio>
//#include<iomanip>//"cout<<fixed<<setprecision(n)<<sth<<endl;"
//#include<string>//"reverse(s's it,s's it)"
//#include<functional>//"greater<T>" "sort(a,a+n,greater<int>());""
//#include<cmath>//"abs" "sqrt"
//#include<numeric>//"accumulate(inputit,inputit,init,(optional) object)"
//#include<algorithm>//"lower_bound(it,it,v)" "next_permutation(a,a+n)"
//"reverse(v's it,v's it)"(v: vector)
//#include<cassert>//"assert(cond);": error if cond doesn't hold.
using namespace std;
#define pb push_back//also for STRING
#define fi first
#define sc second
#define mp make_pair
#define is insert//also use as v.is(v's it,w's it,w's it);
#define ps push//TMP//stack,(priority) queue,
#define fr front//TMP//queue//for priority, use top().
typedef long long ll;//not necessarily
typedef pair<int,int> pii;
//Add other types in the same way.

struct unionfind{
	vector<int> par,rk;

	unionfind(const int n){
		par.resize(n);
		rk.resize(n);
		for(int i=0;i<n;++i) par[i]=i;
		fill(rk.begin(),rk.end(),0);
	}

	int find(int x){
		if(par[x]==x){
			return x;
		}else{
			return par[x]=find(par[x]);
		}
	}

	void unite(int x,int y){
		x=find(x);
		y=find(y);
		if(x==y){
			return;
		}else if(rk[x]<rk[y]){
			par[x]=y;
		}else{
			par[y]=x;
			if(rk[x]==rk[y]){
				++rk[x];
			}
		}
	}

	bool same(int x,int y){
		return find(x)==find(y);
	}
};


#define MAX 100000

int main(){
	int a[MAX+2],sm[MAX+2];
	string s;
	cin>>s;
	s="a"+s;
	s+="a";
	//cout<<s<<endl;
	const int m=s.size()-1;
	for(int i=0;i<m;++i) a[i]=s[i+1]-s[i];
	//for(int i=0;i<m;++i) printf("i=%d, a[i]=%d\n",i,a[i]);
	unionfind u(m);
	for(int i=0;i<m-1-i;++i) u.unite(i,m-1-i);
	int n;
	cin>>n;
	while((n--)>0){
		int l,r;
		cin>>l>>r;
		u.unite(l-1,r);
	}
	fill(sm,sm+m,0);
	for(int i=0;i<m;++i){
//		printf("i=%d,grp is %d\n",i,u.find(i));
		sm[u.find(i)]+=a[i];
	}
	for(int i=0;i<m;++i) if(sm[i]%26!=0){
		cout<<"NO"<<endl;
		return 0;
	}
	cout<<"YES"<<endl;
	return 0;
}

Measured memory_bytes: 2044
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>
using namespace std;
using ll=long long;
using R=double;


int main(){
  int N;
  cin >> N;
  ll a[N+1],b[N+1];
  for(int i=0;i<N;i++){
    cin >> a[i];
  }
  for(int i=0;i<N;i++){
    cin >> b[i];
  }
  ll ans1=0, ans2=0;
  for(int i=0;i<N;i++){
    if(a[i]<b[i]){
      ans1+=(b[i]-a[i])/2;
    }
    else{
      ans2+=a[i]-b[i];
    }
  }
  if(ans1 >= ans2 ){
    cout << "Yes";
    return 0;
  }
  else {
    cout << "No";
    return 0;
  }
}


Measured memory_bytes: 384
import sys
N = int(input())
l = list(map(int, input().split()))
ans = 1

if 0 in l:
    print('0')
    sys.exit()
    
for e in l:
    ans *= e
    if ans > 10 ** 18:
        print('-1')
        sys.exit()

print(str(ans))

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

using namespace std;

#define ll  long long
#define ld  double

#define all(x)  x.begin(),x.end()
#define sz(x)   (int)x.size()

#define pb  emplace_back
#define X   first
#define Y   second

const int   N   = 5005;

typedef pair<int,int>   ii;

vector<int> g[N];

int nCh[N];
ll  f[N][N][2];
ll  h[N][2];
int a[N];

void dfs(int u,int p)   {
    nCh[u] = 1;

    f[u][0][0] = a[u] < 0 ? 1e18 : a[u];
    f[u][0][1] = a[u] > 0 ? 1e18 : a[u];

    for(int v : g[u])   if (v != p) {
        dfs(v,u);

        for(int i = 0 ; i < nCh[u] + nCh[v] ; ++i)
            h[i][0] = 1e18,
            h[i][1] = 1e18;

        for(int i = 0 ; i < nCh[u] ; ++i)
        for(int j = 0 ; j < nCh[v] ; ++j)   {
            int k = i + j;
            h[k][0] = min(h[k][0],f[u][i][0] + f[v][j][0]);
            h[k][1] = min(h[k][1],f[u][i][0] + f[v][j][1]);
            h[k][1] = min(h[k][1],f[u][i][1] + f[v][j][0]);
            h[k][1] = min(h[k][1],f[u][i][1] + f[v][j][1]);


            if (f[v][j][0] < 1e18 || f[v][j][1] < 0)    {
                h[k + 1][0] = min(h[k + 1][0],f[u][i][0]);
                h[k + 1][1] = min(h[k + 1][1],f[u][i][1]);
            }
        }
        nCh[u] += nCh[v];

        for(int i = 0 ; i < nCh[u] ; ++i)
            f[u][i][0] = h[i][0],
            f[u][i][1] = h[i][1];
    }
}

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

    int n;  cin >> n;

    for(int i = 1 ; i <= n ; ++i)
        cin >> a[i];

    for(int i = 1 ; i < n ; ++i)    {
        int x;  cin >> x;
        int y;  cin >> y;

        g[x].pb(y);
        g[y].pb(x);
    }

    dfs(1,0);

    for(int i = 0 ; i < n ; ++i)
        if (f[1][i][0] < 1e18 || f[1][i][1] < 0)    {
            cout << i;
            return  0;
        }
}

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

int main()
{
	int group[3][7] = { 
		{1, 3, 5, 7, 8, 10, 12}, 
		{4, 6, 9, 11, 0, 0, 0}, 
		{2, 0, 0, 0, 0, 0, 0},
	};
	int x, y;
	cin >> x >> y;

	int m, n = 0, o = 0;
	for(int i = 0; i < 3; ++i){
		for(int j = 0; j < 7; ++j){
			m = group[i][j];
			if(m == x) {
				n = i + 1;
			} else if (m == y) {
				o = i + 1;
			}
			
			if(m == 0) break;
		}
	}

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

	return 0;

}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	// Code for A - Programming Education
	var N int
	fmt.Scanf("%d", &N)
	if N == 1 {
		fmt.Println("Hello World")
	} else {
		var A, B int
		fmt.Scanf("%d", &A)
		fmt.Scanf("%d", &B)
		fmt.Println(A + B)
	}
}


Measured memory_bytes: 1832
#include "bits/stdc++.h"
using namespace std;
int main(){
    string s;
    cin >> s;
    int i,n=s.length(),ans=0,tmp=0;
    int a[n];
    for(i=0;i<n;i++){
        if(s.at(i)=='A'||s.at(i)=='T'||s.at(i)=='G'||s.at(i)=='C'){
            a[i]=1;
        }else{
            a[i]=0;
        }
    }
    for(i=0;i<n;i++){
        if(a[i]==0){
            ans = max(ans,tmp);
            tmp=0;
        }else{
            tmp++;
        }
    }
    ans = max(ans,tmp);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
t = int(raw_input())
a = raw_input().split()
small = int(a[0])
large = int(a[0])
total = 0
for i in a:
    v = int(i)
    if v < small:
        small = v
    if v > large:
        large = v
    total = total + v
print small,large,total

Measured memory_bytes: 4720
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())

#define MOD 1000000007


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

	int n,m;
	cin>>n>>m;
	int a,b;
	a = min(n,m);
	b = max(n,m);
	if (a+2<=b){
		cout<<0<<endl;
	}
	else if(a+1==b){
		long long ans = 1;
		rep(i, n)(ans *= i + 1) %= MOD;
		rep(i, m)(ans *= i + 1) %= MOD;
		cout<<ans<<endl;
	}
	else{
		long long ans = 2;
		rep(i, n)(ans *= i + 1) %= MOD;
		rep(i, m)(ans *= i + 1) %= MOD;
		cout<<ans<<endl;
	}


	return 0;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from collections import deque
cnt = 0
def main():
    K = int(readline())
    cnd = [i for i in range(1, 10)]

    dq = deque()
    for i in range(1, 10):
        dq.append(i)

    cnt = 0 
    while len(dq)>0:
        cnt += 1
        x = dq.popleft()
        v = x%10
        if v==0:
            for i in (0, 1):
                nx = 10*x+i
                cnd.append(nx)
                dq.append(nx)
        elif v == 9:
            for i in (-1, 0):
                nx = 10*x+9+i
                cnd.append(nx)
                dq.append(nx)
        else:
            for i in (-1, 0, 1):
                nx = 10*x+v+i
                cnd.append(nx)
                dq.append(nx)
        if cnt == K:
            break 
    cnd.sort()
    print(cnd[K-1])
if __name__ == '__main__':
    main()


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

int main(){
    int n;
    cin>>n;
    vector<double> a(n+1);
    for(int i=1;i<=n;i++) cin>>a[i];
    vector<vector<double>> dat(n+1,vector<double>(n+2));
    dat[1][0]=1-a[1];
    dat[1][1]=a[1];
    for(int i=2;i<=n;i++){
        for(int j=0;j<=i;j++){
            if(j==0){
                dat[i][j]=dat[i-1][j]*(1-a[i]);
            }
            else dat[i][j]=(dat[i-1][j]*(1-a[i])+(dat[i-1][j-1]*a[i]));
        }
    }
    double ans=0;
    for(int i=n/2+1;i<=n;i++){
        ans += dat[n][i];
    }
    printf("%.10f",ans);
}

Measured memory_bytes: 73728
import java.util.Scanner;

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

		int n = sc.nextInt();
		int a = 0;
		int count = 0;
		for (int i = 1; i <= n; i++) {
			a = sc.nextInt();
			if (i % 2 != 0 && a % 2 != 0) {
				count++;
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 35888
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  char b;
  cin >> b;
  switch(b)
  {
    case 'A':
      cout << 'T';
      break;
    case 'T':
      cout << 'A';
      break;
    case 'G':
      cout << 'C';
      break;
    case 'C':
      cout << 'G';
      break;
  }

  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int inf = 1e9;
double pi = 3.14159265359;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, b, a) for (int i = a - 1; i >= b; i--)
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

int main() {
    int n;
    cin >> n;
    ll a[n + 1];
    rep (i, 0, n + 1) cin >> a[i];
    ll tree[n + 1]; //要素の最大の数
    tree[n] = a[n];
    per (i, 0, n) { tree[i] = tree[i + 1] + a[i]; }
    tree[0] = 1;
    ll ans = 1;
    if (a[0] > 1) {
        cout << -1 << "\n";
        return 0;
    }
    rep (i, 1, n + 1) {
        tree[i] = min (tree[i], (tree[i - 1] - a[i - 1]) * 2);
        if (tree[i] <= 0 || a[i] > tree[i]) {
            cout << -1 << "\n";
            return 0;
        }
        ans += tree[i];
    }
    cout << ans << "\n";
}

Measured memory_bytes: 5196
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(void)
{
  int n, m;
  cin >> n >> m;

  vector<int> s(m);
  vector<char> c(m);

  for (int i = 0; i < m; i++)
    cin >> s[i] >> c[i];

  for (int i = 0; i < 1000; i++) {
    bool flag = true;
    string str = to_string(i);
    if (str.length() < n)
      continue;
    for (int j = 0; j < m; j++) {
      if (str[s[j] - 1] != c[j])
        flag = false;
    }
    if (flag) {
      cout << str << endl;
      return 0;
    }
  }
  cout << "-1" << endl;
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {

	nextReader = newScanner()

	n, m := nextInt(), nextFloat64()
	a := nextInts(n)

	count := 0.0
	sum := 0.0

	for _, s := range a {
		sum += float64(s)
	}

	var lim float64 = sum / (4.0 * m)
	for _, s := range a {
		if float64(s) >= lim {
			count++
		}
	}

	if count >= m {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

/* --------------------------------------------------------------------------
 *  std.io
 * ------------------------------------------------------------------------- */
var nextReader func() string

func newScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}
func nextString() string {
	return nextReader()
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextInt64s(n int) []int64 {
	r := make([]int64, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt64()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(nextReader(), 64)
	return f
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

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

func min(a, b int) int {
	if a < b {
		return a
	} else {
		return b
	}
}

func mins(t ...int) int {
	if len(t) == 0 {
		return 0
	}

	min := t[0]
	for i := 1; i < len(t); i++ {
		if min > t[i] {
			min = t[i]
		}
	}
	return min
}

func abs(a int) int {
	if a >= 0 {
		return a
	} else {
		return 0 - a
	}
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<set>
#include<map>

using namespace std;


int main() {
	int r, d, x;
	cin >> r >> d >> x;

	for (int i = 0; i < 10; i++) {
		x = r*x - d;
		cout << x << endl;
	}


	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    static int H;
    static int W;
    static String[][] a;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        H = sc.nextInt();
        W = sc.nextInt();

        a = new String[H+2][W+2];

        for (int i = 1; i <= H; i++) {
            String[] str = sc.next().split("");
            for (int j = 1; j <= W; j++) {
                a[i][j] = str[j - 1];
            }
        }

        showPixel();
    }

    private static void showPixel() {
        for (int i = 0; i < H+2; i++) {
            for (int j = 0; j < W+2; j++) {
                if (i == 0 || i == H+1 || j == 0 || j == W+1) {
                    System.out.print("#");
                } else {
                    System.out.print(a[i][j]);
                }
            }
            System.out.println();
        }
    }
}


Measured memory_bytes: 23720
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int A,B,C,D;cin>>A>>B>>C>>D;
  cout << (A+B==C+D?"Balanced":A+B>C+D?"Left":A+B<C+D?"Right":"hoge~~~~")<<endl;;
  return 0;
}

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

using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,n,m) for(ll i=n; i>(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define VEC2(x,a,b) vector<vector<ll>> x = vector<vector<ll>>(a,vector<ll>(b,0))
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cinv(v,n,m) FOR(i,n,m) cin>>v.at(i)
#define coutv(v,n,m) FOR(i,n,m) cout<<v.at(i) <<" "; cout<<end
#define cout(n) cout<<fixed<<setprecision(n)
int main(){
  ll N,A,B;
  cin>>N>>A>>B;
  cout<<min(N*A,B)<<endl;
}


Measured memory_bytes: 256
n,m = map(int, input().split())
edges = [list(map(int, input().split())) for _ in range(m)]
ans = 0

for edge_i in edges:
  check_list = [i for i in range(n)]
  for edge_j in edges:
    if edge_i != edge_j:
      check_list = [check_list[edge_j[0]-1] if check_list[i]==check_list[edge_j[1]-1] else check_list[i] for i in range(n)]
  if len(set(check_list))!=1:ans += 1
      
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
    int S;
    cin>> S;
    int a,b;
    a=S/100;
    b=S%100;
    
    if (1<=a&&a<=12)
    {
        if (1<=b&&b<=12)
        {
            cout<< "AMBIGUOUS"<<endl;
        }
        else
        {
            cout << "MMYY"<<endl; 
        }
        
    }
    else
    {
        if (1<=b&&b<=12)
        {
            cout<< "YYMM"<<endl;
        }
        else
        {
            cout << "NA" <<endl;
        }
        
    }
    
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int N = cin.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = cin.nextInt();
        }

        int cnt = 1;
        int mod = 0;
        for (int i = 1; i < N; i++) {
            int m;
            if (A[i - 1] < A[i]) {
                m = 1;
            } else if (A[i -1] > A[i]) {
                m = -1;
            } else {
                m = 0;
            }

            if (mod != 0 && m != 0 && mod != m) {
                cnt++;
                mod = 0;
            } else if (mod == 0) {
                mod = m;
            }
        }

        System.out.println(cnt);
    }
}

Measured memory_bytes: 48848
/******************************************
* nils sjoberg never died  *
* He hibernated *
* So did dinesh easwar *
******************************************/
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <cstdlib>
#include <iomanip>
 
using namespace std;
typedef vector< long long > vec;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
#define pb push_back
#define PB pop_back()
#define sqr(a) (((a) * (a)))
#define coud(a,b) cout<<fixed << setprecision((b)) << (a)
#define umap unordered_map
#define all(c) (c).begin(),(c).end()
#define newl "\n"
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rev(i,a,b) for(ll i=a; i>=b; i--)
#define forn(i, n) for (ll i = 0; i < n; i++)
#define sz(a) int((a).size())
#define frev(n) for(ll i=n-1; i>=0, i--)
#define tr(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define present(container, element) (container.find(element) != container.end())
#define vecpresent(container, element) (find(all(container), element) != container.end())
#define N 1000000007
#define PI 3.1415926535897932384
#define F first
#define S second
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

ll binpow(ll a, ll b, ll m){
	a %= m;
	ll res = 1;
	while(b>0){
	if(b&1)
		res = res * a % m;
	a = a * a % m;
	b >>= 1;
	}
	return res;
}

ll binmul(ll a, ll b, ll m){
	b %= m;
	ll res = 0;
	while(a>0){
		if(a&1)
			res = res + b % m;
		b = b + b % m;
		a >>= 1;
	}
	return res;
}

ll gcd(ll a, ll b){
	while(b){
		a %= b;
		swap(a, b);
	}
	return a;
}

pii fib(int n){
	if(n==0)
		return {0, 1};
	auto p = fib(n >> 1);
	int c = p.first * (2*p.second - p.first);
	int d = p.first*p.first + p.second*p.second;
	if(n&1)
		return {d, c+d};
	else
		return {c, d};
}


 
void solve(){
	ll n, d, x, y, cnt=0;
	cin >> n >> d;
	d *= d;
	forn(i, n){
		cin >> x >> y;
		x *= x; y*= y;
		if(x+y<=d) cnt++;
	}

	cout << cnt;
	
}



int main()
{
 	FAST
	ll test;
	test=1;
	//cin>>test;
	while(test--)
	{
		solve();
	}
	return 0;
}



Measured memory_bytes: 3648
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

const int INF = 10000000;
using namespace std;
typedef long long  ll;

int main()
{
	int n;
	
	while (cin>>n, n) {
		int p, a, b, max=0, maxP;
		rep(i, n) {
			cin >> p >> a >> b;
			if (a+b>max) {
				max = a+b;
				maxP = p;
			}
		}
		cout << maxP << " " << max << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define MAX 2000000

int h = 0;

int parent(int i) {
    return i / 2;
}

int left(int i) {
    return i * 2;
}

int right(int i) {
    return i * 2 + 1;
}

void maxHeapify(vector<int> &T, int i) {
    int l = left(i);
    int r = right(i);
    int Large;
    if (l <= h && T[l] > T[i]) {
        Large = l;
    } else {
        Large = i;
    }
    if (r <= h && T[r] > T[Large]) {
        Large = r;
    }

    if (Large != i) {
        swap(T[i], T[Large]);
        maxHeapify(T, Large);
    }
}

void buildMaxHeap(vector<int> &T) {
    for (int i = h / 2; i >= 1; i--) {
        maxHeapify(T, i);
    }
}

void heapIncreaseKey(vector<int> &T, int i, int key) {
    T[i] = key;
    while (i > 1 && T[parent(i)] < T[i]) {
        swap(T[i], T[parent(i)]);
        i = parent(i);
    }
}

int heapExtractMax(vector<int> &T) {
    int great = T[1];
    T[1] = T[h];
    h--;
    maxHeapify(T, 1);

    return great;
}

void insert(vector<int> &T, int key) {
    h++;
    T[h] = -MAX;
    heapIncreaseKey(T, h, key);
}

int main() {
    vector<int> T(MAX);
    while (true) {
        char S[7];
        scanf("%s", S);
        if (S[0] == 'i') {
            int key;
            scanf("%d", &key);
            insert(T, key);
        } else if (S[2] == 't') {
            int priority = heapExtractMax(T);
            printf("%d\n", priority);
        } else if (S[2] == 'd') {
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 10576
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int c1, c2, c3;
        if(!(cin >> c1 >> c2 >> c3))
            return 0;

        vector<bool> check(11, false);
        check[c1] = check[c2] = check[c3] = true;
        int num = 0;
        for(int i=1; i<=10; ++i){
            if(check[i])
                continue;
            if(c1 + c2 + i <= 20)
                ++ num;
        }

        if(num * 2 / 7 >= 1)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
}

Measured memory_bytes: 0
import sys
#input = sys.stdin.readline

def main():
    n = input()
    a = input().split(" ")
    # r = ""
    # for i in range(int(n)):
    #     r += str(a.index(str(i+1)) + 1) + " "
    # print(r[:-1])
    a = [(a[i],str(i+1)) for i in range(len(a))]
    a = list(map(lambda x:x[1],sorted(a,key=lambda x:int(x[0]))))
    print(" ".join(a))

if __name__ == '__main__':
    main()

Measured memory_bytes: 78444
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n;
	cin >> n;
	
	int ans = n / 2 + n % 2;
	
	printf("%.10f\n", (double)ans / (double)n);

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <set>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <map>
#include <cstring>
#include <cmath>
using namespace std;
#define MAXA 1001
#define MAXB 1001
#define MAXH 1000000001
#define MAXW 405
#define INF 5000
#define MAXN 100001
#define MAXM 1001
#define MAXP 1000001
#define MOD 1000000007
typedef long long ll;
typedef pair<ll, ll> P;
ll N;

P max_element(ll n){
    ll ele = 1;
    ll lim = (ll)sqrt(n);
    for(ll i = 1;i <= lim;i++){
        if(!(n % i)){
            ele = i;
        }
    }
    P res = {ele, n / ele};
    return res;
}

int digitnum(ll n){
    int res = 1;
    while(n / 10){
        res++;
        n /= 10;
    }

    return res;
}


int main(){
    cin >> N;
    P res = max_element(N);

    printf("%d\n", max(digitnum(res.first), digitnum(res.second)));

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define M 1e9 + 7
#define C 998244353
#define pi 3.14159265359
#define loop(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
#define rloop(i,a,b) for(ll i = ll(a); i >= ll(b); --i)
#define sloop(i,a) for (std::set<ll>::iterator i = a.begin(); i != a.end(); ++i)
#define pb push_back
typedef long long int ll;
typedef unsigned long long int ull;

vector<ll>edges[1005];
bool visited[1005];
vector<ll> nodes;
ll ans=0;

void dfs(ll m){
    ans++;
    visited[m] = true;
    for (std::vector<ll>::iterator i = edges[m].begin(); i != edges[m].end(); ++i)
    {
        if(!visited[*i]){
            dfs(*i);
        }
    }

}
void solve(){
    ll flag=0,ans=100,n;
    // double n;
    cin >> n;
    while(ans<n){
        ans = 1.01*ans;
        flag++;
    }
    cout << flag<< "\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t = 1;
    // cin >> t;    
    loop(f,0,t){    
        solve();
    }   
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define MAX 100000
int a[MAX];
void inarray(int n){
    for(int i = 0; i < n; i++) cin >> a[i];
}

int main(){
    int n,k,s; cin >> n >> k >> s;
    int c = 0, ss = s+1;
    if(ss > pow(10,9)) ss = 1;
    for(int i = 0; i < n; i++){
        if(c < k) cout << s << " ";
        else cout << ss << " ";
        c++;
    }
    cout << endl;

    return 0;
}

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

const ll mod = 1e9+7;
const ll INF = -1*((1LL<<63)+1);
const int inf = -1*((1<<31)+1);

using namespace std;

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int> a(N+1);
	int ans = 0;
	rep(i,N)cin >> a[i+1];
	for(int i=1;i<=N;i++){
		int x = i;
		int y = a[i];
		if(a[x] == y && a[y] == x)ans++;
	}
	cout << ans/2 << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<map>
#include<math.h>
#include<queue>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = 1000000007;
const int mod = 1000000007;
const int INF = 1000000000;
const long long LINF = 1e18;
const int MAX = 510000;
int main() {
	int j = 0;
	bool f = 1;
	string s;
	vector<int> cnt(26);
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		cnt.at((char)s[i] - 'a')++;
	}
	for (int i = 0; i < 26; i++) {
		if (cnt.at(i) % 2 == 1)f = 0;
	}
	if (f == 1)cout << "Yes" << endl;
	else {
		cout << "No" << endl;

	}
	return 0;

}

Measured memory_bytes: 3624
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var sc *bufio.Scanner

const BufferSize = 1024

func nextInt() int {
	if !sc.Scan() {
		panic(nil)
	}
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var production bool

func debugf(format string, v ...interface{}) {
	if !production {
		fmt.Printf(format, v...)
	}
}

func answer(reader io.Reader, writer io.Writer) {
	sc = bufio.NewScanner(reader)
	buf := make([]byte, BufferSize)
	sc.Buffer(buf, 1e+6)
	sc.Split(bufio.ScanWords)
	n := nextInt()
	k := nextInt()
	q := nextInt()
	s := make([]int, n)

	for i := range s {
		s[i] = k - q
	}

	for i := 0; i < q; i++ {
		s[nextInt()-1]++
	}

	for i := range s {
		if s[i] > 0 {
			_, _ = fmt.Fprint(writer, "Yes\n")
		} else {
			_, _ = fmt.Fprint(writer, "No\n")
		}
	}

}

func main() {
	production = true
	answer(os.Stdin, os.Stdout)
}


Measured memory_bytes: 3968
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(v) begin(v), end(v)
#define allg(v) begin(v), end(v), greater<int>()

int divi(int x) {
  int ans = 0;
  while(x > 0) {
    if(x%2 == 0) {
      x /= 2;
      ans++;
    }
    else
      break;
  }
  return ans;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  
  int an = 1000000007;
  rep(i, 0, n) {
    int a;
    cin >> a;
    an = min(an, divi(a));
  }
  cout << an << "\n";
  
  //cout << fixed << setprecision(10) << n << "\n";

}


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

using namespace std;

#define M 1000000007

#define ll long long


int main()
{

    int n,k;
    cin>>n>>k;
    int a[n+1];
    int dp[n+1][k+1];
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    dp[0][0]=1;
    for(int i=1;i<=k;i++)
    {
        dp[0][i]=0;
    }
    for(ll int i=1;i<=n;i++)
    {
        int sums[k+1];
        sums[0]=dp[i-1][0];
        for(int j=1;j<=k;j++)
        {
           sums[j]=(sums[j-1]+dp[i-1][j])%M;
        }

        for(int j=0;j<=k;j++)
        {

            int ans=sums[j];
            int tr=j-a[i]-1;
            //cout<<"i and sum and tr "<<i<<" "<<sums[j]<<" "<<tr<<endl;
            if(tr>=0)
            {
                ans=(ans-sums[tr]+M)%M;
            }
            dp[i][j]=ans;
        }
    }
   /*for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=k;j++)
        {
            cout<<dp[i][j]<<" ";
        }
        cout<<endl;
    }*/
    cout<<dp[n][k]<<endl;

}


Measured memory_bytes: 40064
"""
多分またバグらせる
"""
# 尺取

N = int(input())
As = list(map(int, input().split()))
res = 0
l,r = 0, 0
val = As[l]
for l in range(N):
    cnt = 0
    # 区間が1のときは確定でOKなので+1する
    if l == r:
        r += 1
        val = As[l]
    # 差分が1以上(実質、区間が2つ以上存在するとき)
    elif r-(l-1) > 1:
        val -= As[l-1]
    # 条件を満たすうちは尺を伸ばす
    # print("be","l",l,"r",r,"val",val)
    while (r < N and val^As[r] == val+As[r]):
        val += As[r]
        r += 1
    # print("af","l",l,"r",r,"val",val)
    # 条件が終了したら差分を加える
    res += (r-l)
print(res)

Measured memory_bytes: 23560