akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int x, y, n, m, k;
  cin >> x >> y >> n >> m >> k;
  vector <int> a(n), b(m), c(k);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  for (int i = 0; i < k; i++) cin >> c[i];
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  sort(c.begin(), c.end());
  multiset <int> p, q;
  for (int i = 0; i < x; i++) {
    p.insert(a[n - i - 1]);
  }
  for (int i = 0; i < y; i++) {
    q.insert(b[m - i - 1]);
  }
  for (int i = k - 1; i >= 0; i--) {
    int z = *p.begin();
    int l = *q.begin();
    if (c[i] <= z && c[i] <= l) {
      break;
    }
    if (c[i] <= z && c[i] > l) {
      q.erase(q.begin());
      q.insert(c[i]);
      continue;
    }
    if (c[i] > z && c[i] <= l) {
      p.erase(p.begin());
      p.insert(c[i]);
      continue;
    }
    if (z < l) {
      p.erase(p.begin());
      p.insert(c[i]);
    } else {
      q.erase(q.begin());
      q.insert(c[i]);
    }
  }
  ll ans = 0;
  for (auto i : p) ans += i;
  for (auto i : q) ans += i;
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 9856
#include<stdio.h>
#define N 100
#define INF 1000000
#define WHITE 0
#define GRAY 1
#define BLACK 2

int A[N][N],B[N][N],k,T[N],d[N],color[N],x,min,v,c;

void shortest(){

  int i,j,u;
  
  for(i=0;i<x;i++){
    d[i]=INF;
    color[i]=WHITE;
  }
  d[0]=0;
  color[0]=GRAY;
  while(1){
    min = INF;
    u=-1;
    for(i=0;i<x;i++){
      if(min >d[i] && color[i]!=BLACK){
	u=i;
	min=d[i];
      }
    }
    if(u==-1) break;
    color[u]=BLACK;
    for(i=0;i<x;i++){
      if(color[i] != BLACK && A[u][i] != INF){
	if(d[i] > d[u] + A[u][i]){
	  d[i] = d[u] + A[u][i];
	  color[i] = GRAY;
	}
      }
    }
  }
  for(i=0;i<x;i++){
    printf("%d %d\n",i,d[i]);
  }
  
}

int main(){

  int i,j,u;

  scanf("%d",&x);

  for(i=0;i<x;i++){
      for(j=0;j<x;j++){
	A[i][j]=INF;
      }
  }

  for(i=0;i<x;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d%d",&v,&c);
      A[u][v]=c;
    }
  }

  shortest();

  
  return 0;
  
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1LL<<60;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
template<class T> void puts(T x) { std::cout << x << std::endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

int n;

ll gcd(ll x, ll y) {
    if (y == 0) return x;
    return gcd(y, x % y);
}

ll lcm(ll x, ll y) {
    ll g = gcd(x, y);
    return x / g * y;
}

int main() {
    cin >> n;

    ll ans = 1;
    rep(i, n) {
        ll t; cin >> t;
        ans = lcm(ans, t);
    }

    cout << ans << endl;
}


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

vector<vector<int>> to;
vector<int> ans;

void dfs(int v, int p) {
    for (int u : to[v]) {
        if (u == p)
            continue;

        ans[u] += ans[v];
        dfs(u, v);
    }
}

int main() {
    int n, q;
    cin >> n >> q;
    to.resize(n);
    ans.assign(n, 0);

    rep(i, n - 1) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }

    rep(i, q) {
        int p, x;
        cin >> p >> x;
        p--;
        ans[p] += x;
    }

    dfs(0, -1);

    rep(i, n) {
        if (i != 0)
            cout << " ";
        cout << ans[i];
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 24296
#include <iostream>
#include <stdint.h>
#include <vector>
#include <algorithm>

using namespace std;

vector<int64_t> X;
vector<uint32_t> V;

int32_t N;
int64_t C;

int64_t exec()
{
  vector<int64_t> sum_V_start, sum_V_stop;
  sum_V_start.reserve(N+1);
  sum_V_stop.reserve(N+1);

  sum_V_start.push_back(V[N+1]);
  sum_V_stop.push_back(V[0]);
  for (uint32_t n=1; n<=N; ++n) {
    sum_V_start.push_back(sum_V_start.back() + V[N-n+1]);
    sum_V_stop.push_back(sum_V_stop.back() + V[n]);    
  }  
  
  int64_t max_calory = 0;

  vector<int64_t> calory_to_start1, calory_to_start2;
  vector<int64_t> calory_to_stop1, calory_to_stop2;
  vector<int64_t> max_calory_to_start1, max_calory_to_start2;
  vector<int64_t> max_calory_to_stop1, max_calory_to_stop2;

  calory_to_start1.reserve(N+1);
  calory_to_start2.reserve(N+1);
  calory_to_stop1.reserve(N+1);
  calory_to_stop2.reserve(N+1);
  max_calory_to_start1.reserve(N+1);
  max_calory_to_start2.reserve(N+1);
  max_calory_to_stop1.reserve(N+1);
  max_calory_to_stop2.reserve(N+1);
  
  for (int32_t start=0; start>=-N; --start) {
    int64_t dist_to_start = C - X[start+N+1];
    int64_t calory_to_start = sum_V_start[-start];

    calory_to_start1.push_back(calory_to_start - dist_to_start);
    calory_to_start2.push_back(calory_to_start - 2*dist_to_start);
    if (start==0) {
      max_calory_to_start1.push_back(calory_to_start1.back());
      max_calory_to_start2.push_back(calory_to_start2.back());
    } else {
      max_calory_to_start1.push_back(max(calory_to_start1.back(),max_calory_to_start1.back()));
      max_calory_to_start2.push_back(max(calory_to_start2.back(),max_calory_to_start2.back()));
    }
  }

  for (int32_t stop=0; stop <= N; ++stop) {
    int64_t dist_to_stop = X[stop];
    int64_t calory_to_stop = sum_V_stop[stop];

    calory_to_stop1.push_back(calory_to_stop - dist_to_stop);
    calory_to_stop2.push_back(calory_to_stop - 2*dist_to_stop);
    if (stop==0) {
      max_calory_to_stop1.push_back(calory_to_stop1.back());
      max_calory_to_stop2.push_back(calory_to_stop2.back());
    } else {
      max_calory_to_stop1.push_back(max(calory_to_stop1.back(),max_calory_to_stop1.back()));
      max_calory_to_stop2.push_back(max(calory_to_stop2.back(),max_calory_to_stop2.back()));
    }
  }

  for (int32_t stop = 0; stop <= N; ++stop) {
    max_calory = max(max(max_calory_to_stop1[stop] + max_calory_to_start2[N-stop],
			 max_calory_to_stop2[stop] + max_calory_to_start1[N-stop]),
		     max_calory);
  }

  return max_calory;
}

int main()
{
  cin >> N >> C;
  
  X.reserve(N+2);
  V.reserve(N+2);
  X.push_back(0);
  V.push_back(0);
  
  for (uint32_t n = 0; n < N; ++n) {
    int64_t x;
    uint32_t v;
    cin >> x >> v;
    X.push_back(x);
    V.push_back(v);
  }

  X.push_back(C);
  V.push_back(0);

  cout << exec() << endl;
  
  return 0;
}

Measured memory_bytes: 9216
A, B, H, M = map(int, input().split())
hun = 6*M
ji = 30*H + 0.5*M
sa = hun-ji

import math
rad_sa = math.radians(sa)
cos_sa = math.cos(rad_sa)

tl = A**2 + B**2 - 2*A*B*cos_sa
print(tl**(1/2))


Measured memory_bytes: 9496
def examA():
    N, K = LI()
    if (N+1)//2>=K:
        print("YES")
    else:
        print("NO")
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LFI(): return list(map(float,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examA()

"""

"""

Measured memory_bytes: 38256
/*
17/10/2017
*/
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
int main()
{
string s;
cin>>s;
if(s[s.length()-1]=='s')
{
cout<<s<<"es"<<endl;
}
else
{
cout<<s<<"s"<<endl;
}
}

Measured memory_bytes: 3596
a,b = map(int,input().split())
c = list(map(int,input().split()))
sum = 0
for i in c:
  sum = sum + i
vote = (1/(4*b))*sum
count = 0
for j in c:
  if j>=vote:
    count = count + 1

if count>=b:
  print("Yes")
else:
  print("No")

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init));

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  cin >> N;
  vvl(s,3,N,0);
  vary(ll,ans,N,0);
  rep(i,N){
    rep(j,3){
      cin >> s[j][i];
    }
  }
  rep(j,3){
    map<ll,ll> m;
    rep(i,N){
      m[s[j][i]]++;
    }
    rep(i,N){
      if(m[s[j][i]] == 1){
        ans[i] += s[j][i];
      }
    }
  }
  rep(i,N){
    cout << ans[i] << endl;
  }

  return 0;
}

Measured memory_bytes: 3220
#include<stdio.h>
#define MAXN 11
int main()
{
	int n,cnt=0,p[MAXN],ba=0,i,j,temp;
	char c;
	while(1){
		cnt=0;
		ba=0;
		scanf("%d",&n);

		if(n==0){
			break;
		}
		for(i=0;i<n;i++){
			p[i]=0;
		}
		for(i=0;i<100;i++){
			scanf("%c",&c);
			if(c=='M'){
				p[cnt]++;
			}
			else if(c=='S'){
				ba+=p[cnt]+1;
				p[cnt]=0;
			}
			else if(c=='L'){
				p[cnt]+=ba+1;
				ba=0;
			}
			else{
				i--;
			}
			cnt++;
			if(cnt==n){
				cnt=0;
			}
		}
		for(i=0;i<n-1;i++){
			for(j=i+1;j<n;j++){
				if(p[i]>p[j]){
					temp=p[i];
					p[i]=p[j];
					p[j]=temp;
				}
			}
		}
		for(i=0;i<n;i++){
			printf("%d ",p[i]);
		}
		printf("%d\n",ba);
	}
	return 0;
}

Measured memory_bytes: 1032
#include <stdio.h>

int main(){
  int i,j,k,n,a[200005][3],m,start=0,temp,prev,pp,l;
  scanf("%d",&l);
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i][0]);
    a[i][1]=-1;
    a[i][2]=i+1;
  }
  a[n-1][2]=-1;
  while(a[start][2]!=-1){
    prev=-1;
    i=start;
    while(i!=-1){
      j=i;
      k=a[j][2];
      if(k==-1) break;
      i=a[k][2];
      a[j][2]=i;
      if(a[j][0]>a[k][0]){
        if(prev==-1){
          start=k;
        }else{
          a[prev][2]=k;
        }
        temp=j;
        j=k;
        k=temp;
      }
      prev=j;
      while(k!=-1){
        if((j==-1)||(a[j][0]>a[k][0])){
          temp=a[k][1];
          a[k][1]=a[pp][1];
          a[pp][1]=k;
          pp=k;
          k=temp;
        }else{
          pp=j;
          j=a[pp][1];
        }
      }
    }
  }
  m=0;
  temp=a[start][0];
  for(i=a[start][1];i!=-1;i=a[i][1]){
    j=a[i][0]-temp;
    if(j>m) m=j;
    temp=a[i][0];
  }
  j=a[start][0]-temp+l;
  if(j>m) m=j;
  printf("%d",l-m);
  return(0);
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int A[1];
int size=1;
int m=2;
#define N 101
#define mod 1000000007
#define f(i,n) for(int i=0;i<n;i++)
/*
bool prime(ll n){if(n==1)return false;for(ll i=2;i*i<=n;i++)if(n%i==0){return false;}return true;}
void prime_fact(int n){for(int i=2;i*i<=n;i++){int count=0;if(n%i==0){while(n%i==0)n/=i,count++;cout<<i<<"^"<<count<<" ";}}if(n>1)cout<<n<<"^1";}
ll power(ll base ,ll pow){ll res=1;while(pow>0){if(pow&1)res*=base,pow-=1;else base*=base,pow/=2;}return res;}
void prime_fact_seieve(int n){for(int i=2;i<=size;i++){if(A[i]==0)for(ll j=i;j<=size;j+=i)if(A[i]==0)A[j]=i;}while(n>2){cout<<A[n]<<"*";n/=A[n];}}
template <class X> X gcd(X a , X b) { return b==0?a: gcd( b, a%b); }
template <class X> X lcm(X a , X b) { return a/gcd(a,b) * b ; }
ll Ab[N][N],I[N][N];  // identity matrix and a matrix to store result
void multiply(ll I[][N],ll A[][N],int dim)
{   int res[dim+1][dim+1];
    for(int i=0;i<dim;i++)
    {  for(int j=0;j<dim;j++)
        {
           res[i][j]=0;
           for(int k=0;k<dim;k++)
           {  res[i][j]+=((I[i][k]%mod)*(A[k][j])%mod)%mod;}}}

        for(int i=0;i<dim;i++)
            for(int j=0;j<dim;j++)
                I[i][j]=res[i][j];}
void powerMat(ll A[][N],int dim,int n)
{   for(int i=0;i<dim;i++)
    for(int j=0;j<dim;j++)
    {if(i==j) I[i][j]=1;
     else     I[i][j]=0;}
     while(n>0)
     {
         if(n%2)
         multiply(I,A,dim),n--;
         else
         multiply(A,A,dim),n/=2;
     }
     for(int i=0;i<dim;i++)
         for(int j=0;j<dim;j++)
             A[i][j]=I[i][j];
}
void printMat(ll A[][N],int dim)
{
    for(int i=0;i<dim;i++)
    {for(int j=0;j<dim;j++)
        {
            cout<<A[i][j]<<" ";
        }cout<<"\n";}
}
// REMEMBER PREFIX SUM SUFFIX SUM OR GCD VERY INTERESTING QUESTIONS
ll power(ll base ,ll pow,ll mo){ll res=1;while(pow>0){if(pow&1)res=(res%mo*base%mo)%mo,pow-=1;else base=(base%mo*base%mo)%mo,pow/=2;}return res;}*/
int main()
{  ll n;
    cin>>n;
    n-=1;
    char arr[26]={'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'};
    char ans[11];
    int temp,cnt=0;
    while(n>=0)
    {    temp=n%26;
         n/=26;n-=1;
         ans[cnt]=arr[temp];
         cnt++;
    }
   for(int i=cnt-1;i>=0;i--)
       cout<<ans[i];

}


Measured memory_bytes: 3608
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

const int Maxn = 200005;

char s[Maxn];
int tot, len;

int main() {
	scanf("%s", s + 1);
	len = strlen(s + 1);
	for (int i = 1; i <= len; i ++) {
		tot += s[i] - '0';
	}
	if (tot % 9) printf("No");
	else printf("Yes");
	return 0;
}


Measured memory_bytes: 1876
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>

#include <algorithm>

using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;
const ll INF = 1ll << 60;

ll MOD = 1e9 + 7;

int main()
{

    int n, k;
    cin >> n;
    cin >> k;

    string s;
    cin >> s;

    int score = 0;
    REP(i, n - 1)
    {
        if (s[i] == s[i + 1])
            score++;
    }
    int ans = min(score + 2 * k, n - 1);

    cout << ans << endl;

    return 0;
}

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  vll b(10);
  rep(i,n){
    ll a; cin>>a;
    ll r = a/400;
    if(r<8) b[r]++;
    else b[8]++;
  }
  
  ll ans=0;
  rep(i,8){
    if(b[i]) ans++;
  }
  
  ll min=ans;
  if(min==0) min=1;
  ll max=ans+b[8];
  
  cout<<min<<' '<<max<<endl;
  
}

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

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>

using namespace std;
using ll = long long;


vector<int> c;
vector<vector<int>> s;
int D;
vector<int> v;
vector<set<int>> U;

ll calc(){
    ll ans = 0;
    vector<int> last(26, 0);
    for(int i = 0;i < D;i++){
        last[v[i] - 1] = i + 1;
        ans += s[i][v[i] - 1];
        //cout<<s[i][v[i] - 1]<<endl;
        for(int j = 0;j < 26;j++){
            ans -= (ll)(i + 1 - last[j]) * c[j];
        }
    }
    return ans;
}

int retrnd(int n){ //乱数生成                                    
	std::random_device rnd;
    std::mt19937 mt(rnd());
    std::uniform_int_distribution<> rand100(0, n);
    return rand100(mt);
}

int main(){
    cin >> D;
    for(int i = 0;i < 26;i++){
        int a;cin >> a;
        c.push_back(a);
    }
    for(int i = 0;i < D;i++){
        vector<int> a;
        for(int j = 0;j < 26;j++){
            int b;cin >> b;
            a.push_back(b);
        }
        s.push_back(a);
    }
    U = vector<set<int>>(26);
    for(int i = 0;i < D;i++){
        v.push_back(retrnd(25) + 1);
    }
    int now = calc();
    int try_cnt = 10000;
    for(int cnt = 0;cnt < try_cnt;cnt++){
        int rnd = retrnd(D - 1);
        for(int i = 1;i < 27;i++){
            int prev = v[rnd];
            v[rnd] = i;
            int w = calc();
            if(now > w){
                v[rnd] = prev;
            }else{
                now = w;
            }
        }
    }
    for(int i = 0;i < D;i++){
        cout<<v[i]<<endl;
    }
}


Measured memory_bytes: 3684
//============================================================================
// Name        : ITP_1_4_C.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
using namespace std;

int main() {
	int a,b;
	char op;
	do {
		cin >> a >> op >> b;
		if (op == '?') break;
		switch(op) {
		case '+' :
			printf("%d\n",a+b);
			break;
		case '-' :
			printf("%d\n",a-b);
			break;
		case '*' :
			printf("%d\n",a*b);
			break;
		case '/' :
			printf("%d\n",a/b);
			break;
		}
	} while(1);
	return 0;
}

Measured memory_bytes: 3104
#include <stdio.h>

int main()
{
    int n,r,a;
    scanf("%d %d", &n, &r);

    if(n>=10){
        a = r;
    }else{
        a = r + 100 * (10 - n);
    }
    printf("%d\n", a);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <queue>
using namespace std;
int main(){
  int n,t,p,c=0;
  string s;
  cin>>n>>t;
  queue<pair<string,int> >a;
  while(n--){
    cin>>s>>p;
    a.push(make_pair(s,p));
  }
  while(!a.empty()){
    pair<string,int>b=a.front();
    a.pop();
    if(b.second<=t){
      c+=b.second;
      cout<<b.first<<' '<<c<<endl;
    }
    else{
      b.second-=t;
      c+=t;
      a.push(b);
    }
  }
}


Measured memory_bytes: 6368
// Problem : A - Takoyaki
// Contest : AtCoder - AtCoder Beginner Contest 176
// URL : https://atcoder.jp/contests/abc176/tasks/abc176_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)


#include<bits/stdc++.h>
using namespace std;


#define sc(ar,n) for(int pen=0;pen<n;pen++){ cin>>ar[pen];}
#define pr(ar,n) for(int pen=0;pen<n;pen++){ cout<<ar[pen]<<" ";} cout<<endl;
#define mem(ar,x) memset(ar,x,sizeof(ar))
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define rt return 0;
#define ct continue;
#define pb push_back
#define ll long long int
#define ff first
#define ss second
#define mod 1000000007
#define maxn 1000003
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif



int main(){
	
	fastio;

		ll n,x,t;
		cin>>n>>x>>t;
		
		ll res = ceil((float)n/x);
		cout<<res*t;
	
	
	}


	
	
	
	



Measured memory_bytes: 3640
#include<iostream>
using namespace std;
#define MAX 10000
#define NIL -1

struct Node { int parent, left, right;};

Node T[MAX];
int n, D[MAX], H[MAX];

void setDepth(int u, int d){
    if(u==NIL) return;
    D[u]=d;
    setDepth(T[u].left, d+1);
    setDepth(T[u].right, d+1);
}

int setHeight(int u){
    int h1=0, h2=0;
    if(T[u].left!=NIL)
        h1 = setHeight(T[u].left) + 1;
    if(T[u].right!=NIL)
        h2 = setHeight(T[u].right) + 1;
    return H[u] = (h1 > h2 ? h1:h2);
}

int getSibling(int u){
    if(T[u].parent==NIL) return NIL;
    if(T[T[u].parent].left!=u && T[T[u].parent].left!=NIL)
        return T[T[u].parent].left;
    if(T[T[u].parent].right!=u && T[T[u].parent].right!=NIL)
        return T[T[u].parent].right;
    return NIL;
}

void print(int u){
    cout << "node " << u << ": ";
    cout << "parent = " << T[u].parent << ", ";
    cout << "sibling = " << getSibling(u) << ", ";
    int deg=0;
    if(T[u].left != NIL) deg++;
    if(T[u].right != NIL) deg++;
    cout << "degree = " << deg << ", ";
    cout << "depth = " << D[u] << ", ";
    cout << "height = " << H[u] << ", ";
    
    if(T[u].parent == NIL){
        cout << "root" << endl;
    }else if(T[u].left==NIL && T[u].right==NIL){
        cout << "leaf" << endl;
    }else{
        cout << "internal node" << endl;
    }
}

int main(){
    int v,l,r,root = 0;
    cin >> n;
    
    for(int i=0; i<n; i++) T[i].parent = NIL;
    
    for(int i=0; i<n; i++){
        cin >> v >> l >> r;
        T[v].left = l;
        T[v].right = r;
        if(l!=NIL) T[l].parent = v;
        if(r!=NIL) T[r].parent = v;
    }
    
    for(int i=0; i<n; i++)
        if(T[i].parent==NIL)
            root = i;
    
    setDepth(root,0);
    setHeight(root);
    
    for(int i=0; i<n; i++)
        print(i);
    
    return 0;
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N; cin>>N;
  vector<long long> arr(N);
  long long ans = 0;
  for(int i = 0; i < N; ++i) {
    cin>>arr[i];
  }
  sort(arr.begin(), arr.end(), greater<int>());
  ans = arr[0];
  int idx = 1, cnt = 2;
  for(int i = 2; i < N; ++i) {
    ans += arr[idx];
    if(--cnt == 0) {
      ++idx; cnt = 2;
    }
  }
  cout<<ans<<endl;
  return 0;
}




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

long gcd(long n,long m){
  if(n>m) return gcd(m,n);
  else if(n==0) return m;
  else return gcd(m-n*(m/n),n);
}

int main()
{
  long N,M,g,n,m;
  string S,T;
  bool fl=1;
  cin >> N >> M >> S >> T;
  g=gcd(N,M);
  for(long i=0;i<g;i++){
    if(S[i*(N/g)]!=T[i*(M/g)]){
      fl=0;
      break;
    }
  }
  if(fl) cout << N*M/g;
  else cout << -1;
}

Measured memory_bytes: 512
n=int(input())
b=list(map(int,input().split()))
if b[0]!=1:
    print(-1)
else:
    ans=[1]
    for j in range(len(b)-1):
        for i in range(len(b)-1,-1,-1):
            if i==0 and b[0]==1 and b[1]==1:
                ans+=[b.pop(i)]
                break
            if b[i]==i+1 and i>0:
                ans+=[b.pop(i)]
                break    
    if len(ans)!=n:  
        print(-1)
    else:
        print(1)
        for i in range(n-1,0,-1):
            print(ans[i])


Measured memory_bytes: 3064
n=int(input())

taro=0
hanako=0

for i in range(n):
    s1,s2=input().split(" ")
    if(s1<s2):
        hanako+=3
    elif(s1>s2):
        taro+=3
    else:
        taro+=1
        hanako+=1
print(taro,hanako)



Measured memory_bytes: 5596
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll=long long;
using lb = long double;
//#define int long long
//#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279; //円周率
/*---------------------便利な関数--------------------------------------*/
int fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}

int gcd(int a, int b) {        //最大公約数
    if (b == 0) return a;
    return gcd(b, a % b);
}

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

int keta(int n) {        //桁数を求める
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}

int ketasum(int n) {    //各桁の和
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
//最小化問題(DP)
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
//最大化問題(DP)
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
/*-------------ここまで---------------------------------------------*/
int main(){
    lb t, x;
    cin >> t >> x;
    cout << t / x << endl;
    return 0;
}

Measured memory_bytes: 3780
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
int n, k;
char c[1010][1010];
long long dp[1010][1010];
int main(){
    ios::sync_with_stdio(0);
    cin >> n >> k;
	for (int i=1; i<=n; i++){
		for (int j=1; j<=k; j++) cin >> c[i][j];
	}
	dp[1][1] = 1;
	for (int i=1; i<=n; i++){
		for (int j=1; j<=k; j++){
			if (c[i][j] == '.'){
				dp[i][j] += dp[i-1][j] + dp[i][j-1];
			}
			dp[i][j] = dp[i][j] % MOD;
		//	cout << dp[i][j] << ' ';
		}
		//cout << endl;
	}
	//for (int i=1; i<=n; i++){
	//	for (int j=1; j<=k; j++) cout << dp[i][j] << ' ';
	//	cout << endl;
	//}
	cout << dp[n][k] << endl;
    return 0;
}

Measured memory_bytes: 9216
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main{
	public static void main(String... args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int x = Integer.parseInt(sc.next());
		List<Integer> l = new ArrayList<>();
		for(int i = 0; i < n; i++)
			l.add(Integer.parseInt(sc.next()));
		List<Integer> res = new ArrayList<>();
		for(int i = 0; i < n + 1; i++){
			if(i == 0){
				res.add(0);
				continue;
			}
			int tmp = res.get(res.size() - 1) + l.get(i - 1);
			if(tmp > x)
				break;
			res.add(tmp);
		}
		System.out.println(res.size());
		// System.out.println("====");
		// res.forEach(System.out::println);
	}
}


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

int main(){
    int n, m, c;
    int b[25];
    cin >> n >> m >> c;
    for(int i = 0; i < m; i++){
        cin >> b[i];
    }
    int ans = 0;
    for(int i = 0; i < n; i++){
        int sum = c;
        for(int j = 0; j < m; j++){
            int a;
            cin >> a;
            sum += a * b[j];
        }
        if(sum > 0)ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <sstream>
#include <istream>
#include <iomanip>
#include <typeinfo>
#include <stack>
#include <map>

using namespace std;
typedef long long int ll;

int main(){

    ll A, B;
    cin >> A >> B;
    ll ans = 0;
    for(ll i = A; i <= B; i++){
        string s = to_string(i);
        if(s[0] == s[4] && s[1] == s[3]){
            ans++;
        }
    }

    cout << ans << endl;

} 

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

int main(){
	int n, a, b, dc;
	std::cin >> n >> a >> b >> dc;
	std::vector<int> v;
	for(int i=0;i<n;i++){
		int c;
		std::cin >> c;
		v.push_back(c);
	}
	
	std::sort(v.begin(), v.end(), std::greater<int>());
	
	int max_c = 0, selected_n = 0;
	for(int i=0;i<n;i++){
		if((a+i*b)*v[i]>b*(dc+max_c)){
			max_c += v[i];
			selected_n++;
		}else{
			break;
		}
	}
	std::cout << static_cast<int>(1.0*(max_c+dc)/(a+selected_n*b)) << std::endl;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
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 INF=1e10;
int MOD=1e9+7;
signed main(){
  int a;
  cin>>a;
  cout<<setprecision(14)<<a*2*M_PI<<endl;
}


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

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ITER(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cout << #a << " = " << a << endl;

const double PI = acos(-1.0);
const LL INF = 1e9 + 7;
const LL LINF = INF * INF;

const int MAX = 3007;
int n;
LL dp[MAX][MAX];
int a[MAX];
char visited[MAX][MAX];

LL get(int l, int r)
{
	if (l == r)
	{
		if (n & 1)
			return a[l];
		else
			return -a[l];
	}
	
	if (visited[l][r])
		return dp[l][r];
	
	visited[l][r] = 1;
	int zab = n - (r - l + 1);
	LL res = 0;
	
	if (zab & 1)
		res = min(get(l + 1, r) - a[l] , get(l, r - 1) - a[r]);
	else
		res = max(get(l + 1, r) + a[l] , get(l, r - 1) + a[r]);
	
	return dp[l][r] = res;
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	//freopen("In.txt", "w", stdout);

	cin >> n;
	FOR(i, 0, n)
		cin >> a[i];

	cout << get(0, n - 1) << endl;
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}



Measured memory_bytes: 78592
package main

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

const pi = math.Pi

var mod int = pow(10, 9) + 7
var Umod uint64 = 1000000007
var cnt int

func main() {
	reader.Split(bufio.ScanWords)
	N, _ := strconv.Atoi(read())

	a := make([]int, N+1)
	ans := make([]int, N+1)

	for i := 0; i < N; i++ {
		a[i+1], _ = strconv.Atoi(read())
	}

	for i := N; 1 <= i; i-- {
		if N/2 < i {
			ans[i] = a[i]
		} else {
			t := 0
			for j := 2; j*i <= N; j++ {
				if ans[j*i] == 1 {
					t++
				}
			}
			if t%2 != a[i] {
				ans[i] = 1
			}
		}
	}

	for i := 1; i <= N; i++ {
		if ans[i] == 1 {
			cnt++
		}
	}

	fmt.Println(cnt)

	for i := 1; i <= N; i++ {
		if ans[i] == 1 {
			fmt.Printf("%d ", i)
		}
		if i == N {
			fmt.Println()
		}
	}
}

/*  ----------------------------------------  */

var reader = bufio.NewScanner(os.Stdin)

func read() string {
	reader.Scan()
	return reader.Text()
}

func lcm(x, y int) int {
	return (x / gcd(x, y)) * y
}

func gcd(x, y int) int {
	if x%y == 0 {
		return y
	} else {
		r := x % y
		return gcd(y, r)
	}
}

var fac [1000000]int
var finv [1000000]int
var inv [1000000]int

func combination_init() {
	fac[0], fac[1] = 1, 1
	finv[0], finv[1] = 1, 1
	inv[1] = 1

	// invは a^(-1) mod p
	// pをaで割ることを考える

	// p/a*(a) + p%a = p
	// p/a*(a) + p%a = 0          (mod p)
	// -p%a = p/a*(a)             (mod p)
	// -p%a *a^(-1)= p/a          (mod p)
	// a^(-1)= p/a * (-p%a)^(-1)  (mod p)
	// a^(-1) =

	for i := 2; i < 1000000; i++ {
		fac[i] = fac[i-1] * i % mod
		inv[i] = mod - inv[mod%i]*(mod/i)%mod
		finv[i] = finv[i-1] * inv[i] % mod
	}
}

func combination(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[y] * finv[x-y] % mod) % mod
	//return fac[x] / (fac[y] * fac[x-y])
}

func permutation(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[x-y] % mod) % mod
	//return fac[x] / fac[x-y]
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }
func ceil(x int) int   { return int(math.Ceil(float64(x))) }

type SortBy [][]int

func (a SortBy) Len() int      { return len(a) }
func (a SortBy) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool {
	return a[i][1] < a[j][1]
}

type PriorityQueue []int

func (h PriorityQueue) Len() int            { return len(h) }
func (h PriorityQueue) Less(i, j int) bool  { return h[i] < h[j] }
func (h PriorityQueue) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
func (h *PriorityQueue) Push(x interface{}) { *h = append(*h, x.(int)) }
func (h *PriorityQueue) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}


Measured memory_bytes: 5120
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int k = sc.nextInt();
    int x = sc.nextInt();
    int a = x-(k-1);
    for(int i = 0;i<k*2-1;i++){
      if(a<-1000000||a>1000000)continue;
        System.out.print(a+" ");
        a++;
    }    
  } 
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define inf 10000000000000007
#define eps 1e-8
#define PI 3.14159265359
#define sp printf(" ")
#define vi vector<int>
#define vl vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pcc pair<char, char>
#define mp make_pair
#define FF first
#define SS second
#define pb(x) push_back(x)
#define sd(x) scanf("%d", &(x))
#define pd(x) printf("%d", (x))
#define pdn(x) printf("%d\n", (x))
#define sld(x) scanf("%ld", &(x))
#define pld(x) printf("%ld", (x))
#define pldn(x) printf("%ld\n", (x))
#define slf(x) scanf("%lf", &(x))
#define plf(x) printf("%.9lf", (x))
#define plfn(x) printf("%.12lf\n", (x))
#define sch(x) scanf("%c", &(x))
#define pch(x) printf("%c", (x))
#define pchn(x) printf("%c\n", (x))
#define gtl(x) getline(cin, (x))
#define flsh fflush(stdout)
#define ios ios::sync_with_stdio(false); cin.tie(0) ; cout.tie(0)
#define endl '\n'
using namespace std;
int gcd(int i,int j)
{
    if(i%j==0)return j;
    return gcd(j,i%j);
}
int a[100005];
int main()
{
    int n,k;
    cin>>n>>k;
    cin>>a[1];
    int g=a[1];
    int mx=a[1];
    for(int i=2;i<=n;i++)
    {
        cin>>a[i];g=gcd(g,a[i]);
        mx=max(mx,a[i]);
    }
    if(k%g==0&&k<=mx)cout<<"POSSIBLE"<<endl;
    else cout<<"IMPOSSIBLE"<<endl;


}




Measured memory_bytes: 640
use std::io::Read;
use std::cmp;
use std::process;

fn main() {
    let mut buf = String::new();

    // 標準入力から全部bufに読み込む
    std::io::stdin().read_line(&mut buf);

    // 読み込んだStringを空白で分解する
    let mut iter = buf.split_whitespace();

    // 入力を受け取る
    let a: usize = iter.next().unwrap().parse().unwrap();
    let b: usize = iter.next().unwrap().parse().unwrap();

    if b % a == 0 {
        println!("{}", a + b);
    } else {
        println!("{}", b - a);
    }
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MOD 1000000007

void solve()
{
	ll n;
	cin>>n;
	vector<vector<ll>> a(n,vector<ll> (n)),cnt(n,vector<ll> (n,0));
	for(ll i=0;i<n;i++)
		for(ll j=0;j<n;j++)
			cin>>a[i][j],cnt[i][j]=0;
	
	for (ll i=0;i<n;i++)
    	for (ll j=0;j<n;j++)
    		for (ll k=0;k<n;k++)
    		{
    			if (i!=j and j!=k and i!=k) 
    			    if(a[i][k]+a[k][j]<a[i][j])
    			    {
    					cout<<-1;
    					return;
    			    }
    		}
    
    for (ll k=0;k<n;k++)
    	for (ll i=0;i<n;i++)
    		for (ll j=0;j<n;j++)
    		{
    			if (i!=j and j!=k and i!=k) 
    			    if(a[i][k]+a[k][j]==a[i][j])
    					cnt[i][j]=1;
    		}
    ll ans=0;
    for (ll i=0;i<n;i++)
    	for (ll j=i+1;j<n;j++)
    		if(cnt[i][j]==0)
    			ans+=a[i][j];
    cout<<ans;
    		
    
	return;
}
int main()
{
	fast;
	int q;
	q=1;
	// cin>>q;
	while(q--)
	{
		solve();
	}
	return 0;
}

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

int main() {
    long a, b;
    cin >> a >> b;

    long d = a / b;
    long r = a % b;
    double f = a * 100000 / b / 100000.0;
    cout << d << " ";
    cout << r << " ";
    cout << fixed << setprecision(5) << f << " " << endl;
    return 0;
}

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

pll A[100005];

struct UnionFind {
    UnionFind(int n) {
        rank.assign(n, 0);
        parent.resize(n);
        for (int i = 0; i < n; ++i) {
            parent[i] = i;
        }
    }

    int find(int x) {
        if (x == parent[x])
            return x;
        return parent[x] = find(parent[x]);
    }

    bool same(int x, int y) {
        return find(x) == find(y);
    }

    void unit(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y)
            return;

        if (rank[x] < rank[y]) {
            parent[x] = y;
        }
        else {
            parent[y] = x;
            if (rank[x] == rank[y])
                rank[x]++;
        }
    }

    vector<int> rank;
    vector<int> parent;
};

struct Data {
    ll y;
    ll index;
};

struct Data2 {
    vector<vector<ll>> X;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    REP(i, N) {
        cin >> A[i].first >> A[i].second;
    }
    vector<ll> x;
    REP(i, N) {
        x.push_back(A[i].first);
    }
    sort(x.begin(), x.end());
    x.erase(unique(x.begin(), x.end()), x.end());
    UnionFind uf(x.size());
    vector<Data> d;
    REP(i, N) {
        ll index = lower_bound(x.begin(), x.end(), A[i].first) - x.begin();
        d.push_back(Data{A[i].second, index});
    }
    sort(d.begin(), d.end(), [](Data a, Data b) { return a.y < b.y; });
    REP(i, d.size() - 1) {
        if (d[i].y == d[i + 1].y)
            uf.unit(d[i].index, d[i + 1].index);
    }

    vector<vector<ll>> X(x.size());
    REP(i, N) {
        ll index = lower_bound(x.begin(), x.end(), A[i].first) - x.begin();
        X[index].push_back(A[i].second);
    }
    REP(i, X.size()) {
        sort(X[i].begin(), X[i].end());
        X[i].erase(unique(X[i].begin(), X[i].end()), X[i].end());
    }

    ll s = 1;
    REP(i, x.size()) {
        s = std::max(s, uf.find(i) + 1LL);
    }

    vector<Data2> d2(s);
    REP(i, X.size()) {
        d2[uf.find(i)].X.push_back(X[i]);
    }

    ll ans = 0;
    REP(i, d2.size()) {
        ll xs = d2[i].X.size();
        if (xs <= 1)
            continue;

        vector<ll> y;
        ll num = 0;
        REP(j, d2[i].X.size()) {
            num += d2[i].X[j].size();
            REP(k, d2[i].X[j].size()) {
                y.push_back(d2[i].X[j][k]);
            }
        }
        sort(y.begin(), y.end());
        y.erase(unique(y.begin(), y.end()), y.end());
        if (y.size() <= 1)
            continue;

        ans += xs * y.size() - num;
    }
    cout << ans << endl;

    return 0;
}

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


void solve(long long X){
    long long sum = 100;
    rep(i,4000){
        sum = 1.01 * sum;
        if(sum >= X){
            cout << i << endl;
            return;
        }
    }
}

int main(){
    long long X;
    scanf("%lld",&X);
    solve(X);
    return 0;
}


Measured memory_bytes: 3688
#include <stdio.h>

int main(void)
{
	int A,B,C;
	int cookie=0;
	
	scanf("%d%d%d",&A,&B,&C);
	
	if(B>=C){
	cookie = B+C;
	}else if(B<C){
	
		if(A>=C-B){
		cookie = B+C;
		}else if(A<C-B){
		cookie = A+(2*B);
		}
	
	}
	
	if(C>A+B){
	cookie += 1;
	}
	
	printf("%d",cookie);
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <deque>
#define pb push_back
#define mod 1000000007
#define all(x) x.begin(),x.end()
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
typedef pair<ll,ll> pll;

int h,w;
vector<string> hako;
int mozi[30];

int main(void){
  string s;
  cin>>h>>w;
  for(int i=0;i<h;i++){
    cin>>s;
    for(int j=0;j<s.size();j++){
      mozi[s[j]-'a']++;
    }
  }
  int t,f;
  if((h%2==0)&&(w%2==0)){
    f=0;
    for(int i=0;i<h*w/4;i++){
      for(int j=0;j<30;j++){
	if(mozi[j]>=4){
	  mozi[j]-=4;
	  f++;
	}
      }
    }
    if(f==(h*w/4)) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  else if((h%2==1)&&(w%2==1)){
    h--;w--;
    f=0;
    for(int i=0;i<h*w/4;i++){
      for(int j=0;j<30;j++){
	if(mozi[j]>=4){
	  mozi[j]-=4;
	  f++;
	}
      }
    }
    if(f!=(h*w/4)) cout<<"No"<<endl;
    else{
      f=0;
      for(int i=0;i<((w/2)+(h/2));i++){
	for(int j=0;j<30;j++){
	  if(mozi[j]>=2){
	    mozi[j]-=2;
	    f++;
	  }
	}
      }
      if(f==((w/2)+(h/2))) cout<<"Yes"<<endl;
      else cout<<"No"<<endl;
    }
  }
  else{
    if(w%2==0){t=w;w=h;h=t;}
    w--;
    f=0;
    for(int i=0;i<h*w/4;i++){
      for(int j=0;j<30;j++){
	if(mozi[j]>=4){
	  mozi[j]-=4;
	  f++;
	}
      }
    }
    if(f!=(h*w/4)) cout<<"No"<<endl;
    else{
      f=0;
      for(int i=0;i<(h/2);i++){
	for(int j=0;j<30;j++){
	  if(mozi[j]>=2){
	    mozi[j]-=2;
	    f++;
	  }
	}
      }
      if(f==(h/2)) cout<<"Yes"<<endl;
      else cout<<"No"<<endl;
    }
  }
  return 0;
}


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

int main(){
   
   int A,V,B,W,T;
   cin >> A >> V >> B >> W >> T;

   if(W-V >= 0) cout << "NO" << endl;
   else{
       if((double)abs(A-B)/abs(W-V) <= T) cout << "YES" << endl;
       else cout << "NO" << endl;
   }
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<stdlib.h>
#define N 2000002
int A[N],B[N],C[10001],n,i,max=0;
void CountingSort(int A[],int B[],int n);
int main(){

  scanf("%d",&n);
  for(i=1;i<=n;i++){

    scanf("%d",&A[i]);
    if(max<A[i])max=A[i];
  }

  CountingSort(A,B,max);
    
    for(i=1;i<n;i++){
      printf("%d ",B[i]);
    }

      printf("%d\n",max);
  return 0;

}
void CountingSort(int A[],int B[],int k){
  int j;

  for(i=0;i<=k;i++){
    C[i]=0;
  }

  for(j=1;j<=n;j++){
    C[A[j]]++;
  }

  for(i=1;i<=k;i++){
    C[i] = C[i] + C[i-1];
  }

  for(j=n;j>=0;j--){
    B[C[A[j]]] = A[j];
    C[A[j]]--;

  }
    return;
}

Measured memory_bytes: 16264
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int digit(int x) {
	int cnt = 0;
	while (x > 0) {
		cnt += x % 10;
		x /= 10;
	}
	return cnt;
}

signed main() {
	int n;
	cin >> n;
	int t[100005];
	double a[100005];
	t[0] = -1, a[0] = 1;
	rep(i, n) {
		cin >> t[i + 1] >> a[i + 1];
	}
	rep(i, n) {
		a[i + 1] = a[i] / 10 * (10 - a[i + 1]);
	}
	int q;
	cin >> q;
	rep(i, q) {
		int l, r;
		cin >> l >> r;
		double be = a[(lower_bound(t, t + n + 1, r) - 1) - t] / a[(lower_bound(t, t + n + 1, l) - 1) - t];
		printf("%.12lf\n", 1000000000 * be);
	}

	return 0;
}



Measured memory_bytes: 4856