akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
#define rreps(i, n) for(int i=((int)(n)); i>0; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pl(s) cout << (s) << "\n";
#define pls(...) {bool space = false; for(auto i : __VA_ARGS__) (cout << (space?" ":"") << i), space = true; cout << "\n";}
#define plexit(s) {cout << (s) << "\n"; exit(0);}
#define yes(s) cout << ((s)?"Yes":"No") << "\n";
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using ll = long long; using ull = unsigned long long; using ld = long double;
template<typename T = int> using V = vector<T>; template<typename T = int> using P = pair<T, T>;
using Vi = V<int>; using Vl = V<ll>; using Vd = V<ld>; using VVi = V<Vi>; using VVl = V<Vl>; using Pi = P<int>; using Pl = P<ll>; using Pd = P<ld>;
constexpr ll MOD = 1000000007; constexpr int INF = (1 << 30) - 1; constexpr ll INFL = 1LL << 60; constexpr ld EPS = 1e-12; constexpr ld PI = 3.141592653589793238462643383279;

int main(void) {
  VVi a(3, Vi(3)); rep(i,3) rep(j,3) cin >> a[i][j];
  int n; cin >> n;
  rep(q,n) {
    int b; cin >> b;
    rep(i,3) rep(j,3) {
      if (a[i][j] == b) a[i][j] = -1;
    }
    bool ok = true;
    rep(i,3) if (a[i][0] != -1) ok = false;
    if (ok) plexit("Yes")
    ok = true;
    rep(i,3) if (a[i][1] != -1) ok = false;
    if (ok) plexit("Yes")
    ok = true;
    rep(i,3) if (a[i][2] != -1) ok = false;
    if (ok) plexit("Yes")
    
    ok = true;
    rep(j,3) if (a[0][j] != -1) ok = false;
    if (ok) plexit("Yes")
    ok = true;
    rep(j,3) if (a[1][j] != -1) ok = false;
    if (ok) plexit("Yes")
    ok = true;
    rep(j,3) if (a[2][j] != -1) ok = false;
    if (ok) plexit("Yes")

    ok = true;
    if (a[0][0] != -1 || a[1][1] != -1 || a[2][2] != -1) ok = false;
    if (ok) plexit("Yes")
    ok = true;
    if (a[0][2] != -1 || a[1][1] != -1 || a[2][0] != -1) ok = false;
    if (ok) plexit("Yes")
  }
  pl("No")
  return 0;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define ll long long int
const ll mod=1e9+7;
const int maxn=2e5+50;
using namespace std;
int fact(int n)
{
	int p=1;
	for(int i=1;i<=n;i++)
	{
		p*=i;
	}
	return p;
}
int main()
//int found; found=chaine.find(cara); if (found!=std::string::npos) how to verify if a caracter exists in a chaine
// toupper(caractere) ==> return the majuscule of a caractere
//floor(x) Returns the largest integer smaller than x
//ceil(x) returns  Returns the smallest integer greater
{
	 
   int n;
   cin>>n;
   int mat[n][2];
   for(int i=0;i<n;i++)
   {
   	cin>>mat[i][0]>>mat[i][1];
	} 
	float res=0.0;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			res+=2*fact(n-1)*1.0*sqrt((mat[i][0]*1.0-mat[j][0]*1.0)*(mat[i][0]*1.0-mat[j][0]*1.0)+(mat[i][1]*1.0-mat[j][1]*1.0)*(mat[i][1]*1.0-mat[j][1]*1.0));
            //cout<<res<<endl;		
		}
	}
	float x=res/(fact(n)*1.0);
	printf("%.6f",x/2.0);
    
}



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

using namespace std;
#define ll long long
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(item) cout << (item) << endl;
#define PRINT_VEC(V)                                                           \
    for (auto v : (V))                                                         \
        cout << v << ' ';
const int MOD = 1000000007;
/* cout << fixed << setprecision(10) << decimal << endl; */

int main() {
    /* code */
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    REP(i, N) { cin >> A[i]; }
    sort(A.begin(), A.end(), std::greater<int>());
    double bound = (double)accumulate(A.begin(), A.end(), 0) / (4 * M);
    if (A[M-1] >= bound) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
// F.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <cmath>

using namespace std;

typedef long double LD;
const LD EPS = 1e-8;

struct Point {
	long double x;
	long double y;
	long double z;
	int i;
	bool operator < (const Point& p) const {
		return x < p.x || (x == p.x && y < p.y);
	}
};

long double cross(const Point& O, const Point& A, const Point& B) {
	return (A.x - O.x) * (B.y - O.y) - (A.y - O.y) * (B.x - O.x);
}

vector<Point> convex_hull(vector<Point>& P)
{
	int n = (int)P.size(), k = 0;
	if (n <= 2) {
		return P;
	}
	vector<Point> H(2 * n);
	sort(P.begin(), P.end());
	for (int i = 0; i < n; ++i) {
		while (k >= 2 && cross(H[k - 2], H[k - 1], P[i]) <= 0) k--;
		H[k++] = P[i];
	}
	for (int i = n - 2, t = k + 1; i >= 0; i--) {
		while (k >= t && cross(H[k - 2], H[k - 1], P[i]) <= 0) k--;
		H[k++] = P[i];
	}
	return vector<Point>(H.begin(), H.begin() + k - 1);
}

bool circumscribed_circle(LD x1, LD y1, LD x2, LD y2, LD x3, LD y3, LD& cx, LD& cy, LD& r)
{
	LD ea = x3 - x1;
	LD ca = x2 - x1;
	cy = (ea * (x1 * x1 + y1 * y1 - x2 * x2 - y2 * y2) - ca * (x1 * x1 + y1 * y1 - x3 * x3 - y3 * y3)) /
		(2 * ea * (y1 - y2) - 2 * ca * (y1 - y3));
	if (fabs(ca) <= EPS) {
		cx = (2 * (y1 - y3) * cy - x1 * x1 - y1 * y1 + x3 * x3 + y3 * y3) / (2 * (x3 - x1));
	} else {
		cx = (2 * (y1 - y2) * cy - x1 * x1 - y1 * y1 + x2 * x2 + y2 * y2) / (2 * ca);
	}
	r = sqrt((x1 - cx) * (x1 - cx) + (y1 - cy) * (y1 - cy));
	return true;
}

int main(int argc, char* argv[]) {
	cout.precision(20);
#ifdef _MSC_VER
	while (true)
#endif
	{
		int n = -1;
		cin >> n;
		if (n <= 0) return 0;
		vector<Point> xy(n);
		for (int i = 0; i < n; ++i) {
			cin >> xy[i].x >> xy[i].y;
			xy[i].i = i;
		}
		LD ans = 1e10;
		vector<Point> ch = convex_hull(xy);
		int sz = ch.size();
		for (int i = 0; i < sz; ++i) {
			for (int j = i + 1; j < sz; ++j) {
				LD cx = (ch[i].x + ch[j].x) * 0.5, cy = (ch[i].y + ch[j].y) * 0.5;
				LD dx = ch[i].x - ch[j].x, dy = ch[i].y - ch[j].y;
				LD r = sqrt(dx * dx + dy * dy) * 0.5;
				auto ok = [&](LD cx, LD cy, LD r) {
					for (int l = 0; l < sz; ++l) {
						LD dx = ch[l].x - cx;
						LD dy = ch[l].y - cy;
						if (sqrt(dx * dx + dy * dy) > r) {
							return false;
						}
					}
					return true;
				};
				if (ok(cx, cy, r)) {
					ans = min(ans, r);
				}
			}
		}
		for (int i = 0; i < sz; ++i) {
			for (int j = i + 1; j < sz; ++j) {
				for (int k = j + 1; k < sz; ++k) {
					LD cx, cy, rr;
					if (!circumscribed_circle(ch[i].x, ch[i].y, ch[j].x, ch[j].y, ch[k].x, ch[k].y, cx, cy, rr)) {
						continue;
					}

					bool ok = true;
					for (int l = 0; l < sz; ++l) {
						LD dx = ch[l].x - cx;
						LD dy = ch[l].y - cy;
						if (sqrt(dx * dx + dy * dy) > rr + 0.0001) {
							ok = false;
							break;
						}
					}
					if (ok) {
						ans = min(ans, rr);
					}
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    char c; cin >> c;
    cout << char(c+1) << endl;
    return 0;
}

Measured memory_bytes: 256
import * as fs from "fs"

// 配列を作成して指定された値で初期化する
const createArray = <T>(length: number, initialValue: T): T[] => {
  const ary = []
  for (let i = 0; i < length; i++) {
    ary.push(initialValue)
  }
  return ary
}


const process = (n: number, L: number): string => {
  const a = createArray(n, 0)
  let allT = 0
  for (let i = 0; i < n; i++) {
    allT += L + i
    a[i] = L + i
  }

  const min = a.reduce((a, b) => (Math.abs(a) > Math.abs(b) ? b : a))
  return allT - min + ""

}

const Main = (input: string): string => {
  //const n: number = parseInt(input)

  const a: string[] = input.split(" ")
  const na: number[] = a.map((e) => parseInt(e))

  //const aa: string[][] = input.split("\n").map((e) => e.split(" "))
  //const na0: number[] = aa[0].map((e) => parseInt(e))
  //const [a, b] = na0

  const res = process(na[0], na[1]) + ""
  console.log(res)
  return res
}
Main(fs.readFileSync("/dev/stdin", "utf8"))


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

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

    string ans;
    if (s == "Sunny"){
        ans = "Cloudy";
    }
    else if (s == "Cloudy"){
        ans = "Rainy";
    }
    else if (s == "Rainy"){
        ans = "Sunny";
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;
 
int main(){
    int n,k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector<P>zero;
    int counter = 0;
    int all = 0;
    char prev = '1';
    int index;
  P hoge;
    for(int i = 0;i < n; i++){
        if(s[i] == '0'){
            if(prev == '1'){
                hoge.first = i;
            }
            counter++;
            all++;
          if(i == n-1){
            hoge.second = i;
            zero.push_back(hoge); 
          }
        }
        if(s[i] == '1' && prev == '0'){
            //zero.push_back(counter);
          hoge.second = i-1;
            zero.push_back(hoge); 
        }
        prev = s[i];
 
    }
    //sort(s.begin(),s.end(),greater<int>());
    int ans = -1;
    int basyo = 0;
    int nagasa = zero.size();
    int last = min(k,nagasa);
  //cout << "unchi" << nagasa << endl;
  if(!zero.size()){
    cout << n << endl;
    return 0;
  }
  else{
    for(int i = 0; i < n; i++){
        if(i > zero[basyo].second && basyo < nagasa-1){
            basyo = basyo+1;
        }
      if(i == 6){
        //cout << "ssss"<<basyo << endl;
      }
        if(basyo+k-1 < nagasa-1){
            ans = max(ans,zero[basyo+k].first-i);
            //cout << zero[basyo+k].first-i << endl;
        }
        
        else{
            ans = max(ans,n-i);
            //cout << n-i << endl;
        }
    }
    cout << ans << endl;
  }
  return 0;
}

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

vector<int> dp(1000000, 1);

void f(int x) {
  for (int i = 2; i <= x; i++) {
    for (int j = 0; j <= x; j+=i) {
      dp[j] += 1;
    }
  }
}

int main() {
  int n;
  cin >> n;

  f(n);

  ll ans = 0;
  int l = min(n, 1000000);
  for (int c = l-1; c > 0; c--) {
    ans += dp[n-c];
  }

  cout << ans << endl;

  return 0;
}



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

int main(){
    int a,b,c,d,e,f,g,h,i,j;
    int x = 1000;
    cin >> a >> b >> c >> d >> e;
    f=(a-1)/10*10+10;
    g=(b-1)/10*10+10;
    h=(c-1)/10*10+10;
    i=(d-1)/10*10+10;
    j=(e-1)/10*10+10;
    vector<int> z(5);
    z.at(0)=a+g+h+i+j;
    z.at(1)=b+f+h+i+j;
    z.at(2)=c+g+f+i+j;
    z.at(3)=d+g+h+f+j;
    z.at(4)=e+g+h+i+f;
    for(int i=0;i<5;i++){
    x = min(x,z.at(i));
    }
    cout << x << endl;

    return 0;
    
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <vector>
#include <list>
#include <map>
#include <string>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <utility>
#include <ctgmath>
#include <queue>
#include <set>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;

const ll inf = 10e17;
const ll mod = inf;//1000000007;
const ld eps = 10e-9;



ll solve(void);
ll gcd(ll x, ll y);


ll mulmod(ll x, ll y)
{
	return (x * y) % mod;
}

ll submod(ll x, ll y)
{
	return (x - y + 100 * mod) % mod;
}

ll power(ll n, ll r)
{
	if ( r == 0 ) { return 1; }
	if ( r == 1 ) { return n; }
	if ( n == 0 ) { return 0; }
	if ( n == 1 ) { return 1; }

	if (r % 2 == 0)
	{
		ll y = power(n, r/2);
		return mulmod(y, y);
	}
	else
	{
		ll y = power(n, (r-1)/2);
		return n * mulmod(y, y) % mod;
	}
}

ll gcd(ll x, ll y)
{
	if (y == 1) { return 1;}
	if (x % y == 0) { return y; }
	return gcd(y, x % y);
}

vector<ll> perm;
vector<ll> inv;
void init_inv(ll m)
{
	perm.resize(m);
	inv.resize(m);
	
	perm[0] = 1;
	inv[0] = 1;

	for (ll i = 1; i < m; i++)
	{
		perm[i] = mulmod(perm[i-1], i);
	}
	
	for (ll i = 1; i < m; i++)
	{
		inv[i] = power(perm[i], mod - 2);
	}
}

ll ncr(ll n, ll r)
{
	// n (n-1) ... (n-r)
	if ( r == n || r == 0 ) { return 1; }

	ll ans = 1;
	for (ll i = 0; i < r; i++)
		ans = mulmod(ans, n - i);

	 return mulmod(ans, inv[r]);
	// return mulmod(perm[n], mulmod(inv[n-r], inv[r]));
}

bool binary_check(ll mid, ll key)
{
	return mid >= key;
}

ll binary_search()
{
//	ll ng = 0;
//	ll ok = x;
//
//	while (abs(ok - ng) > 1)
//	{
	//	ll mid = (ok+ng) / 2;
	//	if (binary_check(mid, k)) ok = mid;
	//	else ng = mid;
	//}

	return 0;
	//return ok;
}

ll n, m, q;
vector<ll> a, b, c, d;

// distribute: どのように渡してきたか, cnt: 何個渡したか, target: 渡す相手
ll dfs(vector<ll> dist, ll cnt)
{


	// 差分1, 2, ..., N-1
	// 仕切り：N - 1 - 1,　玉M-1
	if (dist.size() == n)
	{
		vector<ll> v(n);
		v[0] = 1 + dist[0];
		for (ll i = 1; i < n; i++)
		{
			v[i] = v[i-1] + dist[i];
		}

		//cout << "*****" << endl;
		//for (auto d : v)
		//	cout << " " << d;
		//cout << "*****" << endl;

		ll pts = 0;
		for (ll i = 0; i < q; i++)
		{
			if(v[b[i]] - v[a[i]] == c[i]) pts += d[i];
		}
		return pts;
	}

	ll ans = 0;
	for (ll i = 0; i + cnt < m; i++)
	{
		vector<ll> v(dist);
		v.push_back(i);
		ll cand = dfs(v, i + cnt);
		ans = max(ans, cand);
	}
	
	return ans;
}

ll solve(void)
{
	cin >> n >> m >> q;
	a.resize(q);
	b = a;
	c = a;
	d = a;

	for (ll i = 0; i < q; i++) {
		cin >> a[i] >> b[i] >> c[i] >> d[i];
		a[i]--;
		b[i]--;
	}

	cout << dfs(vector<ll>(), 0) << endl;

	return 0;
}

int main(void)
{
	//// 追加２, 以降 cin の入力元が 'input.txt' になる
	//std::ifstream in("in.txt");
	//std::cin.rdbuf(in.rdbuf());
	while (solve())
	{
	}
	return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
const int mod=1e9+7;
#define pb push_back
#define pii pair<ll,ll>
#define pi pair<int ,int> 
#define REP(i,a,n) for(int i=a;i<n;i++)
#define rep(i,a,n) for(int i=a;i>=n;i-- )

int main()

{  
    
    int n;
    cin>>n;
    map<string,int>mp;int maxi=0;
    REP(i,0,n)
    {
        string x;
        cin>>x;
        mp[x]++;
        maxi=max(mp[x],maxi);
    }
    for(auto i=mp.begin();i!=mp.end();i++)
    {
        if(i->second==maxi)
        {
            cout<<i->first<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 25216
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
#define ll long long 
#define rep(i, s, n) for(int i = s; i < n; i++)
ll mod = 1e9+7;

int main() {
    int n, m;
    cin >> n >> m;
    int p = max(n, m);

    ll val_m = 1, val_n = 1;

    if(abs(n-m) > 1) {
        cout << 0 << endl;
        return 0;
    }
    else if(n == m) {
        rep(i, 1, n+1) {
            val_n *= i;
            val_n %= mod;
        }
        cout << 2*val_n*val_n%mod << endl;
    }
    else {
        rep(i, 0, n) {
            val_n *= (i+1);
            val_n %= mod;
        }
        rep(i, 0, m) {
            val_m *= (i+1);
            val_m %= mod;
        }
        cout << val_m * val_n % mod << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){

	int a=0,b=0,c=0,d=0;
	
	int tmp=0;
	int i,j;
	char dummy;
	scanf("%d %d",&(a),&(b));
	scanf("%c",&dummy);
	scanf("%d %d",&(c),&(d));
	
	a-=c;
	b-=d;
	
	printf("%d",a*b);	
	
	return 0;
}

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl

int gcd(int x,int y){
    if(x<y){
        swap(x,y);
    }
    if(x%y==0) return y;
    else return(gcd(y,x%y));
}


int main(){
    int n,X,a;
    cin >> n >> X >> a;
    int ans = abs(X-a);
    REP(i,n-1){
        int x;
        cin >> x;
        ans = gcd(ans,abs(X-x));
    }
    cout << ans << endl;
    return 0;
}   

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#define ll long long
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin>>n;
    cout<<((!(n%2))?n:n*2);
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
from math import ceil

n, k = map(int, input().split())
a = list(map(int, input().split()))


def f(p):
    c = 0
    for x in a:
        c += x // p
    return c


ok, ng = 0, max(a) + 1
while abs(ok - ng) > 3e-6:
    m = (ok + ng) / 2
    if f(m) > k:
        ok = m
    else:
        ng = m
print(ceil(ok))


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

int main()
{
    int n,m,i,j,x,y;
    cin>>n>>m;
    int a[n];
    memset(a,-1,sizeof(a));
    int flag=0;
    for(i=0; i<m; i++)
    {
        cin>>x>>y;
        if(a[x-1]!=-1)
        {
            if(a[x-1]!=y)
            {
                flag=1;
            }
        }
        else
        {
            a[x-1]=y;
        }
    }
    if(flag==1)
        cout<<-1<<endl;
    else
    {
        if(n==1 && a[0]==-1)
            cout<<0<<endl;
        else
        {
            for(i=0; i<n; i++)
            {
                if(a[i]==-1 && i!=0)
                    a[i]=0;
                else if(i==0 && a[i]==-1)
                    a[i]=1;
            }
            if(a[0]==0 && n!=1)
                cout<<-1<<endl;
            else
            {
                for(i=0; i<n; i++)
                    cout<<a[i];
                cout<<endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 100009 /// Still trying to be normal
#define MOD 1000000007
#define F first
#define S second
#define rep(i, a, b) for(ll i = a; i < (b); ++i)
#define per(i, b, a) for(ll i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
using namespace std;
const ll INF = 1e9 + 15;
vector<int> adj[maxn];
void addedge(int a,int b){
    adj[a].push_back(b);
    adj[b].push_back(a);
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin>>n>>m;
    int vet[n+2];
    rep(i,1,n+1){
        cin>>vet[i];
    }
    while(m--){
        int a,b;
        cin>>a>>b;
        addedge(a,b);
    }
    ll ans =0;
    rep(i,1,n+1){
        bool can=true;
        for(auto e: adj[i]){
            if(vet[e]>=vet[i])can=false;
        }
        if(can)ans++;
    }
    cout<<ans<<'\n';
    return 0;   
}

Measured memory_bytes: 9188
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define lim (int) (1e5+5)
using namespace std;
typedef pair<int,int> ii;
typedef string string;
typedef long long int lli;
string s;
int main()
{
	cin>>s;
	for(int i=0;i<s.length()-1;i++)
	{
		if(s[i]=='A' && s[i+1]=='C')
		{
			printf("Yes");
			return 0;
		}
	}
	printf("No");
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;

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

int main(void){
  int n; cin >> n;
  vector<ll> a(n);
  for(int i=0; i<n; ++i) cin >> a[i];
  vector<ll> L(n),R(n);
  L[0] = R[n-1] = 0;
  for(int i=0; i<n-1; ++i){
    L[i+1] = gcd(L[i], a[i]);
    R[n-2-i] = gcd(R[n-1-i], a[n-1-i]);
  }
  ll max = 1;
  for(int i=0; i<n; ++i){
    ll tmp = gcd(L[i],R[i]);
    if( max < tmp) max = tmp;
  }
  cout << max << endl;
  return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 1e5 + 7;
const int Inf = 1 << 30;
const ll INF = 1ll << 60;
ll a, b;
ll ans = 1ll; //1一定满足要求, 初始化自身为一个

int main() {
	cin >> a >> b;
	ll x = __gcd(a, b);
	for(ll i = 2; i <= sqrt(x); i++) {
		if(x % i == 0) ans++;
		while(x % i == 0) { x /= i; }
		if(x == 1) break;
	}
	if(x > 1) ans++; //x为质数
	cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
An = list(map(int,input().split()))
countN = 0
sum = [0]*N
for i, name in enumerate(An):
    if i + name < N:
        sum[i+name] = sum[i+name] + 1
    if i - name >= 0:
        countN = countN + sum[i-name]
print(countN)

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

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define REP(i,n) for(int _n=n, i=0;i<_n;++i)
#define FOR(i,a,b) for(int64_t i=(a),_b=(b);i<=_b;++i)
#define FORD(i,a,b) for(int64_t i=(a),_b=(b);i>=_b;--i)
using ull = uint64_t;
using ll = int64_t;
using PII = pair<int, int>;
using VI = vector<int>;

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A> string to_string(A v) {
bool first = true; string res = "{";
for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); }
res += "}"; return res; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H); debug_out(T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

const ll md = 1000000007;

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> grid(h);
    REP(i, h) cin >> grid[i];
    int ans = 0;
    for (int maskR = 0; maskR < (1 << h); maskR++) {
    	for (int maskC = 0; maskC < (1 << w); maskC++) {
    		int m = 0;
    		for (int i = 0; i < h; i++) {
    			for (int j = 0; j < w; j++) {
    				if (grid[i][j] == '.') continue;
    				if (maskR & (1 << i)) continue;
    				if (maskC & (1 << j)) continue;
    				m++;
    			}
    		}
    		if (m == k) ans++;
    	}
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
long long n,ans;
int main()
{
	cin>>n;
	for(long long i=2;i<=sqrt(n);i++)
	{
		long long x=i;
		while(n%x==0)
		{
			n/=x;
			x*=i;
			ans++;
		}
		while(n%i==0)n/=i;
	}
	if(n!=1)ans++;
	cout<<ans;
}

Measured memory_bytes: 3684
import Control.Applicative( (<$>))
import Control.Monad( replicateM)
import Data.IntSet( empty, insert, intersection, null)
import qualified Data.IntSet as IS

main = do
    [n_, m_] <- map read . words <$> getLine
    let
	pass = do
	    [a,b] <- map read . words <$> getLine
	    return (a,b)

    passes_ <- replicateM m_ pass
    let
	proc oneside nside []		    = (oneside,nside)
	proc oneside nside ((a,b):passes)
	  | b==n_	    = let
				nside' = insert a nside
			    in
				proc oneside nside' passes

	  | 1==a	    = let
				oneside' = insert b oneside
			    in
				proc oneside' nside passes

	  | otherwise	    = proc oneside nside passes
    
	(oneSide, nSide) = proc empty empty passes_

    putStr $ if IS.null $ oneSide `intersection` nSide
		then "IMPOSSIBLE"
		else "POSSIBLE"
	    

Measured memory_bytes: 147836
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>

#define fo(i,j,l) for(int i=j;i<=l;++i)
#define fd(i,j,l) for(int i=j;i>=l;--i)

using namespace std;
typedef long long ll;
const ll N=12e4;

int a,b,c,n;

int main()
{
//	freopen("a.in","r",stdin);
//	freopen("a.out","w",stdout);
	scanf("%d%d%d%d",&a,&b,&c,&n);
	int aa=n/a,bb=n/b,cc=n/c;
	int ans=0;
	fo(i,0,aa)fo(l,0,bb){
		int las=n-i*a-l*b;
		if(las<0)continue;
		if(las%c==0)++ans;
	}
	cout<<ans;
}

Measured memory_bytes: 256
func readInts() -> [Int]{
    return readLine()!.split(separator: " ").map{Int($0)!};
}
let R1 = readInts()
let R2 = readLine()!
let N = R1[0], K = R1[1], C = R1[2], s = R2
var lastI=1000000000, count = 0;
var dp1: Array<Int> = Array(repeating: 0, count: N + 10)
var dp2: Array<Int> = Array(repeating: 0, count: N + 10)
var S: Array<Character> = Array(repeating: "0", count: N + 10)
for i in s {
    S[count] = i
    count += 1
}
for i in 0 ..< N {
    if lastI - (N - i - 1) > C && S[N - i - 1] == "o" {
        lastI = N - i - 1
        dp1[N - i - 1] = dp1[N - i] + 1
    }
    else {
        dp1[N - i - 1] = dp1[N - i]
    }
}
lastI = -1000000000;
for i in 0 ..< N {
    if i - lastI > C && S[i] == "o" {
        lastI = i
        if i == 0 {
            dp2[i] = 1
        }
        else {
            dp2[i] = dp2[i - 1] + 1
        }
    }
    else{
        dp2[i] = dp2[i - 1]
    }
}
for i in 0 ..< N {
    if i == 0 {
        if dp1[i + 1] < K {
            print(i + 1)
        }
    }
    else if i == N - 1 {
        if dp2[i - 1] < K {
            print(i + 1)
        }
    }
    else {
        if dp1[i + 1] + dp2[i - 1] < K {
            print(i + 1)
        }
    }
}

Measured memory_bytes: 14860
#include<bits/stdc++.h>
using namespace std;
int main()
{
  ios_base::sync_with_stdio(false);
  long long int sum = 0 , a[100002] , b[100002] , ne;
  int n , i;
  cin >> n;
  for(i=0;i<n;i++)
    cin >> a[i] >> b[i];
  for(i=n-1;i>=0;i--)
  {
    a[i] = a[i] + sum;
    if(a[i]%b[i])
    {
      ne = b[i]*(a[i]/b[i] + 1);
      sum = sum + ne - a[i];
      a[i] = ne;
    }
  }
  cout << sum << "\n";
  return 0;
}


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

using namespace std;

#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

ll modpow(ll a, ll b){

    ll ans=1;
    while(b){
        if(b&1){
            ans=(ans*a)%mod;
        }
        a=(a*a)%mod;
        b=b/2;
    }
    return ans;
}

ll solve(ll health) {
    if(health == 1) return 1;

    ll ans = 1 + 2*solve(health/2);

    return ans;
}


int main(){

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

    ll h;
    cin>>h;

    cout<<solve(h)<<endl;
    return 0;

}


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

map<int,int>mp;
const int N=200100;
int n,fa[N],a[N],b[N],c[N],d[N],cnt,ans;
int find(int x){return fa[x]==x?x:fa[x]=find(fa[x]);}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;++i)cin>>a[i],a[0]^=a[i];
	for(int i=1;i<=n;++i)cin>>b[i],b[0]^=b[i];
	for(int i=0;i<=n;++i)c[i]=a[i],d[i]=b[i];
	sort(c,c+n+1);sort(d,d+n+1);
	for(int i=0;i<=n;++i)if(c[i]!=d[i]){
		cout<<-1<<'\n';
		return 0;
	}
	if(!mp.count(a[0]))mp[a[0]]=++cnt,fa[cnt]=cnt;
	for(int i=1;i<=n;++i)
		if(a[i]!=b[i]){
			if(!mp.count(a[i]))mp[a[i]]=++cnt,fa[cnt]=cnt;
			if(!mp.count(b[i]))mp[b[i]]=++cnt,fa[cnt]=cnt;
			int u=mp[a[i]],v=mp[b[i]];
			fa[find(u)]=find(v);
			++ans;
		}
	for(int i=1;i<=cnt;++i)ans+=fa[i]==i;
	cout<<(ans-1)<<'\n';
	return 0;
}


Measured memory_bytes: 8448
#include <iostream>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;
const int MAXN = 202000 ;
int a[MAXN], n;
int main()
{
	cin >> n;
	for (int i = 1; i <= n; ++i) cin >> a[i];
	for (int i = 1; i <= n; ++i)
		if (i != n) cout << a[i] << " " ;
		else cout << a[i] << endl;
	for (int i = 2; i <= n; ++i)
	{
		int key = a[i];
		int j = i - 1;
		while (j >= 0 && a[j] > key)
		{
			a[j + 1] = a[j];
			j --;
		}
		a[j + 1] = key;
		for (int k = 1; k <= n; ++k) 
			if (k != n) cout << a[k] << " ";
			else cout << a[k] << endl;
	}
	return 0;
}



Measured memory_bytes: 3092
#include <stdio.h>
#include <string.h>

int main(void)
{
	char str[1001];
	int i;
	
	gets(str);
	
	for (i = 0; str[i] != '\0'; i++){
		if (strncmp(&str[i], "apple", 5) == 0){
			strncpy(&str[i], "peach", 5);
		}
		else if (strncmp(&str[i], "peach", 5) == 0){
			strncpy(&str[i], "apple", 5);
		}
	}
	
	printf("%s\n", str);
	
	return (0);
}

Measured memory_bytes: 524
//#pragma comment(linker, "/stack:200000000")
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

 
using namespace __gnu_pbds;
using namespace std;
 
template <typename T>
using ordered_set =
	tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define un(x) x.erase(unique(ALL(x)),x.end())
#define REP(i,x,v)for(int i=x;i<=v;i++)
#define REPD(i,x,v)for(int i=x;i>=v;i--)
#define FOR(i,v)for(int i=0;i<v;i++)
 
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
const int MOD=1e9+7;//998244353;

	
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);
	cout << fixed << setprecision(11);
	cerr << fixed << setprecision(6);
	string s;cin>>s;
	FOR(i,SZ(s)) cout<<"x";
	cout<<endl;


    return 0;
}










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

void permutation(vector<int> vec, vector<pair<int,int>>datas) {

    int count = 0;
    double sum = 0;
    do {
        for(int i=0; i<vec.size()-1; i++) {
            sum += sqrt(pow((datas[vec[i]].first - datas[vec[i+1]].first), 2) + pow((datas[vec[i]].second - datas[vec[i+1]].second), 2));
        }
        count++;
//        cout << sum << endl;
    } while(next_permutation(vec.begin(), vec.end()));

    printf("%.10lf\n", sum/count);

    return;
}

int main(void){

    int n;
    cin >> n;
    
    vector<pair<int,int>> datas(n);
    vector<int> city(n);
    
    for(int i=0; i<n; i++) {
        int x, y;
        cin >> x >> y;
        pair<int, int> temp;
        temp.first = x;
        temp.second = y;
        datas[i] = temp;
        city[i] = i;
    }
    
    permutation(city, datas);
    

    return 0;    
}


Measured memory_bytes: 256
import heapq
K,T=map(int,input().split(' '))
A=[[-i,n] for n,i in enumerate(list(map(int,input().split(' '))))]
heapq.heapify(A)
A_max = heapq.heappop(A)
today = A_max[1]
if A_max[0]<-1:
    heapq.heappush(A,[A_max[0]+1,today])
while len(A)>1:
    a=heapq.heappop(A)
    b=heapq.heappop(A)
    if today!=a[1]:
        today = a[1]
        a[0] += 1
    else:
        today = b[1]
        b[0] += 1
    if a[0]<0:
        heapq.heappush(A,a)
    if b[0]<0:
        heapq.heappush(A,b)
if today != A[0][1]:
    print(-A[0][0]-1)
else:
    print(-A[0][0])


Measured memory_bytes: 3064
#include<iostream>
#include <stdio.h>
using namespace std;

int main(){
    int n;
    int b,f,r,v;
    string m="####################";
    int num[4][3][10];
    int i,j,k;
    
    for (i = 0; i < 4; i++){
        for (j = 0; j < 3; j++){
            for (k = 0; k < 10; k++){
                num[i][j][k]=0;
            }
        }
    }

    cin >> n;
    for (i = 0; i < n;i++){
        cin >> b >> f >> r >> v;
        num[b-1][f-1][r-1]=num[b-1][f-1][r-1] + v;
    }
    
    for (i = 0; i < 4; i++){
        for (j = 0; j < 3; j++){
            for (k = 0; k < 10; k++){
                if (k==9){
                    cout << " " << num[i][j][k] << endl;
                }else{
                    cout << " " <<  num[i][j][k];
                }
            }
        }
        if(i!=3)cout << m << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3188
import sys
input = sys.stdin.readline
h,n = map(int,input().split())
A = [list(map(int,input().split())) for i in range(n)]

D = [float("inf")] * (h+10**4+3)
D[0] = 0
for j in range(n):
    for i in range(len(D)):
        D[i] = min(D[i],D[i-A[j][0]] + A[j][1])
    # print(D[:20])
# print(D[:20])
print(min(D[h:]))

# a = float("inf")
# for i in range(n):
#     for j in range(n):
#         for k in range(h//A[i][0]+1):
#             b = A[i][1] * k + A[j][1] * max(0,-((-h+k*A[i][0])//A[j][0]))
#             a = min(a,b)
#             print(A[i][1] , k , A[j][1] , max(0,-((-h+k*A[i][0])//A[j][0])))
#             print(i,j,k,a)
        
# print(a)

# for i in range(n):
#     A[i].append(A[i][0]/ A[i][1])
# A.sort(reverse=True)
# A.sort(key=lambda x:x[2], reverse=True)
# print(A)
# a = 0
# while h > 0:
#     i=0
#     k = h//A[i][0]
#     h -= k * A[i][0]
#     a += k * A[i][1]
#     print(h)
#     if h > 0:
#         for i in range(n):
#             A[i][0] = min(A[i][0], h)
#             A[i][2] = A[i][0] / A[i][1]
#         A.sort(reverse=True)
#         A.sort(key=lambda x:x[2], reverse=True)
#     print(A)
# print(a)


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

int main() {
    int H, W;
    cin >> H >> W;
    vector<string> a(H);
    for (int i = 0; i < H; i++) {
        cin >> a[i];
    }
    bool h[H]={false}, w[W]={false};
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (a[i][j] == '#') {
                h[i] = w[j] = true;
            }
        }
    }

    for (int i = 0; i < H; i++) {
        bool check = false;
        for (int j = 0; j < W; j++) {
            if (h[i] && w[j]){
                cout << a[i][j];
                check = true;
            }
        }
        if (check) cout << endl;
    }
}

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

void slove(int n){
    vector<vector<bool>> m;
    vector<bool> tmp(21,true);
    for(int i=0;i<21;i++){
        m.push_back(tmp);
    }
    int a,b,x=10,y=10;
    char c;
    for(int i=0;i<n;i++){
        cin>>a>>b;
        m[b][a]=false;
    }
    m[10][10]=true;
    cin>>n;
    for(int i=0;i<n;i++){
        cin >> c >> a;
        if(c=='E'){
            for(int j=0;j<a;j++){
                m[y][x+j+1]=true;
            }
            x+=a;
        }
        if(c=='W'){
            for(int j=0;j<a;j++){
                m[y][x-j-1]=true;
            }
            x-=a;
        }
        if(c=='N'){
            for(int j=0;j<a;j++){
                m[y+j+1][x]=true;
            }
            y+=a;
        }
        if(c=='S'){
            for(int j=0;j<a;j++){
                m[y-j-1][x]=true;
            }
            y-=a;
        }
    }

    for(int i=0;i<=20;i++){
        for(int j=0;j<=20;j++){
            if(!m[i][j]){
                cout<<"No"<<endl;
                return;
            }
        }
    }
    cout<<"Yes"<<endl;
    return;
}

int main(void){
    int n;
    while(cin>>n,n){
        slove(n);
    }
}

Measured memory_bytes: 3084
ccc = int(input())
aaa = list(map(int,input().split()))
           
def hantei(xxx):
    count = 0
    while True:
        for i in range(len(xxx)):
            if xxx[i]% 2 != 0:
                return count
            else:
                xxx[i] = xxx[i] // 2
        count += 1
print(hantei(aaa))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
  string a,b,c;
  cin>>a>>b>>c;
  cout<<(char)(a[0]-'a'+'A')<<(char)(b[0]-'a'+'A')<<(char)(c[0]-'a'+'A')<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
    int b1,b2,b3;
    cin>>b1>>b2>>b3;
    string ans="Close";
    if((b1==0&&b2==0&&b3==1)||(b1==1&&b2==1)) ans="Open";
    cout<<ans<<endl;
}

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

int main(){
    int n;
    cin>>n;
    long double arr[n];
    
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }

    long double **dp=new long double*[n+1];
    for(int i=0;i<=n;i++){
        dp[i]=new long double[n+1];
    }

    dp[0][0]=1;
    for(int i=1;i<=n;i++)    dp[0][i]=0;

    for(int i=1;i<=n;i++){
        for(int j=0;j<=n;j++){
            if(j==0)    dp[i][j]=(1-arr[i-1])*dp[i-1][j];
            else{
                dp[i][j]=(arr[i-1])*dp[i-1][j-1]+(1-arr[i-1])*dp[i-1][j];
            }
        }
    }
    long double sum=0.0;
    for(int i=n/2+1;i<=n;i++)   sum+=dp[n][i];
    cout<<setprecision(10)<<sum;
    return 0;
}

Measured memory_bytes: 141056
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define vii vector<int,int>
#define Sort(v) sort(v.begin(),v.end())

const int MOD = 1000000007;
const int INF = 1<<30;
using namespace std;

bool judge(int x,int y){
    int a = y;
    while(x > a){
        a *= y;
    }
    return x == a;
}


int main(){
    
    int x;
    cin >> x;
    
    int ans = 1;
    for(int i=x ; i>=0 ; i--){
        for(int j=2 ; j*j<x ; j++){
            if(judge(i,j)) {
                ans = i;
                break;
            }
        }
        if(ans != 1) break;
    }
    
    cout << ans << endl;
}








Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
#define mp  std::make_pair
#define ll long long int
#define abs(n) ((n>0)?(n):((n)*(-1)))
#define CEIL(a,b) (((a) + ((b)-1)) / (b))
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define VREP_ll(v) for(std::vector<ll>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VREP_int(v) for(std::vector<int>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VALL(v) ((v).begin(),(v).end())
#define errln(v) cerr << (v) << endl;
#define println(v) cout << (v) << endl;

int main(int argc, const char * argv[]) {
	int n, m, penalty=0;
	cin >> n >> m;
	bool ac[n];
	int penalty_each[n];
	REP(i,n){ ac[i]=false; penalty_each[i]=0;}
	int p;
	string s;
	REP(i,m){
		cin >> p >> s;
		if(!ac[p-1] && s=="WA"){
			penalty_each[p-1]++;
		}else if(!ac[p-1] && s=="AC"){
			ac[p-1]=true;
		}
	}
	int ac_cnt=0;
	REP(i,n){
		if(ac[i]){
			ac_cnt++;
			penalty += penalty_each[i];
		}
	}
	printf("%d %d",ac_cnt, penalty);
	return 0;
}


Measured memory_bytes: 768
n=int(input())
x=list(map(int,input().split()))
x.sort()
ans=float("Inf")
for i in range(x[0],x[n-1]+1):
  temp=i
  cal=0
  for j in range(0,n):
    cal=cal+(x[j]-temp)**2
  ans=min(ans,cal)
print(ans)

Measured memory_bytes: 3060
def dec2bin(n, base=10):
    s=""
    x="01"
    while n>0:
        s+=x[n%2]
        n/=2
    return (s+"0"*base)[:base]

while True:
    try:
        tmp = dec2bin(input())
    except:
        break
    weight = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
    s=[]
    for i in range(len(tmp)):
        if tmp[i]=="1":
            s.append(weight[i])

    for e in s:
        print e,
    print

Measured memory_bytes: 4224
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) ((int)(x).size())
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

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

    vint sum(N+1);
    REP(i,N){
        sum[i+1]=sum[i]+(s[i]=='.');
    }
    
    int ans=N;
    REP(i,N+1){
        int l=i-sum[i];
        int r=sum[N]-sum[i];
        ans=min(ans,l+r);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 2180
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
#include <iterator>
#include <functional>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <fstream>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <list>
#include <sstream>
#include <complex>
#include <stdio.h>
#include <unordered_set>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

typedef double LD;
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LD, LD> PDD;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<char> VCH;
typedef vector<LD> VLD;
typedef vector<string> VS;
typedef vector<VS> VSS;
typedef vector<VI> VVI;
typedef vector<VLL> VVLL;
typedef vector<VCH> VVCH;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<PDD> VPDD;
#define MP make_pair
#define PB push_back
#define X first
#define Y second
#define next fake_next
#define prev fake_prev
#define left fake_left
#define right fake_right

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, t) FOR(i,0,t)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())

const LD PI = acos(-1.0);
const LL mod = 1000000007;
const LL INF = 1e6;
const LL LINF = 1e12;
const LL MAXN = 500;
const LD EPS = 1e-6;

LL dist(PLL a, PLL b)
{
	return abs(a.X - b.X) + abs(a.Y - b.Y);
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	//freopen("In.txt", "w", stdout);

	int n;
	cin >> n;
	
	vector<pair<LL, PLL>> a(n);
	FOR(i, 0, n)
		cin >> a[i].X >> a[i].Y.X >> a[i].Y.Y;

	sort(ALL(a));
	PLL curr = MP(0, 0);
	int tm = 0;
	int del;
	FOR(i, 0, n)
	{
		del = a[i].X - tm;
		
		if (del < dist(a[i].Y, curr))
		{
			cout << "No";
			return 0;
		}

		if ((-dist(a[i].Y, curr) + del) & 1)
		{
			cout << "No";
			return 0;
		}

		curr = a[i].Y;
		tm = a[i].X;
	}


	cout << "Yes";
	return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
 
#define MOD (long long int)(1e9+7)
#define ll long long int


int main(void){
	string s;
	cin>>s;
	cout<<s[0]<<s.size()-2<<s[s.size()-1]<<endl;
	return 0;	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  
  string ret;
  if (a == b && b == c) {
    ret = "Yes";
  } else {
    ret = "No";
  }
  cout << ret << endl; 
}


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

using namespace std;

const int MAX = 1e4;
 
bool p[MAX];
vector<int> prime;
int n,sum[MAX+1];
 
void is_prime(){
    fill(p,p+MAX,true);
    p[0] = p[1] = false;
 
    for(int i = 2 ; i*i <= MAX ; i++){
	if(p[i]){
	    for(int j = i*i ; j <= MAX ; j += i){
		p[j] = false;
	    }
	}
    }
}
 
void init(){
    is_prime();
    for(int i = 0 ; i < MAX ; i++){
	if(p[i]) prime.push_back(i);
    }
}
 
void solve(){
    int sum = 0 ,cnt = 0 ,t = 0;
    for(int i = 0 ; i < prime.size() ; i++){
	sum += prime[i];
	if(sum == n) cnt++;   
	while(sum >= n){
	    sum -= prime[t++];
	    if(sum == n) cnt++;   
	}
    }
    cout << cnt << endl;
}
 
int main(){
    init();
    while(cin >> n ,n){
	solve();
    }
    return 0;
}

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

int main() {
  int P,Q,R;
  cin >> P >> Q >> R;

  if (Q>R && R>P) {
    cout << P+R << endl;
  }


  if (R>P && P>Q ) {
    cout << P+Q << endl;
  }

  if (P>Q && Q>R) {
    cout << R+Q << endl;
  }
  
  
  if (Q>P && P>R) {
    cout << P+R << endl;
  }
  if (R>Q && Q>P) {
    cout << P+Q << endl;
  }
  if (P>R && R>Q) {
    cout << Q+R << endl;
  }
  
  if (Q==R && R==P && P==Q) {
    cout << P+R << endl;
  }
  
   if (Q==R && R>P) {
    cout << P+R << endl;
  }
  
   if (Q>R && R==P) {
    cout << P+R << endl;
  }
  
  if (P==R && R>Q) {
    cout << R+Q << endl;
  }
  
   if (P>R && R==Q) {
    cout << R+Q << endl;
  }
  
  if (P==Q && Q>R) {
    cout << Q+R << endl;
  }
  
   if (R>Q && Q==P) {
    cout << Q+P << endl;
  }
}


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

using namespace std;

typedef long long ll;
typedef pair<int,int> p;


int main()
{
  int x, a, b;
  cin >> x >> a >> b;
  if (abs(x-a) < abs(x-b)) {
    cout << "A" << endl;
  }else{
    cout << "B" << endl;
  }
  return 0;
}


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

int main() {
    ll ans, n,h ;
    ans = 0;
    cin >> h >> n;
    vector<vector<int>> v(n,vector<int>(2));
    int minB = 1e5;
    int minId;
    rep(i, n) {
        cin >> v[i][0] >> v[i][1];
        if (v[i][1] < minB) {
            minB = v[i][1];
            minId = i;
        }
    }
    //cout << minId << ',' << minB << endl;
    vector<int> y(h + 1, v[minId][1]);
    y[0] = 0;
    for (int i = v[minId][0] + 1; i <= h; i++) {
        int m = 1e8;
        bool f = true;
        rep(j, n){
            f = false;
            if (i - v[j][0] >= 0) {
                m = min(m, y[i - v[j][0]] + v[j][1]);
            }else {
                m = min(m, v[j][1]);
            }
        }
        if (f) {
            m = 0;
        }
        y[i] = m;
    }
    

    cout << y[h] << endl;
    return 0;
}



Measured memory_bytes: 3732
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <sstream>
#include <set>
#include <map>
#define LLMAX 9223372036854775807

using namespace std;
using ll = long long;

int main() {
	ll argH, argW;
	cin >> argH >> argW;

	vector<string> argS(argH);
	for (ll i = 0; i < argH; ++i) {
		cin >> argS.at(i);
	}

	for (ll i = 0; i < argH; ++i) {
		for (ll j = 0; j < argW; ++j) {
			if (argS.at(i).at(j) == '.') {
				continue;
			}

			bool flag = false;
			if (i - 1 >= 0) {
				if (argS.at(i - 1).at(j) == '#'){
					flag |= true;
				}
			}
			if (i + 1 < argH) {
				if (argS.at(i + 1).at(j) == '#'){
					flag |= true;
				}
			}
			if (j - 1 >= 0) {
				if (argS.at(i).at(j - 1) == '#'){
					flag |= true;
				}
			}
			if (j + 1 < argW) {
				if (argS.at(i).at(j + 1) == '#'){
					flag |= true;
				}
			}

			if (!flag) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
}

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


int n,m;
const char vec[4]={'N','E','W','S'};
const int   dx[4]={ 0 , 1 ,-1 , 0 };
const int   dy[4]={ 1 , 0 , 0 , -1};
int gx[20],gy[20];
char v; int vn;

int main()
{
	while(cin>>n,n)
	{
		for(int i=0;i<n;i++)
		{
			cin>>gx[i]>>gy[i];
		}

		cin>>m;
		int sx=10,sy=10,gnum=0;
		bool flag[20]; memset(flag,false,sizeof flag);
		for(int i=0;i<m;i++)
		{
			cin>>v>>vn;
			int cnt;
			for(int j=0;j<4;j++)
			{
				if(vec[j]==v) {cnt=j; break;}
			}

			while(vn--)
			{
				sx+=dx[cnt];sy+=dy[cnt];
				for(int j=0;j<n;j++)
				{
					if(sx==gx[j]&&sy==gy[j]&&!flag[j])
					{
						gnum++;
						flag[j]=true;
					}
				}
			}
		}
		cout<<(gnum==n?"Yes":"No")<<endl;
	}
	return 0;
}

Measured memory_bytes: 1152