akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int n;
int ans[10010][2],tot;
int main() {
    scanf("%d",&n);
    if(n%2) {
        for(int i=1;i<=n;i++)
            for(int j=1;j<=i;j++)
                if(i!=j&&(n-i)!=j)
                    ans[++tot][0]=i,ans[tot][1]=j;
        printf("%d\n",tot);
        for(int i=1;i<=tot;i++)
            printf("%d %d\n",ans[i][0],ans[i][1]);
    }
    else {
        for(int i=1;i<=n;i++)
            for(int j=1;j<=i;j++)
                if(i!=j&&(n-i+1)!=j)
                    ans[++tot][0]=i,ans[tot][1]=j;
        printf("%d\n",tot);
        for(int i=1;i<=tot;i++)
            printf("%d %d\n",ans[i][0],ans[i][1]);
    }
    return 0;
}

Measured memory_bytes: 3824
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  int n,m;
  cin >> n >> m;
  vector<int> p(m), y(m);
  REP(i,m) cin >> p[i] >> y[i];
  vector<vector<int>> vals(n);
  REP(i,m) vals[p[i]-1].push_back(y[i]);
  REP(i,n) sort(ALL(vals[i]));
  
  REP(i,m){
    printf("%06d", p[i]);
    int id = lower_bound(ALL(vals[p[i]-1]), y[i]) - vals[p[i]-1].begin();
	printf("%06d\n", id + 1);
  }
  return 0;
}

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

map<long long, int> cnt;
long long sum = 0, ans = 0;
int n, a;

int main()
{
    scanf("%d", &n);
    cnt[0] = 1;
    for (int i = 1; i <= n; i++)
    {
        scanf("%d", &a);
        sum += a;
        ans += cnt[sum];
        cnt[sum]++;
    }
    printf("%lld", ans);
}

Measured memory_bytes: 12800
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
#define rep(i,n) for (int i= 0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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; }
const long long INF = 1LL << 60;

class AStudyScheduling {
public:
	void solve(std::istream& cin, std::ostream& cout) {
	    int h1,m1,h2,m2,k;
	    cin>>h1>>m1>>h2>>m2>>k;

	    int time = (h2-h1)*60;
	    if((m2-m1)<0) time = time+(m2-m1);
	    else time += m2-m1;
	    time -= k;
        cout<<time<<endl;




	}
};


int main() {
	AStudyScheduling solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef pair<int, P> PPI;
typedef pair<LL, LL> PL;
typedef long long LL;
// LLONG_MIN, INT_MIN
#define xx first
#define yy second

int n,q;
vector<vector<int>> vp;
// int seg[810000];
// void build(int id=1, int l=0, int r = n){
//   if(l==r-1){
//     seg[id] = da[l];
//   }
//   int mid = (l+r)/2;
//   build(id*2, l, mid);
//   build(id*2+1,mid, r);
//   s[id] = max(s[id*2],s[id*2+1]);
// }
// void mx(int x, int y, int id=1, int l=0, int r = n){
//   if(x>=r||y<=l) return -1;
//   if(l>=x&&r<=y)return seg[id];
//   int mid = (l+r)/2;
//   return max(mx(x,y,id*2,l,mid),mx(x,y,id*2+1,mid, r));
// }

vector<P> in,out; 
int main()
{
  // freopen("input", "r", stdin);
  // freopen("output", "w", stdout);
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin>>n>>q;
  for(int i=0;i<n;i++){
    int a,b,c;
    cin>>a>>b>>c;
    in.push_back({a-c, c});
    out.push_back({b-c, c});
  }
  sort(in.begin(), in.end());
  sort(out.begin(), out.end());
  int idi = 0, ido = 0;
  vector<P> vq;
  vector<int> ans(q);
  for(int i=0;i<q;i++){
    int t;cin>>t;
    vq.push_back({t, i});
  }
  sort(vq.begin(), vq.end());
  multiset<int> ms;
  for (int i = 0; i < q; i++){
    // cout<<vq[i].xx<<"kkkkk"<<vq[i].yy<<endl;
    while (idi < in.size() && in[idi].xx <= vq[i].xx)
      ms.insert(in[idi++].yy);
    while (ido < out.size() && out[ido].xx <= vq[i].xx)
      ms.erase(ms.find(out[ido++].yy));
    // cout<<ms.size()<<endl;
    if(ms.size()){
      ans[vq[i].yy] = *ms.begin();
    }
    else
      ans[vq[i].yy] = -1;
  }
  // cout<<"================="<<endl;
  for (int i = 0; i < q; i++)
    cout<<ans[i]<<endl;
}


Measured memory_bytes: 16100
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------

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

    for(int i = 0; i < s.size() - 1; i++){
        if(s[i] == s[i + 1]){
            cout << i + 1 << " " << i + 2 << endl;
            return 0;
        } else {
            if(i < s.size() - 2){
                if(s[i] == s[i + 2]){
                    cout << i + 1 << " " << i + 3 << endl;
                    return 0;
                }
            }
        }
    }

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


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


int main() {
	int n;
	cin >> n;
	if (n % 2 == 1) {
		cout << (n - 1)*(n - 1) / 2 << endl;
	}
	else
		cout << n * (n - 2) / 2 << endl;
	int x = n - n % 2;
	int y = x + 1;
	for (int i = 1;i < x / 2+1;i++) {
		for (int j = i + 1;j < y - i;j++) {
			cout << i << " " << j << endl;
		}
		for (int j = y - i + 1;j < y ;j++) {
			cout << i << " " << j << endl;
		}
	}
	for (int i = x / 2 + 1;i < x;i++) {
		for (int j = i+1;j < y;j++) {
			cout << i << " " << j << endl;
		}
	}
	if (n % 2 == 1) {
		for (int i = 1;i < n;i++)
			cout << i << " " << n << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int a=s[0]-'0',b=s[1]-'0',c=s[2]-'0';
  int d=s[3]-'0';
  // bit全探索始め
  for(int i=0;i<8;i++){
    int sum=0;
    sum=sum+a;
    if(i&(1<<0)){    
      sum=sum+b;
    }
    else{
      sum=sum-b;
    }
    if(i&(1<<1)){    
      sum=sum+c;
    }
    else{
      sum=sum-c;
    }
    if(i&(1<<2)){    
      sum=sum+d;
    }
    else{
      sum=sum-d;
    }
    if(sum==7){
      cout << a;
      if(i&(1<<0)){
        cout << '+';
      }
      else{
        cout << '-';
      }
      cout << b;
      if(i&(1<<1)){
        cout << '+';
      }
      else{
        cout << '-';
      }
      cout << c;
      if(i&(1<<2)){
        cout << '+';
      }
      else{
        cout << '-';
      }
      cout << d << "=7" << endl;
      break;
    }
  }
}

Measured memory_bytes: 3616
#include <iostream>

void solve() {
    int n;
    std::cin >> n;

    int ans = 0, cont = 0;
    while (n--) {
        int a;
        std::cin >> a;

        if (a == 0) {
            cont = 0;
        } else {
            ++cont;
        }

        ans = std::max(ans, cont);
    }

    std::cout << ans + 1 << std::endl;
}

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

    solve();

    return 0;
}



Measured memory_bytes: 3184
N=int(input())
B=list(map(int,input().split()))
A=sorted(B,reverse=True)
if N==2:
    print(A[0])
else:
    ans=0
    if N%2==1:
        if N==3:
            ans=A[0]+A[1]
        else:
            ans+=A[0]
            for i in range(1,N//2):
                ans+=2*A[i]
            ans+=A[N//2]
    else:
        ans+=A[0]
        for j in range(1,N//2):
            ans+=2*A[j]
    print(ans)

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

#define F first
#define S second

using namespace std;

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

const int N = 100010, M = 200010, INF = 0x3f3f3f3f;

int n, m;
PII seq[N];

bool cmp(PII a, PII b)
{
	if (a.S != b.S) return a.S < b.S;
	else return a.F > b.F;
}

int main()
{
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; i ++ )
	{
		scanf("%d%d", &seq[i].F, &seq[i].S);
		seq[i].F ++ ;
	}
	sort(seq, seq + m, cmp);
	
	int res = 0, pos = -INF;
	for (int i = 0; i < m; i ++ )
		if (seq[i].F > pos)
	    {
	        pos = seq[i].S;
	        res ++ ;
	    }
	printf("%d\n", res);
	return 0;
}

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

using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)

typedef long long i64;
typedef pair<i64, i64> pii;

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  queue<char> que[5];
  rep(i, 3) {
    cin >> s;
    for (auto e : s) {
      que[i].push(e);
    }
  }

  int player = 0;
  while (true) {

    if (que[player].empty()) break;

    char c = que[player].front();
    que[player].pop();

    if (c == 'a') {
      player = 0;
    }
    else if (c == 'b') {
      player = 1;
    }
    else {
      player = 2;
    }

  }

  if (player == 0) cout << 'A' << "\n";
  else if (player == 1) cout << 'B' << "\n";
  else cout << 'C' << "\n";

  return 0;
}

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

int main(){
	string a,b;
	cin >> a >> b;
	for(int i=0;i<(int)a.length();i++){
		if(a[i]==b[i]) continue;
		else {
			cout << "No\n";
			return 0;
		}
	}
	cout << "Yes\n";
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100003,INF=1<<30;

int main(){
    
    int N;cin>>N;
    int M=(1<<N);
    vector<int> A(M),m1(M,0),m2(M,0);
    for(int i=0;i<M;i++){
        cin>>A[i];
    }
    
    for(int i=1;i<M;i++){
        
        for(int j=i;j>0;j=(j-1)&i){
            if(A[j]>m1[i]){
                m2[i]=m1[i];
                m1[i]=A[j];
            }else if(A[j]>m2[i]){
                m2[i]=A[j];
            }
        }
        
        if(A[0]>m1[i]){
            m2[i]=m1[i];
            m1[i]=A[0];
        }else if(A[0]>m2[i]){
            m2[i]=A[0];
        }
    }
    
    int now=0;
    for(int i=1;i<M;i++){
        now=max(now,m1[i]+m2[i]);
        cout<<now<<endl;
    }
    
}



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


def dfs(index, connects):
    global IS_VISITED

    # print(index)
    # print(IS_VISITED)
    # print(connects)

    if index in connects.keys():
        IS_VISITED[index] = True
        nodes = [x for x in connects[index]]
    else:
        return

    for node in nodes:
        if IS_VISITED[node] == False:
            dfs(node, connects)


def is_connected(inputs):
    global IS_VISITED

    connects = {}
    for edge in inputs:
        edge = [int(edge[0]), int(edge[1])]
        if edge[0] in connects.keys():
            connects[edge[0]].append(edge[1])
        else:
            connects[edge[0]] = [edge[1]]

        if edge[1] in connects.keys():
            connects[edge[1]].append(edge[0])
        else:
            connects[edge[1]] = [edge[0]]

    # print(connects)
    IS_VISITED = [True] + [False for x in range(int(N))]
    dfs(1, connects)
    return len(IS_VISITED) is not len([1 for idx in range(len(IS_VISITED)) if IS_VISITED[idx]])


N, _ = input().split(" ")
#IS_VISITED = [False for x in range(int(N))]
IS_VISITED = []

inputs = []
while True:
    try:
        inputs.append(input().split(" "))
    except EOFError:
        break


count = 0
for i in range(len(inputs)):
    # ひとつずつ辺を落として、まだつながっているか調べる
    if is_connected(inputs[:i] + inputs[i + 1:]):
        # print(i, inputs[i])
        count += 1

print(count)


Measured memory_bytes: 3064
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, K = lr()
V = lr()
scores = [0]
limit = min(N, K)
for i in range(limit+1): # iは左から取り出す個数
    for j in range(limit-i+1): # jは右から取り出す個数
        stone = V[:i] + V[N-j:]
        stone.sort()
        result = sum(stone)
        scores.append(result)
        for k in range(min(len(stone), K-(i+j))): # kは戻す個数
            if stone[k] > 0:
                break
            result -= stone[k] 
            scores.append(result)

answer = max(scores)
print(answer)
# 07

Measured memory_bytes: 4884
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;



int main()
{
  int N, X, T;
  cin >> N >> X >> T;
  int ans = (N + X - 1) / X * T;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3588
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi >;
using vl = vector<ll>;
using vvl = vector<vl >;
using pairi = pair<int, int>;
using pairl = pair<ll, ll>;

#define TR ","
#define TS " "
#define rep(i,N) for(ll i=0;i<(ll)N;++i)
#define rpt(i,a,b) for(ll i=a;i<(ll)b;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

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

ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;
}

void printVector(const vector<ll>& vec) {
    for (ll value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

vector<int> IntegerToVector(int bit, int N) {
    vector<int> S;
    for (int i = 0; i < N; ++i) {
        if (bit & (1 << i)) {
            S.push_back(i);
        }
    }
    return S;
}

int main()
{
    IO;

    ll H, W, M;
    cin >> H >> W >> M;

    vl h(M), w(M);

    rep(i, M) {
        cin >> h[i] >> w[i];
    }

    map<ll, ll> hh, hw;

    rep(i, M) {
        ++hh[h[i]]; ++hw[w[i]];
    }

    deque<ll> deqh, deqw;

    rpt(i, 1, H+1) {
        deqh.push_back(hh[i]);
    }

    rpt(j, 1, W+1) {
        deqw.push_back(hw[j]);
    }

    sort(all(deqh));
    sort(all(deqw));

    ll ans = 0, jj=0, x=0, y=0;

    ll p = deqh[deqh.size() - 1];
    ll q = deqw[deqw.size() - 1];

    rpt(i, 1, H + 1) {
        if (hh[i] == p) ++x;
    }

    rpt(i, 1, W + 1) {
        if (hw[i] == q) ++y;
    }

    rep(i, M) {
        if (hh[h[i]] == p & hw[w[i]]==q) {
            ++jj;
        }
    }

    if (jj == x * y) {
        cout << p + q - 1 << endl;
    }
    else {
        cout << p + q << endl;
    }

}

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

int main() {
    int N;
    cin >> N;
    int d[100000];
    for (int i = 0; i < N; i++) {
        cin >> d[i];
    }
    sort(d, d+N);
    int ans = d[N/2]-d[N/2-1];
    cout << ans << endl;
}

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

int main() {
    int64_t N, x;
    cin >> N >> x;
    vector<int64_t> a(N);
    for(int i = 0; i < N; ++i) {
        cin >> a[i];
    }

    int64_t ans = 0;
    for(int i = 0; i < N; ++i) {
        if (x < a[i]) {
            ans += a[i] - x;
            a[i] = x;
        }
    }

    for(int i = 0; i < N - 1; ++i) {
        if (x < a[i] + a[i + 1]) {
            int64_t t = a[i] + a[i + 1] - x;
            ans += t;
            a[i + 1] -= t;
            if (a[i + 1] < 0) {
                a[i + 1] = 0;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1152
#include <cstring>
#include <cstdio>
char in[100001];
#define x(ch) ((((ch)-'1')%3)-1)
int main(){
	for(;~scanf("%s",in);){
		if(in[0]=='#')break;
		int r,l,L=strlen(in),b=0,R,res=9999999;
		for(int k=0;k<2;k++){
			r=3;l=-3;R=0;b=k;
			for(int i=0;i<L;i++){
				if(!b){
					if(x(in[i])>r){
						R++;
						r=x(in[i]);
					}else{
						l=x(in[i]);
						b=!b;
					}
				}else{
					if(x(in[i])<l){
						R++;
						l=x(in[i]);
					}else{
						r=x(in[i]);
						b=!b;
					}
				}
			}
			if(res>R)res=R;
		}
		printf("%d\n",res);
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <set>
#include <utility>
#include <functional>
#include <cmath>
#include <algorithm>
using namespace std;

#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define EPS (1e-8)

struct State {
  double param;
  string name;
  State(double p, string n):param(p), name(n){}
  bool operator>(const State& a) const {
    if (abs(a.param - param) < EPS) {
      return name < a.name;
    } else {
      return param > a.param;
    }
  }
};

int n;

void solve() {
  multiset<State, greater<State> > cset;
  rep(i,n) {
    string l;
    int p, a, b, c, d, e, f, s, m;
    cin>>l>>p>>a>>b>>c>>d>>e>>f>>s>>m;
    double income = f * s * m - p;
    double time = a + b + c + (d + e) * m;
    double value = (double)income / (double)time;
    cset.insert(State(value, l));
  }
  for (multiset<State>::iterator i = cset.begin(); i != cset.end(); i++) {
    cout<<i->name<<endl;
  }
  cout<<"#"<<endl;
}

int main (int argc, char const* argv[]) {
  while (cin>>n, n) {
    solve();
  }
  return 0;
}

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

string s[30];
P t[30][30];
int main() {
	int h, w, n; scanf("%d%d%d", &h, &w, &n);
	rep(i, h)cin >> s[i];
	rep(i, h)rep(j, w - 1) {
		rep(i, h)rep(j, w)t[i][j].first = s[i][j];
		swap(t[i][j].first, t[i][j + 1].first);
		bool update = true;
		while (update) {
			rep(k, h + 1) {
				rep(i, h - 1)rep(j, w) {
					if (t[i][j].first != '.'&&t[i + 1][j].first == '.')
						swap(t[i][j].first, t[i + 1][j].first);
				}
			}
			rep(i, h)rep(j, w)t[i][j].second = false;
			update = false;
			rep(i, h) {
				int cnt = 0; char c = t[i][0].first;
				rep(j, w) {
					if (t[i][j].first == '.' || t[i][j].first != c) {
						if (cnt >= n) {
							rep(k, cnt)t[i][j - k - 1].second = true;
						}
						c = t[i][j].first;
						if (t[i][j].first == '.')cnt = 0;
						else cnt = 1;
					}
					else cnt++;
				}
				if (cnt >= n) {
					rep(k, cnt)t[i][w - k - 1].second = true;
				}
			}
			rep(i, w) {
				int cnt = 0; char c = t[0][i].first;
				rep(j, h) {
					if (t[j][i].first == '.' || t[j][i].first != c) {
						if (cnt >= n) {
							rep(k, cnt)t[j - k - 1][i].second = true;
						}
						c = t[j][i].first;
						if (t[j][i].first == '.')cnt = 0;
						else cnt = 1;
					}
					else cnt++;
				}
				if (cnt >= n) {
					rep(k, cnt)t[h - k - 1][i].second = true;
				}
			}
			rep(i, h)rep(j, w) {
				if (t[i][j].second) {
					t[i][j].first = '.';
					update = true;
				}
			}
		}
		bool ok = true;
		rep(i, h)rep(j, w) {
			if (t[i][j].first != '.')ok = false;
		}
		if (ok) {
			puts("YES"); return 0;
		}
	}
	puts("NO");
}

Measured memory_bytes: 3308
import copy
n, m = map(int, input().split())
H = list(map(int, input().split()))
ANS = copy.deepcopy(H)

for i in range(m):
  a, b = map(int, input().split())
  if H[a-1] > H[b-1]:
    ANS[b-1] = 0
  elif H[a-1] == H[b-1]:
    ANS[a-1] = 0
    ANS[b-1]= 0
  else:
    ANS[a-1] = 0
ans = 0
for i in range(n):
  if ANS[i] != 0:
    ans += 1
print(ans)

Measured memory_bytes: 20844
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll a;
	ll b;
	ll c;
	cin>>a;
	cin>>b;
	cin>>c;
	ll aa=0;
	ll bb=0;
	ll cc=0;
	ll aaa=0;
	bb=a;
	aa=b;
	cc=aa;
	aaa=c;
	cout<<aaa<<" "<<bb<<" "<<cc<<"\n";
	return 0;
}


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


using namespace std;

#define int long long
#define all(a) a.begin(),a.end()
#define sz(x) ((int)x.size())
#define ff first 
#define ss second 
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<string> vs;
typedef map<int,int> mii;
typedef map<char,int> mci;
typedef vector<vector<int>> vvi;
typedef vector<pair<int,int>> vpii;
template<class T>
istream &operator>>(istream &in, vector<T> &arr){
	for(auto &x: arr) in >> x;
	return in;
}


signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n,w;
    cin >> n >> w;

    vi wt(n),v(n);
    for(int i = 0; i < n; ++i) cin >> wt[i] >> v[i];

    vvi dp(w + 1,vi(n + 1));
    dp[0][0] = 0;

    for(int i = 0; i <= w; ++i){
        for(int j = 1; j <= n; ++j){
            dp[i][j] = dp[i][j-1];
            if(i - wt[j - 1] >= 0){
                dp[i][j] = max(dp[i][j],dp[i-wt[j - 1]][j - 1] + v[j - 1]);
            }
        }
    }

    cout << dp[w][n];
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int64 n;
    cin >> n;
    if(n % 2 == 1){
        cout << 0 << endl;
        return 0;
    }
    int64 x = 0;
    int64 y = 10;
    while(n / y > 0){
        x += n / y;
        y *= 5;
    }
    cout << x << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        D solver = new D();
        solver.solve(1, in, out);
        out.close();
    }

    static class D {
        static int MOD = (int) 1e9 + 7;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.next();
            char c = S.charAt(0);
            if (S.length() == 1) {
                if (c == '5' || c == '?') {
                    out.println(1);
                } else {
                    out.println(0);
                }
                return;
            }

            int[] xs = new int[13];
            if (c == '?') {
                for (int i = 0; i < 10; i++) {
                    xs[i] = 1;
                }
            } else {
                xs[c - '0'] = 1;
            }

            for (int i = 1; i < S.length(); i++) {
                int[] ys = new int[13];
                c = S.charAt(i);
                if (c == '?') {
                    for (int j = 0; j < 10; j++) {
                        for (int k = 0; k < 13; k++) {
                            int index = (k * 10 + j) % 13;
                            ys[index] += xs[k];
                            ys[index] %= MOD;
                        }
                    }
                } else {
                    for (int k = 0; k < 13; k++) {
                        int index = (k * 10 + (c - '0')) % 13;
                        ys[index] += xs[k];
                        ys[index] %= MOD;
                    }
                }
                xs = ys;
            }
            out.println(xs[5]);
        }

    }
}



Measured memory_bytes: 32304
import java.util.*;
public class Main{
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long m = 1;
        long ans = 0;

        while(m*m<n){
            if(n%m==0){
                if(n/m-1!=m) ans += n/m-1;
            }
            m++;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 22740
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,n) for(ll i=0;i<(n);++i)
#define REPR(i,n) for(ll i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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; }

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int a, b; cin>>a>>b;
    cout << a*b << '\n';
    return 0;
}

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

#define cc(x) cout << (x) << endl
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef vector<long long> vll;

template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

const ll inf = 1LL<<58;
const int iinf = 1<<30;

int main(){
    ll n, k;
    string s;
    cin >> n >> s >> k;
    char a;
    a = s[k-1];
    rep(i,n){
        if(s[i]!=a){
            s[i]='*';
        }
    }
    cc(s);
}

Measured memory_bytes: 764
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <queue>

typedef long long ll;
const ll LL_MAX (1LL<<60);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

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

    ll n;
    string s, t;
    cin >> n >> s >> t;

    string ns;
    for (ll i=0; i<n; i++)
    {
        ns += s[i]; 
        ns += t[i]; 
    }

    for (auto c: ns)
        cout << c;
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AAbcOfABC solver = new AAbcOfABC();
        solver.solve(1, in, out);
        out.close();
    }

    static class AAbcOfABC {
        private static final String YES = "Yes";
        private static final String NO = "No";

        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            out.println(in.string().matches("^(abc|acb|bac|bca|cab|cba)$") ? YES : NO);
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
}



Measured memory_bytes: 22868
n = gets.to_i
l = []
n.times do
  s = gets.chars
  s.sort!
  l << s
end
l.sort!
idx = 0
ans = 0
while idx < n do
  sub = 0
  while idx + sub < n && l[idx] == l[idx + sub] do
    sub += 1
  end
  ans += sub * (sub - 1) / 2
  idx += sub
end
puts ans



Measured memory_bytes: 67832
#include<bits/stdc++.h>
using namespace std;
int x[200000];
int z[200000];
int len=0;
int main()
{
    int n,i,s=0,mark;
    scanf("%d",&n);
    for(i=1; i<=n; i++)
    {
        scanf("%d",&x[i]);
    }
    for(i=n; i>0; i--)
    {
        s=0;
        mark=i;
        while(mark<=n)
        {
            s+=z[mark];
            mark+=i;
        }
        if(s%2!=x[i])
        {
            z[i]=1;
            len++;
        }
    }
    printf("%d\n",len);
    for(i=1; i<=n; i++)
        if(z[i])
        printf("%d ",i);
    printf("\n");
    return 0;
}


Measured memory_bytes: 2432
/*	
TELL YOUR CODE TO START BELIEVING IN GOD!!
THEY HATE US BECAUSE THEY AIN'T US
	ARIJIT SUR 
	@duke_knight
	@surcode
	IIT ISM 
 WORK SO HARD THAT YOUR IDOL BECOMES YOUR COMPETITOR 
 */
#include<bits/stdc++.h>
#define SIZE 100008
#define mod (ll)(1e9+7)
#define INF 0x3f3f3f3f
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define abs(a) (a>0?a:-a)
#define all(a) a.begin(),a.end()
#define pb push_back
#define sort(a) sort(all(a))
#define reverse(a) reverse(all(a))
#define input(a) {for(int i=0;i<a.size();i++) cin>>a[i];}
#define display(a) {for(int i=0;i<a.size();i++) cout<<a[i]<<" "; cout<<endl;}
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
typedef long long ll;
void solve(){
    int n;
    cin>>n;
    vector<vector<int>> a(n, vector<int> (3,0)), dp= a;
    for(int i=0;i<n;i++) cin>>a[i][0]>>a[i][1]>>a[i][2];
    int i=0;
    dp[i][0] = a[i][0]; dp[i][1] = a[i][1]; dp[i][2] = a[i][2];
    for(int i=1;i<n;i++){
        dp[i][0] = a[i][0] + max(dp[i-1][1], dp[i-1][2]);
        dp[i][1] = a[i][1] + max(dp[i-1][0], dp[i-1][2]);
        dp[i][2] = a[i][2] + max(dp[i-1][0], dp[i-1][1]); 
    }
    printf("%d\n", max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2])) );
	
}
int main()
{
    IOS
    int t=1;
    //cin>>t;
    while(t--){
    	solve();
    }
    return 0;
}

Measured memory_bytes: 14292
#include<iostream>
#include<vector>

using namespace std;

int main() {

    int N;
    cin >> N;

    int M;
    cin >> M;

    int S = N + M;
    int Sum = 0;

    Sum = 0.5 * N * (N - 1) + 0.5 * M * (M - 1);

    cout << Sum << "\n";

}

Measured memory_bytes: 256
from collections import deque

S = deque(input())
Q = int(input())
d = 0
for a in range(Q):
    # print(S,d)
    line = input()
    if line[0] == "1":
        d = 1 - d
    else:
        line = line.split()
        if line[1] == "1":
            if d == 1:
                S.append(line[2])
            else:
                S.appendleft(line[2])
        else:
            if d == 1:
                S.appendleft(line[2])
            else:
                S.append(line[2])
if d == 0:
    print("".join(S))
else:
    print("".join(S)[::-1])

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

const int maxn = 105;
int A[maxn], B[maxn];
int N;

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> N;
    for (int i = 1; i <= N; i++) {
        A[i] = 9999999;
    }
    for (int i = 2; i <= N; i++) {
        cin >> B[i];
        A[i] = min(A[i],B[i]);
        A[i-1] = min(A[i-1],B[i]);
    }
    int sum = 0;
    for (int i = 1; i <= N; i++) {
        sum += A[i];
    }
    cout << sum << '\n';
}



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

int main() {
  long N, Y=1000, K=0, i=0;
  cin >> N;
  vector<int> A(N);
  rep(j, N) cin >> A.at(j);
  while(i<N-1){
    if(A.at(i)>=A.at(i+1) && K==0) i++;
    else if(A.at(i)<A.at(i+1) && K==0){
      K+=Y/A.at(i);
      Y-=A.at(i)*(Y/A.at(i));
      i++;
    }
    else if(A.at(i)<=A.at(i+1) && K!=0) i++;
    else if(A.at(i)>A.at(i+1) && K!=0){
      Y+=K*A.at(i);
      K=0;
      i++;
    }
  }
  if(K!=0){
    Y+=K*A.at(N-1);
    K=0;
  }
  cout << Y << endl;
}


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

int main(){
    int N;
    cin >> N;
    vector<pair<int, int>> D(N);
    for (int i=0; i<N; i++){
        int d1, d2;
        cin >> d1 >> d2;
        D[i] = make_pair(d1, d2);
    }
    int flag = 0;
    for (int i=0; i<N; i++){
        if (D[i].first == D[i].second){
            flag++;
        } else{
            flag = 0;
        }
        if (flag == 3) break;
    }
    if (flag == 3){
        cout << "Yes" << endl;
    } else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3628
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static int N = Integer.parseInt(sc.next());
//	static int[] h = new int[N+2];
	static List<Integer> h = new ArrayList<>();
//	static LinkedHashSet<Integer> h = new LinkedHashSet<>();
	static List<Integer> valleys = new ArrayList<>();
	static List<Integer> mounts = new ArrayList<>();
	public static void main(String[] args) {
//		h[0] = 0; h[N+1] = 0;
		h.add(0);
		for (int i = 1; i <= N; i++) {
//			h[i] = Integer.parseInt(sc.next());
			int temp = Integer.parseInt(sc.next());
			if (temp == h.get(h.size()-1).intValue()) {
				continue;
			}
			h.add(temp);
		}
		h.add(0);
		for (int i = 1; i < h.size()-1; i++) {
//			if (h[i] > h[i-1] && h[i] > h[i+1]) {
//				mounts.add(h[i]);
//			}
//			if (h[i] < h[i-1] && h[i] < h[i+1]) {
//				valleys.add(h[i]);
//			}
			if (h.get(i) > h.get(i-1) && h.get(i) > h.get(i+1)) {
				mounts.add(h.get(i));
			}
			if (h.get(i) < h.get(i-1) && h.get(i) < h.get(i+1)) {
				valleys.add(h.get(i));
			}
		}
//		if (mounts.size() == 0 || mounts.size() == 1) {
//			Arrays.sort(h);
//			System.out.println(h[N+1]);
//			return;
//		}
		int ans = mounts.stream().mapToInt(Integer::intValue).sum()
				- valleys.stream().mapToInt(Integer::intValue).sum();
		System.out.println(ans);
	}
}

Measured memory_bytes: 28756
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#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 REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = (int)3e5;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  ret *= kaijo(n); ret %= MOD;
  ret *= gyaku_kaijo(r); ret %= MOD;
  ret *= gyaku_kaijo(n-r); ret %= MOD;
  return ret;
}


int main(void){
  ll n;cin>>n;
  string s;cin>>s;
  if(n%2==1){
    cout<<"No"<<endl;
    return 0;
  }
  rep(i,n/2){
    if (s[i] != s[i+n/2]){
      cout<<"No"<<endl;return 0;
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 256
/**   Created by: Marcos Portales
          Codeforces User: marcosportales
          Country: Cuba
          Copyright                    */
#include<bits/stdc++.h>
using namespace std;
/// Pragmas:
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2") //Enable AVX
/// Macros:
#define int long long
#define f first
#define s second
#define db(x) cerr << #x << ": " << (x) << '\n';
#define pb push_back
#define lb lower_bound
#define up upper_bound
#define all(x) x.begin() , x.end()
#define rall(x) x.rbegin() , x.rend()
#define enl '\n'
#define vi vector<int>
#define sz(a) int((a).size())
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,n) for(int i=(1);i<=(n);i++)
typedef pair<int,int> ii;
typedef long double ld;
typedef unsigned long long ull;
/// Constraints:
const int maxn = 200005;
const int mod = 1000000007;
const ld eps = 1e-9;
const int inf = ((1ll<<31ll)-1ll);
const int INF = 2000000000000000000ll;
const ld pi = acos(-1);
/// Prime Numbers:
// 2, 173, 179, 181, 197, 311, 331, 737, 1009, 2011, 2027, 3079, 4001, 10037, 10079, 20011, 20089;
// 100003, 100019, 100043, 200003, 200017, 1000003, 1000033, 1000037, 1000081;
// 2000003, 2000029, 2000039, 1000000007, 1000000021, 2000000099;
/// Functions:
#define lg2(x) 31 - __builtin_clz(x)
#define lgx(x,b) ( log(x) / log(b) )
/// Red-Black Tree Test.insert(x)late ---------------------------------
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree < long long ,  null_type ,  less<long long> ,  rb_tree_tag ,  tree_order_statistics_node_update > ordered_set;
/// Quick Pow------------------------------------------------
int qpow(int b,int e){
    if( !e ) return 1;
    if( e & 1 ) return qpow(b,e-1) * b % mod;
    int pwur = qpow(b,e>>1);
    return (pwur * pwur) % mod;
}
int modinv(int x){
    return qpow(x,mod-2);
}

/// My Code -------------------------------------------------

int32_t main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout.setf(ios::fixed); cout.precision(0);
    srand(time(NULL));
    //freopen("a.in","r",stdin);
    //freopen("a.in","w",stdout);
    int n;
    cin>>n;
    map<int,int>mp;
    rep(i,n){
        int x;
        cin>>x;
        mp[x]++;
    }
    int ans=0;
    for(auto v:mp){
        if(v.f>v.s)ans+=v.s;
        else ans+=abs(v.s-v.f);
    }
    cout<<ans<<enl;

    return 0;
}


Measured memory_bytes: 9512
//#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <stack>
#include <queue>
#include <string>
#include <map>
#define mp make_pair
#define pb push_back
#define p push
#define FOR(a,c) for(int a = 0;a<c;a++)
#define ll long long
#define abs(x) (x<0 ? (-x) : x)
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d %d",&a,&b)
#define getIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define getL(a) scanf("%lld",&a)
#define getLL(a,b) scanf("%lld %lld",&a,&b)
#define getLLL(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define BEND(c) (c).begin(),(c).end()
#define fi first
#define se second
#define pi 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfi(a) printf("%d\n",a);
#define pfii(a,b) printf("%d %d\n",a,b);
#define pfl(a) printf("%lld\n",a);
#define pfll(a,b) printf("%lld %lld\n",a,b);
#define  SIZE 1000000007

using namespace std;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vl;
typedef vector<pair<int,int>> vpi;
typedef vector<pair<long long,long long>> vpl;
typedef pair<int,int> pii;
typedef pair <ll,ll> pll;


int gcd(int a, int b) {
    while (a > 0 && b > 0)
        if (a > b) a %= b;
        else b %= a;
    return a + b;
}

int lcm(int a, int b) {
    return a*b / gcd(a,b);
}

int grid [1003][1003];


long long fast_exp(long long n,long long k){
    if(k == 0)
        return 1;
    if(k==1)
        return n;

    long long temp = fast_exp(n,k>>1);

    if((k&1)==1)
        return (n*temp*temp)%SIZE;
    return (temp*temp)%SIZE;

}
ll isprime(ll i){
    if (i==2 || i == 3){
        return 0;
    }
    bool ctr =0;
    for(ll k = 2;k*k <i;k++){
        if(i%k==0)ctr=1;
    }
    if(ctr)return 1;
    else return 0;

}


int main()
{
 priority_queue <ll > pq;

 ll n,m;
 cin >> n>>m;
 ll t,sum=0;

 FOR(a,n){
     getL(t);
    pq.push(t);
    sum+=t;

 }

 while(m--){
     ll tt = pq.top();
     pq.pop();
     pq.push(tt/2);
     sum-=(tt-tt/2);
 }

 pfl(sum);


  return 0;
}

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

int main(void)
{
    int  A = 1, B = 0, C = 0;
    char z;
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    z = s1.at(0);

    while(1){

        if(z == 'a'){
        if(A == s1.size()){
            cout << 'A' << endl;
            return 0;
        }
        z = s1.at(A);
        A++;
        }

        else if(z == 'b'){
            if(B == s2.size()){
                cout << 'B' << endl;
                return 0;
            }
            z = s2.at(B);
            B++;
        }

        else if(z =='c'){
            if(C == s3.size()){
                cout << 'C' << endl;
                return 0;
            }
            z = s3.at(C);
            C++;
        }
    }

        return 0;
}

Measured memory_bytes: 256
from fractions import gcd

n = int(input())
aaa = list(map(int, input().split()))
MOD = 10 ** 9 + 7
lcm = aaa[0]
for a in aaa[1:]:
    lcm = lcm * a // gcd(lcm, a)

ans = sum(lcm // a for a in aaa) % MOD
print(ans)


Measured memory_bytes: 6100
#include <stdio.h>
int main(void){
    int k,s,x,y,z,ans=0;
    scanf("%d%d",&k,&s);
    for(x=0;x<=k;x++){
        for(y=0;y<=k;y++){
            z=s-x-y;
            if(z>=0&&z<=k)ans++;
        }
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;
import java.lang.Math.*;
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        HashMap<Integer, Integer> mem = new HashMap<>();
        LinkedList<Integer> dic = new LinkedList<>();
        int n = in.nextInt();
        int k = in.nextInt();
        String s = in.next();
        char p = s.charAt(0);
        int c=1;
        for(int i=1;i<n;i++){
            if(s.charAt(i)==p){
                c++;
            }
            else {
                dic.add(c);
                c=1;
                p=s.charAt(i);
            }

        }
        dic.add(c);
//        System.out.println(dic);
        int count =0;
        int sum =0;
        while (k>0 && dic.size()>0){
            sum+=dic.removeFirst();
            count++;
            if (count==3){
                k--;
                count=1;
            }
        }
        int ans=0;
        ans+= sum-1;
        while (dic.size()>0){
            ans+=dic.removeFirst()-1;
        }
        System.out.println(ans);
    }
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*(y/gcd(x,y));
}
ll myceil(ll x,ll y){//yがいくつ集まったらx以上になるか
	if(x<=y) return 1;
	else if(x%y==0) return x/y;
	else return x/y+1;
}

//a,b x
int main(){
	ll N,L; cin>>N>>L;
	vector<string> S(N);
	rep(i,N) cin>>S[i];
	sort(S.bg,S.ed);
	rep(i,N) cout<<S[i];
}

Measured memory_bytes: 256
<?php
$n = trim(fgets(STDIN));
$s = trim(fgets(STDIN));
$k = trim(fgets(STDIN));
$target = $s[$k-1];
$answer= "";
for($i=0; $i<$n; $i++){
	if($s[$i]!==$target){
		$answer .="*";
	}else{
		$answer .=$s[$i];
	}
}
echo $answer;
?>

Measured memory_bytes: 3828
#include <iostream>
#include <iomanip>
typedef long long ll;
using namespace std;
const  ll INF = 1e9;
const  ll MOD = 1e9 + 7;
#define repi(i,n,init) for(ll i=init;i<(n);i++)

int main()
{
    ll a;
    long double b;
    cin >> a >> b;
    cout << ll(a * b) << endl;
    return 0;
}

Measured memory_bytes: 3732
N,A,B=map(int,input().split())
M=10**9+7

def cmb(N,R,M):
    C=[1]*(R+1)
    for i in range(1,R+1):
        C[i]=(C[i-1]*(N+1-i)*pow(i,M-2,M))%M
    return C

C=cmb(N,B,M)
ans=pow(2,N,M)-1
ans-=C[A]+C[B]
print(ans%M)

Measured memory_bytes: 16628