akhauriyash/Code-Regression huggingface dataset:
N = int(input())
A = []
B = []
for i in range(N):
    a = int(input())
    A.append(a)
    B.append(a)
B.sort(reverse = True)
M1 = B[0]
M2 = B[1]

if M1 == M2:
    for i in range(N):
        print(M1)
else:
    for i in range(N):
        if A[i] == M1:
            print(M2)
        else:
            print(M1)


Measured memory_bytes: 14120
n, k = map(int, input().split())
d = list(map(int, input().split()))
lis = []
for i in range(10):
    if not i in d:
        lis.append(i)
inf = 1001001001
ans = inf
def dfs(s, n):
    if len(s) >= len(str(n)) + 2:
        return
    if len(s) > 0 and int(s) >= n:
        global ans
        ans = min(ans, int(s))
    else:
        for i in lis:
            dfs(s + str(i), n)
dfs("", n)
print(ans)

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define DBG(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define DBG(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define CIN(type, ...) \
  type __VA_ARGS__;    \
  read_from_cin(__VA_ARGS__);

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, n) for (auto i : (n))
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

int main() {
  CIN(string, S);
  REP(i, S.size()) S[i] = 'x';
  cout << S << endl;
}


Measured memory_bytes: 256
// Problem : C - Sum of gcd of Tuples (Easy)
// Contest : AtCoder Beginner Contest 162
// URL : https://atcoder.jp/contests/abc162/tasks/abc162_c
// 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 int long long
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int mod = 1e9+7;
int inf = 4e18;
const int N = 5e5+5;

signed main()
{
    io
    int tt = 1;
    //cin>>tt;
    while(tt--)
    {
    	int k;
    	cin>>k;
    	int gcd;
    	int result;
    	int ct = 0;
    	
    	for(int i=1;i<=k;++i)
    	{
    		for(int j=1;j<=k;++j)
    		{
    			for(int l=1;l<=k;++l)
    			{
    				result = __gcd(i,__gcd(j,l));
    				
    				ct+=result;
    			}
    		}
    	}
    	cout<<ct;
    }
    return 0;
}



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

int main() {
  int A, B;
  cin >> A >> B;
  int ans = 0;
  for(int i = A; i <= B; i++) {
    if(i / 10000 == i % 10000 % 1000 % 100 % 10 && i % 10000 / 1000 == i % 10000 % 1000 % 100 / 10)
      ans++;
  }
  cout << ans << endl;
}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()

using namespace std;
typedef long long int ll;
typedef pair<int,int> P;

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

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const int INF = 0x3fffffff;


int main(){
	int N, M, ans=0;
	int cnt[100005];
	bool f[100005]={};
	Fill(cnt, 1);
	f[0] = true;

	cin >> N >> M;
	rep(i,M){
		int x, y;
		cin >> x >> y;
		x--; y--;

		cnt[x]--;
		cnt[y]++;
		f[y] |= f[x];
		f[x] &= cnt[x] > 0;
	}

	rep(i,N) if(f[i]) ans++;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 768
let quick_sort a n cmp =
  let swap i j = let tmp = a.(i) in a.(i) <- a.(j); a.(j) <- tmp in
  let partition p r =
    let i = ref p in
    for j = p to r - 1 do
      if cmp a.(j) a.(r) <= 0 then (swap !i j; incr i)
    done;
    swap !i r;
    !i in
  let rec doit p r =
    if p >= r then () else
    let q = partition p r in
    doit p (q - 1);
    doit (q + 1) r in
  doit 0 (n - 1)

let calc_cost a n =
  let b = Array.copy a in
  quick_sort b n compare;
  let t = Array.make (b.(n-1) + 1) 0 in
  Array.iteri (fun i e -> t.(e) <- i) b;
  let p = Array.make n false in
  let rec cycle i acc =
    p.(i) <- true;
    let j = t.(a.(i)) in
    if p.(j) then a.(i) :: acc
    else cycle j (a.(i) :: acc) in
  let cycle i = cycle i [] in
  let rec doit i acc =
    if i = n then acc
    else if p.(i) then doit (i + 1) acc
    else
      let ws = cycle i in
      let m = List.length ws in
      let s = List.fold_left (+) 0 ws in
      let z = List.fold_left min max_int ws in
      doit (i + 1) (acc + (min (s + (m - 2)*z) (s + z + (m + 1)*b.(0)))) in
  doit 0 0

let () =
  let n = read_int () in
  let a = Array.init n (fun _ -> Scanf.scanf "%d " (fun e -> e)) in
  calc_cost a n |> Printf.printf "%d\n"

Measured memory_bytes: 2776
#include<iostream>
#include<queue>
#include<algorithm>
#include<numeric>
using namespace std;
const long long INF=1LL<<40;

int main(){
    long long N,K;cin>>N>>K;
    vector<vector<long long> >s(N);
    for(int i=0;i<N;i++){
        long long t,d;cin>>t>>d;--t;
        s[t].push_back(d);

    }
    //cout<<" 1"<<endl;

    for(auto &v:s){
        sort(v.begin(),v.end(),greater<long long>());
        if(v.empty())v.push_back(-INF);
    }

    sort(s.begin(),s.end(),[&](vector<long long>a,vector<long long>b){
        return a[0]>b[0];
    });
    //cout<<" 2"<<endl;

    long long cur=0;
    priority_queue<long long>que;
    for(int i=0;i<K;i++){
        cur+=s[i][0];
        for(int j=1;j<s[i].size();j++)que.push(s[i][j]);

    }
    //cout<<" 3"<<endl;
    for(int i=K;i<N;i++)for(int j=0;j<s[i].size();j++)que.push(s[i][j]);
    //cout<<"4"<<endl;
    long long res=cur+K*K;
    for(long long x=K-1;x>=1;--x){
        long long v=s[x][0];
        long long w=que.top();
        if(v<w){
            que.pop();cur+=w;
            que.push(v);cur-=v;
        }
        res=max(res,cur+x*x);
    }
    cout<<res<<endl;

}

Measured memory_bytes: 8696
#include <math.h>
#include <stdio.h>
#include <bitset>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
  long int N;
  cin >> N;
  int minVal = -1;
  for (long int a = 1; a <= pow(10, 5); a++) {
    if (N % a == 0) {
      long int b = N / a;
      int m = max((int)to_string(a).size(), (int)to_string(b).size());
      if (minVal < 0) {
        minVal = m;
      } else {
        minVal = min(minVal, m);
      }
    }
  }
  cout << minVal << endl;
}

Measured memory_bytes: 3676
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}



int main(){
   int a,b,c;cin>>a>>b>>c;
   a -= c;
   b += c;
   cout<<a/b;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long f(long long n){
	long long ret = 0;
	long long unit = 1;
	while(unit<=n){
		long long div = unit*2;
		long long division = n/div; 
		long long left = n%div; 
		left++;
		long long parity = max(left-unit,(long long)0);
		if(unit==1) parity+=division;
		if(parity%2) ret|=unit;
		unit*=2;
	}	
	return ret;
}

int main(){
	long long a,b;
	cin>>a>>b;
	cout<<(f(b)^f(a-1));
}

Measured memory_bytes: 3628
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    int ans = 0;
    while (n) {
        n /= k;
        ++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
	for(;;){
		int a,b,x = 0;
		int field[100] = {0};
		for(;;){
			if(scanf("%d %d",&a,&b) == EOF){goto jump;}
			if(!a && !b){break;}
			field[a]++;
			field[b]++;
		}
		for(int i=0; i<100; i++){
			if(field[i]%2 == 1){x++;}
		}
		if(x == 2){cout <<"OK"<<endl;}
		else{cout <<"NG"<<endl;}
	}
	jump:;
	return 0;
}

Measured memory_bytes: 0
# -*- coding: utf-8 -*-
N, M = map(int, input().split())

p_list = []
S_list = []
ac_set = set([])
wa_list = [0 for i in range(N)]
for i in range(M):
    p, S = map(str, input().split())
    p = int(p)
    if p not in ac_set:
        if S == "AC":
            ac_set.add(p)
        else:
            wa_list[p - 1] += 1

wa_num = 0
for i in ac_set:
    wa_num += wa_list[i - 1]
print("{} {}".format(len(ac_set), wa_num))

Measured memory_bytes: 12780
#include <bits/stdc++.h>
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;

const ll INF=(1LL<<50);

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


void solve(long long N, std::string S){
  set<string> s;
  ll ans=0;
  REP(N){
    ll l=0,r=min(N-i,i)+1;
    string pref=S.substr(0,i);
    while(l+1<r){
      ll mid=(l+r)/2;
      if(pref.find(S.substr(i,mid))!=string::npos){
        l=mid;
      }else{
        r=mid;
      }
    }
    ans=max(ans,l);
  }
  cout<<ans<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::string S;
    std::cin >> S;
    solve(N, S);
    return 0;
}


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

#define all(x) (x).begin(), (x).end()
#define szof(x) int32_t((x).size())
#define str(x) to_string(x)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;

const ll MOD = 1e9 + 7;
const ll MOD998 = 998244353;
const int INF = 1e9;
const ll LLINF = 1e18;

mt19937_64 rng((uint) chrono::steady_clock::now().time_since_epoch().count());

template <class T>
T rnd(T l, T r) {
	return uniform_int_distribution<T>(l, r)(rng);
}

void run() {
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for (int &x : a) {
		cin >> x;
	}
	vector<int> dp(n, INF);
	dp[0] = 0;
	for (int i = 1; i < n; i++) {
		for (int prev = max(0, i - k); prev < i; prev++) {
			dp[i] = min(dp[i], dp[prev] + abs(a[prev] - a[i]));
		}
	}
	cout << dp.back() << "\n";
}

int32_t main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cout.precision(10); cout << fixed;
	int tests = 1;
	// cin >> tests;
	while (tests--) {
		run();
	}
	cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
	return 0;
}


Measured memory_bytes: 1024
import numpy as np

a = list(map(int,input().split()))

xy = [map(int, input().split()) for _ in range(a[0])]
x, y = [list(i) for i in zip(*xy)]
i = 0
b = np.array(x)
c = np.array([b,y]).T
for j in range(a[0]):
  if np.linalg.norm(c[j])<=a[1]:
    i +=1  
print(i)

Measured memory_bytes: 134456
#include <iostream>
#include <string>

using namespace std;

int main(void){
    string S,C;
    int Q, T, F, rev = 0;

    cin >> S;
    cin >> Q;
    for(int i=0;i<Q;i++){
        cin >> T;
        if(T==1) {
            rev++;
            continue;
        }
        cin >> F >> C;
        if((F==1) ^ (rev%2==1)) S.insert(0, C);
        else S.append(C);
    }

    if(rev % 2){
        for(int i=S.length()-1;i>=0;i--){
            cout << S[i];
        }
    }else{
        cout << S;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1020
#include <bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pi;
pair<ll, pi> dp[3005][3005]; //dp[i][j] stores the length of lcs considering the first i chars of s1 and first j chars of s2
//~ pair<bool, char> dpp[3005][3005];
string s1, s2, ans;
//~ void back_track(ll a, ll b){
	//~ if (a == 0 || b == 0)return;
	
//~ }
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin >> s1 >> s2;
	dp[0][0] = mp(0, mp(0, 0));
	for (ll i = 1; i <= (ll)s1.length(); i++){
		for (ll j = 1; j <= (ll)s2.length(); j++){
			if (s1[i-1] == s2[j-1])dp[i][j].F = dp[i-1][j-1].F + 1, dp[i][j].S = mp(i-1, j-1);
			else {
				dp[i][j].F = max(dp[i][j-1].F, dp[i-1][j].F);
				if (dp[i][j].F == dp[i][j-1].F)dp[i][j].S = mp(i, j-1);
				else dp[i][j].S = mp(i-1, j); 
			}
		}
	}
	//cout << dp[(ll)s1.length()][(ll)s2.length()];
	//for (ll i = 0; i< )
	pair<ll, pi> cur = dp[(ll)s1.length()][(ll)s2.length()];
	ll ii, jj;
	
	ii = s1.length();
	jj = s2.length();
	while (ii != 0 && jj != 0){
		ll a, b;
		a = cur.S.F;
		b = cur.S.S; //cur is my current, a, b is 
		if (ii-1 == a && jj-1 == b)ans.pb(s1[ii-1]);
		ii = a, jj = b;
		cur = dp[a][b];
	}
	reverse(ans.begin(), ans.end());
	cout << ans;
}


Measured memory_bytes: 211584
#include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); i++)
#define ll long long
using namespace std;
int main() {
  rep(i,19){
    char x; cin >> x;
    if(x == ','){
      cout << " ";
    }
    else{
      cout << x;
    }
  }
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,x[50],y[50];
	set<pair<long long,long long>>st;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>x[i]>>y[i];
		st.emplace(x[i],y[i]);
	}
	int ans=0;
	for(int i=1;i<n;i++){
		for(int j=0;j<i;j++){
			long long xdis=x[i]-x[j],ydis=y[i]-y[j];
			int cnt=0;
			for(int k=0;k<n;k++)
				if(st.find(make_pair(x[k]+xdis,y[k]+ydis))!=st.end())
					cnt++;
			ans=max(ans,cnt);
		}
	}
	cout<<n-ans<<endl;
}


Measured memory_bytes: 256
from __future__ import print_function
# import numpy as np
# import numpypy as np
import sys
input = sys.stdin.readline

def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)

# import math
# import string
# import fractions
# from fractions import Fraction
# from fractions import gcd
# def lcm(n,m):
#     return int(n*m/gcd(n,m))

# import re
# # import array
# import copy
# import functools
# import operator

# import collections
# import itertools
# import bisect
# import heapq


# from heapq import heappush
# from heapq import heappop

# # from itertools import accumulate
# # from collections import deque
# import random

from queue import PriorityQueue as pq
# class ReversePriorityQueue(PriorityQueue):
#     def __cmp__(self, other):
#         return -cmp(self.degree, other.degree)
#     # def put(self, tup):
    #     newtup = tup[0] * -1, tup[1]
    #     PriorityQueue.put(self, newtup)

    # def get(self):
    #     tup = PriorityQueue.get(self)
    #     newtup = tup[0] * -1, tup[1]
    #     return newtup

def main():
    n = int(input())
    dict={}
    for i in range(1,n+1):
        str_x,num = input().split()
        num =int(num)
        if (str_x in dict):
            dict[str_x].put((-num,i))
            # dict[str_x].sort(key = lambda x : x[1])
        else:
            a=pq()
            dict[str_x]=a
            dict[str_x].put((-num,i))
            # a.put([num,i])
    eprint(dict)
    ll = sorted(list(dict.items()))
    eprint(ll)
    # for i in ll:
    #     for j in i[1]:
    #         print(j[1])
    for item in ll:
        while item[1].qsize():
            print((item[1].get())[1])
if __name__ == '__main__':
    main()


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

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define RFOR(i, a, b) for (int i = (int)(b - 1); i >= (int)(a); --i)
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define RREP(i, n) for (int i = (int)(n - 1); i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(a) ((int)(a).size())
#define BIT(x, i) (((x) >> (i)) & 1)
#define SQ(x) ((x) * (x))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define INF 100000000

int main() {
    int N;
    while (cin >> N, N) {
        vi p(N), t(N);
        REP(i, N) cin >> p[i] >> t[i];

        vvi dp(N, vi(4, INF));
        if (p[0] <= t[0]) {
            dp[0][0] = p[0];
        }
        int cnt = 1;
        FOR(i, 1, N) {
            FOR(j, 1, 4) {
                if (dp[i - 1][j - 1] == INF) continue;
                cnt = i + 1;
                int dist = abs(p[i] - p[i - 1]);
                int remain = t[i] - t[i - 1];
                if (j < 3 && dist * (j + 1) <= remain) {
                    dp[i][j] = min(dp[i][j], dp[i - 1][j - 1] + dist);
                }
                int dist_back = p[i] + p[i - 1];
                int time = p[i] + p[i - 1] * (j + 1);
                if (time <= remain) {
                    dp[i][0] = min(dp[i][0], dp[i - 1][j - 1] + dist_back);
                }
            }
        }
        int res = *min_element(ALL(dp[N - 1]));
        if (res != INF) {
            printf("OK %d\n", res + p[N - 1]);
        } else {
            printf("NG %d\n", cnt);
        }
    }
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
const long long INF = 1LL << 60;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  vector<ll> A(N);
  rep(i,N) cin >> A[i];
  int count = 0;
  rep(i,N)
  {
    if(A[i]%2==1)
    {
      count ++;
    }
  }
  if(count%2==1)
  {
    cout << "NO" << endl;
  }
  else
  {
    cout << "YES" << endl;
  }
  return 0;
}


Measured memory_bytes: 4056
#include<bits/stdc++.h>
using namespace std;
#define f1(a,b,c) for(int c=a;c<=b;c++)
#define f2(a,b,c) for(int c=a;c>=b;c--)
#define f3(a,b,c) for(int c=a;c;c=b)
#define so1(a,n) sort(a+1,a+n+1,mycmp);
#define so2(a,n) sort(a+1,a+n+1);
#define ll long long
#define itn int
#define ubt int 
const int twx=+100;
const int inf=0x7fffffff;
ll read()
{
    ll sum=0;
    ll flag=1;
    char c=getchar();
    while(c<'0'||c>'9')
    {
        if(c=='-')
        {
            flag=-1;
        }
        c=getchar();
    }
    while(c>='0'&&c<='9')
    {
        sum=((sum*10)+c-'0');
        c=getchar();
    }
    return sum*flag;
}
int n;
int d[twx];
ll ans=0;
void init()
{
	n=read();
    f1(1,n,i)
    {
        d[i]=read();
    }
    f1(1,n,i)
    {
        f1(i+1,n,j)
        {
            ans+=d[i]*d[j];
        }
    }
    printf("%lld\n",ans);
}
void work()
{
	
}
void print()
{
	
}
int main()
{
    init();
	return 0;
}

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


int main(){
    int n,k;
    cin >> n >> k;
    int a[n];
    int sum=0;
    for(int i=0; i<n; i++){
        cin >> a[i];
        sum += a[i];
    }
    for(int i=sum; i > 1; i--){
        if(sum%i) continue;
        int h[n],l[n];
        for(int j=0; j<n; j++){
            h[j] = a[j]%i;
            l[j] = i-h[j];
        }
        sort(h,h+n);
        sort(l,l+n);
        int t = 0;
        int left=0,right=0;
        while(left + right != n){
            if(t <= 0){
                t += h[left];
                left++;
            }
            else{
                t -= l[right];
                right++;
            }
        }
        int s=0;
        for(int j=0; j<left; j++){
            s += h[j];
        }
        if(s <= k){
            cout << i << endl;
            return 0;
        }
    }
    cout << 1 << endl;
    return 0;
}


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

int all_sum(int n) {
  int sum = 0;
  while(n>0){
    sum += n%10;
    n/=10;
  }
  return sum;
};

int main() {
  int N,A,B;
  cin >> N >> A >> B;
  int res = 0;
  for(int i=1; i<=N; i++) {
    int s = all_sum(i);
    if( s >= A && s <= B) res += i;
  }
  cout << res << endl;
}


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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= ll(b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()

// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
  cout << a;
  ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
  cout << a << ' ';
  pr(b);
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int main()
{
  int n;
  cin >> n;
  for (int i = 9; i >= 1; i--)
  {
    if (n % i == 0 && (n / i) < 10)
    {
      Yes();
      return 0;
    }
  }
  No();
  return 0;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
int main() {
	string a;
	int n;
	int ans;
	int k;
	while (1) {
		ans = 0;
		cin >> a;
		n = a.length();
		if (n==1&&a[0] == '0')break;
		for (int i = 0;i < n;i++) {
			k = a[i] - '0';
			ans = ans + k;
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3160
#!/usr/bin/env python3
n = int(input())
s = input()
e = [0]
w = [0]
for i in s:
    e.append(e[-1] + (i == "E"))
    w.append(w[-1] + (i == "W"))
ans = 10**6
for i in range(n):
    ans = min(ans, w[i] + e[-1] - e[i + 1])
print(ans)


Measured memory_bytes: 33296
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()

	var x = make([]int, n)

	for i := 0; i < n; i++ {
		x[i] = nextInt()
	}

	var count int
	flag := true
	for {
		for i := 0; i < n; i++ {
			if x[i]%2 == 0 {
				x[i] /= 2
			} else {
				flag = false
				break
			}
		}
		if flag != true {
			break
		}
		count++
	}
	fmt.Println(count)
}


Measured memory_bytes: 640
#include<iostream>
#include<string.h>
#define loop(i,a,b) for(int i=a;i<b;++i)
#define rep(i,b) loop(i,0,b)
using namespace std;
    int m[7]={};
    int m2[7]={};
class DICE{
public :
void set_DISE(){
    rep(i,6){
        cin>>m[i];
    }
}
void Rotate(char(dir)){
    if (dir=='N'){
        m[6]=m[0];
        m[0]=m[1];
        m[1]=m[5];
        m[5]=m[4];
        m[4]=m[6];
    }
    else if(char(dir)=='E'){
        m[6]=m[0];
        m[0]=m[3];
        m[3]=m[5];
        m[5]=m[2];
        m[2]=m[6];
    }
    else if(char(dir)=='W'){
        m[6]=m[0];
        m[0]=m[2];
        m[2]=m[5];
        m[5]=m[3];
        m[3]=m[6];
    }    
    else{
        m[6]=m[0];
        m[0]=m[4];
        m[4]=m[5];
        m[5]=m[1];
        m[1]=m[6];
    }
}
};
int main(){
    int q,s,t;
    DICE d;
    d.set_DISE();
    rep(i,7){m2[i]=m[i];}
    cin>>q;
    rep(i,q){
    cin>>s>>t;
        rep(i1,4){
            d.Rotate('E');
            if(m[0]==s&&m[1]==t) goto QUT;
            rep(i2,4){
                d.Rotate('N');
                if(m[0]==s&&m[1]==t) goto QUT;
                rep(i3,4){
                    d.Rotate('W');
                    if(m[0]==s&&m[1]==t) goto QUT;
                    rep(i4,4){
                        d.Rotate('S');   
                        if(m[0]==s&&m[1]==t) goto QUT;
                    }
                }
            }
        }
        QUT:
        cout<<m[2]<<endl;
        rep(i,7){m[i]=m2[i];}
    }
}


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

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

using P = pair<int, int>;
template<typename T>
struct Edge {
    int u, v;
    T cost;
    Edge(int u, int v, T c) : u(u), v(v), cost(c) {}
    bool operator< (const Edge &e) const {return cost < e.cost;}
};

static const long long mod = 1000000007;
static const long long LINF = (ll)(1e18+99);
static const int INF = 1e9+99;

template< int mod >
struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
        ModInt &operator+=(const ModInt &p) {
        if((x += p.x) >= mod) x -= mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p) {
        if((x += mod - p.x) >= mod) x -= mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p) {
        x = (int) (1LL * x * p.x % mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p) {
        *this *= p.inverse();
        return *this;
    }
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0) {
            t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        return ModInt(u);
    }
    ModInt pow(int64_t n) const {
        ModInt ret(1), mul(x);
        while(n > 0) {
            if(n & 1) ret *= mul;
            mul *= mul;
            n >>= 1;
        }
        return ret;
    }
    friend ostream &operator<<(ostream &os, const ModInt &p) {
        return os << p.x;
    }
    friend istream &operator>>(istream &is, ModInt &a) {
        int64_t t;
        is >> t;
        a = ModInt< mod >(t);
        return (is);
    }
    static int get_mod() { return mod; }
};
using mint = ModInt< mod >;

int main(void) {
    ll n, k;
    cin >> n >> k;
    vector<mint> x(k+1, 0);

    for(int i=k; i>=1; i--) {
        mint tmp = mint(k/i).pow(n);
        for (int j=i+i; j<=k; j+=i) {
            tmp -= x[j];
        }
        x[i] = tmp;
    }

    mint ans = 0;
    rep(i, 1, k+1) ans += x[i]*i;  
    
  cout << ans << endl;
  return 0;
}





Measured memory_bytes: 3784
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#include <set>
#define REP(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define INF 10000000
#define ll long long

using namespace std;

typedef pair<int, int> P;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

int a, b, x;

int main(){
    scanf("%d%d%d", &a, &b, &x);

    if((x >= a) && ((a+b) >= x)) printf("YES\n");
    else printf("NO\n");

	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>

int large(char *str){
  int i,flag,tmp;

  do{
    flag = 0;
    for(i = 0;i < 3;i++){
      if(str[i] < str[i+1]){
        tmp = str[i+1];
        str[i+1] = str[i];
        str[i] = tmp;
        flag = 1;
      }
    }
  }while(flag);

  tmp = 0;
  for(i = 0;i < 4;i++){
    tmp *= 10;
    tmp += str[i];
  }

  return tmp;
}

int small(char *str){
  int i,flag,tmp;

  do{
    flag = 0;
    for(i = 0;i < 3;i++){
      if(str[i] > str[i+1]){
        tmp = str[i+1];
        str[i+1] = str[i];
        str[i] = tmp;
        flag = 1;
      }
    }
  }while(flag);

  tmp = 0;
  for(i = 0;i < 4;i++){
    tmp *= 10;
    tmp += str[i];
  }

  return tmp;
}

int foo(char *str){
  int cnt,L,S,tmp,i;

  cnt = 0;

  while(1){
    cnt++;
    L = large(str);
    S = small(str);
    tmp = L-S;
    if(tmp == 6174){
      break;
    }
    for(i = 0;i < 4;i++){
      str[3-i] = tmp%10+'0';
      tmp /= 10;
    }
  }

  return cnt;
}


int main(){
  int i,tmp;
  char str[5];

  while(1){
    scanf("%s",str);
    if(strcmp(str,"0000") == 0){
      break;
    }

    tmp = 0;
    for(i = 0;i < 4;i++){
      tmp *= 10;
      tmp += str[i]-'0';
    }

    if(tmp % 1111 == 0){
      printf("NA\n");
    }else if(tmp == 6174){
      printf("0\n");
    }else{
      printf("%d\n",foo(str));
    }
  }

  return 0;
}

Measured memory_bytes: 552
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n) 
#define SIZE(x) ((int)(x).size())
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef pair<int, int> pint;
typedef pair<lint, lint> plint;
typedef vector<lint> vec;
typedef vector<vector<lint>> matrix;
typedef priority_queue<lint> p_que;
typedef priority_queue<lint, vector<lint>, greater<lint>> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

lint gcd(lint a, lint b) {
    lint r;
    while (b != 0) {
        r = a % b;
        a = b; 
        b = r;
    }
    return a;
}

lint lcm(lint a, lint b) {
    return (a / gcd(a, b)) * b;
}

lint power(lint x, lint n, lint mod = MOD) {
    lint ret = 1;
    while(n > 0) {
        if(n & 1){
            (ret *= x) %= mod;
        }
        (x *= x) %= mod;
        n >>= 1;
    }
    return ret;
}

vector<lint> make_power(int n, lint base){
    lint num = 1;
    vector<lint> ret;
    for (int i=0; i<=n; ++i){
        ret.push_back(num);
        num *= base;
    }
    return ret;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    string o, e;
    cin >> o >> e;
    string p = "";
    REP(i, o.length() + e.length()){
        if(i % 2 == 0){
            p += o[i / 2];
        }
        else {
            p += e[i / 2];
        }
    }
    cout << p << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
template<class S> void arrInsert(const int k, int &sz, S a[], const S aval){
  int i;
  sz++;
  for(i=sz-1;i>k;i--){
    a[i] = a[i-1];
  }
  a[k] = aval;
}
template<class S, class T> void arrInsert(const int k, int &sz, S a[], const S aval, T b[], const T bval){
  int i;
  sz++;
  for(i=sz-1;i>k;i--){
    a[i] = a[i-1];
  }
  for(i=sz-1;i>k;i--){
    b[i] = b[i-1];
  }
  a[k] = aval;
  b[k] = bval;
}
template<class S, class T, class U> void arrInsert(const int k, int &sz, S a[], const S aval, T b[], const T bval, U c[], const U cval){
  int i;
  sz++;
  for(i=sz-1;i>k;i--){
    a[i] = a[i-1];
  }
  for(i=sz-1;i>k;i--){
    b[i] = b[i-1];
  }
  for(i=sz-1;i>k;i--){
    c[i] = c[i-1];
  }
  a[k] = aval;
  b[k] = bval;
  c[k] = cval;
}
int L;
int N;
int M;
int A[60];
int B[60];
int C[60];
int main(){
  int i, j, k, p;
  rd(L);
  while( (1<<N) <= L ){
    N++;
  }
  k = 1;
  for(i=0;i<(N-1);i++){
    arrInsert(M, M, A, i, B, i+1, C, 0);
    arrInsert(M, M, A, i, B, i+1, C, k);
    k *= 2;
  }
  k = 1<<(N-1);
  p = 1;
  for(i=0;i<(N-1);i++){
    if(L%2){
      arrInsert(M, M, A, i, B, N-1, C, k);
      k += p;
    }
    L /= 2;
    p *= 2;
  }
  wt_L(N);
  wt_L(' ');
  wt_L(M);
  wt_L('\n');
  for(i=0;i<(M);i++){
    wt_L(A[i]+1);
    wt_L(' ');
    wt_L(B[i]+1);
    wt_L(' ');
    wt_L(C[i]);
    wt_L('\n');
  }
  return 0;
}
// cLay varsion 20190830-1

// --- original code ---
// int L;
// int N, M, A[60], B[60], C[60];
// {
//   int i, j, k, p;
//   rd(L);
// 
//   while( (1<<N) <= L ) N++;
//   
//   k = 1;
//   rep(i,N-1){
//     arrInsert(M, M, A, i, B, i+1, C, 0);
//     arrInsert(M, M, A, i, B, i+1, C, k);
//     k *= 2;
//   }
// 
//   k = 1<<(N-1);
//   p = 1;
//   rep(i,N-1){
//     if(L%2) arrInsert(M, M, A, i, B, N-1, C, k), k += p;
//     L /= 2;
//     p *= 2;
//   }
// 
//   wt(N,M);
//   rep(i,M) wt(A[i]+1,B[i]+1,C[i]);
// }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int N;
  cin >> N;
  vector<vector<double>> v;
  rep(i,N){
    double x, y;
    cin >> x >> y;
    v.push_back({x,y});
  }

  vector<int> w;
  rep(i,N) w.push_back(i);

  int cnt = 0;
  double sum = 0;
  do{
    cnt++;
    REP(i,1,N){
      double x = v[w[i-1]][0];
      double y = v[w[i-1]][1];
      double xx = v[w[i]][0];
      double yy = v[w[i]][1];
      sum += sqrt((x-xx)*(x-xx)+(y-yy)*(y-yy));
    }
  }while(next_permutation(ALLOF(w)));

  printf("%.12lf\n", sum/cnt);
  
  return 0;
}


Measured memory_bytes: 256
#ALDS1_1_D:   Maximum Profit

n = int(input())
R = []
for _ in range(n):
    R.append(int(input()))
    
res = -1*float('inf')
minv = R[0]
for i in range(1, n):
    res = max(res, R[i]-minv)
    minv = min(minv, R[i])

print(res)


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

using namespace std;

int main(){
    int n;
    cin >> n;
    int t;
    vector<int> l;
    while( n-- ){
        cin >> t;
        l.push_back(t);
    }
    sort( l.begin(), l.end() );
    n = l.size();
    int ans = 0;
    for( int i=0;i <n; i++ ){
        for( int j=i+1;j <n; j++ ){
            int a = l[i];
            int b = l[j];
            auto it = lower_bound(l.begin()+j , l.end(), l[i]+l[j]);
            it--;
            while( it > l.begin()+j ){
                int c = *it;
                if( a < b+c && b < a+c && c < a+b ) {
                    ans++;
                }
                it--;
            }
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main() {
  int N, A[SIZE];

  cin >> N;

  for (int i=0; i<N; i++)
    cin >> A[i];

  int ans = 0;

  for (int i=1; i<N-1; i++) {
    ans += (A[i-1] < A[i]) ^ (A[i+1] < A[i]);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;
#define Pi 3.1415926535897932384626
#define mod llint(1e9+7)

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& 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;
}

bool check(llint a, llint b) {
	return a > b;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long 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;
}

//aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= 1000000007;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, 1000000007);
		ans %= 1000000007;
	}
	return ans;
}

//aのb乗をmodで割った余りを求める
llint power(llint a, llint b) {
	if (b == 1)return a;
	if (b == 0)return 1;
	llint tmp = power(a, b / 2);
	tmp *= tmp;
	tmp %= mod;
	if (b % 2 == 1) {
		tmp *= a;
		tmp %= mod;
	}
	return tmp;
}

int main() {
	int n;
	cin >> n;
	vint a(n);
	rep(i, n)cin >> a[i];
	int ans = 0;
	rep(i, n) {
		for (int j = i + 1; j < n; j++) {
			ans += a[i] * a[j];
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include<bits/stdc++.h>
#include <utility>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ll A,B,C;
  cin >> A >> B >> C;
  cout << (A+B>=C?"Yes":"No") << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
class p
{
  static void Main()
  {
    int N = int.Parse(Console.ReadLine());
    string[] input = Console.ReadLine().Split(' ');
    int T = int.Parse(input[0]);
    int A = int.Parse(input[1]);
    int p = -1;
    double min = double.MaxValue;
    input = Console.ReadLine().Split(' ');
    for (int i = 0; i < N; i++) {
      double abs = Math.Abs(A - (T - double.Parse(input[i]) * 0.006));
      if (abs < min) {
        min = abs;
        p = i;
      }
    }
    Console.WriteLine(p+1);
  }
}

Measured memory_bytes: 11164
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
	int n;cin>>n;
	 int     max1 = n;
        int     max2 = 3;
        vector< vector<int> > v (max1, vector<int>(max2) );
        vector< vector<int> > table (max1, vector<int>(max2) );
        for(int i=0;i<n;i++){
        	for(int j=0;j<3;j++){
        		cin>>v[i][j];//前がn人目後ろが回数
        	}
        }
        table=v;
        for(int k=0;k<n;k++){//kが、調査の対象
         	for(int i=0;i<n;i++){
        		for(int j=0;j<3;j++){
        			if(k==i)continue;
        			if(v[k][j]==table[i][j])v[k][j]=0;
        		}
        	}
        }
        
        for(int i=0;i<n;i++){
        		int count=0;
        		for(int j=0;j<3;j++){
        			count+=v[i][j];
        		}
        		cout<<count<<endl;
        	}
        
	return 0;
}

Measured memory_bytes: 1232
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, l int
	fmt.Scan(&n, &l)

	var s []string
	s = make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&s[i])
	}
	sort.Strings(s)
	for _, value := range s {
		fmt.Print(value)
	}
}


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

signed main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  
  int ans = 0;
  for( int i = 0; i < 1000; i++ ){
    string num = to_string(i);
    int n = (int)num.size();
    for( int k = 0; k < 3-n; k++ ) num = "0" + num;
    bool fg1 = 0;
    bool fg2 = 0;
    bool fg3 = 0;
    for( int j = 0; j < N; j++ ){
      if( fg1 == 0 && S.at(j) == num.at(0) ){
        fg1 = 1;
        continue;
      }if( fg1 && fg2 == 0 && S.at(j) == num.at(1) ){
        fg2 = 1;
        continue;
      }if( fg2 && fg3 == 0 && S.at(j) == num.at(2) ) fg3 = 1;   
    }
    if( fg1 && fg2 && fg3 ) ans++;
  }
  cout << ans << endl;

}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef pair<int,int> P;
typedef map<int,int> mp;

const int MOD = 1e9 + 7;


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

    int n;
    cin >> n;
    map<string, int> ms;
    rep(i, n){
        string s;
        cin >> s;
        ms[s]++;
    }

    int m = 0;
    for (auto p : ms) {
        if(p.second > m) m = p.second;
    }

    vector<string> ans;
    for (auto p : ms) {
        if(p.second == m) {
            ans.push_back(p.first);
        }
    }
    sort(all(ans));
    for (auto& p : ans) {
        cout << p << endl;
    }

    return 0;
}


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

int main()
{
  int H, W;
  vector<vector<char>> s(50, vector<char>(50, '.'));
  bool flag = true;

  cin >> H >> W;
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
      cin >> s[i][j];
  }
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      if (s[i][j] == '.')
        continue;
      if (i == 0 && j == 0 && i == H - 1 && j == W - 1)
        flag = false;
      else if (i == 0 && j == 0 && i == H - 1)
      {
        if (s[i][j + 1] != '#')
          flag = false;
      }
      else if (i == 0 && j == 0 && j == W - 1)
      {
        if (s[i + 1][j] != '#')
          flag = false;
      }
      else if (i == 0 && j == 0)
      {
        if (s[i + 1][j] != '#' && s[i][j + 1] != '#')
          flag = false;
      }
      else if (i == 0 && j == W - 1)
      {
        if (s[i + 1][j] != '#' && s[i][j - 1] != '#')
          flag = false;
      }
      else if (i == H - 1 && j == 0)
      {
        if (s[i - 1][j] != '#' && s[i][j + 1] != '#')
          flag = false;
      }
      else if (i == H - 1 && j == W - 1)
      {
        if (s[i - 1][j] != '#' && s[i][j - 1] != '#')
          flag = false;
      }
      else if (i == 0)
      {
        if (s[i + 1][j] != '#' && s[i][j + 1] != '#' && s[i][j - 1] != '#')
          flag = false;
      }
      else if (i == H - 1)
      {
        if (s[i - 1][j] != '#' && s[i][j + 1] != '#' && s[i][j - 1] != '#')
          flag = false;
      }
      else if (j == 0)
      {
        if (s[i + 1][j] != '#' && s[i - 1][j] != '#' && s[i][j + 1] != '#')
          flag = false;
      }
      else if (j == W - 1)
      {
        if (s[i + 1][j] != '#' && s[i - 1][j] != '#' && s[i][j - 1] != '#')
          flag = false;
      }
      else if (s[i + 1][j] != '#' && s[i - 1][j] != '#' && s[i][j + 1] != '#' && s[i][j - 1] != '#')
        flag = false;
      if (!flag)
        break;
    }
  }
  if (flag)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256