akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>
#define MAXN 200005
#define P 16777216
#define INF 0x3f3f3f3f
#define rint register int
#define LL long long
#define LD long double
using namespace std;

int n, deg[10];

int main()
{
    for(rint i=1; i<=3; ++i)
    {
        int x, y;
        scanf("%d%d", &x, &y);
        deg[x]++; deg[y]++;
    }
    for(rint i=1; i<=4; ++i)
        if(deg[i]>2)
        {
            printf("NO\n");
            return 0;
        }
        printf("YES\n");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <mutex>
#include <cmath>
#include <set>
#include <climits>

#define mod 1e9+7
#define mp make_pair
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
using ll = long long;
using pii = pair<int, int>;
 
int main(){
	int N, a, b;
    cin >> N >> a >> b;
	if(N+a+b >= 22) cout << "bust";
	else cout << "win";
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define fi first
#define se second
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = 1; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(), (x).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T> >

#define v(T) vector<T>
#define vv(T) v(v(T))

using namespace std;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;

const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;

struct UnionFind {
    vector<int> par, rank;

    UnionFind(int n) : par(n, -1), rank(n, 0) {};
    void init(int n) { par.assign(n, -1), rank.assign(n, 0); }

    int root(int x) {
        if (par[x] == -1) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        return true;
    }
    
};


struct V {
    ll x, y;
    int idx;
};

struct edge {
    int from, to;
    ll cost;
};

bool compx(const V v1, const V v2) {
    return v1.x < v2.x;
}
bool compy(const V v1, const V v2) {
    return v1.y < v2.y;
}

bool compe(const edge e1, const edge e2) {
    return e1.cost < e2.cost;
}

int main() {
    int n;
    cin >> n;
    vector<V> vs(n);
    rep(i,n) {
        cin >> vs[i].x >> vs[i].y;
        vs[i].idx = i;
    }
    UnionFind uf(n);

    vector<edge> edges;
    sort(all(vs), compx);

    int from = -1;
    int to = -1;
    ll pre_x;
    rep(i,n) {
        if (i==0) {
            from = vs[i].idx;
            pre_x = vs[i].x;
            continue;
        }
        to = vs[i].idx;
        edge e;
        e.from = from; e.to = to; e.cost = abs(vs[i].x - pre_x);
        edges.push_back(e);
        
        pre_x = vs[i].x; from = to;
    }

    ll pre_y;
    sort(all(vs), compy);
    rep(i,n) {
        if (i==0) {
            from = vs[i].idx;
            pre_y = vs[i].y;
            continue;
        }
        to = vs[i].idx;
        edge e;
        e.from = from; e.to = to; e.cost = abs(vs[i].y - pre_y);
        edges.push_back(e
                );
        pre_y = vs[i].y; from = to;
    }

    sort(all(edges), compe);
    ll ans = 0;
    rep(i,edges.size()) {
        edge e = edges[i];
        if (!uf.issame(e.from, e.to)) {
            uf.merge(e.from, e.to);
            ans += e.cost;
        }
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 9584
import sys
import os

N, M = map(int,input().split())

#box[p][n] p:赤いボールが入っている可能性があるかどうか，n：ボールの数
box = [[0,1] for _ in range(N)]
box[0] = [1,1]
move = [0 for _ in range(M)]
for i in range(M):
    s,t = map(int,input().split())
    move[i] = [s-1,t-1]
for i in range(M):
    box[move[i][0]][1] -= 1
    box[move[i][1]][1] += 1
    if box[move[i][0]][0] == 1:
         box[move[i][1]][0] = 1
    if box[move[i][0]][1] == 0:
        box[move[i][0]][0] = 0
cnt = 0
for b in box:
    if b[0] == 1:
        cnt += 1
print(cnt)


Measured memory_bytes: 29824
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner reader=new Scanner(System.in);
        String x=new String(reader.next());
        if (x.length()<4){
            System.out.println("No");

        }
        else {
            if (x.substring(0,4).equals("YAKI")){

                System.out.println("Yes");
            }
            else{
                System.out.println("No");}
        }


    }
}


Measured memory_bytes: 23764
import heapq
from collections import deque

def bfs(i, c):
    color[i] = c
    cnt[c] += 1
    q = deque()
    q.append(i)
    while q:
        j = q.popleft()
        for k in G[j]:
            if color[k] == -1:
                color[k] = c
                cnt[c] += 1
                q.append(k)
    return

n = int(input())
xy = []
for i in range(n):
    x, y = map(int, input().split())
    xy.append([x, y, i])
xy.sort()
cnt = [0] * n
h = [[n + 1, n + 1]]
G = []
for _ in range(n):
    G.append([])
for i in range(n):
    c = 0
    while h[0][0] < xy[i][1]:
        p = heapq.heappop(h)
        if c == 0:
            minv = p
        c = 1
        G[p[1]].append(xy[i][2])
        G[xy[i][2]].append(p[1])
    #heapq.heappush(h, [xy[i][1], xy[i][2]])
    if c:
        heapq.heappush(h, minv)
    else:
        heapq.heappush(h, [xy[i][1], xy[i][2]])
color = [-1] * n
c = 0
for i in range(n):
    if color[i] == -1:
        bfs(i, c)
        c += 1
for i in range(n):
    ans = cnt[color[i]]
    print(ans)

Measured memory_bytes: 140176
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define debug(x) cout<<#x<<"="<<x<<endl;
#define LL long long 
using namespace std;
set<int>res;
int main(void)
{
	int n;
	scanf("%d",&n);
	rep(i,0,n)
	{
		int x;
		scanf("%d",&x);
		set<int>::iterator it=res.lower_bound(x);
		if(it!=res.end()&&*it==x){
			//debug(res.size());
			res.erase(it);
			//debug(res.size());
		}
		else
		{
			res.insert(x);
		}
	}
	printf("%d",(int)res.size());
	return 0;
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

int32_t main(){
	IOS;
	int w, h, x, y, count = 0;
	cin >> w >> h >> x >> y;

	double area = double(w*h)/double(2);

	if((x+x == w) && (y+y == h))
		count = 1;

	printf("%.6f %lld", area, count);





	return 0;
}

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

int main() {
	int a,b;
	cin >> a >> b;
	if(a>b){
		cout << "a > b";
	}else if(a<b){
		cout << "a < b";
	}else{
		cout << "a == b";
	}
	cout << "\n";
	
}


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

int main()
{
    string command;
    list<int> L;
    int N, num;
    cin >> N;
    for(int i = 0; i < N; i++)
    {
        cin >> command;
        if(command.find("insert") == 0)
        {
            cin >> num;
            L.push_front(num);
        }
        else if(command.find("deleteFirst") == 0)
            L.pop_front();
        else if(command.find("deleteLast") == 0)
            L.pop_back();
        else
        {
            cin >> num;
            for(list<int>::iterator it = L.begin(); it != L.end(); it++)
            {
                if(*it == num){
                    L.erase(it);
                    break;
                }
            }
        }
    }
    int count = 0;
    for(list<int>::iterator it = L.begin(); it != L.end(); it++)
    {
        if(count)
            cout << " ";
        count++;
        cout << *it;
    }
    cout << endl;
}



Measured memory_bytes: 34432
#include <bits/stdc++.h>
using namespace std;
 
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

void pre(){


}
 
void solve(){
 
 
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
	pre();

    ll n,m;cin>>n>>m;
    rep(i,m){int x;cin>>x;n-=x;}
    cout<<max(n,-1ll);


	return 0;
}
 



Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT32_MAX__ / 2)
#define MAX_N 100001

using namespace std;
typedef pair<int, int> ipair;
llong modulo(llong left, llong right) { return (left % right + right) % right; }

int N;
int A[MAX_N];
int main(int argc, char **argv) {
    cin >> N;
    for(int i = 0; i < N; ++i)
        cin >> A[i];
    
    //2 * B1 ... 山1の雨量
    int B1 = 0;
    for(int i = 0; i < N; ++i)
        B1 += pow(-1, i) * A[N - 1 - i];
    
    cout << B1;
    int prev = B1 / 2;
    for(int i = 0; i < N - 1; ++i) {
        cout << " " << 2 * (A[i] - prev);
        prev = (A[i] - prev);
    }

    cout << endl;
}

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

using namespace std;

struct UnionFind {  // The range of node number is from 0 to n-1
	//'rank[x]' is a rank of the union find tree the root of which is x.
	//'parents[x]' is the parent of x
	vector<int> rank, size, parents;

	// constructor
	UnionFind() {}
	UnionFind(int n) {  // make n trees.
		size.resize(n, 0);
		rank.resize(n, 0);
		parents.resize(n, 0);
		for (int i = 0; i < n; i++) {
			makeTree(i);
		}
	}
	// make a union find tree
	void makeTree(int x) {
		parents[x] = x;  // the parent of x is x
		rank[x] = 0;
		size[x] = 1;
	}

	// check whether the root of x is the same as that of y
	bool isSame(int x, int y) { return findRoot(x) == findRoot(y); }

	//uniteはどちらかを選ぶこと！！！！！

	// unite two tree (ランク（木の高さ）が低くなるように繋げる場合）
	bool unite(int x, int y) {
		x = findRoot(x);
		y = findRoot(y);
		if (x == y) return false;
		if (rank[x] > rank[y]) {
			parents[y] = x;
			size[x] += size[y];
		}
		else {
			parents[x] = y;
			size[y] += size[x];
			if (rank[x] == rank[y]) {
				rank[y]++;
			}
		}
		return true;
	}

	// unite two tree (サイズ（頂点の数）が大きい方に小さい方を繋げる場合）
	//bool unite(int x, int y) {
	//	x = findRoot(x);
	//	y = findRoot(y);
	//	if (x == y) return false;
	//	if (size[x] > size[y]) {
	//		parents[y] = x;
	//		size[x] += size[y];
	//	}
	//	else {
	//		parents[x] = y;
	//		size[y] += size[x];
	//	}
	//	return true;
	//}

	//// 経路圧縮（全て根につなげる）する場合の根探しtravel the parents of tree recursivily to find root
	int findRoot(int x) {
		if (x != parents[x]) {
			parents[x] = findRoot(parents[x]);  // change the x's parent to the root of tree.
		}
		return parents[x];
	}
	//経路圧縮しない場合
	//int findRoot(int x) {
	//	if (x == parents[x])
	//		return x;
	//	return findRoot(parents[x]);
	//}

	int treeSize(int x) { return size[findRoot(x)]; }
};

int main() {

	int n, m;
	cin >> n >> m;
	vector<pair<int, int>> a(m);

	int in1, in2;
	for (int i = 0; i < m; i++) {
		cin >> in1 >> in2;
		a[i] = make_pair(in1-1, in2-1);
	}

	UnionFind tree(n);
	vector<long long> res(m);
	res[m - 1] = ((long long)n * (n - 1)) / 2;
	for (int i = m - 1; i > 0; i--) {

		int r1 = tree.findRoot(a[i].first);
		int r2 = tree.findRoot(a[i].second);

		long long s1, s2;
		if (r1 != r2) {
			s1 = tree.treeSize(a[i].first);
			s2 = tree.treeSize(a[i].second);
			res[i - 1] = res[i] - s1 * s2;
			tree.unite(a[i].first, a[i].second);
		}
		else {
			res[i - 1] = res[i];
		}
	}

	for (int i = 0; i < m; i++) {
		cout << res[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 5792
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    int N;
    cin>> N;
    vector<int>A(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    for(int i=0;i<N;i++){
        if(A[i]%2==0){
            if(A[i]%3!=0 && A[i]%5!=0){
                cout << "DENIED";
                break;
            }
        }
        if(i==N-1){
            cout << "APPROVED";
        }
    }

}

Measured memory_bytes: 256
s=raw_input()
K=int(raw_input())
ozp1=123



ls=list(s)
for i in range(len(ls)):
    nowwork=ozp1-ord(ls[i])
    if i==len(ls)-1:
        K%=26
        #print K,nowwork
        ls[i]=chr(ord(ls[i])+K)
        if ord(ls[i])>ord("z"):
            zu=ord(ls[i])-ord("z")-1
            #print zu
            ls[i]=chr(ord("a")+zu)
    if K==0:
        break

    if ls[i]=="a":
        continue
    if nowwork<=K and (len(ls)-1!=i):
        K-=nowwork
        ls[i]="a"

print "".join(ls)


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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    ll n;
    cin >> n;
    vector<ll> a(n, LLINF);
    REP(i, n-1) cin >> a[i];

    ll ret = 0;
    REP(i, n) {
        if(i>=1) ret += min(a[i-1], a[i]);
        else ret += a[i];
    }
    cout << ret << endl;

    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

	/**
	 * @param args
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException {
		// TODO ツ篠ゥツ督ョツ青カツ青ャツつウツづェツつスツδソツッツドツ・ツスツタツブ
		BufferedReader d= new BufferedReader(new InputStreamReader(System.in));
		String temp;
		while((temp	=d.readLine())!= null){
			String array[]=temp.split(" ");

			int a=Integer.valueOf(array[0]).intValue(),b=Integer.valueOf(array[1]).intValue();
			String sum =String.valueOf(a+b);
			System.out.println(sum.length());
		}
	}
}

Measured memory_bytes: 10000
#include<bits/stdc++.h>
using namespace std;
int n,a,flag=0;


set<int> s;
int main()
{
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        if(a%2==0){
            if(a%3!=0&&a%5!=0){
                flag=1;
            }
        }
    }
    if(flag) cout<<"DENIED";
    else cout<<"APPROVED";
    return 0;
}

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

def solve(now,seven,five,three):
    if now > n:
        return 0
    if min(seven,five,three) != 0:
        cnt = 1
    else:
        cnt = 0
    cnt += solve(now*10+3,seven,five,three+1)
    cnt += solve(now*10+5,seven,five+1,three)
    cnt += solve(now*10+7,seven+1,five,three)

    return cnt
print(solve(0,0,0,0))

Measured memory_bytes: 51420
#define  _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
#pragma comment (linker, "/STACK:526000000")

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144*2LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

unsigned long xor128() {
	static unsigned long x = 123456789, y = 362436069, z = 521288629, w = time(NULL);
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

void init() {
	iostream::sync_with_stdio(false);
	cout << fixed << setprecision(10);
}

#define int ll
void solve() {
	while (true) {
		int n;
		cin >> n;
		if (n == 0) return;
		vector<int> keys;
		REP(i, n) {
			int ans = 0;
			cin >> ans;
			keys.push_back(ans);
		}
		string s;
		cin >> s;
		REP(i, s.length()) {
			REP(q, keys[i % keys.size()]) {
				if (s[i] == 'a') s[i] = 'Z';
				else if (s[i] == 'A') s[i] = 'z';
				else s[i]--;
			}
		}
		cout << s << endl;
	}
}
#undef int

int main() {
	init();
	solve();
}


Measured memory_bytes: 3208
N, K = map(int, input().split())
T = [[] for i in range(N)]
MOD = 10 ** 9 + 7
for i in range(N - 1):
    a,  b = map(int, input().split())
    a, b = a - 1, b - 1
    T[a].append(b)
    T[b].append(a)


# 階乗 & 逆元計算
factorial = [1]
inverse = [1]
for i in range(1, K + 2):
    factorial.append(factorial[-1] * i % MOD)
    inverse.append(pow(factorial[-1], MOD - 2, MOD))


# 組み合わせ計算
def nPr(n, r):
    if n < r or r < 0:
        return 0
    elif r == 0:
        return 1
    return ((factorial[n] * inverse[r]) % MOD) * (inverse[n - r] * factorial[r] % MOD) % MOD


ans = K
stack = [[0, 0]]  # [頂点番号, 深さ]
visited = [False] * N
while stack:
    n, depth = stack.pop()
    visited[n] = True

    child = 0
    for to in T[n]:
        if visited[to]:
            continue

        child += 1
        stack.append([to, depth + 1])

    if depth == 0:
        ans *= nPr(K - 1, child)
    else:
        ans *= nPr(K - 2, child)
    ans %= MOD

print(ans % MOD)


Measured memory_bytes: 80416
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(readline())
    s1 = input()
    s2 = input()

    if n == 1:
        print(3)
        return

    ans = 3 * 2

    for i in range(2, n):
        if s1[i-1] == s2[i-1]:
            ans *= 2
        else:
            if s1[i-1] == s1[i-2]:
                if s1[i] == s2[i]:
                    ans *= 1
                else:
                    ans *= 3
        ans %= MOD

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 61900
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    char[] cs = sc.next().toCharArray();
    int count = 0;
    String tmp = "";
    String before = "";
    for (char c : cs) {
      tmp += c;
      if (!tmp.equals(before)) {
        count++;
        before = tmp;
        tmp = "";
      }
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 40540
#!/usr/bin/env python
# -*- coding: utf-8 -*-

(K, S) = map(int, input().split(' '))

r = 0
for x in range(0, K + 1):
    for y in range(0, K + 1):
        d = S - (x + y)
        if 0 <= d <= K:
            r += 1

print(r)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)

/* exchange */
#define chmin(a, b) (a) = min((ll)(a), (ll)(b))
#define chmax(a, b) (a) = max((ll)(a), (ll)(b))

/* output */
#define I(x) cin >> x;
#define D(x) cerr << (x) << " ";
#define BR cerr << "\n";
#define P(x) cout << (x) << endl;
#define FIX cout << fixed << setprecision(10);

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll ret = 0;

int main(void){
  ll r, _D, x;
  I(r);
  I(_D);
  I(x);
  REP(i, 10) {
    x = r * x - _D;
    P(x)
  }

}


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

int N, M, T, a[100];

int main(){
	int ans = 0;
	cin >> N >> M >> T;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	ans += (a[0] - M > 0 ? a[0] - M : 0);
	for (int i = 1; i < N; i++) {
		if (a[i] - a[i - 1] > 2 * M) {
			ans += a[i] - a[i - 1] - 2 * M;
		}
	}
	ans += (T - a[N - 1] - M > 0 ? T - a[N - 1] - M : 0);
	cout << ans << endl;

	return 0;
}

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

long a[3333][3333], d[4], e[3333];
int main() {
    int r, c, k;
    cin >> r >> c >> k;
    for(int i = 0; i < k; i++) {
        int x, y, v;
        cin >> x >> y >> v;
        a[x - 1][y - 1] = v;
    }
    for(int i = 0; i < r; i++) {
        fill(d, d + 4, 0);
        for(int j = 0; j < c; j++) {
            for(int l = 4; l--;) {
                d[l] = max(d[l], e[j]);
                if(l)
                    d[l] = max({d[l], d[l - 1] + a[i][j], e[j] + a[i][j]});
            }
            e[j] = d[3];
        }
    }
    cout << d[3] << endl;
    return 0;
}


Measured memory_bytes: 81636
from sys import stdin
input = lambda: stdin.readline().rstrip("\r\n")
from collections import defaultdict as vector, deque as que
read = lambda: list(map(int,input().split()))
from bisect import bisect
from heapq import heappush as hpush,heappop as hpop

n,m,k=read()
A=read()
B=read()
a,b=[0],[0]
for i in range(n):
	a.append(a[i]+A[i])
for i in range(m):
	b.append(b[i]+B[i])
ans=0
for i in range(0,n+1):
	curr=a[i]
	if curr>k:
		break
	j=bisect(b,k-curr,0,m+1)
	if j>m or b[j]>k-curr:
		j-=1
	if j==-1:
		ans=max(0,ans)
	else:
		ans=max(ans,i+j)
print(ans)



Measured memory_bytes: 136024
#include <stdio.h>

int main(void){
    long long n,a[5],ans=0,min;
    scanf("%lld%lld%lld%lld%lld%lld",&n,&a[0],&a[1],&a[2],&a[3],&a[4]);
    ans=(n+a[0]-1)/a[0];
    min=a[0];
    for (int i=1; i<5; i++){
        if (a[i]>=min){
            ans++;
        } else {
            min=a[i];
            ans=(n+a[i]-1)/a[i]+i;
        }
        
    }
    printf("%lld\n",ans);
    return 0 ;
}


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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int n;cin >> n;
    LL k;cin >> k;
    vector<pair<int, int>> ab;
    inc(i, 0, n){
        int a, b;cin >> a >> b;
        ab.pb({a, b});
    }
    sort(ab.begin(), ab.end());
    LL now = 0;
    inc(i, 0, n){
        now += ab[i].se;
        if(k <= now){
            cout << ab[i].fi << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
	int n;
	scanf("%d", &n);
	map <long long int, int> M;
	long long int curr = 0, ans = 0;
	M[0] = 1;
	for (int i = 0; i < n; ++i)
	{
		int x;
		scanf("%d", &x);
		curr+=x;
		ans+=M[curr];
		M[curr]++;
		//cout<<" curr = "<<curr<<"  "<<" M[curr] = "<<M[curr]<<endl;
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 12800
#include <iostream>
#include <string.h>
#include <algorithm>
#include <cstring>
#include <math.h>
#define ll long long
ll gcd(ll a,ll b){
    ll s=1,c;
    while(a&&b){
        if((~a&1)&&(~b&1))
            a>>=1,b>>=1,s<<=1;
        else if(~a&1)a>>=1;
        else if(~b&1)b>>=1;
        else if(a>b)a=a-b;
        else c=b-a,b=a,a=c;
    }
    if(!a)return b*s;
    if(!b)return a*s;
}
using namespace std;
int main(){
	int n;
	cin>>n;
	char a[n];
	cin>>a;
	int l=0,r=n-1,ans=0;
	while(l<r){
		if(a[l]=='W'&&a[r]=='R'){
			ans++;
			l++;r--;
		}
		else if(a[l]=='W'&&a[r]=='W'){
			r--;
		}
		else if(a[l]=='R'&&a[r]=='R'){
			l++;
		}
		else if(a[l]=='R'&&a[r]=='W'){
			l++;r--;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3796
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll int64_t
#define _GLIBCXX_DEBUG
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
  ll s;
  cin >> s;
  ll x1=s/1000000000+1;
  ll x2=x1*1000000000-s;
  if(x1!=1000000001)
    cout << x1 << " " << 1 << " " <<x2 <<" " << 1000000000 << " " <<0 << " " <<0<<endl;
  else
    cout << 1000000000 << " " << 0 << " " <<0 <<" " << 1000000000 << " " <<0 << " " <<0<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define REP(i,a) for(ll i(0), _##i(a); i < _##i; ++i)
#define FOR(i,a,b) for(ll i(a), _##i(b); i <= _##i; ++i)
using namespace std;
using ll = long long;

void solve(){
    int x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    vector<int> p(a), q(b), r(c);
    for(int &v : p) cin >> v;
    for(int &v : q) cin >> v;
    for(int &v : r) cin >> v;

    sort(RALL(p));
    sort(RALL(q));
    sort(ALL(r));

    p.erase(p.begin() + x, p.end());
    q.erase(q.begin() + y, q.end());

    vector<int> s;
    merge(ALL(p), ALL(q), back_inserter(s), greater<>());
    ll ans = 0;
    while (r.size() && s.size() && r.back() > s.back()) {
        ans += r.back();
        r.pop_back();
        s.pop_back();
    }
    ans = accumulate(ALL(s), ans);
    cout << ans << "\n";
}

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

    int T = 1;
    //cin >> T;
    FOR(i,1,T){
        solve();
    }
}


Measured memory_bytes: 2552
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
// !-------------PBDS-----------------!
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// typedef tree<int,null_type,std::greater_equal<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
// !-------------PBDS-----------------! remember about greater/_equal<int>, less/_equal<int>

using namespace std;
typedef long long ll;
#define INF 1000000000 // 1 billion, safer than 2B for Floyd Warshall’s
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pcont(x) for(auto i: x){cout << i << " ";} cout << "\n";

int main(){
    IOS;
    int n;
    cin >> n;
    int m = 0;
    for(int i = 0; i<n; i++){
        int x, y;
        cin >> x >> y;
        if(x == y){
            m++;
        } else{
            m = 0;
        }
        if(m >= 3){
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
    return 0;
}

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


int main(){
  int N;
  string a,b,c;
  cin>>N>>a>>b>>c;
  int ans = 0;
  for(int i=0;i<N;i++){
    set<char> st;
    st.insert(a[i]);
    st.insert(b[i]);
    st.insert(c[i]);
    int cnt = st.size();
    ans += cnt - 1;
   }
   cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
using ll = long long;
using namespace std;

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
//sort(a, a + N, greater<ll>())   // descend
//sort(a, a+N)                    //  ascend

/**
void comb(vector<vector <ll> > &v) {
	rep (i,0,v.size()) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	rep (k,1,v.size()) {
		rep (j,1,k) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}
/*main内でnCn~nC0 生成 **
vector<vector<ll> > v(n + 1, vector<ll>(n + 1, 0));
comb(v);
*/

int main() {
	ll n;
	cin>>n;
	ll a[110000];
	rep(i,1,n+1)cin>>a[i];
	ll p=0;
	rep(i,1,n+1){
		if(i%2) p+=a[i];
		else p-=a[i];
	}
	cout<<p<<" ";
	rep(i,2,n+1){
		cout<<2*a[i-1]-p <<" ";
		p=2*a[i-1]-p;
	}
}

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

using namespace std;

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    string ch;
    cin>>n;
    cin>>ch;
    int nb=0;
    for (int i=0;i<n-2;i++)
    {
        if (ch.substr(i,3)=="ABC")
                nb++;
    }
    cout<<nb;
    return 0;
}


Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))

X=[0]*8
Y=0

for a in A:
    if a>=3200:
        Y+=1
    else:
        X[a//400]+=1

a=max(1,8-X.count(0))
b=8-X.count(0)+Y
print(a,b)


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

int main(){

    int N;
    cin >> N;

    for (size_t i = 1; i < 10; i++)
    {
        if(N%i==0 && N/i<10){
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import itertools


def main():
  h, w, _ = map(int, input().split())
  values = [[int(v == '#') for v in input().strip()] for _ in range(h)]
  flags = [[0] * w for _ in range(h)]
  areas = []

  for y, x in itertools.product(range(h), range(w)):
    if values[y][x] == 1:
      flags[y][x] = 1
      areas.append([x, y, x + 1, y + 1])

  for area in areas:
    sx, sy, ex, ey = area

    while True:
      if sx > 0 and sum(flags[y][sx - 1] for y in range(sy, ey)) == 0:
        for y in range(sy, ey):
          flags[y][sx - 1] += 1
        sx -= 1
      elif sy > 0 and sum(flags[sy - 1][x] for x in range(sx, ex)) == 0:
        for x in range(sx, ex):
          flags[sy - 1][x] += 1
        sy -= 1
      elif ex < w and sum(flags[y][ex] for y in range(sy, ey)) == 0:
        for y in range(sy, ey):
          flags[y][ex] += 1
        ex += 1
      elif ey < h and sum(flags[ey][x] for x in range(sx, ex)) == 0:
        for x in range(sx, ex):
          flags[ey][x] += 1
        ey += 1
      else:
        break

    area[0], area[1], area[2], area[3] = sx, sy, ex, ey

  rets = [[0] * w for _ in range(h)]

  for i, (sx, sy, ex, ey) in enumerate(areas, start=1):
    for x, y in itertools.product(range(sx, ex), range(sy, ey)):
      rets[y][x] = i

  for r in rets:
    print(' '.join(map(str, r)))


if __name__ == '__main__':
  main()


Measured memory_bytes: 69592
#include <bits/stdc++.h>
using namespace std;
#define in ({int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;})
#define forinc(i,a,b) for(int i=a;i<=b;++i)
#define fordec(i,a,b) for(int i=a;i>=b;--i)
#define int long long
int n,h[100100],f[100100];
main()
{
    cin >> n;
    forinc(i,1,n) cin >> h[i];
    f[1]=0;
    f[2]=abs(h[2]-h[1]);
    forinc(i,3,n)
    {
        f[i]=min(f[i-1]+abs(h[i]-h[i-1]),f[i-2]+abs(h[i]-h[i-2]));
    }
    cout << f[n];
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const int MOD = 1e9+7;
const int INF = 1<<30;
const ll LINF = 1LL<<60;

bool check(vector<P> s) {
    int h = 0;
    for (P p : s) {
        int b = h + p.first;
        if (b < 0) return false;
        h += p.second;
    }
    return true;
}


int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    vector<P> ls, rs;
    int total = 0;
    rep(i, n) {
        string s;
        cin >> s;
        int h = 0, b = 0;
        for (char c : s) {
            if (c == '(') ++h; else --h;
            b = min(b, h);
        }
        if (h > 0) ls.emplace_back(b, h);
        else rs.emplace_back(b - h, -h);
        total += h;
    }
    sort(ls.rbegin(), ls.rend());
    sort(rs.rbegin(), rs.rend());
    if (check(ls) && check(rs) && total == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 18944
#[allow(dead_code)]
fn is_whitespace(c: &char) -> bool {
    c.is_whitespace()
}

#[allow(dead_code)]
fn is_eol(c: &char) -> bool {
    ['\r', '\n'].contains(c)
}

#[allow(unused_macros)]
macro_rules! input {
    ($var:ident, $($r:tt)*) => {
        input_inner!{$var, $($r)*}
    };

    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_mut, unused_variables, bare_trait_objects)]
        let mut next = move |f: &Fn(&char)->bool| -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|f(&c))
                .take_while(|c|!f(&c))
                .collect()
        };
        input_inner!{next, $($r)*};
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; eol ]) => {
        $next(&is_eol).split(' ').map(|x| x.parse::<$t>().unwrap()).collect::<Vec<_>>()
    };

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

    ($next:expr, parser) => {
        $next
    };

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

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};

#[allow(dead_code)]
struct Edge {
    from: usize,
    to: usize,
}

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1_000_000_007;

fn main() {
    input! {
        x1: isize, y1: isize, x2: isize, y2: isize,
    }

    let vx = x2 - x1;
    let vy = y2 - y1;
    let x3 = -vy + x2;
    let y3 = vx + y2;
    let x4 = x3 - vx;
    let y4 = y3 - vy;

    println!("{} {} {} {}", x3, y3, x4, y4);
}


Measured memory_bytes: 4352
#include "bits/stdc++.h"
using namespace std;

#define int long long

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


signed main(void) {
  int num; // num
  num = 0; // count, result
  // num = numeric_limits<int>::min(); // max
  num = numeric_limits<int>::max(); // min
  int N;
  // int M;
  array<int, 100000> A;
  // string S;
  // string T;
  int T;


  cin >> N >> T;
  for (int i = 0; i < N; ++i) {
    int c, t;
    cin >> c >> t;
    if (t <= T) {
      num = min(num, c);
    }
  }

  if (num == numeric_limits<int>::max()) {
    cout << "TLE" << endl;
  } else {
    cout << num << endl;
    
  }
  
  // cin >> N;
  // for (auto it = A.begin(); it < A.begin() + N; ++it) cin >> *it;

  // for (auto it = A.begin(); it < A.begin() + N; ++it) if (*it % 2 == 0) ++num;

  // cout << num << endl;;
  
  return 0;
}


Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
import pprint
sys.setrecursionlimit(10 ** 9)


INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007



n, m = LI()
ret = [''] * n
for _ in range(m):
    s, c = LI()
    if ret[s - 1] and ret[s - 1] != str(c):
        print(-1)
        exit()
    elif s == 1 and c == 0 and n != 1:
        print(-1)
        exit()
    else:
        ret[s - 1] = str(c)

for i in range(n):
    if not ret[i]:
        ret[i] = '0' if i or n == 1 else '1'

ans = ''.join(ret)
print(ans)

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

int main() {
  int a, b;
  cin >> a >> b;
  int x = a + b;
  if (x % 2 == 0) cout << x / 2 << endl;
  else cout << x / 2 + 1 << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>

using namespace std;
int main(){
    int n;
    while(cin >> n){
        if(n==0){
            break;
        }
        int a[n];
        int cnt=0;
        int cnt2=0;
        for(int i=0;i<n;i++){
            cin >> a[i];
            if(a[i]>=2){
                cnt++;
            }
            if(a[i]>=1){
                cnt2++;
            }
        }
        if(cnt==0){
            cout << "NA" << endl;
        }else{
            cout << cnt2+1 << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3120
N=int(input())

A=input().split()
B=[0]*N

for i in range(len(A)):
    B[i]=int(A[i])

B.sort()
B[0]=B[0]/(2**(N-1))

for i in range(len(B)-1):
    j=i+1
    B[j]=B[j]/(2**(N-j))

print(sum(B))

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define REP(i,a,b) for(int i=(a);i<(b);++i)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define All(x) (x).begin(),(x).end()
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ld EPS=10e-8;
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}



int main() {
    ll N,K,A,C=0;
    cin >> N  >>  K;
    rep(i,N){
        cin >> A;
        if(A>=K){
            C++;
        }
    }
    cout << C << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
long long v[2005][2005],mod=1e9+7,n,k;
int main(){
	cin>>n>>k;
	v[0][0]=1;
	for(int i=1;i<=n;i++){
		v[i][0]=1;
		for(int j=1;j<=i;j++)
			v[i][j]=(v[i-1][j-1]+v[i-1][j])%mod;
	}
	for(int i=1;i<=k;i++)
		cout<<v[n-k+1][i]*v[k-1][i-1]%mod<<endl;
	return 0;
}

Measured memory_bytes: 26216
N,K = list(map(int, input().split()))
A = list(map(int, input().split()))
c = [0]*N

idx = 0
stp = 0
ans = 0
while(True):
  stp += 1
  idx = A[idx] - 1
  if c[idx]==0 and idx!=0:
    c[idx] = stp
  else:
    tmp1 = c[idx]
    tmp2 = stp - tmp1
    break
  if stp>=K:
    ans = idx + 1
    break

if(ans>0):
  print(ans)
else:
  k1 = K - tmp1
  k2 = k1%tmp2
  for _ in range(k2):
    idx = A[idx] - 1
  print(idx+1)

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
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; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }

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

    int N; cin >> N;
    vector<P> res;
    int dame = N;
    if (N % 2 == 1) dame--;

    REPS(i, 1, N) {
        REPS(j, 1, N) {
            if (j <= i || j == dame) continue;
            res.pb({i, j});
        }
        dame--;
    }
    cout << res.size() << endl;
    for (P p : res) cout << p.fi << ' ' << p.se << endl;
    
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(v.rbegin(),v.rend())
#define mkp(a,b) make_pair(a,b)
#define scf2(a,b) scanf("%lld%lld",&a,&b)
#define scf(a) scanf("%lld",&a)
#define pf(a) printf("%lld\n",a)
#define mx 10000010
using namespace std;

ll arr[100005];
ll dp[100005];
ll n;

int main()
{
    scf(n);
    for(ll i=0;i<n;i++)scf(arr[i]);
    dp[0]=0;
    dp[1]=abs(arr[1]-arr[0]);
    for(ll i=2;i<n;i++)
    {
        ll a=abs(arr[i]-arr[i-1])+dp[i-1];
        ll b=abs(arr[i]-arr[i-2])+dp[i-2];
        dp[i]=min(a,b);
    }
    printf("%lld\n",dp[n-1]);
}









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

int main() {
    int N, Q;
    cin >> N >> Q;
    auto counts = vector<int>(N + 1);
    string S;
    cin >> S;
    for(auto i = 2; i <= N; ++i) {
        if(S.substr(i - 2, 2) == "AC")
            counts[i] = counts[i - 1] + 1;
        else
            counts[i] = counts[i - 1];
    }

    auto answers = vector<int>();
    for(auto i = 0; i != Q; ++i) {
        size_t l, r;
        cin >> l >> r;
        answers.push_back(counts[r] - counts[l]);
    }
    for(auto i : answers)
        cout << i << endl;

    return 0;
}


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

int main() {
  vector<int> A(3);
  int sum = 0;
  for(int i = 0; i < 3; i++){
    cin >> A.at(i);
    sum += A.at(i);
  }
  if(sum >= 22) cout << "bust" << endl;
  else cout << "win" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include<cstdio>
#include<functional>
#include <bitset>
using namespace std;

int main()
{
	int N, x;

	cin >> N;
	if (N > 2) {
		x = N / 3;
		cout << x << endl;
	}
	else {
		cout << 0 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int x,y;
	char s[105][105];
	cin>>x>>y;
	for(int i=0;i<=x;i++)
	gets(s[i]);
	for(int i=0;i<y+2;i++)
	cout<<"#";
	cout<<endl;
	for(int i=1;i<=x;i++)
	{
		cout<<"#";
		for(int j=0;j<y;j++)
		cout<<s[i][j];
		cout<<"#"<<endl;
	}
	for(int i=0;i<y+2;i++)
	cout<<"#";
	return 0;
}

Measured memory_bytes: 256
#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++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef pair<int, int> p;
typedef priority_queue<p> pq;
typedef priority_queue<p, vector<p>, greater<p>> gpq;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, ans = 0, temp = 0;
    cin >> n;

    string s;
    cin >> s;

    vi l(26,0), r(26,0);

    REP(i, n)
    {
        r[s[i] - 'a']++;
    }

    REP(i, n)
    {
        r[s[i] - 'a']--;
        l[s[i] - 'a']++;

        temp = 0;
        REP(j, 26)
        {
            if(r[j] > 0 && l[j] > 0)
            {
                temp++;
            }
        }
        chmax(ans, temp);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256