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

typedef long long ll;
typedef pair<int, pair<int, int>> piii;
//loop
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//STL
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

//const
#define MOD 1000000007 //10^9+7:合同式の法

//acronym
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素

const int INF = 1e9;

#define deg_to_rad(deg) ((deg)*M_PI / 180.0)

// const int MOD = 998244353;

void printVector(vector<int> &A, int N)
{
    cout << A.at(0);
    FOR(i, 1, N - 1)
    {
        cout << " " << A.at(i);
    }
    cout << endl;
}

void insertionSort(vector<int> &A, int N)
{
    printVector(A, N);
    FOR(i, 1, N - 1)
    {
        int v = A.at(i);
        int j = i - 1;
        while (j >= 0 && A.at(j) > v)
        {
            A.at(j + 1) = A.at(j);
            j--;
        }
        A.at(j + 1) = v;
        printVector(A, N);
    }
}

void Main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i, N)
    {
        cin >> A.at(i);
    }

    insertionSort(A, N);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    Main();
    return 0;
}



Measured memory_bytes: 3208
function Main(arg) {
  let N = arg.trim();
  let resut = 0n;
  for(let i = 0; i<N.length;i++){
    resut += BigInt(N[i]);
  }
  if(resut % 9n != 0n){
    console.log('No');
  } else {
    console.log('Yes');
  }

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

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

int main() {
  string s;
  cin>>s;
  int k = s.length();
  int cnt = 0;
  for (char c: s) {
    if (c == 'o') {
      ++cnt;
    }
  }
  if (cnt + 15 - k >= 8) {
    cout<<"YES"<<endl;
  } else {
    cout<<"NO"<<endl;
  }
}

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

#define lli long int

using namespace std;

int main() {
  lli N, Q;
  cin >> N >> Q;
  map<int,int> M;
  M[0]=0;
  char L1, L2;
  lli cont=0;
  for(int i=0; i<N; i++){
    if(i==0)  cin >> L1;
    else{
      cin >> L2;
      if(L1=='A' && L2=='C')  cont++;
      M[i+1]=cont;
      L1=L2;
    }
  }
  lli l, r;
  for(int i=0; i<Q; i++){
    cin >> l >> r;
    cout << M[r]-M[l] << endl;
  }
}

Measured memory_bytes: 5504
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>	// istringstream
using namespace std;

int main(){
	string in;
	int bangou, day;
	// kongetu = (bangou, kaisuu);
	// sengetu = (bangou, day);
	map<int, int> kongetu, sengetu;

	while (getline(cin, in)){
		if (in.empty())	break;

		istringstream stream(in);
		stream >> bangou >> day;
		// kongetu.insert(pair<int, int>(bangou, day));
		kongetu[bangou]++;
	}
	
	while (scanf("%d,%d", &bangou, &day) != EOF){
		if (kongetu.count(bangou) > 0){
			kongetu[bangou]++;
			// 今月にもbangouがあるときのみinsertする.
			sengetu.insert(pair<int, int>(bangou, day));
		}
	}

	map<int, int>::iterator it = sengetu.begin();
	while (it != sengetu.end()){
		// sengetuとkongetuの両方にあるbangouの値(kaisuu)を出力する.
		cout << (*it).first << " " << kongetu[(*it).first] << endl;
		it++;
	}

	return 0;
}

Measured memory_bytes: 1272
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
//constexpr ll MOD = 998244353;
//constexpr ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
constexpr ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

int main()
{
  ll N;
  cin >> N;
  vector<vector<ll>> G(N);
  for (ll i = 0; i < N - 1; i++)
  {
    ll a, b;
    cin >> a >> b;
    a--, b--;
    G.at(a).push_back(b);
    G.at(b).push_back(a);
  }

  vector<ll> P(N, -1);
  P.at(0) = 1;
  queue<ll> que;
  que.push(0);
  while (!que.empty())
  {
    ll v = que.front();
    que.pop();

    for (auto nv : G.at(v))
    {
      if (P.at(nv) != -1)
        continue;

      P.at(nv) = (P.at(v) == 1) ? 2 : 1;
      que.push(nv);
    }
  }

  ll one = count(P.begin(), P.end(), 1LL);
  ll two = count(P.begin(), P.end(), 2LL);
  ll ONE = (N + 2) / 3, TWO = (N + 1) / 3;
  if (one < ONE || two < TWO)
  {
    vector<ll> ans(N, -1);
    vector<bool> used(N + 1, false);

    ll cnt3 = 3;
    for (ll i = 0; i < N; i++)
    {
      if ((one < ONE && P.at(i) == 1) || (two < TWO && P.at(i) == 2))
      {
        ans.at(i) = cnt3;
        used.at(cnt3) = true;
        cnt3 += 3;
      }
    }
    ll cnt = 1;
    for (ll i = 0; i < N; i++)
    {
      if (ans.at(i) == -1)
      {
        ans.at(i) = cnt;
        cnt++;
        if (cnt <= N && used.at(cnt))
          cnt++;
      }
    }

    for (ll i = 0; i < N; i++)
    {
      cout << ans.at(i) << ((i == N - 1) ? '\n' : ' ');
    }

    return 0;
  }

  ll cnt1 = 1, cnt2 = 2, cnt3 = 3;
  for (ll i = 0; i < N; i++)
  {
    if (P.at(i) == 1)
    {
      if (cnt1 > N)
      {
        cout << cnt3;
        cnt3 += 3;
      }
      else
      {
        cout << cnt1;
        cnt1 += 3;
      }
    }
    else
    {
      if (cnt2 > N)
      {
        cout << cnt3;
        cnt3 += 3;
      }
      else
      {
        cout << cnt2;
        cnt2 += 3;
      }
    }
    cout << ((i == N - 1) ? '\n' : ' ');
  }
}

Measured memory_bytes: 16744
using System;
using System.Collections.Generic;
using System.Linq;

namespace kakomon
{
    class Program
    {
        static void Main(string[] args)
        {
            abc084_a();
        }

        static void abc084_a()
        {
            // A - New Year
            int m = int.Parse(Console.ReadLine());
            int ans = 2 * 24 - m;
            Console.WriteLine(ans);
        }
    }
}

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

using ll = long long;
using namespace std;
constexpr ll inf = 1e9;
constexpr ll mod = 1e9+7;

struct Edge {
    int to;
    int cap;
    int rev;
};
vector<Edge> edges[101];
bool used[101] = {false};

int dfs(int v, int t, int f) {
    if (v == t) return f;
    used[v] = true;
    for (auto&& edge : edges[v]) {
        if (used[edge.to] || edge.cap <= 0) continue;
        int d = dfs(edge.to, t, min(f, edge.cap));
        if (d > 0) {
            edge.cap -= d;
            edges[edge.to][edge.rev].cap += d;
            return d;
        }
    }
    return 0;
}

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

    int V, E;
    cin>>V>>E;
    for (int e = 0; e < E; e++) {
        int U, V, C;
        cin>>U>>V>>C;
        edges[U].push_back(Edge{V, C, (int)edges[V].size()});
        edges[V].push_back(Edge{U, 0, (int)edges[U].size()-1});
    }

    int flow = 0;
    while (1) {
        fill(begin(used), end(used), false);
        int f = dfs(0, V-1, inf);
        if (f == 0) break;
        flow += f;
    }
    cout<<flow<<endl;

    return 0;
}


Measured memory_bytes: 3264
def double_helix(b):
    if b == 'A':
        return 'T'

    if b == 'T':
        return 'A'

    if b == 'C':
        return 'G'

    if b == 'G':
        return 'C'


if __name__ == "__main__":
    b = input()
    print(double_helix(b))

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 30;

int main() {
  int n;
  cin >> n;
  set<ll> st;
  ll a;
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (st.count(a))
      st.erase(a);
    else
      st.insert(a);
  }
  cout << st.size() << endl;
}


Measured memory_bytes: 4864
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EACH(t,i,c) for(t::iretator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);

int c[] = {1, 0, -1, 0};
int s[] = {0, 1, 0, -1};

bool same(vvi a, vvi b, int m) {
	REP(i, m) {
		if(a[i][0] != b[i][0] || a[i][1] != b[i][1]) {
			return false;
		}
	}
	return true;
}

int main() {
	int n;
	while(cin >> n, n) {
		int m;
		cin >> m;
		vvi line(m, vi(2));
		vvi diff(m-1, vi(2));

		REP(i, m) {
			cin >> line[i][0] >> line[i][1];
		}

		REP(i, m-1) {
			diff[i][0] = line[i+1][0] - line[i][0];
			diff[i][1] = line[i+1][1] - line[i][1];
		}

		REP(no, n) {
			int mi;
			cin >> mi;
			vvi linei(mi, vi(2));
			vvi diffi(mi-1, vi(2));

			REP(i, mi) {
				cin >> linei[i][0] >> linei[i][1];
			}

			if(m != mi) {
				continue;
			}

			REP(d, 4) {
				REP(i, m-1) {
					int dx = linei[i+1][0] - linei[i][0];
					int dy = linei[i+1][1] - linei[i][1];

					diffi[i][0] = c[d]*dx - s[d]*dy;
					diffi[i][1] = s[d]*dx + c[d]*dy;
				}

				if(same(diff, diffi, m-1)) {
					cout << no+1 << endl;
					goto next;
				}
			}
			
			REP(d, 4) {
				REP(i, m-1) {
					int dx = linei[m-i-1][0] - linei[m-i-2][0];
					int dy = linei[m-i-1][1] - linei[m-i-2][1];

					diffi[i][0] = c[d]*dx - s[d]*dy;
					diffi[i][1] = s[d]*dx + c[d]*dy;
				}

				if(same(diff, diffi, m-1)) {
					cout << no+1 << endl;
					goto next;
				}
			}

			next:;
		}
		cout << "+++++" << endl;
	}

	return 0;
}

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

int main(){
    int N, K, Q; cin >> N >> K >> Q;
    vector<int> points(N, 0);
    for (int i = 0; i < Q; i++)
    {
        int h; cin >> h;
        points[--h]++;
    }

    for (int i = 0; i < N; i++)
    {
        if(K-Q+points[i]>0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}


Measured memory_bytes: 1024
n, m = map(int, input().split())
max_l = 0
min_r = n
ans = n
for i in range(m):
  l, r = map(int, input().split())
  if ans != 0:
    if l <= min_r or r <= max_l:
      max_l = max(max_l, l)
      min_r = min(min_r, r)
    else:
      ans = 0
if ans != 0:
  ans = min_r - max_l + 1
print(ans)

Measured memory_bytes: 9208
#include <bits/stdc++.h>
#define fin freopen("input", "r", stdin);
#define fout freopen("output", "w", stdout);
#define wt(x) cerr << #x << ": " << x << " ";
#define whatis(x) {cerr << #x << ": " << x << endl;}
#define whatis2(x, y) {wt(x); wt(y); cerr << endl;}
#define whatis3(x, y, z) {wt(x); wt(y); wt(z); cerr << endl;}
#define whatis4(x, y, z, a) {wt(x); wt(y); wt(z); wt(a); cerr << endl;}
using namespace std;

typedef long long ll; typedef unsigned long long ull; typedef long double ld;
const ll MOD = 1000000007; const ld PI = acos(-1.0);

const int N = (int) 100 + 10;
const int W = (int) 1e5 + 10;
ll dp[N][W];
struct ITEM {
    int value, weight;
};
int n, mx_weight;

void solve() {
    cin >> n >> mx_weight;
    vector<ITEM> items(n + 1);
    for (int i = 1; i <= n; ++i) {
        cin >> items[i].weight >> items[i].value;
    }
    for (int i = 0; i <= n; ++i) dp[i][0] = 0;
    for (int cur_weight = 0; cur_weight <= mx_weight; ++cur_weight) dp[0][cur_weight] = 0;

    for (int i = 1; i <= n; ++i) {
        for (int cur_weight = 1; cur_weight <= mx_weight; cur_weight++) {
            dp[i][cur_weight] = dp[i-1][cur_weight];
            if (items[i].weight <= cur_weight) {
                dp[i][cur_weight] = max (dp[i-1][cur_weight - items[i].weight] + items[i].value,
                        dp[i-1][cur_weight]);
            }
        }
    }
    cout << dp[n][mx_weight] << endl;
}

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

    solve();


    return 0;
}


Measured memory_bytes: 80128
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).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> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ld n, m, d; cin >> n >> m >> d;
    printf("%.16Lf\n", (d == 0 ? 1.0 : 2.0) * (n - d) * (m - 1.0) / (n * n));
    return 0;
}

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

using namespace std;

int gcd(int x, int y){
  if(y==0)return x;
  else if(x>=y){
    return gcd(y,x%y);
  }
}

int main(){
  int x;
  int y;

  cin >> x >> y;
  if(y>x)swap(x,y);
  cout << gcd(x,y) << endl;
  return 0;
}

Measured memory_bytes: 3096
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var abc = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int count = 0;
            Array.Sort(abc);
            count = abc[2] - abc[1];
            abc[0] += count;
            abc[1] += count;
            while (abc[0] < abc[1])
            {
                abc[0] += 2;
                count++;
            }
            if (abc[0] > abc[1])
            {
                count++;
            }
            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 13268
#include<cstdio>
#include<iostream>
#include<iomanip>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>

using namespace std;
int main(){
  int n;
  int *p;
  cin >> n;

  //input
  p = new int[n];
  for(int i=0;i<n;i++)
    cin >> p[i];

  //cmp
  int cnt=0;
  for(int i=1;i<n-1;i++){
    if((p[i-1] < p[i] && p[i] < p[i+1]) || (p[i-1] > p[i] && p[i] > p[i+1]))
      cnt++;
  }
  cout << cnt << "\n";
  return 0;
  
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdio>
#include<vector>
#include<map>
using namespace std;

typedef pair<int, string> P;

vector<P> words;

char str[1050], c;
int n;
int main(){
    while(cin >> n, n){
	map<string, int> counter;
	for(int i = 0;i < n;i++){
	    while(true){
		scanf(" %s%c", str, &c);
		counter[str]++;
		if(c == '\n')break;
	    }
	}
	cin >> c;
	words.clear();
	map<string, int>::iterator it = counter.begin();
	while(it != counter.end()){
	    words.push_back(P(-(it->second), it->first));
	    it++;
	}
	sort(words.begin(), words.end());
	int ok = 0;
	for(int i = 0;i < words.size();i++){
	    if((words[i].second)[0] == c){
		if(ok == 0)ok = 1;
		else cout << " ", ok++;
		cout << words[i].second;
	    }
	    if(ok == 5)break;
	}
	if(ok == 0)cout << "NA";
	cout << endl;
    }
    return 0;
}

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

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define lfs <<fixed<<setprecision(10)<<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = n; i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = n - 1; i >= (ll)(m); i--)
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>v,ll n){cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
template<typename T>
void emp(map<T,ll>&m, T x){m.emplace(x,0).first->second++;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main(){
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  ll res=0,res1=INF,res2=-INF,buf=0;
  bool judge = true;
  ll n;cin>>n;
  vector<ll>l(2*n);
  rep(i,0,2*n)cin>>l[i];
  sort(ALL(l));
  rep(i,0,2*n){
    if(i%2==0)res+=l[i];
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define all(a) a.begin(),a.end()
#define sz(a) a.size()
#define re return 
#define MP make_pair
#define pb push_back
using namespace std;

signed main(){
	ios_base::sync_with_stdio(0);
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	int cnt=0;
	while(b<=a){
		b*=2;
		cnt++;
	}
	while(c<=b){
		c*=2;
		cnt++;
	}
	if(cnt>k) cout<<"No";
	else cout<<"Yes";
	re 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n,i;
    cin>>n;
    vector <ll> a(n+1);
    vector <ll> b(n);
    for(i=1;i<n;i++)
    {
        cin>>b[i];
    }
    a[1]=a[2]=b[1];
    for(i=2;i<n;i++)
    {
        if(b[i]>b[i-1])
        {
            a[i+1]=b[i];
        }
        else
        {
            a[i]=b[i];
            a[i+1]=b[i];
        }
    }
    ll sum=0;
    for(i=1;i<=n;i++)
    {
        sum+=a[i];
    }
    cout<<sum;
  return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    long long ans = 0;

    for (auto i = 0; i < n; i++)
    {
        double a_i;
        cin >> a_i;
        a[i] = a_i;
    }

    for (auto i = 0; i < n; i++)
    {
        while(a[i] % 2 == 0){
            a[i] /= 2;
            ans += 1;
        }
    }
    


    cout << ans << endl;
}

Measured memory_bytes: 256
n=int(input())
e=len(str(n))
e1=int('7'*e)
if e1<n:
    e1=e1*10+7
tr=1
s=set()
t=e1%n
ans=len(str(e1))
while(t!=0):
    if t in s:
        tr=0
        break
    s.add(t)
    e1=t*10+7
    t=e1%n
    ans+=1
if tr==0:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 200400
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdio>
#include<set>
#include<map>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repn(i, n) for(int i = 1; i <= n; i++) 
#define lint long long
#define all(x) (x).begin(), (x).end()


const int MAX_N = 1001;
const int MAX_V = MAX_N*(MAX_N-1)/2;
vector<int> G[MAX_V];
int id[MAX_N][MAX_N];

int d[MAX_V];
bool seen[MAX_V];
bool fin[MAX_V];

int get_id(int i, int j){
    if (i > j) swap(i, j);
    return id[i][j];
}

int dfs(int x){
    if (seen[x]){
        if(!fin[x]) return -1;
        return d[x];
    }
    seen[x] = true;
    for(auto& y : G[x]){
        int res = dfs(y);
        if (res == -1) return -1;
        d[x] = max(d[x], res+1);
    }
    fin[x] = true;
    return d[x];
}

int main(){
    int n; cin >> n;
    vector<vector<int>> a(n, vector<int>(n-1));
    rep(i, n) rep(j, n-1) {cin >> a[i][j]; a[i][j]--;}

    int v = 0;
    rep(i, n) rep(j, n){
        if (i < j){
            id[i][j] = v; v++;
        }
    }

    rep(i, n) rep(j, n-2){
        int id1 = get_id(i, a[i][j]);
        int id2 = get_id(i, a[i][j+1]);
        G[id1].push_back(id2);
    }
    
    fill(d, d+v, 1);
    int ans = 0;
    rep(i, v){
        int res = dfs(i);
        if (res == -1){
            cout << -1 << endl;
            return 0;
        }
        ans = max(ans, res);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 38400
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//{akari : 1D, yukari : 2D, maki : 3D} vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//{akane : ascending order, aoi : decending order} priority queue
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Libraries ---------------------------------//

//------------------------------- Dubug Functions ---------------------------//

inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}

//------------------------------- Solver ------------------------------------//

void solve()
{
    int n, m;
    cin >> n >> m;
    yukari<int> g(n);
    while (m--)
    {
        int a, b;
        cin >> a >> b;
        a--, b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    cout << "Yes" << endl;
    akari<int> dist(n, 1e7), pre(n);
    akane<pair<int, int>> pq;
    dist[0] = 0;
    pq.push({0, 0});
    while (!pq.empty())
    {
        auto p = pq.top();
        pq.pop();
        int v = p.second, c = p.first;
        for (int nv : g[v])
        {
            if (dist[nv] > c + 1)
            {
                dist[nv] = c + 1;
                pq.push({c + 1, nv});
                pre[nv] = v + 1;
            }
        }
    }
    for (int i = 1; i < n; i++)
    {
        cout << pre[i] << "\n";
    }
}

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


Measured memory_bytes: 11052
#include <bits/stdc++.h>
#define endl '\n'
#define F first
#define S second
#define all(c) c.begin(), c.end()
#define int long long
#define forn(i,a,b) for (int i=a; i<b; i++)
#define MOD 1000000000+7;

using namespace std;

void solve (){
	int a,b;
	cin>>a>>b;
	int c=__gcd(a,b);
	cout<<(a*(b/c))<<endl;
}

signed main(){
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	
    int t=1;
    //cin>>t;
    while (t--) solve();
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<algorithm>
#include<map>
#include<functional>
using namespace std;
 
int main() {
	int X, A, B;
 
	cin >> X >> A >> B;
 
	X -= A;
	X %= B;
	cout << X << endl;
 
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        List<Character> list = new ArrayList<>();

        for(int i = 0;i < n;i++){
            list.add(s.charAt(i));
        }
        List<Integer> w = new ArrayList<>();
        List<Integer> e = new ArrayList<>();
        if(s.charAt(0) == 'W'){
            w.add(1);
            e.add(0);
        }
        else{
            w.add(0);
            e.add(1);
        }
        for(int i = 0;i < n-1;i++){
            if(list.get(i+1) == 'W'){
                w.add(w.get(i)+1);
            }
            else{
                w.add(w.get(i));
            }
        }
        for(int i = 0;i < n-1;i++){
            if(list.get(i+1) == 'E'){
                e.add(e.get(i)+1);
            }
            else{
                e.add(e.get(i));
            }
        }
        int min = n;
        for(int i = 0;i < n;i++){
            int cnt = 0;
            int left = w.get(i);
            int right = e.get(n-1) - e.get(i);
            if(list.get(i) == 'W'){
                if(left > 0){
                    left--;
                }
            }
            //System.out.println("left = "+ left);
            //System.out.println("right = "+ right);
            cnt = left + right;
            //System.out.println("cnt = "+ cnt);
            min = Math.min(min,cnt);
        }
        System.out.println(min);
    }
}


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

int main() {
    int n;
    cin >> n;
    vector<vector<int>> c(10, vector<int>(10, 0));

    for (int i = 1; i <= n; i++) {
        int tmp = i;
        while (tmp >= 10) tmp /= 10;
        c[tmp][i % 10]++;
    }
    int ans = 0;
    for (int i = 1; i <= 9; i++) {
        for (int j = 1; j <= 9; j++) {
            ans += c[i][j] * c[j][i];
        }
    }
    cout << ans << endl;
}

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

typedef long long int ll;
typedef vector<int> vi;			typedef vector<ll> vl;
typedef vector<vi> vvi; 		typedef vector<vl> vvl;
typedef pair<int, int> 	pii;	typedef pair<ll, ll> pll;
typedef vector<pii> vii; 		typedef vector<pll> vll;
typedef map<int,int> mii;
typedef vector<char> vc;
typedef vector<bool> vb;
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define rforne(i,n) for(int i=n;i>=1;i--)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define in insert
#define mp(a, b) make_pair(a, b)
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define INF INT_MAX
#ifdef KARAN
	#include "../../trace.h"
#else
    #define trace(args...)
#endif

ll modpow(ll a, ll b, ll m = MOD){a %= m; ll res = 1; 
	while (b) {if (b & 1)res = (res * a) % m; a = (a * a) % m; b >>= 1;} return res;}
ll bpow(ll a, ll b){ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a, ll m = MOD) {return modpow(a, m - 2, m);}
void graph(vvi &adj, int m) {int x, y; forn(i, m){cin>>x>>y; adj[--x].pb(--y); adj[y].pb(x);}}

void solve(){
	ll x, s = 100;
	cin>>x;
	int t = 0;
	while(s<x){
		t++;
		s = s + s/100;
	}
	cout<<t<<endl;	
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	#ifdef KARAN
		freopen("inp.txt", "r", stdin);
    	freopen("out.txt", "w", stdout);
    	freopen("err.txt", "w", stderr);
	#endif
	int t=1;
	// cin>>t;
	while(t--)
		solve();
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

#define REVERSE(c) (char)(c == 'S' ? 'W' : 'S')
#define NEXT(a, b, c) (char)(a == 'S' ? (b == 'o' ? c : REVERSE(c)) : (b == 'o' ? REVERSE(c) : c))

int main() {
        int n;
        string s, ans;
        bool flag;
        string pre[4] = {"SS", "SW", "WS", "WW"};
        cin >> n >> s;

        for (int i = 0; i < 4; i++) {
                ans = pre[i];
                for (int j = 1; j < n-1; j++) {
                        ans += NEXT(ans[j], s[j], ans[j-1]);
                }
                flag = true;
                for (int j = 0; j < n; j++) {
                        int next = (j + n + 1) % n;
                        int prev = (j + n - 1) % n;
                        if (ans[j] == 'S') {
                                if (s[j] == 'o') {
                                        if (ans[prev] != ans[next])
                                                flag = false;
                                } else {
                                        if (ans[prev] == ans[next])
                                                flag = false;
                                }
                        } else {
                                if (s[j] == 'o') {
                                        if (ans[prev] == ans[next])
                                                flag = false;
                                } else {
                                        if (ans[prev] != ans[next])
                                                flag = false;
                                }
                        }
                }
                if (flag == true)
                        break;
        }
        if (flag == true)
                cout << ans << endl;
        else
                cout << -1 << endl;
        return 0;
}

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

using namespace std;
using namespace __gnu_pbds;

#define u(x, a, b) for(ll x = a; x < b; x++)
#define d(x, a, b) for(ll x = a; x > b; x--)

typedef long long ll;
typedef long double ld;

#define MAXI 100010
#define MOD 1000000007

int main(){
	ll n;
	cin >> n;
	
	ll x[n];
	u(one, 0, n){cin >> x[one];}
	
	ll mn = MAXI*MAXI;
	ll pos = -1;
	
	u(one, 1, 101){
		ll tot = 0;
		u(two, 0, n){
			tot += (x[two]-one)*(x[two]-one);
		}
		
		if(tot<mn){mn = tot;}
	}
	
	if(n==1){mn=0;}
	
	cout << mn;
}


Measured memory_bytes: 3612
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};
 

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  cout << min(A, B) + min(C, D) << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
const long long Maxn=200000+10;
bool vis[Maxn];
long long a[Maxn];
long long n,k,tot,cnt;
int main()
{
//	freopen("in.txt","r",stdin);
	scanf("%lld%lld",&n,&k);
	for(long long i=1;i<=n;++i)
	scanf("%lld",&a[i]);
	long long x=1;
	while(!vis[x])
	vis[x]=1,x=a[x];
	memset(vis,0,sizeof(vis));
	while(!vis[x])
	vis[x]=1,++tot,x=a[x];
	long long pos=x;
	x=1;
	while(x!=pos)x=a[x],++cnt;
	x=1;
	if(k>cnt+1)k=(k-cnt)%tot,k+=cnt;
	while(k--)x=a[x];
	printf("%lld\n",x);
	return 0;
}

Measured memory_bytes: 5584
#include <bits/stdc++.h>
#define ll      	long long int
#define PI      	acos(-1)
#define read    	freopen("in.txt","r",stdin)
#define uu      	first
#define vv      	second
#define write   	freopen("out.txt","w",stdout)
#define pii     	pair<int,int>
#define pll         pair<ll,ll>
#define INF     	1e9
#define EPS     	1e-8
#define MAX     	100005
#define MOD     	1000000007
#define fastRead 	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
int dp[MAX], mn;
int ara[200] , n , k;

int solve(int baki) {

    if( baki < mn ) {
        return 1;
    }
    int &ret = dp[baki];
    if( ret != -1 ) return ret;

    ret = 1;

    for(int i = 0 ; i < n ; i++ ) {
        if( ara[i] <= baki) {
            ret &= ( 1 ^ solve(baki - ara[i] ) );
        }
    }
    return ret;
}

int main()
{
    fastRead;
    cin>>n>>k;
    mn = INF;
    for(int i =0 ; i <n ; i++ ) {
        cin>>ara[i] , mn = min(mn , ara[i]);
    }
    memset(dp , -1 , sizeof dp);
    int ans = solve(k );
    if(ans == 0) cout<<"First"<<endl;
    else cout<<"Second"<<endl;
    return 0;
}




Measured memory_bytes: 5376
#include<iostream>
using namespace std;
int main(){
   int x,y,tmp;
   while(1){
       cin >> x >> y;
       if (x==0 && y==0)break;
       if (x>y){
           tmp=x;
           x=y;
           y=tmp;
           }
       cout << x << " " << y << endl;
   }
   return 0;
}


Measured memory_bytes: 3068
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
    int a, b, c;

    cin >> a >> b >> c;

    if (a-b >= c) {
        cout << 0 << endl;
    }
    else {
        cout << c - (a-b) << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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 (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

    int n;
    cin >> n;
    vector<pair<int,int>> pairs(n+1);
    rep1(i,n+1){
        int a;
        cin >> a;
        pairs[i] = make_pair(a,i);
    }
    sort(all(pairs));
    rep1(i,n+1){
        if(i==n){cout << pairs[i].second << endl;}
        else{cout << pairs[i].second <<" ";}
    }
    
    return 0;
}

Measured memory_bytes: 1664
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Arrays;

class Graph {
	private int totalVertex;
	//adjMatrix[u][v] = 1 if there is an edge from u to v, otherwise 0
	private int[][] adjMatrix;
	//adjWeight[u][v] -- the weight of the edge from u to v if there is one
	private int[][] adjWeight;
	//if a node is settled (e.g., processed in the Dijkstra's algorithm)
	private Boolean[] ifSettled;
	public Graph() { totalVertex = 0; }
	public int getTotalVertex() { return totalVertex; }
	//load graph from standard input
	public void loadAdjMatrix() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		adjMatrix = new int[totalVertex][totalVertex];
		adjWeight = new int[totalVertex][totalVertex];
		ifSettled = new Boolean[totalVertex];
		int i, j;
		for(i = 0; i < totalVertex; i ++) {
			ifSettled[i] = false;
			for(j = 0; j < totalVertex; j ++) {
				adjMatrix[i][j] = adjWeight[i][j] = 0;
			}
		}
		int u, v;
		for(i = 0; i < totalVertex; i ++) {
			u = in.nextInt();
			int degree = in.nextInt();
			for(j = 0; j < degree; j ++) {
				v = in.nextInt(); 
				adjMatrix[u][v] = 1;
				adjWeight[u][v] = in.nextInt();
			}	
		}
		in.close();
	}
	//return weight of the edge from u to v if there is one
	public int getWeight(int u, int v) {
		return adjWeight[u][v];
	}
	//return neighbors of u as a LinkedList
	public LinkedList<Integer> getNeighbors(int u) {
		LinkedList<Integer> tmp = new LinkedList<Integer>();
		for(int v = 0; v < totalVertex; v ++) {
			if(adjMatrix[u][v] == 1) tmp.add(v);
		}
		return tmp;
	}
	//return unsettled neighbors of u as a LinkedList
	public LinkedList<Integer> getUnsettledNeighbors(int u) {
		LinkedList<Integer> tmp = new LinkedList<Integer>();
		for(int v = 0; v < totalVertex; v ++) {
			if((adjMatrix[u][v] == 1) && (ifSettled[v] == false)) tmp.add(v);
		}
		return tmp;
	}
	//return the unsettled node that has the smallest dist
	public int getUnsettledNearest(int[] dist) {
		int md = Integer.MAX_VALUE;
		int mv = -1;
		int v;
		for(v = 0; v < totalVertex; v ++) {
			if((ifSettled[v] == false) && (dist[v] < md)) {
				md = dist[v];
				mv = v;
			}
		}
		return mv;
	}
	
	public boolean checkSettled(Boolean[] arr) {
		for(int i = 0; i < arr.length; i++) {
			if(!arr[i]) return false;
		}
		return true;
	}
	//implement the following	
	public int[] Dijkstra(int s) {
		int[] dist = new int[totalVertex];
		dist[0] = 0;
		for(int i = 1; i < totalVertex; i++) dist[i] = Integer.MAX_VALUE;
		while(!checkSettled(ifSettled)) {
			int v = getUnsettledNearest(dist);
			LinkedList<Integer> neighbors = getUnsettledNeighbors(v);
			for(int i = 0; i < neighbors.size(); i++) {
				dist[neighbors.get(i)] = Math.min(dist[v] + getWeight(v,neighbors.get(i)), dist[neighbors.get(i)]);
			}
			ifSettled[v] = true;
		}
		return dist;
	}
}

public class Main {
	public static void main(String[] argv) {
		Graph g = new Graph();
		g.loadAdjMatrix();
		int[] dist = g.Dijkstra(0);
		for(int i = 0; i < g.getTotalVertex(); i ++) {
			System.out.println(i + " " + dist[i]);
		}
	}
}



Measured memory_bytes: 40284
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
using namespace std;
int main(){
    int n;
    cin>>n;
    while(n--){
        string str;
        cin>>str;
        set<string>memo;
        for(int i=1;i<=str.length();i++){
            string s[4];
            s[0]=s[1]=str.substr(0,i),s[2]=s[3]=str.substr(i,str.length()-i);
            reverse(s[1].begin(),s[1].end());reverse(s[3].begin(),s[3].end());

            for(int i=0;i<4;i++){
                for(int j=0;j<4;j++){
                    if(i==j)continue;
                    if(i+j<2||i+j>4)continue;
                    memo.insert(s[i]+s[j]);
                }
            }
        }
        cout<<memo.size()<<endl;
    }
    return 0;
}

Measured memory_bytes: 1292
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
#define Reve(a) reverse(a.begin(), a.end())
typedef long long ll;
const ll MOD = 1e9+7;

/*ll gcd(ll a, ll b){
  if(b==0) return a;
  return gcd(b, a%b);
}*/
/*ll myPow(ll x, ll n, ll m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}*/

/*ll lcm(ll a, ll b){
  ll g = gcd(a, b);
  b /= g;
  a *= b;
  return a;
}*/

int main(){
  int s, w; cin >> s >> w;
  if(w>=s) cout << "unsafe" <<endl;
  else  cout << "safe" <<endl; 

}

Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstdio>
#include<ctype.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<numeric>
#include<string>
using namespace std;
typedef long long ll;

ll ds(ll digit) {
	ll res = 0;
	while (digit!=0) {
		res += digit % 10;
		digit /= 10;
	}
	return res;
}
ll MOD = 1000000007;
int main() {
	long double x, y;
	cin >> x >> y;
	long double z = x * y / (x + y);
	cout <<fixed<< setprecision(8)<< z << endl;


}



Measured memory_bytes: 384
#include <stdio.h>
int main(){
  int a,b;
  char op;
  while(1){
  scanf("%d %c %d",&a,&op,&b);

  if(op=='?')break;
  if (op=='+'){
    printf("%d\n",a+b);
  }else if(op=='-'){
    printf("%d\n",a-b);
  }else if(op=='*'){
    printf("%d\n",a*b);
  }else if(op=='/'){
    printf("%d\n",a/b);
  }
}
      return 0;
}

Measured memory_bytes: 600
from functools import reduce
from operator import mul

def cmb(n, r):
    r = min(n - r, r)
    if r == 0:
        return 1
    return reduce(mul, range(n, n - r, -1)) // reduce(mul, range(r, 0, -1))

n,a,b = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse = True)
if v[0] == v[a-1]:
  print(v[0])
  c = v.count(v[a-1])
  ans = 0
  for i in range(a,min(c+1,b+1)):
    ans += cmb(c,i)
  print(ans)
else:
  print(sum(v[:a]) / a)
  c = v.count(v[a-1])
  d = 0
  for key,value in enumerate(v):
    if value == v[a-1]:
      d = key
      break
  print(cmb(c,a-d))
  
  

Measured memory_bytes: 3572
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a , b;
    cin >> a >> b;
    if( a * b % 2 ) cout << "Odd";
    else cout << "Even";
}


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

// Contest: DISCO Presents Discovery Channel Code Contest 2020 Qual (https://atcoder.jp/contests/ddcc2020-qual)
// Problem: B: Iron Bar Cutting (https://atcoder.jp/contests/ddcc2020-qual/tasks/ddcc2020_qual_b)

using namespace std;

template <class T, size_t... Is> struct arr_helper;
template <class T, size_t... Is> using arr = typename arr_helper<T, Is...>::type;
template <class T> struct arr_helper<T> { using type = T; };
template <class T, size_t I, size_t... Is>
struct arr_helper<T, I, Is...> { using type = array<arr<T, Is...>, I>; };

using ll = int64_t;
using u64 = uint64_t;
using u32 = uint32_t;

using vi = vector<int>;
using vvi = vector<vi>;
using pi = pair<int, int>;
using vpi = vector<pi>;

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

    int n; cin >> n;
    vector<ll> a(n);
    for (auto& ai : a) cin >> ai;
    ll sum = accumulate(begin(a), end(a), (ll)0);
    ll p = 0;
    ll mn = sum;
    for (int i = 0; i < n - 1; ++i) {
        p += a[i];
        mn = min(mn, abs((sum - p) - p));
    }

    cout << mn << '\n';
    return 0;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define pb push_back
#define mp make_pair

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

string s;

int main() {
  cin >> s;
  int n = s.size();
  int ans = (n + 1) >> 1;
  int p = 0;
  int tmp = 0;
  rep(i,0,n) {
    int cnt = (s[i] == '1') + tmp;
    if(cnt & 1) {
      p = i;
      tmp++;
    }
    ans = max(ans, min(n - p, i + 1));
  }
  P(ans);
  return 0;
}


Measured memory_bytes: 512
n = int(input())
o = list(map(int, input().split()))

#11
#6 7 1 2 1 2 1 2 6 5 6

import collections as cl
a0 = cl.Counter(o[0::2]).most_common()
a1 = cl.Counter(o[1::2]).most_common()
a0.append((0,0))
a1.append((0,0))
if a0[0] != a1[0]:
    count = n - a0[0][1] - a1[0][1]
else:
    count = min(n - a0[1][1] - a1[0][1], n - a0[0][1] - a1[1][1])

print(count)

Measured memory_bytes: 65004
#include<iostream>
#include<string>
using namespace std;
int a=0,b=0;
int main(void)
{
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='0')
			a++;
		else
			b++;
	}
	cout<<min(a,b)*2;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define All(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
#define IN(a, b, x) (a<=x&&x<b)
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<ll>>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename t, typename u, typename Comp=less<>>
bool chmax(t& xmax, const u& x, Comp comp={}) { if(comp(xmax, x)) { xmax = x; return true; } return false;}
template<typename t, typename u, typename Comp=less<>>
bool chmin(t& xmin, const u& x, Comp comp={}) { if(comp(x, xmin)) { xmin = x; return true;} return false;}
const int INF = 1e9;
const ll infl = ll(1e18)+5;
/*
*ios::sync_with_stdio(false);
*cin.tie(0);
*/

struct Edge{
  ll to,id;
};
using Grp = vector<vector<Edge>>;
vector<int> path;
//u,vは制約,pは親ノード
bool dfs(const Grp &G, int u, int v, int p){
   if(u == v){
     return true;
   }
   for(auto e: G[u]){
     if(e.to != p){
       if(dfs(G, e.to, v, u)){
         path.push_back(e.id);
         return true;
       }
     }
   }
  return false;
}

int main(){
  int N;
  cin >> N;
  Grp G(N);
  rep(i,N-1){//辺
    int a,b;
    cin >> a >> b;
    a--,b--;
    G[a].push_back({b,i});
    G[b].push_back({a,i});
  }
  int M;
  cin >> M;
//制約ごと白くする辺を入れておく
vector<ll> cons(M);

  rep(i,M){
    int u,v;
    cin >> u >> v;
    u--,v--;
    path = vector<int>();//pathの初期化
    dfs(G,u,v,-1);
    for(auto e:path){
      cons[i] |= 1LL << e;//e番目の辺が白いことを記録,i番目の制約で
    }
  }
  //包除原理
  ll ans = 0;
  rep(bit, 1LL << M){
    ll eset = 0;
    rep(i,M){
      if(bit&(1LL<<i)){
        eset |= cons[i];
      }
    }
    int white = __builtin_popcountll(eset);  // 白くなるべき辺の数
        ll num = 1LL << (N - 1 - white);
        if (__builtin_popcountll(bit) % 2 == 0) {  // 制約が偶数か奇数か
            ans += num;
        } else {
            ans -= num;
        }
  } 
  cout << ans  << endl;
}

Measured memory_bytes: 256
N = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())

print(N[K-1])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define all(v) v.begin(), v.end()
//
int main(){
   int x,y;
   cin>>x>>y;
   rep(i,x+1){
      if(2*i+4*(x-i)==y){
         cout<<"Yes"<<endl;
         return 0;
      }
   }
   cout<<"No"<<endl;
}



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

int main() {
    int a ; 
    cin >> a; //2800 ≤ a < 5000
    string s;
    cin >> s ; //s is a string of lowercase English letter of length between 1 and 10 (inclusive). 
    if ( a >= 3200) cout << s << endl;
    else cout << "red" << endl;
	return 0;
}

Measured memory_bytes: 3596