akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <sys/types.h>
#include <unistd.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

template<typename T> vector<T> make_vector(size_t sz){
	return vector<T>(sz);
}

template<typename T,typename... Ts> 
auto make_vector(size_t sz, Ts... ts){
	return vector<decltype(make_vector<T>(ts...))>(sz, make_vector<T>(ts...));
}

template<typename T,typename U,typename... V> 
typename enable_if<is_same<T, U>::value!=0>::type 
fill_value(U &u, const V... v){
	u=U(v...);
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_value(U &u, const V... v){
	for(auto &e:u){
		fill_value<T>(e,v...);
	}
}

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

const pid_t pid = getpid();
// Problem Specific Parameter:

int main(void){
	string s,t,u;
	int a,b;
	cin >> s >> t >> a >> b >> u;
	if(s == u) a--;
	if(t == u) b--;
	cout << a << " " << b << endl;
	return 0;
}

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

/*int check(vector<int> a){
	int time = 0;
	int pre_sum = a.at(0);
	int n = a.size();
	if(a.at(0)<0){
		for(int i = 1; i<n; i++){
			int sum = pre_sum + a.at(i);
			if(i%2==1 && sum <= 0){
				time += abs(sum-1);
				sum = 1;
			}else if (i%2==0 && sum >=0){
				time += abs(sum+1);
				sum = -1;
			}
			pre_sum = sum;
		}
	}else if(a.at(0)>0){
		for(int i = 1; i<n; i++){
			int sum = pre_sum + a.at(i);
			if(i%2==0 && sum <= 0){
				time += abs(sum-1);
				sum = 1;
			}else if(i%2==1 && sum >=0){
				time += abs(sum+1);
				sum = -1;
			}
			pre_sum = sum;
		}
	}
	return time;
}

int zerocheck(vector<int> a){
	a.at(0) = 1;
	int time1 = check(a)+1;
	a.at(0) = -1;
	int time2 = check(a)+1;
	int time = min(time1, time2);
	return time;
}

int main(){
	int n;
	cin >> n;
	int time = 0;
	vector<int> a(n);
	for(auto& x:a){
		cin >> x;
	}
	if(a.at(0) == 0){
		time = zerocheck(a);
	}else{
		time = check(a);
	}
	cout << time << endl;

}*/

int main(){
	int n;
	cin >> n;
	vector<long> a(n);
	for(auto& x: a){
		cin >> x;
	}
	long sum1 = 0;
	long sum2 = 0;
	long time1 = 0;
	long time2 = 0;

	for(int i =0;i<n;i++){
		sum1 += a.at(i);
		sum2 += a.at(i);
		if(i%2 == 0){
			if(sum1<=0){
				time1 += sum1*(-1)+1;
				sum1 = 1;
			}
			if(sum2>=0){
				time2 += sum2+1;
				sum2 = -1;
			}
		}
		if(i%2==1){
			if(sum1>=0){
				time1 += sum1+1;
				sum1 = -1;
			}
			if(sum2<=0){
				time2 += sum2*(-1)+1;
				sum2 = 1;
			}
		}
	}
	cout << min(time1, time2) << endl;

}


Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;
const int MOD = 1000000007;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
inline void swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
inline void swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }

ll n, m;
vll x, y;


void init()
{
	cin >> n >> m;
	x.resize(n - 1);
	y.resize(m - 1);

	ll last, tmp;

	cin >> last;
	REP(i, n - 1)
	{
		cin >> tmp;
		x[i] = tmp - last;
		last = tmp;
	}

	cin >> last;
	REP(i, m - 1)
	{
		cin >> tmp;
		y[i] = tmp - last;
		last = tmp;
	}
}

int main()
{
	init();

	ll h = 0, w = 0;

	REP(i, n-1)
	{
		ll tmp = 1;

		tmp = (tmp + i) % MOD;
		tmp = (tmp + (n - 2 - i)) % MOD;
		tmp = (tmp + i * (n - 2 - i) % MOD) % MOD;

		w = (w + x[i] * tmp) % MOD;
	}

	REP(i, m-1)
	{
		ll tmp = 1;

		tmp = (tmp + i) % MOD;
		tmp = (tmp + (m - 2 - i)) % MOD;
		tmp = (tmp + i * (m - 2 - i) % MOD) % MOD;

		h = (h + y[i] * tmp) % MOD;
	}

	ll ans = h * w % MOD;
	
	cout << ans << endl;

}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e5 +7;

#include <math.h>
#define PI 3.14159265358979323846264338327950L



int main() {
    int n;
    cin >> n;
    set<string> mySet;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        mySet.insert(s);
    }
    cout << mySet.size();

    return 0;
}

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

int main(){
	
	string string;
	int i=0;
	
	getline(cin, string);
	
	while(string[i]!='\0'){
		if(islower(string[i]))
			string[i]=toupper(string[i]);
		else if(isupper(string[i]))
			string[i]=tolower(string[i]);
		i++;
	}
	
	cout << string << endl;
	
	return 0;
}

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

int main() {
  string S;
  cin >> S;
  
  if (S[0] == 'A' && S[1] == 'A' && S[2] == 'A' || S[0] == 'B' && S[1] == 'B' && S[2] == 'B') {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int n;
    cin >> n;
    rep(k, n)
    {
        string s, t;
        cin >> s >> t;
        int s_s = s.size(), t_s = t.size();
        int dp[s_s + 1][t_s + 1];
        rep(i, s_s + 1) dp[i][0] = 0;
        rep(j, t_s + 1) dp[0][j] = 0;

        rep(i, s_s)
        {
            rep(j, t_s)
            {
                if (s[i] == t[j])
                    dp[i + 1][j + 1] = dp[i][j] + 1;
                else
                    dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]);
            }
        }
        OP(dp[s_s][t_s]);
    }
    return 0;
}


Measured memory_bytes: 7132
#include<bits/stdc++.h>
#define endl '\n'
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define mod 1000000007
#define FASTIO ios::sync_with_stdio(0); cin.tie(0);
#define REP(i,a,b) for(int i=a;i<b;i++)

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

int main(){
    FASTIO
    int x,n,p,mn=101,mx=0,ans,d=101,v;
    cin>>x>>n;
    map<int,int> m;
    REP(i,0,n){
      cin>>p;
      m[p]++;
      mn=min(mn,p);
      mx=max(mx,p);
    }
    if(m[x]==0) cout<<x<<endl;
    else{
    REP(i,mn-1,mx+2){
      if(m[i]==0){
        ans=abs(x-i);
        if(ans<d){
            d=ans;v=i;
        }
      }
    }
    cout<<v<<endl;
    }
    return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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 INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}
int main() {
  int K,T;
  cin>>K>>T;
  vector<int>a(T);
  for(int i=0;i<T;i++){
    cin>>a[i];
  }

  sort(a.rbegin(),a.rend());
  
  int cnt=0;
  for(int i=0;i<T;i++){
    int cap=K-a[i];
    cnt+=max(a[i]-1-cap,0);
  }
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;

// typedef
typedef long long ll;
typedef unsigned long ul;
// #define int long long

// macro
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define DESCEND greater<int>()  // sort 降順 大きい順
#define UNIQUE(vec) (vec).erase(unique(ALL((vec))), (vec).end());  // 必ずsortを行なってから
#define MIN(vec) min_element(ALL((vec)))  // 値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
#define zero_pad(num) setfill('0') << std::right << setw(num)  // 直後の要素をパディング
#define space_pad(num) setfill(' ') << std::right << setw(num)  // 直後の要素をパディング

// func declaration
template <class T> void print2DVec(vector< vector<T> >&);
template <class T> void calcVec(vector<T>&, int, char);
int char_to_int(const char);

// const
const int INF = 10000000;

/*MEMO
・辞書順
abc < abcd, atcoder < atlas
・イテレータ
std::vector<int>::iterator とタイプするのは面倒なので、
 通常は型推論の auto を使用する。
 auto iter = max_element(ALL(vec));
・2次元配列
vector<vector<int>> vec = {{1, 2, 3}, {4, 5, 6}}
・20×10の配列
vector<vector<int>> vec(20, vector<int>(10, 0));
・(n, m)の多次元配列
vector< vector<int> > vec(n, vector<int>(m, 0))  // 0で初期化
*/

void all2div(vector<int>& vec) {
    size_t vec_len = vec.size();
    REP(i, vec_len) {
        vec.at(i) /= 2;
    }
}

int main() {
    cin.tie();
    ios::sync_with_stdio(false);
    
    // input
    int N;
    cin >> N;
    vector<int> vec(N);
    REP(i, N) cin >> vec.at(i);
    
    // calculation
    cout << abs(*MAX(vec) - * MIN(vec)) << "\n";
    
    return 0;
}


// function
template <class T> void print2DVec(vector< vector<T> >& vec) {
    REP(i, vec.size()) {
        REP(j, vec.front().size()) {
            cout << vec.at(i).at(j);
        }
        cout << endl;
    }
}

template <class T> void calcVec(vector<T> &vec, int num, char ch) {
    // vec全体への演算
    switch (ch) {
        case '+':
            REP(i, vec.size()) vec.at(i) += num; break;
        case '-':
            REP(i, vec.size()) vec.at(i) -= num; break;
        case '*':
            REP(i, vec.size()) vec.at(i) *= num; break;
        case '/':
            REP(i, vec.size()) vec.at(i) /= num; break;
        case '%':
            REP(i, vec.size()) vec.at(i) %= num; break;
        default:
            cout << "Incorrect Operator" << endl;
    }
}

int char_to_int(const char c) {
    if('0' <= c && c <= '9') return (c - '0');
    return -1;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <set>
 
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
using namespace std;
int main() {
	fast
		int n;
	cin >> n; set<int>s;
	for (int i = 0; i < n; i++) {
      int v;
      cin>>v;
      
		s.insert(v);
	}
if(s.size()==n)
	cout << "YES" << endl;
  else
    cout<<"NO"<<endl;
 
 
}
 

Measured memory_bytes: 9600
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

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

using namespace std;

using ll = long long;
using ld = long double;

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); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "YES"; }
  string_type do_falsename() const { return "NO"; }
};

void solve(ll Q, ll H, ll S, ll D, ll N) {
  chmin(H, Q * 2);
  chmin(S, H * 2);
  chmin(D, S * 2);
  if (D < S * 2) { cout << N / 2 * D + N % 2 * S << endl; }
  else cout << S * N << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll D;
	ll N;
	ll H;
	ll Q;
	ll S;
	scanf("%lld", &Q);
	scanf("%lld", &H);
	scanf("%lld", &S);
	scanf("%lld", &D);
	scanf("%lld", &N);
	solve(Q, H, S, D, N);
	return 0;
}


Measured memory_bytes: 764
#define INF 10000000000
#define MOD 1000000007

#if 1   // use_templates

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <algorithm>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define rep(i, up) for (ll i = 0; i < up; ++i)
#define repp(i, up) for (ll i = 0; i <= up; ++i)
#define rrep(i, lo, up) for (ll i = lo; i < up; ++i)
#define rrepp(i, lo, up) for (ll i = lo; i <= up; ++i)
#define eep(i, lo, up) for ((i) = (lo); (i) < (up); ++(i))
#define eepp(i, lo, up) for ((i) = (lo); (i) <= (up); ++(i))


ll gcd(ll a, ll b);

ll gcd(ll a, ll b)
{
    if (a < b) {
        return gcd(b, a);
    }
    ll r;
    while (r = a % b) {
        a = b;
        b = r;
    }
    return b;
}

#endif  // end of use_templates


int main()
{
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) {
        cin >> a[i];
    }
    rrep(i, k, n) {
        if (a[i - k] < a[i]) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
    return 0;
}


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

using namespace std;

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

	string o, e;

	cin >> o >> e;

	for (int i = 0; i < o.size(); i++) {
		cout << o[i];
		if (i < e.size()) {
			cout << e[i];
		}
	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 384
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization ("unroll-loops")

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

#define ll long long
#define ld long double
#define mod 1000000007
#define pb push_back
#define inf 1000000000000000000
#define ff first
#define ss second
#define Clear(x) memset(x,0,sizeof(x))
#define all(x) (x).begin(),(x).end()

void checkpoint1()
{
	/******think more code less******/
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
}

bool comp(pair< ll,ll > &a,pair< ll,ll > &b)
{
	if(a.ff!=b.ff)
		return a.ff<b.ff;
	else
	{
		if(a.ss>b.ss)
			return b.ss<a.ss;
		else if(a.ss<b.ss)
			return a.ss<b.ss;
	}
	return a.ff>b.ff;
}

ll powe(ll a,ll b)
{
	ll res=1;
	while(b>0)
	{
		if(b&1)
		{
			res*=a;
			res%=mod;
		}
		a*=a;
		a%=mod;
		b>>=1;
	}
	return res;
}
vector< ll > adj[100005];
bool vis[100005];
vector< ll > ans;
ll deg[100005];
int main()
{
	checkpoint1();
	ll n,m;
	cin>>n>>m;
	Clear(deg);
	Clear(vis);
	pair< ll,ll > p[m];
	ll mm=m;
	while(mm--)
	{
		ll x,y;
		cin>>x>>y;
		p[mm]={x,y};
		adj[x].pb(y);
		deg[y]++;
	}
	queue< ll > q;
	for(ll i=1;i<=n;i++)
	{
		if(!deg[i])
		{
			q.push(i);
			ans.pb(i);
			vis[i]=1;
		}
	}
	while(!q.empty())
	{
		ll v=q.front();
		q.pop();
		for(auto u:adj[v])
		{
			if(!vis[u])
			{
				deg[u]--;
				if(!deg[u])
				{
					vis[u]=1;
					q.push(u);
					ans.pb(u);
				}
			}
		}
	}
	ll dp[n+1]={0};
	for(auto i:ans)
	{
		for(auto j:adj[i])
			dp[j]=max(dp[j],dp[i]+1);
	}
	cout<<*max_element(dp+1,dp+n+1);
	return 0;
}

Measured memory_bytes: 12504
import java.util.Scanner;

public class Main {
    private static long WARU = 1000000007;
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int count = scanner.nextInt();
        final int fallCount = scanner.nextInt();

        final long[] steps = new long[count + 1];

        for (int i = 1; i < steps.length; i++) {
            steps[i] = 0;
        }

        steps[0] = 1;

        for (int i = 0; i < fallCount; i++) {
            steps[scanner.nextInt()] = -1;
        }

        for (int i = 0; i < count; i++) {
            if (steps[i] == -1) {
                continue;
            }

            if (i == count - 1) {
                steps[i + 1] += steps[i];
                break;
            }

            if (steps[i + 1] == -1 && steps[i + 2] == -1) {
                System.out.println(0);
                return;
            }

            if (steps[i + 2] != -1) {
                steps[i + 2] += steps[i] % WARU;
            }

            if (steps[i + 1] != -1) {
                steps[i + 1] += steps[i] % WARU;
            }
        }

        System.out.println(steps[count] % WARU);
    }
}


Measured memory_bytes: 50140
#include <bits/stdc++.h> 
#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<double>;
using vs = vector<string>;
using vb = vector<bool>;
using vp = vector<P>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using vvb = vector<vb>;
const int INF = 1e9;
const int MOD = 1e9+7;


signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int N, M, R; cin >> N >> M >> R;
    vi r(R); 
    REP(i, R)
    {
        cin >> r[i];
        r[i]--;
    }
    vvi G(N, vi(N, INF));
    REP(i, M)
    {
        int A, B, C; cin >> A >> B >> C;
        G[A-1][B-1] = C;
        G[B-1][A-1] = C;
    }

    REP(k, N)
        REP(i, N)
            REP(j, N)
                G[i][j] = min(G[i][j], G[i][k]+G[k][j]);

    int ans = INF;
    sort(ALL(r));
    do
    {
        int cost = 0;
        REP(i, R-1) cost += G[r[i]][r[i+1]];
        ans = min(ans, cost);
    } while(next_permutation(ALL(r)));
    cout << ans << endl;
}

Measured memory_bytes: 512
n = int(input())
s = list(str(input()))
white_all = s.count(".")
black_all = s.count("#")
white = 0
black = 0
num = []

for i in range(n):
    if s[i] == ".":
        white += 1       
    else:
        black += 1
    num.append(black + (white_all - white))


print(min(min(num), white, black))


Measured memory_bytes: 12836
#include <stdio.h>
#include <iostream>

int main() 
{
	std::string s;
	std::cin >> s;
	int k = 0;

	for (int i = 0 ; i < 4 ; i++) {
		if (s[i] == '+') {
			++k;
		}
		else {
			--k;
		}
	}

	std::cout << k << std::endl;
	return 0;
}

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

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

    long long n, m, ans = 1;
    cin >> n >> m;

    for(long long i = 1; i * i <= m; i++){
        if(m % i != 0) continue;
        long long j = m / i;
        if(i * n <= m) ans = max(ans, i);
        if(j * n <= m) ans = max(ans, j);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
void main() {
	auto ip = readAs!(long[]), N = ip[0], A = ip[1], B = ip[2];
	auto S = A + B;
	auto t = N / S;
	writeln(t * A + min(N - t * S, A));
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
#define test ll t; t=1; while(t--)
typedef long long int ll;
int main() {
    FIO;
    test{
        ll x,y,a,b,c,i,n,sum=0,j,flag=0;
        cin>>x>>y>>a>>b>>c;
        ll val1[a],val2[b],val3[c];
        for(i=0;i<a;i++){
            cin>>val1[i];
        }
        for(i=0;i<b;i++){
            cin>>val2[i];
        }
        sort(val1,val1+a);
        sort(val2,val2+b);
        vector<ll>res;
        for(i=a-1;i>=a-x;i--){
            res.push_back(val1[i]);
        }
        for(i=b-1;i>=b-y;i--){
            res.push_back(val2[i]);
        }
        n=x+y;
        sort(res.begin(),res.end());
        for(i=0;i<n;i++){
            sum+=res[i];
        }
        for(i=0;i<c;i++){
            cin>>val3[i];
        }
        sort(val3,val3+c);
        j=c-1; i=0;
        while(j>=0 && flag==0 && i<n){
            if(res[i]<=val3[j]){
                sum+=(val3[j]-res[i]);
            }
            else{
                flag=1;
            }
            i++;
            j--;
        }
        cout<<sum<<endl;
    }
	return 0;
}

Measured memory_bytes: 4596
#!/usr/bin/perl

use strict;
use warnings;

my $x = <STDIN>;

if ($x==2) {
    print "2\n";
    exit;
}
for (my $i=$x; ; $i++) {
    if ($i%2==0) {next;}
    my $b = 0;
    for (my $j=3; $j<$i; $j+=2) {
        if ($i%$j==0) {
            $b = 1;
            last;
        }
    }
    if ($b==0) {
        print "$i\n";
        exit;
    }
}

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

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

  for (int i = 0; i < N; i++) {
      string B;
      cin >> B;
      
      if (B == "Y") {
        cout << "Four" << endl;
        break;
        }
      if (i==N-1) {
        cout << "Three" << endl;
      }
      else {
        continue;
        }
    }
}

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

using namespace std;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

int main() {
    int N;
    int a[102];
    cin >> N;
    rep(i, N) cin >> a[i];
    int s = *min_element(a, a + N);
    int t = *max_element(a, a + N);
    cout << t - s << endl;

    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++)
using ll = long long;
using P = pair<string,int>;
const double PI = acos(-1);

int main() {
ll x,y;
cin >> x >> y;
if(x==0||y==0) cout << 0 << endl;
else{
  int cnt = 0;
  while(x<=y){
    cnt++;
    x *= 2;
  }
  cout << cnt << endl;
}
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const double PI=3.141592653589;
const int INF=1000000007;
const ll LMAX=1000000000000001;
ll gcd(ll a,ll b){if(a<b)swap(a,b);ll c=a%b;while(c!=0){a=b;b=c;c=a%b;}return b;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};


int main(){
  int n,m; cin>>n>>m;
  vector<int> a(n);
  int sum=0;
  rep(i,n){
    cin>>a[i];
    sum+=a[i];
  }
  int c=0;
  rep(i,n){
    if(sum%(4*m)==0){
      if(sum/(4*m)<=a[i]) c++;
    }else{
      if(sum/(4*m)+1<=a[i]) c++;
    }
  }
  if(c>=m)
  puts("Yes");
  else
  puts("No");

  return 0;
}


Measured memory_bytes: 256
// in case of multiple test cases and N=1e5 don't intialize arrays as global except for graph vector-array
// always check whether or not you are doing mod of a negative number
// always use 1LL instead of 1
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
 
using namespace __gnu_pbds;
using namespace std;

#define double      	long double
#define int         	long long
#define pb          	push_back
#define pii         	pair<int,int>
#define vi          	vector<int>
#define vii         	vector<pii>
#define mi          	map<int,int>
#define mii         	map<pii,int>
#define all(a)      	(a).begin(),(a).end()
#define sz(x)       	(int)x.size()
// just comment the line below in case of interactive problems
#define endl        	"\n"
#define repp(i,a,b) 	for(int i=a;i<b;i++)
#define rep(i,a,b) 		for(int i=a;i<=b;i++)
#define brep(i,a,b)     for(int i=a;i>=b;i--)
#define deb1(x)      	cout << #x << "=" << x << endl
#define deb2(x, y)  	cout << #x << "=" << x << "," << #y << "=" << y << endl
#define deb3(x, y, z)  	cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define trace(v) 		for(auto it=v.begin();it!=v.end();it++)cout<<*it<<" ";cout<<endl;
#define tracearr(a,l,r) for(int iii=l;iii<=r;iii++)cout << a[iii] << " ";cout << endl;
#define PI          	3.1415926535897932384626
#define F 				first
#define S 				second
#define clr(x,y) 		memset(x, y, sizeof(x))
#define IOS         	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
// *s.find_by_order(1) - gives the 2nd samllest element in set
// s.order_of_key(x)   - gives the number of elements in the set which are strictly smaller than x


const int N=1e5 + 5;
const int MOD=1e9 + 7;

int32_t main()
{
	IOS;
	int T=1;
	//cin >> T;
	// int numOfSetBits = __builtin_popcountll(n);
	std::cout << std::fixed << std::setprecision(12);
	while(T--)
	{
		int n,x,t;
		cin >> n >> x >> t;
		int times = n/x;
		if(n%x!=0)
			times++;
		cout << times*t;
	}
}

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

int main() {

    int X, Y;
    cin >> X >> Y;

    bool ans = false;

    for (int cranes = 0; cranes <= X; cranes++) {

        int turtles = X - cranes;

        if (cranes * 2 + turtles * 4 == Y) {
            ans = true;
            break;
        }

    }

    if (ans) {
        cout << "Yes";
    } else {
        cout << "No";
    }

}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i,n)    for(int i = 0; i < (n) ; ++i)
#define orep(i,n)   for(int i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(int i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()   // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

const int mod = 1000000007;
int main() {
  ll n,k;
  cin >> n >> k;

  ll res = 0;
  for(ll i = k; i < n+2;i++) {
    ll mn = (i-1)*i/2;
    ll mx = i*(2*n-i+1)/2;
    res += mx - mn + 1;
    res = res % mod;
  }
  if(res<0) res+= mod;
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 3640
x = list(map(int,input().split()))
y = list(map(int,input().split()))
z = list(map(int,input().split()))
n = int(input())
b = list(int(input()) for i in range(n))

for i in range(n):
    if b[i] in x:
        x[x.index(b[i])] = 'T'
    if b[i] in y:
        y[y.index(b[i])] = 'T'
    if b[i] in z:
        z[z.index(b[i])] = 'T'

if x[0] == 'T' and x[1] == 'T' and x[2] == 'T':
    print('Yes')
elif y[0] == 'T' and y[1] == 'T' and y[2] == 'T':
    print('Yes')
elif z[0] == 'T' and z[1] == 'T' and z[2] == 'T':
    print('Yes')
elif x[0] == 'T' and y[0] == 'T' and z[0] == 'T':
    print('Yes')
elif x[1] == 'T' and y[1] == 'T' and z[1] == 'T':
    print('Yes')
elif x[2] == 'T' and y[2] == 'T' and z[2] == 'T':
    print('Yes')
elif x[0] == 'T' and y[1] == 'T' and z[2] == 'T':
    print('Yes')
elif x[2] == 'T' and y[1] == 'T' and z[0] == 'T':
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9316
#include <cstdio>
#include <algorithm>

using namespace std;


const int MAXN=1e5+10;
using ll=long long int;

struct Node{
    int lbound,rbound;
    bool updated;
    ll diff;
    ll sum;
    Node *left,*right;
};

Node segtree[MAXN*2];
Node* next_pos=segtree;
int n,q;

Node* build(int left,int right){
    auto* cur=next_pos;
    next_pos++;
    cur->lbound=left;
    cur->rbound=right;

    cur->updated=false;
    cur->diff=0;
    

    int mid=(left+right)/2;

    //リーフノードのケース
    if (right-left==1) {
        cur->sum=2147483647;
        return cur;
    }

    cur->left=build(left,mid);
    cur->right=build(mid,right);
    //総和を集計
    cur->sum=2147483647;
    return cur;
}

//シングルノードの更新
void update(Node& self,ll d){
    self.diff=d;
    self.sum=d;
    self.updated=true;
}

void update(Node& self,int l,int r,int u){
    int mid=(self.lbound+self.rbound)/2;
    
    if (self.rbound-self.lbound!=1&&self.updated){
        update(*self.left,self.diff);
        update(*self.right,self.diff);
        self.diff=0;
        self.updated=false;
    }

    if (l==self.lbound&&r==self.rbound){
        update(self,u);
    }else if (l>=mid){
        update(*self.right,l,r,u);
        self.sum=min(self.left->sum,self.right->sum);
    }else if (r<=mid){
        update(*self.left,l,r,u);
        self.sum=min(self.left->sum,self.right->sum);
    }else{
        update(*self.left,l,mid,u);
        update(*self.right,mid,r,u);
        self.sum=min(self.left->sum,self.right->sum);
    }
}

//シングルポイント
int query(Node& self,int i){
    // puts("q");
    if (self.rbound-self.lbound==1&&self.lbound==i) return self.diff;
    int mid=(self.lbound+self.rbound)/2;
    if (i>=mid) return query(*self.right,i)+self.diff;
    else return query(*self.left,i)+self.diff;
}

//区間
ll query(Node& self,int l,int r){
    int mid=(self.lbound+self.rbound)/2;

    //更新があるノードの区間をプッシュボタン
    if (self.rbound-self.lbound!=1&&self.updated){
        update(*self.left,self.diff);
        update(*self.right,self.diff);
        self.diff=0;
        self.updated=false;
    }

    if (l==self.lbound&&r==self.rbound){
        return self.sum;
    }else if (l>=mid){
        return query(*self.right,l,r);
    }else if (r<=mid){
        return query(*self.left,l,r);
    }else{
        return min(query(*self.left,l,mid),query(*self.right,mid,r));
    }
}

int main(){
    scanf("%d%d",&n,&q);
    build(0,n);
    // printf("%lld\n",segtree[0].sum);
    for(int i=0;i<q;i++){
        int t;
        scanf("%d",&t);
        if (t==0){
            int s,t,x;
            scanf("%d%d%d",&s,&t,&x);
            update(segtree[0],s,t+1,x);
        }else{
            int l,r;
            scanf("%d%d",&l,&r);
            printf("%lld\n",query(segtree[0],l,r+1));
        }

    }
    return 0;
}


Measured memory_bytes: 12108
#include <algorithm>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <queue>
#include <string>
#include <vector>

using ll = long long;
using namespace std;

void dfs(vector<vector<int>> &tree, vector<bool> &check, vector<ll> &cnt, int now) {
    check.at(now) = true;
    bool flag = true;
    for (int x : tree.at(now)) {
        if (!check.at(x)) {
            flag = false;
            break;
        } 
    }
    if (flag) {
        return;
    }
    for (int x : tree.at(now)) {
        if (check.at(x)) {
            continue;
        }
        cnt.at(x) += cnt.at(now);
        dfs(tree, check, cnt, x);
    }
}

int main() {
    int n = 0, q = 0;
    cin >> n >> q;
    vector<vector<int>> tree(n+1);
    int a = 0, b = 0;
    for (int i=0; i<n-1; i++) {
        cin >> a >> b;
        tree.at(a).push_back(b);
        tree.at(b).push_back(a);
    }
    vector<bool> check(n+1, false);
    vector<ll> cnt(n+1);
    int p = 0;
    ll x = 0;
    for (int i=0; i<q; i++) {
        cin >> p >> x;
        cnt.at(p) += x;
    }
    dfs(tree, check, cnt, 1);
    for (int i=1; i<=n; i++) {
        cout << cnt.at(i);
        if (i == n) {
            cout << endl;
        }
        else {
            cout << " ";
        }
    }
    return 0;
}


Measured memory_bytes: 30592
/* ****Ragnar7 -SHINIGAMI- _Lawliet_**** */
/* First, solve the problem.Then write the code. */
#include<bits/stdc++.h>
#define ll          long long
#define ld 			long double
#define hell        1000000007
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifndef ONLINE_JUDGE
	freopen ("input.txt","r",stdin);
	// freopen ("output.txt","w",stdout);
	#endif
	ll t = 1;
	// cin>>t;
	while(t--)
	{
		ll n,k;
		cin>>n>>k;
		vector<ll> h(n+1,0);
		for(ll i=1;i<=n;i++)
			cin>>h[i];
		vector<ll> dp(n+1,0);
		h[0] = h[1];
		for(ll i=2;i<=n;i++)
		{
			dp[i] = hell;
			for(ll j=i-1;j>=max(1LL,i-k);j--)
			dp[i]=min(dp[j]+abs(h[i]-h[j]),dp[i]);
		}
		cout<<dp[n];
		
	}

	
	time
	return 0;
}

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

#define ll long long
#define pb push_back
#define mp make_pair

void solve() {

	int n;
	int k;
	cin >> n >> k;
	int a[n];
	ll sum = 0;
	for(int i = 0;i < n;i++){
		cin >> a[i];
	}    
	sort(a,a+n);
	for(int i  = 0;i <k;i++){
		sum = sum + a[i];
	}

	cout << sum;


}


int main()
{

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

    ll T;
    T = 1;
    //cin >> T;
    while (T--) {
        solve();
    }




}


Measured memory_bytes: 3616
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=n-1;i>=a;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pair<ll,ll>>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
template<typename T>
void max_self(T &a,T b){
    a=max(a,b);
}
template<typename T>
void min_self(T &a,T b){
    a=min(a,b);
}
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=2e5+10,oo=0x3f3f3f3f,MOD=1e9+7;
const double PI = acos(-1);
map<ll,ll>mp;
void factorization(ll n){
    for(ll i=2;i*i<=n;i++){
        while(n%i==0)
            mp[i]++,n/=i;
    }
    if(n>1)mp[n]++;
}
ll power(ll x, ll y)
{
    ll temp;
    if( y == 0)
        return 1;
    temp = power(x, y/2);
    if (y%2 == 0)
        return temp*temp;
    else
        return x*temp*temp;
}
void solve(){
    ll n,k;
    cin>>n>>k;
    factorization(k);
    ll res=1;
    for(auto x:mp){
        res*=power(x.f,x.s/n);
    }
    cout<<res<<endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();
}


Measured memory_bytes: 3660
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N = I()
    A = LI()
    B=[]
    for i,a in enumerate(A):
        B.append((a,i+1))
    B.sort()
    for b in B:
        print(b[1],end=" ")
    print()
if __name__ == '__main__':
    main()

Measured memory_bytes: 59056
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<list>
#include<vector>
#include<cmath>

#define rep(i,a,b) for(int i=a;i<b;i++)

using namespace std;


int main(){
    int r;
    cin >> r;
    if(r<1200)cout << "ABC" << endl;
    else if(r<2800)cout << "ARC" << endl;
    else cout << "AGC" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int N, T, i, ans = 1001;
	int c[100], t[100];
	scanf("%d%d", &N, &T);
	for (int j = 0; j < N * 2; j++) {
		if (j % 2 == 0)scanf("%d", &c[j / 2]);
		else scanf("%d", &t[j / 2]);
	}
	for (i = 0; i < N; i++)
	{
		if (t[i] <= T) {
			if (ans > c[i])ans = c[i];
		}
	}
	if (ans < 1001)printf("%d", ans);
	else printf("TLE");
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef vector<vl> mt;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<string> vs;
typedef vector<vs> table;
typedef vector<vl> v2;
typedef vector<v2> v3;
typedef vector<v3> v4;


const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 50;

ll n,k,q;
vl a;
vl b;
ll ans;

int main(){
  cin >> n >> k >> q;
  a = vl(q);
  for(ll i = 0;i < q;i++) cin >> a[i];
  b = vl(n+1,k-q);
  for(ll i = 0;i < q;i++){
    b[a[i]]++;
  }
  for(ll i = 1;i <= n;i++){
    if(b[i] > 0) cout << "Yes" << endl;
    else cout << "No" << endl;
  }


}


Measured memory_bytes: 2176
#import <stdio.h>
#define MAX(a,b) ((a)>(b)?(a):(b))
int WAIT(int t, int s, int f){
    int r = t%f;
    return (s>=t) ? s-t : r==0 ? 0 : f-r;
}

int main(){
    int N;
    int C[600] = {0};
    int S[600] = {0};
    int F[600] = {0};
    scanf("%d",&N);
    for(int i=1;i<=N-1;i++){
        int c,s,f;
        scanf("%d %d %d",&c,&s,&f);
        C[i] = c;
        S[i] = s;
        F[i] = f;
    }
    for(int i=1;i<=N-1;i++){
        int t = S[i] + C[i];
        for(int j=i+1;j<=N-1;j++){
            t += WAIT(t,S[j],F[j]) + C[j];
        }
        printf("%d\n",t);
    }
    printf("0\n");
}


Measured memory_bytes: 2164
n=input()
t_lst=list(map(int,input().split()))
a_b=[]
m=int(input())
for i in range(m):
    a_b.append(list(map(int,input().split())))
for i in range(m):
    print(sum(t_lst)-t_lst[a_b[i][0]-1]+a_b[i][1])

Measured memory_bytes: 3060
"use strict";

function main(input) {
  input = input.trim().split("");
  let ans = 0;
  if (input[0] === 0) {
    console.log("No");
    return;
  }
  for (const str of input) {
    ans += Number(str);
  }
  if (ans % 9 === 0) {
    console.log("Yes");
  } else {
    console.log("No");
  }
}

function numberSort(array) {
  array.sort(f);
  return array;
}

var f = function (a, b) {
  return a - b;
};

main(require("fs").readFileSync("/dev/stdin", "utf-8"));


Measured memory_bytes: 37400
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t N;
  cin >> N;
  int64_t ans = 0;
  for(int64_t i=1; i<=N; i++){
    int64_t k = N / i;
    ans += i*k*(k+1)/2;
  }
  cout << ans << endl;
}

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

const int MOD = 1000000007;
int main() {
    long long N, K;
    cin >> N >> K;
    long long M = N+1, L = K-1;
    long long res = M*(M*M+5)/6 + L*(L*L*2+L*3-5-M*(L+1)*3)/6;
    cout << res%MOD << endl;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}

int main() {
  int n;cin >> n;
  vl a(n,0);
  vi ud(n,10);
  rep(i,n) {
    cin >> a.at(i);
    if(i != 0) {
      if(a.at(i-1) < a.at(i)) ud.at(i-1) = 1;
      else if(a.at(i-1) > a.at(i)) ud.at(i-1) = -1;
      else ud.at(i-1) = 0;
    }
  }
  ud.at(n-1) = -1;


  ll ans = 0; ll kane = 1000;ll kabu = 0;

  bool p = false;
  ll mni = 0;
  rep(i,n) {
    if(ud.at(i) == 1 and !p) {
      p = true;
      kabu = kane / a.at(i);
      kane = kane % a.at(i);
      mni = i;
    }
    if(ud.at(i) == -1 and p) {
      p = false;
      kane += kabu * a.at(i);
      kabu = 0;
    }
  }

  cout << kane << endl;

  return 0;
}


Measured memory_bytes: 3596
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <sstream>
#include <set>
using namespace std;

int main()
{
  int n;
  cin >> n;
  long long aa = 0, bb = 0;
  for (int i=0; i<n; i++) {
    int a, b;
    cin >> a >> b;
    if (i == 0) {
      aa = a;
      bb = b;
      continue;
    }
    long long mult = max((aa - 1) / a + 1, (bb - 1) / b + 1);
    aa = a * mult;
    bb = b * mult;
  }
  cout << aa + bb << endl;
}


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

using namespace std;

vector <int> pnt;
int N;
int ans=0;
bool dp[101][10101];

int main(){
        cin>>N;
        for(int i=0;i<N;i++){
                for(int j=0;j<10101;j++){
                        dp[i][j]=false;
                }
        }
        for(int i=0;i<N;i++){
                int pp;
                cin>>pp;
                pnt.push_back(pp);
        }
        dp[0][0]=true;
        for(int i=0;i<N;i++){
                for(int j=0;j<10101;j++){
                        if(dp[i][j]){
                                dp[i+1][j]=true;
                                dp[i+1][j+pnt[i]]=true;
                        }
                }
        }
        for(int i=10000;i>=0;i--){
                if(i%10!=0&&dp[N][i]){
                        ans=i;
                        break;
                }
        }
        cout<<ans<<endl;
        return 0;
}


Measured memory_bytes: 1280