akhauriyash/Code-Regression huggingface dataset:
/**
 * author: Dhakad_123
**/
#include<bits/stdc++.h>
using namespace std;
#define PI 3.141592

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    
    int r;  
    cin >> r;
    

    
    float ans = float(2)*float(r)*PI;
    
    printf("%.2f",ans);
    return 0;
}

Measured memory_bytes: 3772
gem_count, times = gets.split.map(&:to_i)
gems = gets.split.map(&:to_i)

res = 0

(0..([times, gem_count].min)).each do |left|
  (0..([times - left, gem_count - left].min)).each do |right|
    a = []
    gems[0...left].each {|n| a.push(n) }
    gems[(gem_count - right)...gem_count].each {|n| a.push(n) }
    
    a = a.sort
    
    sum = a.inject(&:+) || 0
    
    [times-left-right, a.length].min.times do |i|
      break if a[i] >= 0
      sum -= a[i]
    end
    
    res = sum if sum > res
  end
end

puts res

Measured memory_bytes: 2044
/*dismint|jjc*/
#include <bits/stdc++.h>
using namespace std;
#define forl(V, S, E) for(int V = S; V < E; V++)
#define ford(V, S, E) for(int V = S; V >= E; V--)
#define fore(E, X) for(auto &E:X)
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
typedef unordered_map<int, unordered_set<int>> graph;
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int s, w; cin >> s >> w;
	if(w >= s) println("unsafe");
	else println("safe");
}


Measured memory_bytes: 3640
#include <stdio.h>

int main (void) {
  int A, B, max;

  scanf ("%d %d", &A, &B);

  max = A + B;

  if (max < A - B) {
    max = A - B;
  }

  if (max < A * B) {
    max = A * B;
  }

  printf ("%d", max);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int a,b;
cin>>a>>b;
int ans=-1;
rep(i,1011){
    if(floor(i*0.08)==a &&floor(i*0.10)==b){
        ans=i;
        break;
    }
}

cout<<ans<<endl;
//system("pause");
return 0;
}

Measured memory_bytes: 256
N = input()
K = int(input())
dp = [[[0]*(2) for _ in range(K+1)] for _ in range(len(N)+1)]
dp[0][0][0] = 1

for i in range(len(N)) :
    for k in range(K+1) :
        for j in range(2) :
            n = int(N[i])
            for d in range(10) :
                nk = k
                nj = j
                if d != 0:
                    nk += 1
                if nk > K:
                    continue
                if j == 0:
                    if d > n:
                        continue
                    if d < n:
                        nj = 1
                dp[i+1][nk][nj] += dp[i][k][j]

ans = dp[len(N)][K][0] + dp[len(N)][K][1]

print(ans)


Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<(n);i++)
#define Rep(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define eb emplace_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int a,b;
    cin>>a>>b;
    cout<<(1^2^3^a^b)<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int n;
  scanf("%d", &n);
  int array[n];
  int i , count = 0;

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

  for(i=1 ; i<n-1 ; i++){
    if(((array[i-1] <= array[i]) && (array[i] <= array[i+1])) 
       || ((array[i+1] <= array[i]) && (array[i] <= array[i-1])))
      count++;
  }

  printf("%d\n", count);

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define INF 0x7fffffff
typedef long long ll;
typedef long double ld;

typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<ld> vld;

#define fastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define beg(x) x.begin()
#define en(x) x.end()

const int mod = 1e9 + 7;
int block;

int main()
{
	fastIO;

	int n; cin >> n;
	int cnt = 0;
	int d[101][2] = {0};
	for(int i = 0; i < n; i++) 
	{
		cin >> d[i][0] >> d[i][1];
		cnt = d[i][0] == d[i][1]? cnt + 1 : 0;
		if(cnt == 3) 
		{
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>

int main(int argc, char const *argv[]) {

  long k,a,b;
  scanf("%ld %ld %ld", &k,&a, &b);

  long sa = b-a;
  long kaisuu;

  if (sa > 2 && k >= a+1) {
    kaisuu = k-(a-1);
    if(kaisuu%2 == 0) {
      long maisuu = a;
      maisuu += kaisuu/2*sa;
      printf("%ld", maisuu);
    } else {
      long maisuu = a;
      maisuu += kaisuu/2*sa;
      printf("%ld", maisuu+1);
    }
  } else {
    printf("%ld", k+1);
  }


  return 0;
}


Measured memory_bytes: 128
#include <string.h>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iomanip>

using namespace std;
#define INF 1e9
#define MAX 100005
#define MOD 1000000007
#define Q queue
#define PQ priority_queue
#define fr first
#define sc second
#define pb push_back
#define mp make_pair
#define FOR( i, L, U ) for(int i=(int)L ; i<(int)U ; i++ )
#define FORD( i, U, L ) for(int i=(int)U ; i>=(int)L ; i-- )
#define wa cout<<"Wa"<<endl
#define READ(filename)  freopen(filename, "r", stdin);
#define WRITE(filename)  freopen(filename, "w", stdout);

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int> > vvi;
typedef map<int, int> mii;
typedef map<string, int> msi;
typedef map<int, string> mis;
typedef map<int , vector<int> > mvi;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;

void base(){
	 ios_base::sync_with_stdio(false);
	 cin.tie(NULL);
}


int main(){
	base();
	string str;
	cin>>str;
	int c=str.size();
	c--;
	while(c>0){
		bool flag = true;
		if (c%2==1) {
			c--;
			continue;
		}
		int j=c/2;
		for(int i=0;i<c/2 && j<c;i++){
		//	printf("i %d j %d c %d\n",i,j,c);
			if (str[i]!=str[j]){
				flag = false;
				break;
			}
			j++;
		}
		if (flag) break;
		else c--;
	}
	cout<<c<<endl;
	
	return 0;
}



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

int main(){
  int a, b, x;
  cin >> a >> b >> x;
  int v = a * a * b;
  double ans;
  if (x <= v / 2)
    ans = atan((double)a * b * b / (2.0 * x)) * 180.0 / M_PI;
  else
    ans = atan(2.0 / a * (b - (double)x / (a * a))) * 180.0 / M_PI;
  cout << fixed << setprecision(10) << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
n=int(input())
s=input()
ans=''
for ft in {'o':['SSS','WSW','SWW','WWS'],'x':['SSW','WSS','SWS','WWW'],}[s[0]]:
    a=ft
    for l in s[1:-1]:
        if l=='o':
            if a[-1]=='S':a=a+('S' if a[-2]=='S' else 'W')
            else:         a=a+('W' if a[-2]=='S' else 'S')
        if l=='x':
            if a[-1]=='S':a=a+('W' if a[-2]=='S' else 'S')
            else:         a=a+('S' if a[-2]=='S' else 'W')
    else:
        if a[0]==a[-1] and s[-1]=='o':
            if (a[-1]=='S' and a[1]==a[-2]) or (a[-1]=='W' and a[1]!=a[-2]):
                print(a[1:]);exit()
        if a[0]==a[-1] and s[-1]=='x':
            if (a[-1]=='S' and a[1]!=a[-2]) or (a[-1]=='W' and a[1]==a[-2]):
                print(a[1:]);exit()
print(-1)

Measured memory_bytes: 9504
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

int main() {
	int Y[10000];
	for (int N, A, B, C, X; cin >> N >> A >> B >> C >> X && N;) {
		for (int i = 0; i < N; i++) {
			cin >> Y[i];
		}
		int cnt, i = 0;
		for (cnt = 0; cnt <= 10000; cnt++) {
			if (Y[i] == X) {
				i++;
				if (i == N)break;
			}
			X = (A*X + B) % C;
		}
		cout << (cnt <= 10000 ? cnt : -1) << endl;
	}
	return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
   ll n,m,i,k,j=0;
    vector<ll>v;
    cin>>n>>k;
    for(i=0;i<n;i++){
    cin>>m;
        v.push_back(m);
}
    sort(v.begin(),v.end());
    for(i=0;i<k;i++){
    j+=v[i];
}
    cout<<j;
  
cout<<endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define PRINT(V) for (auto v : (V)) cout << v << " "

int main()
{
    string s, t; cin >> s >> t;
    bool f = true;

    rep(i, ll(s.size())){
        if (s[i] != t[i]) {
            f = false;
            break;
        } 
    };

    cout << (f?"Yes":"No") << endl;
    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <math.h>
#define log(x) cout<<x<<endl
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
using namespace std;
int main(){
  int n,d,m;
  int count = 1;
  cin>>n>>d;
  m=d*2+1;
  for (int i=m;  i<n ; i=i+m)
  {
    count++;
  }
  log(count);
  


}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;



#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

ll debugFlag = false;
template<typename T> void debug(T&);
template<typename T> void debug(T&, bool);
template<typename T> void debug(vector<T>&);
template<typename T> void debug(vector<T>&, bool);
template<typename T, typename U> void debug(pair<T, U>&);
template<typename T, typename U> void debug(pair<T, U>&, bool);

template<typename T>
void debug(T& obj) {
	debug(obj, true);
}

template<typename T>
void debug(T& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << obj;
	if (lnFlag) cout << endl;
}

template<typename T>
void debug(vector<T>& obj) {
	debug(obj, true);
}

template<typename T>
void debug(vector<T>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "[";
	rep(i, obj.size()) {
		if (i != 0) cout << ",";
		debug(obj[i], false);
	}
	cout << "]";
	if (lnFlag) cout << endl;
}

template<typename T, typename U>
void debug(pair<T, U>& obj) {
	debug(obj, true);
}

template<typename T, typename U>
void debug(pair<T, U>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "(";
	debug(obj.first, false);
	cout << ",";
	debug(obj.second, false);
	cout << ")";
	if (lnFlag) cout << endl;
}

void solve() {

	ll N, Q;
	cin >> N >> Q;

	vector<vector<ll>> edge(N,vector<ll>());

	rep(i, N - 1) {
		ll a, b;
		cin >> a >> b;
		a--; b--;

		edge[a].emplace_back(b);
		edge[b].emplace_back(a);

	}

	vector<ll> count(N, 0);

	rep(i, Q) {
		ll p, x;
		cin >> p >> x;
		p--;
		count[p] += x;
	}

	vector<ll> ans(N, -1);

	queue<pair<ll,ll>> QUE;//pos,orignum

	QUE.push(make_pair(0,0));

	while (QUE.size() != 0) {

		pair<ll,ll> P = QUE.front();
		QUE.pop();

		if (ans[P.first] != -1) continue;

		ans[P.first] = P.second + count[P.first];

		rep(i, edge[P.first].size()) {
			QUE.push(make_pair(edge[P.first][i], ans[P.first]));
		}

	}

	rep(i, N) {
		cout << ans[i] << " ";
	}


}


int main(int argc, char* argv[]) {
	if (argc == 2 && string(argv[1]) == "debug") debugFlag = true;
	solve();
	cout << endl;
	return 0;
}


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

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    int maxdif[26] {0};
    int nowdif[26] {0};
    for(int i = 0; i < n; i++){
        nowdif[s[i] - 'a']--;
        for(int j = 0; j < 26; j++){
            nowdif[j]++;
            maxdif[j] = max(maxdif[j], nowdif[j]);
        }
        nowdif[s[i] - 'a'] = 0;
    }
    int ans = 1000;
    for(int j = 0; j < 26; j++){
        ans = min(ans, maxdif[j]);
    }
    cout << ans << endl;
}

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

using namespace std;

int main()

{
	

int d,t,s;

cin >> d >>t >> s;


if(t*s >= d)
	cout << "Yes" << endl;
else
{
	cout << "No"<< endl;
}
			
			
			return 0;
			
				
			
			
			
			
			
	
	
	

	
	
	
	
	
	
	}


Measured memory_bytes: 3636
s = [1,2,3,4,5,6,7,8,9,10,11,12,13]
h = [1,2,3,4,5,6,7,8,9,10,11,12,13]
c = [1,2,3,4,5,6,7,8,9,10,11,12,13]
d = [1,2,3,4,5,6,7,8,9,10,11,12,13]

n = gets.to_i

n.times do
 x = gets()
 y = x.split()
 a = y[0]
 b = y[1].to_i
 
 if a == "S"
  s.delete(b)
 elsif a == "H"
  h.delete(b)
 elsif a == "C"
  c.delete(b)
 else
  d.delete(b)
 end
end

i = 0
while i < s.length
  puts "S #{s[i]}"
  i += 1
end

i = 0
while i < h.length
  puts "H #{h[i]}"
  i += 1
end

i = 0
while i < c.length
  puts "C #{c[i]}"
  i += 1
end

i = 0
while i < d.length
  puts "D #{d[i]}"
  i += 1
end


Measured memory_bytes: 6864
import java.util.Scanner;
public class Main{
    
    public void solve(){
        Scanner sc = new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        int men=a*b;
        int syu=a+a+b+b;
        System.out.print(men+" "+syu);
        System.out.println();
    }
    
    public static void main(String[] args){
        Main obj = new Main();
        obj.solve();
    }
}

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

#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 reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  string s;
  cin >> s;
  int n = s.size();
  int N = 0, S = 0, E = 0, W = 0;
  rep(i, n) if (s[i] == 'N') N = 1;
  rep(i, n) if (s[i] == 'S') S = 1;
  rep(i, n) if (s[i] == 'E') E = 1;
  rep(i, n) if (s[i] == 'W') W = 1;
  if (N && !S || !N && S) no();
  if (E && !W || !E && W) no();
  yes();
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>

using namespace std;

typedef unsigned uint;
// typedef long long Int;

const int INF = 1001001001;
// const Int INFLL = 1001001001001001001LL;

string s;
int p;

string cipher(void);
string str(void);
string letter(void);
string decr(string c);
string incr(string c);

string cipher(void){
	string r;
	while (s.size() != p && s[p] != ']'){
		r += str();
	}
	return r;
}

string str(void)
{
	string r;
	if (s[p] == '['){
		p++;
		string tmp = cipher();
		reverse(tmp.begin(), tmp.end());
		// cout << tmp << endl;
		r += tmp;
		p++;
	}
	else {
		return letter();
	}
	return r;
}

string letter(void)
{
	string tmp = "";
	if (isalpha(s[p]) || s[p] == '?'){
		tmp += s[p++];
		return (tmp);
	}
	if (s[p] == '-'){
		p++;
		tmp += decr(letter());
		return tmp;
	}
	if (s[p] == '+'){
		p++;
		tmp += incr(letter());
		return tmp;
	}
}

string decr(string c)
{
	if (c[0] == '?') return (c);
	if (c[0] == 'A'){
		c[0] = 'Z';
		return (c);
	}
	c[0] -= 1;
	return (c);
}

string incr(string c)
{
	if (c[0] == '?') return (c);
	if (c[0] == 'Z'){
		c[0] = 'A';
		return (c);
	}
	c[0] += 1;
	return (c);
}

int main(void)
{
	
	while (cin >> s){
		if (s == ".") return 0;
		
		p = 0;
		string ret = cipher();
		for (int i = 0; i < ret.size(); i++){
			if (ret[i] == '?') ret[i] = 'A';
		}
		cout << ret << endl;
	}
}

Measured memory_bytes: 1204
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>

using namespace std;

int n;
int dp[350];

void mount() {
    int i, j;
    dp[0] = 1;
    for(i = 1; i < 18; i++) {
        for(j = i * i; j < 301; j++) {
            dp[j] += dp[j - i * i];
        }
    }
}

int main(void) {
    mount();
    while(1) {
        scanf("%d", &n);
        if(n == 0) break;
        printf("%d\n", dp[n]);
    }
    return 0;
}

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

using namespace std;

int main(void) {
    vector<int> v(3);
    cin >> v[0];
    cin >> v[1];
    cin >> v[2];
    sort(v.begin(), v.end());
    if(v[0] == 5 && v[1] == 5 && v[2] == 7) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    int l[n+10];
    int r[n+10];
    for(int i = 1; i <= n; i++)
    {
        cin >> l[i] >> r[i];
    }
    int ans = 0;
    for(int i = 1; i <= n; i++)
    {
        ans += r[i] - l[i] + 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from itertools import chain
# form bisect import bisect_left, bisect_right, insort_left, insort_right
# from collections import Counter
# import numpy as np


def solve(a: int):
    return a + a*a + a*a*a

def main():
    tokens = chain(*(line.split() for line in sys.stdin))
    a = int(next(tokens))  # type: int
    answer = solve(a)
    print(answer)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9148
#include <iostream>
#include <string>
#include <algorithm>
// #include <vector>
// #include <algorithm>
// #include <cmath>
// #include <math.h>
using namespace std;

string rev(string s){
    reverse(s.begin(), s.end());
    return s;
}

int main(){
    int A, B;
    cin >> A >> B;
    int c = 0;
    for (int i=A; i<=B; i++){
        string str = to_string(i);
        if (str == rev(str)) c++;
    }   
    cout << c << endl;
}

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

int a[105];
int main()
{
	int N;
	cin >> N;
	for (int i = 1;i <= N;i++)
	{
		scanf("%d", &a[i]);
	}
	sort(a + 1, a + 1 + N);
	int tmp1 = 0, tmp2 = 0;
	for (int i = 1;i <= N;i++)
	{
		if (i % 2)
			tmp1 += a[N - i + 1];
		else
			tmp2 += a[N - i + 1];
	}
	cout << tmp1 - tmp2 << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
	    int n = sc.nextInt();

	    boolean retflg = false;
	    int c = 0;
	    for (int i = 0; i < n; i++) {
	    	int d1 = sc.nextInt();
	    	int d2 = sc.nextInt();
	    	if (d1 == d2) {
	    		c++;
	    	} else {
	    		c = 0;
	    	}
	    	if (c >= 3) {
	    		retflg = true;
	    		break;
	    	}
	    }
	    if (retflg) {
	    	System.out.println("Yes");
	    } else {
	    	System.out.println("No");
	    }
	}

}

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

using namespace std;

inline int ctoi(char c) { if(c < '0' || '9' < c) throw invalid_argument("ctoi error"); return c - '0'; }
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for(int i = (int)(k); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T>
inline T gcd(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("gcd error: x <= 0 or y <= 0");
	
	if(x < y) swap(x, y);
	T r = x % y;

	while(r != 0){
		x = y;
		y = r;
		r = x % y;
	}

	return y;
}
template <typename T>
inline T lcm(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("lcm error: x <= 0 or y <= 0");

	return x * y / gcd(x, y);
}

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

	int ans = 0;
	rep(i, n){
		double x, y;
		cin >> x >> y;

		if(sqrt(x * x + y * y) <= d){
			ans++;
		}
	}

	cout << ans;
	
	return 0;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) ((x).begin()),((x).end())
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimization ("unroll-loops")
#define usecppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using pii = pair<int, int>;

int32_t main()
{
	int n;
	cin >> n;
	cout << n*n;
}

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

using namespace std;

const int INF = 1e9;

int main() {
    int N, M;
    cin >> N >> M;

    int a[50], b[50];
    for (int i = 0; i < N; i++)
        scanf("%d %d", &a[i], &b[i]);

    int c[50], d[50];
    for (int i = 0; i < M; i++)
        scanf("%d %d", &c[i], &d[i]);

    for (int i = 0; i < N; i++) {
        int ans_j, min_L = INF;
        for (int j = 0; j < M; j++) {
            int L = abs(a[i] - c[j]) + abs(b[i] - d[j]);
            if (L < min_L) {
                min_L = L;
                ans_j = j + 1;
            }
        }
        cout << ans_j << endl;
    }

    return 0;
}

Measured memory_bytes: 256
x,y = map(int,input().split())
isOk=False
listA = [1,3,5,7,8,10,12]
listB = [4,6,9,11]
if x==y:
    isOk=True
elif x in listA and y in listA:
    isOk=True
elif x in listB and y in listB:
    isOk=True
print(["No","Yes"][isOk])


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define FORD(i, b, a) for (int i = b; i >= a; --i)
 
using namespace std;
 
const int maxn = 1e5 + 10;
 
int n;
int a[maxn], f[maxn], g[maxn];
 
int main() {
    scanf("%d", &n);
    FOR(i, 1, n) scanf("%d", a + i);
 
    FOR(i, 1, n) f[i] = f[i - 1] + abs(a[i] - a[i - 1]);
    FORD(i, n, 1) g[i] = g[i + 1] + abs(a[i] - a[i + 1]);
    FOR(i, 1, n) printf("%d\n", f[i - 1] + g[i + 1] + abs(a[i - 1] - a[i + 1]));
 
    return 0;
}

Measured memory_bytes: 2432
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <functional>

#define INF 100000000

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int X, Y, Z;

    cin >> X;
    cin >> Y;
    cin >> Z;

    cout << Z;
    cout << ' ';
    cout << X;
    cout << ' ';
    cout << Y;

    return 0;
}


Measured memory_bytes: 256
class BinarySearchTree:
    root = None
    def insert(self, k):
        y = None
        x = self.root
        z = Node(k)
        while x:
            y = x
            if z.k < x.k:
                x = x.l
            else:
                x = x.r
        z.p = y
         
        if y == None:
            self.root = z
        else:
            if z.k < y.k:
                y.l = z
            else:
                y.r = z
                
    def find(self, x, k):
        while x != None and k != x.k:
            if k < x.k:
                x = x.l
            else:
                x = x.r
        return x
     
    def deleteNode(self, z):
        y = None
        x = None
        if z.l == None or z.r == None:
            y = z
        else:
            y = self.getSuccessor(z)
        
        if y.l != None:
            x = y.l
        else:
            x = y.r
        
        if x != None:
            x.p = y.p
        
        if y.p == None:
            self.root = x
        else:
            if y == y.p.l:
                y.p.l = x
            else:
                y.p.r = x
        
        if y != z:
            z.k = y.k

    def getSuccessor(self, x):
        if x.r != None:
            return self.getMinimum(x.r)
        y = x.p
        while y != None and x == y.r:
            x = y
            y = y.p
        return y
    
    def getMinimum(self, x):
        while x.l != None:
            x = x.l
        return x
    
    def preParse(self, u):
        if u == None:
            return
        print("", str(u.k), end = "")
        self.preParse(u.l)
        self.preParse(u.r)
 
    def inParse(self, u):
        if u == None:
            return
        self.inParse(u.l)
        print("", str(u.k), end = "")
        self.inParse(u.r)
 
class Node: 
    def __init__(self, k):
        self.k = k
        self.p = None
        self.l = None
        self.r = None
 
if __name__ == '__main__':
    n = int(input().rstrip())
    x = BinarySearchTree()
    for i in range(n):
        com = input().rstrip()
        if com.startswith("insert"):
            k = int(com.split(" ")[1])
            x.insert(k)
        elif com.startswith("find"):
            k = int(com.split(" ")[1])
            if x.find(x.root, k) != None:
                print("yes")
            else:
                print("no")
        elif com.startswith("delete"):
            k = int(com.split(" ")[1])
            x.deleteNode(x.find(x.root, k))
        else:
            x.inParse(x.root)
            print()
            x.preParse(x.root)
            print()

Measured memory_bytes: 124720
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int a,b,k;
    cin>>a>>b>>k;
    for (int i=0;i<k;i++) {
        if (i%2==0) {
            if (a%2==1) {
                a--;
            }
            b+=a/2;
            a/=2;
        } else {
            if (b%2==1) {
                b--;
            }
            a+=b/2;
            b/=2;
        }
    }
    cout<<a<<" "<<b<<endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (ll i=0; i<(n); ++i)
typedef long long ll;
bool debug=false;
int main(){
  ll a,b,c; cin >> a >> b >> c;
  ll ans = c-min((a-b),c);
  cout << ans;
  return 0;
}


Measured memory_bytes: 256
import itertools
import math
MOD = 1000000007
def P(n, r):
  return math.factorial(n)//math.factorial(n-r)
def C(n, r):
  return P(n, r)//math.factorial(r)% MOD
def X(n, r):
  try:
    return C(n-1,n-r) 
  except:
    return 0
N,K = map(int,input().split())

for i in range(1,K+1):
  if (1==i and K==N):
    print (1)
  else:
    print (X(K,i)*((X(N-K,i+1)+2*X(N-K,i)+X(N-K,i-1)))% MOD)

Measured memory_bytes: 3444
H,W = map(int,input().split())
if(H==1 or W==1):
  print(1)
else:
  ans = 0
  if(H%2==0 and W%2==0):
    ans = H*W//2
  elif(H%2==1 and W%2==0):
    h = (H+1)//2
    w = W//2
    ans = h*w+(h-1)*w
  elif(H%2==0 and W%2==1):
    h = H//2
    w = (W+1)//2
    ans = h*w+h*(w-1)
  else:
    h = (H+1)//2
    w = (W+1)//2
    ans = h*w+(h-1)*(w-1)
  print(ans)
    

Measured memory_bytes: 3064
INT_MAX=10**11+7
MOD=10**9+7
def INPUT():return list(float(i) for i in input().split())
def LIST_1D_ARRAY(n):return [0 for _ in range(n)]
def LIST_2D_ARRAY(m,n):return [[0 for _ in range(n)]for _ in range(m)]
import math
#=======================================================================
n=int(input())
def calc(x):
    a=0
    return int((math.sqrt(1+8*x)-1)/2)
def primefactorisation(n):
	P=[]
	while(n%2==0):
		P.append(2)
		n//=2
	i=3
	while(i<=int(math.sqrt(n))):
		while(n%i==0):
			P.append(i)
			n//=i
		i+=2
	if(n>2):
		P.append(n)
	return P
A=primefactorisation(n)
i=0
Ans=[]
while(i<len(A)):
    p=A[i]
    count=1
    i+=1
    while(i<len(A) and p==A[i]):
        count+=1
        i+=1
    Ans.append(count)
real=0
for ele in Ans:
    real+=calc(ele)
print(real)


Measured memory_bytes: 64276
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a<b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define pb  push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLr(obj) (obj).rbegin(), (obj).rend()
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const double PI=3.14159265358979323846;
ll dp;

int main(){
   ll n,k,ans=0,a,b,c,d;
   string s;
   
   map<string,int> m{};

   cin>>a>>b>>c>>d;
   while(1){
      c-=b;
      if(c<=0){
         cout<<"Yes"<<endl;
         return 0;
      }
      a-=d;
      if(a<=0){
          cout<<"No"<<endl;
         return 0;
      }
   }
   cout<<ans<<endl;
}


Measured memory_bytes: 3628
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

using ll = long long;
const int inf = 99999999;

using namespace std;

const ll mod = 1e9 + 7;

int main(){
	ll n;
	cin >> n;
	if(n % 2 == 1 || n < 10){
		cout << 0 << endl;
		return 0;
	}
	ll ans = 0;
	ll i = 5;
	while(i <= n){
		ll p = (n / i);
		ans += (p / 2);
		i *= 5;
	}
	cout << ans << endl;
	return 0;
}
 


Measured memory_bytes: 3632
#include<bits/stdc++.h>
std::vector<int>A['   '];int N,M,S['   '],B,L,R,I;void U(int z,int u){while(z<=N)S[z]+=u,z+=z&-z;}main(){scanf("%d%d",&M,&N);for(;~scanf("%d%d",&L,&R);)A[R-L+1].push_back(L);for(L=1;L<=N;L++){B=M;for(I=L;I<=N;I+=L){R=I;while(R)B+=S[R],R-=R&-R;}for(int u:A[L])U(u,1),U(u+L,-1),M--;printf("%d\n",B);}}

Measured memory_bytes: 53760
#include <iostream>
#include <cstdint>
#include <vector>

int main()
{
	int64_t n, m;
	std::cin >> n >> m;
	int64_t total = 0;
	for (int64_t i = 0; i < m; ++i) {
		int64_t v = 0;
		std::cin >> v;
		total += v;
	}
	if (total <= n) {
		total = n - total;
	}
	else { total = -1; }
	std::cout << total << std::endl;

}


Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define F first
#define S second
using ll = long long;
const ll mod = 1000000007;
const ll infi = 1000000000000000;
const ll md = 998244353;
using namespace std;
using vl = vector<ll>;
using pll =  pair<ll,ll>;

void  solve(){
    int n,ans =0;
    ll cnt;
    cin>>n;
    string s;
    for(int i=1;i <= n;i++){
       if(i%10 == 0) continue;
       int a,b;
       a = i%10;
       int temp = i;
       while(temp>=10) temp = temp/10;
       b = temp;
       if(a == b ) ans++; 
       int num = a*10 + b;
       if(num<=n) ans++;
       //cout<<num<<" ";}
       string s = to_string(n),sans = "";
       cnt=0;
       if(s[0]-'0' < a){
           cnt = s.size() - 3;
       }
       else if(s[0] - '0' > a){
           cnt = s.size() -2;
       }
       else {
           if(b <= s[s.size() - 1] - '0'){
               for(int i=1;i<s.size()-1;i++) sans.push_back(s[i]);
               cnt = s.size() - 3;
           }
           else{
               int f = 1;
               for(int i=1;i<s.size()-1;i++){
                   if(s[i] != '0') {f = 0;break;}
               }
               if(f){
                   cnt = s.size() - 3;
               }
               else{
                   for(int i= s.size()-2;i>=1;i--){
                       if(s[i] =='0') s[i] = '9';
                       else{ s[i]--;break;}
                   }
                   for(int i=1;i<s.size()-1;i++) sans.push_back(s[i]);
                   cnt = s.size() - 3;
               }
           }
       }
        if(sans != ""){
            ans += stoi(sans)+1;
        }
        temp = 0;
        for(int i=0;i<cnt;i++) temp = temp*10 + 9;
        while(temp) ans+= temp,temp = temp/10;
        if(cnt > 0) ans+=cnt;
    }
    cout<<ans;
}
        
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //int n; cin>>n; for(int i=0;i<n;i++)
        solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
 
typedef long long ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (n); ++i)
const double PI=3.14159265358979323846;

using namespace std;

int main() {

	int a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;

	ll ans = 0;
	ll hoge = 0;

	if (c*2 < a + b) { // c買ったほうが得

		hoge = min(x, y);
		ans += c * hoge * 2;

		hoge = max(x, y) - min(x, y);
		if (x == max(x, y)) ans += a * hoge;
		else ans += b * hoge;

		if (ans > max(x, y)*2*c) ans = max(x, y)*2*c;

	} else {

		ans += a * x + b * y;
	}

	cout << ans << endl;
}

//printf("%ld\n", ans);

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int P,N[6];
const int coin[6] = {1,5,10,50,100,500};
 
int calc(int x){
    int res = 0;
    for(int i = 5 ; i >= 0 ; i--){
	if(x >= coin[i]){
	    res += x/coin[i];
	    x %= coin[i];
	}
    }
    return res;
}
 
int c(int x){
    int res = 0;
    for(int i = 5 ; i >= 0 ; i--){
	int use = x/coin[i];
	if(use > N[i]){
	    res += N[i];
	    x -= N[i]*coin[i];
	}else{
	    res += use;
	    x %= coin[i];
	}
    }
    return res;
}
 
int main(){
    while(cin >> P){
	int end = P;
	for(int i = 0 ; i < 6 ; i++){
	    cin >> N[i];
	    end += N[i];
	}
	if(end == 0) break;
	int res = (1<<29);
	for(int i = P ; i <= P+500 ; i++){
	    int x = c(i);
	    res = min(res,x+calc(i-P));
	}
	cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 3076
from itertools import permutations
N, M, R = map(int, input().split())
r = list(map(int, input().split()))
r = permutations(r, len(r))
INF = 10**10
dist = [[INF]*N for _ in range(N)]
for _ in range(M):
    a, b, c = map(int, input().split())
    dist[a-1][b-1] = dist[b-1][a-1] = c
for k in range(N):
    for i in range(N):
        for j in range(N):
            if dist[i][j] > dist[i][k] + dist[k][j]:
                dist[i][j] =  dist[j][i] = dist[i][k] + dist[k][j]
ans = INF
for i in r:
    tmp = 0
    for j in range(len(i)-1):
        tmp += dist[i[j]-1][i[j+1]-1]
    ans = min(ans, tmp)
print(ans)

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

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

	const string c = "CODEFESTIVAL2016";
	int cnt = 0;

	for ( int i = 0; i < c.size(); i++ ) {
		if ( s[i] != c[i] ) cnt++;
	}

	cout << cnt << endl;
}


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

using namespace std;

#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define _repis(i,a,b,s) for(int i=a, i##_len(b); i<i##_len; i+=s)
#define REP(...) _overload3(__VA_ARGS__,_repis,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl
#define POSS(n) cout<<((n)?"POSSIBLE":"IMPOSSIBLE")<<endl

int main(){
    string b="CODEFESTIVAL2016";
    string s;
    cin>>s;
    int ans=0;
    REP(i,16){
        if(s[i]!=b[i])ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////

struct UnionFind {
    // 根は大きさの負
    // それ以外は親を持つ
    vector<int> data;
    UnionFind(int size) : data(size, -1) {}
    int root (int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    bool unite (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;
        }
        return x != y;
    }
    bool same_root (int x, int y) {
        return root(x) == root(y);
    }
    int size (int x) {
        return -data[root(x)];
    }
};

int main() {
    int n, m, k; cin >> n >> m >> k;
    vector<vector<int>> fr(n), bl(n);
    UnionFind tree(n);
    rep(i,m) {
        int a, b; cin >> a >> b;
        a--; b--;
        fr[a].push_back(b);
        fr[b].push_back(a);
        tree.unite(a, b);
    }
    rep(i,k) {
        int c, d; cin >> c >> d;
        c--; d--;
        bl[c].push_back(d);
        bl[d].push_back(c);
    }

    rep(i,n) {
        int ans = tree.size(i) - 1;
        // cout << ans << " " << fr[i].size() << endl;
        ans -= fr[i].size();

        rep(j,bl[i].size()) {
            if (tree.same_root(bl[i][j], i)) ans--;
        }
        cout << ans << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 12152
/// Be Kind :)
#include <bits/stdc++.h>
using namespace std;
 
#pragma GCC optimize("O2,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("Os")

/*				We pop out at your party, I'm with the gang
				And it's gon' be a robbery, so tuck ya chain
				I'm a killer girl, I'm sorry, but I cannot change
				We ain't aiming for your body, shots hit you brain
				We come from poverty, man, we ain't have a thing
				It's a lot of animosity, but they won't say my name
				Them killers rock with me, lil' nigga, don't get banged
				'Cause they'll do that job for me while I hop on a plane	*/

/*				I take you to the candy shop								*/

/*				Baby, let me put your panties to the side
				I'ma make you feel alright
				'Cause I'ma give you what you need, yeah					*/

/*				Ooooh ooh, it's me, myself and I
				Solo ride until I die, 'cause I got me for life				*/

/*				So I ball So hard, muh'fuckas wanna find me					*/

/*				Bitch, where you when I was walkin'?
				Now I run the game, got the whole world talkin'				*/
 
/*				Niggas been counting me out
				I'm counting my bullets, I'm loading my clips
				I'm writing down names, I'm making a list					*/

/*				Fuck your friendship, I meant it							*/

/*				The Chanel or Balenciaga, Louis and Vuitton
				She know I got Fendi, Prada when I hit Milan				*/

/*				I ran away, I don't think I'm coming back home				*/
 
#define F first
#define S second
#define pb push_back
#define SZ(x) (ll)(x.size())
#define all(x) x.begin(),x.end()
 
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
 
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ll maxn=1e6+10, maxm=1e5+10, lg=21, mod=998244353, inf=1e18;

const int N=1e5+5;
int n,m,a[N],b[N],i,j,d[N],st[N],stt[N],w,mx;
vector<int>e[N];
bool vi[N],bb[N];
bool dfs(int x,int fe){
	vi[x]=1;st[++w]=fe;stt[w]=x;
	for(int i:e[x])if(i!=fe && !bb[i]){
		int y=a[i]^b[i]^x;
		if(vi[y]){
			bb[i]=1;for(;stt[w]!=y;)bb[st[w--]]=1;
			return 1;
		}
		if(dfs(y,i))return 1;
	}
	--w;
}

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	
	scanf("%d%d",&n,&m);
	for(i=1;i<=m;++i)scanf("%d%d",a+i,b+i),d[a[i]]++,d[b[i]]++,e[a[i]].push_back(i),e[b[i]].push_back(i);
	for(i=1;i<=n;mx=max(mx,d[i++]))if(d[i]&1)break;
	bool ans=i>n && m-n>1;
	if(mx==4 && m-n==2){
		for(i=0;i<3;++i){
			memset(vi+1,0,n);
			for(j=1;j<=n;++j)if(w=0,dfs(j,0))break;
			if(j>n)break;
		}
		if(i<3)ans=0;
	}
	puts(ans?"Yes":"No");
	
	return 0;
}






Measured memory_bytes: 11008
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner {stdin: s.lock() };
    let n: usize = sc.read();
    let mut  v: Vec<u64> = sc.vec(n);
    v.sort();
    let mut ans = ((v[0] + v[1]) as f64) / 2.0;
    for i in 2..n {
        ans = (ans + v[i] as f64) / 2.0;
    }
    println!("{}", ans);
}
pub struct Scanner<R> {
    stdin: R,
}


impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr> (&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe{ std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}

Measured memory_bytes: 4352
#include <stdio.h>
#include <stdlib.h>
int compare_int(const void *a, const void *b)
{
    return *(int*)b - *(int*)a;
}

int main(void)
{
    int n,k;
    scanf("%d%d",&n,&k);
    int a[n];
    int s[200001]={0};
    for(int p=0;p<n;p++)
    {
        scanf("%d",&a[p]);
        int aa=a[p];
        s[aa]++;
    }
    qsort(s,200001,sizeof(s[1]),compare_int);
    int ans=n;
    for(int r=0;r<k;r++)
    {
        ans=ans-s[r];
    }
    printf("%d",ans);
}


Measured memory_bytes: 2556
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;
template <class T>
bool chmax(T &a, const T &b)
{
	if (a < b)
	{
		a = b;
		return 1;
	}
	return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
	if (a > b)
	{
		a = b;
		return 1;
	}
	return 0;
}

ll M = 1000000007;

void solve()
{
	int n;
	ll K;
	cin >> n >> K;
	vector<int> a(n);
	vector<int> times;// 1 indexed
	times.push_back(1);
	rep(i, n)
	{
		cin >> a[i];
	}
	int now = 1;
	map<int, int> visited; // visited[move]=place
	visited[1] = 0;
	int cylen = 0;
	int lastvisit = 0;
	//bool dag = false;
	int move = 1;
	while (1)
	{

		now = a[now - 1];
		
		if (visited[now])
		{
			lastvisit = visited[now];
			cylen = move - visited[now];
			//times.push_back(now);
			break;
		}
		else
		{
			visited[now] = move;
		}
		move++;
		times.push_back(now);
	}
	vector<int> cycle;// 0-indexed [lastvisit, nextvisit)
	rep(i, cylen)
	{
		cycle.push_back(times[i + lastvisit]);
		//cycle[0]=times[lastvisit]
		//cout<<" "<<cycle[i]<<endl;
	}
	int dest = 0;
	//  K = K回移動
	//	lastvisit = move =ite+1
	if (K >= lastvisit)
	{
		K -= lastvisit;
		//K=K-(lastvisit-1) 
		K %= cylen;
		dest = cycle[K];
	}
	else
	{
		dest = times[K];
	}
	cout << dest << endl;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
	return 0;
}


Measured memory_bytes: 14932
n = gets.to_i
ary = gets.split.map(&:to_i)
max = 0
for i in 0 .. n - 1
  if max < ary[i]
    max = ary[i]
  end
  if ary[i] < max - 1
    puts :No
    exit
  end
end
puts :Yes


Measured memory_bytes: 8580
#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(a) ((a).begin(), (a).end())
typedef long long ll;
// const long long INF = 1LL << 60;
const int INF = 1010101010;
// using Graph = vector<vector<int>>;
const int MOD = 1000000007;

int main() {
  ll h, w;
  cin >> h >> w;
  if (h == 1 || w == 1)
    cout << 1 << endl;
  else
    cout << ((h + 1) / 2) * ((w + 1) / 2) + (h / 2) * (w / 2) << endl;
}


Measured memory_bytes: 256
/*
--------------              |   /
      |                     |  /
      |                     | /
      |             *       |/          |    |         ------            *
      |                     |           |    |        /      \
      |             |       |\          |    |       |       |\          |
   \  |             |       | \         |    |       |       | \         |
    \ |             |       |  \        |    |        \     /   \        |
     V              |       |   \        \__/|         -----     \       |
*/
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);
#define mem(i,j) memset(i,j,sizeof (i));
using ll = int64_t;
using ull = uint64_t;
using ld = long double;
using uint = uint32_t;
const double EPS  = 1e-8;
const int INF     = 0x3F3F3F3F;
const ll LINF     = 4611686018427387903;
const int MOD     = 1e9+7;
/*-----------------------------------------------------------------------------------------------------*/

const int N = 300;
double dp[N + 2][N + 2][N + 2];

signed main() {
	EmiliaMyWife

	int n;
	cin >> n;
	int a[4] = {0};
	for(int i = 0, x; i < n; i++)
		cin >> x, a[x]++;
	for(int k = 0; k <= N; k++)
		for(int j = 0; j <= N; j++)
			for(int i = 0; i <= N; i++) {
				if(i)
					dp[i][j][k] += (dp[i - 1][j][k]) * i / n;
				if(j)
					dp[i][j][k] += (dp[i + 1][j - 1][k]) * j / n;
				if(k)
					dp[i][j][k] += (dp[i][j + 1][k - 1]) * k / n;
				if(i + j + k)
					dp[i][j][k] = (dp[i][j][k] + 1) * n / (i + j + k);
			}
	cout << setprecision(10);
	cout << dp[a[1]][a[2]][a[3]] << '\n';

	return 0;
}


Measured memory_bytes: 218252