akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

#define DEBUG
#ifdef DEBUG
    #define IFD(...) __VA_ARGS__
    #define IFN(...)
    #define L cout<<__LINE__<<"\n";
    #define PRINT(...) __VA_ARGS__ cout<<__LINE__<" : "<<#__VA_ARGS__<<"\n"
    #define PRT(x) cout<<__LINE__<<" : "<<#x<<" = "<<x<<"\n"
#else // DEBUG
    #define IFD(...)
    #define IFN(...) __VA_ARGS__
    #define L
    #define PRINT(...) __VA_ARGS__
    #define PRT(x)
#endif // DEBUG

#define it iterator
#define rit reverse_iterator
#define mp make_pair
#define mems(a,b) memset(a,b,sizeof(a))
#define mem0(a) mems(a,0)
#define mem1(a) mems(a,1)
#define mem255(a) mems(a,255)
#define halt exit(0)
#define all(c) (c).begin() , (c).end()
#define sz(c) ((long long)((c).size()))
#define phb push_back
#define ppb pop_back
#define phf push_front
#define ppf pop_front
#define fort0(i,a,b) for(ll i=a,i##_TO=b;i<i##_TO;i++)
#define for0(i,n) fort0(i,0,n)
#define fort1(i,a,b) for(ll i=a,i##_TO=b;i<=i##_TO;i++)
#define for1(i,n) fort1(i,1,n)
#define ford(i,a,b) for(ll i=a,i##_TO=b;i>=i##_TO;i--)

using namespace __gnu_pbds;
using namespace std;

#define int ll

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

template
<
    class key,
    class val=null_type,
    class comp=less<key>
>
using ord_set=tree
<
    key,
    val,
    comp,
    rb_tree_tag,
    tree_order_statistics_node_update
>;

const int N=710;

int n;
bool g[N][N];
bool u[N],c[N];
int t[2];

void dfs(int v,int x)
{
    //cout<<v<<" -> "<<x<<"\n";
    if(u[v])
    {
        if(x!=c[v])
            cout<<-1,exit(0);
        return;
    }
    u[v]=true;
    c[v]=x;
    t[x]++;
    for(int i=1;i<=n;i++)
        if(v!=i&&g[v][i])
            dfs(i,!x);
}

int bin(int x)
{
    return x*(x-1)/2;
}

set<int> dp[N];

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int m;
    cin>>n>>m;
    mem1(g);
    while(m--)
    {
        int a,b;
        cin>>a>>b;
        g[a][b]=g[b][a]=false;
    }
    vector<int> k;
    for(int i=1;i<=n;i++)
        if(!u[i])
        {
            //cout<<i<<":\n";
            t[0]=t[1]=0;
            dfs(i,0);
            k.phb(t[0]-t[1]);
        }
    dp[0].insert(k[0]);
    dp[0].insert(-k[0]);
    for(int i=1;i<k.size();i++)
        for(int x:dp[i-1])
            dp[i].insert(x+k[i]),
            dp[i].insert(x-k[i]);
    for(int i=0;i<=n;i++)
        if(dp[k.size()-1].count(i)||
           dp[k.size()-1].count(-i))
            cout<<bin((n+i)/2)+
                  bin((n-i)/2),exit(0);
}


Measured memory_bytes: 12288
#include<bits/stdc++.h>
#define ll long long
#define db double
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define A first
#define B second
#define lowbit(p) (p&(-p))
using namespace std;
void read(int &x){
	x=0; char c=getchar(); int p=1;
	for (;c<48;c=getchar())if (c=='-')p=-1;
	for (;c>47;c=getchar())x=(x<<1)+(x<<3)+(c^48);
	x*=p;
}
void read(ll &x){
	x=0; char c=getchar(); int p=1;
	for (;c<48;c=getchar())if (c=='-')p=-1;
	for (;c>47;c=getchar())x=(x<<1)+(x<<3)+(c^48);
	x*=p;
}
void Min(int &x,int y){
	if (x>y)x=y;
}
void Min(ll &x,ll y){
	if (x>y)x=y;
}
void Max(int &x,int y){
	if (x<y)x=y;
}
void Max(ll &x,ll y){
	if (x<y)x=y;
}

map<int,int>f;
struct node{
	priority_queue<int>q;
	void clear(){
		for (;!q.empty();)q.pop();
	}
	void push(int x){
		q.push(x);
	}
	void upd(int x){
		//q.top()>x  f[q.top()]=0
		for (;!q.empty();){
			int t=q.top();
			if (t>x){
				f[t]=0;
				q.pop();
			}
			else return ;
		}
	}
}q;
#define M 200005
int a[M],n;
bool chk(int l){
	q.clear();
	f.clear();
	q.push(1);
	if (a[1]!=1){
		q.push(a[1]);
	}
	int i,x;
	for (i=2;i<=n;i++){
		if (a[i]>a[i-1]){
			q.push(a[i]);
		}
		else if (a[i]==a[i-1]){
			x=a[i];
			f[x]++;
			for (;f[x]==l;){
				if (x==1)return 0;
				f[x]=0;
				f[x-1]++;
				x--;
				q.push(x);
			}
		}
		else{
			x=a[i];
			q.upd(x);
			q.push(x);
			f[x]++;
			for (;f[x]==l;){
				if (x==1)return 0;
				f[x]=0;
				f[x-1]++;
				x--;
				q.push(x);
			}
		}
	}
	return 1;
}
int main(){
//	freopen("1.in","r",stdin);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	read(n);
	int i,l,r,mid,res=0;
	for (i=1;i<=n;i++){
		read(a[i]);
	}
	int fl=1;
	for (i=2;i<=n;i++)if (a[i-1]>=a[i])fl=0;
	if (fl){
		printf("1\n");
		return 0;
	}
	l=2; r=n;
	for (;l<=r;){
		mid=(l+r)>>1;
		if (chk(mid)){
			r=mid-1;
			res=mid;
		}
		else{
			l=mid+1;	
		}
	}
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
#define double long double
using namespace std;
int n;
double d,x,ans;
int main(){
    cin>>n>>d>>x;
    for (; n; --n){
	ans+=d+(2*n-1)*x/2,d-=x;
	d=((2*n+2)*d+(4*n+8)*x-(2*n+1)*x)/2/n;
	x=((2*n+4)*x)/2/n;
    }
    printf("%.15Lf",ans);
    return 0;
}


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

int main(){
  int k,x;
  cin >> k >> x;
  for(int i=x-(k-1);i<=x+(k-1);i++){
    cout << i << " ";
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <string>
#include <algorithm>
#include <iomanip>
static const double PI = 3.14159265359;
int main()
{
	double R;
	std::cin >> R;
	std::cout << std::fixed << std::setprecision(3) << 2 * PI * R << std::endl;
	return 0;
}

Measured memory_bytes: 3788
var nums = null;

function Main(input) {
    var diviveCount = 0;
    nums = input.split(/\n/)[1].split(/\s/)
        .map(str => {
            return parseInt(str, 10)
        });
    while (halfNum(nums)) {
        diviveCount++;
    }
    console.log(diviveCount);
}
/**
 * 数字の配列
 * @returns すべての数が２で割り切れたかどうか
 */
function halfNum() {
    var resNums = [];
    var complete = nums.every((num, index) => {
        if (num % 2 === 0) {
            resNums.push(nums[index] = num / 2);
            return true;
        } else {
            return false;
        }
    });
    nums = resNums;
    return complete;
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main()
{
    int N, K;
    std::cin >> N >> K;
    std::vector<int> V(N);
    for(int i=0; i<N; i++) scanf(" %d", &V[i]);

    int max = 0;
    std::vector<int> tmp;
    for(int a=0; a<N; a++){ // 左から取り出す数
        if(a > K) break;
        tmp.clear();
        for(int i=0; i<a; i++) tmp.push_back(V[i]);

        for(int b=0; a+b<=N; b++){ // 右から取り出す数
            if(a + b == 0) continue;
            if(a + b > K) break;

            if(b != 0) tmp.push_back(V[N-b]);
            std::sort(tmp.begin(), tmp.end());
            int sum = 0, M = tmp.size();
            for(int i=0; i<M; i++) sum += tmp[i];
            // 価値が負の物を戻す
            int c = std::min(K - a - b, M);
            for(int i=0; i<c; i++){
                if(tmp[i] < 0) sum -= tmp[i];
            }
            if(max < sum) max = sum;
        }
    }
    std::cout << max << std::endl;
}

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

using namespace std ;

const int MAX = 1e5 + 10 ;

int arr[MAX] ;
long long n ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n ;
	int ans = 0 ;
	for(long long i = 2ll ; i * i <= n ; ++i)
	{
		int cnt = 0 ;
		while(n%i == 0)
		{
			n /= i ;
			cnt++ ;
		}
		int cur = 0 ;
		for(int j = 1 ; j <= cnt ; ++j)
		{
			cur += j ;
			if(cur > cnt)
				break ;
			ans++ ;
		}
	}
	if(n > 1)
		ans++ ;
	return cout<<ans<<"\n" , 0 ;
}		

Measured memory_bytes: 3652
#include<cstring>
#include<string>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<sstream>
#include<climits>
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define all(X) (X).begin(),(X).end()
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_N = 100;
int n, l;
string s[MAX_N];

int main() {
  cin >> n >> l;
  rep(i, n) cin >> s[i];

  sort(s, s+n);

  string ans;
  rep(i, n) ans += s[i];

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long N, D;
    cin >> N >> D;
    D = D * D;
    int count = 0;
    for (int i = 0; i < N; i++)
    {
        long X, Y;
        cin >> X >> Y;
        if (X * X + Y * Y <= D)
        {
            count++;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <fstream>
#include <bitset>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef tuple<int, int, int> iii;
typedef vector<iii> viii;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef map<int, int> mii;
typedef map<int, string> mis;
typedef map<string, int> msi;
typedef set<int> si;
typedef set<ll> sl;
typedef map<ll, ll> mll;
typedef queue<int> qi;
typedef queue<ii> qii;
typedef vector<string> vs;
typedef pair<ll, ll> iil;
typedef vector<iil> viil;
typedef vector<vi> vvi;
typedef long double ld;

#define pb push_back
#define mp make_pair
#define rep(i, n) for (int i = 0 ; i < n ; i++)
#define INF 1000000000

void solve() {
    int n;
    cin >> n;
    cout << (1000 - n % 1000)%1000 << endl;
    
}

void querySolve() {
    int n;
    cin >> n;
    while (n--) {
        solve();
    }
}

int main() {
    //querySolve();
    solve();

}


Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <utility>
#include <vector>
#include <algorithm>

using namespace std;

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

int main() {
	int q;
	cin >> q;
	while (q--) {
		int c, a, n;
		scanf("%d %d %d", &c, &a, &n);
		
		int ans = 0;
		
		int tmp = min(c, min(a, n));
		ans += tmp;
		c -= tmp; a -= tmp;
		tmp = min(c / 2, a);
		ans += tmp;
		c -= tmp * 2; a-= tmp;
		tmp = c / 3;
		ans += tmp;
		
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1244
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] code = sc.next().toCharArray();
		boolean good = true;
		for(int i=0; i<3; i++)
			if(code[i]==code[i+1])
				good = false;
		System.out.println(good ? "Good" : "Bad");
		
		sc.close();
	}
}


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

int main() {
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	cout << a[0] << " " << a[1] << " " << a[2] << endl;
	return 0;
}


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

#define int long long

const int N = 1111111;

int n, m, x, y, A[N];

struct Seg {
  int l, r;
  void input(void) {
	scanf("%lld%lld", &l, &r);
  }
}L[N], Q[N];

bool cmp1(Seg a, Seg b) {
  return a.l > b.l;
}

bool cmp2(Seg a, Seg b) {
  return a.r < b.r;
}

main() {
  cin >> n;
  for(int i = 1; i <= n; ++ i)
	L[i].input(), Q[i] = L[i];
  L[++ n] = (Seg){0, 0};
  Q[n] = L[n];
  sort(L + 1, L + n + 1, cmp1);
  sort(Q + 1, Q + n + 1, cmp2);
  int ans = 0;
  for(int i = 1; i <= n; ++ i) {
	if(L[i].l < Q[i].r) break;
	ans += L[i].l - Q[i].r;
  }
  cout << ans * 2 << endl;
}


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

int main() {
  int N,M,K;
  cin >> N >> M >> K;
  bool can = false;
  for (int i = 0; i <= N; i++) {
    for (int j = 0; j <= M; j++) {
      if (i * (M - j) + (N - i) * j == K) can = true;
    }
  }
  
  if (can) cout << "Yes" << endl;
  else cout << "No" << endl; 
}

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

int main()
{
	int n, a;
	int count[10000 + 1];
	for (int i = 0; i < 10000 + 1; i++)
	{
		count[i] = 0;
	}

	cin >> n;

	for (int i = 0; i < n; i++)
	{
		cin >> a;
		count[a]++;
	}
	bool f = false;
	for (int i = 0; i < 10000 + 1; i++)
	{
		if (count[i] == 0)continue;
		while (count[i] > 0)
		{
			if (!f)
			{
				f = true;
				cout << i;
			}
			else
			{
				cout << " " << i;
			}
			count[i]--;
		}
	}

	cout << endl;

}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
int a,b;
int main(){
	cin>>a>>b;
	cout<<a/b<<" ";
	cout<<a%b<<" ";
	double f1=a,f2=b;
	printf("%.10lf\n",f1/f2);
}
/*for(初期化式;条件式;終了のときの式)
  for(int i=a;i<=b;i++){
     cout<<i<<endl;
  }*/



Measured memory_bytes: 3236
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define MAX 510000
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;


int main(){
    ll a,b; cin >> a >> b;
    if(abs(a-b)<=1) puts("Brown");
    else puts("Alice");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
#define inf 10000000000000
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i>=b; i--)
#define f first
#define s second
#define pb push_back
#define mt make_tuple


int main(){

ll n, x[101010],a,b;
cin >> n >> a >> b;
ll ans=0;

rep(i, 1, n)
cin >> x[i];

rep(i, 1, n-1){
ans+= min(a*(x[i+1]-x[i]), b);
}

cout << ans << endl;

return 0;}


Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#define rep(i, n) for (int i = 0; (i) < (int)(n); i++)
using namespace std;

int main() {
	int R;
	double PI = acos(-1);
	cin >> R;
	cout << 2 * PI * R << endl;
	return 0;
}


Measured memory_bytes: 3788
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repd(i, n) for (ll i = n-1; i >= 0; i--)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define repd2(i, s, n) for (ll i = n-1; i >= (s); i--)

int main() {
    const ll MOD = 1000000007;
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    vector<ll> b(n);
    b = a;
    ll ans = 0;
    rep2(i, 1, n) b[i] += b[i-1];
    rep(i, n) {
        ans += (a[i]%MOD)*((b[n-1]-b[i])%MOD);
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

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

    int a,b;cin>>a>>b;
    if(a<=8 && b<=8) cout<<"Yay!"<<endl;
    else cout<<":("<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>

int main()
{
long long int n;
int flag = 0;
long long int pre = 0;
long long int count = 0;
std::cin >> n >> pre;
for(long long int i = 1; i < n; i++){
    long long int a;
    std::cin >> a;
    if(flag == 1 && a >= pre){
        pre = a;
    } else if(flag == -1 && a <= pre){
        pre = a;
    } else if(flag == 1 && a < pre){
        count++;
        flag = 0;
        pre = a;
    } else if(flag == -1 && a > pre){
        count++;
        flag = 0;
        pre = a;
    } else if(flag == 0 && a > pre){
        flag = 1;
        pre = a;
    } else if(flag == 0 && a < pre){
        flag = -1;
        pre = a;
    }
}
count++;
std::cout << count << std::endl;
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define pi 3.14159265358979323846264
#define li 1000000000000000000
using namespace std;

struct ca
{
  char a;
   int si,ei;
};



int binarySearch(vector<int> arr, int l, int r, int x) 
{ 
    if (r >= l) { 
        int mid = l + (r - l) / 2; 
  
        if (arr[mid] == x) 
            return mid; 
  
         
        if (arr[mid] > x) 
            return binarySearch(arr, l, mid - 1, x); 
  
       
        return binarySearch(arr, mid + 1, r, x); 
    } 
  
    
    return -1; 
} 

int prime[1000001]={};

void pr()
{
  prime[1]=0;

 for(int i=2;i*i<1000001;i++)
  if(prime[i]==0)
  for(int j=i*i;j<1000001;j+=i)
  prime[j]=1;

}


ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      
  
    x = x % p;  
  
    while (y > 0) 
    { 
         
        if (y & 1) 
            res = (res*x) % p; 
  
        
        y = y>>1; 
        x = (x*x) % p; 
    } 
    return res; 
} 

 
ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
} 


ll fac[1000001]={};

void facto(ll p)
{
   fac[0] = 1; 
    for (ll i=1 ; i<=1000000; i++) 
        fac[i] = (fac[i-1]*i)%p; 
}
  
 
ll nCrModPFermat(ll n, ll r, ll p) 
{ 
  
   if (r==0) 
      return 1;  
  
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
} 



/*
struct cmp
 {

     bool operator() (const ca &a , const ca &b) const
  {
      if(a.val>b.val)
       return true;

      return false;
  }
 };*/


int main()
{

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

   //pr();
   //facto(mod);
  int t;
  //cin>>t;
  t=1;
  int id=1;

  

  while(t--)
{
   
    int n;
    cin>>n;

    ll ans=1;

    vector<ll> arr;



    for(int i=0;i<n;i++)
  {
     ll a;
     cin>>a;
    arr.push_back(a);
  }


     sort(arr.begin(),arr.end());

      for(int i=0;i<n;i++)
  {
       if(arr[i]> ceil((double)li/ans))
        {
           ans=-1;
              break;
        }
           
    
       ans*=arr[i];
   
     if(ans> li){
            ans=-1;
         
           break; 
          
        }

  }

    

   cout<<ans;

}
     


return 0;
}







Measured memory_bytes: 4304
using System;
using System.Collections;

class P2013
{
  public static void Main()
  {
    int n = int.Parse(Console.ReadLine());
    while(n!=0)
      {
	ArrayList departure = new ArrayList();
	ArrayList arrive = new ArrayList();
	for(int i=0; i<n; i++)
	  {
	    String[] line = Console.ReadLine().Split(' ');
	    String[] dtime = line[0].Split(':');
	    String[] atime = line[1].Split(':');
	    departure.Add(int.Parse(dtime[0])*10000+int.Parse(dtime[1])*100+int.Parse(dtime[2]));
	    arrive.Add(int.Parse(atime[0])*10000+int.Parse(atime[1])*100+int.Parse(atime[2]));
	  }

	for(int i=0; i<n; i++)
	  {
	    int min = 240001;
	    int minIndex = 0;
	    for(int j=i; j<n; j++)
	      {
		if((int)departure[j]<min)
		  {
		    min = (int)departure[j];
		    minIndex = j;
		  }
	      }
	    int tmp = (int)departure[minIndex];
	    departure[minIndex] = departure[i];
	    departure[i] = tmp;
	    tmp = (int)arrive[minIndex];
	    arrive[minIndex] = arrive[i];
	    arrive[i] = tmp;
	  }

	int count = 0;
	while(departure.Count>0)
	  {
	    int end = (int)arrive[0];
	    count++;
	    for(int i=1; i<departure.Count; i++)
	      {
		if(end<=(int)departure[i])
		  {
		    end = (int)arrive[i];
		    departure.RemoveAt(i);
		    arrive.RemoveAt(i);
		    i--;
		  }
	      }
	    departure.RemoveAt(0);
	    arrive.RemoveAt(0);
	  }

	Console.WriteLine(count);

	n = int.Parse(Console.ReadLine());
      }
  }
}

Measured memory_bytes: 6876
S = input()

N = len(S)

def is_kaibun(x):
    list_x = list(x)
    reversed_list_x = list(reversed(list(x)))
    res = True if list_x==reversed_list_x else False
    return res

ans = 'No'

if is_kaibun(S):
    tmp = int((N-1)/2)
    if is_kaibun(S[:tmp]):
        tmp = int((N+3)/2)-1
        if is_kaibun(S[tmp:]):
            ans = 'Yes'

print(ans)


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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i) os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1) printEoln();
  if (suc == 2) printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U>
void chmax(T &a, U b) {
  if (a < b) a = b;
}

template <class T, class U>
void chmin(T &a, U b) {
  if (b < a) a = b;
}

template <class T>
T Sq(const T &t) {
  return t * t;
}

const int mod = 1e9 + 7;

signed main() {
  int h, w;
  std::cin >> h >> w;
  string grid[h];
  REP(i, h) { grid[i] = readString(); }
  vector<vi> dist(h, vi(w, -1));
  vector<pi> que;
  REP(i, h) REP(j, w) {
    if (grid[i][j] == '#') {
      que.EB(i, j);
      dist[i][j] = 0;
    }
  }
  for (int b = 0; b < que.size(); b++) {
    for (int dx = -1; dx <= 1; dx++) {
      for (int dy = -1; dy <= 1; dy++) {
        if (dx * dx + dy * dy == 1) {
          int x = que[b].first + dx;
          int y = que[b].second + dy;
          if (x >= 0 && x < h && y >= 0 && y < w && dist[x][y] == -1) {
            que.EB(x, y);
            dist[x][y] = dist[que[b].first][que[b].second] + 1;
          }
        }
      }
    }
  }
  print(dist[que.back().first][que.back().second]);
}


Measured memory_bytes: 29416
#include <iostream>
using namespace std;
int main() {
	double v;
	while (cin >> v) {
        double t = v / 9.8;
        double y = 4.9 * t * t;
        double n = 1;
        while (5 * n - 5 < y) {
            ++n;
        }
        cout << n << endl;
	}
	return 0;
}

Measured memory_bytes: 1272
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

const int INF = numeric_limits<int>::max();

struct Graph {
    struct edge {
        int v, c;
    };
    vector<vector<edge>> adj;
    vector<int> d;
    Graph(int n) {
        adj.assign(n, vector<edge>());
        d.assign(n, INF);
    }
};

int main()
{
    int n;
    cin >> n;
    Graph g(n);
    for (int i = 0; i < n; i++) {
        int u, k;
        cin >> u >> k;
        for (int j = 0; j < k; j++) {
            int v, c;
            cin >> v >> c;
            g.adj[i].push_back({v, c});
        }
    }

    priority_queue<P, vector<P>, greater<P>> pq;
    g.d[0] = 0;
    pq.push(P(0, 0));
    while (!pq.empty()) {
        int c = pq.top().first;
        int u = pq.top().second;
        pq.pop();
        if (g.d[u] < c) continue;
        for (auto e : g.adj[u]) {
            if (g.d[e.v] > g.d[u] + e.c) {
                g.d[e.v] = g.d[u] + e.c;
                pq.push(P(g.d[e.v], e.v));
            }
        }
    }

    for (int i = 0; i < n; i++) {
        cout << i << " " << g.d[i] << endl;
    }
}


Measured memory_bytes: 7844
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define REPR(i,n) for(int i=n-1; i>=(int)(0); i--)
#define FOR(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define FORR(i,a,b) for(int i=(int)(b)-1; i>=(int)(a); i--)
#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()
//**関数リスト**//
int ctoi(char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.second < secondElof.second;
}
ll nod(ll F) {
	ll keta = 1;
	while (F / 10 > 0) {
		keta++;
		F /= 10;
	}
	return keta;
}
ll gcd(ll x, ll y) {
	ll r;
	if (x < y) {
		swap(x, y);
	}
	while (y > 0) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
ll isPrime(ll x) {
	ll i;
	if (x < 2) {
		return 0;
	}
	else if (x == 2) {
		return 1;
	}
	else if (x % 2 == 0) {
		return 0;
	}
	else {
		for (i = 3; i * i <= x; i += 2) {
			if (x % 1 == 0) {
				return 0;
			}
		}
		return 1;
	}
}
void eratos(vl isPrime) {
	//(注)isPrimeのサイズはN+1にする！実際にはmain内に配置して使用
	ll i, j;
	REP(i, isPrime.size()) {
		isPrime[i] = 1;
	}
	isPrime[0] = 0; isPrime[1] = 0;
	for (i = 2; i * i <= isPrime.size() - 1; i++) {
		if (isPrime[i] == 1) {
			j = i * 2;
			while (j <= isPrime.size() - 1) {
				isPrime[j] = 0;
				j = j + i;
			}
		}
	}
}
ll modinv(ll a, ll m) {
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
void bitSearch(ll n) {
	//実際にはコピーして中身を改変して使う
	ll i;
	REP(i, pow(2, n)) {
		ll p = i;
		REP(i, n) {
			cout << p % 2;
			p /= 2;
		}
		cout << endl;
	}
}
void dfs(ll now) {
	//中身は毎回書き換えて使用
	stack <ll> S;
	//flagは初期値0
	S.push(now);
	//flag[now]=1;
	while (!S.empty()) {
		ll u = S.top();
		//ll v = ;
		//if(flag[v]==0){flag[v]=1;S.push[v];}else{S.pop();}
	}
}
void bfs(ll now) {
	//中身は毎回書き換えて使用
	queue<ll> Q;
	Q.push(now);
	ll u;
	while (!Q.empty()) {
		u = Q.front();
		Q.pop();
		//ll v=;
		//Q.push(v);
	}
}
//**定義場所**//
ll i, j, k, l, m, n;
ll N, M, K, H, W;
ll MOD = 1000000007;
ll ans = 0;
//***********//
int main() {
	cin >> N;
	vl P(N);
	vl Q(N);
	for (i = 0; i < N; i++) {
		cin >> P[i];
		Q[P[i]-1] = i;
	}
	ll key = 1;
	for (i = 0; i < N - 1; i++) {
		if (Q[i] < Q[i + 1]) {
			key++;
		}
		else {
			ans = max(ans, key);
			key = 1;
		}
	}
	ans = max(ans, key);
	cout << N - ans;
}

Measured memory_bytes: 3328
import java.util.Scanner;

class Main{
	public static void main(String arg[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		sc.close();
		
		System.out.println(mulPower(N));
	}
	
	public static long mulPower(int N){
		long power = 1;
		long c = (long) (Math.pow(10, 9)+7);
		for (long i = 1; i <= N; i++) {
			power *= i;
			power %= c;
		}
		return power;
	}
}

Measured memory_bytes: 22612
#include <stdio.h>
#include <stdlib.h>

int main(void) {
  unsigned long long int h;
  unsigned long long int w;
  unsigned long long int result;
  int m;
  int s;
 
  s = scanf("%llu", &h);
  s = scanf("%llu", &w);

  if (h == 1 || w == 1)
    result = 1;
  if (h >= 2 && w >= 2 && h <= 1000000000 && w <= 1000000000)
  {
    m = (h * w) % 2;
    if (m == 0)
      result = h * w / 2;
    else
      result = h * w / 2 + 1;
  }
  printf("%llu", result);
  return (0);
}


Measured memory_bytes: 128
import copy

def stable(origin, new):
    for i in range(n-1):
        if int(new[i][1]) == int(new[i+1][1]):
            if origin.index(new[i]) > origin.index(new[i+1]):
                return False
    return True

n = int(raw_input())
a_origin = raw_input().split()

a = copy.copy(a_origin)
b = copy.copy(a_origin)

# bubble sort
for i in range(n):
    for j in range(n-1, i, -1):
        if int(a[j][1]) < int(a[j-1][1]):
            tmp = a[j]
            a[j] = a[j-1]
            a[j-1] = tmp

for i in range(n):
    if i == n-1:
        print a[i]
    else:
        print a[i], 

if stable(a_origin, a):
    print 'Stable'
else:
    print 'Not stable'

# selection sort
for i in range(n):
    minj = i
    for j in range(i, n):
        if int(b[j][1]) < int(b[minj][1]):
            minj = j
    tmp = b[i]
    b[i] = b[minj]
    b[minj] = tmp

for i in range(n):
    if i == n-1:
        print b[i]
    else:
        print b[i],

if stable(a_origin, b):
    print 'Stable'
else:
    print 'Not stable'

Measured memory_bytes: 6520
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int n,vis[10][10];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        if(i%10==0) continue;
        int last=i%10,fi=i;
        while(fi>=10) fi/=10;
        vis[fi][last]++;
    }
    long long ans=0;
    for(int i=1;i<=n;i++)
    {
        if(i%10==0) continue;
        int last=i%10,fi=i;
        while(fi>=10) fi/=10;
        ans+=vis[last][fi];
    }
    printf("%lld\n",ans);
}


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

using namespace std;

const int max_n = 1111, inf = 1000111222;

int n, m, a[max_n][max_n];
bool rev;
bitset<max_n> b[max_n];

long long solve() {
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            b[i][j] = a[i - 1][j - 1] ^ b[i][j - 1];
        }
        for (int j = 0; j <= m; ++j) {
            b[i][j] = b[i][j] ^ b[i - 1][j];
        }
    }
    long long res = 0;
    for (int i = 0; i <= n; ++i) {
        for (int j = i; j <= n; ++j) {
            int c1 = (b[i] ^ b[j]).count();
            int c2 = m + 1 - c1;
            res += c1 * c2;
        }
    }
    return res;
}

void proc(int lx, int rx, int ly, int ry) {
    if (lx > rx || ly > ry) {
        return;
    }
    if (lx == rx && ly == ry) {
        return;
    }
    int mx = (lx + rx) / 2;
    int my = (ly + ry) / 2;
    a[mx][my] = 0;
    proc(lx, mx - 1, ly, my - 1);
    proc(lx, mx - 1, my + 1, ry);
    proc(mx + 1, rx, ly, my - 1);
    proc(mx + 1, rx, my + 1, ry);
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> n >> m;
    if (n > m) {
        swap(n, m);
        rev = 1;
    }
    n = 1 << n;
    m = 1 << m;
    --n;
    --m;
    if (n == 1 && 0) {
        a[0][m / 2] = 1;
    } else {
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < m; ++j) {
                a[i][j] = 1;
            }
        }
        proc(0, n - 1, 0, m - 1);
        /*a[n / 4][m / 4] = 0;
        a[n - 1 - n / 4][m / 4] = 0;
        a[n / 4][m - 1 - m / 4] = 0;
        a[n - 1 - n / 4][m - 1 - m / 4] = 0;
        a[n / 2][m / 2] = 0;*/
    }
    //cout << solve() << endl;
    if (!rev) {
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < m; ++j) {
                cout << a[i][j];
            }
            cout << endl;
        }
    } else {
        for (int i = 0; i < m; ++i) {
            for (int j = 0; j < n; ++j) {
                cout << a[j][i];
            }
            cout << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 5760
#include<stdio.h>
int main()
{
    int i,j,k,n,temp,num,a[101];
    while(scanf("%d",&n)!=EOF)
    {
        num=0;
        for(i=0; i<n; i++)
            scanf("%d",&a[i]);
        for(i=0; i<n; i++)
        {
            j=i;
            for(k=i+1; k<n; k++)
            {
                if(a[j]>a[k])
                {
                    j=k;
                }
            }
            if(j!=i)
            {
                temp=a[i];
                a[i]=a[j];
                a[j]=temp;
                num++;
            }

        }
        for(j=0; j<n-1; j++)
            printf("%d ",a[j]);
        printf("%d\n",a[n-1]);
        printf("%d\n",num);
    }
    return 0;
}



Measured memory_bytes: 2092
#include<bits/stdc++.h>
#include<algorithm>
#include<string>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace __gnu_cxx;
using namespace __gnu_pbds;
using namespace std;

#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pi acos(-1.0)

#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define pf(a) printf("%lld\n",a)

#define stll(a) stoll(a,nullptr,10)
#define all(a) a.begin(),a.end()
#define PII pair<ll,ll>
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define EL printf("\n")
#define ff first
#define ss second
#define rev(a) reverse(all(a))


#define mem(ar,val) memset(ar,val,sizeof(ar))
#define ssort(ar) sort(ar.begin(),ar.end())
#define csort(ar,comp) sort(ar.begin(),ar.end(),comp)

#define bug1(a) cout<<"test "<<a<<endl;
#define bug2(a,b) cout<<"test "<<a<<" "<<b<<endl;
#define bug3(a,b,c) cout<<"test "<<a<<" "<<b<<" "<<c<<endl;
#define bug4(a,b,c,d) cout<<"test "<<a<<" "<<b<<" "<<c<<" "<<d<<endl;

#define fout freopen("output.txt","w",stdout)
#define fin  freopen("input.txt","r",stdin)

/// unordered_map<int,int>mp;
/// mp.reserve(1024);
/// mp.max_load_factor(0.25);

/// pbds
/// *find_by_order(k) - return k th largest element.. 0 based
/// order_of_key(k) - number of items strictly smaller than k

/*
struct HASH{
  size_t operator()(const pair<int,int>&x)const{
    return (size_t) x.first * 37U + (size_t) x.second;
  }
};
*/

typedef long long ll;
typedef unsigned long long ull;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

ll ar[1000];
int main()
{
    ll n,sum=0;
    cin>>n;
    for(int i=1;i<n;i++)
        cin>>ar[i];
    for(int i=2;i<n;i++)
        sum+=min(ar[i],ar[i-1]);
    sum+=ar[n-1]+ar[1];
    cout<<sum<<endl;



}
















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

int main() {
  int n;
  while(cin >> n, n) {
    int ap, ad = 0;
    for(int i = 0; i < n; i++) {
      int p, d1, d2;
      cin >> p >> d1 >> d2;
      if(d1+d2 > ad) {
	ap = p;
	ad = d1+d2;
      }
    }
    cout << ap << ' ' << ad << endl;
  }
}

Measured memory_bytes: 1160
import scala.annotation.tailrec

object Main extends App {

  import scala.io.StdIn._
  import scala.math._


  val p = readLine.trim.toDouble
  val n = readLine.trim.toInt
  val points = Array.tabulate(n){_ ⇒ Nil:List[(Int, Int)]}
  for (_ ← 1 until n){
    val Array(x, y, c) = readLine.trim.split(' ').map(_.toInt)
    points(x - 1) ::= (y - 1, c)
    points(y - 1) ::= (x - 1, c)
  }
  println(
    calMultiple(points)
  )
  //Stack OverFlowになる
  def calSingle(points: Array[List[(Int, Int)]]): Double = {
    @tailrec
    def addStack(current: List[(Int, Double, List[(Int, Int)])]): List[(Int, Double, List[(Int, Int)])] = {
      current match {
        case (from, c, (next, cost)::t)::tail ⇒
          points(next).filter(_._1 != from) match {
            case nexts ⇒ addStack((next, cost.toDouble, nexts)::(from, c, t)::tail)
          }
        case _ => current
      }
    }
    var stack: List[(Int, Double, List[(Int, Int)])] = addStack(List((0, 0d, points(0))))
    var result = 0d
    while (stack.nonEmpty){
      stack match {
        case (_, res, Nil)::Nil ⇒
          result = res
          stack = Nil
        case (_, res, Nil)::(from, c, t)::tail ⇒
          stack = addStack((from, c + res * p, t)::tail)
        case _ ⇒ ???
      }
    }
    result
    //points(current).withFilter{case (to, _) ⇒ to != from}.map{case (to, cost) ⇒ calSingle(to, current).let{it ⇒ (it + cost) * p}}.sum
  }
  def calMultiple(points: Array[List[(Int, Int)]]): Double = {
    @tailrec
    def addStack(current: List[(Int, Double, Double, List[(Int, Int)])]): List[(Int, Double, Double, List[(Int, Int)])] = {
      current match {
        case (from, m, c, (next, cost)::t)::tail ⇒
          points(next).filter(_._1 != from) match {
            case nexts ⇒ addStack((next, 1d, cost.toDouble, nexts)::(from, m, c, t)::tail)
          }
        case _ ⇒ current
      }
    }
    var stack: List[(Int, Double, Double, List[(Int, Int)])] = addStack((List((0, 1d, 0d, points(0)))))
    var result = 0d
    while (stack.nonEmpty){
      stack match {
        case (_, m, c, Nil)::Nil ⇒
          val single = calSingle(points)
          result = m * single + c
          stack = Nil
        case (_, m, c, Nil)::(from, mm, cc, t)::tail ⇒
          stack = addStack((from, mm + m * p, cc + c * p, t)::tail)
        case _ ⇒ ???
      }
    }
    result
    //points(current).withFilter{case (to, _) ⇒ to != from}.map{case (to, cost) ⇒ calMultiple(to, current).let{case (m, c) ⇒ (m * p, (c + cost) * p)}}.foldLeft((0d, 0d):(Double, Double)){case ((m, c), (m2, c2)) ⇒ (m + m2, c + c2)}.let{case (m, c) ⇒ (m + 1, c)}
  }
  implicit class Extension[T](val value :T){
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
    def let[R](func: T ⇒ R): R = func(value)
  }
}


Measured memory_bytes: 251564
N, X, Y = list(map(int, input().split(" ")))
min_list = [0 for i in range(0, N)]

for i in range(1, N+1):
    for j in range(i+1, N+1):
        dis_a = j-i
        dis_1 = abs(X-i)
        dis_2 = abs(j-Y)
        dis_b = dis_1+dis_2+1
        if dis_a > dis_b:
            min_list[dis_b] += 1
        else:
            min_list[dis_a] += 1

for i in range(1, len(min_list)):
    print(min_list[i])

Measured memory_bytes: 3444
#include <bits/stdc++.h>
#define rep(i, l, r) for(register int i = l; i < r; i++)
#define hrp(i, l, r) for(register int i = l; i <= r; i++)
#define rev(i, r, l) for(register int i = r; i >= l; i--)
#define pb push_back
#define int ll
#ifndef JOEON
#define D(...)
#define R(x, l)
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
template<typename tn> inline tn next(void);
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v);
signed main(void)
{
	#ifdef JOEON
//		freopen("C:\Users\Joeon\Desktop\IN.txt", "r", stdin);
//		freopen("C:\Users\Joeon\Desktop\OUT.txt", "w", stdout);
	#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	string str = next<string>();
	if (str == "ABC") cout<<"ARC"<<endl;
	else cout<<"ABC"<<endl;
	return 0;
}
template<typename tn> inline tn next(void)
{
	tn k;
	cin>>k;
	return k;
}
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v)
{
	rep(i, 0, v.size()) os<<v[i]<<' ';
	return os;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff first
#define ss second
#define pb push_back

#define N 100010
#define MOD 1000000007

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n, m, c;
	cin >> n >> m >> c;
	int b[m];
	for (int i = 0; i < m; ++i)
	{
		cin >> b[i];
	}
	int a[n] = {}, l;
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < m; ++j)
		{
			cin >> l;
			l *= b[j];
			a[i] += l;
		}
	}
	for (int i = 0; i < n; ++i)
	{
		a[i] += c;
	}
	int ans = 0;
	for (int i = 0; i < n; ++i)
	{
		if(a[i] > 0)
			ans++;
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n); for(int i = 0;i < (n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
long double pi = acos(-1);
const int INF = 1001001001;


// 最小公倍数を求める
int euqlid (int a, int b){
  int temp;
  temp = a % b;
  if(temp == 0)return b;
  return euqlid(b,temp);
}
ll conbination(ll a,ll b){
  ll u = 1;
  ll d = 1;
  while(b != 0){
    u *= a;
    d *= b;
    a--;
    b--;
  }
  return u / d;
}
int strtoint(char s){
  return (int(s-'0'));
}
int fact(int n){
  if(n == 1)return 1;
  return n * fact(n-1);
  }


int main(){
  int a, b;
  cin >> a >> b;
  cout << (a+b+1)/2 << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.math.BigInteger;
 
public class Main {
	public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	int N = s.nextInt();
	int K = s.nextInt();
	int R = s.nextInt();
	int S = s.nextInt();
	int P = s.nextInt();
	String T = s.next();
	long score = 0;

	for(int i = 0; i < N; i++){
		if(T.charAt(i) == 'r'){
			score += P;
		}else if(T.charAt(i) == 's'){
			score += R;
		}else{
			score += S;
		}
	}
	
	for(int i = 0; i < K; i++){
		for(int j = 0; (j+1)*K+i < N; j++){
			if(T.charAt(j*K+i) == T.charAt((j+1)*K+i)){
				if(T.charAt(j*K+i) == 'r'){
					score -= P;
				}else if(T.charAt(j*K+i) == 's'){
					score -= R;
				}else{
					score -= S;
				}
				j++;
			}
		}
	}

	System.out.println(score);

    
  }
}

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

using namespace std;

bool is_allowed(vector<int> vs) {
    assert(vs.size() == 4);
    auto check = [&]() {
        if (vs[0] == 0 && vs[1] == 1 && vs[2] == 2) {
            return false;
        }
        if (vs[1] == 0 && vs[2] == 1 && vs[3] == 2) {
            return false;
        }
        return true;
    };
    if (!check()) {
        return false;
    }
    for (int i = 0; i < 3; ++i) {
        swap(vs[i], vs[i+1]);
        if (!check()) {
            return false;
        }
        swap(vs[i], vs[i+1]);
    }
    return true;
}

vector<vector<int>> all_allowed() {
    vector<vector<int>> all;
    for (int a = 0; a < 4; ++a) {
        for (int b = 0; b < 4; ++b) {
            for (int c = 0; c < 4; ++c) {
                for (int d = 0; d < 4; ++d) {
                    vector<int> xs = {a, b, c, d};
                    if (is_allowed(xs)) {
                        all.push_back(xs);
                    }
                }
            }
        }
    }
    return all;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    if (n == 3) {
        cout << 61 << endl;
        return 0;
    }
    vector<map<vector<int>, long long>> count(n+1);
    for (auto& xs : all_allowed()) {
        count[4][xs] = 1;
    }
    long long prime = 1000000007;
    for (int i = 5; i <= n; ++i) {
        for (auto& p : count[i-1]) {
            for (int a = 0; a < 4; ++a) {
                vector<int> xs(p.first.begin()+1, p.first.end());
                xs.push_back(a);
                if (is_allowed(xs)) {
                    count[i][xs] = (count[i][xs] + p.second) % prime;
                }
            }
        }
    }
    long long result = 0;
    for (auto& p : count[n]) {
        result = (result + p.second) % prime;
    }
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 2688
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		for (int i = 1; i <= 9; i++) {
			for (int j = 1; j <= 9; j++) {
				System.out.printf("%dx%d=%d\n",i,j,i*j);
			}
		}
	}

}

Measured memory_bytes: 17948
import java.util.Scanner;

public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
	int N = Integer.parseInt(scan.next());
	int[] T = new int[N];
	int[] A = new int[N];
	for (int i = 0; i < N; i++) {
	    T[i] = Integer.parseInt(scan.next());
	    A[i] = Integer.parseInt(scan.next());
	}

	long t = 1;
	long a = 1;
	for (int i = 0; i < N; i++) {
	    if(t % T[i] != 0) {
		t = (t/T[i] + 1) * T[i];
	    }
	    if(a % A[i] != 0) {
		a = (a/A[i] + 1) * A[i];
	    }

	    long pt = t / T[i];
	    long at = a / A[i];

	    if(pt > at) a = A[i] * pt;
	    else t = T[i] * at;
	}

	System.out.println(a+t);
	scan.close();
    }
}


Measured memory_bytes: 24788
import sys

n=int(input())
a=input()
a=list(a)
a.reverse()
if n==1:
    print('1')
    sys.exit()
    
c=1


for i in range(n-1):
    if a[i]!=a[i+1]:
        c+=1

if c==0:
    c+=1
    
print(c)

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

bool isContaned(std::vector<int>& S, int x){
    int b = 0;
    int e = S.size()-1;
    for(;;){
	int pt = (e - b) / 2 + b;
	int s = S.at(pt);
	if(s == x){
	    return true;
	}else if(s < x){
	    if(pt == e){
		return false;
	    }else{
		b = pt + 1;
	    }
	}else{
	    if(pt == b){
		return false;
	    }else{
		e = pt - 1;
	    }
	}
    }
}

int main(int argc, char **argv){

    int N;
    std::cin >> N;
    std::vector<int> S(N);
    for(int i = 0; i < N; i++){
	std::cin >> S.at(i);
    }

    int Q;
    std::cin >> Q;
    std::vector<int> T(Q);
    for(int i = 0; i < Q; i++){
	std::cin >> T.at(i);
    }

    sort(S.begin(), S.end());

    int sum = 0;
    for(int i = 0; i < Q; i++){
	if(isContaned(S, T.at(i))){
	    sum++;
	}
    }
    std::cout << sum << std::endl;
    
}



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

int main() { 
    int a[3], k, ans = 0;
    cin >> a[0] >> a[1] >> a[2] >> k;
    sort(a, a+3);
    a[2] = a[2]*pow(2, k);
    for(int i = 0; i < 3; ++i) {
        ans += a[i];
    }

    cout << ans << '\n';
    
    return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 入力

		String s = sc.next();

		// 判定
		if(s.equals("ARC")){
			System.out.print("ABC");
  		}else{
			System.out.print("ARC");
		}
	}
}


Measured memory_bytes: 35696
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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


  string s;
  cin >> s;
  int n=s.size();
  int ans=n-1;
  rep(j,n){
    int t=j;
    int p=j;
    for(int i=j+1; i<n; i++){
      if(s[i]==s[j]){
	t = max(t, i-p-1);
	p = i;
      }
      else if(i==n-1){
	t = max(t, i-p);
      }
    }
    ans = min(ans,t);
  }
  cout << ans << endl;
  
  return 0;
    

}


Measured memory_bytes: 256
#include<stdio.h>

#define MAX 100000
#define PMAX MAX*10000
#define true 1
#define false 0

int n, k;
int minp=0;
int  w[MAX];

int minp_check(int P){
  int i, j;
  int sum;

  i = 0;
  for(j = 0; j < k; j++){
    sum = 0;
    while(sum + w[i] <= P){
      sum += w[i];
      i++;
      if(i == n){
        minp = P;
        return true;
      }
    }
  }

  return false;
}

void p_search(int left, int right){
  int mid;

  while(right - left > 1){
    mid = (left+right)/2;
    if(minp_check(mid) == true) return p_search(left, mid);
    else if(minp_check(mid) == false) return p_search(mid, right);
  }
}

int main(){
  int left = 0, right = PMAX;
  int i;

  scanf("%d %d", &n ,&k);
  for(i = 0; i < n; i++){
    scanf("%d", &w[i]);
  }

  p_search(left, right);

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

  return 0;
}



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

// Type alias
using ll=long long;
using ld=double;

using pi=pair<int,int>;
using pll=pair<ll,ll>;
using pld=pair<ld,ld>;
using ti3=tuple<int, int, int>;

using vi=vector<int>;
using vll=vector<ll>;
using vld=vector<ld>;
using vpi=vector<pi>;
using vpll=vector<ll>;
using vpld=vector<ld>;
using vti3=vector<ti3>;

// Constants
const double EPS = 1e-9;
const int inf = numeric_limits<int>::max();

// Macro
#define rep(i,n) for(int i=0;i<int(n);++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;--i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(i,a,b) for(int i=int(b-1);i>=int(a);--i)
#define SHOW(a) cout << #a << " = " << a << endl
#define ARR(a,n) for(int i=0;i<int(n);++i) cout << #a << "[" << i << "]" << " = " << a[i] << endl

#define ALL(a) a.begin(),a.end()

// Funtcions
ll pow(ll base, ll i, ll mod){
  ll a = 1;
  while(i){
    if (i & 1) {
      a *= base;
      a %= mod;
    }
    base *= base;
    base %= mod;
    i >>= 1;
  }
  return a;
}
ll gcd(ll a, ll b){
  while(b){
    ll c = a % b;
    a = b;
    b = c;
  }
  return a;
}
ll lcm(ll a, ll b){
  return a / gcd(a, b) * b;
}
template<typename T> bool chmin(T& a, const T& b) {
  if (a > b) return a = b, true; else return false;
}

template<typename T> bool chmax(T& a, const T& b) {
  if (a < b) return a = b, true; else return false;
}

int cnt(int a){
  int ret = 0;
  while(a % 2 == 0){
    a /= 2;
    ret++;
  }

  return ret;
}

void solve(){
  ll N, M;
  cin >> N >> M;
  ll a[100000 + 5] = {};
  rep(i, N){
    ll t;
    cin >> t;
    a[i] = t / 2;
  }

  ll count[100000 + 5] = {};
  rep(i, N){
    count[i] = cnt(a[i]);
  }

  rep(i, N){
    if(count[i] != count[0]){
      cout << "0" << endl;
      exit(0);
    }
  }

  ll glcm = a[0];
  rep(i, N){
    glcm = lcm(glcm, a[i]);
  }

  cout << fixed << setprecision(0) << ceil(M / glcm / 2.0) << endl;

}

int main(){
// FastIO
//ios_base::sync_with_stdio(false);
cin.tie(NULL);
  solve();
  return 0;
}

Measured memory_bytes: 1792