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

// Optimization

// #pragma GCC optimize("unroll-loops")
// #pragma GCC optimize("O3")
#define endl '\n'

// Shortcut

#define int long long
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define mp make_pair
#define upb upper_bound
#define lwb lower_bound
#define fi first
#define se second
#define For(i, l, r) for (int i = l; i < r; i++)
#define ForE(i, l, r) for (int i = l; i <= r; i++)
#define Ford(i, r, l) for (int i = r; i > l; i--)
#define FordE(i, r, l) for (int i = r; i >= l; i--)
#define Fora(i, a) for (auto i : a)

// I/O & Debug

#define PrintV(a) Fora(iiii, a) cout << iiii << ' '; cout << endl;
#define PrintVl(a) Fora(iiii, a) cout << iiii << endl;
#define PrintA(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << ' '; cout << endl;
#define PrintAl(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << endl;
#define Ptest(x) return cout << x, 0;
#define gl(s) getline(cin, s);
#define setpre(x) fixed << setprecision(x)
/*
#define debug(args...){ string _sDEB = #args; replace(_sDEB.begin(), _sDEB.end(), ',', ' '); stringstream _ssDEB(_sDEB); istream_iterator<string> _itDEB(_ssDEB); DEB(_itDEB, args); }
void DEB(istream_iterator<string> it) {}
template<typename T, typename... Args>
void DEB(istream_iterator<string> it, T a, Args... args){
    cout << *it << " = " << a << endl;
    DEB(++it, args...);
}
*/

// Functions

//#define isvowel(a) (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define bend(a) a.begin(), a.end()
#define rbend(a) a.rbegin(), a.rend()
#define mset(a) memset(a, 0, sizeof(a))
#define mset1(a) memset(a, 1, sizeof(a))
#define msetn1(a) memset(a, -1, sizeof(a))
#define msetinf(a) memset(a, 0x3f, sizeof(a))
#define gcd __gcd
#define __builtin_popcount __builtin_popcountll
//mt19937 rando(chrono::steady_clock::now().time_since_epoch().count());

// Data Structure

#define pque priority_queue
#define mts multiset
#define y0 _y0_
#define y1 _y1_
#define div divi
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <ld> vld;
typedef vector <string> vs;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <vi > vvi;
typedef vector <vll > vvll;
typedef vector <pii > vpii;
typedef vector <pll > vpll;

const int N = 2e5 + 5, mod = 1e9 + 7, mod1 = 998244353, mod2 = 1e9 + 9, inf = 1e9 + 7;
const ll infll = 1e18 + 7;

int n, m, k;
int ans, cnt, tmp, idx, sum, mx = -infll, mn = infll;
int x, y, z;
string s, t;
int a[N], b[N];

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n;
    ForE(i, 1, n){
        if (i % 3 != 0 && i % 5 != 0) ans += i;
    }
    cout << ans;
}

/*
==================================+
INPUT:                            |
------------------------------    |

------------------------------    |
==================================+
OUTPUT:                           |
------------------------------    |

------------------------------    |
==================================+
*/

Measured memory_bytes: 3672
//According to all known laws of aviation, there is no way that a bee should be able to fly.
//Its wings are too small to get its fat little body off the ground. The bee, of course, flies anyway.
//Because bees don't care what humans think is impossible.
#include <bits/stdc++.h>
#define FAST_IO  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define endl "\n"
 
using namespace std ;
using bigint = long long int ;
using vi = vector<int> ;
using vll = vector<long long int> ;

int main(){
    FAST_IO ;
    bigint X ; cin >> X ;
    bigint A = 0 , B = 0 ;
    for( bigint i = -150 ; i <= 150 ; i++ ){
        for( bigint j = -150 ; j <= 150 ; j++ ){
            A = i * i * i * i * i ; B = j * j * j * j * j ;
            if( A - B == X ){
                cout << i << " " << j << endl ;
                return 0 ;
            }
        }
    }
    return 0 ;
}


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

int main() {

  long long N,K;
  cin >> N >> K;

  vector<pair<int,int>> vec(N);
  for(int i = 0;i < N;i++) {
    int a,b;
    cin >> a >> b;
    vec.at(i) = make_pair(a,b);
  }

  sort(vec.begin(),vec.end());

  // for(int i = 0;i < N;i++) {
  //   cout << vec.at(i).first << " " << vec.at(i).second << endl;
  // }

  for(int i = 0;i < N;i++) {
    K -= vec.at(i).second;
    if(K <= 0) {
      cout << vec.at(i).first << endl;
      break;
    }
  }
  
}

Measured memory_bytes: 1024
#include <stdio.h>

#define swap(a, b) {int tmp = a; a = b; b = tmp;}

int main(void)
{
	int w[10];
	int k[10];
	int sum[2];
	int i, j;
	
	for (i = 0; i < 10; i++){
		scanf("%d", w + i);
	}
	for (i = 0; i < 9; i++){
		for (j = 0; j < 9 - i; j++){
			if (w[j] < w[j + 1]){
				swap(w[j], w[j + 1]);
			}
		}
	}
	sum[0] = w[0] + w[1] + w[2];
	
	for (i = 0; i < 10; i++){
		scanf("%d", k + i);
	}
	for (i = 0; i < 9; i++){
		for (j = 0; j < 9 - i; j++){
			if (k[j] < k[j + 1]){
				swap(k[j], k[j + 1]);
			}
		}
	}
	sum[1] = k[0] + k[1] + k[2];
	
	printf("%d %d\n", sum[0], sum[1]);
	
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N, K; cin >> N >> K; 
	int P[200010] = {}; 
	int S[200010] = {}; 
	for(int i = 1; i <= N; i++){
		cin >> P[i]; S[i] = S[i-1] + P[i]; 
	}
	int mx = 0; 
	for(int i = K; i <= N; i++){
		mx = max(mx, S[i] - S[i-K]);
	}
	cout.precision(12); 
	double ans = (double) mx / 2.0 + 0.5 * K; 
	cout << ans << endl; 
}

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

int S[1000002];
int n;

int binarySearch(int key){
        int     left = 0;
        int     right = n;
        int mid;

        while (left < right){
                mid = (right + left) / 2;
                if (S[mid] == key) {
                        return mid;
                } else {
                        if(key < S[mid]) {
                                right = mid;
                        } else {
                                left = mid + 1;
                        }
                }
//              cout << "right = " << right << endl;
//              cout << "left  = " << left  << endl;
//              cout << "mid   = " << mid   << endl;
        }
        return -1;
}

int main(void){
        int i, j, q;
        int T[50003];
        int cnt = 0;

        cin >> n;
        for (i = 0; i < n; i++) {
                cin >> S[i];
        }
        cin >> q;
        for (i = 0; i < q; i++) {
                cin >> T[i];
        }
        for (j = 0; j < q; j++) {
                if (binarySearch(T[j]) >= 0) {
                        cnt++;
                }
        }
        cout << cnt << endl;
        return 0;
}


Measured memory_bytes: 3588
N=int(input())
AB=input().split()
AB=[int(n) for n in AB]
P=input().split()
P=[int(n) for n in P]
q=[0,0,0]

for p in P:
  if (p<=AB[0]):
    q[0]+=1
  elif (AB[0]+1)<=p<=(AB[1]):
    q[1]+=1
  elif (AB[1]+1)<=p:
    q[2]+=1

print ('{}'.format(min(q)))


Measured memory_bytes: 3064
import collections

n = int(input())

lc = list()
ls = list()
for i in range(n):
    s = input()
    ls.append(s)
    lc.append(collections.Counter(s))

lans = list()
for i in lc[0].keys():
    lm = [lc[j][i] for j in range(n)]
    lans.append((i, min(lm)))

lans = sorted(lans)

l = list()
for i in range(len(lans)):
    l.append(lans[i][0]*lans[i][1])

print("".join(l))

Measured memory_bytes: 39280
#include<iostream>
using namespace std;
int main(){
  char b;
  cin>>b;
  if(b=='A')cout<<'T'<<endl;
  else if(b=='T')cout<<'A'<<endl;
  else if(b=='C')cout<<'G'<<endl;
  else if(b=='G')cout<<'C'<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n];
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  int sum=1;int ans=0;
  for(int i=0;i<n-1;i++){
   if(a[i]==a[i+1]){
     sum++;
     if(i==n-2){
       ans+=(sum/2);
     }
   }
   else{
     if(sum!=0){
       sum=(sum/2);
       ans+=sum;
       sum=1;
     }
   }
  }
  cout << ans<<endl;
}


Measured memory_bytes: 256
//Author : Vipul Sharma

// LIBRARIES
#include <bits/stdc++.h>

// MACROS
#define ll long long int
#define ld long double
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define rev(i,b,a) for(ll i=b-1;i>=a;i--)
#define eqrep(i,a,b) for(ll i=1;i<=b;i++)
#define itrep(at) for (auto it = at.begin(); it != at.end(); it++)
#define ld long double
#define pb push_back
#define w(t) while (t--)
#define booster                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
#define mod 1000000007
#define endl "\n"
# define INF 0x3f3f3f3f 
#define deb1(x) cout << #x << " : " << x << endl;
#define deb2(x, y) cout << #x << " : " << x << "\t" << #y << " : " << y << endl;
#define deb3(x, y, z) cout << #x << " : " << x << "\t" << #y << " : " << y << "\t" << #z << " : " << z << endl;
#define deb4(x, y, z, w) cout << #x << " : " << x << "\t" << #y << " : " << y << "\t" << #z << " : " << z << "\t" << #w << " : " << w << endl;
#define deb5(a, b, c, d, e) cout << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define deb6(a, b, c, d, e, f) cout << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

using namespace std;
long long cost = 1e18;

void solve()
{
	string s;
	cin>>s;
	ll res=1;
	//if(s[i]=='R' and s[i+1]=='S') res=1;
	if(s[0]=='R' and s[1]=='R' and s[2]=='R') res=3;
	else if(s[0]=='R' and s[1]=='R') res=2;
	else if(s[1]=='R' and s[2]=='R') res=2;
	else if(s[0]!='R' and s[1]!='R' and s[2]!='R') res=0;
	cout<<res<<endl;
}


int main()
{
	
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    booster;
    solve();
    return 0;
}


Measured memory_bytes: 3640
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

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

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

    vector<long long> xs(n), ys(n);
    for(int i=0; i<n; i++) cin >> xs[i] >> ys[i];

    long long ans = 9223372036854775807LL - 1;
    for(int xi=0; xi<n; xi++){
        for(int xj=xi+1; xj<n; xj++){
            for(int yi=0; yi<n; yi++){
                for(int yj=yi+1; yj<n; yj++){

                    int cnt=0;
                    long long l = xs[xi], r = xs[xj], u = ys[yi], d = ys[yj];
                    if(l > r) swap(l, r);
                    if(d > u) swap(u, d);
                    for(int ki=0; ki<n; ki++)
                        if(l <= xs[ki] && xs[ki] <= r && d <= ys[ki] && ys[ki] <= u)
                            cnt++;

                    long long area = (r - l) * (u - d);
                    if(cnt >= k && area < ans) ans = area;
                }
            }
        }
    }
    cout << ans << "\n";
}


Measured memory_bytes: 256
import sys
input=sys.stdin.readline

N = int(input())
W = list(map(int, input().split()))

ans = sum(W)
for i in range(1,N):
    s1 = sum(W[:i])
    s2 = sum(W[i:])
    ans = min(ans, abs(s1-s2))
print(ans)


Measured memory_bytes: 3060
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define LLIandI pair<long long int , int>
#define ll long long

int main(){
    int N,A,B;
    scanf("%d",&N);
    scanf("%d %d",&A,&B);
    if(N==1)printf("Hello World\n");
    if(N==2)printf("%d\n",A+B);
}

Measured memory_bytes: 128
def check(s1,s2,n):
  ans=0
  for i in range(n):
    ans=ans+(0 if s1[i]==s2[i] else 1)
  return ans
s=input()
t=input()
o_len=len(s)
d_len=len(t)
ans=d_len
for i in range(o_len-d_len+1):
  case_ans=check(s[i:i+d_len],t,d_len)
  ans=min(ans,case_ans)
print(ans)



Measured memory_bytes: 9040
#include <iostream>
#include <array>

int main() {
    long long int n;

    while (std::cin >> n, n) {
        std::array<long long int, 7> arr{{}};
        int age;
        for (; n--;) {
            std::cin >> age;
            age = (age < 60 ? age : 60);
            ++arr[age / 10];
        }

        for (const auto& cnt : arr) {
            std::cout << cnt << std::endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std ;
int n ,t ;
int a[1000000] ;
int main() {
    cin>>n>>t;
    for( int i = 1 ; i <= n ; i ++ ) scanf( "%d" ,&a[ i ] ) ;
    int ans = 0 , mx = 0 ;
    int tot = 0 ;
    for( int i = n ; i  ; i -- ) {
        mx = max( a[ i ] , mx ) ;
        ans = max( mx - a[ i ] , ans ) ;
    }
    mx = 0 ;
    for( int i = n ; i ; i -- ) {
        mx = max(  a[ i ] , mx ) ;
        if( mx - a[ i ] == ans ) tot ++ ;
    }
    printf( "%d\n" , tot ) ;
    return 0 ;
}

Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if (a!=0&&b!=0)
    {
        if (a>0&&b>0) cout<<"Positive"<<endl;
        if (a<0&&b>0) cout<<"Zero"<<endl;
        if (a<0&&b<0)
        {
            if ((b-a)%2==1)
            {
                cout<<"Positive"<<endl;
            }
            else
            cout<<"Negative"<<endl;
        }
    }
    else
    cout<<"Zero"<<endl;
    return 0;
}

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

int main() {
    int r, g, b;
    cin >> r >> g >> b;

    if ((g * 10 + b) % 4 == 0 ) {
        cout << "YES" << endl;
    }

    else {
        cout << "NO" << endl;
    }
}

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

int main(){
  int n,x=0,sum=1; cin >>n; bool p=1,q=1;
  vector<string>a(n);
  for(int i=0; i<n; i++) cin >>a[i];
  sort(a.begin(),a.end());
  while(p)
  {
    q=1;
    for(int k=1; k<n-x; k++)
    {if(a[x]!=a[x+k]){sum++; x+=k; q=0; break;}}
    if(q==1) p=0;
  }
  cout <<sum;
return 0;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, ans[int(1e5+5)];

int main(){
  string S; cin >> S;
  N = S.length();

  int R = 0;
  for (int i = 0; i < N; i++){
    if (S[i] == 'R') R++;
    else{
      ans[i-1] += (R+1) / 2;
      ans[i] += R/2;
      R = 0;
    }
  }

  int L = 0;
  for (int i = N - 1; i >= 0; i--){
    if (S[i] == 'L') L++;
    else{
      ans[i+1] += (L+1) / 2;
      ans[i] += L / 2;
      L = 0;
    }
  }

  cout << ans[0];
  for (int i = 1; i < N; i++) cout << " " << ans[i];
  cout << endl;


  return 0;
}


Measured memory_bytes: 4104
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int maxn=100010;
#define MP make_pair
#define PB push_back
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#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 MEM(x,v) memset(x,v,sizeof(x))
inline ll read(){
	char ch=getchar();ll x=0,f=0;
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}
int n,a[maxn];
map<int,int> cnt;
int main(){
	n=read();
	FOR(i,1,n) a[i]=read(),cnt[a[i]]++;
	sort(a+1,a+n+1,greater<int>());
	if(!a[1]) puts("Yes");
	else{
		if(n%3) return puts("No"),0;
		if(cnt[a[1]]==n/3){
			int x=0,y=0;
			for(map<int,int>::iterator it=cnt.begin();it!=cnt.end();it++){
				if(it->second!=n/3) return puts("No"),0;
				if(it->first==a[1]) continue;
				if(!x) x=it->first;
				else if(!y) y=it->first;
				else return puts("No"),0;
			}
			if((x^y)==a[1]) puts("Yes");
			else puts("No");
		}
		else if(cnt[a[1]]==n/3*2){
			if(cnt[0]==n/3) puts("Yes");
			else puts("No");
		}
		else puts("No");
	}
}

Measured memory_bytes: 4224
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    int sum=0;
    short n;
    cin>>n;
    int l[2*n];
    for (int i=0;i<(2*n);i++)
    {
        cin>>l[i];
    }
 sort(l,l+(n*2));
 for(int j=0;j<(2*n);j+=2)
 {
     sum+=l[j];
 }
 cout<<sum;
    return 0;
}


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

int main()
{
  int n, q;
  string s;
  cin >> n >> q;
  cin >> s;
  int cnt[n];
  int c = 0;
  for (int i = 1; i < n; i++) {
    if (s[i - 1] == 'A' && s[i] == 'C') {
      c++;
      cnt[i - 1] = c - 1;
      cnt[i] = c;
    } else {
      cnt[i - 1] = cnt[i] = c;
    }
  }
  for (int i = 0; i < q; i++) {
    int l, r;
    cin >> l >> r;
    cout << cnt[r - 1] - cnt[l - 1] << endl;
  }
}


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

using namespace std;
#define int long long

const int INF = 200000000007;


  
signed main(){
    int q;
    cin>>q;
    int t,a,b,bsum=0,ans;
    priority_queue<int> que1;
    priority_queue<int, vector<int>, greater<int> > que2;
    int sum1=0,sum2=0;
    for(int i=0;i<q;i++){
        cin>>t;
        if(t==1){
            cin>>a>>b;
            bsum+=b;
            if(que1.size()==que2.size()){
                if(que2.empty()||que2.top()>=a){
                    que1.push(a);
                    sum1+=a;
                }else{
                    que1.push(que2.top());
                    sum2-=que2.top();
                    sum1+=que2.top();
                    que2.pop();
                    que2.push(a);
                    sum2+=a;
                }
            }else{
                if(que1.top()<=a){
                    que2.push(a);
                    sum2+=a;
                }else{
                    que2.push(que1.top());
                    sum2+=que1.top();
                    sum1-=que1.top();
                    que1.pop();
                    que1.push(a);
                    sum1+=a;
                }
            }
           
        }else{
           // cerr<<sum1<<' '<<sum2<<' '<<que1.top()<<endl;
            ans=bsum +  que1.top()*que1.size()-sum1+sum2-que1.top()*que2.size();
            cout<<que1.top()<<' '<<ans<<endl; 
        }
}   
    

    
    return 0;
}

Measured memory_bytes: 3828
#include <iostream>
#include <cstdint>
#include <algorithm>

using namespace std;

int main()
{
    string S;
    u_int64_t K;
    cin >> S;
    cin >> K;

    const u_int64_t len = S.length();
    const char *ss = S.c_str();

    u_int64_t ub = min(len, K);
    char result = '1';
    for (u_int64_t i = 0; i < ub; i++)
    {
        if (ss[i] != '1')
        {
            result = ss[i];
            break;
        }
    }

    cout << result << endl;
    return 0;
}


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

int main(){
    int cnt = 0;
    string w, str;
    cin >> w;
    while(true){
        cin >> str;
        if( str == "END_OF_TEXT") break;
        for(int i = 0; i < str.size(); i++){
            str[i] = tolower(str[i]);
        }
        if(str == w) cnt++;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}

ll INF; 
umap<ll,ll> mp_count;

int main(){
  INF = pow(10,9)+7;
  ll N; cin>>N;
  for(ll i=2;i<=N;i++){
    ll temp = i;
    while(temp>1){
      for(ll j=2;j<=temp;j++){
        if(temp%j==0){mp_count[j]++; temp /= j; j = 1; break;}
      }
    }
  }
  ll r = 1;
  for(int i=2;i<=N;i++){
    r *= (mp_count[i]+1);
    r %= INF;
  }
  cout << r;
}

Measured memory_bytes: 384
#include <stdio.h>

int selectionSort(int s[],int N){
    int i,j;
    int minj;
    int tmp;
    int count=0;
    for(i=0;i<N-1;i++){
        minj=i;
        for(j=i+1;j<N;j++){
            if(s[j]<s[minj])minj=j;
        }
        if(minj!=i){
            tmp=s[i];
            s[i]=s[minj];
            s[minj]=tmp;
            count++;
        }
    }

    return count;
}
int main(void){
    int i;
    
    int N;
    scanf("%d",&N);
    int s[N];
    for(i=0;i<N;i++)scanf("%d",&s[i]);
    
    int count;
    count=selectionSort(s,N);
    
    printf("%d",s[0]);
    for(i=1;i<N;i++)printf(" %d",s[i]);
    printf("\n%d\n",count);
    
    return 0;
}


Measured memory_bytes: 2100
n=int(input())
a=list(map(int,input().split()))
s=sum(a)-sum(a[1::2])*2
d=[s]
for i in range(n):
    if i!=n-1:
        d.append((a[i]-s//2)*2)
        s=(a[i]-s//2)*2
print(*d)

Measured memory_bytes: 14032
#include<bits/stdc++.h>
using namespace std;
 
int main(){
    int H,W;
    
    cin >> H >> W;
    
    vector<string> tbl(H);
    
    for(int i = 0; i < H; i++){
        cin >> tbl.at(i);
    }
    
    vector<bool> col(W,false);
    vector<bool> row(H,false);

    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            if(tbl.at(i).at(j) == '#'){
                col.at(j) = true;
                row.at(i) = true;
            }
        }
    }
    
    for(int i = 0; i < H; i++){
        if(row.at(i)){
           for(int j = 0; j < W; j++){
               if(col.at(j)){
                   cout << tbl.at(i).at(j);
               }
                
            }
            cout << endl;
        }
        
    }
    return 0;
}

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

char ch[10];
int main(){
	ll i,len=0;
	for (i=1; i<=10000000000ll; i*=10,len++){
		printf("? %lld\n",i); fflush(stdout);
		scanf("%s",ch);
		if (ch[0]=='N') break;
	}
	if (i>10000000000ll){
		for (i=9; i<=999999999ll; i=i*10+9){
			printf("? %lld\n",i); fflush(stdout);
			scanf("%s",ch);
			if (ch[0]=='Y') break;
		}
		printf("! %lld\n",i/10+1); fflush(stdout);
		return 0;
	}
	i/=10; len--;
	ll l=i,r=i*10-1;
	while (l<r){
		ll mid=l+r>>1;
		printf("? %lld\n",mid*10+9); fflush(stdout);
		scanf("%s",ch);
		if (ch[0]=='N') l=mid+1; else r=mid;
	}
	printf("! %lld\n",l);
	return 0;
}


Measured memory_bytes: 668
#define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=3053"

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

#define call_from_test
#ifndef call_from_test
#include<bits/stdc++.h>
using namespace std;
#endif
//BEGIN CUT HERE
struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;
//END CUT HERE
#ifndef call_from_test
signed main(){
  return 0;
}
#endif

#ifndef call_from_test
#include<bits/stdc++.h>
using namespace std;
#endif
//BEGIN CUT HERE
template<typename F>
void all_permutations(int n,F f){
  vector<int> vs(n);
  iota(vs.begin(),vs.end(),0);
  do f(vs); while(next_permutation(vs.begin(),vs.end()));
}
//END CUT HERE
#ifndef call_from_test
//INSERT ABOVE HERE
signed ABC054_C(){
  int n,m;
  cin>>n>>m;
  int es[10][10]={};
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    a--;b--;
    es[a][b]=es[b][a]=1;
  }
  int ans=0;
  auto f=
    [&](const auto &vs){
      if(!es[0][vs[0]+1]) return;
      for(int i=0;i+1<n-1;i++)
        if(!es[vs[i]+1][vs[i+1]+1]) return;
      ans++;
    };
  all_permutations(n-1,f);
  cout<<ans<<endl;
  return 0;
}
/*
  verified on 2019/12/09
  https://atcoder.jp/contests/abc054/tasks/abc054_c
*/

signed main(){
  ABC054_C();
  return 0;
}
#endif

#undef call_from_test

signed main(){
  int n;
  string s;
  cin>>n>>s;

  int c[10][10]={};
  for(int i=0;i+1<n;i++){
    int a=s[i]-'0',b=s[i+1]-'0';
    c[a][b]++;
  }

  int ans=n*100;
  vector<int> us;
  auto f=
    [&](auto vs){
      int x[10],y[10];
      for(int i=0;i<9;i++){
        x[vs[i]+1]=i%3;
        y[vs[i]+1]=i/3;
      }

      int res=0;
      for(int i=1;i<=9;i++)
        for(int j=1;j<=9;j++)
          res+=c[i][j]*(abs(x[i]-x[j])+abs(y[i]-y[j]));

      if(res<ans) ans=res,us=vs;
    };
  all_permutations(9,f);

  for(int i=0;i<9;i++){
    cout<<us[i]+1;
    if(i%3==2) cout<<endl;
  }
  return 0;
}



Measured memory_bytes: 3344
#include <bits/stdc++.h>
#define Rep(i,n) for(int i = 0; i < (n); i++)
#define For(i,start,end) for(i64 i = start; i < end; i++)
inline void nl(){std::cout<<std::endl;}
using namespace std;
typedef long long ll;
typedef unsigned long ul;

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using ui = uint64_t;

//----------------library in this time--------------------------------
template <class T>
T gcd(const T a,const T b) {
    return (b == 0) ? a : gcd (b, a % b);
}
template <class T>
T lcm(const T a, const T b) {
    return a * b / gcd(a,b);
}
template <class T>
inline T ave(const T a, const T b) {
    return (a + b) / 2.0f;
}

long long squareTwo(const long long a,const long long b) {
    return (b == 1) ? a : squareTwo(a * 2, b - 1);
}

template<class T> inline bool UpdateMin(T& a, T b) {
    if (a > b) { a = b; return 1; } return 0;
}

template<class T> inline bool UpdateMax(T& a, T b) {
    if (a < b) { a = b; return 1; } return 0;
}

//------------------------main function-------------------------------
void Main(){
    ll n; cin >> n;
    vector<ll> v(n);
    ll sum =0 , ans = 0;
    Rep(i,n){
        cin >> v[i];
        sum += v[i];
    }
    Rep(i, n - 1){
        sum -= v[i];
        ans += sum * v[i];
    }
    
    cout << ans << endl;
    
}
//--------------------------------------------------------------------
int main(){
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(10);
    
    Main();
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define endl "\n"
#define fcout cout<<fixed<<setprecision(15)
typedef pair<int, int> P;
//struct edge { int to, cost; };

int dx[8] = { 1,0,0,-1,1,1,-1,-1 };
int dy[8] = { 0,-1,1,0,-1,1,-1,1 };

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

bool prime(int n) {
    for (int i = 2; i <= sqrt(n); i++) {
        if (n % i == 0)return false;
    }
    return n != 1;
}
int gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
int lcm(int x, int y) {
    return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
    if (p == 0) return 1;
    if (p % 2 == 0) {
        int t = mod_pow(n, p / 2, m);
        return (t * t) % m;
    }
    return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a % b, y, x);
    y -= a / b * x;
    return d;
}
int modinv(int a, int m) {
    int b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int modinv2(int a, int mod) {
    return mod_pow(a, mod - 2, mod);
}
int digit(int x) {
    int cnt = 0;
    while (x > 0) {
        cnt += x % 10;
        x /= 10;
    }
    return cnt;
}
int read() {
    int tmp;
    cin >> tmp;
    return tmp;
}
int xor128() {
    static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    int t = (x xor (x << 11));
    x = y; y = z; z = w;
    return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
    map<int, int>ans;
    int now = 2;
    while (now * now <= x) {
        if (x % now == 0) {
            x /= now;
            ans[now]++;
        }
        else now++;
    }
    if (x != 1) ans[x]++;
    return ans;
}
int comb(int n, int k, int mod) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    k = min(k, n - k);
    int x = 1, y = 1;
    rep(i, k) {
        y *= i + 1;
        y %= mod;
    }
    for (int i = n - k + 1; i <= n; i++) {
        x *= i;
        x %= mod;
    }
    return x * modinv(y, mod) % mod;
}

signed main() {
    //srand((unsigned)time(NULL));

    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n, a, b;
    int h[100005];

    cin >> n >> a >> b;
    rep(i, n) cin >> h[i];

    int ok = 1000000000, ng = 0;
    while ((ok - ng) > 1) {
        int mid = (ok + ng) / 2;
        int cnt = 0;
        rep(i, n) {
            int x = h[i] - b * mid;
            if (x > 0) {
                cnt += (x + a - b - 1) / (a - b);
            }
        }
        if (cnt <= mid) {
            ok = mid;
        }
        else ng = mid;
    }
    cout << ok << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int pnum[1000];
int power(int num)
{
	if(pnum[num]!=0)return pnum[num];
    int p=1;
    for(int i=1;i<num;i++)p*=10;
    return pnum[num]=p;
}
int main() {
    int n,m,a[3]={15,3,5};
    string str,fb[3]={"FizzBuzz","Fizz","Buzz"};
    while(cin>>m>>n,n,m){
        bool player[1000]={};
        for(int i=1,now=0,out=m;i<=n;i++,now=(now+1)%m){
			cin>>str;
			if(out>1){
				int num=0,co=-1;
				while(player[now])now=(now+1)%m;
				for(int j=0;j<3&&co<0;j++)if(i%a[j]<1)co=j;
				for(int j=0;j<str.size()&&co<0;j++)num+=(str[j]-'0')*power(str.size()-j);
				if(co>-1&&str!=fb[co]||co<0&&i!=num)player[now]=1;
				if(player[now])out--;
			}
		}
		for(int i=0,co=0;i<m;i++){
			if(!player[i]&&co>0)cout<<" ";
			if(!player[i]){
				cout<<i+1;
				co++;
			}
		}
		cout<<endl;
	}
}

Measured memory_bytes: 1220
{-# LANGUAGE ScopedTypeVariables #-}

import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import Data.List
import Data.Char
import Control.Monad

solve vec (a, b) i
    | i == 9 = if VU.sum vec > 0 then (a, b + VU.sum vec) else (a, b)
    | VU.sum ts > 0 = solve ds (a + 1, b + 1) (i+1)
    | otherwise = solve ds (a, b) (i+1)
        where
            ts = VU.take 400 vec
            ds = VU.drop 400 vec
        
main = do
    n <- readLn :: IO Int
    (vec :: VUM.IOVector Int) <- VUM.replicate 4801 0
    xs <- VU.unfoldrN n (B.readInt . B.dropWhile isSpace) <$> B.getLine
    VU.forM_ xs $ \x -> do
        VUM.modify vec (+1) x
    vec' <- VU.unsafeFreeze vec
    let (a,b) = solve vec' (0, 0) 1
    putStr $ show (max a 1)
    putStr " "
    putStrLn $ show b

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

int main() {
   	int N, c=0;
  	cin >> N;
    int K = N;
    while (true){
    	c += (N%10);
    	N -= (N%10);
      	if (N==0) break;
    	N /= 10;
       }
   if (K%c == 0) cout << "Yes" << endl;
   else cout << "No" << endl;
}

Measured memory_bytes: 3596
import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs= sys.stdin.buffer.readlines
#rstrip().decode('utf-8')

import math
#import numpy as np
#import operator
#from heapq import heapify,heappop,heappush
#from math import gcd
#from fractions import gcd
#from collections import deque
#from collections import defaultdict
#from collections import Counter
#from itertools import accumulate
#from itertools import groupby
#from itertools import permutations
#from itertools import combinations
#from scipy.sparse import csr_matrix
#from scipy.sparse.csgraph import floyd_warshall
#from scipy.sparse.csgraph import csgraph_from_dense
#from scipy.sparse.csgraph import dijkstra
#sys.setrecursionlimit(10**7)

#map(int,input().split())

def main():
	H,W=map(int,input().split())
	ans=[]
	target=H*W/3
	
	if (H%3)*(W%3)==0:
		ans.append(0)
	else:
		ans.append(H)
		ans.append(W)
		
		a1=math.floor(H/3)*W
		a2=(W//2)*(H-math.floor(H/3))
		a3=H*W-a1-a2
		ans.append(max(a1,a2,a3)-min(a1,a2,a3))
		
		a1=math.ceil(H/3)*W
		a2=(W//2)*(H-math.ceil(H/3))
		a3=H*W-a1-a2
		ans.append(max(a1,a2,a3)-min(a1,a2,a3))
		
		H,W=W,H
		
		a1 = math.floor(H / 3) * W
		a2 = (W // 2) * (H - math.floor(H / 3))
		a3 = H * W - a1 - a2
		ans.append(max(a1, a2, a3) - min(a1, a2, a3))
		
		a1 = math.ceil(H / 3) * W
		a2 = (W // 2) * (H - math.ceil(H / 3))
		a3 = H * W - a1 - a2
		ans.append(max(a1, a2, a3) - min(a1, a2, a3))
		
	print(min(ans))


if __name__ == '__main__':
	main()

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

set<long long> nums;

int main(){
  int n;
  cin >> n;
  long long maxa = 0;
  long long maxb = 0;
  for(int i=0; i<n; i++){
    long long v;
    cin >> v;   
    if(nums.find(v) != nums.end()){
      nums.erase(v);
      if(maxa > maxb) maxb = max(v, maxb);
      else maxa = max(v, maxa);
    } else {
      nums.insert(v);
    }
  }
  cout << maxa * maxb << endl;
  return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    int n;
    cin >> n;
    ll x = 1;
    ll y = 1;
    rep(i, n) {
        ll t, a;
        cin >> t >> a;
        ll it = (x-1)/t+1;
        ll ia = (y-1)/a+1;
        ll z = max(it, ia);
        x = t*z;
        y = a*z;
    }
    ll ans = x + y;
    
    cout << ans << endl;
    return 0;
}


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

//#include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
// using cint = cpp_int;
//#pragma GCC optimize("", on)
//#pragma GCC optimization_level 3

// Define
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ull MAX = ULONG_MAX;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define x first
#define y second
#define endl '\n'
#define space ' '
#define def inline auto
#define func inline constexpr ll
#define run __attribute__((constructor)) def _
#define all(v) begin(v), end(v)
#define input(a) scanf("%lld", &(a))
#define print(a) printf("%lld\n", (a))

// Debug
#define debug(...)                                                             \
    {                                                                          \
        cerr << __LINE__ << ": " << #__VA_ARGS__ << " = ";                     \
        for (auto &&X : {__VA_ARGS__}) cerr << "[" << X << "] ";               \
        cerr << endl;                                                          \
    }

#define dump(a, h, w)                                                          \
    {                                                                          \
        cerr << __LINE__ << ": " << #a << " = [" << endl;                      \
        rep(i, h) {                                                            \
            rep(j, w) cerr << a[i][j] << space;                                \
            cerr << endl;                                                      \
        }                                                                      \
        cerr << "]" << endl;                                                   \
    }

#define lldump(a, n) dump(vector<vector<ll>>{a}, 1, n)

// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i <= _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i >= _##i; --i)
#define each(i, a) for (auto &&i : a)
#define rep(i, n) inc(i, 0, n - 1)
#define loop() for (;;)

// Stream
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)

// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("O3")
#pragma GCC target("avx")

// Math
func gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
func lcm(ll a, ll b) { return a * b / gcd(a, b); }
func sign(ll a) { return a ? abs(a) / a : 0; }

def in() {
    ll A;
    cin >> A;
    return A;
}

signed main() {
    ll N, a, b;
    cin >> N;
    ll A[N], B[N];
    rep(i, N) cin >> A[i] >> B[i];
    a = A[0], b = B[0];
    inc(i, 1, N - 1) {
        ll ratio = max((a + A[i] - 1) / A[i], (b + B[i] - 1) / B[i]);
        a = A[i] * ratio, b = B[i] * ratio;
    }
    cout << a + b << endl;
}

// for compilation: g++ -Ofast -march=native -o _ _.cpp -std=c++17


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

using namespace std;

int main(void)
{
    int N, M, X;
    int a,b;
    cin >> N >> M >> X;

    vector<int> C(N);
    vector<vector<int>> A(N);

    for(int i = 0;i < N;i++) {
        cin >> a;
        C[i] = a;
        for(int j = 0;j < M;j++) {
            cin >> b;
            A[i].push_back(b);
        }
    }

    int result = 0;
    int prev = 0x0FFFFFFF;
    int max = 0;
    for(int i = 0;i < N;i++) {
        max = max |(0x01 << i);
    }
    
    for(int i = 0;i <= max;i++) {
        vector<int> score(M,0);
        for(int j = 0;j < N; j++) {
           result += C[j]* ((i >> j) & 1);

            for(int k = 0;k<M;k++) {
                score[k] += ((i >> j) & 1) * A[j][k];
            }
        }
        if(result < prev && *min_element(score.begin(),score.end()) >= X){
            prev = result;
        }
        result = 0;
    }
    if (prev == 0x0FFFFFFF) {
        cout << -1 << endl;
    }
    else {
        cout << prev << endl;
    }
    return 0;
}

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

int n;
int a[14][115];
int b[14][115];
int ans;


int main()
{
    cin>>n;
    for (int i=0;i<4;i++)
    {
        for (int j=0;j<n+2;j++)
        {
            a[i][j]=0;
        }
    }
    for (int i=1;i<=2;i++)
    {
        for (int j=1;j<=n;j++)
        {
            scanf("%d", &a[i][j]);
        }
    }
    for (int i=1;i<n+2;i++)
    {
        b[1][i]=a[1][i]+b[1][i-1];
        b[2][i]=a[2][i]+b[2][i-1];
    }
    for (int i=1;i<=n;i++)
    {
        ans=max(ans,b[1][i]+b[2][n]-b[2][i-1]);
    }
    cout<<ans;
}


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

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int arr[26];

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    string w;
    cin>>w;
    for(int i=0;i<w.length();i++){
        int k=w[i]-'a';
        arr[k]++;
    }
    int ans=1;
    for(int i=0;i<26;i++){
        if(arr[i]&1==1){
            ans=0;
            break;
        }
    }
    if(ans){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return 0;
}


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

int main() {
	int table[9 * 9];
	for (int i = 1, c = 0; i <= 9; ++i)
		for (int j = 1; j <= 9; ++j, ++c)
			table[c] = i * j;
	int n; cin >> n;
	bool match = false;
	for (int i = 0; i < (9 * 9) && !match; ++i)
		if (table[i] == n)match = true;
	cout << (match ? "Yes" : "No") << endl;
}

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

signed main() {
    int n, d, sum, ans;
    cin >> n;
    
    sum = ans = 0;
    for ( int i = 0; i < n; i++ ) {
        cin >> d;
        
        ans += d * sum;
        sum += d;
    }
    
    cout << ans << endl;
    return (0);
}

Measured memory_bytes: 3620
#include <iostream>

using namespace std;

int main(){
  int N;
  int keta;
  bool ans=false;
  cin >> N;
  while(N>0){
    keta = N%10;
    if(keta==7){
      ans = true;
      break;
    }
    N=N/10;
  }
  if(ans){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int man=1000005;
const int MAXM= 15000005;
string s;
string ss;
int n;
map<string,int> cnt;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin>>n;
  for(int i=0;i<n;i++)
  {
      cin>>s;
     if(i>0)
     {
         if(ss[0]!=s[0])
         {
             cout<<"No"<<endl;
             return 0;
         }
     }
     cnt[s]++;
     ss[0]=s[s.size()-1];
     if(cnt[s]>1)
     {
       cout<<"No"<<endl;
             return 0;
     }

  }
  cout<<"Yes"<<endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pair<ll,ll>>
#define vvll vector<vector<ll>>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
using namespace std;


//

//

void solve()
{
	ld r;	cin>>r;
	cout<<2*3.14159*r<<endl;
}


int main()
{
	    solve();
        return 0;
}


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

int N;
int A[210];         // �ő� 200 �Ȃ̂ŗ]�T�������� 210 �� --- 200 �ȏ�Ȃ�Ȃ�ł��悢�ł�

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

    int res = 0;

    // ���삪�s������葀����J��Ԃ�
    while (true) {
        bool exist_odd = false;  // A[i] �����ׂċ������ǂ����𔻒肷��t���O
        for (int i = 0; i < N; ++i) {
            if (A[i] % 2 != 0) exist_odd = true;  // �����������t���O�𗧂Ă�
        }

        if (exist_odd) break;  // ����������� break

        // ������s����Ȃ瑀������ۂɍs��
        for (int i = 0; i < N; ++i) {
            A[i] /= 2;
        }
        ++res;  // ����񐔂��C���N�������g
    }

    cout << res << endl;
}

Measured memory_bytes: 3172
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())





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

	int a;
	cin >> a;
	cout << a * a << endl;



	return 0;
}

Measured memory_bytes: 256
list=sorted(list(map(int,input().split())))
count=0
while list[-1]-1>list[0] or list[-1]-1>list[1]:
  if list[0]<list[-1]-1:
    list[0]+=2
    count+=1
  if list[1]<list[-1]-1:
    list[1]+=2
    count+=1
if list[0]==list[1]==list[-1]-1:
  count+=1
elif list[0]==list[-1] and list[1]<list[-1]:
  count+=2
elif list[1]==list[-1] and list[0]<list[-1]:
  count+=2
else:
  pass
print(count)

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
    int n,q;cin>>n>>q;
    string s; cin>>s;
    
    vector<int>l(n,0);
    for(int i=1;i<n;++i){
        if(s[i-1]=='A'&&s[i]=='C')l[i]=l[i-1]+1;
        else l[i]=l[i-1];
    }
    
    for(int i=0;i<q;++i){
        int li,ri;
        cin>>li>>ri;
        cout<<l[ri-1]-l[li-1]<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>
#include <cstring>

using namespace std;

typedef pair<int, int> P;
#define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i))
#define rep(i, n)  FOR(i,0,n)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort((v).begin(), (v).end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define all(c) (c).begin(),(c).end()
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define _1 first
#define _2 second
#define pb push_back
#define mod 1000000007LL
#define INF 105000000000

const int maxn = 1e5 + 10;
ll inu[maxn], saru[maxn];

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

	int n,m;
	cin >> n>>m;

	if (abs(n - m) > 1) { cout << 0 << endl; return 0; }
	
	inu[0] = 1; saru[0] = 1;

	FOR(i,1, n+1)
	{
		inu[i] = (inu[i - 1] * i)%mod;
	}

	FOR(i,1, m+1)
	{
		saru[i] = (saru[i - 1] * i)%mod;
	}
	ll res = (inu[n] * saru[m]) % mod;
	if (n == m) res = res * 2 % mod;
	cout << res << endl;

	return 0;
	
}

Measured memory_bytes: 1792
//I am so vegetable
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define FIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define PB push_back
#define IN insert
#define ER erase
#define CT count
#define EP empty
#define _for(i,a,b) for(int i = (a);i<(b);++i)
#define _rfor(i,a,b) for(int i = (a);i>(b);--i)
#define _sfor(p,st) for(auto &p:st)
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const double eps = 1e-6;
const double pi = 3.141593;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
ll qpow(ll x, ll y) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans *= x; x *= x; }return ans; }
ll qpow(ll x, ll y, int MOD) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans = ans*x%MOD; x = x*x%MOD; }return ans; }
void exgcd(ll a,ll b,ll &x,ll &y){
    if(!b){x=1;y=0;return;}
    exgcd(b,a%b,x,y);
    ll X=x;
    x=y; y=X-a/b*y;
}
ll inv(ll x, int mod = MOD) { return qpow(x, mod - 2) % mod; }
ll m_m(ll a){ return (a%MOD+MOD)%MOD; }

int main() {
	//ofstream cout("E:\\acm dream\\out.txt",ios::out);
	FIO;
	int a,b,k;cin>>k>>a>>b;
    _for(i,a,b+1){
        if(i%k==0){
            cout<<"OK";
            return 0;
        }
    }
    cout<<"NG";
	return 0;
}

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

int main(){
    string S;
    cin >> S;

    int count = 0;

    for(int i = 0; i < S.size(); i++){
        for(int j = 0; j < S.size(); j++){
            if(S.at(i) == S.at(j)){
                count++;
            }
        }
    }

    if(count == 8){
        cout << "Yes" << endl;
    }

    else{
        cout << "No" << endl;
    }

}

Measured memory_bytes: 256