akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

#define N 10

int main(void)
{
  int i,j,tmp=0,k,l,n,S;
  int a[N][5];

  while(1)
    {
      scanf("%d",&n);
      if(n==0) break;
      for(i=0;i<=n-1;i++)
	{
	  for(j=0;j<=4;j++)
	    {
	      scanf("%d",&a[i][j]);
	    }
	}
      k=0;
      S=0;
      while(k!=n)
	{
	  k=0;
          for(i=n-1;i>=0;i--)
	    {
	      if(a[i][0]==a[i][1] && a[i][1]==a[i][2] && a[i][0]!=0)
	        {
	          if(a[i][2]==a[i][3])
		    {
		      if(a[i][3]==a[i][4])
		        {
		          for(j=0;j<=4;j++)
			    {
			      S+=a[i][j];
			      a[i][j]=0;
			    }
		        }
		      else
		        {
		          for(j=0;j<=3;j++)
			    {
			      S+=a[i][j];
			      a[i][j]=0;
			    }
		        }
		    }
	          else
		    {
		      for(j=0;j<=2;j++)
		        {
			  S+=a[i][j];
		          a[i][j]=0;
		        }
		    }
	        }
	      else if(a[i][0]!=a[i][1] && a[i][1]==a[i][2] && a[i][2]==a[i][3] && a[i][1]!=0)
	        {
	          if(a[i][3]==a[i][4])
		    {
		      for(j=1;j<=4;j++)
		        {
			  S+=a[i][j];
		          a[i][j]=0;
		        }
		    }
	          else
	            {
	              for(j=1;j<=3;j++)
		        {
			  S+=a[i][j];
		          a[i][j]=0;
		        }
		    }
	        }
	      else if(a[i][1]!=a[i][2] && a[i][2]==a[i][3] && a[i][3]==a[i][4] && a[i][2]!=0)
	        {
	          for(j=2;j<=4;j++)
		    {
		      S+=a[i][j];
		      a[i][j]=0;
		    }
	        }
	      else
		{
		  k++;
		}
	    }
          if(k<=n-1)
	    {
	      for(l=1;l<=n;l++)
		{
                  for(j=0;j<=4;j++)
	            {
	              for(i=1;i<=n-1;i++)
	                {
	                  if(a[i][j]==0)
		            {
		              tmp=a[i][j];
		              a[i][j]=a[i-1][j];
		              a[i-1][j]=tmp;
		            }
	                }
	            }
		}
	    }
	}
      printf("%d\n",S);
    }
  return 0;
}

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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

int main() {
    int64_t n;
    cin >> n;

    vector<pair<int64_t, int64_t>> x(n);
    for (auto i : irange(1L, n + 1)) {
        cin >> x[i - 1].first;
        --x[i - 1].first;
        x[i - 1].second = i;
    }
    sort(x.begin(), x.end());

    int64_t cur = -1L;
    vector<int64_t> ans(n * n, -1L);
    for (const auto& t : x) {
        auto idx = t.first;
        auto xx = t.second;

        for (auto i : irange(0L, xx - 1)) {
            ++cur;

            while (cur < n * n && ans[cur] != -1L) {
                ++cur;
            }

            assert(cur < n * n);
            ans[cur] = xx;
        }

        if (cur >= idx) {
            cout << "No" << endl;
            return 0;
        }

        ans[idx] = xx;
    }

    cur = n * n;
    for (const auto& t : x | reversed) {
        auto idx = t.first;
        auto xx = t.second;

        for (auto i : irange(xx, n)) {
            --cur;
            while (cur >= 0 && ans[cur] != -1L) {
                --cur;
            }

            assert(cur >= 00);
            ans[cur] = xx;
        }

        if (cur < idx) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    const auto* delim = "";
    for (auto a : ans) {
        assert(a != -1L);
        cout << delim << a;
        delim = " ";
    }
    cout << endl;
}

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Ti = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  string s;
  cin >> s;
  s[3]++;
  cout << s << endl;

  return 0;
}


Measured memory_bytes: 256
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

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

	vector<int> v(3);
	cin >> v[0] >> v[1] >> v[2];
	stable_sort(v.begin(),v.end());

	printf("%d\n",v[0]+v[1]);

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
                                                                                                
  
int main(){
                                                                     

    int x, i, j;

    int max = 0;

    cin >> x;

    if( x == 1 ){

        cout << 1 << endl;

        return 0;

        }


    else for( i = 2 ; i < x ; i = i + 1 ){

              for( j = i * i ; j <= x ; j *= i ){

                   if( max < j ) max = j;

                   }

              }


    cout << max << endl;


    return 0;

    }

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
	#define eprintf(...) 42
#endif

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
	return (ull)rng() % B;
}

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second

clock_t startTime;
double getCurrentTime() {
	return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}

const int N = 200200;
int a[N], b[N];
int n, k;

void solve() {
	for (int i = 0; i <= n; i++)
		b[i] = 0;
	for (int i = 0; i < n; i++) {
		int l = max(i - a[i], 0);
		int r = min(i + a[i] + 1, n);
		b[l]++;
		b[r]--;
	}
	for (int i = 1; i <= n; i++)
		b[i] += b[i - 1];
	for (int i = 0; i < n; i++)
		a[i] = b[i];
}

int main()
{
	startTime = clock();
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

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

//	n = 200000;
//	k = 200000;

	while(k--) {
		//printf("here\n");
		bool ok = true;
		for (int i = 0; i < n; i++)
			ok &= a[i] == n;
		if (ok) break;
		solve();
	}
	for (int i = 0; i < n; i++)
		printf("%d ", a[i]);
	printf("\n");

	return 0;
}


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

int main() {
  
  int N; cin >> N; int64_t sum = 0;
  
  for (int i = 1; i <= N; i++) {
    
    if (i % 3 == 0 || i % 5 == 0) continue;
    
    sum += i;
    
  }
  
  cout << sum << endl;
  
}

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



int main(){
   ll d,n;
   cin >> d >> n;
   if(n==100){
		if(d==0)cout<<101<<endl;
		else if(d==1)cout<<10100<<endl;
		else if(d==2)cout<<1010000<<endl;}
   else if(d ==0) cout <<n <<endl;
   else if(d ==1) cout << 100*n <<endl;
   else if(d ==2) cout  << 10000 *n << endl;
      }

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

int main() {
  int N,M;
  cin >> N >> M;
  vector<int> A(M);
  int sum=0;
  for(int i=0;i<M;++i){
    cin >> A[i];
    sum = sum + A[i];
  }
  if(N-sum>=0) cout<<N-sum<<endl;
  else cout<<"-1"<<endl;
 
    
}

Measured memory_bytes: 3668
H, W = [int(_) for _ in input().split()]
a = [input() for _ in range(H)]

def turnover(hw):
    l1 = len(hw)
    l2 = len(hw[0])
    wh = ['' for _ in range(l2)]
    for i in range(0, l1):
        for j in range(0, l2):
            wh[j] += hw[i][j]
    return wh

def adjustHeight(hw):
    l2 = len(hw[0])
    for i in range(0, len(hw)):
        if hw[i] == '.' * l2:
            del hw[i]
            return adjustHeight(hw)
    return hw

def adjustWidth(hw):
    wh = turnover(hw)
    return turnover(adjustHeight(wh))

[print(_) for _ in adjustWidth(adjustHeight(a))]

Measured memory_bytes: 3064
n = gets.to_i
as = gets.split.map(&:to_i).map.with_index { |x, i| x - i - 1 }.sort
med = n.odd? ? as[n/2] : (as[n/2-1] + as[n/2]) / 2
p as.map { |a| (a-med).abs }.inject(:+)

Measured memory_bytes: 22152
#include <bits/stdc++.h>
#define int long long
#define P(x) {if (debug) cout << x << endl;}
#define H(x) P(#x << ": " << (x))
#define FR(i,a,b) for (int i=(a); i<(b); i++)
#define F(i,n) FR(i,0,n)
#define DR(i,a,b) for (int i=(b); i-->(a);)
#define D(i,n) DR(i,0,n)
#define S(s) (int)(s).size()
#define ALL(v) v.begin(), v.end()
#define MI(a,v) a = min(a,v)
#define MA(a,v) a = max(a,v)
#define V vector
#define pb push_back
#define mt make_tuple
using namespace std;
template<class T> ostream &operator<<(ostream &os, V<T> v) {
    F(i,S(v)) os<<(i?" ":"")<<v[i];
    return os;
}
const bool debug = 1;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    string s; cin>>s;
    int n = S(s);
    bool ok = false;
    F(i,n+1) FR(j,i,n+1) {
        if (s.substr(0,i) + s.substr(j) == "keyence")
            ok = true;
    }
    cout<<(ok?"YES\n":"NO\n");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch PlayingTagOnTree | diff PlayingTagOnTree.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address PlayingTagOnTree.cpp && ./a.out

/*

 5/21/2020

 9:01-

 */

const int MAX_N=1e6+1;
int N,t,a;
VI G[MAX_N];

int D[2][MAX_N];
void dfs(int u, int pre, int c, int d) {
  D[c][u]=d;
  FORR(v,G[u])if(v!=pre) dfs(v,u,c,d+1);
}
void solve() {
  dfs(t,-1,0,0),dfs(a,-1,1,0);
  int res=0;
  REP(i,N) if(D[0][i]<D[1][i]) {
    SMAX(res,D[1][i]);
  }
  cout<<res-1<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;

  cin>>N>>t>>a,--t,--a;
  REP(i,N-1){
    int u,v; cin>>u>>v;
    --u,--v;
    G[u].push_back(v),G[v].push_back(u);
  }
  solve();

  return 0;
}


Measured memory_bytes: 38144
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REV(c) reverse((c).begin(),(c).end())

using namespace std;

// 最大公約数
int64_t gcd(int64_t a, int64_t b) {
  return b != 0 ? gcd(b, a % b) : a;
}

// 最小公倍数
int64_t lcm(int64_t a, int64_t b) {
  return a * b / gcd(a, b);
}

int ctoi(char c){
  return c - '0';
}

struct UnionFind {
  vector< int > data;
 
  UnionFind(int sz) {
    data.assign(sz, -1);
  }
 
  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }
 
  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }
 
  int size(int k) {
    return (-data[find(k)]);
  }
};

int64_t rec(int64_t b, string s, int64_t i){
  if (i==0){
    return stoll(s) + b;
  }else{
    int64_t t = 0;
    for(int j=1;j<s.size()-i+1;j++){
      t += rec(b+stoll(s.substr(0,j)), s.substr(j, s.size() - j), i-1);
    }
    return t;
  }
}

int main(){
  string s;
  cin >> s;
  int64_t t = 0;
  for(int i=0;i<s.size();i++){
    t += rec(0,s,i);
  }
  cout << t << endl;
  return 0;
}



Measured memory_bytes: 256
# coding: utf-8
# Your code here!
class UnionFind:
    def __init__(self, n):
        self.parent = list(range(n))#親ノード
        self.size = [1]*n #グループの要素数

    def root(self, x): #root(x): xの根ノードを返す．
        while self.parent[x] != x:
            self.parent[x] = self.parent[self.parent[x]]
            x = self.parent[x]
        return x 

    def merge(self, x, y): #merge(x,y): xのいるグループと$y$のいるグループをまとめる
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return False
        if self.size[x] < self.size[y]: 
            self.size[y] += self.size[x] #yの要素数を更新
            self.parent[x] = y #xをyにつなぐ
        else:
            self.size[x] += self.size[y] #xの要素数を更新
            self.parent[y] = x #yをxにつなぐ
        return True

    def issame(self, x, y): #same(x,y): xとyが同じグループにあるならTrue
        return self.root(x) == self.root(y)
        
    def size(self,x): #size(x): xのいるグループの要素数を返す
        return self.size[self.root(x)]


n,m = [int(i) for i in input().split()]
 
T=UnionFind(n)
c=0
for _ in [0]*m:
    x,y,z=[int(i) for i in input().split()]
    if T.merge(x-1,y-1):
        c+=1
 
print(n-c)

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int n;
  cin >> n;
  cout << n / 3 << endl;
}


Measured memory_bytes: 764
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N, M;
int dp[301][301][301];
vector<P> G[300];

bool valid(int i, int a, int b, int c) {
  for (P p : G[i]) {
    int ctr = 0;
    if (a > p._1) ctr++;
    if (b > p._1) ctr++;
    if (c > p._1) ctr++;
    if (ctr != p._2) return false;
  }
  return true;
}

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N >> M;
  rep(i, M) {
    int l, r, x;
    cin >> l >> r >> x;
    l--, r--;
    G[r].pb(P(l, x));
  }

  dp[0][0][0] = 1;
  for (int i=1; i<=N; i++) {
    for (int a=0; a<i; a++) {
      for (int b=0; b<i; b++) {
        if (a != 0 && a == b) continue;
        int c = i-1;
        if (c != 0 && (a == c || b == c)) continue;
        if (dp[i-1][a][b] == 0) continue;
        // (a,b,c) ->
        // a
        if (valid(i-1, i, b, c)) {
          dp[i][b][c] += dp[i-1][a][b];
          dp[i][b][c] %= MOD;
        }

        // b
        if (valid(i-1, i, a, c)) {
          dp[i][a][c] += dp[i-1][a][b];
          dp[i][a][c] %= MOD;
        }

        // c
        if (valid(i-1, a, b, i)) {
          dp[i][a][b] += dp[i-1][a][b];
          dp[i][a][b] %= MOD;
        }
      }
    }
  }
  int s = 0;
  rep(a, N) {
    rep(b, N) {
      s += dp[N][a][b];
      s %= MOD;
    }
  }
  cout << s << "\n";
  return 0;
}


Measured memory_bytes: 104832
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<queue>
#include<algorithm>
#define ll long long
#define re register
using namespace std;
inline int gi()
{
	int f=1,sum=0;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
	return f*sum;
}
int n,m;
struct node
{
	int val,num;
}a[20];
int use[10]={0,2,5,5,4,5,6,3,7,6};
int dp[10010],pos[10010];
void print(int x)
{
if(!x)return;
	printf("%d",a[pos[x]].val);
	print(x-a[pos[x]].num);	
}
int main()
{
	n=gi();m=gi();
	for(int i=1;i<=m;i++)
	{
		a[i].val=gi(),a[i].num=use[a[i].val];
	}
	memset(dp,-127/3,sizeof(dp));
dp[0]=0;
	for(int i=1;i<=n;i++)
{
		for(int j=1;j<=m;j++)
			if(a[j].num<=i)
			{
				if(dp[i]<dp[i-a[j].num]+1)
{
	dp[i]=dp[i-a[j].num]+1;pos[i]=j;
}
else if(dp[i]==dp[i-a[j].num]+1)
{
	if(a[pos[i]].val<a[j].val)pos[i]=j;
}
			}
}
print(n);
puts("");
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;

vector<int> E(vector<int> a){
    return {a[3], a[1], a[0], a[5], a[4], a[2]};
}
vector<int> W(vector<int> a){
    return E(E(E(a)));
}
vector<int> S(vector<int> a){
    return {a[4], a[0], a[2], a[3], a[5], a[1]};
}
vector<int> N(vector<int> a){
    return S(S(S(a)));
}
int main() {
    vector<int> cu(6);
    char co;
    for (int i = 0; i < 6; i++){
        cin >> cu[i];
    }
    while (cin >> co){
        if (co == 'E'){
            cu = E(cu);
        }
        if (co == 'W'){
            cu = W(cu);
        }
        if (co == 'S'){
            cu = S(cu);
        }
        if (co == 'N'){
            cu = N(cu);
        };
    }
    cout << cu[0] << endl;
}


Measured memory_bytes: 3224
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(10);
    int N; cin >> N;
    vector<double> A(N); REP(i,N) cin >> A[i];
    double mot = 0;
    REP(i,N){
        mot += 1.0/A[i];
    }
    cout << 1.0 / mot << endl;



}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
using ll = long long;
#define MAX_N 1000001
#define MAX_M 100010
const long long mod = 1e9 + 7;
#define vec vector<int>
#define vecll vector<ll>
#define vecllvec vector<vector<ll>>
#define vecb vector<bool>
#define vecBvec vector<vector<bool>>
#define vecst vector<string>
#define veche vector<char>
#define vecd vector<double>
#define vecvec vector<vector<int>>
#define vecDvec vector<vector<double>>
#define vecHvec vector<vector<char>>
#define all(x) (x).begin(),(x).end()
#define ent cout<<endl
#define printvec(vec) for(int aqw=0;aqw<vec.size();aqw++){cout<<vec[aqw]<<" ";}ent;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define REP(i,m,n) for(int i=m;i<(int)n;++i)
#define INF 1e+9
using P = pair<int, int>;
#define PLL pair<ll, ll>;
#define MAX_V 1000
#define PI 3.141592653589793
// cout << setprecision(15) << std::fixed;

int d[MAX_V][MAX_V];
int V=10;

void warshall_floyd() {
    for (int k = 0; k < V; k++) {
        for (int i = 0; i < V; i++) {
            for (int j = 0; j < V; j++) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}
int main()
{
    int h, w;
    cin >> h >> w;
    for (int i = 0;i < 10;i++) {
        for (int j = 0;j < 10;j++) {
            int a;
            cin >> a;
            d[i][j] = a;
        }
    }
    warshall_floyd();
    int ans = 0;
    for (int i = 0;i < h;i++) {
        for (int j = 0;j < w;j++) {
            int a;
            cin >> a;
            if (a == -1||a==1) continue;
            ans += d[a][1];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main(){
    int x, y;
    cin >> x >> y;

    int g[13] = {0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};

    if(g[x] == g[y]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;

//using Graph = vector<vector<edge>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define query int qq;std::cin >> qq;rep(qqq,qq)
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout <<"Case #" <<qqq+1<<": "
#define RES(a,i,j) a.resize(i);rep(ii,i)a[ii].resize(j); 
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout<<a<<" "<<b<<" "<<c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define ssum(a) accumulate(a,0ll) 
#define gre(n) greater<n>()

typedef long long ll;
//
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
//typedef long long T;
const int INF = 1000000000;
const double dINF = 1000000000;
const ll INF64 = 922337203685477580ll;
const ll MOD = 1000000007ll;
//const ll MOD = 67280421310721ll;
const dou pi=3.141592653589793;
//メモ
//二次元配列のresizeのしかた
//vv.resize(n);
//for(size_t i=0; i<n; i++){
// vv[i].resize(n);
//}

//メモ
//負の辺を持つ最短経路問題では到達不可経路でも初期化値より小さくなりうるので注意しよう！
int main(){
    int n;
    std::cin >> n;
    VEC(int,a,n);
    rep(i,n)a[i]--;
    int ans=0;
    rep(i,n-1){
        if(a[i]==i){
            swap(a[i],a[i+1]);
            ans++;
        }
    }
    if(a[n-1]==n-1)ans++;
    std::cout << ans << std::endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 1; I <= (N); ++I)
#define REPP(I, N) for (int I = 0; I < (N); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORR(I, A, B) for (int I = (A); I >= (B); I--)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
struct rec
{
    string s;
    int a;
    int id; 
}a[N];
bool cmp(rec a,rec b)
{
    if(a.s == b.s)
        return a.a > b.a;
    return a.s < b.s;
}
int main() {
    int n;
    cin >> n;
    REP(i, n){
    cin >> a[i].s >> a[i].a;
    a[i].id = i;
    }
    sort(a + 1, a + 1 + n, cmp);
    REP(i, n)
        cout << a[i].id << endl;
    return 0;
}


Measured memory_bytes: 1792
//
#include <vector>
#include <set>
#include <map>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
#include <iomanip>
//
using ll = long long;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
#define outD(fpv) cout << setprecision(20) << fpv << endl;
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"); }
inline void YES(bool cond) { cond ? puts("YES") : puts("NO"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Arr, typename Type> inline void fill(Arr& arr, Type v) { std::fill(arr.begin(), arr.end(), v); }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
template<typename Type> inline void unique(Type& arr) { sort(arr); arr.erase(unique(arr.begin(), arr.end()), arr.end()); }
constexpr ll INF_I = std::numeric_limits<ll>::max();
constexpr ll BIGP = 1000000007L;
constexpr double INF_F = std::numeric_limits<float>::infinity();
constexpr double PI = 3.14159265358979323846L;
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<ll> L(N);
    rep(i, N) cin >> L[i];
    sort(L);
    ll ans = 0;
    for (int i = 0; i < N; ++i)
    {
        for (int j = i + 1; j < N; ++j)
        {
            for (int k = j + 1; k < N; ++k)
            {
                if ((L[i] != L[j]) && (L[i] != L[j]) && (L[j] != L[k]) && (L[k] < L[i] + L[j]))
                {
                    ++ans;
                }
            }
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3176
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

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

const ll mod = 1000000007;

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

  int n;
  cin >> n;
  vector<ll> a(n), b(n);
  for (auto &x: a) cin >> x;
  for (auto &x: b) cin >> x;

  vector<ll> diff(n);
  for (int i = 0; i < n; i++) {
    diff[i] = a[i] - b[i];
  }

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

  ll insufficient = 0;
  int changed = 0;
  for (int i = 0; i < n; i++) {
    if (diff[i] < 0) {
      insufficient += -diff[i];
      changed++;
    }
    else break;
  }

  sort(diff.rbegin(), diff.rend());

  for (int i = 0; i < n; i++) {
    if (insufficient <= 0) break;
    if (diff[i] > 0) {
      insufficient -= diff[i];
      changed++;
    }
    else break;
  }

  if (insufficient <= 0) {
    cout << changed << endl;
  }
  else {
    cout << -1 << endl;
  }

  return 0;
}


Measured memory_bytes: 2560
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int[] a = new int[3];
    int[] b = new int[3];
    a[0] = 0;
    boolean judge = true;
    int[][] c = new int[3][3];
    for(int i = 0; i < 3; i++){
      for(int j = 0; j < 3; j++){
        c[i][j] = sc.nextInt();
      }
    }
    for(int i = 0; i < 3; i++){
      b[i] = c[0][i] - a[0];
    }
    for(int i = 1; i < 3; i++){
      a[i] = c[i][0] -b[0];
    }
    for(int i = 0; i < 3; i++){
      for(int j = 0; j < 3; j++){
        if(c[i][j] != (a[i]+b[j])){
          judge = false;
        }
      }
    }
    if(judge){
      System.out.println("Yes");
    }
    else{
      System.out.println("No");
    }
  }
}

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

using namespace std;
using ll = long long;

ll D[6060][9090];
ll n, m, ans;

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

	ll i, j;

	cin >> n >> m;

	D[0][3000] = 1;
	for(i = 1; i <= n * 3; i ++){
		for(j = 0; j <= 9000; j ++){
			if(j > 0) D[i][j] += D[i - 1][j - 1];
			if(i > 1) D[i][j] += (i - 1) * D[i - 2][j + 1];
			if(i > 2) D[i][j] += (i - 1) * (i - 2) * D[i - 3][j];
			D[i][j] %= m;
		}
	}

	for(j = 3000; j <= 9000; j ++){
		ans = (ans + D[n * 3][j]) % m;
	}
	
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 428160
/*	[]__________[][][][]____[][][][][]__{}__[][][][]____[][][][][]__[][][][]
    []__________[]______________[]__________[]__________[]__________[]____[]
    []__________[][][][]________[]__________[][][][]____[]__________[]____[]
    []__________[]______________[]________________[]____[]__[][][]__[]____[]
    []__________[]______________[]________________[]____[]______[]__[]____[]
    [][][][]____[][][][]________[]__________[][][][]____[][][][][]__[][][][]
*/
#include <bits/stdc++.h>
#define int long long int
#define mod 1000000007
#define endl '\n'
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define decimal(x) cout<<fixed<<setprecision(x);
bool prime[100005]; 
void Sieve(int n) {
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
} 
vector<int>grapj[100005];
bool vis[100005];
void solve()
{
    string s;
    cin>>s;
    if(s[s.length()-1]=='s')
    cout<<s+"es";
    else
    {
        cout<<s+"s";
    }
    
}	
signed main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    while(t--)
    {
        solve();
    }
}

Measured memory_bytes: 6008
h, w = map(int, input().split())
n = int(input())
A = list(map(int, input().split()))

C = [0 for i in range(w*h)]
idx = 0

for i in range(n):
    a = A[i]
    for j in range(a):
        C[idx] = i+1
        idx += 1

C = [C[i:i+w] for i in range(0, h*w, w)]
for i in range(h):
    if i % 2 == 0:
        print(*C[i])
    else:
        print(*C[i][::-1])


Measured memory_bytes: 3920
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
typedef long long ll;
using namespace std;

long long MOD = 1e9 + 7;

long long Repeat(long long a, long long cnt) {
    if(cnt == 0) return 1LL;
    if(cnt % 2 == 1) {
        long long x = Repeat(a, cnt / 2);
        return (((a * x) % MOD) * x) % MOD;
    } else {
        long long x = Repeat(a, cnt / 2);
        return (x * x) % MOD;
    }
}

long long fact(long long a) {
    if(a == 0)
        return 1LL;
    else
        return (a * fact(a - 1)) % MOD;
}

long long comb(long long a, long long b) {
    long long fa, fb, fab;
    fa = fact(a);
    fb = fact(b);
    fab = fact(a - b);
    fb = Repeat(fb, MOD - 2);
    fab = Repeat(fab, MOD - 2);
    return (((fa * fb) % MOD) * fab) % MOD;
}

int main() {
    ll i, j, k, n, m;
    cin >> n >> m >> k;
    ll com;
    com = comb(n * m - 2, k - 2);
    ll kyori = 0;
    ll cnt = 0;
    for(i = 1; i < n; i++) {
        cnt += ((i*(n - i) * m % MOD) * m) % MOD;
        cnt %= MOD;
    }
    cnt = cnt * com % MOD;
    kyori += cnt;
    kyori %= MOD;
    cnt = 0;
    for(i = 1; i < m; i++) {
        cnt += ((i * (m - i) * n % MOD) * n) % MOD;
        cnt %= MOD;
    }
    kyori += (cnt * com) % MOD;
    kyori %= MOD;
    cout << kyori << endl;
    return 0;
}


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

 int main() {
 int N, X; 
 cin >> N >> X;
 vector<int> D(N + 1);
 D[0] = 0;
 for (int i = 0; i < N; ++i) {
 int x; cin >> x;
 D[i + 1] = D[i] + x;
 }
 int ans = 0;
 for (int i = 0; i <= N; ++i) {
 if (D[i] <= X) {
 ans++;
 }
 }
cout << ans << endl;
 }

Measured memory_bytes: 256
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

char a[200];
int n;
int v[100];

char q() {
    printf("?");
    for (int i = 0; i < n; i++)
        printf(" %d", v[i]+1);
    printf("\n");
    fflush(stdout);
    char res[10];
    scanf("%s", res);
    if (res[0] == '-')
        exit(0);
    return res[0];
}

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

    n = gi();
    for (int i = 0; i < n; i++)
        v[i] = i;
    char la = q();
    int w = 0, y = n;
    while (w+1 < y) {
        int m = (w+y)/2;
        for (int i = 0; i < n; i++)
            v[i] = m+i;
        if (q() == la)
            w = m;
        else
            y = m;
    }

    a[w] = la;
    a[w+n] = (la == 'R' ? 'B' : 'R');

    for (int i = 1; i < n; i++)
        v[i] = w+i;

    for (int i = 0; i < w; i++) {
        v[0] = i;
        a[i] = q();
    }
    for (int i = w+n+1; i < 2*n; i++) {
        v[0] = i;
        a[i] = q();
    }

    for (int i = 0; i < w; i++)
        v[i+1] = i;
    for (int i = w+n+1; i < 2*n; i++)
        v[i-n] = i;

    for (int i = w+1; i < w+n; i++) {
        v[0] = i;
        a[i] = q();
    }

    a[2*n] = 0;
    printf("! %s\n", a);

    return 0;
}


Measured memory_bytes: 724
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>


using namespace std;


using namespace std;

int main() {
  int p,q,r;
  cin>>p>>q>>r;
  cout<<p+q+r-max({p,q,r})<<endl;






   }


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

int main() {
  long long int h;
  cin>>h;
  long long int q=0;
  while (h/2>=1) {
    q+=1;
    h=h/2;
  }
  long long int ans=0;
  for (long long int i=0;i<(q+1);++i) {
    ans+=pow(2,i);
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 256
<?php
$N = intval(fgets(STDIN));
$sum = 0;
foreach(divisor($N) as $div){
    $div--;
    if($div == 0)continue;
    if($N % $div == floor($N/$div)){
        $sum+=$div;
    }
}
echo $sum;

function divisor($n){
    for($i = ceil(sqrt($n)); $i >= 1; $i--){
        if($n % $i == 0){
            $f[] = $i;
            $f[] = $n / $i;
        }
    }
    sort($f);
    return array_unique($f);
}


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

template<typename T>
constexpr T modpow(T a,T n,T mod=1000000007){//(a^n)%MOD
    T ret=1;
    while(n>0){
        if((n&1)!=0){//n%2==1
            ret=ret*a%mod;
        }
        a=a*a%mod;
        n=n/2;
    }
    return ret;
}

std::vector<long long> fac;
std::vector<long long> ifac;
long long MOD=1000000007;
template <typename T>
T modcomb(T a, T b,T MOD=1000000007){
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    long long tmp = ifac[a-b]* ifac[b] % MOD;
    return tmp * fac[a] % MOD;
}

void combinit(int maxn){
    fac.resize(maxn);
    ifac.resize(maxn);
    fac[0] = 1;
    ifac[0] = 1;
    for(long long i = 0; i<maxn; i++){
        fac[i+1] = fac[i]*(i+1) % MOD;
        ifac[i+1] = ifac[i]*modpow(i+1, MOD-2) % MOD;
    }
}

using namespace std;
using ll=long long;

bool lsgeq(string s,string t){
    if(s.size()>t.size())return true;
    for (int i = 0; i < s.size(); ++i) {
        if(s[i]>t[i])return true;
        if(s[i]<t[i])return false;
    }
    return true;
}

int main(){
    combinit(2000);
    string n;
    cin>>n;
    int k;
    cin>>k;
    if(n.size()<k){
        cout<<0<<endl;
        return 0;
    }
    ll ans=0;
    ll c=1;
    for (int j = 0; j < k; ++j) {
        c*=9;
    }
    for (int i = k; i < n.size(); ++i) {
        ans+=c*modcomb(i-1,i-k);
    }
    if(k==3){
        for (int i = 0; i < 9; ++i) {
            string t(n.size(),'0');
            t[0]+=(i+1);
            for (int j = n.size()-1; j >= 1; --j) {
                for (int k = j-1; k >= 1; --k) {
                    for (int l = 1; l <= 9; ++l) {
                        for (int m = 1; m <= 9; ++m) {
                            t[j]+=l;t[k]+=m;
                            if(lsgeq(n,t)){
                                ++ans;
                            }
                            
                            t[j]='0';t[k]='0';
                        }
                    }
                }
            }
        }
    }
    else if(k==2){
        for (int i = 0; i < 9; ++i) {
            string t(n.size(),'0');
            t[0]+=(i+1);
            for (int j = n.size()-1; j >= 1; --j) {
                for (int l = 1; l <= 9; ++l) {

                        t[j]+=l;
                        if(lsgeq(n,t)){
                            ++ans;
                        }
                        t[j]='0';

                }
            }
        }
    }
    else if(k==1){
        for (int i = 0; i < 9; ++i) {
            string t(n.size(), '0');
            t[0] += (i + 1);
            if(lsgeq(n,t)){
                ++ans;
            }
            
        }
    }

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

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define endl "\n"
using namespace std;
using ll = long long;
 
int main(){
    vector<ll> s(3);
    for(int i = 0;i<3;++i){
        cin >> s[i];
    }sort(s.begin(),s.end());
    ll d = floor(s.at(2) / 2);;
    cout << ((s.at(2) - d) * s.at(1) * s.at(0)) - (d * s.at(1) * s.at(0)) << endl;
}

Measured memory_bytes: 3596
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <cmath>
#include <climits>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <array>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define io() ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define fi first
#define se second
#define IN(i,l,r) (l<i&&i<r)
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define v(T) vector<T>
#define p(T, N) pair<T, N>
#define tp(A, B, C) tuple<A, B, C>
#define ii p(int, int)
#define vi v(int)
#define vii v(p(int, int))
#define vvi v(v(int))
#define vl v(long long)
#define vll v(p(long long, long long))
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define qsort(a) sort(all(a))
#define qsortd(a) sort(all(a), greater<>())
#define qsortf(a, f) sort(all(a), f)
#define qsortsi(v) sort(v.begin(), v.end(), [](pair<int, int> a, pair<int, int> b){return a.se < b.se;})
#define pb(n) push_back(n)
#define eb(n) emplace_back(n)
#define pp(a, b) emplace_back(make_pair(a, b))
#define pt(a, b, c) emplace_back(make_tuple(a, b, c))
#define elif else if
#define fori(i, n) for(ll i = 0; i < n; ++i)
#define foris(i, a, b) for(ll i = a; i < b; ++i)
#define forise(i, a, b) for(ll i = a; i <= b; ++i)
#define ford(i, n) for(ll i = n; i >= 0; --i)
#define fords(i, a, b) for(ll i = a; i >= b; --i)
#define fordse(i, a, b) for(ll i = a; i > b; --i)
#define fora(i, a) for (auto &i: a)
#define rev(a) reverse(a.begin(), a.end())
#define revf(a, b, c) (reverse(a.begin() + b, a.begin() + c))
#define digits(i) (int)((log(i)/(log(10))+1)
#define umap unordered_map
#define uset unordered_set
#define nl '\n'
#define fileio(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)
const int mod = 1000000007;

string S;

int main() {
  io();
  cin >> S;
  
  fori(i, S.size() - 1) {
    if(S[i] == S[i+1]) {
      cout << "Bad";
      return 0;
    }
  }
  
  cout << "Good";
  
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<iomanip>
using namespace std;
int main(){
	int H,W;
	cin >> H >> W;
	char a[H+2][W+2];
	for(int i=0;i<H+2;i++){
		for(int j=0;j<W+2;j++){
			a[i][j]='#';
		}
	}

	for(int k=1;k<H+1;k++){
		for(int p=1;p<W+1;p++){
			cin >> a[k][p];
		}
	}

	for(int g=0;g<H+2;g++){
		for(int h=0;h<W+2;h++){
			cout << a[g][h];
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 256
const input = require("fs").readFileSync("/dev/stdin", "utf8")
const parts = input.split(" ");

const A = parseInt(parts[0], 10);
const B = parseInt(parts[1], 10);
const C = parseInt(parts[2], 10);

const R = Math.max(C - (A - B), 0)

console.log(R)

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

using namespace std;
void sample(){
	#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}

int main() {
	ios::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    //sample();
    long long int t,n,m,k,x,y,w,i,j,count=1,sum=0,ans,mod=1000000007;
    cin>>n;
    for(i=1;i<n;i++){
    	sum+=n/i;
    	if(n%i==0){
    		sum--;
    	}

    }
    cout<<sum<<endl;

}



Measured memory_bytes: 3620
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
#define vv(a,b,c,d) vector<vector<a> >(b,vector<a>(c,d))
#define vvv(a,b,c,d,e) vector<vector<vector<a> > >(b,vv(a,c,d,e))
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

const int INF = 1 << 30;
const int MA = (int)1e9 + 1;
int N, H[5003], P[5003], dp[5003][5003];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    cin >> N;
    vector<tuple<int, int, int> > HP(N);
    rep(i, N) {
        cin >> H[i] >> P[i];
        HP[i] = MT(H[i] + P[i], H[i], P[i]);
    }
    sort(all(HP));
    rep(i, N) {
        int tmp;
        tie(tmp, H[i], P[i]) = HP[i];
    }

    rep(i, N + 1)rep(j, N + 1)dp[i][j] = INF;
    dp[0][0] = 0;
    rep(i, N) rep(j, N) if(dp[i][j]!=INF){
        if (dp[i][j] <= H[i]) {
            smin(dp[i + 1][j + 1], dp[i][j] + P[i]);
            smin(dp[i + 1][j + 1], MA);
        }
        smin(dp[i + 1][j], dp[i][j]);
    }

    for (int i = N; i >= 0; --i)if (dp[N][i] != INF) {
        cout << i << endl;
        break;
    }
}

Measured memory_bytes: 98048
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int n;
    cin>>n;
    if(n%10==0|| n%10==6 || n%10==8 || n%10==1)cout<<"pon";
    else if(n%10==3)cout<<"bon";
    else cout<<"hon";
    
}

Measured memory_bytes: 3636
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    private static final int MAX = 5000+24;
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        while(in.hasNext()) {
            int a=in.nextInt(),b=in.nextInt();
            String code=in.next();
            boolean flag=code.length()==a+b+1;
            for(int i=0;i<code.length();i++){
                flag = flag & (i == a ? code.charAt(i) == '-' : Character.isDigit(code.charAt(i)));
            }
            out.println(flag?"Yes":"No");
            out.flush();
        }
        in.close();
        out.close();
    }

}


Measured memory_bytes: 21716