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


//wierd debugging stuff
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << "\n" ; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
//end of weird debugging stuff
using ll = long long;
using vi = vector<int>;
using ii = pair<int,int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define invec(v) for(auto& x : v)cin>>x;
#define Time()	cerr <<'\n' << clock() * 1000 / CLOCKS_PER_SEC << "ms\n"
#define SZ(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define fo(i,k,n) for(ll (i)=(k);(i)<(n);(i)++) 
#define ar array
// no change 

const ll MOD = 1e9+7;   // it is an prime...

template<typename T,typename L>
T power(T a, L b);				// to find reverse modulo its power(a,MOD-2);
template < typename T ,typename L> 
L coefficient(T n, T k);  // computing nCk

//const int MxN = 1e9+5;
void solve(){
	string a,b;
	cin >> a >> b;
	int ans = 0;
	for(int i = 0;i<a.size();i++){
		if(a[i] !=b[i])ans++;
	}
	cout << ans;



}
int main() {
	FASTER;
	int T = 1;
	//cin >> T;		//cmt if one test case
	while(T--)solve();
	Time();
}


template<typename T,typename L>
T power(T a, L b){
	
	T result = 1;
	while(b){
		if(b&1) result = (result% MOD * a%MOD) % MOD;
	   	a = (a%MOD * a%MOD) % MOD;
   		b/=2;	   
	}
	return result;
}

template < typename T ,typename L> 
L coefficient(T n, T k){  // computing nCk
	k = min(k,(n-k));
	L res = 1;
	for(T i = 0; i< k;i++){
		res *= (n-i);
		res /= (i+1);

	}
	return res;
}


Measured memory_bytes: 3888
import math
N, D = map(int, input().split())
X = []
count = 0
for i in range(N):
    tmp = list(map(int, input().split()))
    X.append(tmp)

for n in range(N):
    for k in range(n+1, N):
        tmp = 0
        for t in range(D):
            tmp += (X[n][t]- X[k][t])**2
        if int(math.sqrt(tmp)) == math.sqrt(tmp):
            count += 1
print(count)




Measured memory_bytes: 3064
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
using pll = pair<ll,ll>;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1e9+7;



int main(){

int N;
cin>>N;
map<ll,int> A_;
bool judge=true;
rep(i,N){
    ll A;
    cin>>A;
    if(A_[A]!=0)judge=false;
    A_[A]++;
}
if(judge)cout<<"YES"<<endl;
else cout<<"NO"<<endl;


return 0;
}

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


#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}

struct UF{
	vector<int> p;
	UF(int n) : p(n, -1) {}
	int find(int a){ return p[a] < 0 ? a : p[a] = find(p[a]); }
	bool unite(int a, int b) {
		a = find(a); b = find(b);
		if(a == b) return false; //閉路検出
		if(-p[a] < -p[b]) swap(a, b);
		p[a] += p[b]; p[b] = a;
		return true;
	}
	bool root(int a){ return p[a] < 0; }
	bool same(int a, int b){ return find(a) == find(b); }
};

int main()
{
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	
	vector<VI> sk(n, VI(3)), kn;
	rep(i, n){
		cin >>sk[i][0] >>sk[i][1];
		sk[i][2] = i;
	}
	UF ufa(n);
	sort(all(sk));
	rep(i, n-1){
		kn.push_back({sk[i+1][0] - sk[i][0], sk[i][2],sk[i+1][2]} );
	}
	sort(all(sk), [](auto& l, auto& r){return l[1] < r[1];});
	rep(i, n-1){
		kn.push_back({sk[i+1][1] - sk[i][1], sk[i][2],sk[i+1][2]} );
	}
	sort(all(kn));
	
	ll ans =0;
	for(auto& z: kn){
		if(!ufa.same(z[1], z[2])){
			ans += z[0];
			ufa.unite(z[1], z[2]);
		}
	}
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 18476
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tll;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll D, G;
    cin >> D >> G;
    vector<pll> questions;
    questions.emplace_back(0, 0);
    for (int i = 0; i < D; i++)
    {
        ll p, c;
        cin >> p >> c;
        questions.emplace_back(p, c);
    }
    ll answer = 1e12;
    int maxI = (1 << D);
    for (int i = 0; i < maxI; i++)
    {
        ll tempAnswer = 0;
        ll score = 0;
        for (int j = 1; j <= D; j++)
        {
            int checkBit = 1 << (j - 1);
            //1が立っていたらコンプリートする
            if (i & checkBit)
            {
                tempAnswer += questions.at(j).first;
                score += questions.at(j).first * j * 100 + questions.at(j).second;
            }
        }
        ll questionIndex = D;
        while (score < G && questionIndex)
        {
            int checkBit = 1 << (questionIndex - 1);
            if ((i & checkBit) == 0)
            {
                ll point = questionIndex * 100;
                ll count = min((G - score + point - 1) / point, questions.at(questionIndex).first - 1);
                tempAnswer += count;
                score += count * point;
            }
            questionIndex--;
        }
        if(score >= G)
        {
            answer = min(answer, tempAnswer);
        }
    }
    cout << answer << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <vector>
namespace atcoder {
// Implement (union by size) + (path compression)
// Reference:
// Zvi Galil and Giuseppe F. Italiano,
// Data structures and algorithms for disjoint set union problems
struct dsu {
  public:
    dsu() : _n(0) {}
    dsu(int n) : _n(n), parent_or_size(n, -1) {}
    int merge(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        int x = leader(a), y = leader(b);
        if (x == y) return x;
        if (-parent_or_size[x] < -parent_or_size[y]) std::swap(x, y);
        parent_or_size[x] += parent_or_size[y];
        parent_or_size[y] = x;
        return x;
    }
    bool same(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        return leader(a) == leader(b);
    }
    int leader(int a) {
        assert(0 <= a && a < _n);
        if (parent_or_size[a] < 0) return a;
        return parent_or_size[a] = leader(parent_or_size[a]);
    }
    int size(int a) {
        assert(0 <= a && a < _n);
        return -parent_or_size[leader(a)];
    }
    std::vector<std::vector<int>> groups() {
        std::vector<int> leader_buf(_n), group_size(_n);
        for (int i = 0; i < _n; i++) {
            leader_buf[i] = leader(i);
            group_size[leader_buf[i]]++;
        }
        std::vector<std::vector<int>> result(_n);
        for (int i = 0; i < _n; i++) {
            result[i].reserve(group_size[i]);
        }
        for (int i = 0; i < _n; i++) {
            result[leader_buf[i]].push_back(i);
        }
        result.erase(
            std::remove_if(result.begin(), result.end(),
                           [&](const std::vector<int>& v) { return v.empty(); }),
            result.end());
        return result;
    }
  private:
    int _n;
    // root node: -1 * component size
    // otherwise: parent
    std::vector<int> parent_or_size;
};
}  // namespace atcoder
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, q;
  cin >> n >> q;
  atcoder::dsu g(n);
  while (q--) {
    int op, u, v;
    cin >> op >> u >> v;
    if (op) {
      cout << g.same(u, v) << '\n';
    } else {
      g.merge(u, v);
    }
  }
  return 0;
}


Measured memory_bytes: 3892
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    a, b, c, d = (int(_) for _ in input().split())
    if a+b > c+d:        
        print('Left')
    elif a+b == c+d:
        print('Balanced')
    else:
        print('Right')
        
if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
#include <iostream>
#include <vector>
using namespace std;
int main(void){
  int N;
  cin >> N;
  
  vector<string>s(N);
  vector<int>t(N);
  
  for(int i=0;i<N;i++){
    cin >> s[i] >> t[i];
  }
  
  string m;
  cin >> m;
  
  int p;
  for(int i=0;i<N;i++){
    if(s[i] == m) p = i;
  }
  
  int ans = 0;
  for(int i=p+1;i<N;i++){
    ans += t[i];
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>
int main(void) {
	int N;
	scanf("%d", &N);
	int A[4];
	int b = 1000;
	for (int i = 0; i < 4; i++) {
		A[i]=(N/b)%10;
		b /= 10;
	}

	if ((A[0] == A[1] && A[1] == A[2])||(A[1]==A[2]&&A[2]==A[3])) {
		printf("Yes");
	}
	else {
		printf("No");
	}

	return 0;

}

Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <complex>
#include <vector>
#include <utility>
#define X real()
#define Y imag()
#define EPS (1e-10)
using namespace std;
typedef complex<double> P;
typedef pair<P,P> L;

namespace std{
  bool operator<(const P& a, const P& b){
    return a.X != b.X ? a.X < b.X : a.Y < b.Y;
  }
}

double dot(P a, P b){return a.X * b.X + a.Y * b.Y;}

double cross(P a, P b){return a.X * b.Y - a.Y * b.X;}


P intersection(L a, L b){
  //??´???a??¨??´???b?????????
  return a.first + cross(b.second-b.first,a.first-b.first)/(-cross(b.second-b.first,a.second-b.first)+cross(b.second-b.first,a.first-b.first))*(a.second-a.first);
}

  
int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if( cross(b,c) > EPS ) return +1;
  if( cross(b,c) < -EPS ) return -1;
  if( dot(b,c) < 0 ) return +2;
  if( abs(b-a) + EPS < abs(c-a) ) return -2;
  return 0;
}

bool is_cross(L a, L b){
  if(ccw(a.first,a.second,b.first)*ccw(a.first,a.second,b.second) <= 0 &&
     ccw(b.first,b.second,a.first)*ccw(b.first,b.second,a.second) <= 0) return true;
  return false;
}


int main(){
  int N;
  cin >> N;
  double x_s, y_s, x_t, y_t;
  for(int i = 0; i < N; ++i){
    cin >> x_s >> y_s >> x_t >> y_t;
    P a = P(x_s,y_s), b = P(x_t, y_t);
    L S = L(a,b);
    int n, o, l;
    cin >> n;
    vector<pair<P,int> > cp;
    for(int i = 0; i < n; ++i){
      cin >> x_s >> y_s >> x_t >> y_t >> o >> l;
      L T = L(P(x_s,y_s),P(x_t,y_t));
      if(is_cross(S,T))
	cp.push_back(make_pair(intersection(S,T),o^l));
    }
    sort(cp.begin(),cp.end());
    if(!cp.size()){
      cout << 0 << endl;
      continue;
    }
    int t = cp[0].second, ans = 0;
    for(int i = 1; i < (int)cp.size(); ++i){
      if(t != cp[i].second){
	++ans;
	t = cp[i].second;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3300
<?php

$n = trim(fgets(STDIN));
$a = explode(' ', trim(fgets(STDIN)));
$b = explode(' ', trim(fgets(STDIN)));
$c = explode(' ', trim(fgets(STDIN)));

$sum = array_sum($b);
for ($i = 0; $i < $n - 1; $i++) {
    if ($a[$i] + 1 === (int)$a[$i + 1]) {
        $sum += $c[$a[$i] - 1];
    }
}

echo $sum;

Measured memory_bytes: 4984
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;
const int INF = 1 << 30;

int pow(int a, int b)
{
	if(b == 0) return 1;
	return a*pow(a, b-1);
}

int tonum(int *n)
{
	int ret = 0;
	for(int i = 1; i <= 8; i++)
	{
		ret += n[8-i] * pow(10, i);
	}
	return ret;
}

int main()
{
	int F[8][8], T[8];
	int L[] = {1, 4, 1, 4, 1, 2, 1, 2};
	
	for(int i = 0; i < 8; i++)
	{
		F[0][i] = L[i];
	}

	for(int i = 1; i < 8; i++)
	{
		for(int j = 0, k = i; j < 8; j++, k++)
		{
			if(k > 7)
			{
				k = 0;
			}
			F[i][k] = F[0][j];
		}
	}
	
	while(cin >> T[0])
	{
		int res, sum = INF;
		for(int i = 1; i < 8; i++)
		{
			cin >> T[i];
		}

		for(int i = 0; i < 8; i++)
		{
			int s = 0;
			for(int j = 0; j < 8; j++)
			{
				if(T[j] - F[i][j] > 0)
				{
					s += T[j] - F[i][j];
				}
			}
			if( sum > s || s == sum && tonum(F[res]) > tonum(F[i]))
			{
				res = i;
				sum = s;
			}
		}

		for(int i = 0; i <= 7; i++)
		{
			printf("%d%s",F[res][i] ,(i!=7)?" ":"\n");
		}
	}
}

Measured memory_bytes: 1144
#include <bits/stdc++.h>
#include<algorithm>
#define ll long long
#include<cmath>
#include<string>
#include<set>
#include<vector>
#define MOD 1000000007
#define loop(a,b) for(ll i=a;i<b;i++)
#define fast_ip ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
 
int main(){
 
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
  {
      cin>>a[i];
  }
  int m[n];
  m[n-1]=0;
  for(int i=n-2;i>=0;i--)
  {
      if(a[i]>=a[i+1])
      {
          m[i]=m[i+1]+1;
      }
      else
         m[i]=0;
  }
  int ma=INT_MIN;
  for(int i=0;i<n;i++)
  {
      if(ma<m[i])
         ma=m[i];
  }
  cout<<ma<<"\n";
  
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> i_i;

#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((int)(x).size())
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    ll X;
    cin >> X;
    ll a = 100;
    int i = 0;
    while(1){
        a = (ll)(a * 1.01);
        i++;
        if (a >= X){
            cout << i;
            return 0;
        }
    }
    
    return 0;
}



Measured memory_bytes: 3636
#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main()
{

	int s;
	scanf("%d", &s);

	int hour = s / 3600;
	int min = s % 3600 / 60;
	int sec = s % 3600 % 60;
	printf("%d:%d:%d\n", hour,min,sec );

	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  int ans=0;
  string s;
  cin >> s;
  if(s[0]=='1') {
    ans++;
  }
  if(s[1]=='1') {
    ans++;
  }
  if(s[2]=='1') {
    ans++;
  }
  cout << ans << endl;
}

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

int main(){

  int r,g,b,val;
  cin >> r >> g >> b;
  val = 100 * r + 10 * g + b;
  if(val%4 == 0){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}


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

int main(void){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(abs(c-a) <= d || (abs(b-a) <= d && abs(c-b) <= d)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

using namespace std;

int n;
long long a[100009];

void enter()
{
    cin >> n;
    for (int i=1; i<=n; i++)
        cin >> a[i];
}

long long dp[100009];

void optimize()
{
    dp[2] = abs(a[2] - a[1]);
    for (int i=3; i<=n; i++)
        dp[i] = min(abs(a[i] - a[i-1]) + dp[i-1], abs(a[i] - a[i-2]) + dp[i-2]);
    cout << dp[n];
}

int main() 
{
    enter();
    optimize();
	return 0;
}

Measured memory_bytes: 1792
import Data.List

solver::Int -> [Int]->[Int]->Int
solver n vs cs = (sum.(takeWhile (0<)).(take n).(sortBy (\ x -> \ y -> compare y x)).(map (\ (v,c) -> v-c))) (zip vs cs)



main::IO()
main=do
  n<-return.read=<<getLine
  vs<-return.map read.words=<<getLine
  cs<-return.map read.words=<<getLine
  print (solver n vs cs)


Measured memory_bytes: 636
#include<stdio.h>

int insertionsort(int a[], int n, int g, int cnt);
void shellsort(int a[], int n);


int main(void)
{
	int n;
	scanf("%d", &n);
	int a[n];
	int i;
	for(i=0; i<n; i++){
		scanf("%d", &a[i]);
	}
	
	shellsort(a, n);
	
	return 0;
}

int insertionsort(int a[], int n, int g, int cnt)
{
	int v, j, i;
	for(i=g; i<n; i++){
		v = a[i];
		j = i-g;
		while (j>=0 && a[j]>v){
			a[j+g] = a[j];
			j=j-g;
			cnt++;
		}
		a[j+g] = v;
	}
	return cnt;
}

void shellsort(int a[], int n)
{
	int i;
	int cnt = 0;
	int g[n];
	int m = 0;
	
	for(int h=1; ;){
		if(h > n) break;
		g[m] = h;
		h = 3*h+1;
		m++;
	}
	
	printf("%d\n", m);
	
	for(i=m-1; i>=0; i--){
		if(i != m-1) printf(" ");
		printf("%d", g[i]);
	}
	printf("\n");
	
	for(i=m-1; i>=0; i--){
		cnt = insertionsort(a, n, g[i],cnt);
	}
	printf("%d\n", cnt);
	for(i=0; i<n; i++){
		printf("%d\n", a[i]);
	}
}


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

int main() {
	// your code goes here
	string s[7] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
	string t;
	cin >> t;
	int i;
	for( i = 0; i < 7; ++i){
		if(t==s[i]) break;
	}
	cout << 7 - i;
	return 0;
}

Measured memory_bytes: 256
//
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
// #define MOD 1000000007
#define rp(i,n) for(int i=0;i<(n);++i)
#define up(i,s,e,d) for(int i=(s);i<(e);i+=(d))
#define ot(x) cout<<(x)
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()

int main(){
	string a,b,c; cin>>a>>b>>c;
	string ans ={a[0],b[1],c[2]};
	ote(ans);
}


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


int main()
{
    int S, W;
    cin >> S >> W;

    if( S <= W ){
        cout << "unsafe" << endl;
    }
    else
    {
        cout << "safe" << endl;
    }

    return 0;
}

Measured memory_bytes: 3596
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		boolean[] leapYearFlag=new boolean[3000];
		for(int i=0;i<3000;i++){
			if(i%4==0&&i%100!=0||i%400==0){
				leapYearFlag[i]=true;
			}
		}
		int a=sc.nextInt();
		int b=sc.nextInt();
		while(true){
			boolean flag=false;
			for(int i=a;i<=b;i++){
				if(leapYearFlag[i]){
					System.out.println(i);
					flag=true;
				}
			}
			if(!flag){
				System.out.println("NA");
			}
			a=sc.nextInt();
			b=sc.nextInt();
			if(a==0&&b==0){
				break;
			}else{
				System.out.println();
			}
		}
	}
}

Measured memory_bytes: 20864
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
long long n;
vector<char> a;
string x="abcdefghijklmnopqrstuvwxyz";
int main(){
	cin>>n;
	while(n){
		n--; 
		a.push_back(x[n%26]);
		n/=26;
	}
	reverse(a.begin(),a.end());
	for(int i=0;i<a.size();i++) 
		cout<<a[i];
	return 0;
}


Measured memory_bytes: 3620
#include <iostream>

using namespace std;

void solve()
{
	int n;
	while(cin >> n, n)
	{
		while(n--)
		{
			int x1, y1, z1, w1, x2, y2, z2, w2;
			cin >> x1 >> y1 >> z1 >> w1 >> x2 >> y2 >> z2 >> w2;
			cout << x1 * x2 - y1 * y2 - z1 * z2 - w1 * w2 << " " << x1 * y2 + y1 * x2 + z1 * w2 - w1 * z2 << " " << x1 * z2 + z1 * x2 - y1 * w2 + w1 * y2 << " " << x1 * w2 + w1 * x2 + y1 * z2 - z1 * y2 << endl;
		}
	}
}

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

Measured memory_bytes: 1160
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        int n,m;
        int result = 0;
        
		Scanner scanner = new Scanner(System.in);
		n = scanner.nextInt();
		m = scanner.nextInt();
		int A[][] = new int[n][m];
		int b[]   = new int[m];
		
		for(int i = 0;i < n;i++){
			for(int j = 0;j < m;j++){
				A[i][j] = scanner.nextInt();
			}
		}
		
		for(int i = 0;i < m;i++){
			b[i] = scanner.nextInt();
		}
		
		for(int i = 0;i < n;i++){
			for(int j = 0;j < m;j++){
				result += A[i][j]*b[j];
			}
			System.out.println(result);
			result = 0;
		}
    	scanner.close();
    }
}

Measured memory_bytes: 40388
#include <iostream>
#include <math.h>
using namespace std;

int main()
{
	double x[4];
	double y[4];
	while (true)
	{
		for (int i = 0; i < 4; i++)
		{
			if (!(cin >> x[i] >> y[i])) return 0;
		}

		double dx1 = x[1] - x[0];
		double dy1 = y[1] - y[0];
		double dx2 = x[3] - x[2];
		double dy2 = y[3] - y[2];
		double innerProduct = (dx1 * dx2) + (dy1 * dy2);

		if (fabs(innerProduct) < 0.000000000001) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}

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

#define    int               long long int
 #define    bp(x)         __builtin_popcount(x)
#define  ld         long double
 #define  f(i,j,n)            for(int i = j; i <= n; i++)
#define  r(i,n,j)       for(int i = n; i >= j; i--)
 #define  all(container)       container.begin() , container.end()
#define  sz(container)   (int)container.size()
 #define  ff             first
#define  ss             second
 #define  pii      pair <int , int>
#define  sp(x)       setprecision(x)
 #define  endl    "\n"
#define  mod  1000000007
 #define  pb    push_back
#define  mp    make_pair
 #define  T     int ttt; cin >> ttt; while(ttt--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);

int power(int x, int y, int p)  
{  
    int res = 1;    
    x = x % p; 
    if (x == 0) return 0; 
    while (y > 0)  
    {     
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res; 
}

int32_t main()
{
    fast
    int n;  cin>>n;
    if(n==1)    cout<<"0";
    else{
        int ans=power(10,n,mod) + power(8,n,mod);
        ans=(ans+mod + mod -power(9,n,mod))%mod;
         ans=(ans+mod + mod -power(9,n,mod))%mod;
        
        cout<<ans;
    }
}

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

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    int r = 0;

    cin >> r;

    cout << 2 * r * 3.141592 << endl;
}


Measured memory_bytes: 3764
fun main(args: Array<String>) {
    val mod = 1000000007
    val N = readInputLine().toInt()
    val minFactor = IntArray(N + 1, { -1 })
    val isPrime = BooleanArray(N + 1, { true })
    
    isPrime[0] = false
    isPrime[1] = false
    minFactor[0] = 0
    minFactor[1] = 1
    
    for (i in 2..N) {
        if (isPrime[i]) {
            minFactor[i] = i
            for (j in i * 2..N step i) {
                isPrime[j] = false
                if (minFactor[j] == -1) {
                    minFactor[j] = i
                }
            }
        }
    }
    
    val factorCount = mutableMapOf<Int, Int>()

    for (i in 2..N) {
        var tmp = i
        while (tmp != 1) {
            val cnt = factorCount.get(minFactor[tmp]) ?: 0
            factorCount.put(minFactor[tmp], cnt + 1 % mod)
            tmp /= minFactor[tmp]
        }
    }

    var ans = 1L
    
    for (factorNum in factorCount.values) {
        ans *= (factorNum + 1)
        ans %= mod
    }
    
    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}


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

int main() {
  int N;
  string S;
  cin >> N >> S;
  
  int ans = 0;
  for (int i = 0; i < N - 2; ++i) {
    if (S[i] == 'A' && S[i + 1] == 'B' && S[i + 2] == 'C') ++ans;
  }
  
  cout << ans << endl;
  return 0;
}

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

using namespace std;
const int maxn = 1e5+7;
typedef long long ll;

int main()
{
	ll a,b,ans=0;
	cin>>a>>b;
	ll cnt=__gcd(a,b);
	for(ll i=2;i*i<=cnt;i++){
		if(cnt%i==0){
			ans++;
			while(cnt%i==0){
				cnt/=i;
			//	cout<<c<<endl;
			}
		}
	}
	ans++;
	if(cnt!=1)
		ans++;   //1 de qing kuang
	cout<<ans<<endl;
}
/*
6
2 3
60 
2 3 5  
1
1 
*/ 

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*) array, (T*) (array + N), val);
}
pii Dir [] = {
	{ 1,0 },{ 0,1 }
};

signed main() {
	char str [100001];
	scanf("%s", str);
	int len = strlen(str);
	char kah = -1;
	if (len == 2 && str[0] == str[1]) {
		printf("1 2\n");
		return 0;
	}
	REP(i, len) {
		map<char, int> cou;
		rep(j, i, min(i+3,len)) {
			cou[str[j]]++;
		}
		for (auto itr : cou) {
			if (itr.second >= 2) {
				printf("%d %d\n", i+1, i+3);
				return 0;
			}
		}
	}
	printf("-1 -1\n");
	return 0;
}

Measured memory_bytes: 384
/*#include<iostream>
#include<algorithm>
using namespace std;
int partition(int A[],int p,int r){
     
    int x=A[r-1];
    int i=p-1;
 
 
    for(int j=p;j<r;j++){
        if(A[j]<=x){
            i++;
        if(i>=0&&j>=0)
        swap(A[i],A[j]);    
        }
        //swap(A[i],A[r-1]);
    }
 
    //swap(A[i],A[r-1]);
    return i;
 
}
 
 
 
int main(){
    int tmp[1000000];
    int n;
    cin>>n;
 
    for(int i=0;i<n;i++){
        cin>>tmp[i];
    }
 
    int q;
 
    q=partition(tmp,0,n);
     
    for(int i=0;i<n;i++){
         
        if(i==q){
            cout<<"["<<tmp[i]<<"]";
        }
         
        else cout<<tmp[i];
 
        if(i==n-1)cout<<endl;
        else cout<<" ";
    }
 
    return 0;
}*/

#include<iostream>
#include<algorithm>
using namespace std;
const int MAX_N=100000;
	struct card{
		char mark;
		int num;
		int index;
	};
	card table[MAX_N];

	int partitation(int q,int r){
		int x=table[r].num;
		int i=q-1;
		for(int j=q;j<r;j++){
			if(table[j].num<=x){
				i++;
				swap(table[i],table[j]);
			}
		}
		swap(table[i+1],table[r]);
		return i+1;
	}

	void quicksort(int a,int b){
		if(a<b){
		int tmp;
		tmp=partitation(a,b);
		quicksort(a,tmp-1);
		quicksort(tmp+1,b);
		}
	}
	int main(){
 		int n;
		cin>>n;
 		for(int i=0;i<n;i++){
			cin>>table[i].mark>>table[i].num;
			table[i].index=i;
		}
		quicksort(0,n-1); 
 		bool is=true;
		for(int i=1;i<n;i++){
			if(table[i-1].num==table[i].num&&table[i-1].index>table[i].index)is=false;
		}
		if(is)cout<<"Stable\n";
		else cout<<"Not stable\n";
		for(int i=0;i<n;i++){
			cout<<table[i].mark<<" "<<table[i].num<<endl;
		}
		return 0;
	}

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

const int MAXN = 105;

long long a[MAXN];
int x, n;

int main()
{
	cin >> n >> x;
	for (int i = 1; i <= n; i++) cin >> a[i];
	sort(a+1, a+n+1);
	for (int i = 1; i <= n; i++) a[i] += a[i-1];
	if (a[n] == x) {
		cout << n << endl;
		return 0;
	}
	for (int i = n-1; i >= 1; i--)
		if (a[i] <= x) {
			cout << i << endl;
			return 0;
		}
	cout << 0 << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vstring vector<string>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 100000000


ll gcm(ll a,ll b);
ll lcm(ll a,ll b);
ll fac(ll a);

int main(){
  ll x;
  cin >> x;
  ll ans = 0;
  ans = x / 11 * 2;
  x %= 11;
  if(x >= 6){
    x -= 6;
    ans++;
  }
  if(x >= 1){
    x -= 5;
    ans++;
  }
  cout << ans << endl;
}

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

int parent(int i)
{
    return i / 2;
}

int left(int i)
{
    return 2 * i;
}

int right(int i)
{
    return (2 * i + 1);
}

int main()
{
    int H, i, A[MAX + 1];

    cin >> H;

    for (i = 1; i <= H; i++) cin >> A[i];

    for (i = 1; i <= H; i++)
    {
        cout << "node " << i << ": key = " << A[i] << ", ";
        if (parent(i) >= 1) cout << "parent key = " << A[parent(i)] << ", ";
        if (left(i) <= H) cout << "left key = " << A[left(i)] << ", ";
        if (right(i) <= H) cout << "right key = " << A[right(i)] << ", ";
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

template<class T>
struct Edge{
	int from,to;
	T cost;
	Edge(int to,T cost) : to(to),cost(cost){}
	Edge(int from,int to,T cost) : from(from),to(to),cost(cost){}
};

template<class T>
using WeightedGraph = vector<vector<Edge<T>>>;
using Graph = vector<vector<int>>;
template<class T>
using Matrix = vector<vector<T>>;

template<class T>
vector<T> dijkstra(const WeightedGraph<T> &G,int source = 0){
	using P = pair<T,int>;
	vector<T> dist(G.size(),INF);
	priority_queue<P,vector<P>,greater<P>> que;
	dist[source] = 0;
	que.emplace(dist[source],source);
	while(!que.empty()){
		P p = que.top();que.pop();
		int v = p.second;
		if(dist[v] < p.first) continue;
		for(const auto &e : G[v]){
			if(dist[e.to] > dist[v] + e.cost){
				dist[e.to] = dist[v] + e.cost;
				que.emplace(dist[e.to],e.to);
			}
		}
	}
	return dist;
}

signed main(){
	int n,m;
	cin >> n >> m;
	WeightedGraph<int> G(n * 3);
	for(int i = 0;i < m;i++){
		int u,v;
		cin >> u >> v; u--;v--;
		for(int j = 0;j < 3;j++){
			G[u + n * j].emplace_back(v + n * ((j + 1) % 3),1);
		}
	}
	int s,t;
	cin >> s >> t; s--;t--;
	auto dist = dijkstra(G,s);
	if(dist[t] != INF && dist[t] % 3 == 0) cout << dist[t] / 3 << endl;
	else cout << -1 << endl;
}

Measured memory_bytes: 18944
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
using ull = unsigned long long;

typedef pair< long long, long long > P;
typedef pair< long long, P > PP;
typedef pair< P, P > PPP;

const double DINF = 5e14, eps = 1e-10;
const long long MOD = 1e9 + 7, INF = 5e18;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };

#define fr first
#define sc second
#define pb push_back
#define eb emplace_back
#define ALL(x) (x).begin(),(x).end()

int n, ans = 10000;

int dig(int s) {
	int ret = 0;
	while (s) {
		ret += s % 10;
		s /= 10;
	}
	return ret;
}

int main() {
	cin >> n;
	for (int a = 1;a < n;a++) {
		ans = min(ans, dig(a) + dig(n - a));
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;

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

#define ll long long

int main()
{
	vector<int> n(3);
	rep (i, 3)
		cin >> n[i];
	sort(all(n), greater<int>());
	int ans = n[0] * 10 + n[1] + n[2];
	cout << ans << endl;
}



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

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

const long long INF = 1LL << 60;

int main ()
{
    int a,b,c,d;    cin >> a ;
    vector<int>v(a);
    for(int i=0;i<a;i++)    cin >> v.at(i);
    int cnt=1;
    b=v.at(0);
    for(int i=1;i<a;i++){
        if(v.at(i)<b){   
            b=v.at(i);
            cnt++;
        }
    }

    cout << cnt << endl;
    
}

     



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

int main() {
  int64_t n,ans = 0;
  cin >> n;
  for(int i=1; i<=n; i++) {
    if(i%3 == 0 || i%5 == 0) continue;
    ans += i;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3652
int main(){
  int n;
  scanf("%d\n",&n);
  char str[n+1];
  scanf("%s\n",str);
  int x=0,i,k,d=0;
  for(i=0;i<n;i++){
    if(str[i]=='I') x++;
    if(str[i]=='D') x--;
    k = x;
    if(k>d) d=k;
  }
  printf("%d\n",d);
  return 0;
}

Measured memory_bytes: 1708
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int mod = 1e9 + 7;
const int inf = 2e18;

signed main() {
    vector<int> A(3);
    cin >> A;
    sort(A.begin(), A.end());
    if ((A[0] == A[1] && A[1] != A[2]) || (A[1] == A[2] && A[0] != A[1])) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int mod = 1000000007;
struct mint{
	ll x;
	mint(ll x = 0):x((x%mod+mod)%mod){}
	mint operator-() const{return mint(-x);}
	mint& operator+=(const mint a){
		if((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a){
		if((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a){
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const{
		mint res(*this);
		return res+=a;
	}
	mint operator-(const mint a) const{
		mint res(*this);
		return res-=a;
	}
	mint operator*(const mint a) const{
		mint res(*this);
		return res*=a;
	}
	mint pow(ll t) const{
		if(!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if(t&1) a *= *this;
		return a;
	}
	mint inv() const{
		return pow(mod-2);
	}
	mint& operator/=(const mint a){
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const{
		mint res(*this);
		return res/=a;
	}
	bool operator==(const mint a){
		return x == a.x;
	}
};

//istream& operator>>(istream& is, const mint& a){return is >> a.x;}
//ostream& operator<<(ostream& os, const mint& a){return os << a.x;}

// 2^n
mint f(int n){
	if(n == 0) return 1;
	mint x = f(n/2);
	x *= x;
	if(n%2 == 1) x *= 2;
	return x;
}

// nCa
mint choose(int n, int a){
	mint x = 1, y = 1;
	rep(i,a){
		x *= n-i;
		y *= i+1;
	}
	return x / y;
}

struct Combination{
	vector<mint> fact, ifact;
	Combination(int n):fact(n+1),ifact(n+1){
		assert(n < mod);
		fact[0] = 1;
		for(int i = 1; i <= n; i++) fact[i] = fact[i-1]*i;
		ifact[n] = fact[n].inv();
		for(int i = n; i >= 1; i--) ifact[i-1] = ifact[i]*i;
	}
	mint operator()(int n, int k){
		if(k < 0 || k > n) return 0;
		return fact[n]*ifact[k]*ifact[n-k];
	}
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a[i];
	sort(a.begin(), a.end());
	vector<mint> two(n+1);
	two[0] = 1;
	rep(i,n) two[i+1] = two[i] * 2;
	mint ans = 0;
	rep(i,n){
		int l = i, r = n-1-i;
		mint now = two[r];
		if(r != 0) now += two[r-1] * r;
		now *= two[l];
		now *= a[i];
		ans += now;
	}
	ans *= two[n];
	cout << ans.x << endl;
	return 0;
}


Measured memory_bytes: 5504
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <limits.h>
using namespace std;

int main()
{
    int n;
    cin >> n;
    std::vector<int> a;
    for(int i=0; i<n; i++){
        int tmp;
        cin >> tmp;
        a.push_back(tmp);
    }
    std::sort(a.begin(), a.end());
    
    int maxnum = a[n-1];
    int dp[maxnum+1];
    for(int i=1; i<maxnum+1; i++) dp[i] = 0;
    
    for(int i=0; i<n; i++){
        int num = a[i];
        //cout << "--- " << num << endl;
        for(int j=num; j<=maxnum; j+=num){
            //cout << "  cnt " << j << endl;
            dp[j]++;
        }
    }
    //for(int i=1; i<maxnum+1; i++) cout << dp[i] << ", ";
    //cout << endl;
    
    long long int cnt = 0;
    for(int i=0; i<n; i++){
        int num = a[i];
        if(dp[num] == 1) cnt++;
    }

    cout << cnt << endl;       
    return 0;
}

Measured memory_bytes: 7948
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,k,j,m;
    cin>>n>>k;
    long int h[n],c[n];
    for(i=0;i<n;i++)
    {
       cin>>h[i];
       c[i]=999999999;
    }
    c[0]=0;
    for(i=0;i<n-1;i++)
    {
        for(j=1;j<=k;j++)
        {
            if(i+j<n)
            {
                m=c[i]+abs(h[i+j]-h[i]);
                    if(m<c[i+j])
                        c[i+j]=m;
            }
        }
    }
    cout<<c[n-1];
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
typedef long long int ll;
typedef long double ld;
using namespace std;

//-------------------------------------------------------------------
#define P 1000000007
#define N_MAX 2000000
typedef long long int ll;
ll fac[N_MAX+1];
ll inv[N_MAX+1];
ll finv[N_MAX+1];

ll comb(ll n, ll k){
    return (((fac[n]*finv[n-k])%P)*finv[k])%P;
}

void init(){
    fac[0] = finv[0] = fac[1] = finv[1] = inv[1] = 1;
    for(int i = 2; i <= N_MAX; i++){
        fac[i] = (fac[i-1]*i)%P;
        inv[i] = ((-(P/i)*inv[P%i])%P+P)%P;
        finv[i] = (finv[i-1]*inv[i])%P;
    }
}
ll pp(ll a, ll b){
  return (a * b)%P;
}
//-------------------------------------------------------------------
int main(int argc, char const *argv[]) {
  ll ans = 1, n;std::cin >> n;
  vll x(n);re(i, n) std::cin >> x[i];
  init();
  ll now=0;
  re(i, n){
    while(now!=n-1){
      if((x[now]/2 + (x[now]%2==1?1:0))<now+1-i) break;
      now++;
    }
    //std::cout << now << '\n';
    ans = pp(ans, now+1 - i);
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 47872
// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define pi pair<int,int> 
#define pii pair<pi,int>
#define ull unsigned long long
#define vi vector<int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
ll fastexp(ll x,ll a){
    ll res = 1;
    while(a>0){
        if(a&1){
            res = (res*x)%mod;
        }
        a=a>>1;
        x=(x*x)%mod;
    }
    return res;
}
ll inverse(ll n){
    return fastexp(n,mod-2);
}
template <typename T>
void add(T &a, T b){
	a += b;
	if(a >= mod)a -= mod;
}
template <typename T>
void sub(T &a, T b){
	a -= b;
	if(a < 0)a += mod;
}
template <typename T>
void mul(T &a, T b){
	a *= b;
	if(a >= mod)a %= mod;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	n %= 1000;
	if(n != 0){
		n = 1000-n;
	}
	cout<<n;
	
	// n = 1000-n;	
	return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <cstdio>

using namespace std;

int main(int argc, char *argv[]) {
  int ver, hor;

  cin >> ver;
  cin >> hor;
  int nums[ver];
  for (int i = 0; i < ver; i++)
    nums[i] = i+1;
  
  int tmp, a, b;
  for (int i = 0; i < hor; i++) {
    scanf("%d,%d", &a, &b);
    a--; b--;
    tmp = nums[a];
    nums[a] = nums[b];
    nums[b] = tmp;
  }

  for (int i = 0; i < ver; i++)
    cout << nums[i] << endl;
  return 0;
}

Measured memory_bytes: 1240
#include <stdio.h>

int main() {
    int h, w, n, ops = 0, c = 0;
    scanf("%d", &h);
    scanf("%d", &w);
    scanf("%d", &n);
    while (n > ops) {
        if (w > h) {
            ops += w;
            c++;
        } else {
            ops += h;
            c++;
        }
    }
    printf("%d", c);
}

Measured memory_bytes: 1732
n = int(input())

a = [[0 for i in range(10)]for j in range(10)]
ans = 0

for i in range(n):
    np = str(i+1)
    s = len(np)
    r1 = np[-1]
    r2 = np[-s]
    
    a[int(r1)][int(r2)] += 1
                    
for i in range(10):
    for j in range(10):
        ans += a[i][j]*a[j][i]
        
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
     
     
typedef long long ll;
typedef vector <int> vi;
typedef pair <int,int> pi;
typedef tuple <int,int,int> ti;

#define forn(i,a,n) for(int i = a; i < n ; i++)
#define mem(str,a) memset(str, a, sizeof(str));
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(nullptr)
const int MOD = 1e9+7, N = 1e7 + 10, E = 1e-9;
/*
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
//vector <int> show;
//for (auto x : show)
//   cout << x << " ";
getline(cin,s);


*/

int main() {
    int x;
    cin >> x;
    if(x < 1200) cout << "ABC" << endl;
    else cout << "ARC" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
const ll longinf=1ll<<60;
const int inf=(1<<30)-1;


int main(){
    string s;
    cin>>s;
    ll ans=0;
    ll n=15-s.size();
    for(auto t:s){
        if(t=='o') ans++;
    }
    if(ans+n>=8) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

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

int main() {
    int64_t N, Q;
    std::cin >> N >> Q;

    atcoder::dsu d(N);
    for (int64_t i = 0; i < Q; i++) {
        int64_t t, u, v;
        cin >> t >> u >> v;
        if (t == 0) {
            d.merge(u, v);
        } else {
            std::cout << d.same(u, v) << std::endl;
        }
    }
}

Measured memory_bytes: 4004
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define debug(x) cerr << "\n" \
                      << #x << ": " << x << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define INF 1e9
#define pii pair<int, int>
#define pt(xx) cout << "\n" \
                    << xx << "\n"
#define debugv(x, n)               \
    cout << "\n"                   \
         << #x << ": ";            \
    rep(i, n) cout << x[i] << " "; \
    cout << endl
#define debug2d(x, m, n)            \
    cout << "\n"                    \
         << #x << " is: \n";        \
    for (int i = 0; i < m; ++i)     \
    {                               \
        for (int j = 0; j < n; ++j) \
        {                           \
            cout << x[i][j] << " "; \
        }                           \
        cout << endl;               \
    }
#define nl cout << endl

#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

int N, K;
int ans;
int dp[100005][2] = {};

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

    string L;
    cin >> L;

    /*
        a+b<=L
        a+b==a^b

        を満たすa,bの組の数
    */

   dp[0][0] = 1;
   
    for (int i = 0; i < L.size(); i++) {
        if (L[i] == '0') {
            dp[i+1][0] = dp[i][0]; // no change
            dp[i+1][1] = dp[i][1]; // no change

            //a+b=1
            dp[i+1][1] += dp[i][1]*2; // 2通り
        } else { // L[i]が1
            dp[i+1][1] = (dp[i][0] + dp[i][1]) % MOD;

            dp[i+1][0] += dp[i][0]*2;
            dp[i+1][1] += dp[i][1]*2;
        }
        dp[i+1][1] %= MOD;
        dp[i+1][0] %= MOD;
    }

    ans = (dp[L.size()][0] + dp[L.size()][1]) % MOD;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 2048