akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define rrepa(i,a,n) for(int i=n;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define maxs(a,b) a=max(a,b)
#define mins(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;

int main(){

    string s;cin>>s;

    int ans=0;

    int l=s.length();
    rep(i,l/2){
        if(s[i]!=s[l-1-i])ans++;
    }

    cout<<ans<<"\n";

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

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

    int N; cin >> N;
    vei a(N); rep(i,N) cin >> a[i];

    vei maxcheck(8,0);
    vei mincheck(8,0);

    sort(all(a));

    if(a[0] >= 3200){
            cout << 1 << " " << N << endl;
            return 0;
    }

    int cntma = 0;
    int cntmi = 0;
    rep(i,N) {
        if(a[i] <= 399) maxcheck[0]++, mincheck[0]++;
        else if (a[i] <= 799) maxcheck[1]++, mincheck[1]++;
        else if (a[i] <= 1199) maxcheck[2]++, mincheck[2]++;
        else if (a[i] <= 1599) maxcheck[3]++, mincheck[3]++;
        else if (a[i] <= 1999) maxcheck[4]++, mincheck[4]++;
        else if (a[i] <= 2399) maxcheck[5]++, mincheck[5]++;
        else if (a[i] <= 2799) maxcheck[6]++, mincheck[6]++;
        else if (a[i] <= 3199) maxcheck[7]++, mincheck[7]++;
        else if (a[i] <= 4800) {
            cntma++;
        }
            
    }

    
    rep(i,8){
        if(maxcheck[i] > 0) cntma++;
        if(mincheck[i] > 0) cntmi++;
    }
    cout << cntmi << " " << cntma << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int sum[1010];

int main(void){
	for(int i=1;i<1010;i++)
		sum[i]=sum[i-1]+i;

	int n;
	while(cin >> n,n){
		int ans=0;
		for(int i=0;i<1010;i++){
			for(int j=i+2;j<1010;j++){
				if((sum[j]-sum[i])==n)
					ans++;
			}
		}
		cout <<  ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int M=1e5+7;
ll a, b, q, s[M], t[M], x;
int main(){
	cin>>a>>b>>q;
	for(int i=1;i<=a;i++) scanf("%lld", &s[i]);
	for(int i=1;i<=b;i++) scanf("%lld", &t[i]);
	s[a+1]=t[b+1]=1e18;
	s[0]=t[0]=-1e18;
	for(int i=1;i<=q;i++) {
		scanf("%lld", &x); 
		int m=lower_bound(s+1, s+a+2, x)-s;
		int n=lower_bound(t+1, t+b+2, x)-t;
		ll minn=1e18;
		minn=min(minn, abs(s[m]-t[n])+min(abs(s[m]-x), abs(t[n]-x)));
		minn=min(minn, abs(s[m-1]-t[n])+min(abs(s[m-1]-x), abs(t[n]-x)));
		minn=min(minn, abs(s[m]-t[n-1])+min(abs(s[m]-x), abs(t[n-1]-x)));
		minn=min(minn, abs(s[m-1]-t[n-1])+min(abs(s[m-1]-x), abs(t[n-1]-x)));
		printf("%lld\n", minn);
	}
} 

Measured memory_bytes: 2816
import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
INF = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    d, m = divmod(N, 11)
    ret = d * 2
    if m == 0:
        print(ret)
    elif m >= 7:
        print(ret + 2)
    else:
        print(ret + 1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9860
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>

#include <sstream>
#include <string>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
typedef std::pair<int,int> P;
using namespace std;
using ll = long long;


int main(){

    int n;string s;
    cin >> n >> s;
    if (n%2==1){
        cout << "No";rn 0;
    }
    rep(i,n/2){
        if (s[i]!=s[i+n/2]){
            cout << "No"; rn 0;
        }
    }
    cout << "Yes";
    rn 0;
}



Measured memory_bytes: 256
N, M, C =  map(int, (input().split(' ')))
B_list = list(map(int, input().split(' ')))
collect = 0
i = 0
while i < N:
    A_list = list(map(int, input().split(' ')))
    if sum([A*B for A,B in zip(A_list, B_list)]) + C > 0:
        collect += 1
    i+=1


print(collect)

Measured memory_bytes: 3060
'use strict';
let price = [];
let answer = 0;
// let answer;
function main(input) {
    const abc = input.replace("\n"," ").split(" ");
    const K = abc[0];
    const N = abc[1];
    for (let i = 2; price.length < K; i++) { 
        price.push(parseInt(abc[i]));
    }
    price.sort(
        function (a, b) { 
            return (a < b ? -1 : 1);
        }
    )
    for (let i = 0; i < N ; i++) { 
        answer += price[i];
    }
    console.log(answer);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 29644
module.exports=function(r){var t={};function e(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=r,e.c=t,e.d=function(r,t,n){e.o(r,t)||Object.defineProperty(r,t,{enumerable:!0,get:n})},e.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},e.t=function(r,t){if(1&t&&(r=e(r)),8&t)return r;if(4&t&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&t&&"string"!=typeof r)for(var o in r)e.d(n,o,function(t){return r[t]}.bind(null,o));return n},e.n=function(r){var t=r&&r.__esModule?function(){return r.default}:function(){return r};return e.d(t,"a",t),t},e.o=function(r,t){return Object.prototype.hasOwnProperty.call(r,t)},e.p="",e(e.s=0)}([function(r,t,e){e(1)(e(2).readFileSync("/dev/stdin","UTF-8"))},function(r,t){function e(r,t){return function(r){if(Array.isArray(r))return r}(r)||function(r,t){var e=[],n=!0,o=!1,u=void 0;try{for(var i,l=r[Symbol.iterator]();!(n=(i=l.next()).done)&&(e.push(i.value),!t||e.length!==t);n=!0);}catch(r){o=!0,u=r}finally{try{n||null==l.return||l.return()}finally{if(o)throw u}}return e}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}r.exports=function(r){for(var t=r.split("\n"),n=e(t[0].split(" ").map(function(r){return Number(r)}),2),o=n[0],u=n[1],i=[],l=0;l<u;l++){var a=t[l+1].split(" ").map(function(r){return Number(r)-1}).slice(1);i.push(a)}var f=t[u+1].split(" ").map(function(r){return Number(r)}),c=new Array(o).fill(0),p=0;!function r(t,e){if(e==o){for(var n=!0,l=0;l<u;l++){var a=0,c=!0,d=!1,s=void 0;try{for(var y,v=i[l][Symbol.iterator]();!(c=(y=v.next()).done);c=!0){var b=y.value;1==t[b]&&(a+=1)}}catch(r){d=!0,s=r}finally{try{c||null==v.return||v.return()}finally{if(d)throw s}}if(a%2!=f[l]){n=!1;break}}return void(n&&(p+=1))}var m=t.concat();m[e]=1;r(t,e+1);r(m,e+1)}(c,0),console.log(p)}},function(r,t){r.exports=require("fs")}]);

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

int main() {
    int a,b;
    cin>>a>>b;
    cout<<max(0,a-b*2);
	return 0;
}

Measured memory_bytes: 256
n = int(input())
x = list(map(int, input().split()))

sorted_x = sorted(x)

median_1 = sorted_x[n//2-1]
median_2 = sorted_x[n//2]

for i in range(n):
    if x[i] <= median_1:
        print(median_2)
    else:
        print(median_1)


Measured memory_bytes: 25228
N = int(input())
P = list(range(1,N+1))
ans = 0
keta = len(str(N))
for p in P:
    first = str(p)[0]
    last = str(p)[-1]
    if last == "0":
        pass
    else:
        temp = 0
        for k in range(1,keta+1):
            if k == 1:
                if first == last:
                    temp += 1
            elif k == 2:
                if int(last+first) <= N:
                    temp += 1
            elif k == keta:
                if int(last) > int(str(N)[0]):
                    pass
                elif int(last) < int(str(N)[0]):
                    temp += 10**(k-2)
                else:
                    temp += int(str(N)[1:-1])+1
                    if int(str(N)[-1]) < int(first):
                        temp -= 1
            else:
                temp += 10**(k-2)
        ans += temp
print(ans)


Measured memory_bytes: 44652
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	double ave = 0;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		a.at(i) = x;
		ave += x;
	}
	ave /= n;
	int ans = n;
	double rec = 1000;
	for (int i = 0; i < n; i++) {
		double gap = a.at(i) - ave;
		gap = abs(gap);
		if (gap < rec) {
			rec = gap;
			ans = i;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
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; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

vector<pair<ll, ll>> prime_factorize(ll n) {
    vector<pair<ll, ll>> res;
    for (ll p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        ll num = 0;
        while(n % p == 0) {
            ++num;
            n /= p;
        }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}


ll euclidean_gcd(ll a, ll b) {
    if (a < b) return euclidean_gcd(b, a);
    ll r;
    while(r = a % b) {
        a = b;
        b = r;
    }
    return b;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    ll a, b;
    cin >> a >> b;
    ll g = euclidean_gcd(a, b);
    vector<pair<ll, ll>> pf = prime_factorize(g);
    cout << pf.size() + 1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

struct elem {
    char c[12];
    elem *next;
};
elem *dict[1000000] = {nullptr};

int hash(char s[])
{
    int n = strlen(s);
    int h = 0;
    for (int i = 0; i < n; i++){
        h += s[i] * (i+1);
    }
    return h;
}
int match(char s[], char c[])
{
    int n = strlen(s);
    if (n != strlen(c)) return 0;
    for (int i = 0; i < n; i++){
        if (s[i] != c[i]) return 0;
    }
    return 1;
}

void insert(char s[]){
    elem *p = (elem *)malloc(sizeof(elem));
    for (int i = 0; i < 12; i++) p->c[i] = '\0';
    int n = strlen(s);
    for (int i = 0; i < n; i++){
        p->c[i] = s[i];
    }
    p->next = dict[hash(s)];
    dict[hash(s)] = p;
    
}

int find(char s[])
{
    int h = hash(s);
    for (elem *p = dict[h]; p != nullptr; p = p->next){
        if (match(s, p->c)) return 1;
    }
    return 0;
}
 int main()
 {
    int n;
    scanf("%d", &n);
    char order[6];
    char s[12];
    for (int j = 0; j < n; j++){
        for (int i = 0; i < 12; i++){
            s[i] = '\0';
        }
        scanf("%s", order);
        scanf("%s", s);
        if (order[0] == 'i'){
            insert(s);
        }
        else {
            if(find(s)){
                printf("yes\n");
            }else {
                printf("no\n");
            }
        }       
    }
    return 0;       
}


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

signed main(){
    int N,M; cin>>N>>M;
    priority_queue<int> Q;
    int ans=0;
    for(int i=0;i<N;i++){
        int a; cin>>a;
        Q.push(a);
        ans+=a;
    }

    while(M--){
        int t=Q.top(); Q.pop();
        ans-=t-t/2;
        Q.push(t/2);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1400
/*
 * a.cc: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int ps[5] = {2, 3, 5, 7, 11};

/* typedef */

/* global variables */

int fs[5];

/* subroutines */

/* main */

int main() {
  int n;
  cin >> n;
  //printf("%d\n", 1 << (n - 1));

  for (int k = 1;; k++) {
    int cnt = 0;
    for (int i = 1; i * i <= k; i++)
      if (k % i == 0)
	cnt += (i * i == k) ? 1 : 2;
    if (cnt == n) {
      printf("%d\n", k);
      break;
    }
  }
}

Measured memory_bytes: 1144
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define outl(x) cout<< (x) << '\n'
#define fi first
#define se second
using namespace std;
using pii = pair<int,int>;
using vi = vector<int>;
using ll = long long;

signed main()
{
    cin.tie(0), ios::sync_with_stdio(false);
    int N;
    cin >> N;
    rep(i, N) {
        int x, y, b, p;
        cin >> x >> y >> b >> p;
        int minv = x*b + y*p;

        minv = min((int)(0.8 * (x*max(b, 5) + y*max(p, 2))), minv);

        outl(minv);

    }
}




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

int main() {
    // 制約見て！！！デカかったらlong longにすること！
    int n;
    long sum = 0;
    cin >> n;
    vector<int> b(n);
    rep(i, n - 1) cin >> b[i];

    sum += b[0];
    rep(i, n - 2) sum += min(b[i], b[i + 1]);

    sum += b[n - 2];
    cout << sum << endl;
}

Measured memory_bytes: 3564
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007


ll s[114154];
ll gcd(ll a, ll b) {
	return (b == 0 ? a : gcd(b, a % b));
}

int main() {
	bool pos = true, odd = false, even = false;
	int n, k, u;
	cin >> n >> k;
	REP(i, n)cin >> s[i];
	sort(s, s + n,greater<ll>());
	u = s[0];
	if (k > s[0])pos = false;
	REP(i, n) {
		u = gcd(u, s[i]);
	}
	if (k % u != 0)pos = false;
	cout << (pos ? "POSSIBLE" : "IMPOSSIBLE") << endl;
	
}


Measured memory_bytes: 1024
X, K, D = map(int, input().split())
X = abs(X)
now = X

if X // D <= K:
    now = X % D
    K -= X // D
else:
    now -= K * D
    K = 0

if K > 0:
    ans1 = now
    ans2 = abs(now - D)

    if ans2 < ans1 and K % 2 == 1 or ans2 > ans1 and K % 2 == 1:
        now = ans2
print(abs(now))

Measured memory_bytes: 9188
def fun(li):
  for i in li:
    if i%2 == 0:
      if i%3 == 0 or i%5 ==0:
        continue;
      else:
        return "DENIED"
  return "APPROVED"
n = int(input())
li = [int(num) for num in input().split(" ")]
print(fun(li))


Measured memory_bytes: 2940
// ----------------------------------------------------------

#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>

using namespace std;

typedef long long LL;
typedef unsigned int UI;
typedef long double LD;

#define LL MOD          (LL)1000000007
#define LL_INF          (LL)1 << 62
#define INT_INF         (int)1 << 30

#define rSort(a)        sort(a.rbegin(),a.rend())
#define Sort(a)         sort(a.begin(),a.end())
#define Reverse(a)      reverse(a.begin(),a.end())
#define Sum(a)          accumulate(a.begin(), a.end(), 0)
#define REP(i, n)       for(UI i = 0;i < n;i++)
#define REPR(i, n)      for(UI i = n;i >= 0;i--)
#define FOR(i, m, n)    for(UI i = m;i < n;i++)
#define pb(i)           push_back(i)
#define SWAP(x,y)       ((x!=y)&&(x^=y,y^=x,x^=y))

int main(int argc, char* argv[]) {
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string S;
    cin >> S;
    
    if(S[0]=='S'){
       cout << "Cloudy" << endl;
    }else if(S[0]=='C'){
        cout << "Rainy" << endl;
    }else if(S[0]=='R'){
        cout << "Sunny" << endl;
    }else{
        //
    }
    
    return 0;
    
}


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


int main(){
    ll h,w,m; cin >> h >> w >> m;
    vector<int> hn(h+10,0),wn(w+10,0);
    map<P,bool> hw;
    rep(i,m){
        int hi,wi; cin >> hi >> wi;
        hi--; wi--;
        hn[hi]++; wn[wi]++;
        hw[make_pair(hi,wi)]=true;
    }
    ll mah=0;
    set<ll> idh;
    rep(i,h){
        if(mah == hn[i]){
            idh.insert(i);
        }
        if(mah < hn[i]){
            if(!idh.empty()) idh.clear();
            idh.insert(i);
            mah = hn[i];
        }
    }
    ll maw=0;
    set<ll> idw;
    rep(i,w){
        if(maw == wn[i]){
            idw.insert(i);
        }
        if(maw < wn[i]){
            if(!idw.empty()) idw.clear();
            idw.insert(i);
            maw = wn[i];
        }
    }

    ll res = mah+maw;
    bool ok = true;
    for(auto ith : idh){
        for(auto itw : idw){
            if(hw[make_pair(ith,itw)]==false){
                ok=false;
            }
        }
        if(!ok)break;
    }
    if(ok) res--;
    cout << res << endl;
    //cout << ok << endl;
}

Measured memory_bytes: 71320
#include<iostream>
#include<cstdlib>
#include<cstdio>

using namespace std;

int pre[41], in[41], n, _index = 0;

int findInInOrder (int u) {
  int result = -1;

  for (int i = 0; i < n; i++) {
    if (in[i] == u) {
      result = i;
      break;
    }
  }

  return result;
}

void reconstruction (int l, int r) {
  if (l >= r)
    return;

  int c = pre[_index++];
  int m = findInInOrder(c); // middle

  // printf("c = %d, m = %d\n", c, m);
  
  reconstruction(l, m);
  reconstruction(m + 1, r);

  printf("%d", c);
  if (c == pre[0])
    printf("\n");
  else
    printf(" ");
}

int main () {
  cin >> n;

  for (int i = 0; i < n; i++)
    cin >> pre[i];

  for (int i = 0; i < n; i++)
    cin >> in[i];

  reconstruction(0, n);

  return 0;
}


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

int main(){
  int n;
  cin>>n;
  string str;
  cin>>str;

  int cnt[26]={};
  for(int i=0;i<n;i+=2) cnt[str[i]-'a']++;

  int num[10]={};
  for(int i=0;i<26;i++) num[cnt[i]]++;

  int ans = 0;
  for(int i=1;i<10;i++){
    if(num[i] == 0) continue;
    if(ans && num[i]) ans++; // +
    if(i == 1) ans +=num[i] + num[i]-1;
    else if(num[i] == 1) ans += 3;
    else ans += 4 + num[i] + num[i]-1;
  }
  cout<<ans<<endl;

  return 0;
}

Measured memory_bytes: 3200
use std::io::{stdin, BufRead};

fn main() {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.clear();

    stdin().read_line(& mut buf).unwrap();
    let iter = buf.trim().split_whitespace();
    let mut student_id = 0;

    let mut student_array: Vec<[i32; 2]> = Vec::new();
    for students in iter{
        student_id += 1;
        student_array.push([student_id, students.parse::<i32>().unwrap()]);
    }

    print!("{}", solve(student_array));
}

fn solve(mut student_array: Vec<[i32; 2]>) -> String {
    student_array.sort_by(|array1, array2| array1[1].cmp(&array2[1]));
    let mut result = String::new();
    for iter in student_array.iter(){
        result.push_str(&format!("{}\n", iter[0]));
    }
    result
}

Measured memory_bytes: 6908
#include<cstdio>
#include<stack>
using namespace std;
int a[10],flag;
stack<int>s1,s2;
void dfs(int i){
	if(i==10){flag=1;return ;}
	if(a[i]>s1.top()){
		s1.push(a[i]);
		dfs(i+1);
		s1.pop();
	}
	if(a[i]>s2.top()){
		s2.push(a[i]);
		dfs(i+1);
		s2.pop();
	}
	return ;
}
int main(void){
	int T;scanf("%d",&T);
	while(T--){
		while(!s1.empty())s1.pop();
		while(!s2.empty())s2.pop();
		flag=0;
		for(int i=0;i<10;i++)
			scanf("%d",a+i);
		s1.push(0),s2.push(0);
		dfs(0);
		printf(flag?"YES\n":"NO\n");
	}
}

Measured memory_bytes: 2588
#include <bits/stdc++.h>
    using namespace std;
    #define ll long long int
    #define pb push_back
    #define mk make_pair
    #define ft first
    #define sc second
    #define ppb pop_back
    #define sz size
    #define forn(i,a,n) for(i=a;i<n;i++)
    #define M 1000000007
    #define inf 2e18
    
    int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    ll t,k;
    cin>>t>>k;
    ll i, arr[t];
    for(i=0;i<t;i++)
    	cin>>arr[i];
    ll dp[t],j;
    memset(dp,0,sizeof dp);
    dp[1]=abs(arr[1]-arr[0]);
    for(i=2;i<t;i++)
    	{
    	dp[i]=inf;
    	for(j=1;j<=k&&(i-j)>=0;j++)
    	dp[i]=min(dp[i],dp[i-j]+abs(arr[i]-arr[i-j]));
    }
    cout<<dp[t-1];
    return 0;
    } 

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<P,int>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
signed main(){
	int a;
	cin>>a;
	cout<<a*a*3<<endl;
}


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

using namespace std;

static const int INF = 1e9 + 7;

template<typename T>
using Vec = vector<T>;

template<typename T, typename T2>
using P = pair<T, T2>;

template<typename... Args>
using Tup = tuple<Args...>;

template<typename T>
using qp = priority_queue<T, Vec<T>, greater<T> >;

template<typename T>
using pq = priority_queue<T>;

using llong = long long;
using ullong = unsigned long long;
using uint = unsigned int;

template<typename T>
T gcd(T x, T y)
{
	return y ? gcd(y, x % y) : x;
}

void hawawa()
{
	string str;
	cin >> str;
	switch (str.size())
	{
	case 3:
		str = string(rbegin(str), rend(str));
	default:
		cout << str << "\n";
		break;
	}
}

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


Measured memory_bytes: 256
N,X,Y = map(int, input().split())

ans = [0]*(N-1)
for i in range(1, N+1):
    for j in range(i+1, N+1):
        if j <= X:
            ans[j-i-1] += 1
        elif i <= X:
            ans[min(j-i, X-i+1+abs(Y-j))-1] += 1
        elif i < Y:
            ans[min(j-i, i-X+abs(j-Y)+1)-1] += 1
        else:
            ans[j-i-1] += 1
for a in ans:
    print(a)

Measured memory_bytes: 3444
import java.awt.Point;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Main {

    Node[] nodes;

    public static void main(String[] args) {
        new Main().compute();
    }

    void compute() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        nodes = new Node[N];
        Point[] lines = new Point[M];
        for (int i = 0; i < N; i++) {
            nodes[i] = new Node(i);
        }
        for (int i = 0; i < M; i++) {
            int a = sc.nextInt() - 1;
            int b = sc.nextInt() - 1;
            lines[i] = new Point(a, b);
            nodes[a].linkeds.add(nodes[b]);
            nodes[b].linkeds.add(nodes[a]);
        }

        int bridge = 0;
        for (int i = 0; i < M; i++) {
            int a = lines[i].x;
            int b = lines[i].y;
            nodes[a].linkeds.remove(nodes[b]);
            nodes[b].linkeds.remove(nodes[a]);

            boolean[] through = new boolean[N];
            for (int j = 0; j < N; j++) {
                through[j] = false;
            }
            advance(0, through);
            for (int j = 0; j < N; j++) {
                if (!through[j]) {
                    bridge++;
                    break;
                }
            }
            nodes[a].linkeds.add(nodes[b]);
            nodes[b].linkeds.add(nodes[a]);
        }
        System.out.println(bridge);
    }

    void advance(int pos, boolean[] through) {
        if (through[pos]) {
            return;
        }
        through[pos] = true;
        for (Node node : nodes[pos].linkeds) {
            advance(node.num, through);
        }
    }

    class Node {

        int num;
        List<Node> linkeds = new ArrayList<>();

        Node(int num) {
            this.num = num;
        }
    }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using i64 = int64_t;
using ll = long long;
int main() {
  int A,B;
  cin >> A >> B;
  for(int n = 1; n <= 1000;n ++){
    if(n * 8 / 100 == A && n * 10 / 100 == B){
      cout << n << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
#define mp make_pair
using namespace std;
using ll=long long;
using P=pair<int,int>;
const ll INF=1LL<<30;
const ll LINF=1LL<<60;
const double eps=1e-9;
const ll MOD=1000000007LL;
template<typename T>void chmin(T &a,T b){a=min(a,b);};
template<typename T>void chmax(T &a,T b){a=max(a,b);};
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V>typename enable_if<is_class<T>::value==0>::type fill_v(T& t,const V& v){t=v;}
template<typename T,typename V>typename enable_if<is_class<T>::value!=0>::type fill_v(T& t,const V& v){for(auto &e:t)fill_v(e,v);};
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
    int a,b,k;cin>>a>>b>>k;
    int c=0;
    for(int i=100;i>=1;i--){
        if(a%i==0&&b%i==0){
            c++;
            if(c==k){
                cout<<i<<endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 256
/*---------------------------------------------------------------------*/
/*                   -------------------------------------             */
/*                   -----------MEHEDI HASAN--------------             */
/*                   -----CSE,JAHANGIRNAGAR UNIVERSITY----             */
/*                   -------------------------------------             */
/*---------------------------------------------------------------------*/
#include<bits/stdc++.h>
#include <cassert>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
/*---------------------------------------------------------------------*/
#define FAST        ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
#define cc(x)       cout<<#x<<"="<<x<<" ";
#define ccc(x)      cout<<#x<<"="<<"("<<x.ff<<" "<<x.ss<<") ";
#define CC(x)       cout<<"["<<#x<<"] = ";for(auto xx: x) cout<<xx<<" ";
#define CCC(x)      cout<<"["<<#x<<"] = ";for(auto xx: x) cout<<"("<<xx.ff<<" "<<xx.ss<<") ";
#define mark(x)     cout<<x<<" ";
#define ee          cout<<"\n";
#define OK          cout<<"Ok"<<"\n";
/*---------------------------------------------------------------------*/
#define ff          first
#define ss          second
#define ll          long long
#define ull         unsigned long long
#define pii         pair<int,int>
#define mp          make_pair
#define ps          push
#define psb         push_back
#define psf         push_front
#define pp          pop
#define ppb         pop_back
#define ppf         pop_front
#define all(x)      x.begin(),x.end()
#define TESTS       int t;cin>>t;for(int tcase=1;tcase<=t;tcase++)
#define ordered_set tree< int, null_type, less_equal< int >, rb_tree_tag, tree_order_statistics_node_update>
/*---------------------------------------------------------------------*/
#define MAX (ll)(2e5+9)
#define MOD (ll)(1e9+7)

int main()
{
    FAST
    int n,m;
    cin>>n>>m;
    vector <int> v(n);
    int s=0;
    for(int &x : v) cin>>x,s+=x;
    sort(all(v));reverse(all(v));
    double x=(1.0/(4.0*m))*s;
    double y=v[m-1];
    if(y>=x) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;


    return 0;
}

/*--------------------------------------------------------------------*/
/*
>Check Corner Cases (n==1 or T==1)
>Overflow issues?
>LB / UB !!not found!! check?
*/
/*--------------------------------------------------------------------*/
/* ---INPUT---
--------(1)------


-------(2)-------


-------(3)-------


-------(4)-------



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




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

int main()
{
  int N; string s, t; cin >> N >> s >> t;

  for (int i = 0; i < N; ++i) {

    bool ok = true;
    for (int j = i; j < N; ++j) {
      if (s[j] != t[j-i]) {
        ok = false;
        break;
      }
    }

    if (ok) {
      cout << N+i << endl;
      return 0;
    }
  }

  cout << N*2 << endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define dupl(s) s.erase(unique(s.begin(), s.end()), s.end());//重複取り除き
#include <bits/stdc++.h>
using namespace std;
int sum(vector<int> s){return accumulate(s.begin(),s.end(),0);}
void p(vector<int> A){rep(i,A.size()){cout << A[i] << " ";}cout << "\n";}

int main(){
    int n;
    cin >> n;
    vector<int> inp;
    map<int,int> a{};
    rep(i,n){
        int k;
        cin >> k;
        a[k]++;
        if(a[k] == 1)inp.push_back(k);
        };
    int cnt = 0;
    rep(i,inp.size())if(a[inp[i]]%2 != 0)cnt++;
    cout << cnt;
}

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

int main() {
	int n; //1<=n<=50
	int	k; //1<=k<=n
	string s; //A,B,Cからなるnの文字列

	cin >> n >> k;
	cin >> s;
	s[k-1] = tolower(s[k-1]);
	cout << s << endl;
}

Measured memory_bytes: 3128
using System;
using System.Linq;
public class s
{
  public static void Main()
  {
    int[] rgb=Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    string ans="NO";
    if((rgb[1]*10+rgb[2])%4==0)ans="YES";
    Console.WriteLine(ans);
  }
}

Measured memory_bytes: 13268
#include <iostream>

using namespace std;

int main()
{
	int n;
	int k, p;
	
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> k >> p;
		int winner = k % p;
		
		if (winner == 0){
			winner = p;
		}
		cout << winner << endl;
	}
	
	return (0);
}

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

//macro
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPR(i, n) for(int i = n; i >= 0; --i)
#define FOR(i, n, m) for(int i = m; i < n; ++i)
#define LL long long

using namespace std;

typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;

int main(){
    int a, b;

    cin >> a >> b;

    if(a + b >= 10){
        cout << "error" << endl;
        return 0;
    }

    cout << a + b << endl;

    
}

Measured memory_bytes: 256
import java.util.*
import java.math.*

private val readString: ()->String = {readLine()!!}
private val readInt: ()->Int = { readLine()!!.toInt() }
private val readLong: ()->Long = { readLine()!!.toLong() }
private val readListInt: ()->List<Int> = { readLine()!!.split(' ').map(String::toInt) }
private val readListLong: ()->List<Long> = { readLine()!!.split(' ').map(String::toLong) }
private val errPrintln: (String)->Unit = { msg -> System.err.println(msg) }
private const val MOD = 1_000_000_007L


fun main(args: Array<String>) {
    val S = readString()
    val T = readString()

    if (T.substring(0, T.length-1) == S) {
        println("Yes")
    } else {
        println("No")
    }
}


Measured memory_bytes: 34648
r, c = map(int, input().split())
li = []
for _ in range(r):
    li.append(list(map(int, input().split())))
for i in range(r):
    li[i].append(sum(li[i]))
    print(" ".join(map(str, li[i])))
li.append([])
for i in range(c):
    li[-1].append(sum([li[j][i] for j in range(r)]))
li[-1].append(sum(li[-1]))
print(" ".join(map(str, li[-1])))



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

int main()
{
  int a, b, c, k, i;
  cin >> a >> b >> c >> k;
  int m = max(max(a, b), c);
  int res = a + b + c - m;
  for (i = 0; i < k; i++)
    m *= 2;
  cout << res + m << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){

int n,m,i,j,total;
scanf("%d %d\n",&n,&m);
int a[n][m];
int b[m];

for (i = 0;i<n;i++){
    for (j = 0;j<m-1;j++){
        scanf("%d",&a[i][j]);
    }
    scanf("%d\n",&a[i][j]);
}

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

for (i = 0;i<n;i++){
    total = 0;
    for (j = 0;j<m;j++){
        total = total + a[i][j] * b[j];
    }
    printf("%d\n",total);
}

return 0;
}


Measured memory_bytes: 2048
let s = read_int ()
let a_s = Array.make 1000001 0
let f n = if n mod 2 = 0 then n / 2 else 3 * n + 1
let x, i = ref s, ref 1
let _ = while a_s.(!x) = 0 do a_s.(!x) <- 1; x := f !x; incr i done; Printf.printf "%d\n" !i

Measured memory_bytes: 10624
#include<bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define rep(i, a, b) for(ll i = a; i < b; ++i)
using namespace std;
typedef long long ll;
typedef vector<ll> vll;

int main()
{
	FIO;
    char c; cin >> c;
    if(isupper(c)) {
        cout << 'A';
    } else cout << 'a';
	return 0;
}

Measured memory_bytes: 3648
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;

class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null){
int a=Integer.parseInt(line);
BigInteger x=BigInteger.valueOf(a);
System.out.println(prevProbablePrime(a)+" "+x.nextProbablePrime());
}
}
public static int prevProbablePrime(int a){
a--;
while(true){
BigInteger y=BigInteger.valueOf(a);
if(y.isProbablePrime(1)){
return a;
}
a--;
}
}
}

Measured memory_bytes: 21260
n,m,k = map(int,input().split())

di = 998244353
summ = m

def pow_k(x, n):
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K = (K*x)%di
        x = (x*x)%di
        n //= 2

    return (K * x)%di

for i in range(n-1):
    summ = (summ*(m-1))%di

a=[]

for i in range(max(m,k+2)):
    a.append(pow_k(i,di-2))


lis = [0 for i in range(k+1)]
lis[0] = summ
for i in range(k):
    gm = a[m-1]
    gi = a[i+1]
    lis[i+1] = (lis[i]*(n-1-i)*gm*gi)%di

if k==n-1 and m==1:
    print(1)
else:
    print(sum(lis)%di)

Measured memory_bytes: 98092
import heapq
import math
from collections import defaultdict
from itertools import permutations,combinations,combinations_with_replacement
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

K = int(input())
res = 0

for a in range(1,K+1,1):
    for b in range(1,K+1,1):
        for c in range(1,K+1,1):
            res += gcd(a,b,c)

print(res)


Measured memory_bytes: 69608
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++) 
#define all(v) begin(v),end(v)
using ll = long long;

int main() {
  int n;cin>>n;
  vector<int> vec(n+1);
  for(int i=1;i<=100;i++){
    for(int j=1;j<=100;j++){
      for(int k=1;k<=100;k++){
        int ans=i*i+j*j+k*k+i*j+j*k+k*i;
        if(ans<=n)vec[ans]++;
      }
    }
  }
  for(int i=1;i<=n;i++)cout<<vec[i]<<endl;
}


Measured memory_bytes: 3616
N = int(input())
S = [input() for i in range(N)]
r = N*(N-1)//2
ans = 0
for i in range(N):
    g = 0
    for j in range(N):
        ji = (j+i) % N
        for k in range(j+1, N):
            if S[j][k+i-N] == S[k][ji]:
                g += 1
    if g == r:
        ans += 1
    for j in range(N-1):
        ji = (j+i) % N
        for k in range(N-1):
            if S[1+k+j-N][ji] == S[j][ji+k+1-N]:
                g += 1
            if S[j+k-N][ji] == S[j][ji+k-N]:
                g -= 1
        if g == r:
            ans += 1
print(ans)


Measured memory_bytes: 58972
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int a,b,k,ans; 
int main(){
    cin>>k;
    cin>>a>>b;
    int largest = ( b / k ) * k ;
    if ( a <= largest ) {
    puts (" OK ");
    } else {
    puts (" NG ");
    }
   
    return 0;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define arr array

using namespace std;

const int e = 2e6 + 69;
const ll mod = 1e9 + 7;

ll a[e];

//beginner 1999 129
/// count : 3
int n, m;
ll p[e], x[e];
vector<ll>adj[e];
ll ans = 0;

void dq(int pos)
{
    if(pos == n+1){
        for(int i=1; i<=m; i++){
            ll dem = 0;
            for(auto j : adj[i]){
                if(x[j] == 1){
                    dem ++;
                }
            }
            if(dem%2 != p[i]%2){
                return ;
            }
        }
        ans ++;
        return ;
    }
    else{
        for(int i=0; i<2; i++){
            x[pos] = i;
            dq(pos+1);
        }
    }
}

int main()
{
    cin >> n >> m;
    for(int i=1; i<=m; i++){
        int x;
        cin >> x;
        for(; x>0;x--){
            int bulbs;
            cin >> bulbs;
            adj[i].pb(bulbs);
        }
    }
    for(int i=1; i<=m; i++) cin >> p[i];
    dq(1);
    cout << ans;
}


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

int main()
{
  int H1,H2,M1,M2,K;
  cin >> H1 >> M1 >> H2 >> M2 >> K;
  
  int time;
  if(M1<=M2)
    time=60*(H2-H1)+(M2-M1);
  else
    time=60*(H2-H1-1)+(60+M2-M1);
    
  cout << time - K << endl;
}
    

Measured memory_bytes: 3624
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);

  int A, B, C;

  std::cin >> A >> B >> C;

  std::cout << (A + B >= C ? "Yes" : "No") << std::endl;

  return 0;
}


Measured memory_bytes: 256
import java.awt.Point;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Point[] P = new Point[n];
        for(int i = 0; i < n; i++) P[i] = new Point(sc.nextInt(), sc.nextInt());
        double ans = 0;
        for(int i = 0; i < n-1; i++)
            for(int j = i + 1; j < n; j++)
                ans += P[i].distance(P[j]) * 2 / n;
        System.out.println(ans);
    }
}


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

int a, b, c, d, e;

int main()
{
  cin >> a >> b >> c >> d >> e;

  int ans = 0;
  if (a < 0){
    ans += (a * c) * -1;
    a = 0;
  }

  if (a == 0){
    ans += d;
  }

  ans += (b - a) * e;

  cout << ans << endl;
}

Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
 
 
 
int main()
{
    int64_t N;
    cin >> N;
    vector<int64_t>ys(N);
    for (int64_t i=1 ; i<=N ; i++){
        for (int64_t j=i; j<=N ; j+=i){
            ys.at(j-1)++;
        }
    }
    int64_t ans=0;
    for(int64_t i=1 ; i<=N ; i++){
        ans += i * ys.at(i-1);
    }
    cout<<ans;
}

Measured memory_bytes: 81388
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

struct vw_pair
{
    int v, w;
    vw_pair(int v, int w) : v(v), w(w){};
};

typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<vector<vw_pair>> adj_list;
typedef vector<bool> vb;
typedef int_fast64_t ll;
typedef uint_fast64_t ul;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef priority_queue<int> max_heap_int;
typedef priority_queue<int, vi, greater<>> min_heap_int;

#define isOn(S, j) (S & (1 << j))
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
#define lowBit(S) (S & (-S))
#define setAll(S, n) (S = (1 << n) - 1)
#define modulo(S, N) ((S) & (N - 1)) // returns S % N, where N is a power of 2
#define isPowerOfTwo(S) (!(S & (S - 1)))
#define nearestPowerOfTwo(S) ((int)pow(2.0, (int)((log((double)S) / log(2.0)) + 0.5)))
#define turnOffLastBit(S) ((S) & (S - 1))
#define turnOnLastZero(S) ((S) | (S + 1))
#define turnOffLastConsecutiveBits(S) ((S) & (S + 1))
#define turnOnLastConsecutiveZeroes(S) ((S) | (S - 1))
#define in_range(lo, hi, x) ((x >= lo && x <= hi))
#define numberOfOnBit(x) __builtin_popcountll(x)
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define forsn(i, x, n) for (int i = x; i < int(n); i++)
double esp = 1e-6;

struct custom_hash
{
    static uint64_t splitmix64(uint64_t x)
    {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const
    {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

// Hash map for long long
gp_hash_table<long long, int, custom_hash> ll_hash_map;
// Simple hash for pair
struct chash
{
    int operator()(ii x) const { return x.first * 31 + x.second; }
};
gp_hash_table<ii, int, chash> pair_hash_map;

typedef tree<
    pair<long long, int>,
    null_type,
    less<pair<long long, int>>,
    rb_tree_tag,
    tree_order_statistics_node_update>
    ordered_set;

typedef tree<
    int,
    null_type,
    less<int>,
    rb_tree_tag,
    tree_order_statistics_node_update>
    int_ordered_set;

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

    ll n,k;cin >> n >> k;
    if (n > k) {
        ll x = n / k;
        n -= (k * x);
    }
    cout << min(n, k - n) << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdint>
#include <unordered_set>
#include <unordered_map>
#include <stack>
using namespace std;
typedef long long i64;
typedef vector<int> ivec;
typedef vector<string> svec;

//??????????????°?????£?¨?
stack<int> S;


int main()
{
    char inString[100];
    int a;
    int b;

    while (scanf("%s", inString) != EOF){
        if (inString[0] == '+'){
            a = S.top();
            S.pop();
            b = S.top();
            S.pop();
            S.push(a+b);
        } else if (inString[0] == '-'){
            b = S.top();
            S.pop();
            a = S.top();
            S.pop();
            S.push(a-b);
        } else if (inString[0] == '*'){
            a = S.top();
            S.pop();
            b = S.top();
            S.pop();
            S.push(a*b);
        } else {
            S.push(atoi(inString));
        }
    }
    printf("%d\n", S.top());


    return 0;
}

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

int main(){
    char n[3];
    cin >> n;
    if(n[0] == '7' || n[1] == '7' || n[2] == '7'){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string S;
  cin >> S;
  int ans = 0;
  vector<int> v(10,0);
  for(int i=0;i<S.size();i++){
    if(S[i] == 'A' || S[i] == 'T'|| S[i] == 'C'|| S[i] == 'G'){
      ans++;
    }
    else {
      v[i] = ans;
      ans = 0;
    }
  }
  sort(v.begin(),v.end());
  cout << max(ans,v[9]) << endl;  
}


Measured memory_bytes: 256