akhauriyash/Code-Regression huggingface dataset:
#include <numeric>
#include <vector>
#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <numeric>
using namespace std;


    


int main(const int args, const char* argv[])
{
    array<array<int, 6>, 6> S;

    S[0] = array<int, 6>({0, 0, 0, 0, 1, 0});
    S[1] = array<int, 6>({1, 0, 0, 0, 0, 0});
    S[2] = array<int, 6>({0, 0, 1, 0, 0, 0});
    S[3] = array<int, 6>({0, 0, 0, 1, 0, 0});
    S[4] = array<int, 6>({0, 0, 0, 0, 0, 1});
    S[5] = array<int, 6>({0, 1, 0, 0, 0, 0});

    array<array<int, 6>, 6> N;

    N[0] = array<int, 6>({0, 1, 0, 0, 0, 0});
    N[1] = array<int, 6>({0, 0, 0, 0, 0, 1});
    N[2] = array<int, 6>({0, 0, 1, 0, 0, 0});
    N[3] = array<int, 6>({0, 0, 0, 1, 0, 0});
    N[4] = array<int, 6>({1, 0, 0, 0, 0, 0});
    N[5] = array<int, 6>({0, 0, 0, 0, 1, 0});

    array<array<int, 6>, 6> W;

    W[0] = array<int, 6>({0, 0, 1, 0, 0, 0});
    W[1] = array<int, 6>({0, 1, 0, 0, 0, 0});
    W[2] = array<int, 6>({0, 0, 0, 0, 0, 1});
    W[3] = array<int, 6>({1, 0, 0, 0, 0, 0});
    W[4] = array<int, 6>({0, 0, 0, 0, 1, 0});
    W[5] = array<int, 6>({0, 0, 0, 1, 0, 0});

    array<array<int, 6>, 6> E;

    E[0] = array<int, 6>({0, 0, 0, 1, 0, 0});
    E[1] = array<int, 6>({0, 1, 0, 0, 0, 0});
    E[2] = array<int, 6>({1, 0, 0, 0, 0, 0});
    E[3] = array<int, 6>({0, 0, 0, 0, 0, 1});
    E[4] = array<int, 6>({0, 0, 0, 0, 1, 0});
    E[5] = array<int, 6>({0, 0, 1, 0, 0, 0});

    array<int, 6> input;
    for(int i = 0; i < 6; i++)
    {
        int tmp;
        cin >> tmp;
        input[i] = tmp;
    }
    
    string opInput;
    cin >> opInput;
    for(auto& it:opInput)
    {
        array<int, 6> tmpInput(input);
        if(it == 'S')
        {
            for(int i = 0; i < 6; i++)
            {
                for(int j = 0; j < 6; j++)
                {
                    if(S[i][j] * tmpInput[j] != 0) input[i] = S[i][j] * tmpInput[j];
                }
            }
        }
        if(it == 'W')
        {
            for(int i = 0; i < 6; i++)
            {
                for(int j = 0; j < 6; j++)
                {
                    if(W[i][j] * tmpInput[j] != 0) input[i] = W[i][j] * tmpInput[j];
                }
            }
        }
        if(it == 'E')
        {
            for(int i = 0; i < 6; i++)
            {
                for(int j = 0; j < 6; j++)
                {
                    if(E[i][j] * tmpInput[j] != 0) input[i] = E[i][j] * tmpInput[j];
                }
            }
        }
        if(it == 'N')
        {
            for(int i = 0; i < 6; i++)
            {
                for(int j = 0; j < 6; j++)
                {
                    if(N[i][j] * tmpInput[j] != 0) input[i] = N[i][j] * tmpInput[j];
                }
            }
        }
    }
    cout << input[0] << endl;

    return 0;
}


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main()
{
    ll N; 
    cin >> N;
    vector<ll> A(N);
    vector<ll> I(N);

    REP(i,N){
        ll a;
        cin >> a;
        A[i] = a;
        I[i] = a;        
    }
    sort(A.begin(), A.end());

    map<ll,ll> M;

    ll now = A[0];
    ll count = 0;
    ll total = 0;
    REP(i, N){
        if(A[i] == now){
            count++;
        }
        else{
            M[A[i-1]] = count;
            total += count*(count-1)/2;
            count = 1;
            now = A[i];
        }
    }
    M[A[N-1]] = count;
    total += count*(count-1)/2;

    REP(i, N){
        // cout << "i:" << i << endl;
        if(M[I[i]] == 1){
            cout << total << endl;
        }
        else{
            cout << total - M[I[i]] * (M[I[i]]-1) / 2 + (M[I[i]]-1) * (M[I[i]]-2) / 2 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 14208
a,b,c = map(int,input().split())
d=0
if a+b+c == 17:
  if a == 7 or a == 5:
    if b == 7 or b == 5:
      if c == 7 or c == 5:
        print("YES")
        d =1
        
if d == 0:print("NO")
        

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
const int MAX = 1000*1000+10;
string a, b;
int main()
{
    ios_base::sync_with_stdio(false);
    cin >> a >> b;
    int wynik = (a[0] == b[0]);
    wynik += (a[1] == b[1]) + (a[2] == b[2]);
    cout << wynik << "\n";
}


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

int n, t, a[111], res;
int main()
{
    cin >> n;
    while(n--)
    {
        cin >> t;
        if(!a[t])
        {
            a[t] = 1;
            ++res;
        }
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    string T;
    cin >> T;
    bool N = false;
    bool S = false;
    bool E = false;
    bool W = false;
    rep(i,T.size()){
        if (T[i] == 'S') S = true;
        if (T[i] == 'E') E = true;
        if (T[i] == 'W') W = true;
        if (T[i] == 'N') N = true;
    }
    if (S && !N) cout << "No" << endl;
    else if (N && !S) cout << "No" << endl;
    else if (E && !W) cout << "No" << endl;
    else if (W && !E) cout << "No" << endl;
    else cout << "Yes" << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(auto (i) = (n)*0; (i) < (n); (i)++)
#define RNG(i, a, b) for(auto (i) = (a); (i) < (b); (i)++)
#define RBF(i, v) for(auto& (i) : (v))
#define ALL(x) (x).begin(), (x).end()

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }

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

	int ans = 1;
	while (ans <= 1250) {
		int a2 = ans * 8 / 100;
		int b2 = ans * 10 / 100;
		if (a == a2 && b == b2) {
			col(ans);
			return 0;
		}
		ans++;
	}

	col(-1);
	return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)	for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define GI(i) (scanf("%d",&i))
#define pb          push_back
#define mp          make_pair
#define mt          make_tuple
#define get0(x)     (get<0>(x))
#define get1(x)     (get<1>(x))
#define get2(x)     (get<2>(x))
#define ALL(X)      (X).begin(),(X).end()
#define LLMAX       9223372036854775807LL
#define LLMIN       -9223372036854775808LL
#define IMAX        2147483647
#define IMIN        -2147483648
typedef long long LL;

using namespace std;

int XY[2];
vector<int> ls[2];
vector<int> S;

char cache[10000][20000][2];
char rec(int i,int p,int k){
    char &res=cache[i][p+10000][k];
    if(res!=-1){
        ;
    }else if(i==SZ(ls[k])){
        if(XY[k]==p)
            res=true;
        else
            res=false;
    }else{
        if(ls[k][i]<0)
            res=rec(i+1,p-ls[k][i],k);
        else
            res=rec(i+1,p-ls[k][i],k) || rec(i+1,p+ls[k][i],k);
    }
    return res;
}

int main(void){
    string t;
    cin>>t>>XY[0]>>XY[1];
    memset(cache,-1,sizeof(cache));
    int i=0,j=0;
    while(i<SZ(t)){
        while(j<SZ(t)&&t[i]==t[j])
            j++;
        if(t[i]=='F')
            S.pb(j-i);
        else
            S.pb(((j-i)%2==0)?-2:-1);
        i=j;
    }
    int d=0;
    REP(i,SZ(S)){
        if(S[i]==-2){
        }else if(S[i]==-1){
            d^=1;
        }else{
            ls[d].pb((i==0)?-S[i]:S[i]);
        }
    }

    if(rec(0,0,0)&&rec(0,0,1))
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


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

#define ll long long

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ll a, b, c;
  cin >> a >> b >> c;
  ll rhs = c - a - b;
  if (rhs <= 2) cout << "No\n";
  else if (4 * a * b < rhs * rhs) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}

Measured memory_bytes: 256
import math
import sys
from heapq import heappush, heappop


def solution(arr, moves):
    if len(arr) <= moves:
        return 0

    arr.sort()
    if moves == 1:
        return abs(arr[0] - arr[-1])

    heapq_max = []
    # place them then scan the array
    # right side of longest interval

    for i in range(0, len(arr) - 1):
        heappush(heapq_max, (-abs(arr[i] - arr[i + 1] ), i , i + 1))

    placed = [0]
    for _ in range(moves - 1):
        val = heappop(heapq_max)
        placed.append(val[2])

    placed.sort()
    counter = 0
    for i in range(len(placed) - 1):
        if (abs(placed[i] -  placed[i + 1]) > 1):
            counter += abs(arr[placed[i]] - arr[placed[i + 1] - 1])
    if placed[-1] != len(arr) - 1:
        counter += abs(arr[placed[-1]] - arr[-1])
    return counter

    # visited = {}
    # current_positions = {}
    #
    # for i in list(reversed(sorted(d, key=lambda x: x[1])))[:moves]:
    #     visited[i[0]] = True
    #     current_positions[i[0]] = True
    #
    # counter = 0
    # while len(visited) < len(arr):
    #     min_on_position = sys.maxsize
    #     minimum_element = None
    #     side = None
    #     for i in current_positions:
    #         if i - 1 not in visited and i > 0:
    #             if min_on_position > abs(arr[i - 1] - arr[i]):
    #                 min_on_position = abs(arr[i - 1] - arr[i])
    #                 minimum_element = i
    #                 side = i - 1
    #
    #         if i + 1 not in visited and i < len(arr) - 1:
    #             if min_on_position > abs(arr[i + 1] - arr[i]):
    #                 min_on_position = abs(arr[i + 1] - arr[i])
    #                 minimum_element = i
    #                 side = i + 1
    #
    #
    #     current_positions[side] = True
    #     visited[side] = True
    #     counter += abs(arr[minimum_element] - arr[side])
    #
    # return counter

for i,line in enumerate(sys.stdin):
    if i == 0:
       M, N = line.split(" ")
    if i == 1:
        A = [int(i) for i in line.split(" ")]
        print(solution(A, int(M)))

# line = "-10 -3 0 9 -100 2 17"
#
# lines = [int(i) for i in line.split(" ")]
# a = [10,12,1,2,14]
# b = [-100000]
# print(solution(lines, 3))
# print(solution(a, 2))
# print(solution(b, 1))


Measured memory_bytes: 22720
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,t=0,m=0;cin>>n;
  vector<int> w(n);
  for(int i=0;i<n;i++){
    cin>>w.at(i);
    t+=w.at(i);
  }
  t-=w.at(0);
  int s=w.at(0);
  m=abs(s-t);
  if(n>2){
    for(int j=1;j<n-1;j++){
      s+=w.at(j);
      t-=w.at(j);
      m=min(m,abs(s-t));
    }
  }
  cout<<m<<endl;
}
  

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll X;
    cin >> X;
    ll ans = (X / 500) * 1000 + ((X % 500) / 5) * 5;
    cout << ans << endl;
    return 0;
}

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

int main(){
    string b;
    cin >> b;
    if(b=="A"){
        cout << "T" << endl;
    }
    else if(b=="T"){
        cout << "A" << endl;
    }
    else if(b=="C"){
        cout << "G" << endl;
    }
    else{
        cout << "C" << endl;
    }
    
    
    

    return 0;
}

Measured memory_bytes: 3552
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end() // 昇順ソート
#define rall(v)(v).rbegin(), (v).rend() // 降順ソート
#define INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair < ll, ll >
#define F first
#define S second
const int MOD = 1000000007;
template < class T > bool chmax(T & a,const T & b) { if (a < b) { a = b; return true; } return false; }
template < class T > bool chmin(T & a,const T & b) { if (a > b) { a = b; return true; } return false; }
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main() {
    int A,B;cin >> A >> B;
    cout << A * B << endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;

int main(){
    long long h ,w, D;
    cin >> h >> w >> D;

    long long px[90001], py[90001];

    for(long long i = 0; i < h; i++){
        for(long long j = 0; j < w; j++){
            long long a;
            cin >> a;
            px[a] = j;
            py[a] = i;
        }
    }

    long long d[90001];

    for(long long i = D+1; i <= h*w; i++) d[i] = d[i-D] + abs(px[i] - px[i-D]) + abs(py[i] - py[i-D]);

    long long q;
    cin >> q;

    for(long long i = 0; i < q; i++){
        long long l, r;
        cin >> l >> r;

        printf("%lld\n", d[r]-d[l]);
    }
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N-1);
   for (int i = 0; i < N-1; i++) {
     cin >> vec.at(i);
   }
  int x = vec.at(0) + vec.at(N-2);
   for (int i = 0; i < N-2; i++) {
     x += min (vec.at(i), vec.at(i+1));
   }
  cout << x << endl;
}

Measured memory_bytes: 3612
//
//  main.cpp
//  CoderProj
//
//  Created by Minoru Hayashi on 2020/04/04.
//  Copyright © 2020 Minoru Hayashi. All rights reserved.
//
//  ABC163
//
//

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

#define REP(i,n) for (int i=0; i<(n); i++)
#define REP2(i,x,n) for (int i=x; i<(n); i++)
#define ALL(n) begin(n), end(n)

using ll = long long;

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

// const ll INF = 1LL<<60;
// const int INF = 1<<29;
// const ll MOD = 1000000007;
//#define __DBG__


void solve(void){
  
  int N, M;
  
  cin >> N >> M;
  
  ll sum=0;
  
  REP(i,M){
    int tmp;
    cin >> tmp;
    sum += tmp;
  }
  
  if(sum>N){
    cout << "-1" << endl;
  }
  else
  {
    cout << N-sum << endl;
  }

  
  return;
   
}



#define TESTCASES 1

int main() {

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

    REP(i,TESTCASES){
      solve();
    }
 
    return 0;
}



Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;
const ll INF=1e18;

vin par(100050);
vin deep(100050);
vin sizee(100050);
void init(int n);
int root(int x);
void unite(int x,int y);
bool same(int x,int y);

int main(){
    int n,m,k;cin>>n>>m>>k;
    init(n);
    vin friends(n+1),block(n+1);//blockは同じグループ内にいるblock関係の人数
    int a,b;
    rep(i,m){
        cin>>a>>b;
        unite(a,b);
        friends[a]++;
        friends[b]++;
    }
    int c,d;
    rep(i,k){
        cin>>c>>d;
        if(same(c,d)){
            block[c]++;
            block[d]++;
        }
    }
    rep2(i,1,n+1){
        cout<<sizee[root(i)]-block[i]-friends[i]-1<<endl;
    }
}

void init(int n){
    rep(i,n+1){
        par[i]=i;
        deep[i]=0;
        sizee[i]=1;
    }
}
int root(int x){
    if(par[x]==x)return x;
    else return par[x]=root(par[x]);
}
void unite(int x,int y){
    x=root(x);
    y=root(y);
    if(x==y)return;
    if(deep[x]<deep[y]){
        par[x]=y;
        sizee[y]+=sizee[x];
    }
    else{
        par[y]=x;
        sizee[x]+=sizee[y];
        if(deep[x]==deep[y])deep[x]++;
    }
}
bool same(int x,int y){
    return root(x)==root(y);
}

Measured memory_bytes: 2816
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 11;
int n, m;
int dl[N], dis[N], fr[N];
vector<int> G[N];
int main(){
    cin>>n>>m;
    memset(dis, -1, sizeof dis);
    int u, v;
    for(int i = 1;i <= m; i++){
        scanf("%d%d", &u, &v);
        G[u].push_back(v);
        G[v].push_back(u);
    }
    int hd = 0, tl = 0;
    dl[++tl] = 1;
    dis[1] = 0;
    while(hd < tl){
        u = dl[++hd];
        for(int v : G[u]){
            if(dis[v] != -1)continue;
            dis[v] = dis[u] + 1;
            fr[v] = u;
            dl[++tl] = v;
        }
    }
    if(hd != n){
        puts("No");
    }
    else{
        puts("Yes");
        for(int i = 2;i <= n; i++){
            printf("%d\n", fr[i]);
        }
    }
    return 0;
}


Measured memory_bytes: 11156
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n,k;
    cin>>n>>k;
    vector<int> a(n),A;
    for(auto&i:a) cin>>i,--i;
    int p{};
    for(unsigned c{};c<62;++c){
        if((k>>c)&1) p=a[p];
        A.assign(n,0);
        for(int i{};i<n;++i) A[i]=a[a[i]];
        a.swap(A);
    }
    cout<<p+1<<endl;
}

Measured memory_bytes: 4764
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

ll gcd(ll a, ll b) {
    return a % b == 0 ? b : gcd(b, a % b);
}
int main() {
    ll a, b; cin >> a >> b;
    cout << a * b / gcd(a, b) << endl;
}


Measured memory_bytes: 256
/// Code By t_bone_289 (Tushar Singh)
/// An Immature Programmer.... I'm still developing !!
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define M 1000000007
#define error(x) cout << #x << " = " << x << endl;
#define pi 3.14159265358979323846
typedef long long ll;
typedef long double ld;
template <typename T>
void ContainerError(T &v){cout<<"{";for(auto &x:v){cout<<x<<',';}cout<<"}"<<endl;return;}
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
ll mpow(ll base,ll exp){ll res=1;while(exp>0){if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return (res);}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    std::map<ll, ll> m;
    ll n;
    cin>>n;
    std::vector<ll> v(n);
    for(auto &x:v)
    {
    	cin>>x;
    }
    for(auto x:v)
    {
    	ll p = 0;
    	while(x%2==0)
    	{
    		p++;
    		x/=2;
    	}
    	m[2]=max(m[2],p);
    	for(ll i=3;i*i<=x;i+=2)
    	{
    		p = 0;
    		while(x%i==0)
    		{
    			p++;
    			x=x/i;
    		}
    		m[i] = max(m[i],p);
    	}
    	if(x>1)
    	{
    		m[x]=max(m[x],1ll);
    	}
    }
    ll lcm = 1;
    for(auto &x:m)
    {
    	ll z = powmod(x.fi,x.se,M);
    	lcm = (lcm*z)%M;
    }
    ll ans = 0;
    for(auto x:v)
    {
    	ll temp = powmod(x,M-2,M);
    	temp = (temp*lcm)%M;
    	ans = (ans+temp)%M;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  for(int i=0;i<3;i++){
      if(s[i]==s[i+1]){
        cout<<"Bad";
        return 0;
      }
  }
  cout<<"Good";
  return 0;
  }

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)

int main(){
    int n_max = 55555;
    vector<bool> prime(n_max,true);
    prime[0] = prime[1] = false;
    rep(i,n_max)if(prime[i]){
        for(int j = 2; j*i < n_max; j++){
            prime[i*j] = false;
        }
    }
    int n;
    cin >> n;
    vector<int> ans;
    rep(i,n_max){
        if(prime[i] && i%5==1){
            ans.push_back(i);
            if(ans.size() == n)break;
        }
    }
    rep(i,n){
        cout << ans[i];
        if(i < n-1)cout << " ";
        else cout << endl;
    }
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::cmp::{min, max};

fn main() {
    input!{
        n: i64,
        l: i64
    }
    let mut sum = n * (2 * l + n - 1) / 2;
    if l > 0 {
        sum -= l;
    } else if n + l - 1 < 0 {
        sum -= n + l - 1;
    }
    println!("{}", sum);
}


Measured memory_bytes: 4352
import java.util.*;

class State implements Comparable<State>{
  int value;
  int cost;

  State(int value, int cost){
    this.value = value;
    this.cost = cost;
  }

  public int compareTo(State st){
    return this.cost - st.cost;
  }
}

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

    while(sc.hasNextInt()){
      int n = sc.nextInt();
      int[][] c = new int[n + 1][n + 1];

      for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
          c[i][j] = sc.nextInt();
        }
      }

      int mask = 1;
      int firstValue = 0;

      for(int i = 1; i <= n; i++){
        firstValue *= 10;
        firstValue += i;

        if(i != 1){
          mask *= 10;
        }
      }

      PriorityQueue<State> open = new PriorityQueue<State>();
      open.add(new State(firstValue, 0));
      boolean[] closed = new boolean[10000000];
      int maxCost = -1;

      while(!open.isEmpty()){
        State st = open.poll();

        if(closed[st.value % mask]){
          continue;
        }
        closed[st.value % mask] = true;

        maxCost = Math.max(maxCost, st.cost);

        for(int i = 0; i < n; i++){
          for(int j = i + 1; j < n; j++){
            StringBuilder valueStr = new StringBuilder(Integer.toString(st.value));
            int a = valueStr.charAt(i) - '0';
            int b = valueStr.charAt(j) - '0';

            valueStr.setCharAt(i, (char)(b + '0'));
            valueStr.setCharAt(j, (char)(a + '0'));

            open.add(new State(Integer.parseInt(valueStr.toString()), st.cost + c[a][b]));
          }
        }
      }

      System.out.println(maxCost);
    }
  }
}

Measured memory_bytes: 154824
#include<stdio.h>

int main() {
    int i , j,n;
	int max = 55000;
    int cnt = 0;

    int sosu[max];

    for(i = 0; i < max; i++) {
        sosu[i] = 1;
    }

    for(i = 2; i <= max; i++) {
        if(sosu[i - 1]){
            for(j = 2; i * j <= max; j++) {
                sosu[i * j - 1] = 0;
            }
        }
    }

	while(0<=scanf("%d",&n)){
	for(i=n-2;;i--){
	if(sosu[i]){
		printf("%d ",i+1);
		break;
	}
	}
	for(i=n;;i++){
	if(sosu[i]){
		printf("%d\n",i+1);
		break;
	}
	}
	}

	return 0;
	
    

}

Measured memory_bytes: 0
//  main.cpp
//  CppTest

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, const char * argv[]) {
    
    // cinを高速にするためのおまじない
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    /////////////////////
    // Write code below /
    /////////////////////
    string input;
    cin >> input;
    
    int size_count = 0; // ACGTが含まれる文字列の長さのカウントアップ用
    int max_length = 0; // 最大文字列の長さ
    for ( int i = 0; i < input.size(); i++ ) {
        if ( input.at(i) != 'A' &&
             input.at(i) != 'C' &&
             input.at(i) != 'G' &&
             input.at(i) != 'T' ) {
            size_count = 0;
        } else {
            size_count++;
        }
        max_length = max(max_length, size_count);
    }
    
    cout << max_length << endl;
    
    return 0;
}


Measured memory_bytes: 256
function Main(input) {
  input=input.split("\n");
　const N=input[0]-0;
  console.log(N*(N+1)/2);
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
  
  

Measured memory_bytes: 29556
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
using namespace std;
int MOD = 1000000007;

signed main(){
    int n;
    cin >> n;
    
    vector<pair<int,int>> ba;
    rep(i,n){
        int a,b;
        cin >> a >> b;
        ba.pb(MP(b,a));
    } 
    SORT(ba);

    int now = 0;
    rep(i,n){
        now += ba[i].se;
        if(now > ba[i].fi){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
     
    return 0;
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://cf17-final-open.contest.atcoder.jp/tasks/cf17_final_a
// rm -r -f test;oj dl http://abc131.contest.atcoder.jp/tasks/abc131_a


Measured memory_bytes: 6512
#include <iostream>

using namespace std;

int main() { 
    int a,b,c,i; 
    cin>>a>>b;
    for(i=1;i<=3000&&(a!=0||b!=0);i++)
    {
    if(a>b){
    c=a;
    a=b;
    b=c;
    }
    cout<<a<<" "<<b<<endl;
    cin>>a>>b;
    }
}


Measured memory_bytes: 3096
n = int(input())
a = list(map(int, input().split(" ")))
s = 0
a.insert(0, 0)
a.insert(n+1, 0)
for j in range(n+1):
    s += abs(a[j] - a[j+1])
for i in range(1, n+1):
    s_i = s + abs(a[i-1]-a[i+1]) - ((abs(a[i-1] - a[i]) + abs(a[i]-a[i+1])))
    print(s_i)

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

string S;

int main() {
	cin >> S;
	int size = S.size();
	int dif1 = 0, dif2 = 0;
	for (int i = 0; i < size; i++) {
		if ((i % 2 == 0 && S[i] == '0') || (i % 2 == 1 && S[i] == '1')) {
			dif1++;
		}
		else {
			dif2++;
		}
	}
	cout << min(dif1, dif2) << endl;
}

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

const int sz = 1e5+5;
int n;
ll a1[sz], a2[sz];

int pos(ll a[sz], ll& sum, int i, ll prev){
    if(sum > 0) return 0;

    ll needtoadd = -sum+1; 
    ll ret = needtoadd;
    if(i >= 1){
        assert(prev < 0);
        ll addtoprev = min(needtoadd, -prev-1);
        a[i-1] += addtoprev; 
        needtoadd -= addtoprev;
    }
    a[i] += needtoadd;
    sum += ret;
    return ret;
}

int neg(ll a[sz], ll& sum, int i, ll prev){
    if(sum < 0) return 0;

    ll needtosub = sum+1;
    ll ret = needtosub;  
    if(i >= 1){
        assert(prev > 0);
        ll subfromprev = min(needtosub, prev-1);
        a[i-1] -= subfromprev; 
        needtosub -= subfromprev;
    }
    a[i] -= needtosub;
    sum -= ret;
    return ret;
}

void solve(){
    cin >> n;
    for(int i = 0; i < n; ++i){
        cin >> a1[i];
        a2[i] = a1[i];
    }

    ll sum1 = 0, sum2 = 0, op1 = 0, op2 = 0;
    for(int i = 0; i < n; ++i){
        sum1 += a1[i];
        sum2 += a2[i];
        if(i%2==0){
            op1 += pos(a1, sum1, i, sum1-a1[i]);
            op2 += neg(a2, sum2, i, sum2-a2[i]);
        }
        else{
            op1 += neg(a1, sum1, i, sum1-a1[i]);
            op2 += pos(a2, sum2, i, sum2-a2[i]);
        }
    }

    cout << min(op1, op2) << '\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}


Measured memory_bytes: 5184
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <functional>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

void Main();

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(10);
#ifdef LOCAL
  freopen("in.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
#endif
  Main();
#ifdef LOCAL
  cout << "\nTime: " << (int)ceil((double)1000 * clock() / CLOCKS_PER_SEC) << " ms";
#endif
}

int n, m;
vector<vector<int>> G;
vector<int> dist;

void Main() {
  cin >> n >> m;
  G.resize(n);
  for (int i = 0; i < m; i++) {
    int v, u;
    cin >> v >> u;
    v--, u--;
    G[v].push_back(u);
    G[u].push_back(v);
  }
  dist.resize(n, n);
  dist[0] = 0;
  queue<int> q;
  q.push(0);
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (auto u : G[v]) {
      if (dist[u] > dist[v] + 1) {
        dist[u] = dist[v] + 1;
        q.push(u);
      }
    }
  }
  vector<int> ans(n);
  bool ok = true;
  for (int i = 1; i < n; i++) {
    if (dist[i] == n) {
      ok = false;
      break;
    }
    ans[i] = -1;
    for (auto j : G[i]) {
      if (dist[i] == dist[j] + 1 && (ans[i] == -1 || ans[i] > j)) {
        ans[i] = j;
      }
    }
  }
  if (ok) {
    cout << "Yes\n";
    for (int i = 1; i < n; i++) {
      cout << ans[i] + 1 << '\n';
    }
  } else {
    cout << "No\n";
  }
}

Measured memory_bytes: 10620
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,0,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
using namespace std;

int main(){
  ll N,K,ans=0,BB=0,CC=0;
  cin>>N>>K;
  ll A[N];
  REP(i,N) cin>>A[i];
  
  ll B[N],C[N];//B[i]自分よりmaeで小さいもの,C[i]自分よりusiroで大きいもの
  REP(i,N){
    B[i]=0;
    C[i]=0;
  }
  
  REP(i,N){
    REP(j,N){
      if(j<i && A[i]>A[j]) B[i]++;
      else if(j>i && A[i]>A[j]) C[i]++;
    }
  }
  
  REP(i,N){
    BB+=B[i]%MOD;
    CC+=C[i]%MOD;
  }
  
  ll T=(K*(K-1)/2)%MOD,S=(K*(K+1)/2)%MOD;
  
  ans+=BB*T+CC*S;
  cout<<ans%MOD<<endl;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll N, x;
	cin >> N >> x;
	vector<ll> a(N);
	REP(i, N) cin >> a[i];

	sort(a.begin(), a.end());
	ll res = 0;
	REP(i, N){
		if(i==N-1){
			if(a[i]==x) res++;
		}else{
			if(a[i]<=x){
				res++;
				x -= a[i];
			}
		}
	}
	cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
from functools import reduce 
num, maxi = map(lambda x : int(x), input().split(' '))
mix_list = []
for _ in range(num):
    mix_list.append(int(input()))

count = 0
maxi = maxi - reduce(lambda x,y:x+y, mix_list)
count += num
mini = min(mix_list)
while maxi > 0:
    count += 1
    maxi -= mini
if maxi == 0:
    print(count)
else:
    print(count-1)

Measured memory_bytes: 3700
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
using namespace std;


long long mlt[51];

int main(void) {
	long long N, P;
	cin >> N >> P;

	int odd_cnt = 0;

	for (int i = 0; i < N; i++) {
		int A;
		cin >> A;
		if (A % 2 == 1) odd_cnt++;
	}

	mlt[0] = 1;
	for (int i = 1; i <= N; i++) mlt[i] = 2*mlt[i-1];

	if (odd_cnt > 0) {
		cout << mlt[N-1] << endl;;
	} else {
		if (P == 0) cout << mlt[N] << endl;
		else        cout << 0 << endl;
	}

	return 0;
}


Measured memory_bytes: 256
from math import atan, degrees
a, b, x = map(int, input().split())

if (a * a * b / 2) <= x:
  tan_ans = 2 * (a * a * b - x) / (a * a * a)
else:
  tan_ans = (a * b * b) / (2 * x)

ans = degrees(atan(tan_ans))

print(ans)

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

typedef long long ll;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int main() {
  int x, ans, num = 0;
  cin >> x;

  for(ans = 0; num < x; ans++) {
    num += ans;
  }

  cout << ans - 1 << endl;
}


Measured memory_bytes: 256
(n,i),a,*q=$<.map{_1.split.map &:to_i}
b=(0..u=n).map{_1&-_1}
d=b.map{[]}
q.map{d[_2]<<[_1-1,~i-=1]}
a.map{t=$*[_1]||u+=1
(b[t]-=1;t+=t&-t)until t>n
d[$*[_1]=i+=1].map{|x,y|q[y]=u-n
(q[y]-=b[x];x&=x-1)while x>0}}
p *q

Measured memory_bytes: 176088
from collections import Counter
N = int(input())
S = list(input().rstrip() for _ in range(N))
c = Counter(S)

for k in ['AC', 'WA', 'TLE', 'RE']:
    count = c.get(k)
    if count is None:
        count = 0
    print('{} x'.format(k), count)


Measured memory_bytes: 79244
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define inrange(a, x, b) (a <= x && x <= b)
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using vc = vector<char>;
using pll = pair<ll, ll>;
template<class T> void print(T x,bool cl=1){cout<<(cl?"\x1b[36m":"")<<x<<(cl?"\x1b[39m":"")<<'\n';}
template<class T> void print1d(T x,ll n=-1,bool cl=true){if(n==-1)n=x.size();rep(i,0,n){cout<<(cl?"\x1b[36m":"")<<x[i]<<(i==n-1?'\n':' ');}cout<<(cl?"\x1b[39m":"");}
template<class T> void print2d(T x,ll r=-1,ll c=-1,bool cl=1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c,cl);}
template<class T, class U> bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U> bool isin(T el, U container) { return find(all(container), el) != container.end(); }
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; }
template<class T> bool even(T n) { return ! (n & 1); }
template<class T> bool odd(T n) { return n & 1; }
template<class T> ll rup(T a, T b) { return a % b ? a / b + 1 : a / b; }
template<class T> ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T> ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;
ll intpow(ll a, ll n, ll _mod=numeric_limits<ll>::max()) { ll p=1; while (n) { if (n&1) p=p*a%_mod; a=a*a%_mod; n>>=1; } return p; } 
ll modc(ll a, char op, ll b, ll _mod=mod)
{
        a %= _mod; b %= _mod; ll res = 1;
        switch (op) {
        case '+': res = (a + b) % _mod; break;
        case '-': res = (a - b) % _mod; break;
        case '*': res = a * b % _mod; break;
        case '/': res = modc(a, '*', modc(b, '^', _mod-2, _mod), _mod); break;
        case '^': res = intpow(a, b, _mod); break;
        case 'P': rep(i, a-b+1, a+1) res = modc(res, '*', i, _mod); break;
        case 'C': res = modc(modc(a, 'P', b, _mod), '/', modc(b, 'P', b, _mod)); break;
        } 
        if (res < 0) { res += _mod; } return res;
}



int main()
{
        vll a(3);
        cin >> a[0] >> a[1] >> a[2];
        swap(a[0], a[1]);
        swap(a[0], a[2]);
        print1d(a, -1, false);
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int n, m, r;
vector<int> R;

void solve(std::vector<std::vector<int>> w_s, const int num_vertices) {
  std::vector<std::vector<ll>> dist(num_vertices);
  for (auto& dim : dist) {
    for (auto i = 0; i < num_vertices; ++i) {
      dim.push_back(INF);
    }
  }
  for (auto& w : w_s) {
    dist[w[0]][w[1]] = w[2];
  }
  std::vector<std::vector<int>> next(num_vertices);
  for (auto i = 0; i < num_vertices; ++i) {
    for (auto j = 0; j < num_vertices; ++j) {
      next[i].push_back(0);
    }
    for (auto j = 0; j < num_vertices; ++j) {
      if (i != j) {
        next[i][j] = j + 1;
      }
    }
  }
  for (auto k = 0; k < num_vertices; ++k) {
    for (auto i = 0; i < num_vertices; ++i) {
      for (auto j = 0; j < num_vertices; ++j) {
        if (dist[i][j] > dist[i][k] + dist[k][j]) {
          dist[i][j] = dist[i][k] + dist[k][j];
          next[i][j] = next[i][k];
        }
      }
    }
  }
  sort(R.begin(), R.end());
  ll ans=INFll;
  do {
    ll cand=0;
    rep(i, r-1){
      cand+=dist[R[i]][R[i+1]];
    }
    if(ans>cand){
      ans=cand;
    }
  } while (std::next_permutation(R.begin(), R.end()));
  cout << ans << endl;
}


int main() {
  cin >> n >> m >> r;
  R.resize(r);
  rep(i, r){
    cin >> R[i];
    --R[i];
  }
  std::vector<std::vector<int>> w(m*2, vector<int>(3));
  int a, b, c;
  rep(i, m){
    cin >> a >> b >> c;
    --a; --b;
    w[i][0]=a; w[i][1]=b; w[i][2]=c;
    w[i+m][0]=b; w[i+m][1]=a; w[i+m][2]=c;
  }
  solve(w, n);
  return 0;
}
/*
Output:
(pair, dist, path)
(1 -> 2, -1, 1 -> 3 -> 4 -> 2)
(1 -> 3, -2, 1 -> 3)
(1 -> 4, 0, 1 -> 3 -> 4)
(2 -> 1, 4, 2 -> 1)
(2 -> 3, 2, 2 -> 1 -> 3)
(2 -> 4, 4, 2 -> 1 -> 3 -> 4)
(3 -> 1, 5, 3 -> 4 -> 2 -> 1)
(3 -> 2, 1, 3 -> 4 -> 2)
(3 -> 4, 2, 3 -> 4)
(4 -> 1, 3, 4 -> 2 -> 1)
(4 -> 2, -1, 4 -> 2)
(4 -> 3, 1, 4 -> 2 -> 1 -> 3)
*/


Measured memory_bytes: 5248
H, W, K = map(int, input().split())
#Ci,jを表す配列を作成する
c = []
for i in range(H):
    c.append(input())

ans = 0

# 各行のYes or Noに関して列のYes or Noの全通りを試す
# bit演算を行うことで全通りを簡単に試すことができる
for h in range((1 << H)):
    for w in range((1 << W)):
        black = 0
        # 各行の各列
        for i in range(H):
            for j in range(W):
                if ((h >> i) & 1) == 0 and ((w >> j) & 1) == 0 and c[i][j] == '#':
                    black += 1
        if black == K:
            ans += 1

print(ans)


Measured memory_bytes: 9192
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
//#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "No" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl

int fact(int x){
    int k=1;
    for(int i=1;i<=x;i++){
        k=(k*i)%MOD;
    }
    return k;
}


int BE(int b,int e){
    int r=1;
    while(e){
        if(e&1){
            r=(r*b)%MOD;
        }
        b=(b*b)%MOD;
        e >>=1;
    }
    return r;
}

 
signed main(void){
    int X,Y;
    cin >> X >> Y;
    if((X+Y)%3!=0){
        cout << 0 << endl;
        return 0;
    }
    int a=(-X+2*Y)/3;
    int b=(-Y+2*X)/3;
    //cout << a MM b << endl;
    if(a<0 || b<0){
        cout << 0 << endl;
        return 0;
    }
    
    int G=fact(a+b);
    G*=BE(fact(a),MOD-2);G%=MOD;
    G*=BE(fact(b),MOD-2);G%=MOD;
    
    cout << G << endl;
    
    return 0;
}



Measured memory_bytes: 256
/*
オーダー
10**6	余裕を持って間に合う	
10**7	おそらく間に合う	余裕を持って間に合う
10**8	非常にシンプルな処理でない限り厳しい	おそらく間に合う
10**9		非常にシンプルな処理でない限り厳しい
logn	:OK
n		:10^7
nlogn	:10^6
n**2	:10^4
n**3	:300
2**n	:20
n!		:10



// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/

#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <string.h>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18
// int 
// // 各桁の和を計算する関数
// int findSumOfDigits(int n) {
//   int amari = 0;
//   int keta = 0;
//   while (n > 0) { // n が 0 になるまで
//     amari += n % 2;
//     if (keta%2==0)
//     n /= 10;
//   }
//   return sum;
// }
 
ll gcd(ll a, ll b) {
	if(b == 0) return a;
	return gcd(b, a % b);
}

// const ll MAX_N = 1e5;
// ll N;
// ll h[MAX_N];
// ll dp[MAX_N+1]; // メモ化テーブル
 
// // i番目以降の品物から重さの総和がj以下になるように選ぶ
// void rec(ll i){
// 	if (i==0) dp[i] = 0;
// 	else if (i==1) dp[i] = abs(h[1]-h[0]);
// 	else dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
// 	return;
// }
 
 
int main() {
	// 入力
	ll K,X;
	cin >>K>>X;
	
	// 解法
	REP(i,K*2-1){
		printf("%lld ", X-K+i+1);
	}
}


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

#define FILE_NAME ""
                                                                        
#define all(x) x.begin(), x.end()

#define sc second
#define fr first

#define pb push_back    
#define mp make_pair

using namespace std;

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

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;         
           
const int dx[] = {+1, -1, 0, 0};
const int dy[] = {0, 0, +1, -1};
  
int main() {
#ifdef LOCAL    
    freopen(FILE_NAME".in", "r", stdin);
    freopen(FILE_NAME".out", "w", stdout);
#endif 
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    int col = 0;
    ll ans = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'W') 
            ans += col;
        else
            col++;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())
#define Next_permutation(vec) next_permutation(vec.begin(), vec.end())

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    Rep(i, N) {
        cin >> A[i];
    }
    for (int i = 1; i < N; ++i) {
        Rep(i, N - 1) {
            cout << A[i] << " ";
        }
        cout << A[N - 1] << endl;
        int v = A[i];
        int j = i - 1;
        while (j >= 0 && A[j] > v) {
            A[j + 1] = A[j];
            j--;
        } 
        A[j + 1] = v;
    }
    Rep(i, N - 1) {
        cout << A[i] << " ";
    }
    cout << A[N - 1] << endl;
    return 0;
}


Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
#define ll  long long int
#define mp make_pair
#define fi first
#define se second
#define pii pair<ll,ll>
#define pb push_back
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int main()
{
	io;
	ll n,a,b,c,d,i,j;
	cin>>n>>a>>b>>c>>d;
	string s;
	cin>>s;
	ll flag=0;

		for(i=a;i<=c-3;i++)
		{
			if(s[i]=='#'&&s[i+1]=='#')
			{
				flag=1;
				break;
			}
		}
		for(i=b;i<=d-3;i++)
		{
			if(s[i]=='#'&&s[i+1]=='#')
			{
				flag=1;
				break;
			}
		}
		ll f2=1;
	if(c>d)
	{
		f2=0;
		for(i=b-1;i<=d-1;i++)
		{
			if(s[i-1]==s[i]&&s[i]==s[i+1]&&s[i+1]=='.')
			{
				f2=1;
				break;
			}
		}
		}
		if(flag!=1&&f2==1)
		cout<<"Yes";
		else
		cout<<"No";	
}

Measured memory_bytes: 592
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
using namespace std;

bool prime(int n){
    for(int i=2;i<=sqrt(n);i++)if(n%i==0)return false;
     return true;
}
int main(){
int n;cin>>n;

long long ans=1;
for(int i=2;i<=n;i++){
    if(prime(i)){
        int yay=0;
        int t=n;
        while(t){
            yay+=t/i;
            t/=i;
        }
        ans*=yay+1;
        ans%= 1000000007;
    }
}
cout<<ans;
}

Measured memory_bytes: 256