akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline

N = int(input())
abc = [list(map(int,input().split())) for _ in range (N)]

dp = [[0]*3 for _ in range(N+10)]
for i in range(N):
    for j in range(3):
        for k in range(3):
            if j==k:continue
            dp[i+1][j] = max(dp[i+1][j], dp[i][k] + abc[i][j])

print(max(dp[N]))


Measured memory_bytes: 69596
#include <iostream>
#include <vector>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
using ll = long long;

using namespace std;

const int mod = 1000000007;
class mint {
public:
    long long x;
    mint(long long x=0) : x((x%mod+mod)%mod) {}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint& a) {
        if((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint& a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint& a) const { mint res(*this); return res+=a;}
    mint operator-(const mint& a) const { mint res(*this); return res-=a;}
    mint operator*(const mint& a) const { mint res(*this); return res*=a;}
    mint pow(long long t) const {
        if(t == 0) return 1;
        mint a = pow(t>>1);
        a *= a;
        if(t & 1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint& a) { return (*this) *= a.inv();}
    mint operator/(const mint& a) const { mint res(*this); return res /= a;}
};
//istream& operator>>(istream& is, mint& a) { return is >> a.x;}
//ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

// combination mod prime
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1), ifact(n+1) {
        fact[0] = 1;
        for(int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for(int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if(k < 0 || n < k) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};


int main() {
    int s;
    cin >> s;
    int mx = s / 3;
    vector<mint> t(mx+1);
    //t[1] = 1;
    for(int i = 1; i <= mx; ++i) {
        int n = s - 3 * i;
        if(n == 0) t[i] = 1;
        else {
            combination c(n + i - 1);
            t[i] = c(n + i - 1, i - 1);
        }
    }
    mint ans = 0;
    for(int i = 1; i <= mx; ++i) ans += t[i];
    cout << ans.x << endl;

    return 0;
}


Measured memory_bytes: 3528
//2020年4月17日現在

#include<stdio.h>
#include<cmath>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<complex>
#include<queue>
#include<set>
#include<utility>
#include<iomanip>
#include<limits>
#include<thread>
#include<map>
#include<stack>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<tuple>
#include <cstdio>

using namespace std;

template <class... A>
void prints() { cout << "\n"; }
template <class... A>
void prints_rest() { cout << "\n"; }
template <class T, class... A>
void prints_rest(const T &first, const A &... rest) { cout << " " << first; prints_rest(rest...); }
template <class T, class... A>
void prints(const T &first, const A &... rest) { cout << first; prints_rest(rest...); }
template <class T, class... A>
void printd(const T &first, const A &... rest) { cout << fixed << setprecision(15) << first; prints_rest(rest...); }


namespace {
	// printElems(&a[0], &a[n]);　みたいな感じで使う。
	void printElems(const int* begin, const int* end)
	{
		for (const int* p = begin; p != end; ++p) {
			cout << *p << ' ';
		}
		cout << endl;
	}
}

#define rep(i,n) for(ll i=0; i<n; i++)
#define rep1(i,n) for(ll i=1; i<n+1; i++)
#define repr(i,n) for(ll i=n-1; i>=0; i--)
#define repr1(i,n) for(ll i=n; i>0; i--)
#define FOR(i,j,n) for(ll i=j; i < n; i++)
#define souatari(i,j,n) rep1(i,n-1)rep(j,i)
#define souatari1(i,j,n) for(ll i=2; i<n+1; i++)rep1(j,i-1)
#define mp make_pair
#define F first
#define S second
#define elif else if

typedef long long ll;
typedef vector<int>  vi;
typedef vector<vi>  vvi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef array<int,3> arr3;
typedef long double D;


const ll llinf =  numeric_limits<ll>::max();
const ll _llinf = numeric_limits<ll>::lowest();
const int inf = numeric_limits<int>::max();
const int _inf = numeric_limits<int>::lowest();
const double dinf = numeric_limits<double>::infinity();
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const ll BIG = 1LL<<60;
const string yes = "Yes";
const string no = "No";

//----------------------------------------------

int a[200005];

int main(){
	int n,k;
	cin >> n >> k;
	rep(i,n) cin >> a[i];

	int l = 0;
	int r = 1<<30;

	while(r-l>1){
		int mid = (r-l)/2+l;
		int cnttmp = 0;
		rep(i,n) {
			cnttmp+=(a[i]-1)/mid;
		}
		if(cnttmp<=k){r = mid;}
		else{l = mid;}
	}
	prints(r);


	return 0;
}




Measured memory_bytes: 4380
n,y = map(int,input().split())
y = y//1000
flag = 0
for i in range(n+1):
    for j in range(n+1-i):
        if i*10 + j*5 + (n-i-j) == y:
            print(i, j, n-i-j)
            flag = 1
            break
    if flag == 1:
        break
if flag == 0:
    print('-1 -1 -1')


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(a) int((a).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
template<class T, class U> inline void add_self(T &a, U b){a += b;if (a >= mod) a -= mod;if (a < 0) a += mod;}
template<class T, class U> inline void min_self(T &x, U y) { if (y < x) x = y; }
template<class T, class U> inline void max_self(T &x, U y) { if (y > x) x = y; }

#define _deb(x) cout<<x;
void _print() {cerr << "]\n";} template <typename T, typename... V>void _print(T t, V... v) {_deb(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
template <class T, class U> void print_m(const map<T,U> &m, int w=3){if(m.empty()){cout<<"Empty"<<endl; return;}for(auto x: m)cout<<"("<<x.first<<": "<<x.second<<"),"<<endl;cout<<endl;}
template<class T, class U>void debp(const pair<T, U> &pr, bool end_line=1){cout<<"{"<<pr.first<<" "<<pr.second<<"}"; cout<<(end_line ? "\n" : ", ");}
template <class T> void print_vp(const T &vp, int sep_line=0){if(vp.empty()){cout<<"Empty"<<endl; return;}if(!sep_line) cout<<"{ ";for(auto x: vp) debp(x,sep_line);if(!sep_line) cout<<"}\n";cout<<endl;}
template <typename T>void print(const T &v, bool show_index = false){int w = 2;if(show_index){for(int i=0; i<sz(v); i++)cout<<setw(w)<<i<<" ";cout<<endl;}for(auto &el: v) cout<<setw(w)<<el<<" ";cout<<endl;}
template <typename T>void print_vv(const T &vv){if(sz(vv)==0) {cout<<"Empty"<<endl; return;} int w = 3;cout<<setw(w)<<" ";for(int j=0; j<sz(*vv.begin()); j++)cout<<setw(w)<<j<<" ";cout<<endl;int i = 0;for(auto &v: vv){cout<<i++<<" {";for(auto &el: v) cout<<setw(w)<<el<<" ";cout<<"},\n";}cout<<endl;}

int main(){
    forn(i,5){
        int x;
        cin>>x;
        if(x==0){
            cout<<i+1<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
    return 0;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
int ans=0, swi[100]={0}, k[100], s[100][100], p[100], n, m, pat=0;
bool judge(){
    int i, j, cnt=0;
    for(i=0;i<m;i++){
        for(j=0;j<k[i];j++){
            if(swi[s[i][j]]==1) cnt++;
        }
        if(cnt%2!=p[i]) return false;
        cnt=0;
    }
    return true;
}
int search(int num){
    if(num==n){
        pat++;
        if(judge()) ans++;
        return 0;
    }
    swi[num]=0;
    search(num+1);
    swi[num]=1;
    search(num+1);
}
int main(){
    int i, j;
    cin >> n >> m;
    for(i=0;i<m;i++){
        cin >> k[i];
        for(j=0;j<k[i];j++){
            cin >> s[i][j];
            s[i][j]--;
        }
    }
    for(i=0;i<m;i++){
        cin >> p[i];
    }
    search(0);
    cout << ans <<endl;
    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <numeric>

using namespace std;

int main(){
   int a,b,c;
   long long k;
   cin>>a>>b>>c>>k;
   long long ans=0;
   ans=b-a;
   if(abs(ans)>1000000000000000000) {
      cout<<"Unfair"<<endl;
      return 0;
   }
   else {
      if(k%2==0)ans=a-b;
      cout<<ans<<endl;
   }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    string s;
    cin>>s;
    ll r=0;
    ll cnt=0;
   for(ll i=0;i<s.length();i++)
    {
       if(s[i]=='R'){
        r++;
        cnt=max(cnt,r);
      }
       else{
         r=0;
       }
    }
    cout<<cnt;


}


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

int arr[100010] = {0};
int dp[100010] = {0};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
	// cin >> t;
	while(t != 0) {
	    int n, K;
        cin >> n >> K;
        for(int i = 1; i <= n; i++) {
            cin >> arr[i];
        }
        dp[1] = 0;
        dp[2] = abs(arr[2] - arr[1]);
        for(int i = 3; i <= n; i++) {
            dp[i] = INT_MAX;
            for(int k = 1; k <= K; k++) {
                if(i-k == 0) {
                    break;
                }

                dp[i] = min(dp[i], dp[i-k] + abs(arr[i] - arr[i-k]));
            }
        }
        cout << dp[n] << "\n";
	    t--;
	}
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <iomanip>

using namespace std;

double dp[3000][3000];

int main() {
  int N; cin >> N;
  vector<double> p(N);
  for (int i = 0; i < N; i++) cin >> p[i];
  dp[0][0] = 1.0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= i; j++) {
      dp[i+1][j+1] += dp[i][j]*p[i];
      dp[i+1][j] += dp[i][j]*(1.0-p[i]);
    }
  }
  double sum = 0.0;
  for (int j = 0; j <= N; j++) {
    if (j > N-j) sum += dp[N][j];
  }
  cout << fixed << setprecision(10) << sum << endl;
  return 0;
}

Measured memory_bytes: 68864
#include <bits/stdc++.h>
#define ll long long int
#define pb(x) push_back(x)
#define TEST int inox,t;cin>>t; for(inox=1;inox<=t;inox++)
#define rep(i,n) for(i=0;i<n;i++)
#define repr(i,n) for(i=n-1;i>=0;i--)
#define FAST    ios::sync_with_stdio(false); cin.tie(0);
using namespace std;
#define modd 998244353 
 
 
int main(){
FAST;
ll x; cin>>x;

double e=1.01;

ll p=100; ll c=0;
while(p<x){
c++;
p=p+(p/100);

}
cout<<c;
}

Measured memory_bytes: 3700
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

bool isPrime(int x) {
  if(x == 2) return true;
  if(x < 2 || !(x % 2)) return false;
  int i = 3;
  while(i <= sqrt(x)) {
    if (!(x % i)) return false;
    i += 2;
  }
  return true;
}

int main(void) {
  int A[10000],n;
  cin >> n;
  for(int i=0;i<n;i++) cin >> A[i];
  int prime = 0;
  for(int i=0;i<n;i++)
    if(isPrime(A[i])) prime++;
  cout << prime << '\n';

  return 0;
}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    int n;
    cin >> n;
    vector<int> v(9);
    rep(i, 9) v[i] = 111*(i+1);

    int ans = *lower_bound(whole(v), n);
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] a_asArgs)
        {
			string l_sInput = Console.ReadLine();
			ulong[] l_aiInput = l_sInput.Split(' ').Select(a => ulong.Parse(a)).ToArray();

			if (l_aiInput[0] % l_aiInput[1] == 0)
			{
				Console.WriteLine("-1");
				return;
			}

			ulong l_iIndex = 1;
			ulong l_iValue;
			ulong l_iMax = 1000000ul * 1000000ul * 1000000ul;
			do
			{
				l_iValue = l_aiInput[0] * l_iIndex++;
				if (l_iValue % l_aiInput[1] != 0)
				{
					Console.WriteLine(l_iValue.ToString());
					return;
				}
			}
			while (l_iValue <= l_iMax);
			Console.WriteLine("-1");
		}
	}
}


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

typedef long long int ll;
ll powk(ll a, ll n = 2){
    ll r = 1;
    for(ll i = 0;i < n;i++){
        r *= a;
    }

    return r;
}

int main()
{
    ll n, q;
    string s;
    cin >> n >> q >> s;
    vector<pair<ll,ll>> lr(n);
    for(ll i = 0;i < q;i++){
        cin >> lr[i].first >> lr[i].second;
    }
    vector<ll> c(n);
    for(ll i = 1;i < n;i++){
        c[i] = c[i - 1];
        if(s[i - 1] == 'A' && s[i] == 'C'){
            c[i]++;
        }
    }

    for(ll i = 0;i < q;i++){
        cout << c[lr[i].second - 1] - c[lr[i].first - 1] << "\n";
    }

    return 0;
}

Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
const int inf=1001001001;
int main(){
 int n,m;
  cin>>n>>m;
  int a,b;
  vector<int> to[100005];
  for(int i=0;i<m;i++){
    cin>>a>>b;
    a--;
    b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  queue<int> q;
  vector<int> dist(n,inf);
  vector<int> pre(n,-1);
  dist[0]=0;
  q.push(0);
  while(!q.empty()){
    int v=q.front();
    q.pop();
    for(int u:to[v]){
      if(dist[u]!=inf) continue;
      dist[u]=dist[v]+1;
      pre[u]=v;
      q.push(u);
    }
  }
  cout<<"Yes"<<endl;
  for(int i=0;i<n;i++){
    if(i==0) continue;
    int ans=pre[i];
    ans++;
    cout<<ans<<endl;
  }
  return 0;
}


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

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; }

int main()
{
    int h,w;
    cin >> h >> w;
    string s[h];
    for (int i = 0; i < h; i++)
    {
        cin >> s[i];
    }
    
    vector<vector<int>> dp(h, vector<int>(w, INT_MAX - 100));
    int dx[] = {0, 1, 0, -1};
    int dy[] = {1, 0, -1, 0};

    dp[0][0] = (s[0][0] == '#');
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            for (int k = 0; k < 2; k++)
            {
                if(0 <= i + dy[k] && i + dy[k] < h && 0 <= j + dx[k] && j + dx[k] < w)
                {
                    if(s[i + dy[k]][j + dx[k]] == '#' && s[i][j] == '.')chmin(dp[i + dy[k]][j + dx[k]], dp[i][j] + 1);
                    else chmin(dp[i + dy[k]][j + dx[k]], dp[i][j]);
                }
            }
        }
    }
/*
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)cout << dp[i][j] << " ";
        cout << endl;
    }
*/
    cout << dp[h - 1][w - 1] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N;cin >> N;
  vector<int> v(N);
  int ma = MIN_I;
  int ma_i = 0;
  int mi = MAX_I;
  int mi_i = 0;
  rep(i,N){
    cin >> v[i];
    if(v[i] > ma){
      ma = v[i];
      ma_i = i;
    }
    if(v[i] < mi){
      mi = v[i];
      mi_i = i;
    }
  }
  queue<PII> que;
  if(ma > -mi){
    rep(i,N) if(v[i] < 0){
      que.push(PII(ma_i,i));
      v[i] += ma;
    }
    rep(i,N-1){
      if(v[i+1] < v[i]){
        que.push(PII(i,i+1));
        v[i+1] += v[i];
      }
    }
  }else{
    rep(i,N) if(v[i]>0){
      que.push(PII(mi_i,i));
      v[i] += mi;
    }
    per(i,N-1){
      if(v[i+1] < v[i]){
        que.push(PII(i+1,i));
        v[i] += v[i+1];
      }
    }
  }
  cout << que.size() << endl;
  while(!que.empty()){
    cout << que.front().first+1 SP que.front().second+1 << endl;
    que.pop();
  }
  return 0;
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
namespace 令和{
    class ABC{
        static void Main(){
            
            int n = int.Parse(Console.ReadLine());
            List<int[]>[] tonari = new List<int[]>[n+1];
            int[] ans = new int[n+1];
            for(int i=0;i<n+1;i++){
                tonari[i] = new List<int[]>();
                ans[i] = -1;
            }
            for(int i=1;i<n;i++){
                string[] uvw = Console.ReadLine().Split();
                int u = int.Parse(uvw[0]);
                int v = int.Parse(uvw[1]);
                int w = int.Parse(uvw[2]);
                tonari[u].Add(new int[2]{v,w});
                tonari[v].Add(new int[2]{u,w});
            }

            Queue<int> q = new Queue<int>();
            q.Enqueue(1);
            ans[1] = 0;

            while(q.Count>0){
                int p = q.Dequeue();
                foreach(int[] tnr in tonari[p]){
                    if(ans[tnr[0]]==-1){
                        if(tnr[1]%2==0){
                            ans[tnr[0]] = ans[p];
                        }else{
                            ans[tnr[0]] = 1-ans[p];
                        }
                        q.Enqueue(tnr[0]);
                    }
                }
            }
            for(int i=0;i<n;i++){
                Console.WriteLine(ans[i+1]);
            }


        }
    }
}

Measured memory_bytes: 35272
#include<stdio.h>
int D[107][7],i,j,N;
int G[55][6]=
{
    {1,2,3},{1,3,5},{1,5,4},{1,4,2},
    {2,1,4},{2,4,6},{2,6,3},{2,3,1},
    {3,1,2},{3,2,6},{3,6,5},{3,5,1},
    {4,1,5},{4,2,1},{4,6,2},{4,5,6},
    {5,1,3},{5,3,6},{5,4,1},{5,6,4},
    {6,2,4},{6,4,5},{6,5,3},{6,3,2}
}
;
int ch(int a,int b)
{
    int i;
    for(i=0;
i<24;
i++)
    {
 if(D[a][1]==D[b][G[i][0]]&&
  D[a][2]==D[b][G[i][1]]&&
  D[a][3]==D[b][G[i][2]]&&
  D[a][6]==D[b][7-G[i][0]]&&
  D[a][5]==D[b][7-G[i][1]]&&
  D[a][4]==D[b][7-G[i][2]])
 return 1;
    }
    return 0;
}
int main()
{
    scanf("%d",&N);
    for(i=0;
i<N;
i++)
 for(j=1;
j<=6;
j++)
 scanf("%d",&D[i][j]);
    for(i=0;
i<N;
i++)
 for(j=i+1;
j<N;
j++)
 {
 if(ch(i,j))
 {
 puts("No");
 return 0;
 }
 }
    puts("Yes");
    return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
long long n, k, h, ans;
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n >> k;
for (int i=0;i<n;i++){
	cin >> h; if (h>=k) ans++;
}
cout << ans;
return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
int b[5100];
int c[5100];
pair<int,int> p[5100];
int dp[5100][5100];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%d%d",b+i,c+i);
	for(int i=0;i<a;i++){
		p[i]=make_pair(b[i]+c[i],c[i]);
	}
	std::sort(p,p+a);
	for(int i=0;i<a;i++){
		b[i]=p[i].first-p[i].second;
		c[i]=p[i].second;
	}
	for(int i=0;i<5100;i++)for(int j=0;j<5100;j++)dp[i][j]=mod*2;
	dp[0][0]=0;
	for(int i=0;i<a;i++){
		for(int j=0;j<=i;j++){
			dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
			if(dp[i][j]<=b[i])dp[i+1][j+1]=min(dp[i+1][j+1],dp[i][j]+c[i]);
		}
	}
	int ret=0;
	for(int i=0;i<=a;i++)if(dp[a][i]<mod*2)ret=i;
	printf("%d\n",ret);
}

Measured memory_bytes: 101888
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stack>
using namespace std;
int main()
{
	stack<int> S;
	string s;
	int a,b;
	while(cin>>s){
		if(s[0]=='+'){
			a=S.top();
			S.pop();
			b=S.top();
			S.pop();
			S.push(a+b);
		}else if(s[0]=='-'){
			a=S.top();
			S.pop();
			b=S.top();
			S.pop();
			S.push(b-a);
		}else if(s[0]=='*'){
			a=S.top();
			S.pop();
			b=S.top();
			S.pop();
			S.push(a*b);
		}else{
			S.push(atoi(s.c_str()));
		}
	}
	int r=S.top();
	cout<<r<<endl;
	return 0; 
	
}


Measured memory_bytes: 3212
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

import static java.lang.Integer.parseInt;

/**
 * Era Name
 */
public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		while ((line = br.readLine()) != null && !line.isEmpty()) {
			int N, Q;
			N = parseInt(line.substring(0, line.indexOf(' ')));
			Q = parseInt(line.substring(line.indexOf(' ') + 1));
			if ((N | Q) == 0) break;

			NavigableMap<Integer, String> mins = new TreeMap<>();
			Map<String, Integer> maxs = new HashMap<>();

			mins.put(0, "Unknown");
			maxs.put("Unknown", 0);

			StringTokenizer st;
			for (int i = 0; i < N; i++) {
				st = new StringTokenizer(br.readLine());
				String E;
				int B, W;
				E = st.nextToken();
				B = parseInt(st.nextToken());
				W = parseInt(st.nextToken());
				mins.put(W - B + 1, E);
				maxs.put(E, W);
			}

			for (int i = 0; i < Q; i++) {
				int q, w;
				q = parseInt(br.readLine());
				w = q - mins.floorKey(q) + 1;
				String e = mins.floorEntry(q).getValue();
				if (q <= maxs.get(e)) {
					System.out.println(e + " " + w);
				} else {
					System.out.println("Unknown");
				}
			}
		}
	}
}

Measured memory_bytes: 45592
/*
    Author : Nishant Gupta 2.0
*/
#include<bits/stdc++.h>
using namespace std;

#define LL long long int
#define getcx getchar_unlocked
#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define MAX 1000005
#define LOG_MAX 20
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL (LL(1e18))
#define chk(a) cerr << endl << #a << " : " << a << endl
#define chk2(a,b) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << endl
#define chk3(a,b,c) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << endl
#define chk4(a,b,c,d) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << "\t" << #d << " : " << d << endl
#define rep(i, a, n) for(i=a;i<n;i++)
#define rev(i, a, n) for(i=a;i>=n;i--)
#define in(x) scanf("%d", &x)
#define inl(x) scanf("%lld", &x)
#define in2(x, y) scanf("%d %d", &x, &y)
#define inl2(x, y) scanf("%lld %lld", &x, &y)
#define MSV(A,a) memset(A, a, sizeof(A))
#define rep_itr(itr, c) for(itr = (c).begin(); itr != (c).end(); itr++)
#define finish(x) {cout<<x<<'\n'; return;}
typedef pair<int, int> pi;
typedef pair<LL, LL> pl;
const char en = '\n';

int cnt[MAX] = {0};
vector<int> f[MAX];
int np[MAX];
void pre() {
	np[0] = np[1] = 1;
	for(int i=2;i*i<MAX;i++) {
		if(!np[i]) {
			for(int j=i*i;j<MAX;j+=i) {
				np[j] = 1;
			}
		}
	}
	
	for(int i=2;i*i<MAX;i++) {
		if(!np[i]) {
			for(int j=2*i;j<MAX;j+=i) {
				int q = j/i;
				if(q >= i) f[j].PB(i);
				if(q > i && !np[q]) f[j].PB(q); 
			}
		}
	}
	for(int i=2;i<MAX;i++) {
		if(!np[i]) f[i].PB(i);
	}
}
void solve() {
	int n;in(n);
	int a[n];
	
	int g = 0;
	for(int i=0;i<n;i++) {
		in(a[i]);
		g = __gcd(g, a[i]);
	}
	
	if(g != 1) finish("not coprime");
	
	for(int i=0;i<n;i++) {
		int sz = f[a[i]].size();
		for(int j=0;j<sz;j++) {
			if(cnt[f[a[i]][j]] > 0) finish("setwise coprime");
			cnt[f[a[i]][j]]++;
		}
	}
	finish("pairwise coprime");
}

int main() {
	int t = 1;
	pre();
	//~cin>>t;
	while(t--) {
		solve();
	}
    return 0;
}


Measured memory_bytes: 67108
#include <set>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <map>
#include <bitset>
#define ll long long
#define inf 0x3f3f3f3f
#define ms(a, b) memset(a, b, sizeof a)
using namespace std;
ll gcd(ll a, ll b){
    ll t;
    while(b){
        t = b;
        b = a % b;
        a = t;
    }
    return a;
}
int main(void) {
    int n;
    scanf("%d", &n);
    ll num = 1;
    for(int i = 1; i <= n; ++i) {
        ll a;
        scanf("%lld", &a);
        num = num / gcd(a, num) * a;
    }
    printf("%lld", num);
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = [0]*(n+1)
cnt = 0

for i in range(n):
    b[a[i]] += 1
for i in range(1,n+1):
    cnt += b[i]*(b[i]-1)//2
for i in range(n):
    if(b[a[i]]>1):
        print(cnt - b[a[i]]*(b[a[i]]-1)//2 + (b[a[i]]-1)*(b[a[i]]-2)//2)
    else:
        print(cnt)

Measured memory_bytes: 100612
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

    private static BigInteger THRESHOLD_VALUE = BigInteger.valueOf(1000000000000000000L);

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = Integer.parseInt(scanner.next());

        // 取得と同時に乗算をすると閾値が超えた後に 0 が来た場合に WA になるため、保持する
        long[] a = new long[N];
        for (int i = 0; i < N; i++) {
            long num = Long.parseLong(scanner.next());
            if (num == 0) {
                System.out.println("0");
                return;
            }
            a[i] = num;
        }

        BigInteger ans = BigInteger.ONE;
        for (long num : a) {
            ans = ans.multiply(BigInteger.valueOf(num));

            if (ans.compareTo(THRESHOLD_VALUE) > 0) {
                System.out.println("-1");
                return;
            }
        }
        System.out.println(ans.toString());
    }
}


Measured memory_bytes: 50588
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
/*--Input//////////////////////////////////////////////////*/
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
    cin >> first;
    IN(rest...);
    return;
}
#define SS(T, ...)      T __VA_ARGS__; IN(__VA_ARGS__);
/*--Output/////////////////////////////////////////////////*/
inline int p(void){cout << endl; return 0;}
template<class Head> int p(Head&& head){cout << head;p();return 0;} template<class Head,class... Tail> int p(Head&& head,Tail&&... tail){cout<<head<<" ";p(forward<Tail>(tail)...);return 0;}
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.second < b.second; }

const int MOD = 1000000007;

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

ll CbyK(ll n, ll k){
    ll res=1;
    rep(i,k){
        res*=n-i;
        res/=i+1;
    }
    return res;
}
int main() {
    SS(ll,n,a,b)
    vl v(n);rep(i,n)cin>>v[i];sort(v.rbegin(),v.rend());

    long double ave=0;
    rep(i,a)ave+=v[i];
    ave/=a;

    ll res=0,num=0;
    rep(i,n)if(v[i]==v[a-1])num++;

    if (v[0] == v[a-1]) {
        for (int r = a; r <= b; ++r) {
            res += CbyK(num,r);
        }
    }
    else {
        ll r = 0;
        rep(i,a){
            if (v[i]==v[a-1]) r++;
        }
        res = CbyK(num,r);
    }
    p(ave);
    p(res);
}

Measured memory_bytes: 256
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> orderedMultiset;
int solve()
{
	int x,k,d;
	cin>>x>>k>>d;
	int move=ceil((double)abs(x)/(double)d);
	if(move<=k){
		int rem=k-move;
		if(rem%2==0)
			cout<<abs(abs(x)-move*d)<<endl;
		else
			cout<<abs(abs(x)-move*d+d)<<endl;
	}
	else{
		cout<<abs(x)-k*d<<endl;
	}
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}




Measured memory_bytes: 3744
#n=int(input())
#li=input().split()
#li=list(map(int,input().split()))
n=input()
d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
if len(n)%2==1:
    print("No")
else:
    flag=0
    ans="Yes"
    for i in range(26):
        if flag==0:
            count=0
            for j in range(len(n)):
                if n[j]==d[i]:
                    count+=1
            if count%2==1:
                flag=1
                ans="No"
                break
        else:
            break

    print(ans)


Measured memory_bytes: 3064
#include<stdio.h>
int main(void)
{
	int n,m,i,j,cnt,flg;
	int a[10001],b[10001],flgk[501];
	while(1){
		scanf("%d %d",&n,&m);
		if(n==0&&m==0) break;
		cnt=0; flg=0;
		for(i=1;i<=n;i++) flgk[i]=0;
		for(i=1;i<=m;i++){
			scanf("%d %d",&a[i],&b[i]);
			if(a[i]==1){
				cnt++; flgk[b[i]]=1;
				flgk[a[i]]=1;
			}
			if(b[i]==1){
				cnt++; flgk[a[i]]=1;
				flgk[b[i]]=1;
			}	
		}
		if(cnt==0) flg=1;
		if(flg==0){
			for(i=1;i<=n;i++){
				if(flgk[i]==1){
					for(j=1;j<=m;j++){
						if(i==a[j]&&flgk[b[j]]==0){
							flgk[b[j]]=2;
							cnt++;
						}
					}
					for(j=1;j<=m;j++){
						if(i==b[j]&&flgk[a[j]]==0){
							flgk[a[j]]=2;
							cnt++;
						}
					}
				}
			}
		}
		printf("%d\n",cnt);
	}
	return 0;
}

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

int main()
{
    ll k, x, y;
    cin >> k >> x >> y;
    int ans = 0;
    vector<ll> vx, vy;
    if(k % 2 == 0 && abs(x + y) % 2 == 1){
        cout << -1 << endl;
        return 0;
    }
    if(abs(x) + abs(y) == k){
        cout << 1 << endl;
        cout << x << " " << y << endl;
        return 0;
    }
    ll nx = 0, ny = 0;
    while(abs(nx - x) + abs(ny - y) > k * 2){
        if(abs(x - nx) > k){
            if(x > nx) nx += k;
            else nx -= k;
            vx.push_back(nx);
            vy.push_back(ny);
            ans++;
        }
        else if(abs(x - nx) != 0){
            ny = k - abs(x - nx);
            nx = x;
            if(y < 0) ny = -ny;
            vx.push_back(nx);
            vy.push_back(ny);
            ans++;
        }
        else{
            if(y > ny) ny += k;
            else ny -= k;
            vx.push_back(nx);
            vy.push_back(ny);
            ans++;
        }
    }
    if(abs(nx + ny) % 2 != abs(x + y) % 2){
        if(abs(x - nx) > abs(y - ny)){
            if(x - nx > 0) nx += k;
            else nx -= k;
        }
        else{
            if(y - ny > 0) ny += k;
            else ny -= k;
        }
        vx.push_back(nx);
        vy.push_back(ny);
        ans++;
    }
    ll d = abs(x - nx) + abs(y - ny);
    if(abs(x - nx) > abs(y - ny)){
        if(x - nx > 0) nx += d / 2;
        else nx -= d / 2;
        if(y - ny > 0) ny -= k - d / 2;
        else ny += k - d / 2;
    }
    else{
        if(y - ny > 0) ny += d / 2;
        else ny -= d / 2;
        if(x - nx > 0) nx -= k - d / 2;
        else nx += k - d / 2;
    }
    vx.push_back(nx);
    vy.push_back(ny);
    ans++;
    cout << ans + 1 << endl;
    for(int i = 0; i < ans; i++) cout << vx[i] << " " << vy[i] << endl;
    cout << x << " " << y << endl;
}

Measured memory_bytes: 5604
str = gets.chomp

ary = {}

str.each_char{|c| if ary[c].nil? then ary[c] = 1 else ary[c] += 1 end}

r = true
ary.each{|a|r = false if a[1] > 1}
puts (if r then 'yes' else 'no' end)

Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
const int maxn = 10000 + 10;
long long sqr(long long a) {return a * a; }
int main() {
    long long a, b, c;  cin >> a >> b >> c;
    if (a < c && b < c && (c - a - b > 0 && sqr(a + b - c) > 4 * a * b)) {
        cout << "Yes\n";
    }
    else {
        cout << "No\n";
    }
    getchar(); getchar();
    return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val s = sc.next()

  println(abc160a(s))
}

private fun abc160a(s: String): String {
  val s3 = s.get(2)
  val s4 = s.get(3)
  val s5 = s.get(4)
  val s6 = s.get(5)

  if (s3 == s4 && s5 == s6) return "Yes"
  return "No"
}


Measured memory_bytes: 31256
number = int(input())
# values = [i+2 for i in range(2*10**5)]
values = list(map(int, input().split()))

maxV = 10**6+1
dp = [0]*(maxV)

for a in values:
    i = 1
    if dp[a] > 0:
        dp[a] = dp[a] + 1
        continue
    while i * a < maxV:
        i_a = i * a
        dp[i_a] = dp[i_a] + 1
        i += 1

count = 0
for a in values:
    if dp[a] == 1:
        count+=1

print(count)


Measured memory_bytes: 121656
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(abs(b-a)<=d&&abs(c-b)<=d||abs(c-a)<=d) cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
double weight,height;
int main(){
	int n,tn;
	char tmp[2];
	while(1){
		if(cin.eof()) break;
		else cin >> n >> tmp[0] >> weight >> tmp[1] >> height;
		tn = weight / (height * height);
		if(tn >= 25.0) cout << n << endl;
	}
	return 0;
}

Measured memory_bytes: 0
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

type Point struct {
	x int
	y int
}

func main() {
	rdr := NewReader(10000)
	H, W, D := ScanInt(), ScanInt(), ScanInt()

	max := H*W + 1
	px := make([]int, max)
	py := make([]int, max)
	for i := 0; i < H; i++ {
		s := ReadInts(rdr)
		for j, v := range s {
			px[v] = i
			py[v] = j
		}
	}

	memo := make([]int, max)
	for i := 1 + D; i <= H*W; i++ {
		memo[i] = memo[i-D] + Abs(px[i]-px[i-D]) + Abs(py[i]-py[i-D])
	}

	Q := ReadInt(rdr)

	for i := 0; i < Q; i++ {
		ints := ReadInts(rdr)
		L, R := ints[0], ints[1]
		fmt.Println(memo[R] - memo[L])
	}
}

type Reader struct {
	rdr  *bufio.Reader
	size int
}

func NewReader(size int) *Reader {
	return &Reader{
		bufio.NewReaderSize(os.Stdin, size),
		size,
	}
}

func ScanInt() (i int) {
	fmt.Scan(&i)
	return
}

func ReadLine(r *Reader) string {
	buf := make([]byte, 0, r.size)
	for {
		line, isPrefix, err := r.rdr.ReadLine()
		if err != nil {
			panic(err)
		}
		buf = append(buf, line...)
		if !isPrefix {
			break
		}
	}
	return string(buf)
}

func ReadStrs(r *Reader) []string {
	return strings.Split(ReadLine(r), " ")
}

func ReadInts(r *Reader) []int {
	a := ReadStrs(r)
	n := make([]int, 0)
	for _, v := range a {
		if i, e := strconv.Atoi(v); e == nil {
			n = append(n, i)
		}
	}
	return n
}

func Abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}

func ReadInt(r *Reader) (n int) {
	if i, e := strconv.Atoi(ReadLine(r)); e == nil {
		n = i
	}
	return
}


Measured memory_bytes: 10624
#include "bits/stdc++.h"
 
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<VVLL> VVVLL;

#define SORT_ASC(c) sort((c).begin(), (c).end())
#define SORT_DESC(c) sort((c).begin(), (c).end(), greater<typeof((c).begin())>())
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FORL(i,a,b) for(LL i=(a);i<(b);++i)
#define REPL(i,n)  FORL(i,0,n)
#define SIZE(a) int((a).size())
#define ALL(a) (a).begin(),(a).end()
 
const double EPS = 1e-10;
const double PI  = acos(-1.0);

 //debug func
template<typename T>
void vprint(vector<T> v) {
    for(auto x : v) {
        cerr << x << " ";
    }
    cerr << endl;
}
 
template<typename T>
void vvprint(vector<vector<T>> vv) {
    REP(i, SIZE(vv)) {
        REP(j, SIZE(vv[i])) {
            cerr << vv[i][j] << " ";
        }
        cerr << endl;
    }
}

template <typename Iterator>
inline bool next_combination(const Iterator first, Iterator k, const Iterator last)
{
   /* Credits: Thomas Draper */
   if ((first == last) || (first == k) || (last == k))
      return false;
   Iterator itr1 = first;
   Iterator itr2 = last;
   ++itr1;
   if (last == itr1)
      return false;
   itr1 = last;
   --itr1;
   itr1 = k;
   --itr2;
   while (first != itr1)
   {
      if (*--itr1 < *itr2)
      {
         Iterator j = k;
         while (!(*itr1 < *j)) ++j;
         iter_swap(itr1,j);
         ++itr1;
         ++j;
         itr2 = k;
         rotate(itr1,j,last);
         while (last != j)
         {
            ++j;
            ++itr2;
         }
         rotate(k,itr2,last);
         return true;
      }
   }
   rotate(first,k,last);
   return false;
}

inline double get_time_sec(void){
    return static_cast<double>(chrono::duration_cast<chrono::nanoseconds>(chrono::steady_clock::now().time_since_epoch()).count())/1000000000;
}

template<typename T>
T gcd(T a, T b) {
    if(a > b) swap(a, b);
    if(a == 0) return b;
    else return gcd(b%a, a);
}

template<typename T>
T lcm(T a, T b) {
    return (a / gcd(a, b)) * b;
}

template<typename T>
map<T, T> prime_list(T n) {
    map<T, T> ret;
    for(T i = 2; i*i <= n; i++) {
        if(n % i == 0) {
            ret[i] = 0;
            while(n % i == 0) {
                n /= i;
                ret[i]++;
            }
        }
    }
    if(n != 1) ret[n]++;
    return ret;
}

#define MOD 1000000007

LL mypow(LL a, LL n) {
    if(n == 1) return a % MOD;
    if(n % 2 == 1) return (a * mypow(a, n-1)) % MOD;
    LL t = mypow(a, n/2);
    return (t * t) % MOD; 
}

int main(void) {
    string s;
    cin >> s;
    int ans = 0;
    char p = s[0];
    FOR(i, 1, s.size()) {
        if(s[i] != p) {
            ans++;
            p = s[i];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <math.h>

int main(void)
{
   int i,s[1000]={},sum;
   double m,aa,a,bun,n;
   
   while(1)
   {
       sum=0; aa=0;
       for(i=0;i<1000;i++)
       {
           s[i]=0;
       }
       scanf("%lf",&n);
       if(n==0) break;
       else
       {
           for(i=0;i<n;i++)
           {
               scanf("%d",&s[i]);
               sum+=s[i];
           }
           m=sum/n;
           for(i=0;i<n;i++)
           {
               aa+=(s[i]-m)*(s[i]-m);
           }
           bun=aa/n;
           a=sqrt(bun);
           printf("%f\n",a);
       }
   }
   
    return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++) //for文マクロ
using namespace std;

typedef unsigned long ul;
typedef long long ll;
typedef pair<ul, ul> P; //ペア　タイプでふ
int main()
{
    int a, b;
    cin >> a >> b;
    if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0)
    {
        cout << "Possible";

    }
    else
    {
        cout << "Impossible";

    }
}

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

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

	int N;
	int i,j;
	int tmp;
	int answer;
	int counter=0;
	double ave;
	vector<int> given;

	cin >> N;

	answer=N*N*N;
	cout << answer << endl;

	return 0;
}



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

int main() {
    int a,b,temp1,temp2,temp3,c;
    cin>>a>>b>>c;
    temp1=c;temp2=a;temp3=b;
    a=temp1;b=temp2;c=temp3;
    cout<<a<<" "<<b<<" "<<c;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int main()
{
    int n;
    long long int a,b;
    long long int sum=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%lld %lld",&a,&b);
        sum+=(b-a+1);
    }
    printf("%lld\n",sum);
}


Measured memory_bytes: 256
from math import sin,cos,pi
x = 0
y = 0
ca = 90
while True:
    d, a = list(map(int, input().split(",")))
    if d or a:
        x += d*cos(ca*pi/180)
        y += d*sin(ca*pi/180)
        ca -= a
    else:
        break

print(int(x))
print(int(y))

Measured memory_bytes: 7848
n = int(input())
h = list(map(int, input().split()))
a, count = 0, 0
for i in range(n-1):
  if h[i] >= h[i+1]:
    a += 1
    if i == n-2 and count < a:
      count = a
  else:
    if count < a:
      count = a
    a = 0
print(count)

Measured memory_bytes: 63984
#include<bits/stdc++.h>
#define ll long long

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

int main(){
	ios::sync_with_stdio(false);
	ll h;
	cin>>h;
	ll c = 0;
	while(h>0){
		h/=2;
		++c;
	}
	ll ans = 0;
	for(ll i=0;i<c;++i){
		ans += power(2,i);
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

// {{{
// source: https://github.com/raahii/algo
func MaxInts(nums []int) (int, int) {
	var maxIdx, maxVal int
	for i, e := range nums {
		if i == 0 || e > maxVal {
			maxIdx = i
			maxVal = e
		}
	}
	return maxVal, maxIdx
}

func MinInts(nums []int) (int, int) {
	var minIdx, minVal int
	for i, e := range nums {
		if i == 0 || e < minVal {
			minIdx = i
			minVal = e
		}
	}
	return minVal, minIdx
}

func SumInts(nums []int) int {
	s := 0
	for _, v := range nums {
		s += v
	}
	return s
}

func ReverseInts(nums []int) []int {
	rnums := make([]int, len(nums))
	for i := 0; i < len(nums); i++ {
		rnums[len(nums)-1-i] = nums[i]
	}
	return rnums
}

func ExtendInts(nums1 []int, nums2 []int) []int {
	for _, v := range nums2 {
		nums1 = append(nums1, v)
	}
	return nums1
}

func Ints2d(n_rows, n_cols int) [][]int {
	ints := make([][]int, n_rows)
	for i := 0; i < n_rows; i++ {
		ints[i] = make([]int, n_cols)
	}
	return ints
}

func MemsetInts1d(nums []int, val int) {
	for i := range nums {
		nums[i] = val
	}
}

func MemsetInts2d(nums [][]int, val int) {
	for i := range nums {
		for j := range nums[i] {
			nums[i][j] = val
		}
	}
}

func ContainsInt(nums []int, num int) bool {
	sort.Ints(nums)

	s, e := 0, len(nums)
	for {
		if s >= e {
			break
		}

		m := (e + s) / 2
		if nums[m] == num {
			return true
		} else if num > nums[m] {
			s = m + 1
		} else {
			e = m
		}
	}

	return false
}

func ReadInt(f *os.File) int {
	var n int
	fmt.Fscanf(f, "%d", &n)
	return n
}

func ReadInts(f *os.File, n int) []int {
	nums := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(f, "%d", &nums[i])
	}
	return nums
}

func ReadLines(f *os.File, n int) []string {
	var lines []string
	reader := bufio.NewReader(f)
	for i := 0; i < n; i++ {
		bytes, _, err := reader.ReadLine()
		if err != nil {
			break
		}
		lines = append(lines, string(bytes))
	}

	return lines
}

func ReadWords(f *os.File, n int) []string {
	strs := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(f, "%s", &strs[i])
	}
	return strs
}

func Pow(a, n int) int {
	c := 1
	for i := 0; i < n; i++ {
		c *= a
	}
	return c
}

// }}}

func main() {
	N, W := ReadInt(os.Stdin), ReadInt(os.Stdin)
	w, v := make([]int, N), make([]int, N)
	for i := 0; i < N; i++ {
		w[i], v[i] = ReadInt(os.Stdin), ReadInt(os.Stdin)
	}

	dp := Ints2d(N+1, W+1)
	for i := 0; i < N; i++ {
		for j := 0; j < W+1; j++ {
			if j < w[i] {
				dp[i+1][j] = dp[i][j]
			} else {
				dp[i+1][j], _ = MaxInts([]int{
					dp[i][j],
					dp[i][j-w[i]] + v[i],
				})
			}
		}
	}
	fmt.Println(dp[N][W])
}

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

int main() {
  long N,C;
  cin>>N>>C;
  vector<vector<long>> d(C,vector<long>(C));
  vector<vector<long>> c(N,vector<long>(N));

  vector<long> c0(C);
  vector<long> c1(C);
  vector<long> c2(C);
  for(int i=0;i<C;i++) for(int j=0;j<C;j++) cin>>d[i][j];
  for(int i=0;i<N;i++) for(int j=0;j<N;j++) cin>>c[i][j];
  for(int y=0;y<N;y++) for(int x=0;x<N;x++){
    if((x+y)%3==0) c0[c[x][y]-1]++;
    if((x+y)%3==1) c1[c[x][y]-1]++;
    if((x+y)%3==2) c2[c[x][y]-1]++;
  }
  long ans=123456789012345;
  for(int i=0;i<C;i++) for(int j=0;j<C;j++) for(int k=0;k<C;k++){
    if(i==j||j==k||k==i) continue;
    long tmp=0;
    for(int l=0;l<C;l++) tmp+=d[l][i]*c0[l];
    for(int l=0;l<C;l++) tmp+=d[l][j]*c1[l];
    for(int l=0;l<C;l++) tmp+=d[l][k]*c2[l];
    ans=min(ans,tmp);
  }
cout<<ans<<endl;
}


Measured memory_bytes: 5596