akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
  
using namespace std;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
  
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
  
#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

#define INF 1000000000

typedef long double Real;
#define EPS 1e-13
#define EQ(x) (-EPS<x && x<EPS)
typedef complex<Real> P;
Real dot(P a,P b){return real(conj(a)*b);}
Real cross(P a,P b){return imag(conj(a)*b);}

int main(){
  while(true){
    int n;
    cin>>n;
    if(!n)break;
    P ps[n];
    REP(i,n){
      double x,y;
      scanf("%lf,%lf",&x,&y);
      ps[i] = P(x,y);
    }
    int res = 1;
    REP(i,n)REP(j,i){
      P a=ps[i], b=ps[j];
      Real len = abs(b-a);
      if(len>2.0+EPS)continue;
      Real ang_ab = atan2(b.imag()-a.imag(),b.real()-a.real());
      Real ang_x = acos(len/2.0);
      P x = a + exp(P(0,ang_ab+ang_x));
      P y = a + exp(P(0,ang_ab-ang_x));
      if(x.real()<0.0-EPS || x.real()>10.0+EPS || x.imag()<0.0-EPS || x.imag()>10.0+EPS) x=y;
      swap(x,y);
      if(x.real()<0.0-EPS || x.real()>10.0+EPS || x.imag()<0.0-EPS || x.imag()>10.0+EPS) x=y;
      int t = 0;
      REP(k,n){
        if(abs(ps[k]-x)<1.0+EPS)++t;
      }
      res = max(res,t);
      t = 0;
      REP(k,n){
        if(abs(ps[k]-y)<1.0+EPS)++t;
      }
      res = max(res,t);
    }
    cout<<res<<endl;
  }
  return 0;
}

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

int main() {
  int x, a, b;
  cin >> x >> a >> b;
  int dist_a = a - x;
  int dist_b = b - x;
  if (dist_a < 0) {
    dist_a *= -1;
  }
  if (dist_b < 0) {
    dist_b *= -1;
  }
  if(dist_a > dist_b) {
    cout << "B" << endl;
  }
  else {
    cout << "A" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename T>
vector<T> compress(vector<T> v){
  sort(v.begin(),v.end());
  v.erase(unique(v.begin(),v.end()),v.end());
  return v;
}

template<typename T>
map<T, Int> dict(const vector<T> &v){
  map<T, Int> res;
  for(Int i=0;i<(Int)v.size();i++)
    res[v[i]]=i;
  return res;
}

//INSERT ABOVE HERE
signed main(){
  Int n,k;
  cin>>n>>k;
  vector<Int> as(n);
  for(Int i=0;i<n;i++) cin>>as[i];

  Int sum=0;
  for(Int a:as) sum+=a;

  vector<Int> cand;
  for(Int i=1;i*i<=sum;i++){
    if(sum%i) continue;
    cand.emplace_back(i);
    cand.emplace_back(sum/i);
  }

  cand=compress(cand);

  Int ans=0;
  for(Int x:cand){
    vector<Int> neg;
    for(Int a:as){
      if(a%x==0) continue;
      neg.emplace_back(a%x);
    }
    sort(neg.begin(),neg.end());
    Int m=neg.size();
    Int lft=0,rgh=0;
    for(Int i=0;i<m;i++) rgh+=x-neg[i];

    for(Int i=0;i<=m;i++){
      //cout<<x<<" "<<i<<":"<<lft<<" "<<rgh<<endl;
      if(max(lft,rgh)<=k&&abs(lft-rgh)%x==0) chmax(ans,x);
      if(i==m) break;
      lft+=neg[i];
      rgh-=x-neg[i];
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;cin>>n>>m;
  vector<int>c(m);
  for(int i=0;i<m;i++)
    cin>>c[i];
  int dp[n+10010];
  for(int i=0;i<n+10001;i++)
    dp[i]=1000000000;
  for(int i=0;i<m;i++)
    dp[c[i]]=1;

  for(int i=1;i<n;i++){
    for(int j=0;j<m;j++){
      dp[i+c[j]]=min(dp[i+c[j]],dp[i]+1);
    }
  }
  cout<<dp[n]<<endl;
  return 0;
}

Measured memory_bytes: 3304
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int main()
{
  ll t=1;
 // cin>>t;
  while(t--)
  {
    ll n;
    cin>>n;
    string ans;
    string s="ACL";
    for(ll i=0;i<n;i++)
       ans+=s;
    cout<<ans<<endl;
    
  }
 return 0; 
}

Measured memory_bytes: 3624
f=lambda s,h,w,a,q:s[h+1].__setitem__(w+1,s[h+1][w]+s[h][w+1]-s[h][w]+a[h][w]*q);g=lambda s,y1,x1,y2,x2:s[y2][x2]-s[y2][x1-1]-s[y1-1][x2]+s[y1-1][x1-1];H,W,N=map(int,raw_input().split());a=[map(int,raw_input())for _ in[0]*H];s,s1,s2=[[[0]*(W+1)for _ in[0]*-~H]for _ in[0]*3]
for h in range(H):
	for w in range(W):f(s,h,w,a,1);f(s1,h,w,a,w+1<W and a[h][w+1]);f(s2,h,w,a,h+1<H and a[h+1][w])
for _ in[0]*N:y1,x1,y2,x2=map(int,raw_input().split());print g(s,y1,x1,y2,x2)-g(s1,y1,x1,y2,x2-1)-g(s2,y1,x1,y2-1,x2)

Measured memory_bytes: 165020
N = int(input())
S = list(input())

xx = S.count("E")
if S[0] == "E":
	x = xx - 1
else:
	x = xx

ans = x
v = x
for i in range(N - 1):
	if S[i + 1] == "E" and S[i] == "E":
		v -= 1
	elif S[i + 1] == "W" and S[i] == "W":
		v += 1
	else:
		pass

	if v < ans:
		ans = v

print(ans)

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

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

template<class T> bool chmax(T &a, const T &b) { if(a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if(a > b) { a = b; return true; } return false; }

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int A, B; cin >> A >> B;
    cout << (A+B) % 24 << endl;
}

Measured memory_bytes: 3584
#include <iostream>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <limits>

using namespace std;

int main (int argc, char* argv[]) {
	int a, b;
	cin >> a >> b;
	int res = 0;
	int t = 1;
	while (t < b) {
		t--;
		t += a;
		res++;
	}
	cout << res << endl;
}


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

const int MAX_N = 103;

int main()
{
  int n;
  vector<int> arr;

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

  for (int i = 0; i < n; i++)
    cout << arr[i] << (i==n-1?'\n':' ');

  for (int i = 1; i < n; i++) {
    int key = arr[i];
    int j = i - 1;
    while (j >= 0 && arr[j] > key) {
      arr[j+1] = arr[j];
      j--;
    }
    arr[j+1] = key;

    for (int k = 0; k < n; k++)
      cout << arr[k] << (k==n-1?'\n':' ');
  }

  return EXIT_SUCCESS;
}




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

int main()
{
	int n,l;
	cin>>n>>l;
	int i;
    string s[n];   // array of string 
	for(i=0;i<n;i++){
		
      cin>>s[i];	
		
	}
  
	   sort(s,s+n);
	   string f;  
	  for(i=0;i<n;i++){
		
	   f=f+s[i];
		
	  }
	
   cout<<f<<endl;
   return 0;
	
}

Measured memory_bytes: 3680
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

int main() {
    int n;
    int m;
    int l;
 
   cin >> n >> m >> l;
  
   int a = m - n;
   int b = l - m;
  
  if (a == b){
    
    cout << "YES" << endl;
  }else{
   
    cout << "NO" << endl;
  }
     
   
  
  
  return 0;
}

Measured memory_bytes: 256
from collections import deque

N, X = map(int, input().split())
L = list(map(int, input().split()))
d = deque([0])
current = 0
for i in range(N):
    current = current + L[i]
    d.append(current)

lessX = [i for i in d if i <= X]
print(len(lessX))


Measured memory_bytes: 3316
K = int(input())

def gcd(a, b):
    if a == 0 or b == 0:
        return max(a,b)
    x, y = min(a,b), max(a,b)
    return gcd(x,y%x )

ans = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        x = gcd(a,b)
        for c in range(1, K+1):
            ans += gcd(x,c)
print(ans)


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

using namespace std;

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

#define int ll

const ll mod = 1e9 + 7;

bool ans[200001];

main(){
	int x;
	cin >> x;

	for(int i=100;i<106;i++){
		ans[i] = true;
		int t = 0;
		for(int t=0;t<101001;t++){
			if(ans[t]) ans[t+i] = true;
		}
	}

	if(ans[x]){
		cout << 1 << endl;
	}else{
		cout << 0 << endl;
	}

	return 0;
}


Measured memory_bytes: 3684
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;


void solve(){

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

    int m;
    cin >> m;
    cout << 48 - m;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 2000000
#define infly 1<<30
using namespace std;

int a[maxn+5],h;
char s[100];

void maxheapfy(int i)
{
    int l=i*2;
    int r=i*2+1;
    int large;
    if(l<=h && a[l]>a[i])
        large=l;
    else large=i;
    if(r<=h && a[r]>a[large])
        large=r;

    if(large!=i)
    {
         swap(a[i],a[large]);
         maxheapfy(large);
    }

}

void heapinsert(int i,int k)
{
    if(k<a[i]) return;
    a[i]=k;
    while(i>1 && a[i/2]<a[i])
    {
        swap(a[i],a[i/2]);
        i/=2;
    }
}

void insert(int k)
{
    a[++h]=-infly;
    heapinsert(h,k);
}

int extract()
{
    int maxv=a[1];
    swap(a[h],a[1]);
    h--;
    maxheapfy(1);
    return maxv;
}

int main()
{
    int k;
    while(scanf("%s",s) && s[2]!='d')
    {
        if(s[0]=='i')
        {
            scanf("%d",&k);
            insert(k);
        }
        else if(s[0]=='e')
        {
            printf("%d\n",extract());
        }
    }
    return 0;
}

Measured memory_bytes: 7020
#include <stdio.h>
main () {
int i,j,x;
int box[10001];
scanf("%d",&x);
for(i=1;x!=0;i++){
if(x!=0){
  box[i] = x;
  scanf("%d",&x);
}
}
for(j=1;j<i;j++){
  printf("Case %d: %d\n",j,box[j]);
}
return 0;
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    int h,w,k;
    cin >> h>>w>>k;
    ll mod = 1e9+7;
    ll dp[105][10]; //takasa, bou;
    m0(dp);
    dp[0][0]=1;
    
    for(int hh = 0; hh < h; hh++)
    {
        
        for(int bit = 0; bit < (1<<(w-1)); bit++)
        {
            bool bitok = true;
            
            for(int i = 0; i < w-2; i++)
            {
                if(((bit>>i) & (bit>>(i+1)) & 1) ==1)
                {
                    bitok = false;
                    break;
                }
            }
            if(bitok==false) continue;
            
            for(int bou = 0; bou < w; bou++)
            {
                if((bit>>bou) & 1)
                {
                    dp[hh+1][bou]+=dp[hh][bou+1];
                    dp[hh+1][bou+1]+=dp[hh][bou];
                    dp[hh+1][bou]%=mod;
                    dp[hh+1][bou+1]%=mod;
                    bou++;
                }
                else
                {
                    dp[hh+1][bou]+=dp[hh][bou];
                    dp[hh+1][bou]%=mod;
                }

            }
            
        }
        
    }

    if(w>1)
    {
        cout << dp[h][k-1] << endl;
    }
    else
    {
        cout << 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
for i in range(N):
  A[i] = bin(A[i])
max_len = len(A[N-1]) - 2
for i in range(N):
  A[i] = A[i][2:].zfill(max_len)
check = True
for i in range(max_len):
  count0 = 0
  count1 = 0
  for j in range(N):
    if(A[j][i] == '0'):
      count0 += 1
    else:
      count1 += 1
  if(count1 == 0):
    continue
  elif(count1 == count0 * 2):
    continue
  else:
    check = False
    break
if(check):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 14212
#include <bits/stdc++.h>
#define pb push_back
typedef long long ll;
using namespace std;
const int mx = 2e3;
ll dp[mx + 3][mx + 3];
ll mod = 1e9 + 7;
int main() {
	for (int i = 0; i <= mx; ++i)
		dp[i][0] = 1, dp[i][i] = 1;
	for (int i = 1; i <= mx; ++i)
		for (int j = 1; j <= i; ++j)
			dp[i][j] = dp[i - 1][j] + dp[i - 1][j - 1], dp[i][j] %= mod;
	ll s;
	cin >> s;
	ll ans = 0;
    ll here = s / 3;
    for (int i = 0; i < here; ++i){
    	ll temp = s - (i + 1) * 3;
    	ans += dp[temp + i][i];
    	ans %= mod;
    //	cout << ans << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 26244
#include<bits/stdc++.h>
using namespace std;
string s;
vector<long long> a;
typedef long long LL;
LL dfs(int i, LL sum, LL cur) {
    if(i>=a.size()) {
        return sum+cur;
	}
    return dfs(i+1, sum+cur, a[i])+dfs(i+1, sum, cur*10+a[i]);
}
 
int main() {
    ios_base::sync_with_stdio(false);
 
    cin>>s;
    for(int c=0;c<s.size();c++) a.push_back(int(s[c]-'0'));
    LL ans=dfs(1, 0, a[0]);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N = n()
Ws = nl()

res = 10000
for i in range(1, N):
    diff = abs(sum(Ws[:i]) - sum(Ws[i:]))
    res = min(res, diff)

print(res)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define INF 2000000000
typedef long long int ll;
typedef pair<ll,ll> ii;
typedef pair<ii,ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
#define getbit(n,i) (((n)&(1<<(i)))!=0)
#define setbit0(n,i) ((n)&(~(1<<(i))))
#define setbit1(n,i) ((n)|(1<<(i)))
#define togglebit(n,i) ((n)^(1<<(i)))
#define lastone(n) ((n)&(-(n)))
#define read freopen("debug\\in.txt","r",stdin)
#define write freopen("debug\\out.txt","w",stdout)
#define fi first
#define se second
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d%d",&a,&b)
#define PI (acos(-1))
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod (1000000007)
#define asz 500005
#define pb push_back
#define ppf pop_front
#define ppb pop_back
#define pf push_front
map<string,ll>mp;
vector<pair<ll,string> >v; 
set<string>st;  
vector<string>vs;
int main()
{
    fastread;
    ll n,i,j,k,l,m;
    cin>>n;
    for(i=1;i<=n;i++){
    	string s;
    	cin>>s;
    	mp[s]++;
    	st.insert(s);
    	//cout<<mp[s]<<endl;
	}
	set<string>:: iterator it;
	it=st.begin();
    while(it!=st.end()){
    	v.pb({mp[*it],*it});
    	it++;
	}
	sort(v.begin(),v.end());
	ll sz=v.size();
	i=sz-1;
	while(i>=0&&v[i].fi==v[sz-1].fi){	
		vs.pb(v[i].se);
		i--;
	}
	sort(vs.begin(),vs.end());
	ll sz1=vs.size();
	for(i=0;i<sz1;i++)
	cout<<vs[i]<<endl;
    return 0;
}

Measured memory_bytes: 40812
loop{
    a,op,b=gets.chomp.split(" ")
    a=a.to_i
    b=b.to_i
    break if op=='?'
    c=a+b if op=='+'
    c=a-b if op=='-'
    c=a*b if op=='*'
    c=a/b if op=='/'
    puts c
}


Measured memory_bytes: 6872
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pi pair<ll, ll>
#define mp make_pair
#define pb push_back
#define vi vector<ll>
#define pd pair<double, double>
#define vp vector<pi>
#define f(i, n) for(int i = 0; i < n; i++)
#define fo(i, a, n) for(int i = a; i < n; i++)
#define mod (1000*1000*1000+7)
#define sz(x) int((x).size())
#define all(x) x.begin(),x.end()
#define DBG(v) cerr << #v << " = " << (v) << endl;
ll INF = (1ll<<61);

using namespace std;

int main(int argc, char* argv[])
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll a, b, m; cin >> a >> b >> m;
    vi va(a), vb(b);
    f(i, a) cin >> va[i];
    f(i, b) cin >> vb[i];
    ll ans = INF;
    f(i, m){
      ll x, y, c; cin >> x >> y >> c;
      ans = min(ans, va[x-1] + vb[y-1] - c);
    }
    sort(all(va)); sort(all(vb));
    ans = min(ans, va[0] + vb[0]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int n;cin>>n;
  int t[n],a[n];
  for(int i=0;i<n;i++) cin>>t[i];
  for(int i=0;i<n;i++) cin>>a[i];
  vector<int>v(n);
  for(int i=0;i<n;i++) v[i]=0;
  v[0]=t[0];
  for(int i=1;i<n;i++){
    if(t[i]!=t[i-1]) v[i]=t[i];
  }
  if(v[n-1]!=a[n-1]&&v[n-1]>0){
    cout<<0<<endl;
    return 0;
  }
  else v[n-1]=a[n-1];
  for(int i=n-2;i>=0;i=i-1){
    if(a[i]!=a[i+1]){
      if(v[i]!=a[i]&&v[i]>0){
        cout<<0<<endl;
        return 0;
      }
      else v[i]=a[i];
    }
  }
  for(int i=0;i<n;i++){
    if(v[i]>t[i]||v[i]>a[i]){
      cout<<0<<endl;
      return 0;
    }
  }
  ll sum=1;
  for(int i=0;i<n;i++){
    if(v[i]==0){
      sum*=min(t[i],a[i]);
      sum%=1000000007;
    }
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 1408
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = getcha() - '0';
	while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint();

	int V1[100001] = {}, V2[100001] = {};
	rep(i, N / 2) {
		V1[getint()]++;
		V2[getint()]++;
	}
	int k11 = 0, k12 = 0, k21 = 0, k22 = 0;
	int m11 = 0, m12 = 0, m21 = 0, m22 = 0;
	rep1(i, 100000) {
		if (V1[i] > m12) {
			m12 = V1[i];
			k12 = i;
			if (m11 < m12) {
				swap(m11, m12);
				swap(k11, k12);
			}
		}
		if (V2[i] > m22) {
			m22 = V2[i];
			k22 = i;
			if (m21 < m22) {
				swap(m21, m22);
				swap(k21, k22);
			}
		}
	}

	if (k11 != k21) printf("%d", N - m11 - m21);
	else printf("%d", N - max(m11 + m22, m12 + m21));

	Would you please return 0;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int sum = 0;
        int num2[] = new int[num];
        for(int h=0;h<num;h++)
        {
            num2[h]=sc.nextInt();
        }
        for(int i=0;i<num-1;i++)
        {
            for(int j=i+1;j<num;j++)
            {
                sum = sum + num2[i] * num2[j];
            }
        }
        System.out.println(sum);
            
    }
}

Measured memory_bytes: 23636
#include  <functional>
#include  <algorithm>
#include  <exception>
#include  <stdexcept>
#include  <streambuf>
#include  <iterator>
#include  <string.h>
#include  <stdlib.h>
#include  <typeinfo>
#include  <valarray>
#include  <iostream>
#include  <sstream>
#include  <istream>
#include  <stdio.h>
#include  <climits>
#include  <clocale>
#include  <complex>
#include  <csetjmp>
#include  <csignal>
#include  <cstdarg>
#include  <cstddef>
#include  <ctype.h>
#include  <cassert>
#include  <cstdlib>
#include  <utility>
#include  <cstring>
#include  <numeric>
#include  <ostream>
#include  <cwctype>
#include  <fstream>
#include  <iomanip>
#include  <math.h>
#include  <bitset>
#include  <cctype>
#include  <string>
#include  <vector>
#include  <limits>
#include  <locale>
#include  <memory>
#include  <cerrno>
#include  <time.h>
#include  <iosfwd>
#include  <cfloat>
#include  <cstdio>
#include  <cwchar>
#include  <cmath>
#include  <ctime>
#include  <deque>
#include  <queue>
#include  <stack>
#include  <ios>
#include  <map>
#include  <set>
#include  <new>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
using namespace std;
const int maxn=300005;
int n,a[maxn];
int sum1[maxn],sum2[maxn];
int ans[maxn];
void upday(int val,int pos)
{
    if(val>sum1[pos])
    {
        sum2[pos]=sum1[pos];
        sum1[pos]=val;
    }
    else
    {
        if(val>sum2[pos])
        {
            sum2[pos]=val;
        }
    }
}
int main()
{
    cin>>n;
    for(int i=0;i<(1<<n);i++)
    {
        cin>>a[i];
        sum1[i]=a[i];
    }
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<(1<<n);j++)
        {
            int t=1<<i;
            if(!(j&t))
            {
                int nowp=(j|t);
                int old=sum1[j];
                upday(old,nowp);
                old=sum2[j];
                upday(old,nowp);
            }
        }
    }
    for(int i=0;i<(1<<n);i++)
    {
        if(i!=0)
        ans[i]=max(ans[i-1],sum1[i]+sum2[i]);
        else
        ans[i]=sum1[i]+sum2[i];
    }
    for(int i=1;i<(1<<n);i++)
    {
        cout<<ans[i]<<endl;
    }
    return 0;
}


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

int main(){
    int N, A[200000], B[200000];
	cin >> N;
	for(int i=0; i<N; i++) cin >> A[i] >> B[i];
	int64_t S = accumulate(A, A+N, 0LL);

	const int INF = 2e9;
	int mn = INF;
	for(int i=0; i<N; i++) if(A[i] > B[i]) mn = min(mn, B[i]);

	int64_t ans = (mn == INF ? 0 : S - mn);
	cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;

int main() {
	int  d,t,s;
	cin >> d>>t>>s;

	if (d <= t*s) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}


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

int main(){
    int n; cin >> n;
    string s; cin >> s;
    int count=0;
    if(n%2==1){
      cout << "No" << endl;
    }
    else{
      rep(i,(n/2)){
          if(s.at(i)==s.at(i+(n/2))){
              count++;
          }
      }
      if(count==n/2){
    	  cout << "Yes" << endl;
      }
      else{
    	  cout << "No"  << endl;
      }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>//toINFandByd
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define endl "\n"
using namespace std;
typedef long long ll;

void solve(){
    int x1 = 1,x2 = 2,x3 = 3,x4 = 4,x5 = 5;
    cin >> x1 >> x2 >> x3 >> x4 >> x5;
    if(x1==0){
        cout << 1 << endl;
    }
    else if(x2==0){
        cout << 2 << endl;
    }
    else if(x3==0){
        cout << 3 << endl;
    }
    else if(x4==0){
        cout << 4 << endl;
    }
    else{
        cout << 5 << endl;
    }
}   

int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
    //     freopen("output.txt","w",stdout);
    #endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 3640
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define MP make_pair
#define PB push_back
#define ff first
#define ss second
#define TR(it,c) for( typeof(c.begin()) it = c.begin(); it != c.end(); ++it )
#define TRR(it,c) for( typeof(c.rbegin()) it = c.rbegin(); it != c.rend(); ++it
#define REP(i,a) for (int i = 0; i < (a); i++)
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORD(i,a,b) for (int i = (a); i >= (b); i--)

#define DRI(a) int a; scanf("%d", &a);
#define DRII(a, b) int a, b; scanf("%d %d", &a, &b);
#define DRIII(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c);
#define RI(a) scanf("%d", &a);
#define RII(a, b) scanf("%d %d", &a, &b);
#define RIII(a, b, c) scanf("%d %d %d", &a, &b, &c);
#define MM(arr, num) memset((arr), (num), sizeof((arr)))
#define DEB(x) cerr << ">>> " << (#x) << " -> " << (x) << endl;
#define DEBA(x,n) cerr << (#x) << " "; deba((x),(n));
void deba(int * a, int n){ cerr << "| "; REP(i,n) cerr << a[i] << " "; cerr << "|" << endl;}


inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }

const int INF = 1<<30;
typedef long long ll;
typedef unsigned long long ull;
/*******************************************************/


int main() {

  DRI(n);
  ll a = 0, b=0;
  REP(i,n){
    DRII(x,y);
    if(a==0){
      a = x;
      b = y;
    }
    else if( x < y){
        int m = a%x;
        if(m){
          a+= x-m;
        }
        ll sb = (a/x)*(ll)y;
        if(sb < b){
          int m2 = b%y;
          if(m2){
            b+= y-m2;
          }
          a = (b/y)*(ll)x;
        }
        else b = sb;
    }
    else{

       int m = b%y;
        if(m){
          b+= y-m;
        }
        ll sa = (b/y)*(ll)x;
        if(sa < a){
          int m2 = a%x;
          if(m2){
            a+= x-m2;
          }
          b = (a/x)*(ll)y;
        }
        else a = sa;



    }


    //cout << a << " " << b << endl;
  }

  cout << a+b << endl;


  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
//#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PI;
typedef pair< PI, int> PII;
#define pb push_back
#define Key_value ch[ch[root][1]][0]
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define MS(x,y) memset(x,y,sizeof(x))
const double eps = 1e-6;
const double pi = acos (-1.0);
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int M = 300005;

int main()
{
    int n, m;
    cin >> n >> m;
    if(abs(n - m) >= 2)
    {
        cout << "0" << endl;
        return 0;
    }
    if(n == m)
    {
        LL ans = 1;
        LL ans2 = 1;
        for(int i = 1; i <= n; ++i)
        {
            ans *= i;
            ans %= mod;
        }
        for(int i = 1; i <= n; ++i)
        {
            ans2 *= i;
            ans2 %= mod;
        }
        ans *= ans2;
        ans %= mod;
        ans *= 2;
        ans %= mod;
        cout << ans << endl;
    }
    else
    {
        LL ans = 1;
        LL ans2 = 1;
        for(int i = 1; i <= n; ++i)
        {
            ans *= i;
            ans %= mod;
        }
        for(int i = 1; i <= m; ++i)
        {
            ans2 *= i;
            ans2 %= mod;
        }
        ans *= ans2;
        ans %= mod;
        cout << ans << endl;
    }
    
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  sort(a.begin(), a.end(), greater<int>());
  int sum_a = 0;
  int sum_b = 0;
  for (int i = 0; i < n; i += 2) {
    sum_a += a.at(i);
  }
  for (int i = 1; i < n; i += 2) {
    sum_b += a.at(i);
  }
  cout << abs(sum_a - sum_b) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <queue>
#include <queue>
#include <stack> 
#include <sstream>
#include <set>

typedef  long long ll;
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = { 0, 1, 0,-1};
const int INF = 1e9;
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
int guki (int a){
    if(a%2==0) return 0;
    else return 1;
}
int gcd(int a, int b){
    if(a%b==0){
        return b;
    }else{
        return (gcd(b,a%b));
    }
}
int lcm(int a, int b){
    int x = gcd(a,b);
    return (a*b/x);
}

using namespace std;
ll k (ll a){
    a--;
    ll ans =0;
    while(a != 0){
        ans += a;
        a--;
        
    }
    return ans;
}


int main(){
    int a;
    string s;
    cin >> a >> s;

    string x="",y="";
    REP(i,a/2 ){
        x += s[i];
    }
    FOR(i,a/2,s.size()){
        y += s[i];
    }

    if(x == y){
        cout << "Yes" << endl;
    }else{
        cout << "No" <<endl;
    }
    
}



Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
double n,m,k;
double p,b;
void saiki(int d,int v){
  if(d==n) {
    if(v>k)
      p+=v-k;
    else
      p++;
  }
  else{
    for(int i=1;i<=m;i++){
      saiki(d+1,v+i);
    }
  }
}
int main(){
  
  int i,j;
  cin >> n >> m >> k;
  while(n!=0){
    p=0;
    b=1;
    for(i=0;i<n;i++) b*=m;
    //cout << b << endl;
    saiki(0,0);
    //cout << p/b << endl;
    printf("%.8f\n",p/b);
    cin >> n >> m >> k;
  }


  return 0;
}

Measured memory_bytes: 1236
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-7;
const int inf=1e8;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
	int a,b;
	cin>>a>>b;
	if(a>b)swap(a,b);
	double t;
	if(abs(b-a)<180){
		t=a+(b-a)/2.;
	}else{
		t=a-(360-b+a)/2.;
	}
	if(t<0)t+=360;
	cout<<t<<endl;
}

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

int main() {
 vector<int> vec(10001);
for(int i=1;i<101;i++){
  for(int j=1;j<101;j++){
    for(int k=1;k<101;k++){
      if(i*i+j*j+k*k+i*j+j*k+k*i<=10000){vec.at(i*i+j*j+k*k+i*j+j*k+k*i)++;}
    }
  }
}
  
int n;
  cin>>n;
  for(int i=1;i<=n;i++){cout<<vec.at(i)<<endl;}
}

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

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

int getChar(char ch) {
	if (ch == 'A') return 1;
	else if (ch == 'C') return 2;
	else if (ch == 'G') return 3;
	else if (ch == 'T') return 4;
	else return 0;
}

long long getKey(char str[]) {
	long long sum = 0, p = 1;
	for (int i = 0; i < strlen(str); i++) {
		sum += p * (getChar(str[i]));
		p *= 5;
	}
	return sum;
}

int h1(int key) { return key % M; }
int h2(int key) { return 1 + (key % (M - 1)); }

int find(char str[]) {
	long long key, h;
	key = getKey(str);
	for (int i = 0;;i++) {
		h = (h1(key) + i * h2(key)) % M;
		if (strcmp(H[h], str) == 0) return 1;
		else if(strlen(H[h]) == 0) return 0;
	}
}

int insert(char str[]) {
	long long key, h;
	key = getKey(str);
	for (int i = 0;; i++) {
		h = (h1(key) + i * h2(key)) % M;
		if (strcmp(H[h], str) == 0) return 0;
		else if (strlen(H[h]) == 0) {
			strcpy(H[h], str);
			return 0;
		}
	}
	return 0;
}

int main() {
	int i, n, h;
	char str[L], com[9];
	for (int i = 0; i < M;i++) H[i][0] = '\0';
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%s %s", com, str);
		if (com[0] == 'i') {
			insert(str);
		}
		else {
			if (find(str)) {
				printf("yes\n");
			}
			else {
				printf("no\n");
			}
		}
	}
}



Measured memory_bytes: 17076
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
const long double PI=3.14159265358979323846264338327950;
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n,q;
  cin>>n>>q;
  vector<queue<long long> > vq(n);
  rep(i,q){
    int tmp,t,x;
    cin>>tmp;
    if(tmp==0){
      cin>>t>>x;
      vq[t].push(x);
    }
    else if(tmp==1){
      cin>>t;
      if(vq[t].empty()){
        continue;
      }
      cout<<vq[t].front()<<'\n';
    }
    else{
      cin>>t;
      if(vq[t].empty()){
        continue;
      }
      vq[t].pop();
    }
  }

  return(0);
}


Measured memory_bytes: 4976
# One-stroke Path
import itertools
n, m = map(int, input().split())
ab = {}
for i in range(n+1):
    ab[i] = []
for i in range(m):
    a, b = map(int, input().split())
    ab[a].append(b)
    ab[b].append(a)

count = 0

for values in list(itertools.permutations(range(2, n+1))):
    pre = 1
    for i, v in enumerate(values):
        if(v not in ab[pre]):
            break
        if i == n-2:
            count += 1
        pre = v
print(count)

Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <utility>
#include <cstring>

using namespace std;
typedef pair<int, int> pii;

pii dp[32][32][32][32];
int integral[33][33];

int partial_sum(int x1, int y1, int x2, int y2){
	int result = integral[y2 + 1][x2 + 1];
	result -= integral[y2 + 1][x1];
	result -= integral[y1][x2 + 1];
	result += integral[y1][x1];
	return result;
}

pii recur(int x1, int y1, int x2, int y2, int r){
	if(dp[x1][y1][x2][y2].first >= 0){ return dp[x1][y1][x2][y2]; }
	pii result = pii(1, partial_sum(x1, y1, x2, y2));
	for(int i = x1; i < x2; ++i){
		if(partial_sum(x1, y1, i, y2) < r){ continue; }
		if(partial_sum(i + 1, y1, x2, y2) < r){ continue; }
		pii a = recur(x1, y1, i, y2, r), b = recur(i + 1, y1, x2, y2, r);
		result = max(result, pii(a.first + b.first, min(a.second, b.second)));
	}
	for(int i = y1; i < y2; ++i){
		if(partial_sum(x1, y1, x2, i) < r){ continue; }
		if(partial_sum(x1, i + 1, x2, y2) < r){ continue; }
		pii a = recur(x1, y1, x2, i, r), b = recur(x1, i + 1, x2, y2, r);
		result = max(result, pii(a.first + b.first, min(a.second, b.second)));
	}
	dp[x1][y1][x2][y2] = result;
	return result;
}

int main(){
	while(true){
		int h, w, s;
		cin >> h >> w >> s;
		if(h == 0 && w == 0 && s == 0){ break; }
		vector< vector<int> > u(h, vector<int>(w));
		int total = 0;
		for(int i = 0; i < h; ++i){
			for(int j = 0; j < w; ++j){
				cin >> u[i][j];
				total += u[i][j];
			}
		}
		memset(integral, 0, sizeof(integral));
		for(int i = 0; i < h; ++i){
			for(int j = 0, sum = 0; j < w; ++j){
				sum += u[i][j];
				integral[i + 1][j + 1] = integral[i][j + 1] + sum;
			}
		}
		memset(dp, -1, sizeof(dp));
		pii result = recur(0, 0, w - 1, h - 1, total - s);
		cout << result.first << " " << (s - (total - result.second)) << endl;
	}
	return 0;
}

Measured memory_bytes: 9120
#include <stdio.h>
#include <math.h>

using namespace std;

int main(){
	double x1,x2,x3,y1,y2,y3,xp,yp;
	double calc1,calc2,calc3;

	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)!=EOF){
		calc1 = (x2-x1)*(yp-y1)-(y2-y1)*(xp-x1);
		calc2 = (x3-x2)*(yp-y2)-(y3-y2)*(xp-x2);
		calc3 = (x1-x3)*(yp-y3)-(y1-y3)*(xp-x3);

		if((calc1>0&&calc2>0&&calc3>0) || (calc1<0&&calc2<0&&calc3<0)){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
    return 0;
}



Measured memory_bytes: 2584
import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for(int i = 0; i < n; i++) {
			boolean[][] map = new boolean[10][10];
			for(int j = 0; j < 10; j++) {
				for(int k = 0; k < 10; k++) {
					map[j][k] = (sc.nextInt() == 1)?true:false;
				}
			}
			
			for(int j = 0; j < 1 << 10; j++) {
				boolean[][] cpMap = new boolean[10][10];
				boolean[][] faMap = new boolean[10][10];
				for(int k = 0; k < 10; k++) {
					cpMap[k] = Arrays.copyOf(map[k], 10);
				}
				for(int k = 0; k < 10; k++) {
					if((j & 1 << k) != 0) {
						faMap[0][k] = true;
						fa(cpMap,0,k);
					}
				}
				for(int k = 1; k < 10; k++) {
					for(int l = 0; l < 10; l++) {
						if(cpMap[k-1][l]) {
							fa(cpMap,k,l);
							faMap[k][l] = true;
						}
					}
				}
				if(check(cpMap)) {
					show(faMap);
					break;
				}
			}
		}
	}
	public static void show(boolean[][] a) {
		for(int i = 0; i < 10; i++) {
			if(a[i][0]) {
				System.out.print(1);
			}
			else {
				System.out.print(0);
			}
			for(int j = 1; j < 10; j++) {
				if(a[i][j]) {
					System.out.print(" " + 1);
				}
				else {
					System.out.print(" " + 0);
				}
			}
			System.out.println();
		}
	}
	
	public static boolean check(boolean[][] a) {
		for(int i = 0; i < 10; i++) {
			for(int j = 0; j < 10; j++) {
				if(a[i][j]) return false;
			}
		}
		return true;
	}
	
	public static void fa(boolean[][] a, int b, int c) {
		a[b][c] = (a[b][c])?false:true;
		for(int i = 0; i < 4; i++) {
			if(fb(b + vy[i],c + vx[i])) {
				a[b + vy[i]][c + vx[i]] = (a[b + vy[i]][c + vx[i]])?false:true;
			}
		}
	}
	
	public static boolean fb(int b, int c) {
		if(b < 0 || c < 0 || b >= 10 || c >= 10) return false;
		return true;
	}
	
	static int[] vx = new int[] {1,0,-1,0};
	static int[] vy = new int[] {0,1,0,-1};
}

Measured memory_bytes: 34440
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
S = str(input())
a = int(S[0])
b = int(S[1])
c = int(S[2])
d = int(S[3])

for i in range(2) :
  for j in range(2) :
    for k in range(2) :
      sum = a
      ans = str(a)
      if i == 0 :
        sum += b
        ans += "+" + str(b)
      else :
        sum -= b
        ans += "-" + str(b)
      if j == 0 :
        sum += c
        ans += "+" + str(c)
      else :
        sum -= c
        ans += "-" + str(c)
      if k == 0 :
        sum += d
        ans += "+" + str(d)
      else :
        sum -= d
        ans += "-" + str(d)
        
      if sum == 7 :
        print(ans+"=7")
        exit()


Measured memory_bytes: 38384
#include <cstdio>
#include <algorithm>
using namespace std;
int N,L[2000],ans;
int main() {
    scanf("%d",&N); for (int i = 0;i < N;i++) scanf("%d",&L[i]); sort(L,L+N);
    for (int i = 0;i < N;i++) for (int j = i+1;j < N;j++) {
        int k = lower_bound(L,L+N,L[i]+L[j])-L; ans+=k-j-1;
    }
    printf("%d\n",ans);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int MAXN=100000;
int main(){
	int n,k,s,a[MAXN];
	cin>>n>>k>>s;
	for(int i=1;i<=k;i++){
		cout<<s<<" ";
	}
	if(n-k<s){
		for(int i=1;i<=n-k;i++){
			cout<<1<<" ";
		}	
	}
	else{
		for(int i=1;i<=n-k;i++){
			cout<<s+1<<" ";
		}
	}	
}

Measured memory_bytes: 1280
"use strict";
function I(s,f){this._s=s.split("\n");this._c=0;this._l=0;this._f=f||Number}I.prototype.a=function(){var l=this._s[this._l];if(!l)return;var t=l.trim().split(" ");var a=t[this._c];this._c++;if(t.length===this._c){this._c=0;this._l++}return this._f(a)};I.prototype.l=function(){var l=this._s[this._l];if(!l)return;this._c=0;this._l++;return l.split(" ").map(this._f)};module.exports=I;

function main(input) {
  const o = new I(input, String);

  const N = Number(o.a());
  const BTC = 380000.0;

  let x = [];
  let u = [];

  let sum = 0;
  for (let i = 0; i < N; i++) {
    let x = Number(o.a());
    let u = o.a();

    if (u === "JPY") {
      sum += x;
    } else {
      sum += BTC * x;
    }
  }

  console.log(sum)
}


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


Measured memory_bytes: 21192
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
using namespace std;
int main() {
	string s, a;
	cin >> s;
	a = "";
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '0')a += '0';
		else if (s[i] == '1')a += '1';
		else if (a != "")a.pop_back();
	}
	cout << a << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define debug cerr << "-- " << __LINE__ << " --" << endl
#define MOD 1000000007
typedef long long int ll;

using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
template <typename T> string to_string(const vector<T> &xs) {string s="["; for(int i=0;i<xs.size();i++) s += (i>0 ? " " : "") + to_string(xs[i]); return s + "]";}



ll extgcd(ll a, ll b, ll &x, ll &y) {
  ll g = a; x = 1; y = 0;
  if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
  return g;
}
ll gcd(ll a, ll b) { ll x, y; return extgcd(a, b, x, y);}

class llm{
	ll n;
public:
	llm(){n = 0;}
	llm(ll n){this->n = (n >= 0) ? (n % MOD) : (MOD - 1 - (-n-1 % MOD));}
	operator ll() const {return n;}
	llm operator+(const llm &y) const{ return llm((ll)*this + (ll)y);}
	llm operator+=(const llm &y) { *this = *this + y; return *this;}
	llm operator-(const llm &y) const{ return llm((ll)*this - (ll)y);}
	llm operator-=(const llm &y) { *this = *this - y; return *this;}
	llm operator-() const{ return llm(0) - *this;}
	llm operator*(const llm &y) const{ return llm((ll)*this * (ll)y);}
	llm operator*=(const llm &y) { *this = *this * y; return *this;}
	llm operator/(const llm &y) const{ return *this * y.inv();}
	llm operator/=(const llm &y) { *this = *this / y; return *this;}
	llm inv() const{
		ll x, y;
		if (extgcd(n, MOD, x, y) == 1) return llm(x);
  		return llm(0); // unsolvable
	}
	friend istream& operator >> (istream& os, llm& x);
	friend ostream& operator << (ostream& os, const llm& x);
};
istream& operator >> (istream& is, llm& x){ll n; is >> n; x = llm(n); return is;}
ostream& operator << (ostream& os, const llm& x){os << (ll)x; return os;}

template<typename T> T comb(ll n, ll k){
	T ret = 1;
	for(ll i=1;i<=k;i++) ret = ret * T(n - k + i) / T(i);
	return ret;
}



int n;
int x[8], y[8];


int main(void){
	cin >> n;
	for(int i=0;i<n;i++) cin >> x[i] >> y[i];
	double ans = 0;
	for(int i=0;i<n;i++)for(int j=0;j<i;j++) ans += sqrt((x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]));
	ans *= 2.0 / n;
	
	printf("%.8f\n", ans);

    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

typedef long long ll;

int dif[30];

int main()
{
	std::ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    for(int i=0;i<s.size();i++)
    	dif[s[i]-'a']++;
    for(int i=0;i<30;i++){
    	if(dif[i]>1){
    		cout << "no\n";
    		return 0;
		}
	}
	cout << "yes\n";
    
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>

using namespace std;

int main(){
    int n,c=0;
    string s;
    cin>>n>>s;
    if (n%2==0) {
        for (int i=0; i<n/2; i++) {
            if (s.at(i)==s.at(n/2 + i)){
                c++;
            }
        }
        cout<<((c==s.size()/2) ? "Yes":"No")<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as BS
import qualified Data.Maybe as MA
import qualified Data.List as L

main = do
    [n, k] <- fmap (fst . MA.fromJust . BS.readInt) . BS.words <$> BS.getLine
    putStrLn . show . length . L.takeWhile (/= 0) $ iterate (`div` k) n


Measured memory_bytes: 380
import math
import sys 
s = input()
if s==s[::-1]:
    n = len(s)
    right = int((n-1)/2)
    tmp = s[:right]
    if tmp == tmp[::-1]:
        left = int((n+3)/2)
        tmp2 = s[left-1:]
        if tmp2 == tmp2[::-1]:
            print('Yes')
            sys.exit()
print('No')


Measured memory_bytes: 3060
#include <bits/stdc++.h>
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;

namespace Math {
// Generic modular integer.
    template<int MOD, typename IntType = int>
    struct GModint {
        IntType val;

        GModint() : val(0) {}

        GModint(int v, bool safe = false) { val = safe ? v : ((v % MOD) + MOD) % MOD; }

        GModint(ll v, bool safe = false) { val = safe ? v : ((v % MOD) + MOD) % MOD; }

        explicit operator bool() const { return val != 0; }

        const bool operator==(const GModint &g) const { return val == g.val; }

        const bool operator!=(const GModint &g) const { return val != g.val; }

        const GModint operator+=(const GModint &g) { return *this = *this + g; }

        const GModint operator-=(const GModint &g) { return *this = *this - g; }

        const GModint operator*=(const GModint &g) { return *this = *this * g; }

        const GModint operator/=(const GModint &g) { return *this = *this / g; }

        const GModint operator^=(const GModint &g) { return *this = *this ^ g; }

        const GModint operator-() const { return GModint(val == 0 ? 0 : MOD - val, true); }

        const GModint operator+(const GModint &g) const {
            ll newval = val + g.val;
            if (newval >= MOD)
                newval -= MOD;
            return GModint(newval, true);
        }

        const GModint operator-(const GModint &g) const { return *this + (-g); }

        const GModint operator*(const GModint &g) const { return GModint(1ll * val * g.val); }

        const GModint operator/(const GModint &g) const { return *this * g.inv(); }

        template<class T>
        const GModint operator^(const T t) const { return GModint(modpow(val, t, MOD)); }

        const GModint inv() const { return GModint(modinv(val, MOD)); }
    };

    using Modint = GModint<1000000007>;
}

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

    int n; cin >> n;
    vector<int> x(n);
    int mincost = 0x3f3f3f3f;
    for (int i = 0; i < n; i++) cin >> x[i];
    for (int i = 0; i <= 100; i++) {
        int cost = 0;
        for (int j = 0; j < n; j++) cost += (x[j] - i) * (x[j] - i);
        mincost = min(cost, mincost);
    }
    cout << mincost << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
n, k = map(int, input().split())
li = [0] * n
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for x in a:
        li[x - 1] += 1
ans = sum(x == 0 for x in li)
print(ans)


Measured memory_bytes: 9204
#include <stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;

int main() {
  long long n, k;
  long long ans;
  scanf("%lld %lld", &n, &k);
  // if (n >= k) {
  //   if (n%k == 0) {
  //     min = 0;
  //   } else {
    long long t = n % k;
    ans = min(t, k-t);
      // ans = - (n % k - k) >= n % k ? n % k : - (n % k -k); 
  //   }
  // } else {
  //     min = - (n - k) >= n ? n : - (n - k); 
  // }
  printf("%lld\n", ans);
  return 0;
}

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

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	int N, M, C;
	cin >> N >> M >> C;

	vector <int> B(M);
	for (int ii = 0; ii < M; ++ii){
		cin >> B[ii];
	}

	int ans = 0;
	for (int ii = 0; ii < N; ++ii){
		int val = 0;
		for (int jj = 0; jj < M; ++jj){
			int A;
			cin >> A;
			val += A*B[jj];
		}
		if (val > -C){
			ans++;
		}
	}


	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 3584