akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
int pow2(int x, int y) {
	if (y <= 0)return 1;
	int res = pow2(x*x, y / 2);
	if (y & 1)res *= x;
	return res;
}
signed main() {
	int n; cin >> n;
	vector<bool>prime(n + 1, true);
	prime[0] = prime[1] = false;
	for (int i = 2; i <= sqrt(n); i++) {
		if (prime[i]) {
			for (int j = 2; i*j <= n; j++) {
				prime[i*j] = false;
			}
		}
	}
	vector<int>v(n + 1, 0);
	for (int i = 0; i <= n; i++) {
		if (prime[i]) {
			for (int j = 1; n / pow2(i, j); j++) {
				v[i] += n / pow2(i, j);
			}
		}
	}
	int ans = 1;
	for (int i = 0; i <= n; i++) {
		ans = (ans*(v[i] + 1)) % MOD;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.Set;

//Towns along a Highway
public class Main{
	
	int n;
	int[] rs;
	int[][] a;
	int[] p, c;
	Set<String> res;
	Map<Integer, Set<Integer>> ref;
	
	boolean check(){
		int key = trans(p).hashCode();
		int mm = trans(c).hashCode();
		if(ref.containsKey(key)){
			if(ref.get(key).contains(mm))return false;
			ref.get(key).add(mm);
			return true;
		}
		ref.put(key, new HashSet<Integer>());
		ref.get(key).add(mm);
		return true;
	}
	
	void dfs(int k, int l, int r){
		if(k<0){
			res.add(trans(p)); return;
		}
		if(c[k]==0){
			dfs(k-1, l, r); return;
		}
		if(!check())return;
		int d = k;
		if(p[0]==-1){
			a[0][n-1]=a[n-1][0]=d;
			p[0] = 0; p[n-1] = d; c[d]--; dfs(k, l+1, r-1);
			p[0] = d; p[n-1] = 0; dfs(k, l+1, r-1); c[d]++;
			return;
		}
		for(int i=0;i<n;i++){
			if(p[i]!=-1||(i!=l&&i!=r))continue;
			for(int j=0;j<n;j++){
				if(p[j]==-1)continue;
				int pos = p[j]-d;
				if(0<=pos&&pos<=400){
					boolean ok = true;
					for(int m=0;m<n;m++){
						if(p[m]==-1)continue;
						int dif = Math.abs(p[m]-pos);
						a[i][m]=a[m][i]=dif;
						c[dif]--;
						if(c[dif]<0)ok = false;
					}
					if(ok){
						boolean f = i==l;
						p[i] = pos; dfs(k, f?l+1:l, f?r:r-1); p[i] = -1;
					}
					for(int m=0;m<n;m++){
						if(p[m]==-1)continue;
						int dif = Math.abs(p[m]-pos);
						a[i][m]=a[m][i]=-1;
						c[dif]++;
					}
				}
				pos = p[j]+d;
				if(0<=pos&&pos<=400){
					boolean ok = true;
					for(int m=0;m<n;m++){
						if(p[m]==-1)continue;
						int dif = Math.abs(p[m]-pos);
						a[i][m]=a[m][i]=dif;
						c[dif]--;
						if(c[dif]<0)ok = false;
					}
					if(ok){
						boolean f = i==l;
						p[i] = pos; dfs(k, f?l+1:l, f?r:r-1); p[i] = -1;
					}
					for(int m=0;m<n;m++){
						if(p[m]==-1)continue;
						int dif = Math.abs(p[m]-pos);
						a[i][m]=a[m][i]=-1;
						c[dif]++;
					}
				}
			}
		}
	}
	
	String trans(int[] p){
		String r = "";
		int[] t = p.clone();
		Arrays.sort(t);
		for(int i=1;i<n;i++)r+=String.format("%03d", t[i]-t[i-1]);
		return r;
	}
	
	void run(){
		Scanner sc = new Scanner(System.in);
		for(;;){
			n = sc.nextInt();
			if(n==0)break;
			ref = new HashMap<Integer, Set<Integer>>();
			a = new int[n][n];
			for(int[]b:a)Arrays.fill(b, -1);
			c = new int[401];
			rs = new int[n*(n-1)/2];
			int k = 0;
			for(int i=0;i<n;i++)for(int j=i+1;j<n;j++){
				int d = sc.nextInt();
				rs[k++] = d;
				c[d]++;
			}
			p = new int[n];
			Arrays.fill(p, -1);
			res = new HashSet<String>();
			dfs(400, 0, n-1);
			PriorityQueue<String> q = new PriorityQueue<String>();
			for(String t:res)q.add(t);
			while(!q.isEmpty()){
				String t = q.poll();
				List<Integer> l = new ArrayList<Integer>();
				for(int i=0;i<t.length();i+=3)l.add(Integer.parseInt(t.substring(i, i+3)));
				for(int i=0;i<l.size();i++)System.out.print(l.get(i)+(i==l.size()-1?"\n":" "));
			}
			System.out.println("-----");
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 0
N = int(input())
mon = [int(x) for x in input().split()]
her = [int(x) for x in input().split()]
n = 0
for i in range(len(her)):
    z = min(mon[i], her[i])
    mon[i] -= z
    her[i] -= z
    n += z
    z = min(mon[i+1], her[i])
    mon[i+1] -= z
    her[i] -= z
    n += z
print (n)

Measured memory_bytes: 19156
#include <bits/stdc++.h>
#include <math.h>
#include <regex>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;
ld n , d;
vector<vector<ld>> x(n,vector<ld>(d));

int main(){
    ll n,m; cin >> n >> m;
    priority_queue<ll> a;
    rep(i,n){
        ll x; cin >> x; 
        a.push(x);
    }
    for(int i=0;i<m;i++){
        ll x = a.top();
        a.pop();
        a.push(x/2);
    }
    ll ans = 0;
    for(int i=0;i<n;i++){
        ll x = a.top();
        ans += x;
        a.pop();
    }
    cout << ans << endl;
}

Measured memory_bytes: 1400
/****************
 *		*
 * ALDS_1_4:    *
 * LinearSearch *
 *		*
 * 2019/08/15   *
 ****************/

#include<iostream>

#define MAX_ARRAY 10000

using namespace std;

bool linear_search(int* a,int num_array,int num_search);

int main(void){

  int n,S[MAX_ARRAY];
  int q,T;
  int count_match = 0; 

  cin >> n;
  for(int i=0;i<n;i++) {
    cin >> S[i];
  }

  cin >> q;
  for(int i=0;i<q;i++) {
    cin >> T;
    if(linear_search(S,n,T)) count_match++;
  }

  cout << count_match << endl;
  
  return 0;
}

bool linear_search(int *a,int num_array,int num_search){

  int i;
  
  for(i=0;(i<num_array) && (a[i] != num_search);i++);
    
  return (i < num_array);
}



Measured memory_bytes: 3132
/* ChampionsNeverFall :)*/
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
#define mp make_pair
#define mod 1000000007
#define vll vector<ll>
#define vpll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define f(n) for(ll i=0;i<n;i++)
#define pb push_back
#define iPair pair<ll, pair<ll,ll>>
#define en '\n'
typedef long long ll;
typedef long double ld;
#define PI 2*acos(0.0);
ll extendedGcd(ll a, ll b, ll & x, ll & y);
void addEdge(vector<ll> adj[], ll u, ll v);
void DFSUtil(ll u, vector<ll> adj[],vector<bool> &visited);
void DFS(vector<ll> adj[], ll V,ll start=0);
ll logg(ll x);
ll pw(ll x,ll y);
ll lcm(ll a,ll b);
vll adj[100005];
bool vis[100005];
ll n;
ll connected=0;
void dfs(int x)
{
    vis[x]=true;
    for(auto it: adj[x])
    {
        if(vis[it]==false)
        {
           dfs(it);
        }
    }
}
void cnnct()
{
    rep(i,1,n+1)
    {
        if(vis[i]==false)
        {
            //cout<<i<<en;
            dfs(i);
            connected++;
        }
    }
}
int main()
{
    IOS
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ll t=1;
    //cin>>t;
    while(t--)
    {
        ll m,x,y;
        memset(vis,false,sizeof vis);
        cin>>n>>m;
        f(m)
        {
            cin>>x>>y;
            adj[x].pb(y);
            adj[y].pb(x);
        }
        cnnct();
        cout<<connected-1<<en;
    }
    return 0;
}
ll lcm(ll a,ll b)
{
    ll temp=((a*b)/__gcd(a,b));
    return temp;
}
ll pw(ll x,ll y)
{
    ll temp = 1;
    x = x % mod;
    if (x == 0) return 0;
    while (y > 0)
    {
        if (y & 1)
            temp = (temp*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return temp;
}
ll logg(ll x)
{
    ll ans=0;
    ll temp=1;
    while(temp<=x)
    {
        temp*=2;
        ans++;
    }
    if(temp>x)
        ans--;
    return ans;
}
ll extendedGcd(ll a, ll b, ll & x, ll & y)
{
    if (a == 0)
    {
        x = 0;
        y = 1;
        return b;
    }
    ll x1, y1;
    ll d = extendedGcd(b % a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return d;
}




Measured memory_bytes: 10408
N = int(input())
work = [list(map(int, input().split())) for _ in range(N)]

work = sorted(work, key=lambda x: x[1])


def solve():
    t = 0
    for w in work:
        t += w[0]
        if t > w[1]:
            return False

    return True


print('Yes' if solve() else 'No')


Measured memory_bytes: 55192
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pri 1000000007
#define MP make_pair
#define mx 1000000000
#define PB push_back
using namespace std;
void run(){
	ll s;cin>>s;
	ll a=sqrt(s);
	
	ll b=s/a;
    if(s%a!=0)b++;
	
	if(b>mx){
	 a=mx;
	 b=s/a;
	 if(s%a!=0)b++;}
	
	ll x=(a*b-s);
	ll y=1;
	cout<<a<<" "<<b<<" "<<a-x<<" "<<0<<" "<<0<<" "<<b-y<<endl;	
		
	
	
	
}
int main() {
	ll t=1;//cin>>t;
	for(ll i=0;i<t;i++)run();
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ldb long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define forn(i, n) for(int i=0; i<(int)(n); i++)
#define forne(i, a, b) for(int i=a; i<=(int)(b); i++)

#define gottagofast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl "\n"
using namespace std;

#define MAX (3001)
#define MOD (ll)(1e9 + 7)

int n;
ldb tabela[MAX][MAX];
vector<ldb> p(MAX, 0);

ldb dp(int idx, int heads) {
  if(idx >= n) {
    if(heads > n-heads)
      return 1;
    else
      return 0;
  }
  if(tabela[idx][heads] != -1)
    return tabela[idx][heads];

  ldb res = (p[idx]*dp(idx+1, heads+1) + (1-p[idx])*(dp(idx+1, heads)));

  return tabela[idx][heads] = res;
}

int main() {
  cin >> n;

  for(int i = 0; i < MAX; i++) {
    for(int j = 0; j < MAX; j++) {
      tabela[i][j] = (ldb)(-1);
    }
  }
  forn(i, n)
    cin >> p[i];

  printf("%.12Lf\n", dp(0, 0));

  return 0;
}


Measured memory_bytes: 141312
/* Dsingh_24 */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ios	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

#define N  100005

int main()
{
	ios
	ll n,i,j,a=0,b,cnt=0,c1=0,c2=0;
	cin>>n>>a>>b;
	ll p[n+1];
	for(i=0;i<n;i++){
		cin>>p[i];
		if(p[i]<=a)c1++;
		if(p[i]>a&&p[i]<=b)cnt++;
		if(p[i]>b)c2++;
	}
	cout<<min(c1,min(c2,cnt));
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e3+5;
inline int read(){
	char c=getchar();int t=0,f=1;
	while((!isdigit(c))&&(c!=EOF)){if(c=='-')f=-1;c=getchar();}
	while((isdigit(c))&&(c!=EOF)){t=(t<<3)+(t<<1)+(c^48);c=getchar();}
	return t*f;
}
int n,x,y;
vector<int> g[maxn];
int dis[maxn],ans[maxn];
inline void add(int a,int b){
	g[a].push_back(b);
	g[b].push_back(a);
}
void bfs(int s){
	queue<int> q;
	memset(dis,0x3f,sizeof(dis));
	while(!q.empty())q.pop();
	dis[s]=0;
	q.push(s);
	while(!q.empty()){
		int u=q.front();q.pop();
		//printf("%d %d %d\n",s,u,dis[u]);
		ans[dis[u]]++;
		for(int i=0;i<g[u].size();i++){
			int v=g[u][i];
			if(dis[v]>dis[u]+1){
				dis[v]=dis[u]+1;
				q.push(v);
			}
		}
	}
}
signed main(){
	n=read(),x=read(),y=read();
	for(int i=1;i<n;i++){
		add(i,i+1);
	}
	add(x,y);
	for(int i=1;i<=n;i++){
		bfs(i);
	}
	for(int i=1;i<n;i++)printf("%d\n",ans[i]/2);
	return 0;
}


Measured memory_bytes: 512
import java.util.*;
public class Main {
    Scanner kbd = new Scanner(System.in);
    HashMap<String, String>  con; 
    public static void main(String[] args){
	new Main().run();
    }
    
    void run(){
	while(kbd.hasNext()){
	    int n = kbd.nextInt();
	    if(n!=0){
		con = new HashMap<String, String>();
		String in;
		String out;
		StringBuffer ans = new StringBuffer();
      		while(n-- != 0){
		    con.put(kbd.next(), kbd.next());
		}

		n = kbd.nextInt();
		while(n-- != 0){
		    String a = kbd.next();
		    if(con.containsKey(a))  ans.append(con.get(a));
		    else ans.append(a);
		}
		System.out.println(ans.toString());
	    }
	}
    }
}

Measured memory_bytes: 68264
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue> //priority_queue
#include <map>
#include <set> //multiset set<int,greater<int>>大到小
#include <vector>// ::iterator it;
#include <stack>
#include <cmath> // auto &Name : STLName  Name.
#include <utility>
#include <sstream>
#include <string>//__builtin_popcount(ans);//获取某个数二进制位1的个数
#define mod 1000000007
#define mod9 998244353
typedef unsigned long long ull;
typedef long long ll;
typedef double db;
typedef long double ld;
const db eps=1e-10;
const int INF = 0x3f3f3f3f;
const ll inf=0x3f3f3f3f3f3f3f3f;
const int N=1e5+7;
using namespace std;

int t,n,m,ans=0,cnt=0,sum=0;
db x1,y11,x2,y2,a,b,k,p,x;
int main(){
    scanf("%lf%lf%lf%lf",&x1,&y11,&x2,&y2);
    scanf("%d",&n);
    while(n--){
        scanf("%lf%lf",&a,&b);
        if(x1==x2){
            printf("%.10lf %.10lf\n",x1,b);
        }else if(y11==y2){
            printf("%.10lf %.10lf\n",a,y2);
        }else{
            k=(y2-y11)/(x2-x1);
            p=-1/k;
            x=(a*p-b+y11-k*x1)/(p-k);
            printf("%.10lf %.10lf\n",x,p*(x-a)+b);
        }
    }




    return 0;
}


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

int main() {
  int a,b,c;
  std::cin >> a >> b >> c;
  if (a < b && b < c && a < c) {
    std::cout << "Yes" << '\n';
  } else {
    std::cout << "No" << '\n';
  }

  return 0;
}


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

#define Fast            ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define fWrite          freopen ("out.txt","w",stdout);
#define TC              int t;cin >> t;FOR(tc,1,t)
#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define pii             pair<int,int>
#define all(a)          a.begin(),a.end()
#define MEM(a,x)        memset(a,x,sizeof(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)

#define Make(x,p)       (x  (1<<p))
#define DeMake(x,p)     (x & ~(1<<p))
#define Check(x,p)      (x & (1<<p))
#define popcount(x)     __builtin_popcount(x)

int n;
LL arr[3003];
LL dp[3003][3003];
bool vis[3003][3003];

LL call(int i,int j){
    if(i==j) return arr[i];
    if(vis[i][j]==1) return dp[i][j];
    vis[i][j]=1;
    return dp[i][j]=max(arr[i]-call(i+1,j),arr[j]-call(i,j-1));
}

int main()
{
    cin >> n;
    REP(i,n) cin >> arr[i];
    cout << call(0,n-1);
}


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

int main()
{
    int r, D, x2;
    int i;
    int ans;

    cin >> r >> D >> x2;
    ans = x2;
    for(i = 0; i < 10; i++){
        ans = r * ans - D;
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            new Main().solve(in);
        }
    }

    private void solve(Scanner in) {
        int N = in.nextInt(), M = in.nextInt();
        Fenwick F = new Fenwick(N);
        for (int i = 0; i < M; i++) {
            int a = in.nextInt(), b = in.nextInt();
            if (a > b) {
                int tmp = a;
                a = b;
                b = tmp;
            }
            F.add(a, +1);
            F.add(b, -1);
        }
//        System.out.println(F);

        boolean yes = true;
        for (int i = 1; i < N; i++) {
            int accum = F.accum(i);
//            System.out.println(accum);
            if (accum % 2 > 0) {
                yes = false;
                break;
            }
        }
        System.out.println(yes ? "YES" : "NO");
    }

    private static class Fenwick {
        private final int[] fenwick;

        public Fenwick(int n) {
            fenwick = new int[n + 1];
        }

        public int accum(int i) {
            int sum = 0;
            for (; i > 0; i -= i & -i) {
                sum += fenwick[i];
            }
            return sum;
        }

        public int sum(int begin, int end) {
            return accum(end) - accum(begin - 1);
        }

        public void add(int i, int a) {
            for (; i < fenwick.length; i += i & -i) {
                fenwick[i] += a;
            }
        }

        @Override
        public String toString() {
            int N = fenwick.length;
            long[] raw = new long[N];
            long[] acc = new long[N];
            for (int i = 1; i < N; i++) {
                acc[i] = accum(i);
                raw[i] = acc[i] - acc[i - 1];
            }
            StringBuilder s = new StringBuilder();
            s.append("Fenwick [\n");
            s.append(" fenwick=" + Arrays.toString(fenwick) + "\n");
            s.append(" accum  =" + Arrays.toString(acc) + "\n");
            s.append(" raw    =" + Arrays.toString(raw) + "\n]");
            return s.toString();
        }
    }
}

Measured memory_bytes: 65032
#include <stdio.h>
int main()
{
  int a, b = 0, N, d;
  char S[4];
  scanf("%s", &S[0]);
  if (S[0] == S[1] && S[0] != S[2] && S[0] != S[3] && S[2] == S[3])
    printf("Yes\n");
  else if (S[0] != S[1] && S[0] == S[2] && S[0] != S[3] && S[1] == S[3])
    printf("Yes\n");
  else if (S[0] != S[1] && S[0] != S[2] && S[0] == S[3] && S[1] == S[2])
    printf("Yes\n");
  else
    printf("No\n");

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);
#define ADD +
#define SUBTRACT -
#define MULTIPLY *
#define DIVIDE /
#define MOD %
#define INCREMENT(x) ++x
#define DECREMENT(x) --x
#define in(a,b) cin>>a>>b;
#define out(a,b) cout<<a<<endl<<b<<endl;
#define scan(a) scanf("%d",&a);
#define print(a) printf("%d\n",a);
#define scanii(a,b) scanf("%d %d",&a,&b);
#define printii(a,b) printf("%d\n%d\n",a,b);
#define scaniii(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define ll long long
#define ull unsigned long long
#define sll signed long long
#define pi acos(-1)
#define mod 1000000007
#define TRUE 1
#define FALSE 0
#define ZERO 0
#define MP make_pair
#define F first
#define S second
#define f1(i,a) for(int i=0;i<a;++i)
#define f2(i,a) for(int i=a-1;i>=0;--i)
#define en puts("");
#define elif else if
typedef ll int lli;
typedef sll int slli;
typedef ull int ulli;
const int sz=10000;
using namespace std;

int clue();
int result();
void show();
bool check();


bool cmp(pair<int,int>p,pair<int,int>q) {
    // return p.first>q.first;//descending by first
    // return p.first<q.first;//ascending by first
    // return p.second>q.second;//descending by second
    return p.second<q.second;//ascending by second
}

// bool cmp(int p,int q) {
    // return p>q;//descending
    // return p<q;//ascending
// }


int main() {

    int t;
    // cin>>t;
    t=1;
    while(t-->0) {
        clue();
    }

    return 0;
}
int clue() {


    int n;
    cin>>n;
    n++;
    cout<<n/2<<endl;
    // ()?cout<<"Yes"<<endl:cout<<"No"<<endl;
    
    return 0;
}

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

#define ALL (num[0] == num[1]) && (num[1] == num[2]) && (num[2] == num[3])

int sortup(char *str);
int sortdw(char *str);

char num[5];
char n[5];

int main(void)
{
  int up, dw;
  int count = 0, i = 0, j, k, N;
  int ans[9999];
//  char temp = '0', temp2;
  char str2[5] = {'0', '\0'};
  char tempstr[5] = {'\0'};
  
  scanf("%s", num);

  while (strcmp(num, "0000") != 0){
	if (ALL){
		ans[i] = -1;
		i++;
		scanf("%s", num);
	}
	else if (strcmp(num, "6174") == 0){
	    ans[i] = count;
    	i++;
   		scanf("%s", num);
	}
	else {
	    up = sortup(num);
    	dw = sortdw(num);
	    N = up - dw;
		//printf("%d-%d=%d\n", up, dw, N);
	    sprintf(n, "%d", N);
		for (j = 0; n[j] != '\0'; j++);
		if (j == 3){
			strcat(tempstr, str2);
			strcat(tempstr, n);
			//printf("%s\n", tempstr);
			strcpy(n, tempstr);
			tempstr[0] = '\0';
		}
		n[4] = '\0';
		count++;
		
    	while (strcmp(n, "6174") != 0){
      		up = sortup(n);
     		dw = sortdw(n);
      		N = up - dw;
			//printf("%d-%d=%d\n", up, dw, N);
      		sprintf(n, "%d", N);
			for (j = 0; n[j] != '\0'; j++);
			if (j == 3){
				strcat(tempstr, str2);
				strcat(tempstr, n);
				//printf("%s\n", tempstr);
				strcpy(n, tempstr);
				tempstr[0] = '\0';
			}
			n[4] = '\0';
      		count++;
    	}
		
	    ans[i] = count;
    	i++;
		count = 0;
    	scanf("%s", num);
  	}
  }
  
  for (j = 0; j < i; j++){
  	if (ans[j] == -1){
		puts("NA");
  	}
	else {
	    printf("%d\n", ans[j]);
	}
  }

  return (0);
}

int sortup(char *str){
	int n, i, j;
	char temp;
	for (i = 0;i < 4; i++){
		for (j = 0; j < 3; j++){
			if (str[j] < str[j + 1]){
				temp = str[j];
				str[j] = str[j + 1];
				str[j + 1] = temp;
			}
		}
	}
	
	n = atoi(str);
	
	return (n);
}

int sortdw(char *str)
{
	int n, i, j;
	char temp;
	for (i = 0;i < 4; i++){
		for (j = 0; j < 3; j++){
			if (str[j] > str[j + 1]){
				temp = str[j];
				str[j] = str[j + 1];
				str[j + 1] = temp;
			}
		}
	}
	
	n = atoi(str);
	
	return (n);
}

Measured memory_bytes: 620
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>

using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(int (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define matC(name,fnum,snum); vector<vector<char>> name((fnum),vector<char>((snum),0));
#define debugP int debug_point; cin>>debug_point;
#define FI first
#define SE second
const ll MOD= 1e9 + 7;
template <typename T>
void putv(vector<T>& V){
	// cout << "The elements in the vector are: " << endl;
	for(auto x: V)
		cout << x << " ";
	cout << endl;
}
ll pow_mod(ll fi,ll se,ll mod){
  if(se==0){
    return 1;
  }
  if(se%2){
    return pow_mod(fi,se-1,mod)*fi%mod;
  }
  ll t=pow_mod(fi,se/2,mod);
  return t*t%mod;
}
template <class T>
vector<T> getv(ll n){
	vector<T> Vector_temp;
	rep(i,n){
		T input;
		cin >> input;
		Vector_temp.emplace_back(input);
	}
	return Vector_temp;
}
ll gcd(ll c,ll b){
    while(1){
        if(c%b!=0){
        ll tmp=b;
        b=c%b;
        c=tmp;
        }else{
            return b;
        }
    }
}

vector<pair<int,int>> Dir={{-1,0},{1,0},{0,1},{0,-1}};
/* <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3*/


int main(){
  ll n,x;
  cin>>n>>x;
  vec(l,n);
  rep(i,n){
    cin>>l[i];
  }
  ll ans=1;
  ll tmp=0;
  rep(i,n){
    tmp+=l[i];
    if(tmp<=x)ans++;
  }
  op(ans)
  return 0;
}


Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    PrintWriter out = new PrintWriter(System.out);

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

    void run() {

        int k = sc.nextInt();
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i=0; i<n; i++) arr[i] = sc.nextInt();


        int ans = Integer.MAX_VALUE;

        for (int i=0; i<n; i++) {
            int rightS = i;
            int rightEnd = (i==0) ? n-1 : i-1;
            if (i==0) {
                ans = Math.min(ans, arr[n-1]-arr[0]);
            } else {
                ans = Math.min(ans, k-(arr[i]-arr[i-1]));
            }

            int leftS = i;
            int leftEnd = (i==n-1) ? 0 : i+1;
            if (i==n-1) {
                ans = Math.min(ans, arr[n-1]-arr[0]);
            } else {
                ans = Math.min(ans, k-(arr[i+1]-arr[i]));
            }
        }


        out.print(ans);
        out.flush();



    }

}


Measured memory_bytes: 87172
#!/usr/bin/env python3
import sys
input = lambda: sys.stdin.buffer.readline()[:-1].decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 10**9+7

class UnionFind:
    __slots__ = ['id','sz']

    def __init__(self, n):
        self.id = [-1] * n
        self.sz = n

    def root(self, x):
        if self.id[x] < 0:
            return x
        else:
            self.id[x] = self.root(self.id[x])
            return self.id[x]

    def find(self, x, y):
        return self.root(x) == self.root(y)

    def union(self, x, y):
        s1, s2 = self.root(x), self.root(y)
        if s1 != s2:
            if self.id[s1] <= self.id[s2]:
                self.id[s1] += self.id[s2]
                self.id[s2] = s1
            else:
                self.id[s2] += self.id[s1]
                self.id[s1] = s2
            self.sz-=1
            return True
        return False


V,E=map(int,input().split())
uf=UnionFind(V)
ans=0
stw=[list(map(int,input().split())) for i in range(E)]
stw.sort(key=lambda tup:tup[2])
for s,t,w in stw:
    if not uf.find(s,t):
        uf.union(s,t)
        ans+=w
print(ans)



Measured memory_bytes: 28272
using System;
using System.Collections.Generic;
using System.Linq;

class MainClass
{
    static void Main()
    {
        var ABCD = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int A = ABCD[0], B = ABCD[1], C = ABCD[2], D = ABCD[3];
        bool turn = true;
        while (A > 0 && C > 0)
        {
            if (turn) C -= B;
            else A -= D;
            turn = !turn;
        }
        Console.WriteLine(A>0?"Yes":"No");
    }
}

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

#undef LOCAL
#ifdef LOCAL
#include "../lib/dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))

typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int g[1001][1001];
ll dp[1002][1002];

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("temp.1", "r", stdin);

  int H, W;
  cin >> H >> W;
  for (int i = 0; i < H; i++) {
    string a;
    cin >> a;
    for (int j = 0;  j < W; j++) {
      g[i][j] = a[j] == '.' ? 0 : 1;
    }
  }
  dumpv(g, H, W);
  dp[0][0] = 1;
  dumpv(dp, H, W);
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (0 < i)
        dp[i][j] = (dp[i][j] + dp[i - 1][j]) % MOD;
      if (0 < j)
        dp[i][j] = (dp[i][j] + dp[i][j - 1]) % MOD;
      if (g[i][j])
        dp[i][j] = 0;
    }
  }
  dumpv(dp, H, W);
  cout << dp[H - 1][W - 1] << endl;
  return 0;
}


Measured memory_bytes: 12032
def prime_table(n):
    arr = [True]*(n+1)
    arr[0], arr[1] = False, False
    for i in range(2, N+1):
        if not arr[i]: continue
        j = 2*i
        while j <= n:
            arr[j] = False
            j += i
    return arr
N = 10**5
pt = prime_table(N)
cum = [0]*(N+1)
for i in range(1, N+1, 2):
    if pt[i] and pt[(i+1)//2]:
        cum[i] = 1
for i in range(1, N+1):
    cum[i] += cum[i-1]
Q = int(input())
ans = []
for _ in range(Q):
    l, r = map(int, input().split())
    ans.append(cum[r]-cum[l-1])
print(*ans, sep="\n")


Measured memory_bytes: 18200
#include <iostream>
#include <algorithm>
#include <stack>
#include <string>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <list>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

struct node{ int parent, left, right;};
node t[100];
int n, NIL = -1, d[100], h[100];

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

void print(int u) {
	int c, deg = 0;
	cout << "node " << u << ": parent = " << t[u].parent;

	cout << ", sibling = " << getSibling(u);

	if(t[u].left != NIL) deg++;
	if(t[u].right != NIL) deg++;
	cout << ", degree = " << deg;

	cout << ", depth = " << d[u] ;
	cout << ", height = " << h[u] << ", ";
	
	if(t[u].parent == NIL) cout <<"root";
	else if (t[u].left == NIL && t[u].right == NIL) cout << "leaf";
	else cout << "internal node";
	cout << endl;
}

void rec(int u, int p) {
	d[u] = p;
	if( t[u].right != NIL) rec(t[u].right, p+1);
	if( t[u].left != NIL) rec(t[u].left, p+1);
}

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

int main(){
	int v, c, l, r;
	int n; cin >> n;
	for( int i = 0; i < n; i++) t[i].parent = NIL;
	for( int i = 0; i < n; i++) {
		cin >> v;
		for( int j = 0; j < 2; j++) {
			cin >> c;
			if( j == 0) t[v].left = c;
			else t[v].right = c;
			if( c != NIL) t[c].parent = v;
		}
	}
	for( int i = 0; i < n; i++) {
		if( t[i].parent == NIL) r = i;
	}

	rec(r, 0);
	height(r);

	for(int i = 0; i < n; i++) print(i);

	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
using lli = long long int;

lli nc2(lli l) {
	if (l < 2)return 0;
	lli ret = l;
	return (l * (l - 1)) / 2;
}

int main() {
	string s,t;
	cin >> s >> t;
	for (int i = 0; i < s.size(); i++) {
		rotate(s.begin(), s.begin() + 1, s.end());
		if (s == t) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
from itertools import accumulate
N, C = map(int, input().split())
X = [[0] * (10 ** 5 + 1) for i in range(C)]
for i in range(N):
    s, t, c = map(int, input().split())
    c -= 1
    X[c][s - 1] += 1
    X[c][t] -= 1

for c in range(C):
    X[c] = list(accumulate(list(X[c])))


ans = 0
for i in range(10 ** 5 + 1):
    tmp = 0
    for c in range(C):
        tmp += min(1, X[c][i])
    ans = max(ans, tmp)

print(ans)


Measured memory_bytes: 119768
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

int main(){
    int n;
    string s;
    cin>>n>>s;
    rep(i,s.size()-1){
        if(s[i]=='x' && s[i+1]=='x'){
            cout<<i+1<<endl;
            return 0;
        }
    }
    cout<<n<<endl;
}

Measured memory_bytes: 3340
#include <iostream>
#include <vector>
using namespace std;
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

int main() {
    /* 入力 */
    int N;
    cin >> N;
    vector<long long> a(N*2); // 環状の数列を扱うときは二週確保はよくやる
    long long total = 0; // バームクーヘン全体のサイズ
    for (int i = 0; i < N; ++i) cin >> a[i], a[i+N] = a[i], total += a[i];
    
    
    /* 二分探索 */
    long long low = 0, high = 1LL<<60;
    while (high - low > 1) {
        /* 三ピースとも mid 以上にできるかを判定する */
        long long mid = low + (high - low) / 2;
        
        //COUT("------");
        //COUT(mid);
    
        /* 各切れ目から mid 以上になる最小区間がどこまでかを求める */
        vector<int> Next(N, -1);
        vector<long long> Size(N, -1);
        int right = 0;
        long long sum = 0;
        for (int left = 0; left < N; ++left) {
            while (right < N*2 && sum < mid) {
                sum += a[right];
                ++right;
            }
            if (sum >= mid) { // mid 以上なら記録
                Next[left] = right;
                Size[left] = sum;
                
                //cout << left << ": " << Next[left] << ", " << Size[left] << endl;
            }
            if (right == left) ++right;
            else sum -= a[left];
        }
        
        /* check */
        bool ok = false;
        for (int i = 0; i < N; ++i) {
            int ni = Next[i];
            if (ni == -1) continue;
            if (Size[i] >= total) continue;
            
            ni %= N;
            int nni = Next[ni];
            if (nni == -1) continue;
            
            // 残りが mid 以上なら OK
            if (total - Size[i] - Size[ni] >= mid) ok = true;
        }
        
        if (!ok) high = mid;
        else low = mid;
    }
    
    cout << low << endl;
}


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

using namespace std;

#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define INF (1 << 29)
#define LLINF (1LL << 60)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

using Pi = pair<int, int>;
using ll = long long;

string to_string(string s) { return s; }
template <class S>
string to_string(unordered_set<S> s);
template <class S>
string to_string(set<S> s);
template <class S, class T>
string to_string(map<S, T> m);
template <class T>
string to_string(vector<T> v);

template <class S, class T>
string to_string(pair<S, T> p) {
  return "{" + to_string(p.first) + "," + to_string(p.second) + "}";
}

template <class S>
string to_string(unordered_set<S> s) {
  string ret = "{";
  for (S x : s) ret += to_string(x) + ",";
  return ret + "}";
}

template <class S>
string to_string(set<S> s) {
  string ret = "{";
  for (S x : s) ret += to_string(x) + ",";
  return ret + "}";
}

template <class S, class T>
string to_string(map<S, T> m) {
  string ret = "{";
  for (pair<S, T> x : m) ret += to_string(x) + ",";
  return ret + "}";
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  for (int i = 0; i < (int)v.size() - 1; ++i) {
    ret += to_string(v[i]) + ",";
  }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() { cerr << endl; }

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() { cout << endl; }

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

int main() {
  cin.tie(0);
  int N, A, B;
  cin >> N >> A >> B;
  int ans = N;
  FOR(i, N) {
    int t;
    cin >> t;
    if (A <= t && t < B) ans--;
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 2e9
#define LINF 1e18
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;

int main() {
    int r; cin >> r;
    cout << r*r << endl;

}

Measured memory_bytes: 256
import heapq
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


N = int(input())
adj = [[] for _ in range(N)]

for _ in range(N-1):
    a, b = map(lambda x: int(x)-1, input().split())
    adj[a].append(b)
    adj[b].append(a)

# heapqで大きい順に取り出したいから、マイナスにしておく。
L = list(map(lambda x: -int(x), input().split()))
heapq.heapify(L)
# Maxは一番大きい数字以外の和.(全体の和-最大の整数)でも止める。
# Lはマイナスがかけてあるので、min(L)で最大の和が求まる
score = -sum(L)+min(L)


# nodeに書く数字
node = [-1]*N

# leafを探す,leafからbfsして訪問順に大きい数字を入れていく
leaf = -1
for i, a in enumerate(adj):
    if len(a) == 1:
        leaf = i
        break

# bfs
Q = [leaf]
while Q:
    cur = Q.pop()
    for a in adj[cur]:
        if node[a] == -1:  # まだたどり着いてないとこには、数字を入れる。
            node[a] = - heapq.heappop(L)
            Q.append(a)
print(score)
print("\n".join(map(str, node)))

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

int main() {
  int K;
  string S;
  cin >> K >> S;
  if (K >= S.size()) cout << S << endl;
  else {
    for (int i = 0; i < K; i++) cout << S[i];
    cout << "..." << endl;
  }
}


Measured memory_bytes: 3596
use std::io::{self, Stdin};
use std::str::{self, FromStr};
use std::error::Error;
use std::thread;
use std::cmp::*;
fn exec() {
    let mut sc = Scanner::new();
    let n: usize = sc.ne();
    let a: Vec<i64> = (0..n).map(|_| sc.ne()).collect();
    let mut z: Vec<_> = a.into_iter().zip(0..).collect();
    z.push((0, -1));
    z.sort();
    let mut ans = vec![0; n];
    let (mut mi, mut cnt, mut mx) = (n, 0, z[n].0);
    for j in (0..n + 1).rev() {
        let (x, i) = z[j];
        if x != mx {
            assert!(mi < n);
            ans[mi] += (mx - x) * cnt;
            mx = x;
        }
        cnt += 1;
        mi = min(mi, i as usize);
    }
    for x in ans {
        println!("{}", x);
    }
}

fn main() {
    const DEFAULT_STACK: usize = 16 * 1024 * 1024;
    let builder = thread::Builder::new();
    let th = builder.stack_size(DEFAULT_STACK);
    let handle = th.spawn(|| { exec(); }).unwrap();
    let _ = handle.join();
}

trait Monoid<T>: Clone {
    fn merge(&T, &T) -> T;
    fn ide() -> T;
}

// Range Minimum Query
type Int = i64;
impl Monoid<Int> for Int {
    fn merge(l: &Int, r: &Int) -> Int {
        std::cmp::min(*l, *r)
    }
    fn ide() -> Int {
        std::i32::MAX as Int
    }
}

#[allow(dead_code)]
struct Scanner {
    stdin: Stdin,
    id: usize,
    buf: Vec<u8>,
}

#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner {
        Scanner {
            stdin: io::stdin(),
            id: 0,
            buf: Vec::new(),
        }
    }
    fn next_line(&mut self) -> Option<String> {
        let mut res = String::new();
        match self.stdin.read_line(&mut res) {
            Ok(0) => return None,
            Ok(_) => Some(res),
            Err(why) => panic!("error in read_line: {}", why.description()),
        }
    }
    fn next<T: FromStr>(&mut self) -> Option<T> {
        while self.buf.len() == 0 {
            self.buf = match self.next_line() {
                Some(r) => {
                    self.id = 0;
                    r.trim().as_bytes().to_owned()
                }
                None => return None,
            };
        }
        let l = self.id;
        assert!(self.buf[l] != b' ');
        let n = self.buf.len();
        let mut r = l;
        while r < n && self.buf[r] != b' ' {
            r += 1;
        }
        let res = match str::from_utf8(&self.buf[l..r]).ok().unwrap().parse::<T>() {
            Ok(s) => Some(s),
            Err(_) => {
                panic!("parse error, {:?}",
                       String::from_utf8(self.buf[l..r].to_owned()))
            }
        };
        while r < n && self.buf[r] == b' ' {
            r += 1;
        }
        if r == n {
            self.buf.clear();
        } else {
            self.id = r;
        }
        res
    }
    fn ne<T: FromStr>(&mut self) -> T {
        self.next::<T>().unwrap()
    }
}


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

ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}

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

  ll gcd_v = gcd(a, b);

  ll ans = 1;
  ll i = 2;
  while (true) {
    ll tmp = gcd_v;
    while (gcd_v % i == 0) gcd_v /= i;
    if (tmp > gcd_v) ans++;
    if (gcd_v == 1) break;
    if (++i*i > gcd_v) {
      ans++;
      break;
    }
  }

  cout << ans << endl;

  return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> V(N);
  for (int i = 0; i < N; i++)
    cin >> V.at(i);
  
  int count = 0;
  for (int j = 0; j < N; j++) {
    for (int k = j + 1; k < N; k++) 
      count += V.at(j)*V.at(k);
  }
  
  cout << count << endl;
    
}


Measured memory_bytes: 3600
import java.util.*;
 
public class Main { 
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int n = sc.nextInt();
		int[] as = new int[n];
		int[] bs = new int[n];
		for(int i=0; i<n; i++){
			as[i] = sc.nextInt();
			bs[i] = sc.nextInt();
		}
		dp(n, h, as, bs);
	}

	public static void dp(int n, int hp, int[] as, int[] bs){
		long[][] dp = new long[n + 1][(int) hp + 1];
		for(long[] tmp: dp){
			Arrays.fill(tmp, 100_000_000);
		}
		for (int i = 1; i < dp.length; i++) {
			for (int j = 1; j < dp[0].length; j++) {
				if (as[i - 1] < j) {
					dp[i][j] = Math.min(dp[i - 1][j], bs[i - 1] + dp[i - 1][j - as[i - 1]]);
					dp[i][j] = Math.min(dp[i][j], bs[i - 1] + dp[i][j - as[i - 1]]);
				} else {
					dp[i][j] = Math.min(bs[i-1], dp[i-1][j]);
				}
			}
		}
		System.out.println(dp[n][hp]);
	}
}


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

int main(){
    int n;
    cin >> n;
    int count =0;
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        while(a%2==0){
            count++;
            a /= 2;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
int main(int argc, char const *argv[]) {
    string s;
    cin >> s;
    int n = s.length();
    vector<int> a(3);
    REP(i,n) a[s[i]-'a']++;
    sort(a.begin(), a.end());
    if (n%3 == 0) {
        if (a[0] == a[2]) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    else if (n%3 == 1) {
        if (a[1]-a[0] == 0 && a[2]-a[0] == 1) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    else {
        if (a[2]-a[1] == 0 && a[1]-a[0] == 1) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 512
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int Mx(int a,int b){return a>b?a:b;}
int Mn(int a,int b){return a<b?a:b;}
const int N=190;
int n,m,sm[N][N],dp[2][N][N][N];
char ch[N][N];
bool chk(int x1,int y1,int x2,int y2)
{
  int s=sm[x2][y2]-sm[x2][y1-1]-sm[x1-1][y2]+sm[x1-1][y1-1];
  return (!s)||s==(x2-x1+1)*(y2-y1+1);
}
int main()
{
  scanf("%d%d",&n,&m);
  for(int i=1;i<=n;i++)
    scanf("%s",ch[i]+1);
  for(int i=1;i<=n;i++)
    for(int j=1;j<=m;j++)sm[i][j]=sm[i][j-1]+(ch[i][j]=='.');
  for(int i=1;i<=n;i++)
    for(int j=1;j<=m;j++)sm[i][j]+=sm[i-1][j];
  for(int i=1;i<=n;i++)
    for(int j1=1;j1<=m;j1++)
      for(int j2=j1;j2<=m;j2++)
	{
	  int l=i,r=n,ans=i-1;
	  while(l<=r)
	    {
	      int mid=l+r>>1;
	      if(chk(i,j1,mid,j2))ans=mid,l=mid+1;
	      else r=mid-1;
	    }
	  dp[0][i][j1][j2]=ans;
	}
  if(dp[0][1][1][m]==n){puts("0");return 0;}
  bool u=1,v=0;
  for(int t=1;t<=16;t++,swap(u,v))
    {
      for(int i=1;i<=n;i++)
	for(int j1=1;j1<=m;j1++)
	  for(int j2=j1;j2<=m;j2++)
	    {
	      int d=dp[v][dp[v][i][j1][j2]+1][j1][j2];
	      if(dp[v][i][j1][j2]==n)
		{ dp[u][i][j1][j2]=n;continue;}
	      int l=j1,r=j2-1;
	      while(l<=r)
		{
		  int mid=l+r>>1;
		  int t1=dp[v][i][j1][mid],t2=dp[v][i][mid+1][j2];
		  d=Mx(d,Mn(t1,t2));
		  if(t1>=t2)l=mid+1; else r=mid-1;
		}
	      dp[u][i][j1][j2]=d;
	    }
      if(dp[u][1][1][m]==n)
	{printf("%d\n",t);return 0;}
    }
}


Measured memory_bytes: 53504
//0035 s it Convex

//http://www5d.biglobe.ne.jp/~tomoya03/shtml/algorithm/Intersection.htm ±±©çl¦qØ

#include<iostream>
using namespace std;

struct Point
{
	double x, y;
	Point(double x,double y):x(x), y(y){}
	Point(){}
};

inline double AngleFromLine(const Point &p1, const Point &p2, const Point &to)
{
	//(x1-x2)*(y-y1)+(y1-y2)*(x1-x)=0@ª¼üÌ®
	return ((p1.x-p2.x)*(to.y-p1.y)+(p1.y-p2.y)*(p1.x-to.x));
}

int main(void)
{
	const int N = 4;
	while(1)
	{
		Point p[N];
		char dummy;
		int i;
		for(i = 0; i < N; i++)
		{
			if(i)
				cin >> dummy;
			cin >> p[i].x >> dummy >> p[i].y;
		}
		if(!cin)
			break;

		double last = 0;	//OñÌü«»èÌÊ@0Í¼üó¾©ç¡ñÌâèÅÍ¶ÝµÈ¢
		double current;
		bool isConvex = true;	//ÊH
		for(i = 0; i < N; i++)
		{
			current = AngleFromLine(p[i], p[(i+1)%N], p[(i+2)%N]);
			//OñÆü«ªá¦ÎAÏÍ}CiXÉÈé
			if(last * current < 0)
			{
				isConvex = false;
				break;
			}
			last = current;
		}

		cout << (isConvex ? "YES": "NO") << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<cstdio>
#include<cstring>
#include<algorithm>
const int maxn=100+3;

inline int getint(){
	bool flag=0;
	register int n=0;
	register char ch=getchar();
	while(ch<'0' || ch>'9'){
		if(ch=='-')flag=1;
		ch=getchar();
	}
	while(ch>='0' && ch<='9'){
		n=ch-'0'+(n<<3)+(n<<1);
		ch=getchar();
	}
	return flag?(-n):n;
}

int n;
int cnt;
bool des[maxn][maxn];

int main(){
#ifdef Ezio
	freopen("input","r",stdin);
#endif

	n=getint();
	if(n&1)
		for(int i=1;i<=(n>>1);i++)
			des[i][n-i]=1,cnt++;
	else
		for(int i=1;i<=(n>>1);i++)
			des[i][n+1-i]=1,cnt++;
	printf("%d\n",n*(n-1)/2-cnt);
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			if(des[i][j]==0)printf("%d %d\n",i,j);
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		int m = Integer.parseInt(sa[1]);
		sa = br.readLine().split(" ");
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sa[i]);
		}
		Obj[] arr = new Obj[m];
		for (int i = 0; i < m; i++) {
			Obj o = new Obj();
			sa = br.readLine().split(" ");
			o.b = Integer.parseInt(sa[0]);
			o.c = Integer.parseInt(sa[1]);
			arr[i] = o;
		}
		br.close();

		Arrays.sort(a);
		Arrays.sort(arr, (o1, o2) -> o2.c - o1.c);
		long ans = 0;
		int j = 0;
		for (int i = 0; i < n; i++) {
			if (j >= m || a[i] >= arr[j].c) {
				ans += a[i];
			} else {
				ans += arr[j].c;
				arr[j].b--;
				if (arr[j].b == 0) {
					j++;
				}
			}
		}
		System.out.println(ans);
	}

	static class Obj {
		int b, c;
	}
}


Measured memory_bytes: 53412
#include<iostream>
#include<cstring>
#include<queue>
#include<map>
#include<vector>
#include<cstring>
using namespace std;
#define fr first
#define sc second
typedef pair<int,int> P;
int main(){
  int a , b ;
  int ROAD_sum[102]={};
  while(cin >> a >> b){
    if(a == 0 && b == 0){
      bool ok = true;
      if( ROAD_sum[1] % 2 == 0 || ROAD_sum[2] %2 == 0){
        ok = false;
      }
      for(int i = 3;i<=101;i++){
        if(ROAD_sum[i] % 2 == 1) ok = false;
      }
      cout << ( ok ? "OK" : "NG" ) << endl;
      memset(ROAD_sum,0,sizeof(ROAD_sum));
    }else ROAD_sum[a]++ , ROAD_sum[b]++;
  }
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
const int N=100005;
int a[N],n;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	int ans=1,k=1;
	for(int i=2;i<=n;i++)
	{
		if(a[i]>a[i-1])
		{
			ans=max(ans,k);
			k=1;
		}
		else
			k++;
	}
	ans=max(ans,k);
	printf("%d\n",ans-1);
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    int w,a,b; cin >> w >> a >> b;
    if (abs(a-b) <= w)
    {
        cout << 0 << endl;
    } else {
        cout << abs(a-b)-w << endl;
    }
    return 0;
}

Measured memory_bytes: 256