akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  string S;
  cin >> N >> S;
  int count = 0;
  
  for(int i=0;i<N-2;i++){
    if(S.at(i)=='A'){
      if(S.at(i+1)=='B'){
        if(S.at(i+2)=='C'){
          count++;
        }
      }
    }
  }
  cout << count << endl;
}




Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int N, K;
  cin >> N >> K;

  vector<int> A(N);
  REP(i, N) cin >> A[i];

  vector<int> L(N+1), R(N+1), M(N+1);
  REP(i, N) L[i+1] += L[i]+(A[i]>0? A[i]: 0);
  RREP(i, N) R[i] += R[i+1]+(A[i]>0? A[i]: 0);
  REP(i, N) M[i+1] += M[i]+A[i];

  int ans = 0;
  REP(i, N-K+1){
    chmax(ans, L[i]+max(0ll, M[i+K]-M[i])+R[i+K]);
  }

  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 3456
/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
const int MOD = (int)1e9 + 7;
const int INF = 1LL << 60;
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; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
template <typename T>
ostream& operator<<(ostream& os, vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, pair<T,T> &P){
os << P.first;
os << " ";
os << P.second;
os << "\n";
return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
     os<<endl;
    return os;
}
int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
//fixed<<setprecision(10)<<ans<<endl;
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M;
    cin >> N >> M;
    cout << gcd(N,M) << endl;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;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--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

ll dp[405][405];

ll rec(int l, int r, vector<ll> &B) {
    if (l == r - 1) return 0;
    if (dp[l][r] != 0) return dp[l][r];
    ll ans = INF;
    rep2(i, l + 1, r) {
        ans = min(ans, rec(l, i, B) + rec(i, r, B) + B[r] - B[l]);
    }
    dp[l][r] = ans;
    return ans;
}

void Main() {
    int N;
    cin >> N;
    vector<ll> A(N), B(N + 1, 0);
    rep(i, N) cin >> A[i];
    rep(i, N) {
        B[i + 1] += B[i] + A[i];
    }
    cout << rec(0, N, B) << '\n';
}

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


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int a[100010];
int main(){
    int n, q;
    string s;
    while(cin>>s>>q){
    	n=s.size();
        ll ans=0;
        int x, f;
        bool l=0;
        char c[111];
        deque<char> v;
        for(int i=0; i<n; ++i){
        	v.push_back(s[i]);
        }
        for(int i=0; i<q; ++i){
            scanf("%d",&x);
            if(x==1){
            	l=!l;
            }
            else{
            	scanf("%d%s",&f,c);
            	if(l){
            		if(f==1){
            			v.push_back(c[0]);
            		}
            		else{
            			v.push_front(c[0]);
            		}
            	}
            	else{
            		if(f==2){
            			v.push_back(c[0]);
            		}
            		else{
            			v.push_front(c[0]);
            		}
            	}
            }
        }
        if(l){
        	reverse(v.begin(), v.end());
        }
        for(auto it:v){
        	printf("%c",it);
        }
        cout<<endl;
    }
  return 0;
}




Measured memory_bytes: 1024
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import           Data.List (inits, tails)
import qualified Data.Set  as S

main :: IO ()
main = do
  s <- getLine
  k <- readLn
  putStrLn $ solve s k

solve :: String -> Int -> String
solve s k = ts !! (k - 1) where
 ts = S.toList . S.fromList $ subLists k s

-- from submit #2530333
subLists :: Int -> [a] -> [[a]]
subLists k = concatMap (take k . tail . inits) . init . tails


Measured memory_bytes: 4348
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>

const long INF = (1l << 30);
const long LINF = (1l << 60);

long a, b, c;
int main(){
    scanf("%ld%ld%ld", &a, &b, &c);
    printf("%ld\n", std::max(0l, c-(a-b)));
}


Measured memory_bytes: 256
import bisect
n, q = map(int, input().split())
s = input()
li = []

for i in range(n-1):
    if s[i]=="A" and s[i+1]=="C":
        li.append(i)

ans = []
num = 0

for i in range(q):
    l, r = map(int, input().split())
    num = bisect.bisect_right(li, r-2)-bisect.bisect_left(li, l-1)
    ans.append(num)

for i in ans:
    print(i)

Measured memory_bytes: 9912
//
#if 0

#endif // 0
#include<iostream>
#define MAX 1010
using namespace std;
int l[MAX][MAX];

int main()
{
    int num;
    cin>>num;       // int l[MAX][MAX];

    for(int i=0;i<num;i++)
    {
        string s1,s2;
        cin>>s1>>s2;
        //int l[MAX][MAX];
        for(int m=0;m<=s1.size();m++)
            for(int n=0;n<=s2.size();n++)
            {
                if(m<=0||n<=0)
                    l[m][n]=0;
                else if(s1[m-1]==s2[n-1])
                    l[m][n]=l[m-1][n-1]+1;
                else
                    l[m][n]=max(l[m][n-1],l[m-1][n]);
            }
        cout<<l[s1.size()][s2.size()]<<endl;
    }
    return 0;
}



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

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

    int count_0 = 0, count_1 = 0;
    rep(i, s.size()){
        if(s[i] == '0')
            count_0++;
        else
            count_1++;
    }
    cout << min(count_0, count_1) * 2 << endl;
    return 0;
}


Measured memory_bytes: 512
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

a,b = ls()
num = int(a+b)

ans = False

for i in range(1000):
    if num == i*i:
        ans = True
        
if ans:
    print("Yes")
else:
    print("No")

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

int main(){
  int H, W, h, w;
  cin >> H >> W;
  cin >> h >> w;
  
  int white_num=0;
  
  white_num = H*W - (h*W + H*w - h*w);
  
  cout << white_num << endl;

  return 0;
}

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

int main(){
  int x;
  cin >>x;
  if(x<1200) cout << "ABC" << endl;
  else cout << "ARC" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
using namespace std;
typedef long long ll;

int main(){
    int n,t;cin>>n>>t;
    int wow=1001;
    for(int i=0;i<n;i++){
        int a,b;cin>>a>>b;
        if(b<=t)wow=min(wow,a);
    }
    if(wow==1001)cout<<"TLE";
    else cout<<wow;
}


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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

using namespace std;
using ll = long long;
using pii = pair<int, int>;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1, 0};

int mod_pow(int x, int y){
    if(y < 0) y = MOD + y - 1;
    ll tmp = x, ret = 1;
    while(y){
        if(y & 1){
            ret *= tmp;
            ret %= MOD;
        }
        tmp = tmp * tmp % MOD;
        y >>= 1;
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    string s;
    cin >> s;
    int n = s.size();
    vector<int> a(n+1), c(n+1), q(n+1);
    for(int i = 0; i < n; ++i){
        a[i+1] = a[i] + (s[i] == 'A');
        c[i+1] = c[i] + (s[i] == 'C');
        q[i+1] = q[i] + (s[i] == '?');
    }
    ll ans = 0;
    int mp0 = mod_pow(3, q[n]), mp1 = mod_pow(3, q[n] - 1), mp2 = mod_pow(3, q[n] - 2), mp3 = mod_pow(3, q[n] - 3);
    for(int i = 0; i < n; ++i){
        if(s[i] == 'B'){
            ll tmp = (ll)a[i] * (c[n]-c[i+1]) % MOD;
            ans += tmp * mp0 % MOD;
            ans %= MOD;
            tmp = (ll)q[i] * (c[n]-c[i+1]) % MOD;
            ans += tmp * mp1 % MOD;
            ans %= MOD;
            tmp = (ll)a[i] * (q[n]-q[i+1]) % MOD;
            ans += tmp * mp1 % MOD;
            ans %= MOD;
            tmp = (ll)q[i] * (q[n]-q[i+1]) % MOD;
            ans += tmp * mp2 % MOD;
            ans %= MOD;
        }
        if(s[i] == '?'){
            ll tmp = (ll)a[i] * (c[n]-c[i+1]) % MOD;
            ans += tmp * mp1 % MOD;
            ans %= MOD;
            tmp = (ll)q[i] * (c[n]-c[i+1]) % MOD;
            ans += tmp * mp2 % MOD;
            ans %= MOD;
            tmp = (ll)a[i] * (q[n]-q[i+1]) % MOD;
            ans += tmp * mp2 % MOD;
            ans %= MOD;
            tmp = (ll)q[i] * (q[n]-q[i+1]) % MOD;
            ans += tmp * mp3 % MOD;
            ans %= MOD;
        }
    }
    cout << ans << "\n";
    return 0;
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';
#define N 1000000007 // prime modulo value 

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e9 + 7;


// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, k, p, m, y;
string s, t;
ld w;
ll a, b;

ll c[11][11];

// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> n >> m;
	cout<<2*m - n;
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}

Measured memory_bytes: 3628
fun main(args: Array<String>) {
    val (a, b, c) = readLine()!!.split(' ').map(String::toInt)
    val t = gcd(a, b)
    val ret = (a % b - c) % t == 0
    print(if (ret) "YES" else "NO")

}

tailrec fun gcd(a : Int, b: Int): Int {
    if(a == 0) return b
    if(b == 0) return a
    if(a > b) return gcd(a%b, b)
    return gcd(b%a, a)
}

Measured memory_bytes: 36516
module app;

import core.bitop;

import std.algorithm;
import std.array;
import std.bigint;
import std.conv;
import std.stdio;
import std.string;

struct Input
{
	string s;
}

void parseInput(T)(out Input input, T file)
{
	with (file) with (input)
	{
		s = readln().strip();
	}
}

struct Output
{
}

auto main2(Input* input)
{
    foreach (c; input.s)
        write("x");
}

void main()
{
	Input input = void;
	parseInput(input, stdin);
	main2(&input);
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
	string s,t;
	int N,x;
	for(cin>>N;N--;){cin>>t,s+=t;}
	char buf[9];
	const char *p=s.c_str();
	for(x=0;;x++){
		sprintf(buf,"%d",x);
		if(!strstr(p,buf)){puts(buf);return 0;}
	}
}

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

/* メモリ食い過ぎ注意 */
#define int long long

typedef long long ll;

int euclid(int a, int b)
{
    if (a < b)
        euclid(b, a);
    if (b == 0)
        return a;
    int r;
    while ((r = a % b))
    {
        a = b;
        b = r;
    }
    return b;
}

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

signed main()
{
    int a, b, c, x, cnt = 0;
    cin >> a >> b >> c >> x;

    for (int i = 0; i <= a; i++)
    {
        for (int j = 0; j <= b; j++)
        {
            for (int k = 0; k <= c; k++)
            {
                if (500 * i + j * 100 + k * 50 == x)
                    cnt++;
            }
        }
    }
    cout << cnt << endl;
}


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

int main() {
	string S;
	cin >> S;
	int count = 0;
	for(int i = 0;i < 4;i++){
		if(S[i] == '+'){
			count++;
		}
		else{
			count--;
		}
    }
cout << count << endl;

}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    string s;
    int A,B;
    cin >> A >> s >> B;
    int c = 0;

    if (s=="+"){
      c=A+B;
    }else if (s=="-"){
      c=A-B;
    }

    cout << c << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
#define BITBOOL(x,a) (((x)>>(a))&1)
int main(){
  string s; string ss[3];
  ss[0] =  "Sunny";
  ss[1] =  "Cloudy";
  ss[2] =  "Rainy";
  cin >> s;
  if(s==ss[0]) cout << ss[1];
  if(s==ss[1]) cout << ss[2];
  if(s==ss[2]) cout << ss[0];
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count etc.
#include <cstdlib>	// require abs
#include <cstdio>	// require printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require sqrt ceil floor
#include <climits>	// require INT_MAX etc
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>	// require tolower, toupper
#include <stdint.h>	// require uint64_t
#include <fstream>	// require freopen

using namespace std;

int main()
{
//	cut here before submit 
//	freopen ("testcase.nexttrip", "r", stdin );
	string str = "";
	while (getline (cin, str ) && str != "0" ){
		int l;
		stringstream ssl (str );
		ssl >> l;
		int sum = 0;
		int res = -1;
		bool found = false;
		for (int i = 0; i < 12; ++i ){
			int n, m;
			getline (cin, str );
			stringstream ss (str );
			ss >> n >> m;
			sum += (n - m );
			if (sum >= l && !found ){
				res = i+1;
				found = true;
			} // end if
		} // end for
		if (res != -1 ){
			cout << res << endl;
		}else{
			cout << "NA" << endl;
		} // end if
	} // end loop
		
	return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <algorithm>
using namespace std;

int n;
int as[100000];

int main() {
  while (1) {
    scanf("%d", &n);
    if (n == 0) return 0;
  
    for (int i=0; i<n; i++) {
      scanf("%d", &as[i]);
    }
  
    int l = 0;
    int r = 0;
    int cur = 0;
    int ans = as[0];
    while (l < n) {
      while (r < n && cur >= 0) {
        cur += as[r++];
        ans = max(ans, cur);
      }
  
      l = r;
      cur = 0;
    }
  
    printf("%d\n", ans);
  }
}

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

int main()
{
    int a,b,i;
    cin>>a>>b;
    string s;
    cin>>s;
    bool ch=1;
    for(i=0;i<a;i++)
    {
        if(s[i]<'0' || s[i]>'9') ch=0;
    }
    if(s[a]!='-') ch=0;
    for(i=a+1;i<=a+b;i++)
    {
        if(s[i]<'0' || s[i]>'9') ch=0;
    }
    if(ch==0) cout<<"No\n";
    else cout<<"Yes\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#define pb emplace_back
#define mp make_pair
#define tci(v,i) for(auto i=v.begin();i!=v.end();i++)
#define all(v) v.begin(),v.end()
#define rep(i,start,lim) for(long long (i)=(start);i<(lim);i++)
#define boost ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define osit ostream_iterator<int> output (cout," ")
#define pv(x) copy(all(x),output)
#define pa(a) rep(i,0,sizeof(a)/sizeof(a[0]))cout<<a[i]<<" "
#define endl '\n'
#define f first
#define s second
#define PI 3.141592653589793
#define set0(x) memset(x,0,sizeof(x))
#define sort_uniq(c) (sort(c.begin(), c.end()), c.resize(distance(c.begin(), unique(c.begin(), c.end()))))
#define uniq(a) a.resize(distance(a.begin(), unique(a.begin(), a.end())))
#define dg(x) cout<<#x<<':'<<x<<endl;
#define dg2(x,y) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<endl;
#define dg3(x,y,z) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<' '<<#z<<':'<<z<<endl;
#define dg4(x,y,z,zz) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<' '<<#z<<':'<<z<<' '<<#zz<<':'<<zz<<endl;
using namespace __gnu_pbds;
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
template<typename T> T gcd(T a,T b){if(a==0) return b; return gcd(b%a,a);}

int main(){
    boost;
    int r;
    cin>>r;
    double ans=2*PI*r;
    cout<<fixed<<setprecision(10)<<ans; 
    return 0;
}


Measured memory_bytes: 3804
#include<iostream>
#include<queue>

using namespace std;

int main() {
  int n[3];
  int cnt = 0;

  cin >> n[0] >> n[1] >> n[2];

  while (n[0] != n[1] || n[1] != n[2] || n[0] != n[2]) {
    cnt += 1;
    int max = -1;
    int maxi = 0;
    int min = 51;
    int mini = 0;

    for (int i = 0; i < 3; i++) {
      if (max < n[i]) {
        max = n[i];
        maxi = i;
      }

      if (min > n[i]) {
        min = n[i];
        mini = i;
      }
    }


    queue<int> mxq;
    queue<int> othq;
    for (int i = 0; i < 3; i++) {
      if (n[i] == max) 
        mxq.push(i);
      else
        othq.push(i);
    }

    if (mxq.size() == 1) {
      n[othq.front()] += 1;
      othq.pop();
      n[othq.front()] += 1;
      othq.pop();
    } else {
      n[othq.front()] += 2;
      othq.pop();
    }
  }

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define hell1 1e9+7
#define hell2 1e9+9
#define pi 3.1415926535
#define ms(s, n) memset(s, n, sizeof(s))
#define prec(n) fixed<<setprecision(n)
#define eps 0.000001
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define ll long long
#define ld long double 
#define no_of_digits(n) floor(log10(n)) + 1
#define see(x) cout << (#x) << " is " << (x) << endl
#define INF 1e9

using namespace std;

ll mult(ll a,ll b, ll p=hell1){   return ((a%p)*(b%p))%p; }
ll multbig(ll a,ll b,ll mod=hell1){   if(a==0 or b==0) return 0;if(a==1 or b==1) return (a*b)%mod;ll cur=multbig(a,b/2,mod);cur=(2*cur)%mod;if(b%2) cur=(cur+a)%mod;return cur;
}
ll add(ll a, ll b, ll p=hell1){ if(a>=p) a%=p; if(b>=p) b%=p; if(a+b>p) return (a + b)%p; else return a+b;}
ll sub(ll a, ll b, ll p=hell1){return (a%p - b%p + p)%p;}
ll fpow(ll n, ll k, ll p = hell1) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = hell1) {return fpow(a, p - 2, p);}
ll inv_euclid(ll a, ll m = hell1){ll m0 = m;ll y = 0, x = 1;if (m == 1)return 0;while (a > 1){ll q = a / m;ll t = m;m = a % m, a = t;t = y;y = x - q * y;x = t;}if (x < 0)x += m0;return x;}
int isPowerof2(ll x) { return (x && !(x & x-1)); } 
ll log2(ll x) { ll res = 0; while (x >>= 1) res++; return res; } 

// max({a, b, c, d})

vector<ll>adj[200005];
ll update[200005];
ll ans[200005];

int binaryToDecimal(string n) 
{ 
    string num = n; 
    int dec_value = 0; 
  
    // Initializing base value to 1, i.e 2^0 
    int base = 1; 
  
    int len = num.length(); 
    for (int i = len - 1; i >= 0; i--) { 
        if (num[i] == '1') 
            dec_value += base; 
        base = base * 2; 
    } 
  
    return dec_value; 
} 

bool isPerfectSquare(long double x) 
{   
  // Find floating point value of  
  // square root of x. 
  long double sr = sqrt(x); 
  
  // If square root is an integer 
  return ((sr - floor(sr)) == 0); 
} 

int main()
{
    string s;
    cin >> s;
    int i;
    for(i=0;i<s.size();i++)
    {
        if(s[i] == s[i+1]) 
        {
            cout << "Bad\n";
            break;
        }
    }

    if(i == s.size()) cout << "Good\n";
}




Measured memory_bytes: 6016
D,G = map(int,input().split())
P = [list(map(int,input().split())) for d in range(D)]
ans = 1000

for i in range(1<<D):
  s=0
  n=0
  for j in range(D):
    if i>>j&1==1:
      s+=100*(j+1)*P[j][0]+P[j][1]
      n+=P[j][0]
  for j in range(D-1,-1,-1):
    if i>>j&1==0:
      r = ((G-s)//100+j)//(j+1)
      if r>P[j][0]:
        n = 1000
      else:
        n+=max(r,0)
      break
  ans=min(ans,n)

print(ans)

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

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

	int zero = 0;
	int one = 0;
	for (int i = 0;i < s.size();++i) {
		if (s[i] == '0')++zero;
		else ++one;
	}
	int ans = 2 * min(zero, one);
	cout << ans << endl;
}

Measured memory_bytes: 512
import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int[] Hi = new int[N];
   for(int i = 0; i<N;i++)
   {
		Hi[i] = sc.nextInt();       
   }
   int count =0;
   boolean flg = false;
   for(int i = 0; i<N;i++)
   {
     flg = true;
		for(int k = 0;k <i; k++)
        {
         	if(Hi[k]>Hi[i])
            {
              	flg = false;
          		break;
            }
        }
     if(flg) count++;
   }
   System.out.println(count);
 }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
#include <stdio.h>
#include <cmath>
#include <tgmath.h>

using namespace std;

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const ll inf = 1e18+7;
const ll mod = 1e9+7;


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

    vector<int>a1(n),a2(n),A1(n),A2(n);
    rep(i,n)cin>>a1[i];
    rep(i,n)cin>>a2[i];

    A1[0]=a1[0];
    A2[n-1]=a2[n-1];

    rep2(i,1,n-1)A1[i]=A1[i-1]+a1[i];
    repr(i,n-2,0)A2[i]=A2[i+1]+a2[i];

    int ans=0;

    rep2(i,0,n-2){
        ans=max(ans,A1[i]+A2[i]);
    }

    if(n==1)ans=a1[0]+a2[0];

    cout<<ans<<endl;

}


Measured memory_bytes: 256
#[allow(unused_imports)]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(n: usize, p: [usize; n]);
    let mut count = 0;
    for i in 1..n - 1 {
        let mut v = vec![p[i - 1], p[i], p[i + 1]];
        v.sort();
        if v[1] == p[i] {
            count += 1;
        }
    }
    println!("{}", count);
}


Measured memory_bytes: 2156
#include<iostream>
#include<map>
#include<vector>
#include<set>
using namespace std;

int main()
{
  int m;
  for(;cin>>m,m;)
    {
      pair<int,int> tar[201];
      for(int i=0;i<m;i++)
	{
	  int a,b;
	  cin>>a>>b;
	  if(i==0)
	    tar[i]=make_pair(a,b);
	  else
	    tar[i]=make_pair(a-tar[0].first,b-tar[0].second);
	  //	  cout<<tar[i].first<<" "<<tar[i].second<<endl;
	}

      pair<int,int> star[1001];
      map<pair<int,int>, bool>maps;
      int n;
      cin>>n;
      for(int i=0;i<n;i++)
	{
	  int a,b;
	  cin>>a>>b;
	  maps[make_pair(a,b)]=true;
	  star[i]=make_pair(a,b);
	}
      for(int i=0;i<n;i++)
	{
	  int diffx=star[i].first-tar[0].first;
	  int diffy=star[i].second-tar[0].second;
	  bool flag=true;
	  for(int j=1;j<m;j++)
	    {
	      if(!maps[make_pair(star[i].first+tar[j].first,star[i].second+tar[j].second)])
		{
		  //	  cout<<star[i].first<<" "<<tar[j].first<<" "<<star[i].second<<" "<<tar[j].second<<endl;
		  flag=false;
		  break;
		}
	    }
	  if(flag)
	    {
	      cout<<diffx<<" "<<diffy<<endl;
	      break;
	    }
	}
    }
}

Measured memory_bytes: 1308
#include<cstdio>
#include<cstring>
#include<cmath>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define FOR(i,a,b) for(int i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define LMAX 9223372036854775807
#define LMIN -9223372036854775808

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ull, ull> UP;
typedef tuple<int, int, int> T;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x])swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	int k = a % b;
	if (k == 1)return 1;
	if (k == 0)return b;
	int ans = gcd(b, k);
	return ans;
}
ll digisum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}
ll countpow(ll a, ll b) {
	int ans = 0;
	if (b == 0)return -1;
	while (1) {
		if (a % b == 0) {
			a /= b;
			ans++;
		}
		else break;
	}
	return ans;
}


int main() {
	IOS;
	int ans;
	string s;
	cin >> s;
	while (1) {
		s = s.substr(0, s.size() - 2);
		string a = s.substr(0, s.size() / 2);
		string b = s.substr(s.size() / 2, s.size() / 2);
		if (a == b) {
			ans = s.size();
			break;
		}
	}
	cout << ans << endl;
}



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

int main(){
    using namespace std;
    int N; cin >> N;
    int highest = 0;
    int cnt = 0;
    for (int i = 0; i < N; i++)
    {
        int h; cin >> h;
        if(h>=highest) cnt++;
        highest = max(highest, h);
    }
    cout << cnt << endl;
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
#include<random> 
#define int long long 
#define pp pair<int,int> 
#define ss second 
#define ff first 
#define pb push_back 
#define mod 1000000007 
#define mk(arr,n,type) type *arr=new type[n]; 
#define sl s1.length(); 
#define yes cout<< "Yes"<<endl 
#define no cout<< "No"<<endl 
#define all(v) (v).begin(),(v).end() 
#define mt mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); 
using namespace std; 
void fastio() 
{ 
    #ifndef ONLINE_JUDGE 
    freopen("INPUT.txt","r",stdin); 
    freopen("OUTPUT.txt","w",stdout); 
    #endif 
    ios_base :: sync_with_stdio(false); 
    cin.tie(NULL) ; 
    cout.tie(NULL); 
    
}

signed main() 
{ 
    fastio(); 
    int a,b,c;
    cin>>a>>b>>c;
    int m=(a%c>0)+a/c;
    if(m<=b)
    cout<<"Yes\n";
    else
    cout<<"No\n";
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
namespace ZDY{
    #pragma GCC optimize(3)
    #define il __inline__ __attribute__ ((always_inline))
    #define rg register
    #define ll long long
    #define ull unsigned long long
    #define db double
    #define sht short
    #define MB template <class T>il
    #define Fur(i,x,y) for(int i=x;i<=y;++i)
    #define Fdr(i,x,y) for(int i=x;i>=y;--i)
    #define fl(i,x) for(int i=head[x],to;to=e[i].to,i;i=e[i].nxt)
    #define clr(x,y) memset(x,y,sizeof(x))
    #define cpy(x,y) memcpy(x,y,sizeof(x))
    #define fin(s) freopen(s".in","r",stdin)
    #define fout(s) freopen(s".out","w",stdout)
    #define fcin ios::sync_with_stdio(false)
    #define l2(n) (int(log2(n)))
    #define inf 0x3f3f3f3f
    MB T ABS(T x){return x>0?x:-x;}
    MB T MAX(T x,T y){return x>y?x:y;}
    MB T MIN(T x,T y){return x<y?x:y;}
    MB T GCD(T x,T y){return y?GCD(y,x%y):x;}
    MB void SWAP(T &x,T &y){T t=x;x=y;y=t;}
}using namespace ZDY;using namespace std;
namespace IO{const char* ln="\n";const int str=1<<20;struct IN{char buf[str],*s,*t;bool _;IN():s(buf),t(buf),_(0){}il char gc(){return s==t&&((t=(s=buf)+fread(buf,1,str,stdin))==s)?EOF:(*s++);}IN&operator>>(char&ch){if(_)return *this;char c;while((c=gc())!=EOF&&isspace(c));if(c==EOF)_=1;else ch=c;return *this;}IN& operator>>(char* ch){clr(ch,0);if(_)return *this;char c;while((c=gc())!=EOF&&isspace(c));if(c==EOF)return _=1,*this;*ch=c;ch++;while((c=gc())!=EOF&&!isspace(c))*ch=c,ch++;if(c==EOF)_=1;return *this;}IN& operator>>(string& ch){if(_)return *this;char c;while((c=gc())!=EOF&&isspace(c));if(c==EOF)return _=1,*this;ch+=c;while((c=gc())!=EOF&&!isspace(c))ch+=c;if(c==EOF)_=1;return *this;}template<typename T>IN&operator>>(T&x){if(_)return *this;char c=gc();bool ff=0;while(c!=EOF&&(c<'0'||c>'9'))ff^=(c=='-'),c=gc();if(c==EOF){_=1;return *this;}x=0;while(c!=EOF&&'0'<=c&&c<='9')x=(x<<3)+(x<<1)+c-48,c=gc();if(c==EOF)_=1;if(ff)x=-x;return *this;}}in;struct OUT{char buf[str],*s,*t;OUT():s(buf),t(buf+str){}~OUT(){fwrite(buf,1,s-buf,stdout);}void pt(char c){(s==t)?(fwrite(s=buf,1,str,stdout),*s++=c):(*s++=c);}OUT&operator<<(const char*s){while(*s)pt(*s++);return *this;}OUT&operator<<(char*s){while(*s)pt(*s++);return *this;}OUT&operator<<(string s){for(int i=0;s[i];i++)pt(s[i]);return *this;}template<typename T>OUT&operator<<(T x){if(!x)return pt('0'),*this;if(x<0)pt('-'),x=-x;char a[30],t=0;while(x)a[t++]=x%10,x/=10;while(t--)pt(a[t]+'0');return *this;}}out;}using namespace IO;
#define N 100011
int n;
int main(){
    int n;
    in>>n;
    printf("%.6f\n",1.0*int((n+1)/2)/n);
}

Measured memory_bytes: 256
n = int(input())
m = n%10
if m == 2 or m == 4 or m == 5 or m == 7 or m == 9:
  print('hon')
elif m == 0 or m == 1 or m == 6 or m == 8:
  print('pon')
elif m == 3:
  print('bon')

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

typedef long long ll;
char mat[25][25];
int vis[25][25];
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int ans=0;
int n,m;
queue<pair<int,int> > que;
void bfs(int sx,int sy){
	vis[sx][sy]=0;
	//queue<pair<int,int> > que;
	que.push(make_pair(sx,sy));
	while(que.size()){
		//ans=max(ans,vis[sx][sy]);
		int x=que.front().first,y=que.front().second;
		ans=max(ans,vis[x][y]);
		que.pop();
		for(int i=0;i<4;i++){
			int nx=x+dx[i],ny=y+dy[i];
			if(nx<1 || nx>n || ny<1 || ny>m) continue;
			if(mat[nx][ny]=='#') continue;
			if(nx==sx && ny==sy) continue;
			if(vis[nx][ny]) continue;
			
			vis[nx][ny]=vis[x][y]+1;
			que.push(make_pair(nx,ny));
		}
	}
}
int main(){
	while(~scanf("%d %d", &n, &m)){
		memset(mat,'\0',sizeof(mat));
		for(int i=1;i<=n;i++){
			scanf("%s", mat[i]+1);
		}
		//memset(vis,0,sizeof(vis));
		ans=0;
		for(int i=1;i<=n;i++){
			for(int j=1;j<=m;j++){
				if(mat[i][j]=='.'){
					memset(vis,0,sizeof(vis));
					bfs(i,j);
				}
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/arc080/tasks/arc080_a
import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def get_2(i):
    cnt = 0
    while i % 2 == 0 and i > 0:
        i = i // 2
        cnt += 1
    return cnt


def main():
    n = input_int()
    A = input_int_list()
    odd = 0
    even_4 = 0
    even_2 = 0
    for a in A:
        if a % 4 == 0:
            even_4 += 1
        elif a % 2 == 0:
            even_2 += 1
        else:
            odd += 1
    if even_4 >= odd:
        print("Yes")
    elif odd == 0 and even_2 > 1:
        print("Yes")
    elif odd == 0 and even_4 == 0 and even_2 == 1:
        print("No")
    elif even_4 == odd - 1 and even_2 == 0:
        print("Yes")
    elif even_4 == odd - 1 and even_2 > 0:
        print("No")
    elif even_4 < odd - 1:
        print("No")
    else:
        print("No")
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 84488
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int m = sc.NextInt();

        int answer = 48 - m;

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 11092
S = input()

def gusuretu(S):
    if S[ : len(S) // 2] == S[len(S) // 2 : ]:
        return True
    else:
        return False

S = S[: len(S) - 1]
while True:
    if gusuretu(S):
        print(len(S))
        break
    S = S[:len(S) - 1]

Measured memory_bytes: 3064
from fractions import gcd


def lcm(x,y):
    return (x*y)//gcd(x,y)


n,m=map(int,input().split())
s=input()
t=input()
lcm=lcm(n,m)
S=[(i,int(i*(lcm/n)+1)) for i in range(n)]
L=[(i,int(i*(lcm/m)+1)) for i in range(m)]
left,right=0,0
ans=[]
while left!=n and right!=m:
    if S[left][1]==L[right][1]:
        ans.append([S[left][0],L[right][0]])
        right +=1
        left +=1
    elif S[left][1]>L[right][1]:
        right +=1
    elif S[left][1]<L[right][1]:
        left +=1
for l,r in ans:
    if s[l]==t[r]:continue
    else:print(-1);exit()
print(lcm)

Measured memory_bytes: 28988
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int A, B;
    cin >> A >> B;
    for (int i = 1; i < 1000000; i++) {
        int p1 = 8 * i / 100;
        int p2 = i / 10;
        if (p1 == A && p2 == B) {
            cout << i << "\n";
            return 0;
        }
    }
    cout << "-1\n";
    return 0;
}

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

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

x = a[0]
for i in range(n-1):
    x = x^a[i+1]
ans = []
if n % 2 == 0:
    for i in range(n):
        pp = a[i]^x
        ans.append(pp)
else:
    ans = a
print(*ans)

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

int n,k;
set<int> s;
string solve(int k){

	bool dp[k+1] = {0};

	for(int i=1;i<=k;i++){
		for(int move:s){
			if(move>i)
				continue;	
			if(dp[i-move] == 0)
				dp[i] = 1;
		}
	}

	return dp[k] ? "First" : "Second" ;
}

int main(){

	#ifndef ONLINE_JUDGE
    	// for getting input from input.txt
    	freopen("input.txt", "r", stdin);
    	// for writing output to output.txt
    	freopen("output.txt", "w", stdout);
	#endif

   ios_base::sync_with_stdio(false);
        cin.tie(NULL);


        cin>>n>>k;
        for(int i=1;i<=n;i++){
        	int x;cin>>x;
        	s.insert(x);
        }


        cout<<solve(k)<<endl;

}

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

int used[100005];

int main(){
    int n,m;
    cin>>n>>m;
    int h[n+1];
    REP(i,n){
        cin>>h[i];
    }
    vector<vector<int>> g(n+1);
    rep(i,m){
        int a,b;
        cin>>a>>b;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    int ans = 0;
    REP(i,n){
        if(used[i]==0){
            bool fl=true;
            for(auto v:g[i]){
                if(h[v]>=h[i]){
                    fl = false;
                    break;
                }else{
                    used[v]=1;
                }
            }
            if(fl) {
                ans++;

                }

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

Measured memory_bytes: 8980
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque> 
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype> 
using namespace std;

vector<long long> vi(long long n) {
    vector<long long> res;
    for (int i=1; i<=(int)sqrt(n); i++) {
        if (n%i==0) {
            res.push_back(i);
            if(i!=n/i) res.push_back(n/i);
            //else if (i*i==n) res.push_back(i);
        }
    }
    sort(res.begin(),res.end());
    return res;
}

int main(){
    long long N;
    cin >> N;
    vector<long long> v=vi(N);
    //for (int i=0; i<v.size(); i++) cout << v.at(i) << endl;
    //cout << v.size() << endl;;
    if (N==1) {
        cout << 1 << endl;
        return 0;
    }
    int a=v.at(v.size()/2-1),b=v.at(v.size()/2);
    //cout << a << " " << b << endl;
    int z=0;
    if (v.size()%2==1) {
        a=v.at(v.size()/2);
        //cout << a << endl;
        while (a!=0) {
            a/=10;
            z++;
        }
        cout << z << endl;
        return 0;
    }
    
    while (b!=0) {
        b/=10;
        z++;
    }
    cout << z << endl;
}

Measured memory_bytes: 888
/*------------------------- Bism Allah Alruhmin Alrahim -------------------------------*/
#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < n; i++)
#define ford(i, n) for (int i = n - 1; i > -1; i--)
#define forl(i, l, r) for (int i = l; i <= r; i++)
#define vc vector
#define f first
#define s second
#define pb(i) push_back(i)
#define mx(ar, n) (*max_element(ar, ar + n))
#define mn(ar, n) (*min_element(ar, ar + n))

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;


int main()
{
    int a, b ,t; 
    cin >> a >> b >> t; 
   
    cout << (t/a)*b << endl ;
    
    return 0 ;
}

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

cnt = 0
for i in range(N):
  if A[i] <= B[i]:
    B[i] -= A[i]
    cnt += A[i]
    A[i] = 0
  else:
    A[i] -= B[i]
    cnt += B[i]
    B[i] = 0
  if B[i] == 0:
    continue
  if A[i+1] <= B[i]:
    B[i] -= A[i+1]
    cnt += A[i+1]
    A[i+1] = 0
  else:
    A[i+1] -= B[i]
    cnt += B[i]
    B[i] = 0
print(cnt)

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

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;

int sign = 0;

void dfs(int u, vector<multiset<int> >& G, vector<int>& a, set<int>& st) {
	int N = a.size();
	if (G[u].empty()) {
		st.erase(u);
		return;
	}
	int v = *G[u].begin();
	if (v >= 0) {
		auto it = G[u].find(v);
		G[u].erase(it);
		it = G[v].find(u);
		G[v].erase(it);
		a[u]++, a[v]--;
		dfs(v, G, a, st);
	}
	else {
		v = ~v;
		auto it = G[u].find(~v);
		G[u].erase(it);
		it = G[v].find(~u);
		G[v].erase(it);
		a[u]--, a[v]++;
		dfs(v, G, a, st);
	}
}

int main() {
	int N; cin >> N;
	vector<int> p(N), q(N);
	rep(u, N) scanf("%d", &p[u]), p[u]--;
	rep(u, N) scanf("%d", &q[u]), q[u]--;
	vector<multiset<int> > G(N + 1);
	rep(u, N) if (p[u] != -2) {
		int v = p[u];
		G[u].insert(v);
		G[v].insert(u);
	}
	else G[u].insert(N), G[N].insert(u);
	rep(u, N) if (q[u] != -2) {
		int v = q[u];
		G[u].insert(~v);
		G[v].insert(~u);
	}
	else G[u].insert(~N), G[N].insert(~u);
	rep(u, N) if (G[u].size() % 2) {
		cout << "IMPOSSIBLE" << endl;
		return 0;
	}
	set<int> st;
	rep(u, N + 1) st.insert(u);
	vector<int> a(N + 1);
	while (st.size()) {
		int u = *st.begin();
		dfs(u, G, a, st);
	}
	cout << "POSSIBLE" << endl;
	rep(u, N) printf("%d ", a[u] / 2);
	cout << endl;
}


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

int main(void) {
    int n, r;
    while (cin >> n >> r, n+r) {
        vector<int> h(n);
        for (int i = 0; i < n; i++) {
            h[i] = n-i;
        }

        int p, c;
        for (int i = 0; i < r; i++) {
            cin >> p >> c;
            vector<int> tmp;
            for (int j = 0; j < c; j++) {
                tmp.push_back(h[p-1+j]);
            }
            for (int j = 0; j < p-1; j++) {
                tmp.push_back(h[j]);
            }
            for (int j = 0; j < tmp.size(); j++) {
                h[j] = tmp[j];
            }

            // cout << "#: ";
            // for (int j = 0; j < n; j++) {
            //     cout << " " << h[j];
            // }
            // cout << endl;
        }

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

Measured memory_bytes: 1216
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int a, b;
    int ans = 0;

    cin >> a >> b;

    for(int i = 0; i < 2; i++){
        if(a > b){
            ans += a--;
        }else{
            ans += b--;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
/*
Author: CNYALI_LK
LANG: C++
PROG: d.cpp
*/
#include<bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define all(x) x.begin(),x.end()
using namespace std;
const double eps=1e-8;
const double PI=acos(-1.0);
typedef long long ll;
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;}
#define min mmin
#define max mmax
#define abs aabs
int a[2048],fx[2048],fy[2048],hx[2048],hy[2048];
int main(){
#ifdef cnyali_lk
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
	int n,z,w;
	scanf("%d%d%d",&n,&z,&w);
	if(!n)printf("%d\n",abs(z-w));
	else{
		a[0]=w;
		for(int i=1;i<=n;++i)scanf("%d",a+i);
		hy[n]=fy[n]=0x3f3f3f3f;
		fx[n]=hx[n]=0;
		for(int i=n-1;i+1;--i){
			fx[i]=min(hy[i+1],abs(a[i]-a[n]));
			fy[i]=max(hx[i+1],abs(a[i]-a[n]));
			hy[i]=min(hy[i+1],fy[i]);
			hx[i]=max(hx[i+1],fx[i]);
		}
		printf("%d\n",fy[0]);
	}
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
 int N;
 int sum =0;

 int main(){
 
  cin >> N;

  int temp=N;
  while (temp > 0) {

   sum += temp%10;
   temp /= 10;
  }

  sum+=temp;


  if (N%sum == 0) {
    cout << "Yes" << endl;
   } 
  else cout << "No" << endl;


 return 0;
}


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

double dist(pair<int,int> i, pair<int, int> j){
    int x = i.first - j.first;
    int y = i.second - j.second;
    return pow(x * x + y * y, 0.5);
}

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

    vector<pair<int, int>> z(n);
    rep(i,n){
        int x,y;
        cin >> x >> y;
        z.at(i) = make_pair(x,y);
    }
    int fact = 1;
    for(int i=1;i<=n;i++) fact*=i;

    double ans =0.0;
    vector<int> v(n);
    for(int i = 0; i < n; i++) v.at(i) = i;

    do {
        for(int i=0;i<n-1;i++){
            // cout << v.at(i) <<  ' ' << v.at(i+1) << endl;
            ans += dist(z.at(v.at(i)), z.at(v.at(i+1)));
        }
    } while (next_permutation(v.begin(), v.end()));
    
    cout << fixed << setprecision(10) <<  ans/fact << endl;
    return 0;
}

Measured memory_bytes: 256