akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define IO {ios_base::sync_with_stdio(false); cin.tie(0);}
#define ll   long long
#define pi pair<ll,ll>
ll a[2000000], b[300000];
string s;
ll f(ll n, ll mod, ll b)
{
    ll ans=1, aa;
    if(!b) return 1;
    if(b%2) ans=n;
    aa=f(n,mod,b/2);
    return ((aa*aa)%mod*ans)%mod;
}
ll g(ll n)
{
    ll cnt, ans=0;
    while(n){
        cnt=__builtin_popcount(n);
        n%=cnt; ans++;
    }
    return ans;
}
int main()
{
    IO;
    ll i, j, k, l=0, n, m, h, mod=1e9+7, cnt=0, mx = 0, t, ans=0, tc=0,r , l1, l2=0;

        cin>>n>>s;
        for(i=1; i<=n; i++){
            if(s[i-1]=='1') cnt++;
        }
        l1=0;
        for(i=1; i<=n; i++){
            if(s[i-1]=='1') l1=(l1+f(2,cnt+1,n-i))%(cnt+1);
        }
        if(cnt>1) for(i=1; i<=n; i++){
            if(s[i-1]=='1') l2=(l2+f(2,cnt-1,n-i))%(cnt-1);
        }
        for(i=1; i<=n; i++){
            if(s[i-1]=='0'){
                a[i]=(l1+f(2,cnt+1,n-i))%(cnt+1); b[i]=1;
            }
            else{
                if(cnt!=1){
                    a[i]=(l2-f(2,cnt-1,n-i))%(cnt-1); b[i]=1;
                    if(a[i]<0) a[i]+=cnt-1;
                }
            }
        }
        for(i=1; i<=n; i++){
            b[i]+=g(a[i]);
        }
        for(i=1; i<=n; i++) cout<<b[i]<<endl;
    return 0;
}


Measured memory_bytes: 6844
/*An anomaly, I'm Muhammad Ali
  'Cause I know one day I'm gonna be the*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define llpow(a,b) (ll)(pow(a,b)+0.5)
#define f first
#define s second
const  int mod = 1000000007;
void add(ll& a, ll b){a+=b;while(a>=mod)a-=mod;while(a<0)a+=mod;}
void mul(ll& a, ll b){a*=b;while(a>=mod)a-=mod;while(a<0)a+=mod;}
ll binexpomodulo(ll x, ll y){ll res =1;x%=mod;if(!x)return 0;while(y){if(y&1){mul(res, x);}mul(x,x);y>>=1;}return res;}
ll nCrInOr(ll n, ll r){ll res = 1;if(r>n-r)r = n-r;ll rin = 1;for(ll i = 1; i <=r ; i++)rin = (rin*i)%mod;rin = binexpomodulo(rin,mod-2);for(ll i = 1; i <= r; i++)res = (res*(n-i+1))%mod;res = (res*rin)%mod;return res;}
int main()
{
	int n; cin>>n;
	string s; cin>>s;
	vector<vector<int>> l(3);
	for(int i = 0 ; i < n ; i++)
	{
		if(s[i]=='R')
			l[0].push_back(i);
		else if(s[i]=='G')
			l[1].push_back(i);
		else
			l[2].push_back(i);
	}
	set<int> org;
	org.insert((int)'R');
	org.insert((int)'G');
	org.insert((int)'B');
	ll ans = 0;
	for(int i = 0; i < n-1; i++)
	{
		for(int j = i+1; j < n-1; j++)
		{
			if(s[i]!=s[j])
			{
				set<int> curr = org;
				curr.erase(s[i]);
				curr.erase(s[j]);
				ll val;
				if(*curr.begin()==(int)'R')
				{
					val = l[0].end()-upper_bound(l[0].begin(),l[0].end(),j);
					if(binary_search(l[0].begin(),l[0].end(),2*j-i))
						val--;
				}
				if(*curr.begin()==(int)'G')
				{
					val = l[1].end()-upper_bound(l[1].begin(),l[1].end(),j);
					if(binary_search(l[1].begin(),l[1].end(),2*j-i))
						val--;
				}
				if(*curr.begin()==(int)'B')
				{
					val =  l[2].end()-upper_bound(l[2].begin(),l[2].end(),j);
					if(binary_search(l[2].begin(),l[2].end(),2*j-i))
						val--;
				}
				ans+=val;
			}
		}
	}
	cout<<ans<<endl;
  	return 0;
}

Measured memory_bytes: 3644
#define DEBUG 0

/**
 * File    : A.cpp
 * Author  : Kazune Takahashi
 * Created : 4/6/2019, 8:54:53 PM
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(10101010));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int a[5];
int k;

int main()
{
  for (auto i = 0; i < 5; i++)
  {
    cin >> a[i];
  }
  cin >> k;
  sort(a, a + 5);
  if (a[4] - a[0] > k)
  {
    cout << ":(" << endl;
  }
  else
  {
    cout << "Yay!" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  int n;
  R n;
  int a[n];
  rep(i,n) R a[i];
  int x=-1;
  int ans=1;
  rep(i,n-1) {
    if(a[i]<a[i+1]) {
      if(x==1) {
        x=-1;
        ans++;
      } else if(x==-1) {
        x=0;
      }
    } else if(a[i]>a[i+1]) {
      if(x==0) {
        x=-1;
        ans++;
      } else if(x==-1) {
        x=1;
      }
    }
  }
  pr(ans);
}

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


Measured memory_bytes: 640
#define _CRT_SECURE_NO_WARNINGS

#include<bits/stdc++.h>

using namespace std;

#define PI			3.14159265
#define OO			1e9
#define SS       	second
#define FF       	first
#define Trace(n)  	cout<< #n <<" = "<< n << endl; 
#define ll			long long
#define endl		"\n"
#define EPS		    1e-9
//#define MOD         1e9 + 7	    
//int dx[] = { 0, 0, -1, 1, 1, 1, -1, -1 };
//int dy[] = { -1, 1, 0, 0, 1, -1, 1, -1 };

void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);

}


int main()
{
	fast();
	int n;
	string s;
	cin >> n >> s;
	if (n < 3200)
		cout << "red";
	else
		cout << s;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ll long long
using namespace std;
int main(){
int N,W;
cin>>N>>W;
ll dp[N+1][W+1]={};
for(int i=0;i<N;i++){
    int w,v;
    cin>>w>>v;
    for(int j=W-w;j>=0;j--){
        dp[i+1][j+w]=max(dp[i][j+w],dp[i][j]+v);
    }
    for(int j=w-1;j>=0;j--){
        dp[i+1][j]=dp[i][j];
    }
 
   }
   
ll ans=-1;

for(int i=0;i<=W;i++){
    ans=max(ans,dp[N][i]);
}
cout<<ans<<endl;
return 0;
}

Measured memory_bytes: 79104
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
#define mid ((l+r)>>1)

const int N=190;
char str[N][N];
int n,m,tmp,sum[N][N],dp[N][N][N][18];

bool check(int lx,int rx,int ly,int ry) {
	int res=sum[rx][ry]-sum[lx-1][ry]-sum[rx][ly-1]+sum[lx-1][ly-1];
	if(res==0||res==(rx-lx+1)*(ry-ly+1)) return true;
	return false;
}
int main() {
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i) scanf("%s",str[i]+1);
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j)
			sum[i][j]=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+(bool)(str[i][j]=='.');
	for(int x=1;x<=n;++x)
		for(int L=1;L<=m+1;++L)
			for(int k=0;k<18;++k) dp[x][L][L-1][k]=1<<30;
	for(int x=1;x<=n;++x)
		for(int L=1;L<=m;++L) for(int R=L;R<=m;++R) {
			int l=x,r=n,ans=l-1;
			while(l<=r) check(x,mid,L,R)?ans=mid,l=mid+1:r=mid-1;
			dp[x][L][R][0]=ans;
		}
	for(tmp=1;dp[1][1][m][tmp-1]<n;++tmp) {
		for(int x=1;x<=n;++x)
			for(int L=1;L<=m;++L)
				for(int R=L;R<=m;++R)
					dp[x][L][R][tmp]=dp[dp[x][L][R][tmp-1]+1][L][R][tmp-1];
		for(int x=1;x<=n;++x)
			for(int L=1;L<=m;++L)
				for(int R=L,res=L;R<=m;++R) {
					while(res<R&&
						min(dp[x][L][res][tmp-1],dp[x][res+1][R][tmp-1])<=
						min(dp[x][L][res+1][tmp-1],dp[x][res+2][R][tmp-1])) ++res;
					dp[x][L][R][tmp]=
						max(dp[x][L][R][tmp],min(dp[x][L][res][tmp-1],dp[x][res+1][R][tmp-1]));
				}
	}
	printf("%d\n",tmp-1);
	return 0;
}

Measured memory_bytes: 471424
#単体変更, 区間取得

class RMQ:
    #INF = int(1e18)
    INF = int((1<<31)-1)
    n = 0
    n_ = 0
    val = []
    def __init__(self, n_):
        n = 1
        while n < n_:
            n = n * 2
        self.n = n
        self.n_ = n_
        self.val = [self.INF] * (2 * n - 1)

    @staticmethod
    def merge(a, b):
        return min(a, b)
        
    def update(self,k, x):
        k = k + self.n - 1
        self.val[k] = x
        while k:
            k = (k-1)//2
            self.val[k] = self.merge(self.val[k*2+1], self.val[k*2+2])

    def dfs(self, a, b, k, l, r):
        if r <= a or b <= l:
            return self.INF
        if a <= l and r <= b:
            return self.val[k]
        vl = self.dfs(a, b, k * 2 + 1, l, (l+r)//2)
        vr = self.dfs(a, b, k * 2 + 2, (l+r)//2, r)
        return self.merge(vl, vr)
    

    def query(self, a, b):
        return self.dfs(a, b, 0, 0, self.n)

    
n, q = list(map(int, input().split()))
rmq = RMQ(n)

query = rmq.query
update = rmq.update
while q:
    q = q - 1
    com, x, y = list(map(int, input().split()))
    if com == 0:
        update(x, y)
    else:
        print (query(x, y + 1))



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

#define FOR(i,b,e) for(int i=(b); i <= (e); ++i)
#define FORD(i,b,e) for(int i=(b); i >= (e); --i)
#define SIZE(c) (int) (c).size()
#define FORE(i,c) FOR(i,0,SIZE(c)-1)
#define FORDE(i,c) FORD(i,SIZE(c)-1,0)

#define pb push_back
#define mp make_pair
#define st first
#define nd second


using namespace std;

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

typedef vector <int> VI;
typedef vector <bool> VB;
typedef vector <pii> VP;
typedef vector <ll> VL;
typedef vector <pll> VPL;

typedef vector <VI> VVI;
typedef vector <VL> VVL;
typedef vector <VB> VVB;
typedef vector <VP> VVP;

const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000000000000001LL;


/*************************************************************************/

int main() {
    ios_base::sync_with_stdio(0);
    
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    
    ll res = a - b;
    if (k % 2) {
        res *= -1;
    }
    
    cout << res;

    return 0;
}

/*************************************************************************/


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <complex>
using namespace std;

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

#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T> void preview(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}

const int INF = 100000000;
const double PI = acos(-1.0), EPS = 1e-10;

int main() {
	for(string s; getline(cin, s);) {
		bool b = false;
		bool w = false;
		for(int i = 0; i < 3; i++) {
			if(s[i] == 'x' && s[i+3] == 'x' && s[i+6] == 'x') b = true;
		}
		for(int i = 0; i < 3; i++) {
			if(s[3*i] == 'x' && s[3*i+1] == 'x' && s[3*i+2] == 'x') b = true;
		}
		if(s[0] == 'x' && s[4] == 'x' && s[8] == 'x') b = true;
		if(s[2] == 'x' && s[4] == 'x' && s[6] == 'x') b = true;
		
		for(int i = 0; i < 3; i++) {
			if(s[i] == 'o' && s[i+3] == 'o' && s[i+6] == 'o') w = true;
		}
		for(int i = 0; i < 3; i++) {
			if(s[3*i] == 'o' && s[3*i+1] == 'o' && s[3*i+2] == 'o') w = true;
		}
		if(s[0] == 'o' && s[4] == 'o' && s[8] == 'o') w = true;
		if(s[2] == 'o' && s[4] == 'o' && s[6] == 'o') w = true;
		
		string ans;
		if(b) ans = "x";
		else if(w) ans = "o";
		else ans = "d";

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

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

int main(){
int n;
  cin>>n;
  int a=0,w=0,t=0,r=0;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    if(s=="AC") a++;
    else if(s=="WA") w++;
    else if(s=="TLE") t++;
    else if(s=="RE") r++;
  }
  cout<<"AC x "<<a<<endl;
  cout<<"WA x "<<w<<endl;
  cout<<"TLE x "<<t<<endl;
  cout<<"RE x "<<r<<endl;
}

Measured memory_bytes: 3628
N,T=map(int,input().split())
t= list(map(int,input().split()))
ans=0
t_diff=[t[i+1]-t[i] for i in range(N-1)]
for i in t_diff:
    if i>T:
        ans+=T
    else:
        ans+=i
# 差分で足し合わせたので最後は計算に入ってない、最後は必ず被らないのでTを加える
print(ans+T)




Measured memory_bytes: 26836
#include <algorithm>
#include <iostream>
using namespace std;
int main(){
  int n, d;
  while(cin >> n >> d,n){
    int acum[n][10000+1];
    string ans = "Yes";
    for(int i = 0; i < n; ++i) fill(acum[i],acum[i]+n,0);
    int m, N = 0, last_id[n];
    for(int i = 0; i < n; ++i){
      cin >> m;
      N += m;
      last_id[i] = m;
      for(int j = 0; j < m; ++j){
        cin >> acum[i][j+1];
        acum[i][j+1] += acum[i][j];
      }
    }
    for(int _ = 0; _ < N; ++_){
      int power[n];
      for(int i = 0; i < n; ++i){
        int id = last_id[i];
        power[i] = acum[i][id];
      }
      sort(power,power+n,greater<int>());
      bool f = true;
      for(int i = 0; i < n; ++i){
        int id = last_id[i];
        if(id == 0) continue;
        if((acum[i][id] == power[0] && power[1] - acum[i][id-1] <= d) || 
           (acum[i][id] != power[0] && power[0] - acum[i][id-1] <= d)){
          --last_id[i];
          f = false;
          break;
        }
      }
      if(f){
        ans = "No";
        break;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3572
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{

	class Program
	{
		static void Main(string[] args)
		{
			var N = int.Parse(Console.ReadLine());
			var inputNum = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

			var dicPositionNumber = new Dictionary<int, int>();
			var dicNumberCount = new Dictionary<int, int>();

			// 入力取得
			for (int i = 0; i < N; i++)
			{
				dicPositionNumber.Add(i, inputNum[i]);
				if (dicNumberCount.ContainsKey(inputNum[i]))
				{
					dicNumberCount[inputNum[i]]++;
				}
				else
				{
					dicNumberCount.Add(inputNum[i], 1);
				}
			}

			var sabun = new Dictionary<int, long>();
			long max = 0;
			foreach (var value in dicNumberCount.Keys)
			{
				// 4 -> 6
				var answer = (dicNumberCount[value] * (dicNumberCount[value] - 1L)) / 2L;
				max += answer;
				// 3 -> 3
				var sabunValue = ((dicNumberCount[value] - 1L) * (dicNumberCount[value] - 2L)) / 2L;
				sabun.Add(value, answer - sabunValue);
			}


			for (int i = 0; i < N; i++)
			{
				var deleteNum = dicPositionNumber[i];
				Console.WriteLine(max - sabun[deleteNum]);
			}

		}

	}
}

Measured memory_bytes: 51152
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
using namespace std;

typedef long long ll;
typedef double db;
typedef long double ldb;

template<class T> inline void checkmin(T &a,const T &b){if(b<a) a=b;}
template<class T> inline void checkmax(T &a,const T &b){if(b>a) a=b;}

const int inf=1e9+10;

int n;

int main(){
	cin>>n;
	if(n>=30) cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}


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

#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr<<#x<<" = "<<x<<endl
#define fori(i,a,b) for(int i=(a);i<=(b);i++)
#define rep(n) fori(somethingStupid,1,(n))


using namespace std;

using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

bool tests = false;

void solve(){
    int n; cin >> n;
    vll a;
    ll out = 1;
    rep(n){
        ll temp; cin >> temp;
        if (temp == ll(0)){
            cout << 0; return;
        }
        a.push_back(temp);
    }
    fori(i, 0, n-1){
        if (a[i] > ll(pow(10, 18))/out){
            cout << -1; return;
        }out *= a[i];
    }cout << out << endl;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t = 1;
    if (tests){
        cin >> t;
    }
    rep(t) solve();
    return 0;
}


Measured memory_bytes: 4284
a, b = [int(elem) for elem in input().split()]

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct

a_lst = factorize(a)
b_lst = factorize(b)
res = list(set(a_lst) & set(b_lst))
print(len(res) + 1)

Measured memory_bytes: 3064
import sys

X, Y = map(int, input().split())

for i in range(X+1):
    if Y == 4*i + 2*(X-i):
        print("Yes")
        sys.exit()

if X == 1:
    if Y == 4 or Y == 2:
        print("Yes")
        sys.exit()

if Y < X:
    print("No")
    sys.exit()

print("No")

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

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

    int N;
    cin >> N;
    int A, B;
    cin >> A >> B;

    if(N==1) {
        cout << "Hello World" << endl;
    } else {
        cout << A+B << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
const int inf = INT_MAX;
const ll INF = 1LL >> 60;
const ll mod = 1e9+7;

// DAME:
/*
    3,5,7を使ったものを全列挙して、
    3,5,7を一回以上使っていたらans++する
*/
ll n, ans=0;

void dfs(ll x, int a, int b, int c){
    if(x>n) return;
    // 3, 5, 7が一回以上使われている
    if(a and b and c) ans++;

    // 3, 5, 7を右から追加する
    dfs(x*10+3, 1, b, c);
    dfs(x*10+5, a, 1, c);
    dfs(x*10+7, a, b, 1);
}

int main() {
    cin >> n;
    dfs(0, 0, 0, 0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a, b, c, d, l, r;

int main(){
	scanf("%d %d %d %d", &a, &b, &c, &d);
	l = a + b;
	r = c + d;
	if(l > r)	puts("Left");
	else if(r > l)	puts("Right");
	else puts("Balanced");
	return 0;
}

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

using namespace std;

int main()
{
    int n, i, j, a, k, cnt = 0;

    cin >> n >> k;

    while(n--){
        cin >> a;
        if(a >= k)
            cnt++;
    }
    cout << cnt << endl;

    return 0;
}


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

int main(){
  
  ll n;
  cin >> n;
  ll tmp = n;
  ll i = 1;
  ll a = 0;
  
  while(tmp){
    tmp /= 2;
    a += i;
    i *= 2;
  }
  
  cout << a << endl;
  
	return 0; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,p,x;
    cin>>n>>p;
    long long int sum = 0;
    for(int i = 0;i<p;i++)
    {
        cin>>x;
        sum = sum+x;
        if(sum>=n)
        {

            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
    return 0;

}


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

int main() {
    ll n, b = 0;
    cin >> n;
    map<ll, ll> mp;
    vector<ll> a(n);

    for(ll i = 0; i < n; i++) {
        cin >> a[i];
        if(mp.count(a[i])){
            b += 1;
            break;
        }
        mp[a[i]] = 1;
    }

    if(b == 0){
        puts("YES");
    }else{
        puts("NO");
    }
    return 0;
}

Measured memory_bytes: 14336
#include <stdio.h>
#define N 100

int main(){
  int n, k, u, v;
  int i, j;
  int M[N][N];
  
  scanf("%d",&n);
  for(i=0; i<n; i++){
    for(j=0; j<n; j++)M[i][j] = 0;
  }
  for(i=0; i<n; i++){
    scanf("%d%d",&u,&k);
    u--;
    for(j=0; j<k; j++){
      scanf("%d",&v);
      v--;
      M[u][v] = 1;
    }
  }

  for(i=0; i<n; i++){
    for(j=0; j<n; j++){
      printf("%d",M[i][j]);
      if(j < n - 1)printf(" ");
    }
    printf("\n");
  }
  return 0;
}




Measured memory_bytes: 2108
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
 
int main() {
  ios::sync_with_stdio(0); 
  cin.tie(0); 
  
  string s;
  cin >> s;

  int count[26] = {0};

  for (char c: s) {
    count[c - 'a']++;
  }

  for (int i = 0; i < 26; ++i) {
    if (count[i] > 1) {
      cout << "no" << "\n";
      return 0;
    }
  }

  cout << "yes" << "\n";
}


Measured memory_bytes: 3640
#include <iostream>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
#include <math.h>
//#include <vector>
//#include <string>
typedef long long LL;
using namespace std;
 
int main(){
    LL n;
    LL min_sum;
    cin >> n;
    min_sum=2*n;
    for(int a=1; a<sqrtl(n)+2; a++){
        if(n%a!=0){
            continue;
        }else{
            if(min_sum>a+n/a){
                min_sum=a+n/a;
            }
        }
    }
    cout << min_sum-2 << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <algorithm>
std::vector<long long> solve(int N, std::vector<int> X, std::vector<int> Y, std::vector<int> P) {
	const long long inf = 1LL << 62;
	int mul = 1;
	for (int i = 0; i < N; ++i) {
		mul *= 3;
	}
	std::vector<std::vector<int> > xsel(1 << N, std::vector<int>(N));
	std::vector<std::vector<int> > ysel(1 << N, std::vector<int>(N));
	for (int i = 0; i < 1 << N; ++i) {
		for (int j = 0; j < N; ++j) {
			xsel[i][j] = std::abs(X[j]);
			ysel[i][j] = std::abs(Y[j]);
			for (int k = 0; k < N; ++k) {
				if ((i >> k) & 1) {
					xsel[i][j] = std::min(xsel[i][j], std::abs(X[j] - X[k]));
					ysel[i][j] = std::min(ysel[i][j], std::abs(Y[j] - Y[k]));
				}
			}
		}
	}
	std::vector<long long> ans(N + 1, inf);
	for (int i = 0; i < 1 << N; ++i) {
		int cnt = 0;
		for (int j = 0; j < N; ++j) {
			if ((i >> j) & 1) ++cnt;
		}
		for (int j = i; j >= 0; --j) {
			j &= i;
			long long cost = 0;
			for (int k = 0; k < N; ++k) {
				if (!((i >> k) & 1)) {
					cost += 1LL * std::min({ xsel[j][k], ysel[i - j][k] }) * P[k];
				}
			}
			ans[cnt] = std::min(ans[cnt], cost);
		}
	}
	return ans;
}
int main() {
	int N;
	std::cin >> N;
	std::vector<int> X(N), Y(N), P(N);
	for (int i = 0; i < N; ++i) {
		std::cin >> X[i] >> Y[i] >> P[i];
	}
	std::vector<long long> ans = solve(N, X, Y, P);
	for (int i = 0; i <= N; ++i) {
		std::cout << ans[i] << std::endl;
	}
	return 0;
}


Measured memory_bytes: 9796
a, b = map(int, input().split())

x1, y1 = (a-1)//4, (a-1) % 4
x2, y2 = b//4, b % 4

A = 0
for i in range(4*x1, 4*x1+y1+1):
    A ^= i

B = 0
for i in range(4*x2, 4*x2+y2+1):
    B ^= i

ans = A ^ B
print(ans)


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

typedef long long ll;
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
bool ISINT(double x){return fabs(x-(int)round(x))<EPS;}
bool ISEQ(double x,double y){return fabs(x-y)<EPS;}
string itos(ll x){stringstream ss;ss<<x;return ss.str();}
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin();itr!=c.end();itr++)

typedef pair<int,int> P;

int t[100002];
int cnt[2][100002];

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

  int n;
  
  while (cin >> n) {
    memset(cnt, 0, sizeof(cnt));
    
    for (int i = 0; i < n; i++) {
      cin >> t[i];
      cnt[i%2][t[i]]++;
    }

    vector<P> v[2];

    for (int i = 0; i < 2; i++) {
      for (int j = 0; j <= 100000; j++) {
        if (cnt[i][j] == 0) continue;
        v[i].push_back(P(cnt[i][j], j));
      }
    }

    sort(v[0].begin(), v[0].end());
    sort(v[1].begin(), v[1].end());

    int ans = INT_MAX;
    
    for (int i = 0; i < 2; i++) {
      int idx1 = v[0].size() - i - 1;
      if (idx1 < 0) {
        break;
      }
      
      for (int j = 0; j < 2; j++) {
        int idx2 = v[1].size() - j - 1;
        if (idx2 < 0) break;

        if (v[0][idx1].second == v[1][idx2].second) {
          ans = min(ans, (n / 2 - v[0][idx1].first) + (n / 2));
        } else {
          ans = min(ans, (n / 2 - v[0][idx1].first) + (n / 2 - v[1][idx2].first));
        }
      }
    }

    cout << ans << endl;
  }
}


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

using namespace std;

int ans;
string s;
char tmp[101];

int main(){
	while (cin >> s){
		strcpy(tmp, s.c_str());
		for (int i = 0; i < 100; i++)
			if (tmp[i] == 'C')
				for (int j = i; j < 100; j++)
					if (tmp[j] == 'F') {
						printf("Yes\n");
						return 0;
					}
	}
	printf("No\n");
	return 0;
}

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

int main() {
    string S;
    cin >> S;
    int ans = 0;
    char prev = S[0];
    for(int i=1; i<S.size(); ++i) {
        if(S[i] != prev){
            ++ans;
            prev = S[i];
        }
    }
    cout << ans << endl;
}

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

using namespace std;

#define FOR(i,s,e) for((i)=(s);(i)<(int)(e);(i)++)
#define REP(i,e) FOR(i,0,e)

#define all(o) (o).begin(), (o).end()
#define psb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))

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

const double EPS = 1e-10;

const int N = 20;
const int Q = 20;
int n, q;
int a[N];
int m;

bool check(int i, int k) {
  if (k==m) return true;
  if (m<k || i==n) return false;

  if (check(i+1, k)) return true;
  if (check(i+1, k + a[i])) return true;

  return false;
}

int main() {
  int i;
  scanf("%d ", &n);
  for (i=0; i<n; i++)
    scanf("%d ", a+i);
  scanf("%d ", &q);
  for (i=0; i<q; i++) {
    scanf("%d ", &m);
    if (check(0, 0)) 
      printf("yes\n");
    else
      printf("no\n");
  }

	return 0;
}

Measured memory_bytes: 1172
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  double a,b,h,m;
  cin >> a>>b>>h>>m;

  double sho = h*30+0.5*m;
  double lon = 6*m;
  double kakudo = sho - lon;

  double ans = a*a+b*b-2*a*b*cos(M_PI/180*kakudo);
  cout<<fixed<<setprecision(12)<< sqrt(ans)  <<endl;
}


Measured memory_bytes: 4208
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <math.h>
#include <complex>
using namespace std;
#define rep(i,n) for (int i=0; i < (n); i++)

typedef double D;      // 座標値の型。doubleかlong doubleを想定
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;
const D EPS = (1e-10);    // 許容誤差。問題によって変える
#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

// 内積　dot(a,b) = |a||b|cosθ
D dot(P a, P b) {
  return (conj(a)*b).X;
}
// 外積　cross(a,b) = |a||b|sinθ
D cross(P a, P b) {
  return (conj(a)*b).Y;
}

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    D xa, ya, ra, xb, yb, rb;
    cin >> xa >> ya >> ra >> xb >> yb >> rb;
    P a = P(xa, ya);
    P b = P(xb, yb);

    if (ra+rb < abs(a-b)) {
      std::cout << 0 << std::endl;
    }else if (ra+abs(a-b) < rb) {
      std::cout << -2 << std::endl;
    }else if (rb+abs(a-b) < ra) {
      std::cout << 2 << std::endl;
    }else {
      std::cout << 1 << std::endl;
    }
  }

  
  return 0;
}

Measured memory_bytes: 1244
#include<iostream>
#include<string>

using namespace std;

int main(void){
    string s;
    bool x['z'-'a'+1];
    for(auto& i : x) i = true;
    cin >> s;
    for(int i=0;i<s.length();i++){
        x[s.at(i)-'a'] = false;
    }
    for(int i=0;i<sizeof(x);i++){
        if(x[i]){
            cout << (char)('a'+i) << endl;
            return 0;
        }
    }
    cout <<  "None" << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
/*
typeA(0,i) typeB(K,i)
ボールの位置(xi,i) i番目,i台目
0 < x < K, 場合分け:K/2 >= x, K/2 < x
*/
int main() {
  int N, K, sum = 0;
  cin >> N >> K;
  for(int i = 0; i < N; i++) {
    int x;
    cin >> x;
    if(K/2 >= x) {
      sum += x * 2;
    }
    else {
      sum += (K - x) * 2;
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int q;
    cin >> q;
    multiset<ll>st1,st2;
    ll x = 0, y = 0;
    ll sum = 0;
    int t = 0;
    rep(i,q){
        int k;
        cin >> k;
        if(k==1){
            ll a, b;
            cin >> a >> b;
            sum += b;
            st2.insert(a);
            y += a;
            if(t % 2 == 0){
                auto itr = st2.end();
                itr--;
                x += *itr;
                y -= *itr;
                st1.insert(*itr);
                st2.erase(itr);
            }else{
                auto itr1 = st1.begin();
                auto itr2 = st2.end();
                itr2--;
                if(*itr1 < *itr2){
                    x += *itr2;
                    y -= *itr2;
                    x -= *itr1;
                    y += *itr1;
                    st1.insert(*itr2);
                    st2.erase(itr2);
                    st2.insert(*itr1);
                    st1.erase(itr1);
                }
            }
            t++;
        }
        else{
            ll num;
            if(st1.size() == st2.size()){
                num = *(--st2.end());
            }else{
                num = *st1.begin();
            }
            show(num);
            ll a = (ll) st1.size();
            ll b = (ll) st2.size();
            cout << num << " " <<  abs(x - a * num) + abs(y - b * num) + sum << "\n";
        }
    }
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define LL long long
using namespace std;
LL dp[51][51][2501];
int main()
{
	//freopen("In.txt" , "r" , stdin);
	string s;
	cin >> s;
	for(int i = 1; i < s.size(); i++)
	{
		if(s[i] == s[i - 1])
		{
			cout << i << " " << i + 1 << endl;
			return 0;
		}
		if(i >= 2 && s[i] == s[i - 2])
		{
			cout << i - 1 << " " << i + 1 << endl;
			return 0;
		}
	}
	cout << "-1 -1";
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main() {
  int l;
  cin >> l;
  char prev = ' ';
  int total = 0;
  for (int i = 0; i < l; i++){
    char n;
    cin >> n;
    if (n != prev){
      total++;
    }
    prev = n;
  }
  cout << total;
}

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

const int MOD(1000000007);
int n, k;
int fac[4000000], inv_fac[4000000], dp[2001];


int Power(long long a, int b)
{
	long long ret(1ll);
	
	while (b) {
		b & 1 && (ret *= a);
		ret >= MOD && (ret %= MOD);
		a *= a;
		a >= MOD && (a %= MOD);
		b >>= 1;
	}
	return ret;
}


int main()
{
	register long long lt;
	int t;
	
	scanf("%d%d", &n, &k);
	if (k == 1) {
		printf("1\n");
		return 0;
	}
	fac[0] = 1;
	t = n * k;
	for (int i = 1; i < t; ++i) {
		lt = (long long)i * fac[i - 1];
		fac[i] = lt < MOD ? lt : lt % MOD; 
	}
	inv_fac[t - 1] = Power((long long)fac[t - 1], MOD - 2);
	for (int i = t - 2; i; --i) {
		lt = (long long)(i + 1) * inv_fac[i + 1];
		inv_fac[i] = lt < MOD ? lt : lt % MOD;
	}
	inv_fac[0] = 1;
	dp[0] = 1;
	t = -2;
	for (int i = 1; i <= n; ++i) {
		t += k - 1;
		for (int j = 0; j <= i; ++j) {
			++t;
			lt = (long long)fac[t] * inv_fac[t - k + 2];
			lt >= MOD && (lt %= MOD);
			lt *= (long long)inv_fac[k - 2];
			lt >= MOD && (lt %= MOD);
			lt *= (long long)dp[j];
			j && (lt += dp[j - 1]);
			dp[j] = lt < MOD ? lt : lt % MOD;
		}
		t -= i + 1;
	}
	lt = (long long)dp[n] * fac[n] % MOD;
	printf("%lld\n", lt);
	return 0;
}



Measured memory_bytes: 31488
# coding: utf-8
# Your code here!
import sys
import itertools
N = int(input())
balls = []
for i in range(N):
    l = list(map(int,input().split()))	
    balls.append(l)

d = list(itertools.permutations(balls, 2))

#print(d)
if N == 1:
    print(1)
    sys.exit()
    

dic = {}

for i in range(len(d)):
   p = d[i][1][0] - d[i][0][0]
   q = d[i][1][1] - d[i][0][1]
   dic[str(p) + "," + str(q)] = 0
   
for i in range(len(d)):
   p = d[i][1][0] - d[i][0][0]
   q = d[i][1][1] - d[i][0][1]
   dic[str(p) + "," + str(q)] += 1

dic[str(0) + "," + str(0)] = -1


max_num = max(dic.values())
ans = N - max_num
p_q = max(dic.items(), key = lambda x:x[1])[0]
p,q = map(int,p_q.split(","))

#if p == 0 && q == 0:
    
#print(max_num)


print(ans)

Measured memory_bytes: 40048
#include <stdio.h>

int main()
{
  int a,b,c,d,e;
  scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);
  a=a>b?b>c?c:b:a>c?c:a;
  d=d>e?e:d;
  printf("%d\n",-50+a+d);
  return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

template<typename T>
void cout_vec(vector<T> &vec){
    for(int i=0; i<vec.size(); i++){
        if (i!=0){
            cout << ' ';
        }
        cout << vec[i];
    }
    cout << endl;
}

int main(){
    int N, K, C;
    string S;
    cin >> N >> K >> C >> S;

    vector<int> L(K+1,0);
    vector<int> R(K+1,N+1);
    int cnt=0;
    int vac=0;
    for(int i=0; i<N; i++){
        if(vac>0){
            vac--;
        }else if(S[i]=='o'){
            cnt++;
            L[cnt]=i+1;
            vac=C;
        }
        if(cnt==K)break;
    }

    cnt=K;
    vac=0;
    for(int i=N-1; i>=0; i--){
        if(vac>0){
            vac--;
        }else if(S[i]=='o'){
            R[cnt]=i+1;
            vac=C;
            cnt--;
        }
        if(cnt==0)break;
    }

    //cout_vec(L);
    //cout_vec(R);

    for(int i=1; i<=K; i++){
        if(L[i]==R[i]){
            cout << L[i] << endl;
        }
    }
}

Measured memory_bytes: 3332
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;
typedef priority_queue<int, vector<int>, greater<int>> PQ;
const int MOD = 1000000007;

int main(){
    string S; cin >> S;
    if (S == "ABC"){
        cout << "ARC" << endl;
    }
    else{
        cout << "ABC" << endl;
    }

}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
vector<P> ki[110000];
int dist[110000];
const int INF = 1001001001;
void dfs(int now,int last = -1){
    for(auto p:ki[now]){
        int next = p.first,d = p.second;

        if(next == last)continue;
        dist[next] = dist[now]+d;
        dfs(next,now);
    }
}
signed main(){
    int n;cin >> n;
    rep(i,n-1){
        int u,v,w;cin >> u >> v >> w;
        u--;v--;
        ki[u].emplace_back(v,w);
        ki[v].emplace_back(u,w);
    }
    rep(i,110000)dist[i] = INF;
    dist[0] = 0;
    dfs(0);
    vector<int> ans(n,-1);
    rep(i,n){
        //trace(dist[i]);
        ans[i] = dist[i]%2;
        //trace(ans[i]);
    }
    rep(i,n)cout << ans[i] << endl;


    return 0;
}

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

int main() {
  int n,m;
  cin >> n >> m;
  vector<int> h(n);
  vector<bool> ok(n,true);
  rep(i,n) cin >> h[i];
  
  rep(i,m){
      int a,b;
      cin >> a >> b;
      a--,b--;
      if(h[a] >=  h[b]) ok[b] = false;
      if(h[b] >= h[a]) ok[a] = false;
  }
  int count = 0;
  rep(i,n) if(ok[i]) count++;
  cout << count << endl;
}


Measured memory_bytes: 3796
#include<iostream>
#define ll long long
#include<algorithm>
#include<string>
#include<vector>
#include<unordered_set>
#include <iomanip>
using namespace std;
ll dp[400][400] = {0};
vector<ll> elements;


ll sum(int start, int last)
{
    ll ans = 0;
    for(int i = start; i<=last; ++i)
    {
        ans+=elements[i];
    }
    return ans;

}


ll check(int start, int last)
{
    //cout<<start<<"\t"<<last<<endl;
    if(start == last)
    {
        dp[start][start] = 0;
        return 0;
    }

    if(dp[start][last] != -1)
    {
        return dp[start][last];
    }

    ll ans = 1e18+5;
    for(int i=start; i< last; ++i)
    {
       // cout<<ans<<" "<<" "<<start<<" "<<last<<endl;
        ans = min( (check(start, i) + check(i+1, last) + (sum(start, last))),ans);
    }
    dp[start][last] = ans;
    return ans;


}


int main()
{

    ll n;
    cin>>n;
    for(int i=0; i<n; ++i)
    {
        for(int j=0; j<n; ++j)
        {
            dp[i][j] = -1;
        }
    }
    ll temp;
    for(ll i=0; i< n; ++i){
        cin>>temp;
        elements.push_back(temp);
    }
    ll ans  = check(0 , n-1);
    cout<<ans;
    return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = 1; i <= (int)(n); i++)
#define ll long long
#define umap unordered_map
using graph = vector<vector<int>>;
using graph2 = vector<vector<pair<int, int>>>;
#define oorret true //std::out_of_rangeが返された時
#define oor(x) [&](){try{x;} catch(const std::out_of_range& oor){return oorret;} return x;}()
double pi = 3.141592653589793238;
ll mod(ll x, ll y){if(x>=0||x%y==0) return x%y;return y+x%y;} //mod including minus
ll dv0(ll x, ll y){if(x>=0||x%y==0)return x/y;return x/y-1;} //rnd down
ll dv1(ll x, ll y){if(x%y==0) return dv0(x,y);return dv0(x,y)+1;} //rnd up
int D;
void calculate(vector<int> c, vector<vector<int>> s, int contest,int day, vector<int> &t, ll &score){
    ll p=0;
    int a[26];
    rep(i, 26){
        a[i]=0;
    }
    rep(i, D){
        rep(j, 26){
            p-=c[j]*(i+1-a[j]);
        }
        if(i!=day){
            p+=s[i].at(t[i])+c[t[i]]*(i+1-a[t[i]]);
            a[t[i]]=i+1;
        }else{
            p+=s[day].at(contest)+c[contest]*(day+1-a[contest]);
            a[contest]=i+1;
        }
        
    }
    if(score<p){
        score=p;
        t[day]=contest;
    }
}

int main(){
cin>>D;
vector<int> c(26);
rep(i, 26){
    cin>>c[i];
}
vector<vector<int>> s(D);
int r;
rep(i, D){
    rep(j, 26){
        cin>>r;
        s[i].push_back(r);
    }
}
int M2=0;
vector<pair<int,int>> m2(D);
vector<int> a(26);
vector<int> m(D);

rep(i, 26){
    a[i]=0;
}
int M=0;
rep(i, D){
}
vector<int> t(D);

ll score=0;
rep(i, D){
    M=0;
    rep(j, 26){
        score-=c[j]*(i+1-a[j]);
        if(s[i].at(j)+c[j]*(i+1-a[j])>M){
            M2=M;
            M=s[i].at(j)+c[j]*(i+1-a[j]);
            m2[i].second=m[i];
            m[i]=j;
        }else if(s[i].at(j)+c[j]*(i+1-a[j])>M2){
            M2=s[i].at(j)+c[j]*(i+1-a[j]);
            m2[i].second=j;
        }
    }
    score+=M;
    m2[i].first=M-M2;
    a[m[i]]=i+1;
    t[i]=m[i];
}
rep(j, 10){
rep(i, D){
    calculate(c, s, m2[i].second, i, t, score);
}
rep(i, D){
    calculate(c, s, m[i], i, t, score);
}
}
rep(i, D){
    cout<<t[i]+1<<endl;
}
}


Measured memory_bytes: 3736
#include <cmath>
#include <iostream>
#include <string>
#include <time.h>
#include <stdio.h>
#include <iomanip>
#include <vector>
#include <map>
#include <algorithm>
#include <stack>
#define LEN 100005
using namespace std;

int S[10000000], n;

int binarysearch(int key){
    int left = 0;
    int right = n;
    int mid;
    while(left < right) {
        mid = (left + right) / 2;
        if(key == S[mid]) return 1;
        if(key > S[mid]) {
            left = mid + 1;
        }
        else if (key < S[mid]){
            right = mid;
        }
    }
    return 0;
}

int main()
{
    int q;
    cin >> n;
    int s, key, sum = 0;
    for(int i = 0; i < n; i++){
        scanf("%d", &S[i]);
    }
    
    scanf("%d", &q);
    for(int i = 0; i < q; i++){
        scanf("%d", &key);
        if( binarysearch(key) ){
            sum++;
        }
    }
    printf("%d\n", sum);
    return 0;
}



Measured memory_bytes: 3496
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, mod = 1000003;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define HelloFile freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define ll long long
int main()
{
    Hello
    int n;
    long double sum = 0;
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        long double a;
        cin >> a;
        sum += ( 1 / a );
    }
    cout << fixed << setprecision(5) << ( 1 / sum );
    return 0;
}


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

#define forn(i,n) for(int i=0;i<n;i++)
#define pb push_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vii;

const int INF=1e9+7;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);	
        int n;cin>>n;
        vector<vector<int>> v(n,vector<int>(3,0));
        int a,b,c;
        cin>>a>>b>>c;
        v[0]={a,b,c};
        for(int i=1;i<n;i++){
            int x,y,z;
            cin>>x>>y>>z;
            v[i][0]=max(v[i-1][1],v[i-1][2])+x;
            v[i][1]=max(v[i-1][0],v[i-1][2])+y;
            v[i][2]=max(v[i-1][1],v[i-1][0])+z;
        }
        cout<<max({v[n-1][0],v[n-1][1],v[n-1][2]})<<endl;
}


Measured memory_bytes: 5760
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*
cout<<fixed<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	llint n,m,i,j;cin>>n>>m;
	vector<llint>mos(n,m);
	//おなじクエリを合成していもすで間に合う
	map<pair<int,int>,int>que;
	for(i=0;i<m;i++){int a,b;cin>>a>>b;que[mp(a,b)]++;}
	for(auto it:que){
		llint a,b,c;a=it.fir.fir;b=it.fir.sec;c=it.sec;
		mos[0]+=a*c;
		for(i=b-a-1;i<n;i+=b){mos[i]-=b*c;}
		
	}
	for(i=0;i<n-1;i++){mos[i+1]+=mos[i];}
	for(i=0;i<n;i++){cout<<mos[i]<<"\n";}
	return 0;
}


Measured memory_bytes: 9684
def insertion_sort(array):
    n = len(array)
    for i in range(1, n):
        tmp = array[i] # 挿入する値を退避
        if tmp < array[i-1]:
            # 挿入する位置までずらしていく
            j = i
            while True:
                array[j] = array[j-1]
                j -= 1
                if j == 0 or tmp >= array[j-1]:
                    break
            array[j] = tmp 
        print_list(array)

def print_list(array):
    list_s = [str(x) for x in array]
    print(" ".join(list_s))


N = int(input())
A = list(map(int, input().split()))
print_list(A)
insertion_sort(A)
#print_list(A)


Measured memory_bytes: 5608
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin >> n;
    if (n % 2) return cout << 0, 0;
    ll sol = n / 10;
    n /= 10;
    ll k = 1;
    while (k * 5 <= n)
    {
        k *= 5;
        sol += n / k;
    }
    cout << sol;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if(abs(a - c) <= d)
    cout << "Yes" << endl;
  else if(abs(a - b) <= d && abs(b - c) <= d)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
while true do
    x, y, z = gets.split(" ")
    x = x.to_i
    z = z.to_i
    
    case y
    when "+" then
        a = x + z
    when "-" then
        a = x - z
    when "*" then
        a = x * z
    when "/" then
        a = x / z
    end
    
    break if y == "?"
    puts a
end

Measured memory_bytes: 8676