akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
using namespace std;

int main(){
    vector<int> prime;
    bool nonprime[101] = {};
    nonprime[0] = nonprime[1] = true;
    for(int i = 2; i < 101; i++){
        if(nonprime[i]) continue;
        prime.push_back(i);
        for(int j = i+i; j < 101; j+=i) nonprime[j] = true;
    }

    int count[101] = {};

    int n;
    cin >> n;

    for(int i = 2; i <= n; i++){
        int tmpi = i;
        for(int p : prime){
            while(tmpi % p == 0)    tmpi /= p, count[p]++;
            if(tmpi == 1)   break;
        }
    }

    int ans = 0;
    for(int i = 2; i < 100; i++){
        if(count[i] >= 74)  ans++;
        for(int j = i+1; j < 100; j++){
            if(count[i] >= 4 && count[j] >= 14) ans++;
            if(count[i] >= 24 && count[j] >= 2) ans++;
            if(count[j] >= 4 && count[i] >= 14) ans++;
            if(count[j] >= 24 && count[i] >= 2) ans++;
            for(int k = j+1; k < 100; k++){
                if(count[i] >= 2 && count[j] >= 4 && count[k] >= 4) ans++;
                if(count[i] >= 4 && count[j] >= 2 && count[k] >= 4) ans++;
                if(count[i] >= 4 && count[j] >= 4 && count[k] >= 2) ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <utility>
#include <tuple>
#include <map>
#include <ctime>
#include <cstdlib>
#include <random>
using namespace std;

string s;

int main(){
	cin >> s;
	for(int i = 0; i < s.length();i++)cout << "x";
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
def test():
  x = input()
  x = x.split()
  if x == ['5', '5', '7']:
    print("YES")
  elif x == ['5', '7', '5']:
    print("YES")
  elif x == ['7', '5', '5']:
    print("YES")
  else:
    print("NO")
    
test()

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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define out(S) cout<<(S)<<endl;
#define ShowAll(collection) for(auto i:collection){out(i);}
#define beginend(v) v.begin(),v.end()
#define Foreach(item,collection) for(auto item : collection)

using pii=pair<int,int>;
using vb=vector<bool>;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vvc=vector<vector<char>>;
using ti3=tuple<int,int,int>;
using ulong=unsigned long;
template<typename T> void removeAt(vector<T>& v, int index) { v.erase(v.begin() + index); }
#define OCB(c) (c&1)|(c&2)<<2|(c&4)<<4|(c&8)<<6|(c&16)<<8|(c&32)<<10|(c&64)<<12|(c&128)<<14

int main(){
    int n;
    cin >> n;
    n*=2;
    vi L(n);
    rep(i,n) cin>>L[i];
    sort(beginend(L));

    int sum=0;
    rep(i,n) if(i%2==0){
        sum+=L[i];
    }
    out(sum)
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];

        for(int i=0; i<n; i++) {
            a[i] = sc.nextInt();
        }

        int min = a[0];
        int res = 1;
        for(int i=1; i<n; i++) {
            if(min >= a[i]) {
                res++;
                min = a[i];
            }
        }
        System.out.println(res);

    }
}


Measured memory_bytes: 65152
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int W = sc.nextInt();
        int H = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int r = sc.nextInt();

        if( x-r < 0 || x+r > W || y-r < 0 || y+r > H) System.out.println("No");
        else System.out.println("Yes");
        
    }
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

ll rec(ll n, ll a, ll b, ll c, ll d, map<ll, ll> &mp) {
    if (n == 0) return 0;
    if (n == 1) return d;
    if (mp.count(n)) return mp[n];

    ll res = LINF;
    if (n < LINF / d) chmin(res, n*d);
    chmin(res, a + n%2 * d + rec(n/2, a, b, c, d, mp));
    if (n != 2) chmin(res, a + (2 - n%2) * d + rec(n/2+1, a, b, c, d, mp));
    chmin(res, b + n%3 * d + rec(n/3, a, b, c, d, mp));
    chmin(res, b + (3 - n%3) * d + rec(n/3+1, a, b, c, d, mp));
    chmin(res, c + n%5 * d + rec(n/5, a, b, c, d, mp));
    chmin(res, c + (5 - n%5) * d + rec(n/5+1, a, b, c, d, mp));

    return mp[n] = res;
}

void solve() {
    int t;
    cin >> t;
    for (int i=0; i<t; ++i) {
        ll n, a, b, c, d;
        cin >> n >> a >> b >> c >> d;
        map<ll, ll> mp;
        cout << rec(n, a, b, c, d, mp) << '\n';
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}


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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using ll = long long;
using lb = long double;
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 1000000007LL;

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

int main() {
  int N;
  cin>>N;
  int A,B,C,D;
  D = N%10;
  N/=10;
  C = N%10;
  N/=10;
  B = N%10;
  N/=10;
  A=N;
  vector<int> ans(3);
  rep(i,2){
    rep(j,2){
      rep(k,2){
        int cnt = A;
        if(i==0) cnt+=B;
        else cnt -= B;
        if(j==0) cnt += C;
        else cnt -= C;
        if(k == 0) cnt += D;
        else cnt -= D;
        if(cnt==7) ans = (vector<int>){i,j,k};
      }
    }
  }
  cout<<A;
  if(ans[0]==0) cout<<'+';
  else cout<<'-';
  cout<<B;
  if(ans[1]==0) cout<<'+';
  else cout<<'-';
  cout<<C;
  if(ans[2]==0) cout<<'+';
  else cout<<'-';
  cout<<D<<"=7"<<endl;
}

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

# 指数的に平均に収束する。よって適当な回数試せばよい

A,B,C = map(int,read().split())

for t in range(500):
    if A&1 or B&1 or C&1:
        break
    A,B,C = A//2,B//2,C//2
    A,B,C = B+C,C+A,A+B

answer = t if t < 400 else -1
print(answer)

Measured memory_bytes: 3064
#include <stdio.h>

typedef struct node_t_tag {
	struct node_t_tag *left;
	struct node_t_tag *right;
} node_t;

node_t node_pool[1000];
int node_pool_pos=0;

node_t *create_node(void) {
	return &node_pool[node_pool_pos++];
}

node_t *create_tree_i(const char **tree_str) {
	node_t *node=create_node();
	(*tree_str)++; /* '(' no hazu */
	if(*(*tree_str)=='(') {
		node->left=create_tree_i(tree_str);
	} else {
		node->left=NULL;
	}
	(*tree_str)++; /* ',' no hazu */
	if(*(*tree_str)=='(') {
		node->right=create_tree_i(tree_str);
	} else {
		node->right=NULL;
	}
	(*tree_str)++; /* ')' no hazu */
	return node;
}

node_t *create_tree(const char *tree_str) {
	return create_tree_i(&tree_str);
}

node_t *calc(const node_t *tree1,const node_t *tree2,int is_union) {
	node_t *node;
	if(tree1==NULL && tree2==NULL)return NULL;
	if(!is_union && (tree1==NULL || tree2==NULL))return NULL;
	node=create_node();
	node->left=calc(
		tree1==NULL?NULL:tree1->left,tree2==NULL?NULL:tree2->left,is_union);
	node->right=calc(
		tree1==NULL?NULL:tree1->right,tree2==NULL?NULL:tree2->right,is_union);
	return node;
}

void display_tree(const node_t *node) {
	putchar('(');
	if(node->left!=NULL)display_tree(node->left);
	putchar(',');
	if(node->right!=NULL)display_tree(node->right);
	putchar(')');
}

int main(void) {
	char query[32];
	char A[1024];
	char B[1024];
	while(node_pool_pos=0,scanf("%s%s%s",query,A,B)==3) {
		node_t *tree1=create_tree(A);
		node_t *tree2=create_tree(B);
		node_t *res=calc(tree1,tree2,query[0]=='u');
		display_tree(res);
		putchar('\n');
	}
	return 0;
}

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

#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repa(i,arr,n) for(int i=arr;i<=n;i++)
#define repd(i,arr,n) for(int i=arr;i>=n;i--)
#define trav(arr,x) for(auto& arr:x)
#define all(c) c.begin(), c.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(arr) arr.size()
#define pi 3.14159265358979323846
#define MAX (1000*1000*1000+7)
#define vi vector<int>
#define pii pair<int,int>
#define pqueue priority_queue<int>
#define pdqueue priority_queue<int,vi,greater<int> >

const int mod=998244353;
const long double inf=1e14;
int power(int a,int b,int p)
{
    int ans=1;
    while(b)
    {
        if(b&1)
        {
            ans=(ans*a)%p;
        }
        a=(a*a)%p;
        b>>=1;
    }
    return ans;
}

int32_t main()
{
    int n,k;
    double ans=0.0,d=0.0;
    cin>>n>>k;

    repa(i,1,n)
    {
        if(i==k)
        {
            ans+=(n-k+1);
            break;
        }
        int cnt=0,val=i;
        while(val<k)
        {
            val*=2;
            cnt++;
        }
        d+=(1.0/pow(2,cnt));
    }
    ans+=d;
    ans/=n;
    printf("%0.15lf\n",ans );
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

struct UnionFind
{
  std::vector<int> Parent;
  UnionFind(int n){
    Parent=vector<int>(n,-1);
  }
  
  int root(int a){
    if(Parent.at(a)<0) return a;
    Parent.at(a)=root(Parent.at(a));
    return Parent.at(a);
  }

  int size(int a){
    return -Parent.at(root(a));
  }

  bool connect(int a,int b){
    if(root(a)==root(b)) return false;
    if(size(a)<size(b)) swap(a,b);
    Parent.at(root(a))-=size(b);
    Parent.at(root(b))=root(a);
    return true;
  }
};


int main()
{
  int n,m;
  cin>>n>>m;
  vector<int> vec(n);
  for (int i = 0; i < n; ++i)
  {
    cin>>vec[i];
    vec[i]--;
  }
  
  UnionFind field(n);
  
  for (int i = 0; i < m; ++i)
  {
    int a,b;
    cin>>a>>b;
    a--;
    b--;
    field.connect(a,b);
  }


  int cnt=n;
  for (int i = 0; i < n; ++i)
  {
    if(vec[i]!=i){
      if(field.root(i)!=field.root(vec[i])) cnt--;
    }
  }
  cout<<cnt;
}

Measured memory_bytes: 1024
package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func main() {
	scanner.Split(bufio.ScanWords)

	const maxCapacity = 512 * 1024
	buf := make([]byte, maxCapacity)
	scanner.Buffer(buf, maxCapacity)

	aStr := nextString()
	bStr := nextString()

	a, _ := new(big.Int).SetString(aStr, 10)
	b, _ := new(big.Int).SetString(bStr, 10)
	c := big.NewInt(0).Mod(a, b)

	fmt.Println(c)
}



Measured memory_bytes: 1248
/*
Author: CNYALI_LK
LANG: C++
PROG: b.cpp
Mail: cnyalilk@vip.qq.com
*/
#include<bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define DEBUG printf("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define Debug debug("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define all(x) x.begin(),x.end()
#define x first
#define y second
#define int ll
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const signed inf=0x3f3f3f3f;
const double eps=1e-8;
const double pi=acos(-1.0);
template<class T>int chkmin(T &a,T b){return a>b?a=b,1:0;}
template<class T>int chkmax(T &a,T b){return a<b?a=b,1:0;}
template<class T>T sqr(T a){return a*a;}
template<class T>T mmin(T a,T b){return a<b?a:b;}
template<class T>T mmax(T a,T b){return a>b?a:b;}
template<class T>T aabs(T a){return a<0?-a:a;}
template<class T>int dcmp(T a,T b){return a>b;}
template<int *a>int cmp_a(int x,int y){return a[x]<a[y];}
#define min mmin
#define max mmax
#define abs aabs
namespace io {
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	// getchar
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	// print the remaining part
	inline void flush () {
		fwrite (obuf, 1, oS - obuf, stdout);
		oS = obuf;
	}
	// putchar
	inline void putc (char x) {
		*oS ++ = x;
		if (oS == oT) flush ();
	}
	// input a signed integer
	inline void read (signed &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = x * 10 + (c & 15); x *= f;
	}

	inline void read (long long &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = x * 10 + (c & 15); x *= f;
	}
	inline void read (char &x) {
		x=gc();
	}
	inline void read(char *x){
		while((*x=gc())=='\n' || *x==' '||*x=='\r');
		while(!(*x=='\n'||*x==' '||*x=='\r'))*(++x)=gc();
		*x=0;
	}
	template<typename A,typename ...B>
	inline void read(A &x,B &...y){
		read(x);read(y...);
	}
	// print a signed integer
	inline void write (signed x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
	}

	inline void write (long long x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
	}
	inline void write (char x) {
		putc(x);
	}
	inline void write(const char *x){
		while(*x){putc(*x);++x;}
	}
	inline void write(char *x){
		while(*x){putc(*x);++x;}
	}
	template<typename A,typename ...B>
	inline void write(A x,B ...y){
		write(x);write(y...);
	}
	//no need to call flush at the end manually!
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
}
using io :: read;
using io :: putc;
using io :: write;
signed main(){
#ifdef cnyali_lk
	freopen("b.in","r",stdin);
	freopen("b.out","w",stdout);
#endif
	int n,s=0,t=0,x;	
	read(n);
	for(int i=1;i<=n;++i){
		read(x);	
		if(!x){s+=t>>1;t=0;}
		else t+=x;
	}
	s+=t>>1;
	write(s,'\n');
	return 0;
}



Measured memory_bytes: 2304
#include <stdio.h>

int main(){
	int N,B,x,score=0;
	scanf("%d %d",&N,&B);
	for(int i=0;i<N;i++){
		scanf("%d",&x);
		if(x>B-x)
			score += (B-x)*2;
		else
			score += x*2;
	}
	printf("%d",score);
}

Measured memory_bytes: 128
#-------------------------------------------------------------------
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------
n = int(input())
a =        list( map(int, input().split()) )	# 1 2 3 4 5 ...


ans=0
x=a[0]

for i in range(n):
	#p(x, a[i])
	if x >= a[i]:
		x = a[i]
		ans+=1

print(ans)


Measured memory_bytes: 24744
#include <iostream>
#include <string>
#include <vector>
 
int main(){
  unsigned long long N;
  std::cin >> N;

  auto dict = "abcdefghijk";
  
  std::vector<std::string> t[N];

  t[0].emplace_back("a");
  for(auto i = 0; i < N-1; ++i){
    t[i+1].reserve(t[i].size() * N);
    
    for(auto v : t[i]){
      	for(auto j=0; j <= i+1; ++j){
          if(j && v.find(dict[j-1]) == std::string::npos){ break; }
          t[i+1].push_back(v + dict[j]);
        }
    }
  }
  
  for(auto v : t[N-1]){
   	std::cout << v << "\n"; 
  }
  std::cout << std::flush;
	  
  return 0;
}

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	priority_queue<ll> A;
	rep(i, n) {
		ll a; cin >> a;
		A.push(a);
	}
	ll res;
	rep(i, m) {
		res = A.top();
		res /= 2;
		A.pop();
		A.push(res);
	}
	ll ans = 0;
	rep(i, n) {
		ans += A.top();
		A.pop();
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1400
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<cstring>

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<int, int>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl

class mint {
    long long x;
public:
    mint(long long x=0) : x((x%MOD+MOD)%MOD) {}
    mint operator-() const {
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};
/* -- template -- */
const int MAX_H = 300, MAX_W = 300;
int A[MAX_H][MAX_W];
int sumA[MAX_H * MAX_W + 1];
int main() {
    int H, W, D; cin >> H >> W >> D;
    map<int, pair<int, int>> m;
    rep(i, H) {
        rep(j, W) {
            cin >> A[i][j];
            m[A[i][j]] = make_pair(i, j);
        }
    }
    for(int j = 1;j <= D;++j){
        for(int i = j; i <= H * W ; i += D) {
            if(i == j)continue;
            sumA[i] = sumA[i - D] + abs(m[i].first - m[i - D].first) + abs(m[i].second - m[i - D].second);
        }
    }

    int Q; cin >> Q;
    int L, R;
    int ans[Q];
    rep(i, Q) {
        cin >> L >> R;
        ans[i] = sumA[R] - sumA[L];
    }
    rep(i, Q)
        cout << ans[i] << endl;
}


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

int main() {
  int n;
  cin >> n;
  int count = n;
  unsigned long int v[n];
  for (size_t i = 0; i < count; i++) {
    cin >> v[i];
  }
  sort(v, v+n, greater<int>());
  for (int i = 1; i < count; i++) {
    if (i == count - 1) {
      cout << v[0] << ' ' << v[i] << endl;
      return 0;
    } else if (v[i] <= v[0]/2) {
      if (v[0]/2 - v[i] < v[i-1] - v[0]/2) cout << v[0] << ' ' << v[i] << endl;
      else cout << v[0] << ' ' << v[i-1] << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(void){
	int tate,yoko,takasa;
	int n;
	int r;
	int i;
	int en;
	int min=0;
	int a,b,c;
	while(scanf("%d %d %d",&tate,&yoko,&takasa)){
		if((tate==0) && (yoko==0) && (takasa==0)){
			break;
		}
		a=tate*tate+yoko*yoko;
		b=yoko*yoko+takasa*takasa;
		c=takasa*takasa+tate*tate;
		if(b>a && c>a){
			min=a;
		}
		else if(c>b && a>b){
			min=b;
		}
		else if(a>c && b>c){
			min=c;
		}
		scanf("%d",&n);
		for(i=0;i<n;i++){
			scanf("%d",&r);
			if(4*r*r>min){
				printf("OK\n");
			}
			else{
				printf("NA\n");
			}
		}
	}
	return 0;
}

Measured memory_bytes: 584
#include<bits/stdc++.h>
using namespace std;
 
using lint=long long;
const int INF=1e9;

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

   int N; cin>>N;
   vector<int> x(N);
   for(int i=0;i<N;i++) cin>>x[i];

   int ans=INF;
   for(int p=1;p<=100;p++){
      int sum=0;
      for(int i=0;i<N;i++) sum+=(x[i]-p)*(x[i]-p);
      ans=min(ans,sum);
   }
   cout<<ans<<endl;
   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(),(x).end()
using ll = long long;
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; }
//vector<vector<要素の型>> 変数名(要素数1, vector<要素の型>(要素数2, 初期値));
//vector<vector<要素の型>> 変数名(要素数1, vector<要素の型>(要素数2));  // 初期値を省略

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	string ts="test";
	
	int n,k; cin >> n >> k;
	vector<ll> a(n); rep(i,n) cin >> a[i];
	
	sort(all(a));
	
	ll sum=0;
	
	rep(i,n){
		if(k>0) k--;
		else sum+=a[n-1-i];

	}
	
	cout << sum << endl;
	
	
	return 0;
}



Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.PriorityQueue;

public class Main {

    static class edge{
        int from, to, cost;
    }

    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] str = br.readLine().split(" ");
        int v = Integer.parseInt(str[0]);
        int e = Integer.parseInt(str[1]);
        int r = Integer.parseInt(str[2]);

        @SuppressWarnings("unchecked")
        ArrayList<edge>[] es = new ArrayList[v];
        for(int i=0; i<v; i++) es[i] = (new ArrayList<>());

        for (int i=0; i<e; i++){
            str = br.readLine().split(" ");
            edge ed = new edge();
            ed.from = Integer.parseInt(str[0]);
            ed.to = Integer.parseInt(str[1]);
            ed.cost = Integer.parseInt(str[2]);
            es[ed.from].add(ed);
        }

        PriorityQueue<long[]> dist = new PriorityQueue<>((long[] le, long[] ri) -> (int)(le[0] - ri[0]));
        long[] vertex = new long[2];
        vertex[0] = 0;
        vertex[1] = r;
        dist.add(vertex);

        long[] len = new long[v];
        Arrays.fill(len, Long.MAX_VALUE);
        len[r] = 0;

        while(!dist.isEmpty()){
            vertex = dist.poll();

            long u = vertex[1];
            for (Object ed: es[(int)u]){
                if(len[((edge) ed).from] + ((edge) ed).cost < len[((edge) ed).to]) {
                    len[((edge) ed).to] = len[((edge) ed).from] + ((edge) ed).cost;
                    long[] p = new long[2];
                    p[0] = len[((edge) ed).to];
                    p[1] = ((edge) ed).to;
                    dist.add(p);
                }
            }
        }

        for(int i=0; i<v; i++){
            if(len[i] == Long.MAX_VALUE){
                System.out.println("INF");
            } else {
                System.out.println(len[i]);
            }
        }
    }
}

Measured memory_bytes: 126780
N, Y = gets.split.map(&:to_i)

(0..([(Y / 10000), N].min)).each do |c10000|
  rest1 = Y - c10000 * 10000
  rest_c1 = N - c10000
  (0..([(rest1 / 5000), rest_c1].min)).each do |c5000|
    rest2 = rest1 - c5000 * 5000
    rest_c2 = rest_c1 - c5000
    if rest_c2 * 1000 == rest2
      c1000 = rest_c2
      puts "#{c10000} #{c5000} #{c1000}"
      exit 0
    end
  end
end
puts '-1 -1 -1'


Measured memory_bytes: 1788
# coding: utf-8
A = [int(input()) for i in range(5)]
B = [10 if i % 10 == 0 else i % 10 for i in A]
minB = A.pop(B.index(min(B)))
A = [i if i % 10 == 0 else i + 10 - (i % 10) for i in A]
A.append(minB)
print(sum(A))

Measured memory_bytes: 3060
function main(input) {
  var a = input[0]-0;
  var ans = "";
  switch(a){
    case 25:
      ans = "Christmas";
      break;
    case 24:
      ans = "Christmas Eve";
      break;
    case 23:
      ans = "Christmas Eve Eve";
      break;
    case 22:
      ans = "Christmas Eve Eve Eve";
      break;
  }
  console.log(ans);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))


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

const double PI = acos(-1);

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000
#define LLINF 1e18

void solve_abc_c() {
	ll n, m;
	ll k;
	ll h, w;
	//ll x;
	//ll a;
	string s;
	string s_ans;
	ll l_ans = 0;
	double d_ans = 0;

	cin >> n;
	V a(n);
	rep(i, n) cin >> a[i];
	
	ll now = a[0];
	rep(i, n) {
		if (a[i] < now) {
			l_ans += now - a[i];
		}
		else {
			now = a[i];
		}
	}

	cout << l_ans << "\n";
}

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed;
	cout << setprecision(15);

	solve_abc_c();

	return 0;
}


Measured memory_bytes: 4780
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
typedef double lf;
typedef long double Lf;
typedef pair <int,int> pii;
typedef pair <ll, ll> pll;

#define TRACE(x) cerr << #x << "  " << x << endl
#define FOR(i, a, b) for (int i = (a); i < int(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define _ << " " <<

#define fi first
#define sec second
#define mp make_pair

const int MAXN = 100100;

int n, m, a, b, cont[MAXN], cnt[MAXN];

int main() {
  scanf("%d %d",&n,&m);
  cont[1] = 1;
  FOR(i, 1, n + 1) cnt[i]++;
  REP(i, m) {
    scanf("%d %d",&a,&b);
    if (!cnt[a]) continue;
    cnt[b]++;
    if (cont[a]) cont[b] |= 1;
    cnt[a]--;
    if (!cnt[a]) cont[a] = 0;
  }

  int sol = 0;
  FOR(i, 1, n + 1) sol += cont[i];
  printf("%d\n",sol);
  return 0;
}


Measured memory_bytes: 1024
n = gets.to_i
p = gets.split.map(&:to_i)

sorted = p.sort
diff = []

p.each_index do |i|
  if p[i] != sorted[i]
    diff << p[i]
  end
end

if diff.size == 2 || diff.size == 0
  puts "YES"
else
  puts "NO"
end

Measured memory_bytes: 3836
#include<iostream>
using namespace std;
int sod(int x){
    int ret = 0;
    while(x>0){
       ret += x%10; 
       x/=10;
    }
    return ret;
}
int main(){
    int n;
    cin>>n;
    int mi = -1;
    for(int i=1;i<n;++i){

        int x=i;
        int y=n-i;
        int tmp = sod(x)+sod(y);
        if(mi<0 || tmp < mi)
            mi = tmp;
    }
    cout<<mi<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include<iostream> 
#include<iomanip> 
#include<vector> 
#include<map> 
#include<set> 
#include<algorithm> 
#include<numeric> 
#include<limits> 
#include<bitset> 
#include<functional> 
#include<type_traits> 
#include<queue> 
#include<stack> 
#include<array> 
#include<random> 
#include<utility> 
#include<cstdlib> 
#include<ctime>
//#define _LIBCPP_DEBUG 0
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define all(a) (a).begin(),(a),end()
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)	

int max(ll a, ll b) {
	ll max;
	if (a > b) max = a;
	else max = b;
	return max;
}
int min(ll a, ll b) {
	ll min;
	if (a < b) min = a;
	else min = b;
	return min;
}


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

	string ss;
	ss = s;
	reverse(ss.begin(), ss.end());
	int cnt = 0;
	rep(i,s.size() / 2) {
		if (s[i] != ss[i]) {
			cnt++;
		}
	}
	cout << cnt << endl;
}

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

cnt = 0
for i in range(1000):
  c = str(i).zfill(3)
  if c[0] in S:
        index1 = S.index(c[0])
        if c[1] in S[index1+1:]:
            index2 = index1 + 1 + S[index1+1:].index(c[1])
            if c[2] in S[index2+1:]:
                cnt+=1
print(cnt)


Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;


int main() {

	int N;
	cin >> N;
	vector<int> B(N-1), A(N);
	
		
	for(int i = 0; i < (N - 1); i++){
		cin >> B[i];
	}
	
	A[0] = B[0];
	A[N-1] = B[N-2];
	
	for(int i = 1; i < (N - 1); i++){
		
		int b1 = B[i-1];
		int b2 = B[i];
		if(b1 >= b2){
			A[i] = b2;
		}else{
			A[i] = b1;
		}
		
	}	
	
	long long count = 0;

	for(int i = 0; i < N; i++){
		//cout <<A[i] << " ";
		count += A[i];
	}
	
	cout << count << endl;





    return 0;
}


/*

for(int i = 0; i < N; i++){
	
}

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


*/


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

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if(a == b && b == c) cout << 1 << endl;
  else if(a == c || b == c || a == b) cout << 2 << endl;
  else cout << 3 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int flag=1,i,j,minj,N,A[100],temp,cnt=0;

  scanf("%d",&N);
  for(i=0;i<N;i++)scanf("%d",&A[i]);

  for(i=0;i<N;i++)
  {
    minj = i;
    for(j=i;j<N;j++)
    {
      if(A[j]<A[minj])minj=j;
    }
    if(A[i]==A[minj])continue;
    else
    {
      temp=A[i];
      A[i]=A[minj];
      A[minj]=temp;
      cnt++;
    }
  }
  for(i=0;i<N;i++)
  {
    printf("%d",A[i]);
    if(i!=N-1)printf(" ");
  }
  printf("\n");
  printf("%d\n",cnt);
  return 0;
}



Measured memory_bytes: 2104
import java.io.File;
import java.io.FileInputStream;
import java.util.Scanner;
import java.util.Map.Entry;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.NoSuchElementException;

public class Main {
	
	public static void main(String[] args) throws IOException {
		FastScanner sc = new FastScanner(System.in);
		
		int N = sc.nextInt();
		long x = sc.nextLong();
		long[] a = new long[N];
		for(int i = 0; i < N; i++) a[i] = sc.nextLong();
		
		long ans = 0;
		for(int i = 1; i < N; i++){
			long diff = (a[i] + a[i-1]) - x;
			if(diff > 0){
				if(diff <= a[i]){
					a[i] -= diff;
				}else{
					a[i] = 0;
					a[i-1] -= (diff - a[i]);
				}
				ans += diff;
			}
		}
		
		System.out.println(ans);
	}
}

class FastScanner {
    private InputStream in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    public FastScanner(InputStream in) {
		this.in = in;
	}
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
    	if (hasNextByte()) return buffer[ptr++];
    	else return -1;
    }
    private static boolean isPrintableChar(int c){
    	return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
    	while(hasNextByte() && !isPrintableChar(buffer[ptr]))
    		ptr++; return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
    	return Double.parseDouble(next());
    }
}

Measured memory_bytes: 24120
#include<bits/stdc++.h>
#define N 100010
using namespace std;
int n,mp[30];
const int p=1e9+7;
char s[N];
inline int read(){
	int x=0,sgn=1;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())if(ch=='-')sgn=-1;
	for(;isdigit(ch);ch=getchar())x=(x<<1)+(x<<3)+(ch^48);
return sgn*x;
}
int main(){
	n=read();
	scanf("%s",s+1);
	for(int i=1;i<=n;i++)
		mp[s[i]-'a'+1]++;
	int ans=1;
	for(int i=1;i<=26;i++)
		ans=1LL*ans*(mp[i]+1)%p;
	ans=(ans-1+p)%p;
	printf("%d",ans);
return 0;
}


Measured memory_bytes: 384
#include<stdio.h>

double i,v,y;

int main(){
	while(scanf("%lf",&v)!=EOF){
		i=0.0;
		y=v*v/19.6;
		while(y>i*5-5)i+=1.0;
		printf("%d\n",(int)i);
	}
	return 0;
}

Measured memory_bytes: 0
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *DD = map(int, read().split())
    
    count = 0
    for d1, d2 in zip(*[iter(DD)] * 2):
        if d1 == d2:
            count += 1
            if count == 3:
                print('Yes')
                return
        else:
            count = 0
    
    print('No')
    return


if __name__ == '__main__':
    main()


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

int main(){
    double x1, y1, x2, y2;
    double dis;
    cin >> x1 >> y1 >> x2 >> y2;
    dis = (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2);
    cout << fixed << setprecision(8) << sqrt(dis) << endl;
}



Measured memory_bytes: 3216
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main(){
    int a, b, ans;
    cin >> a >> b;
    ans = a - b*2;
    if(ans < 0)cout << 0 << endl;
    else cout << ans << endl;
}

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

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

	int N, M;
	scanf("%d %d", &N, &M);

	int powm = 1;
	for (int i = 0; i < M; i++) {
		powm *= 2;
	}
	printf("%d", powm * (M * 1900 + (N - M) * 100));

	return 0;
}


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

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main() {
  int N;
  cin >> N;
  int A;
  cin >> A;

  N %= 500;
  if (N <= A) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


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

//---------------------------------------------------------------
// ------ graph ------ //
using Weight = int;
using Flow = int;
struct Edge {
    int src, dst;
    Weight weight;
    Flow cap;
    Edge() : src(0), dst(0), weight(0) { }
    Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) { }
};
bool operator < (const Edge &e, const Edge &f) {
    return e.weight != f.weight ? e.weight > f.weight : // pqが降順のため
        e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
using Edges = vector<Edge>;
struct Graph {
    vector<Edges> adj;
    Graph(int n) : adj(n) { }
    int size() { return adj.size(); }
    Edges operator [] (int v) { return adj[v]; }
    void add_edge(int a, int b, Weight w = 1) { // graph
        adj[a].emplace_back(a, b, w);
        adj[b].emplace_back(b, a, w);
    }
    void add_arc(int a, int b, Weight w = 1) {  // digraph
        adj[a].emplace_back(a, b, w);
    }
};
using Array = vector<Weight>;
using Matrix = vector<Array>;

// ------ Topological Sort (dfs) ------ //
vector<int> tsort(Graph &g) {
    int n = g.size();
    enum { YET, VISITED, DONE };
    vector<int> res, color(n, YET);
    static const function<bool(int)> dfs = [&](int v) {
        color[v] = VISITED;
        for (Edge &e : g[v]) {
            if (color[e.dst] == DONE) continue;
            if (color[e.dst] == VISITED) return false;
            if (!dfs(e.dst)) return false;
        }
        color[v] = DONE; res.push_back(v);
        return true;
    };
    for (int i = 0; i < n; ++i) if (color[i] == YET && !dfs(i)) return {};
    reverse(res.begin(), res.end());
    return res;
}
//---------------------------------------------------------------

int main() {
    int V, E; cin >> V >> E;
    Graph g(V);
    for (int i = 0; i < E; i++) {
        int s, t; cin >> s >> t;
        g.add_arc(s, t);
    }
    vector<int> ord = tsort(g);
    for (int i = 0; i < V; i++) cout << ord[i] << endl;
    return 0;
}


Measured memory_bytes: 4368
from collections import deque
N,M=map(int,input().split())
graph=[[] for i in range(N)]
for i in range(M):
    A,B=map(int,input().split())
    graph[A-1].append(B-1)
    graph[B-1].append(A-1)
queue=deque([0])
distance=[0]*N
while queue:
    que=queue.popleft()
    for value in graph[que]:
        if distance[value]==0:
            distance[value]=que+1
            queue.append(value)
if 0 in distance:
    print("No")
else:
    print("Yes")
    for i in range(1,N):
        print(distance[i])

Measured memory_bytes: 36976
#include <bits/stdc++.h>
using namespace std;
int fun(string s1,string s2);
int fun(string s1,string s2)
{
  if(s1==s2)
    return 3;
  int c=0;
  for(int i=0;i<3;i++)
  {
    if(s1[i]==s2[i])
      c++;
  }
  return c;
}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s1,s2;
  cin>>s1>>s2;
  cout<<fun(s1,s2);
}

Measured memory_bytes: 256
n,k = map(int,input().split())
ans = [0]*n

for i in range(k):
    d_i = int(input())
    D = [int(x) for x in input().split()]
    for j in D:
        ans[j-1] += 1

count = 0
for a in ans:
    if a == 0:
        count += 1
print(count)

Measured memory_bytes: 9184
#include<stdio.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
int n,xx,yy,et,be[6000],siz[5100];
const int p=1e9+7;
long long f[5100][5100][2],tmp[5100][2],g[5100],ans;
struct edg{
	int y,ne;
};
edg e[11000];
inline void add_edge(int x,int y){
	e[++et].y=y;
	e[et].ne=be[x];
	be[x]=et;
}
void dfs(int x,int fa){
	siz[x]=1;f[x][1][0]=1;
	for(int i=be[x];i;i=e[i].ne){
		if (e[i].y==fa) continue;
		dfs(e[i].y,x);
		fo(j,1,siz[x])
			fo(w,0,1){
				tmp[j][w]=f[x][j][w];
				f[x][j][w]=0;
			}
		fo(j,1,siz[x])//
			fo(k,1,siz[e[i].y])//
				fo(w1,0,1)
					fo(w2,0,1){
						f[x][j+k][w1^w2]+=tmp[j][w1]*f[e[i].y][k][w2]%p;
						f[x][j][w1^w2^1]+=tmp[j][w1]*f[e[i].y][k][w2]%p*g[k]%p;
					}
		siz[x]+=siz[e[i].y];
		fo(j,1,siz[x])
			fo(w,0,1)
				f[x][j][w]%=p;//tmp[j][w]%p
	}
}
int main(){
	scanf("%d",&n);
	fo(i,2,n){
		scanf("%d%d",&xx,&yy);
		add_edge(xx,yy);
		add_edge(yy,xx);
	}
	g[0]=1;
	for(int i=2;i<=n;i+=2) g[i]=g[i-2]*(i-1)%p;//i++
	dfs(1,-1);
	fo(i,1,siz[1]) ans+=(f[1][i][0]-f[1][i][1])*g[i]%p;
	ans=(ans%p+p)%p;
	printf("%lld\n",ans);
	return 0;
} 

Measured memory_bytes: 399232
def inpl(): return list(map(int, input().split()))
S = input()
x = "keyence"
OK = False
if S[:7] == x or S[-7:] == x:
    print("YES")
else:
    for i in range(1, 8):
        if S[:i] == x[:i] and S[-7+i:] == x[i:]:
            print("YES")
            break
    else:
        print("NO")

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

#define ull unsigned long long
#define ll long long
#define mod 1000000007
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
#define PI acos(-1.0)
const int N=1e5 + 5;
const int M=1e5 + 5;


int main()
{
	ios_base::sync_with_stdio(false);
	int n,i,s[N];
	cin>>n;
	for(i=0;i<n;i++){
		cin>>s[i];
	}
	int ans=0;
	int cnt=1;
	for(i=1;i<n;i++){
		if(s[i]==s[i-1]){
			cnt++;
		}
		else{
			ans+=cnt/2;
			cnt=1;
		}
	}
	ans+=cnt/2;
	cout << ans << endl;	
	
		
	return 0;
}

Measured memory_bytes: 256
while True:
    a,op,b = input().split()
    a = int(a)
    b = int(b)
    if op == "+":
        print(a + b)
    elif op == "-":
        print(a - b)
    elif op == "*":
        print(a * b)
    elif op == "/":
        print(a // b)
    elif op == "?" :
        break


Measured memory_bytes: 5596
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int main(void){
    int n,a,b,ans1,ans2;
    cin >> n >>a >> b;
    ans1 = min(a,b);
    if(n >= a+b){
        ans2 = 0;
    } else{
        ans2 = a+b-n;
    }
    cout << ans1 << " "<< ans2 <<endl;
    return 0;
}

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

int main()
{
	while(1)
	{
		string s;
		int y,m,d;
		cin>>s;
		if(s=="#")
			break;
		cin>>y>>m>>d;
		
		if(y<31)
			cout<<s<<" "<<y<<" "<<m<<" "<<d<<endl;
		else if(y>31)
			cout<<"? "<<y-30<<" "<<m<<" "<<d<<endl;
		else{
			if(m<=4)
				cout<<s<<" "<<y<<" "<<m<<" "<<d<<endl;
			else
				cout<<"?"<<" "<<1<<" "<<m<<" "<<d<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3104
#include <stdio.h>

int main(void)
{
  int a[1000000];
  int i, j, s;

  scanf("%d", &s);

  a[0] = s;

  for (i = 1; i < 999999; i++) {
    if (a[i - 1] % 2)
      a[i] = 3 * a[i - 1] + 1;
    else
      a[i] = a[i - 1] / 2;
    for (j = 0; j < i; j++) {
      if (a[j] == a[i])
        goto end;
    }
  }

 end:

  printf("%d\n", i + 1);

  return 0;
}


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

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

    int ans;
    if (a + b > c * 2) {
        if (x > y) {
            int tmp = c * x * 2;
            ans = c * y * 2 + a * (x-y);
            ans = min(tmp, ans);
        }
        else {
            int tmp = c * y * 2;
            ans = c * x * 2 + b * (y-x);
            ans = min(tmp, ans);
        }
    }
    else {
        ans = a * x + b * y;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
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> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

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

    vector<bool> ab(20000, true), bc(20000, true), ac(20000, true);
    REP(i, a.size()) REP(j, b.size()) if(a[i]!='?' && b[j]!='?' && a[i]!=b[j]) ab[i-j+10000] = false;
    REP(i, b.size()) REP(j, c.size()) if(b[i]!='?' && c[j]!='?' && b[i]!=c[j]) bc[i-j+10000] = false;
    REP(i, a.size()) REP(j, c.size()) if(a[i]!='?' && c[j]!='?' && a[i]!=c[j]) ac[i-j+10000] = false;

    ll ret = INF;
    FOR(i, -4000, 4000) FOR(j, -4000, 4000) {
        if(ab[i+10000] && ac[j+10000] && bc[j-i+10000]) {
            ll l = min({0LL, i, j});
            ll r = max({(ll)a.size(), i+(ll)b.size(), j+(ll)c.size()});
            chmin(ret, r-l);
        }
    }
    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl

int main() {
  int A, P;  cin >> A >> P;
  print((A * 3 + P)/2);
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int r,c;
    cin>>r>>c;
    int x[101][101]={{}};
    
    
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            cin>>x[i][j];
            x[r][j]+=x[i][j];
            x[i][c]+=x[i][j];
        }
        x[r][c]+=x[i][c];
    }
    
    for(int i=0;i<r+1;i++){
        for(int j=0;j<c+1;j++){
            cout<<x[i][j];
            
            if(j==c){
                cout<<endl;
            }
            else{
                cout<<" ";
            }
        }
    }
    return 0 ;
}



Measured memory_bytes: 3108
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        boolean color[] = new boolean[8];
        Arrays.fill(color, false);
        int rainbow = 0;
        int min = 0;
        int N = s.nextInt();
        for(int i = 0; i < N; i++){
            try{
                int rate = s.nextInt();
                if(!color[rate / 400]){
                    min++;
                    color[rate / 400] = true;
                }
            } catch(IndexOutOfBoundsException e){
                rainbow++;
            }
        }
        if(min == 0){
            min = 1;
            rainbow--;
        }
        System.out.println(min + " " + (min+rainbow)); //好きな色ってほんとに好きな色なのかよshit!!
    }
}


Measured memory_bytes: 21716
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<vi> vvi;
typedef std::vector<ll> vll;
typedef std::vector<vll> vvll;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

int main() {
  vi a(3), b(3);
  vi check(4, 0);
  rep (i, 3) {
    scan(a[i], b[i]);
    a[i] -= 1;
    b[i] -= 1;
    check[a[i]] += 1;
    check[b[i]] += 1;
  }
  rep (i, 4) {
    if (check[i] == 0) {
      print("NO");
      return 0;
    }
  }
  rep (i, 4) {
    if (check[i] == 3) {
      print("NO");
      return 0;
    }
  }
  print("YES");
  return 0;
}


Measured memory_bytes: 888