akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
 
int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int l= a + b;
  int r = c + d;
  if(r == l)
    cout << "Balanced" << endl;
  if( r > l)
    cout << "Right" << endl;
  if(r < l)
    cout << "Left" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define inf 1000000007
#define mod 1000000007
//#pragma GCC optimize(2)
#define int long long
using namespace std;
template <typename T> void read(T &x){
	x=0;char ch=getchar();int fh=1;
	while (ch<'0'||ch>'9'){if (ch=='-')fh=-1;ch=getchar();}
	while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	x*=fh;
}
template <typename T> void write(T x) {
	if (x<0) x=-x,putchar('-');
	if (x>9) write(x/10);
	putchar(x%10+'0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
int n,m,l;
int h[300005],w[300005];
int r[300005],c[300005];
int mxr,mxc;
signed main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>m>>l;
	for(int i=1;i<=l;i++)
	{
		cin>>h[i]>>w[i];
		r[h[i]]++;
		c[w[i]]++;
	}
	mxr=*max_element(r+1,r+n+1),mxc=*max_element(c+1,c+m+1);
	int cnt1=0,cnt2=0;
	for(int i=1;i<=n;i++)
		if(r[i]==mxr)
			cnt1++;
	for(int i=1;i<=m;i++)
		if(c[i]==mxc)
			cnt2++;
	int cnt3=cnt1*cnt2;
	int cnt4=0;
	for(int i=1;i<=l;i++)
	{
		if(r[h[i]]==mxr&&c[w[i]]==mxc)
			cnt4++;
	}
	if(cnt3>cnt4) cout<<mxr+mxc<<endl;
	else cout<<mxr+mxc-1<<endl;
	return 0;
}

Measured memory_bytes: 12980
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    string s;
    cin>>s;
    int n=s.size(),cnt=0;
    rep(i,n){
        rep(j,n){
            if(s[i]==s[j]) cnt++;
        }
    }
    if(cnt>n) cout<<"no";
    else cout<<"yes";
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(void){
    // Your code here!
    int a,b,k=0;
    cin>>a>>b;
    int x,y;
    for(int i=0;i<a;i++){
        cin>>x>>y;
        if(sqrt(x*x+y*y)<=b){
            k++;
        }
    }
    cout<<k;
}


Measured memory_bytes: 3672
n = int(input())
a = list(map(int, input().split()))
a_dic = {}

a.sort(reverse=True)
for i in a:
    a_dic[i] = a_dic.get(i, 0) + 1

h = [0, 0]
for i in range(2):
    for j in a:
        if a_dic[j] >= 2:
            h[i] = j
            a_dic[j] -= 2
            break

print(h[0]*h[1])


Measured memory_bytes: 17960
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll N, M; cin >> N >> M;

	ll res = 0LL;
	if (M >= 2 * N){
		res += N;
		M -= 2LL * N;
	}else{
		res += M / 2LL;
		M -= (M / 2LL) * 2LL;
	} // end if

	res += M / 4LL;
 
	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long a,arr[10010],brr[10010];
int main(){
	
	scanf("%lld",&a);
	for(int i=0;i<a;i++){
		scanf("%lld",&arr[i]);
	}
	for(int i=0;i<a;i++){
		scanf("%lld",&brr[i]);
	}
	long long tot=0,t=0;
	for(int i=0;i<a;i++){
		tot+=max((long long)0,brr[i]-arr[i])/2;
		t+=max((long long)0,arr[i]-brr[i]);
	}
	if(t<=tot){
		printf("Yes\n");
	}
	else printf("No\n");
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    Func cin2;
    void calc()
    {
        cin = new Scanner();
        cin2 = new Func();
        int[] NP=cin.ArrayInt(2,0);
        int[] a=cin.ArrayInt(NP[0],0);
        int oddcount=0;
        double ans=0;
        for(int i=0;i<NP[0];i++)
        {
          if(a[i]%2==1)oddcount++;
        }
        if(oddcount==0&&NP[1]==1)ans=0;
        else if(oddcount==0)ans=Math.Pow(2,NP[0]);
        else ans=Math.Pow(2,NP[0]-1);
        Console.WriteLine(ans);
        
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Answer
{
    public static void Int2DArrayAns(int[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }//Answer.IntArrayAns(x);
    public static void Char2DArrayAns(char[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
}

class Func
{
    public long GCDLong(long a, long b)
    {
        while(a!=0)
        {
          long t=a;
          a=b%a;
          b= t;
        }
      
        return b;        
    }
}

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

int main()
{
  int N, M; cin >> N >> M;
  vector<vector<int>> A(N, vector<int>(M, 0));
  vector<int> K(N, 0);
  for (int i = 0; i < N; i++)
  {
    cin >> K[i];
    for (int j = 0; j < K[i]; j++)
    {
      cin >> A[i][j];
     }
  }

  int cnt = 0;
  for (int k = 1; k <= M; k++)
  {
    int suki = 0;
    for (int i = 0; i < N; i++)
    {
      int chk = 0;
      for (int j = 0; j < K[i]; j++)
      {
        if (A[i][j] == k) chk = 1;
      }
      if (chk == 0) suki = 1;
    }
    if (suki == 0)cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

class AtCoder
{
    public void Slove()
    {
        var array =
            Enumerable.Range(0, 5)
            .Select(x => int.Parse(Console.ReadLine()))
            .ToArray();
        int a = 10;
        int sum = 0;
        foreach(int num in array)
        {
            sum += num / 10 * 10;
            int b = num % 10;
            if (b != 0)
            {
                sum += 10;
                a = Math.Min(a, b);
            }
        }
        int c = 10 - a;
        Console.WriteLine(sum - c);
    }
    static void Main()
    {
        var ac = new AtCoder();
        ac.Slove();
    }
}

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

int main(){
  int n,mi=1000000000;
  cin >> n;
  vector<int> v(n,0);
  r(i,n)cin >> v.at(i);
  sort(v.begin(),v.end());
  for(int i = v.at(0); i < v.at(n-1)+1; i++){
    int sum=0;
    r(j,n)sum+=(v.at(j)-i)*(v.at(j)-i);
    mi=min(sum,mi);
  }
  cout << mi << endl;
}

Measured memory_bytes: 256
import java.util.*;


public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int h = sc.nextInt();
        int w = sc.nextInt();
        char[][] c = new char[h][w];
        int acount=w;
        
        for(int i=0; i<h; i++){
            String  s = sc.next();
            for(int j=0; j<w; j++){
                c[i][j] = s.charAt(j);
            }
        }
        
        int[] gyou = new int[h];
        for(int i=0; i<h; i++){
            int flg = 0;
            for(int j=0; j<w; j++){
                if(c[i][j]=='#'){
                    flg = 1;
                }
            }
            if(flg == 0){
                for(int j=0; j<w; j++){
                    c[i][j]='0';
                }
                gyou[i]=0;
            }else{
                gyou[i]=1;
            }
        }
        
        for(int j=0; j<w; j++){
            int flg = 0;
            for(int i=0; i<h; i++){
                if(c[i][j]=='#'){
                    flg = 1;
                }
            }
            if(flg == 0){
                for(int i=0; i<h; i++){
                    c[i][j]='0';
                }
            }
        }
        
        for(int i=0; i<h; i++){
            int j=0;
            for(j=0; j<w; j++){
                if(c[i][j]!='0'){
                    System.out.print(c[i][j]);
                }
            }
            if(j==w && gyou[i]==1){
                System.out.println();
            }
            //System.out.print(j);
            //System.out.println(acount);
        }
    }
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;


vector<ll>memo;
vector<P>cnt;
vector<ll>co;
ll loop;
vector<ll>a;
ll s;
bool flg=true;
void dfs(ll v,ll i){
    co[v]++;
    if(co[v]>3)return;
    if(co[v]>1){
        memo.push_back(v);
        if(co[v]==2) {
            cnt[v].first = i;
            if(flg){
                s=i;
                flg=false;
            }
        }
        if(co[v]==3){
            cnt[v].second=i;
            loop=cnt[v].second-cnt[v].first;
        }
    }
    dfs(a[v],i+1);
}

int main(){
    ll n,k;cin >>n>>k;
    a.resize(n);
    co.assign(n,0);
    cnt.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >>a[i];
        a[i]--;
    }
    dfs(0,0);
    ll ans;
//    for(auto i:memo){
//        cout <<i <<endl;
//    }
//    cout <<s<<" "<<loop <<endl;
    if(k<s){
        ll key=0;
        while(k>0){
//            cout <<key <<endl;
            key=a[key];
            k--;
        }
        ans=key+1;
    }
    else {
        k -= s;
        ans = memo[k % loop] + 1;
    }
    cout <<ans <<endl;
    return 0;
}

Measured memory_bytes: 29668
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back
#define sz(x) int(x.size())

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind{
public:
  vi Parent;
  UnionFind(int n){
    Parent = vi(n,-1);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    else return Parent[a] = root(Parent[a]);
  }

  int size(int a){
    return -Parent[root(a)];
  }

  bool merge(int a, int b){
    a = root(a);
    b = root(b);
    if(a == b) return false;

    if(size(a) < size(b)) swap(a,b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }
};

class Factrial{
public:
  vl Fac;
  Factrial(int MAX){
    Fac = vl(MAX+1);
    rep(i,MAX) {
      if(i == 0) Fac[i+1] = 1;
      else Fac[i+1] = ((i+1)*Fac[i])%MOD;
    }
  }
};

ll lcm(ll a, ll b){
  return a*b/gcd(a,b);
}
int main(){
  ll H; cin >> H;
  ll ans = 0;
  ll two = 1;
  while(true){
    if(two > H) break;
    ans += two;
    two *= 2;
  }
  cout << ans << endl;
}

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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

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

const int INF = 1e9;

int main(void){

	string S; cin >> S;
	if(S[2] == S[3] and S[4] == S[5]) cout << "Yes" << endl;
	else cout << "No" << endl;


	return 0;

}


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

using namespace std;

bool compare(vector<long long> i1, vector<long long> i2) 
{ 
    return (i1[1] > i2[1]); 
} 

int main() {
    long long n,m;
    vector<long long> a;
    vector<vector<long long> > bc;
    cin >> n >> m;

    for(long long i=0; i<n; i++) {
        long long tmp;
        cin >> tmp;
        a.push_back(tmp);
    }

    for(long long i=0; i<m; i++) {
        long long tmp;
        vector<long long> vtmp;
        cin >> tmp;
        vtmp.push_back(tmp);
        cin >> tmp;
        vtmp.push_back(tmp);
        bc.push_back(vtmp);
    }
    
    sort(a.begin(), a.end());
    sort(bc.begin(), bc.end(), compare);

    // cout << endl;
    // for(long long i=0; i<n; i++) {
    //     cout << a[i] << " ";
    // }
    // cout << endl << endl;
    // for(long long i=0; i<m; i++) {
    //     cout << bc[i][0] << " " << bc[i][1] << endl;
    // }
    // cout << endl << endl;
    long long i,j;
    i = j = 0;

    while( a[i] < bc[j][1] ) {
        if( bc[j][0] > 0 ) {
            a[i] = bc[j][1];
            i++;
            if( i > n-1 ) {
                break;
            }
            bc[j][0]--;
        } else {
            j++;
            if( j > m-1 ) {
                break;
            }
        }
    }
    long long ans = 0;
    for(long long i=0; i<n; i++) ans += a[i];
    cout << ans << endl;
}


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

using namespace std;

int main(){
	int minx=0,miny=0,maxx,maxy,n,x,y,a;
	cin >> maxx >> maxy >> n;
	for(int i=0;i<n;++i){
		cin >> x >> y >> a;
		if(a==1)minx = max(minx,x);
		else if(a==2)maxx = min(maxx,x);
		else if(a==3)miny = max(miny,y);
		else maxy = min(maxy,y);
	}
	int ky = max(0,maxy-miny);
	int kx = max(0,maxx-minx);
	cout << ky*kx << endl;
}

Measured memory_bytes: 764
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;
#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)
int main(){
    string s[3];
    REP(i,3)cin>>s[i];
    REP(i,3)cout<<s[i][i];
    cout<<endl;
}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long int
#define INF 1000000007
#define llINF 1000000000000000007
// cin.eof() 入力個数の問題

int main() {
int n;
cin >> n;
string s;
cin>>s;
map<char,ll>m;
rep(i,n){
m[s[i]]++;
} 
ll ans=m['R']*m['G']*m['B'];
ll count=0;
rep(i,n){
  rep(j,n){
  int k=2*j-i;
  if(k<0||k>=n) continue;
  if(s[j]!=s[i]&&s[i]!=s[k]&&s[k]!=s[j]) count++;
    }
}
cout<<ans-count/2<<endl;
  return 0;
}


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

using namespace std;
int main()
{
    int m,n,s=0;
    cin>>m>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
        s=s+a[i];
    }
    (s>=m)? cout<<"Yes"<<endl : cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 640
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  Name:- OMHARI 
  Institution:- UNIVERSIT OF CALCUTTA(INFORMATION TECHNOLOGY)
  Email:- omharicu@gmail.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include<bits/stdc++.h>
using namespace std; 

#define F               first
#define S               second
#define ull             unsigned long long
#define ll              long long
#define db              long double
#define ST              string
#define pb              push_back
#define mp              make_pair
#define el              "\n"
#define vll             vector <ll>
#define vi              vector <int>
#define pii             pair <int, int>
#define pll             pair <ll, ll>
#define vec(v)          vector <v>
#define all(v)          (v.begin(), v.end()) 
#define rall(v)         (v.rbegin(), v.rend()) 
#define is_sort(v)      is_sorted all(v)
#define max_of(v)       *max_element all(v)
#define min_of(v)       *min_element all(v)
#define itos(s)         to_string(s)
#define cntone(x)       __builtin_popcountll(x)
#define cntzro(x)       __builtin_clz(x)
#define clr(x,y) 		memset(x, y, sizeof(x))
#define For(i, a, b)    for(int i=a; i<b; i++)
#define Forr(i, a, b)   for(int i=a; i>=b; i--)
const ll mod = 1e9+7;

void solve()
{
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll t1=a*c;
    ll t2=a*d;
    ll t3=b*c;
    ll t4=b*d;
    cout<<max(t1, max(t2, max(t3, t4)));
    // cout<<
    // cout<<(b*d);
}

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

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    /***************-Code starts from here-***************/
    // int t;
    // cin>>t;
    // while(t--)
    solve();
    return 0; 
} 

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

int main () {
  int N, M;
  cin >> N >> M;
  long ans = 1; 
  if (N == M-1 || N == M+1) {
    for (int i = 1; i <= N; i++) {
      ans *= i;
      ans %= 1000000007;
    }
    for (int i = 1; i <= M; i++) {
      ans *= i;
      ans %= 1000000007;
    }
  }
  else if (N == M) {
    for (int i = 1; i <= N; i++) {
      ans *= i;
      ans %= 1000000007;
    }
    for (int i = 1; i <= M; i++) {
      ans *= i;
      ans %= 1000000007;
    }
    ans *= 2;
    ans %= 1000000007;
  }
  else ans = 0;
  cout << ans << endl;
}

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

int main(){
	int k,a,b;
	cin>>k>>a>>b;
	long long ans=1;
	while(k){
		if(b-a>2 && k>=2 && ans>=a){
			ans += b-a;
			k -= 2;
		}
		else {
			++ans;
			--k;
		}
	}
	cout<<ans<<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++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

signed main() {
    int n;
    cin >> n;
    int mx = 0;
    int a[n];
    rep(i, n) {
        cin >> a[i];
        mx = max(mx, a[i]);
    }
    int mn = (mx + 1) / 2;
    sort(a, a + n);
    if (mx % 2 == 0) {
        if (a[0] != mn || a[1] == mn) {
            cout << "Impossible" << endl;
            return 0;
        }
    } else {
        if (a[0] != mn || a[1] != mn || a[2] == mn) {
            cout << "Impossible" << endl;
            return 0;
        }
    }
    int cnt[mx + 1] = {};
    for (int i = (mx % 2 == 0 ? 1 : 2); i < n; i++) {
        cnt[a[i]]++;
    }
    for (int i = mn + 1; i <= mx; i++){
        if(cnt[i] < 2){
            cout << "Impossible" << endl;
            return 0;
        }
    }
    cout << "Possible" << endl;
    return 0;
}

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

using namespace std;

int D[101010];
int n, q, s;

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

	int i, u, v;

	cin >> n >> q;

	for(; q --; ){
		cin >> u >> v;
		D[u] ++; D[v] ++;
	}

	for(i = 1; i <= n; i ++){
		s |= D[i];
	}

	cout << (s & 1? "NO" : "YES");

	return 0;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=(n); i--)
#define LREP(lst,itr) for(auto itr = lst.begin(); itr != lst.end(); ++itr)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define P(s) cout<<(s)<<endl
#define P2(a, b) cout<<(a)<<" "<<(b)<<endl
#define P3(a, b, c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl
#define V2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main(){
    int N,K,tmp,ans=0;
    cin >> N >> K;
    REP(i,0,N){
        cin >> tmp;
        if(tmp>=K) ans++;
    }
    P(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct Edge{
    ll to, weight;
    Edge(ll t, ll w) : to(t), weight(w){}
};
using graph = vector<vector<ll>>;
using Graph = vector<vector<Edge>>;


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

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    ll a, v, b, w, t;
    cin>>a>>v>>b>>w>>t;

    string ans = "NO";
    if(v <= w){
        ans = "NO";
    }else if(abs(a - b) + w * t <= v * t){
        ans = "YES";
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3624
s = input()
t = input()

ans = "UNRESTORABLE"

memo = -1

for i in range(len(s) - len(t) + 1):
    count = 0
    for j in range(len(t)):
        if s[i+j] == t[j] or s[i+j] == "?":
            count += 1
        else:
            break
        if count == len(t):
            ans = t
            memo = i

if ans == "UNRESTORABLE":
    print(ans)
else:
    ans1 = ""
    for word in s:
        if word == "?":
            ans1 += "a"
        else:
            ans1 += word
    ans2 = ans1[0:memo] + ans + ans1[memo+len(t):]
    print(ans2)

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

void solve(int n,int m){
    vector<string> e(n);
    string ts;
    rep(i,0,n) cin >> e[i];
    rep(i,0,m){
        string t;
        cin >> t;
        ts+=t;
    }

    vector<int> sum_len(1<<n);
    rep(i,0,1<<n){
        rep(j,0,n){
            if(((i>>j)&1)==0) continue;
            sum_len[i]+=e[j].size();
        }
    }

    static bool p[5000][1<<12];
    fill_n((bool*)p,int64_t(5000)*(1<<12),false);
    vector<vector<int>> heads(ts.size());
    rep(i,0,ts.size()) p[i][0]=true;
    rep(i,0,ts.size()){
        rep(j,0,n){
            if(i+e[j].size()>ts.size() or e[j]!=ts.substr(i,e[j].size())) continue;
            p[i][1<<j]=true;
            heads[i].push_back(j);
        }
    }
    int ans=0;
    for(int i=ts.size()-1; i>=0; --i){
        rep(j,1,1<<n){
            if(p[i][j] or i+sum_len[j]>ts.size()) continue;
            for(int k:heads[i]){
                if(((j>>k)&1)==0) continue;
                int i2=i+e[k].size();
                if(p[i2][j&(~(1<<k))]){
                    p[i][j]=true;
                    break;
                }
            }
        }
        if(p[i][(1<<n)-1]) ++ans;
    }
    cout << ans << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    for(;;){
        int n,m;
        cin >> n >> m;
        if(n==0 and m==0) break;
        solve(n,m);
    }
    return 0;
}

Measured memory_bytes: 23484
import numpy as np

H,W=map(int,input().split())
field=[list(input()) for i in range(H)]

field=[i for i in field if "#" in i]

field=np.array(field)
#print(field)

field=np.rot90(field,k=1)
field=field.tolist()

field=[i for i in field if "#" in i]

field=np.rot90(field,k=-1)
field=field.tolist()

#print(field)
for i in field:
    print("".join(i))

Measured memory_bytes: 12536
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <set>
#include <sstream>
#include <string>
#include <queue>
#include <vector>
using namespace std;

#define rep(i,n) for(int i=0; i<(n); ++i)
#define rrep(i,n) for(int i=1; i<=(n); ++i)
#define drep(i,n) for(int i=(n)-1; i>=0; --i)
#define foreach(it, v) for(typeof(v.begin()) it=v.begin(); it!=v.end(); ++it)
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second

typedef unsigned int uint;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef set<int> si;

//MOD//
const ll MOD = 1000000007;
struct big;
big ex(big a, ll tms);
typedef struct big{
  ll val;
  big():val(0){}
  big(ll val):val((val%MOD+MOD)%MOD){}
  big& operator += (const big& obj){ (val+=obj.val)%=MOD; return *this;}
  big& operator -= (const big& obj){ (val+=MOD-obj.val)%=MOD; return *this;}
  big& operator *= (const big& obj){ (val*=obj.val)%=MOD; return *this;}
  big& operator /= (const big& obj){ (val*=ex(obj,MOD-2).val)%=MOD; return *this;}
  big operator + (const big& obj)const{ return big(*this) += obj;}
  big operator - (const big& obj)const{ return big(*this) -= obj;}
  big operator * (const big& obj)const{ return big(*this) *= obj;}
  big operator / (const big& obj)const{ return big(*this) /= obj;}
  bool operator < (const big& obj)const{ return val < obj.val;}
  bool operator == (const big& obj)const{ return val == obj.val;}
} big;
istream& operator >> (istream& i, big& obj){ i>>obj.val; return i;}
ostream& operator << (ostream& o, const big& obj){ o<<obj.val; return o;}
big ex(big obj, ll tms){
  if(!tms) return 1;
  big ret = ex(obj, tms/2);
  ret *= ret;
  return (tms&1) ? ret*obj : ret;
}
//MOD//

ll pow(ll n, int m){
  if(!m) return 1;
  ll ret = pow(n, m/2);
  ret *= ret;
  return (m&1) ? ret*n : ret;
}

template <class F, class T>
void convert(const F &f, T &t){
  stringstream ss;
  ss << f;
  ss >> t;
}


int main(){
  int K, T;
  scanf("%d%d",&K,&T);
  int a[T];
  rep(i,T) scanf("%d",&a[i]);
  sort(&a[0],&a[T]);
  int ans = max(0,a[T-1]*2-K-1);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define rev(v) reverse(v.begin(), v.end())
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
#define uniq(a) sort(all(a));(a).resize(unique(all(a)) - a.begin());
#define dab(v) for(auto i:v)cout<<i<<' '; cout << endl;
#define vin(v) for (ll i = 0; i < v.size(); ++i) cin >> v[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 (a > b) { a = b; return 1; } return 0; }
int dx[] = { 0, 0, -1, 1 };
int dy[] = { 1, -1, 0, 0 };
int gcd(int a, int b) { if (a % b == 0) { return(b); } else { return(gcd(b, a % b)); } }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
	int N;
	cin >> N;
	vector<string> A(N);
	rep(i, N) {
		cin >> A.at(i);
	}
	sort(all(A));

	int cnt = 1;
	rep(i, N - 1) {
		if (A.at(i) != A.at(i + 1))cnt++;
	}
	cout << cnt;
	return 0;
}


Measured memory_bytes: 9524
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

struct UnionFind {
    vector<int> data;
    UnionFind(int size) : data(size, -1) { }
    bool 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;
        }
        return x != y;
    }
    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 solve(){
    ll res = 0;
    int N,M; cin >> N >> M;
    vector<int> p(N); for(auto& in:p){ cin >> in; in--;}
    UnionFind UF(N);
    while(M--){
        int x,y; cin >> x >> y;
        x--; y--;
        UF.unionSet(x,y);
    }
    for(int i = 0; i < N;i++){
        if(UF.root(p[i]) == UF.root(i)) res++;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}


Measured memory_bytes: 1024
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		int[] V = new int[N];

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

		int dif = 0;

		for (int i = 0; i < V.length; i++) {
			int C = sc.nextInt();
			if (V[i] - C > 0) {
				dif += V[i] - C;
			}
		}

		PrintWriter out = new PrintWriter(System.out);
		out.println(dif);

		out.flush();
	}

}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  // rep(i, 10) {
  //   cout << i << endl;
  // }
  string s;
  cin >> s;

  if (s == string("Sunny")) {
    cout << "Cloudy" << endl;
  }
  if (s == string("Cloudy")) {
    cout << "Rainy" << endl;
  }
  if (s == string("Rainy")) {
    cout << "Sunny" << endl;
  }


  return 0;
}


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

typedef long long ll;
const int N = 1054, mod = 1000000007;

int n, A, B, C, D;
int fact[N], finv[N];
int dp[2][N], *cur = *dp, *nxt = dp[1];

ll PowerMod(ll a, int n, ll c = 1) {for (; n; n >>= 1, a = a * a % mod) if (n & 1) c = c * a % mod; return c;}

void init() {
	int i;
	for (*fact = i = 1; i < N; ++i) fact[i] = (ll)fact[i - 1] * i % mod;
	--i, finv[i] = PowerMod(fact[i], mod - 2);
	for (; i; --i) finv[i - 1] = (ll)finv[i] * i % mod;
}

int main() {
	int i, j, k, ij, I; init();
	scanf("%d%d%d%d%d", &n, &A, &B, &C, &D);
	*nxt = 1;
	for (i = A; i <= B; ++i) {
		memcpy(cur, nxt, (n + 1) << 2), I = PowerMod(finv[i], C);
		for (j = C, ij = i * j; j <= D && ij <= n; ++j, ij += i, I = (ll)I * finv[i] % mod)
			for (k = ij; k <= n; ++k) nxt[k] = (nxt[k] + (ll)cur[k - ij] * I % mod * finv[j]) % mod;
	}
	printf("%d\n", int((ll)nxt[n] * fact[n] % mod));
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		
		int []a = new int[7];
		
		for(int i = 1; i < 7; i++) {
			a[i] = sc.nextInt();
		}
		
		char []b = sc.next().toCharArray();
		for(int j = 0; j < b.length; j++) {
			if(b[j] == 'S') {
				a[0] = a[2];
				a[2] = a[1];
				a[1] = a[5];
				a[5] = a[6];
				a[6] = a[0];
			}
			else if(b[j] == 'N') {
				a[0] = a[2];
				a[2] = a[6];
				a[6] = a[5];
				a[5] = a[1];
				a[1] = a[0];
			}
			else if(b[j] == 'W') {
				a[0] = a[1];
				a[1] = a[3];
				a[3] = a[6];
				a[6] = a[4];
				a[4] = a[0];
			}
			else{
				a[0] = a[1];
				a[1] = a[4];
				a[4] = a[6];
				a[6] = a[3];
				a[3] = a[0];
			}
		}
		sc.close();
		System.out.println(a[1]);
	}
}



Measured memory_bytes: 26416
#include <stdio.h>

int main(){
    char S[3];
    char T[3];

    scanf("%s", S);
    scanf("%s", T);

    int count = 0;
    for(int i = 0; i < 3; i++){
        if(S[i] == T[i]){
            count++;
        }
    }
    printf("%d", count);

}

Measured memory_bytes: 128
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;

int main() {
    int N;
    cin >> N;
    vector<char> ans;
    vector<vector<int>> A(26, vector<int>(N, 0));
    rep(i, N) {
        string s;
        cin >> s;
        rep(j, s.size()) {
            int a = s[j] - 'a';
            A[a][i]++;
        }
    }

    rep(i, 26) {
        bool judge = 1;
        int num = 1e9;
        rep(j, N) {
            if (A[i][j] == 0) {
                judge = 0;
                break;
            }
            num = min(num, A[i][j]);
        }

        if (judge) {
            rep(k, num) { ans.push_back(i + 'a'); }
        }
    }

    sort(all(ans));
    rep(i, ans.size()) { cout << ans[i]; }
    cout << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define era(t) t.erase(unique(be(t)),t.end())
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin>>n;
    cin>>s;
    int num=0;
    for(int i=0;i<n;i++){
        if(s[i]=='R')num++;
        else num--;
    }
    if(num>0)cout <<"Yes"<<endl;
    else cout << "No"<<endl;
    return 0;
}





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

int main(){
    char s[11];
    char t[11];
    int flag = 0;
    
    scanf("%s",s);
    scanf("%s",t);
    
    for(int i = 0; i < strlen(s); i++){
        if(s[i] != t[i]){
            flag = 1;
            break;
        }
    }
    
    if(flag == 0) printf("Yes\n");
    else printf("No\n");
    return 0;
}


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

using namespace std;

int main() {
  int n; cin >> n;
  vector <int> a(n - 1);
  for(auto &x : a) cin >> x;
  int ans = 0;
  for(int i = 0; i < n - 2; i++) {
    ans += min(a[i], a[i + 1]);
  }
  ans += a[0] + a[n - 2];
  cout << ans << '\n';
}

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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
signed main(){
	int A;cin>>A;
  	int B;cin>>B;
  	int C;cin>>C;
  	string ans;
  	if((A<C&&C<B)||(A>C&&C>B)){
    	ans="Yes";
      
    }else{
    	ans="No";
    }
  	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define mkt make_tuple
#define no {cout << -1; return;}

void solve() {
    string s; cin >> s;
    int ans = 0;
    for (char c : s)
        ans += c - '0';
    cout << (ans % 9 ? "No" : "Yes");
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //int t; cin >> t; loop(i, t)
    solve();
    return 0;
}

Measured memory_bytes: 3780
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class Main {

	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<Double> list = new ArrayList<>();
		while (true) {
			try {
				Integer.valueOf(br.readLine());
				String aaa = br.readLine();
				String[] bbb = aaa.split(" ");
				List<String> tmp = Arrays.asList(bbb);
				ArrayList<String> tmp2 = new ArrayList<String>(tmp);
				for (String t : tmp2) {
					list.add(Double.parseDouble(t));
				}
				
				Collections.sort(list);
				Collections.reverse(list);
				double newValue = 0;
				while (list.size() != 1) {
					newValue = list.get(list.size() - 1) + list.get(list.size() - 2);
					newValue = newValue / 2.00;
					list.set(list.size() - 2,newValue);
					list.remove(list.size() - 1);
					Collections.sort(list);
					Collections.reverse(list);
				}
				System.out.println(list.get(0));
				
			} catch (NumberFormatException | IOException e) {
				return;
			}
		}

	}

}


Measured memory_bytes: 20692
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if ((a + b) >= c) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}


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

int main(){
  int N;
  cin >> N;
  vector<int> h(N);
  for(int i=0; i<N; i++) cin >> h.at(i);
  vector<int> d(N+1);
  d.at(0)=h.at(0);
  for(int i=1; i<N; i++){
    d.at(i)=h.at(i)-h.at(i-1);
  }
  d.at(N)=0-h.at(N-1);
  int ans=0;
  for(int i=0; i<N; i++){
    if(d.at(i)>=0) ans+=d.at(i);
  }
  cout << ans << endl;
}

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

int main(){
    string in;
    getline( cin, in );
    for( int i=0; i+4<in.length(); i++ ){
        if( in.substr(i,5)=="apple" ) in.replace(i,5,"peach");
        else if( in.substr(i,5)=="peach" )  in.replace(i,5,"apple");
    }
    cout << in << endl;
    return 0;
}

Measured memory_bytes: 1184
N = int(input())
num = [0,0,0,0,0]
answer = 0
for i in range(N):
	a = input()
	if a[0]=='M':
		num[0] += 1
	if a[0]=='A':
		num[1] += 1
	if a[0]=='R':
		num[2] += 1
	if a[0]=='C':
		num[3] += 1
	if a[0]=='H':
		num[4] += 1

for i in range(3):
	for j in range(i+1, 4):
		for k in range(j+1, 5):
			answer += num[i]*num[j]*num[k]

print(answer)

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main() {
  int R, G, B, N; cin >> R >> G >> B >> N;
  int ans = 0;
  for(int r = 0; r <= N/R; ++r) {
    for(int g = 0; g <= N/G; ++g) {
      int b = N - R*r - G*g;
      if(b >= 0 && b % B == 0) ans++;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import itertools
n = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
nums = [i for i in range(1,n+1)]
fac = [words for words in itertools.permutations(nums)]
ans = abs(fac.index(p) - fac.index(q))
print(ans)


Measured memory_bytes: 7924
// Starting with the name of Allah

#include <bits/stdc++.h>
#define ll long long
#define nl endl
#define Nayon ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define gcd(a,b)         __gcd(a,b)
#define lcm(a,b)         (a/gcd(a,b))*b


using namespace std;



int main()
{
	Nayon;
	ll n,d,p,q,x,y,cnt=0;
	cin>>n>>d;
	while(n--){
		cin>>p>>q;
		y=(p*p)+(q*q);
		if(y<=d*d){
			cnt++;
		}
	}
	cout<<cnt<<nl;
	return 0;
}


Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		try(Scanner sc = new Scanner(System.in);){
			int n = sc.nextInt();
			
			long min = 1000001;
			long max = -1000001;
			long sum = 0;
			
			for(int i = 0; i < n; i++) {
				long a = sc.nextLong();
				
				if(a > max) {
					max = a;
				}
				if(a < min) {
					min = a;
				}
				sum += a;
			}
			
			System.out.println(min + " " + max + " " + sum);
		}
	}
}


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

using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n); i > 0; i--)
#define all(n) n.begin(), n.end()
#define print(n) cout << n << endl

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if((a+(d-1))/d >= (c+(b-1))/b) print("Yes");
    else print("No");
    return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
int n, m, q, max = 0;
int A[15];
int a[55], b[55], c[55], d[55];
int check(){
    int ans = 0;
    for(int i = 1; i <= q; i++)
        if(A[b[i]] - A[a[i]] == c[i])
            ans += d[i];
    return ans;
}
void make(int i, int t){
    if(i == n + 1){
        int x = check();
        if(x > max) 
            max = x;
        return ;
    }
    for(int j = t; j <= m; j++){
        A[i] = j;
        make(i + 1, j);
    }
}
int main(){
    scanf("%d%d%d",&n,&m,&q);
    int i = 1;
    for(; i <= q; i++)
        scanf("%d%d%d%d",&a[i],&b[i],&c[i],&d[i]);
    make(1, 1);
    printf("%d",max);    
    return 0;
}

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

using namespace std;

int main()
{
    //freopen("", "r", stdin);
    //freopen("", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n, k, ans = 0;
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
    {
        int x;
        cin >> x;
        ans += min(x, k - x) * 2;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256