akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
typedef long long ll;
const int mod = 998244353;
template <class E> struct csr {
    std::vector<int> start;
    std::vector<E> elist;
    csr(int n, const std::vector<std::pair<int, E>>& edges)
        : start(n + 1), elist(edges.size()) {
        for (auto e : edges) {
            start[e.first + 1]++;
        }
        for (int i = 1; i <= n; i++) {
            start[i] += start[i - 1];
        }
        auto counter = start;
        for (auto e : edges) {
            elist[counter[e.first]++] = e.second;
        }
    }
};

struct scc_graph {
  public:
    scc_graph(int n) : _n(n) {}

    int num_vertices() { return _n; }

    void add_edge(int from, int to) { edges.push_back({from, {to}}); }

    // @return pair of (# of scc, scc id)
    std::pair<int, std::vector<int>> scc_ids() {
        auto g = csr<edge>(_n, edges);
        int now_ord = 0, group_num = 0;
        std::vector<int> visited, low(_n), ord(_n, -1), ids(_n);
        visited.reserve(_n);
        auto dfs = [&](auto self, int v) -> void {
            low[v] = ord[v] = now_ord++;
            visited.push_back(v);
            for (int i = g.start[v]; i < g.start[v + 1]; i++) {
                auto to = g.elist[i].to;
                if (ord[to] == -1) {
                    self(self, to);
                    low[v] = std::min(low[v], low[to]);
                } else {
                    low[v] = std::min(low[v], ord[to]);
                }
            }
            if (low[v] == ord[v]) {
                while (true) {
                    int u = visited.back();
                    visited.pop_back();
                    ord[u] = _n;
                    ids[u] = group_num;
                    if (u == v) break;
                }
                group_num++;
            }
        };
        for (int i = 0; i < _n; i++) {
            if (ord[i] == -1) dfs(dfs, i);
        }
        for (auto& x : ids) {
            x = group_num - 1 - x;
        }
        return {group_num, ids};
    }

    std::vector<std::vector<int>> scc() {
        auto ids = scc_ids();
        int group_num = ids.first;
        std::vector<int> counts(group_num);
        for (auto x : ids.second) counts[x]++;
        std::vector<std::vector<int>> groups(ids.first);
        for (int i = 0; i < group_num; i++) {
            groups[i].reserve(counts[i]);
        }
        for (int i = 0; i < _n; i++) {
            groups[ids.second[i]].push_back(i);
        }
        return groups;
    }

  private:
    int _n;
    struct edge {
        int to;
    };
    std::vector<std::pair<int, edge>> edges;
};


int main(){
  int n,m; cin>>n>>m;
  scc_graph g(n);

  rep(i,m){
    int u,v; cin>>u>>v;
    g.add_edge(u,v);
  }

  auto scc = g.scc();

  cout << scc.size() << endl;

  for(auto v : scc) {
    cout << v.size() << " ";
    for(int x : v) {
      cout << x << " ";
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 40600
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <math.h>
#include <queue>
#include <list>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <ctime>
#include <iomanip>
#include <fstream>
#include <array>
using namespace std;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define IN(x,c) (find(c.begin(),c.end(),x) != (c).end())
#define REP(i,n) for (int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define INIT(a,v) memset(a,v,sizeof(a))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
template<class A, class B> A cvt(B x) { stringstream ss; ss<<x; A y; ss>>y; return y; }

#define SPC << " " <<
#define DEBUG(x) cerr << #x << " = "; cerr << x << endl;
#define DEBUG_ITER(x) cerr << #x << " = "; for (auto _ : x) cerr << _ << ' '; cerr << endl;

typedef pair<int,int> PII;
typedef long long int64;
typedef vector<int> VI;

int n;
int l[100];

int main() {
	//freopen("test.in","r",stdin);
	cin >> n;
	REP (i,n) cin >> l[i];
	sort(l,l+n);
	int st=0;
	REP (a,n) {
		REP (b,a) {
			REP (c,b) {
				if (l[a]!=l[b] && l[a]!=l[c] && l[b]!=l[c]) {
					if (l[a]<l[b]+l[c]) {
						st++;
					}
				}
			}
		}
	}
	cout << st << endl;
	return 0;
}


Measured memory_bytes: 3636
let () =
  let rec main_loop () =
    let n = read_int () in
    if n = 0 then ()
    else begin
      let rec doit i ans sum =
        if i = n then ans
        else
          let a = read_int () in
          let sum = max a (sum + a) in
          doit (i + 1) (max ans sum) sum in
      doit 0 min_int 0 |> Printf.printf "%d\n";
      main_loop ()
    end in
  main_loop ()

Measured memory_bytes: 2492
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,cnt=0;
    scanf("%d",&n);
    int arr[n];
    for(int i=0;i<n;i++)
    scanf("%d",&arr[i]);
     for(int i=0;i<n-1;i++)
         for(int j=0;j<n-i-1;j++)
         {
             if(arr[j]>arr[j+1])
             {
                 swap(arr[j],arr[j+1]);
                 cnt++;
             }
         }
 for(int i=0;i<n-1;i++)
    printf("%d ",arr[i]);
printf("%d\n",arr[n-1]);
 printf("%d\n",cnt);
}

Measured memory_bytes: 3196
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
using namespace std;
#define INF 0x3f3f3f3f
//#define INF 1100000000000000000LL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//int arr[SIZE]={};
//ここまでテンプレ
int main(){
	int N;
	cin>>N;
	//int a[1000]={};
	ll ans=1;
	int en=1;
	for(int i=0;i<N;i++){
		ans*=3;
		int a;
		cin>>a;
		if(a%2==0)
			en*=2;
	}
	cout<<ans-en<<endl;
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <list>
#include <iomanip>
#include <queue>
#include <cmath>
#include <numeric>
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)

using namespace std;
using ll = long long;
typedef pair<ll, ll> p;
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; }
const long long mod = 1e9 + 7;
ll gcd(ll a, ll b);
ll lcm(ll a, ll b);

int main() {

    ll N;
    cin >> N;

    string S;
    cin >> S;

    vector<char> p(3);
    ll ans = 0 , d, tmp;

    rep(i, 1000) {
        tmp = i;
        rep(j, 3) {
            d = pow(10, 2 - j);
            p[j] = tmp / d + '0';
            tmp %= d;
        }
        ll x = 0, y = 0;
        while(x != N){
            if (S[x] == p[y]) y++;
            if (y == 3) {
                ans++;
                break;
            }
            x++;
        }
    }
    cout << ans;

    return 0;
}



ll gcd(ll a, ll b) {
    if (a % b == 0)return(b);
    else return(gcd(b, a % b));
}
ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}

Measured memory_bytes: 3844
#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1.0)
#define P pair<int,int>
#define PiP pair<ll,pair<ll,ll>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main(){
    string s;
    cin >> s;
    if(s == "RRR")cout << 3 << endl;
    else if(s == "RRS" || s == "SRR")cout << 2 << endl;
    else if(s == "SSS")cout << 0 << endl;
    else cout << 1 << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <string.h>
#include <ctype.h>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {
  int n,a[200000];
  cin >> n;
  for(int i = 0; i < n; i++)
    cin >> a[i];

  int cnt = 0;
  for(int i = 0; i < n; i++) {
    if(a[i] % 2 == 1) cnt++;
  }
  if(cnt % 2 == 1) 
    cout << "NO" << endl;
  else
    cout << "YES" << endl;  
}


Measured memory_bytes: 3912
n = int(input())
arr = [0 for i in range(n)]
for i in range(n):
    it = i+1
    if not ((it %3 == 0 and it%5==0) or it%3 == 0 or it%5 == 0):
        arr[i] = i+1
# print(arr)
print(sum(arr))

Measured memory_bytes: 33488
//
// Created by yuki on 2018/9/4.
//

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

int n, k;

int main() {
    cin >> n >> k;
    long long ans = 0;
    for (int i = 1; i <= n; i++) {
        if (i * 2 % k != 0) continue;
        int p = (n - i) / k;
        int q = (i - 1) / k;
        int t = p + q + 1;
        ans += 1ll * t * t;
    }
    cout << ans << endl;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

int main() {
    int n;
    cin >> n;
    set<string> st;
    rep(i, n){
        string buf;
        cin >> buf;
        st.insert(buf);
    }
    cout << st.size() << endl;
    return 0;    
}


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

int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  for (int i = 0; i < n; i++) {
    cin >> d.at(i);
  }
  int sum = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j <  n; j++) {
      sum += d.at(i) * d.at(j);
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define debugvec(v)   rep(i, v.size()) cerr << "L" << __LINE__ << ": " << #v << "[" << i << "] = " << v[i] << endl;
#define debugvec2(v)  cerr << "L" << __LINE__ << ": " << #v << " = { "; rep(i, v.size()) cerr << v[i] << (i + 1 == v.size() ? "" : ", "); cerr << " }" << endl;
typedef long long ll;  /* 10^18 くらいまでいける */

int main(){
  string s, t;
  cin >> s >> t;

  cout << t << s << endl;

  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
"""
def main():
    N = int(input())
    A_lsit = list(map(int, input().split()))

    DP_list = [1000]*N

    for i in range(N):
        bought_stock_number = DP_list[i]//A_lsit[i]
        remained_monye = DP_list[i]%A_lsit[i]
        max_i = DP_list[i]
        for j in range(i+1, N):
            DP_list[j] = max(
                max_i,
                DP_list[j],
                bought_stock_number*A_lsit[j] + remained_monye
            )
    print(DP_list[-1])

if __name__ == "__main__":
    main()



Measured memory_bytes: 9200
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = int64_t;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}

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

  int n; cin >> n;
  vector<int> a(n);
  map<int, int> mp;
  for (int i = 0; i < n; ++i) {
    cin >> a[i]; ++mp[a[i]];
  }

  int even = 0;
  for (auto it = mp.begin(); it != mp.end(); ++it) {
    even += !(it->second & 1);
  }

  sort(all(a));

  int cnt = 0, beg = 0;
  while (beg < n) {
    int end = beg;
    while (end + 1 < n && a[end + 1] == a[beg]) ++end;
    ++cnt; beg = end + 1;
  }
  // debug(even);
  if (even & 1) {
    print(cnt - 1);
  } else {
    print(cnt);
  }

  return 0;
}

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

int main()
{
    int n;ll k;
    cin>>n>>k;
    int a[n+1];
    for(int i=1;i<=n;i++)
        cin>>a[i];
    int ans[n+1],cnt=1,vis[n+1]={0};
    for(int i=1;;i=a[i]){
        vis[i]++;
        if(vis[i]==3) break;
        ans[cnt++]=i;
    }
   if(vis[ans[1]]==2) cout<<ans[(k+1)%(cnt-1)==0?cnt-1:(k+1)%(cnt-1)];
   else{
        int pos,t;
        for(int i=1;i<cnt;i++) if(vis[ans[i]]==3) {pos=i;break;}
        for(int i=pos+1;i<cnt;i++) if(ans[i]==ans[pos]) {t=i-pos;break;}
        if(k<=pos-1) cout<<ans[k+1];
        else cout<<ans[((k+1-pos+1)%t==0?t:(k+1-pos+1)%t)+pos-1];
   }
    return 0;
}


Measured memory_bytes: 5968
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s; cin >> s;
  int a = 0, b = 0, c = 0;
  FOR(i,0,s.length()) {
    if(s[i] == 'a') a++;
    if(s[i] == 'b') b++;
    if(s[i] == 'c') c++;
  }
  int x = min(a, min(b, c));
  a -= x;
  b -= x;
  c -= x;
  if(a > 1 || b > 1 || c > 1) cout << "NO" << endl;
  else cout << "YES" << endl;
  return 0;
}

Measured memory_bytes: 512
def main():
    n = int(input())
    L = []
    for _ in range(n):
        x,l = map(int,input().split())
        L.append([x+l,x-l])

    L.sort()

    cnt = 0
    right = -10**9
    for r,l in L:
        if right <= l:
            cnt += 1
            right = r

    print(cnt)

main()

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

int main(){
  string S;
  cin >>S;
  if( (S=="AAA")||(S=="BBB")){
    cout<<"No"<<endl;
    return 0;
  }
  cout<<"Yes"<<endl;
  
  
  return 0;
}

  
  


Measured memory_bytes: 256
N, Ma, Mb = map(int, input().split())
rec = []
for i in range(N):
    a, b, c = map(int, input().split())
    rec.append((a, b, c))

INF = float("inf")
ma = 401
dp = [[[INF] * ma for j in range(ma)] for i in range(N + 1)]

dp[0][0][0] = 0
for i in range(N):
    for j in range(ma):
        for k in range(ma):
            if dp[i][j][k] == INF:
                continue
            dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k])
            dp[i + 1][j + rec[i][0]][k + rec[i][1]] = min(dp[i + 1][j + rec[i][0]][k + rec[i][1]], dp[i][j][k] + rec[i][2])

ans = INF
for i in range(1, ma):
    for j in range(1, ma):
        if i * Mb == j * Ma:
            ans = min(ans, dp[N][i][j])

if ans == INF:
    print(-1)
else:
    print(ans)


Measured memory_bytes: 59500
#include "bits/stdc++.h"
using namespace std;

typedef long long LL;
typedef vector<int> vi;
typedef vector<LL> vl;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
typedef vector<pii> vpi;
typedef vector<pll> vpl;

#define fast ios_base::sync_with_stdio(0),cin.tie(0)
#define temp template<typename T>
#define debug(x) cerr<<"Line "<<__LINE__<<": "<<#x<<" = "<<x<<'\n'
#define itr(it,x) for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define rep(i,a,b) for(int i=a;i<=(int)b;i++)
#define repr(i,a,b) for(int i=a;i>=(int)b;i--)
#define cas(n) printf("Case %d:",(int)n)
#define mem(x,v) memset(x,v,sizeof(x))
#define read(x) freopen(x,"r",stdin)
#define write(x) freopen(x,"w",stdout)
#define all(x) x.begin(),x.end()
#define aut(x,v) for(auto &x:v)
#define ini(n) scanf("%d",&n)
#define inl(n) scanf("%lld",&n)
#define ind(n) scanf("%lf",&n)
#define ins(n) scanf("%s",n)
#define insn(n) scanf(" %[^\n]",n)
#define outi(n) printf("%d",(int)n)
#define outl(n) printf("%lld",(LL)n)
#define outd(n,p) printf("%.*lf",p,(double)n)
#define outs(n) printf("%s",n)
#define sz(x) (int)x.size()
#define nl printf("\n")
#define sp printf(" ")
#define pb push_back
#define mp make_pair
#define xx first
#define yy second

const int inf=0x3f3f3f3f;
const int mod=1000000007;
const int mx=100005;
const LL  infL=0xf3f3f3f3f3f3f3f;
const double eps=1e-9;
const double pi=acos(-1.0);

int main()
{
    //read("in.txt"),write("out.txt");
    string x;
    cin>>x;
    outi(count(all(x),'2')),nl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define Rep(i,n) for(ll i=1;i<=n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
#define prique priority_queue<ll>
const int mod = 1000000007;
const int mod2 = 998244353;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
long nCr(int n, int r) {
	int ans = 1;
	for (ll i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
struct union_find {
	int par[200010], size_[200010];
	void init(int x) {
		rep(i, x) { par[i] = i; size_[i] = 1; }
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (size_[x] < size_[y]) {
			par[x] = y;
			size_[y] += size_[x];
		}
		else {
			par[y] = x;
			size_[x] += size_[y];
		}
	}
};
int a[100010];
signed main() {
	int n;
	cin >> n;
	rep(i, n)cin >> a[i];
	if (n % 2 == 0) {
		sort(a, a + n);
		rep(i,n){
			if (a[i] != (i / 2) * 2 + 1) {
				cout << 0 << endl; return 0;
			}
		}
		int ans = 1;
	}
	else {
		sort(a, a + n);
		rep(i, n) {
			if (i != 0 && a[i] != ((i + 1) / 2) * 2 ) {
				cout << 0 << endl; return 0;
			}
		}
		int ans = 1;
	}
	cout << mod_pow(2, n / 2, mod) << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>
#define MAX 250

int main(){

  int A[MAX],i,num;
  scanf("%d",&num);

  for(i=1;i<=num;i++){
    scanf("%d",&A[i]);
  }

for(i=1;i<=num;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if( i != 1)printf("parent key = %d, ",A[i/2]);
    if(i*2 <= num)printf("left key = %d, ",A[i*2]);
    if(i*2+1 <= num )printf("right key = %d, ",A[i*2+1]);
    printf("\n");
  }
  return 0;
}

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

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

#define MOD 1000000007

using namespace std;

int main(){
	int a,b,c;
	cin >> b >> c >> a;
	cout << a << " " << b << " " << c << endl;
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3", "unroll-loops")

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <bitset>
#include <sstream>
#include <deque>
#include <queue>
#include <random>
#include <complex>

using namespace std;

#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FIXED cout << fixed << setprecision(12);
#define RANDOM srand(94385)
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define graph vector<vector<int>>
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define f first
#define s second
#define hashmap unordered_map
#define hashset unordered_set
#define eps 1e-9
#define mod 1000000007
#define inf 3000000000000000007ll
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define shuffle(a) \
    for (int i = 0; i < sz(a); ++i) \
        swap(a[i], a[rand() % sz(a)])

template<class T, class U> inline void checkmin(T &x, U y) { if (y < x) x = y; }
template<class T, class U> inline void checkmax(T &x, U y) { if (y > x) x = y; }
template<class T, class U> inline bool ifmax(T &x, U y) { if (y > x) return x = y, true; return false; }
template<class T, class U> inline bool ifmin(T &x, U y) { if (y < x) return x = y, true; return false; }
template<class T> inline void sort(T &a) { sort(all(a)); }
template<class T> inline void rsort(T &a) { sort(rall(a)); }
template<class T> inline void reverse(T &a) { reverse(all(a)); }
template<class T, class U> inline istream& operator>>(istream& str, pair<T, U> &p) { return str >> p.f >> p.s; }
template<class T> inline istream& operator>>(istream& str, vector<T> &a) { for (auto &i : a) str >> i; return str; }

signed main() {
    FAST; FIXED; RANDOM;
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    cin >> a;
    int ans = 0;
    for (int x = 0; x <= k && x <= n; ++x) {
        for (int s = 0; s <= x; ++s) {
            vector<int> b;
            for (int i = 0; i < s; ++i) b.pb(a[i]);
            for (int i = n - x + s; i < n; ++i) b.pb(a[i]);
            sort(b);
            int sum = 0;
            for (auto i : b) sum += i;
            for (int i = 0; i < k - x && i < sz(b); ++i) 
                if (b[i] < 0) sum -= b[i];
            checkmax(ans, sum);
        }
    }
    cout << ans;
    return 0;
}   

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
	long long h,w,ans;
	scanf("%lld%lld",&h,&w);
	if(h==1||w==1){
		printf("1\n");
	}
	else{
		ans=h*w;
		if(ans%2==0){
			ans=ans/2;
		}
		else{
			ans=ans/2+1;
		}
		printf("%lld\n",ans);
	}
	return 0;
} 

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

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N;
	int a = 0, b = 0, con = 1;
	vector<int> P, Q, Z;
	
	cin>>N;
	
	P.resize(N);
	Q.resize(N);
	
	for(int i = 0; i < N; i++){
		Z.push_back(i+1);
	}
	
	for(int i = 0; i < N; i++){
		cin>>P[i];
	}
	
	for(int i = 0; i < N; i++){
		cin>>Q[i];
	}
	
	do{
		if(P == Z) a = con;
		if(Q == Z) b = con;
		
		con++;
	} while(next_permutation(Z.begin(), Z.end()));
	
	cout<<abs(a-b)<<endl;
	
	return 0;
}

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

int main(){
	ll n,m;
	cin>>n>>m;
	vector<vector<int> > g(n+1);
	for(ll i=0;i<m;i++){
		int u,v;
		cin>>u>>v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	vector<ll> d(n+1,LONG_MAX);
	d[1]=0;
	vector<ll> p(n+1,0);
	queue<ll> q;
	q.push(1);
	
	while(!q.empty()){
		ll tp=q.front();
		q.pop();
		for(ll i=0;i<g[tp].size();i++){
			if(d[g[tp][i]]==LONG_MAX){
				d[g[tp][i]]=d[tp]+1;
				p[g[tp][i]]=tp;
				q.push(g[tp][i]);
			}	
		}
	}
	bool flag=false;
	for(int i=2;i<(n+1);i++){
		if(p[i]==0){
			flag=true;
			break;
		}
	}
	if(flag){
		cout<<"No"<<endl;
	}
	else{
		cout<<"Yes"<<endl;
		for(int i=2;i<(n+1);i++){
			cout<<p[i]<<endl;
		}
	}
	return 0;
}


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

int main(){
    string s;
    string right="yuiophjklnm";
    cin >> s;
    while(s.at(0)!='#'){
        vector<int> Right(s.size(),0);
        for(int i=0;i<s.size();i++){
            if(find(right.begin(),right.end(),s.at(i))==right.end()){
                Right.at(i)=1;
            }
        }
        int count=0;
        for(int i=1;i<Right.size();i++){
            if(Right.at(i)!=Right.at(i-1)) count++;
        }
        cout << count << endl;
        cin >> s;
    }
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
typedef long long lint;
using namespace std;

string s;

int main() {
    cin >> s;
    string t;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] != 'x') {
            t.push_back(s[i]);
        }
    }
    int m = t.length();
    for (int i = 0; i < m - i - 1; i++) {
        if (t[i] != t[m - i - 1]) {
            cout << -1 << endl;
            return 0;
        }
    }
    int n = s.length();
    int left = 0, right = n - 1;
    int ans = 0;
    while (left < right) {
        if (s[left] != s[right]) {
            ans++;
            if (s[left] == 'x') {
                left++;
            } else {
                right--;
            }
        } else {
            left++, right--;
        }
    }
    cout << ans << endl;
}

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

int main() {
  vector<int> g2 = {4, 6, 9, 11};
  int x, y;
  cin >> x >> y;
  int xx = 1, yy = 1;
  if(x == 2) xx = 3;
  if(y == 2) yy = 3;
  for(int i = 0; i < 4; i++){
    if(x == g2.at(i)) xx = 2;
    if(y == g2.at(i)) yy = 2;
  }
  if(xx == yy) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <set>
#include <vector>
#include <iostream>
using namespace std;
typedef long long ll;
const int mod = 10000000;
int m, n, a, b;
int main() {
	while (cin >> m, m) {
		vector<ll> v(m);
		for (int i = 0; i < m; i++) {
			cin >> a >> b;
			v[i] = 1LL * a * mod + b;
		}
		set<ll> s;
		cin >> n;
		for (int i = 0; i < n; i++) {
			cin >> a >> b;
			s.insert(1LL * a * mod + b);
		}
		for (ll i : s) {
			bool flag = true;
			for (int j = 1; j < v.size() && flag; j++) {
				if (s.find(v[j] - v[0] + i) == s.end()) flag = false;
			}
			if (flag) cout << i / mod - v[0] / mod << ' ' << i % mod - v[0] % mod << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3108
#include <iostream>
#define min(a,b) (((a)<=(b))?(a):(b))
using namespace std;

int main()
{
	int n,n10,n50,n100,n500;
	cin >> n;
	while (n) {
		cin >> n10 >> n50 >> n100 >> n500;
		n = n10 * 10 + n50 * 50 + n100 * 100 + n500 * 500 - n;
		n10 -= min(n % 50 / 10, n10);
		n -= n % 50;
		n50 -= min(n % 100 / 50, n50);
		n -= n % 100;
		n100 -= min(n % 500 / 100, n100);
		n -= n % 500;
		n500 -= min(n / 500, n500);

		if (n10)
			cout << "10 " << n10 << endl;
		if (n50)
			cout << "50 " << n50 << endl;
		if (n100)
			cout << "100 " << n100 << endl;
		if (n500)
			cout << "500 " << n500 << endl;

		cin >> n;
		if(n)
			cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main() {
  int N;cin >> N; map<ll, ll> A;
  rep(i,N){
    ll a;cin >> a;
    A[a]++;
  }
  int M;cin >> M;map<ll, ll> B;
  rep(i, M){
    ll b; cin >> b;B[b]++;
  }
  if (N < M) {
    cout << "NO" << endl;
    return 0;
  }
  bool judge;
  for (auto p : B){
    ll value = p.second;
    if (A[p.first] >= value) judge = 1;
    else {
      judge = 0;
      break;
    }
  }
  if (judge) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 25216
import bisect

N, C, K = map(int, input().split())
T = sorted([int(input()) for i in range(N)])

i = 0
ans = 0

while T:
    ans += 1
    check = T[0] + K
    people = bisect.bisect_right(T, check)
    if people > C:
        del T[:C]
    else:
        del T[:people]

print(ans)

Measured memory_bytes: 8280
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 300005;

void setIn(string s) { freopen(s.c_str(),"r",stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }

void io(string s = "") {
    ios_base::sync_with_stdio(0); cin.tie(0);
    if (sz(s)) {
    	setIn(s+".in");
    	setOut(s+".out");
    }
}

int n, cum[MX];

bool OK(vi p) {
    /*for (int i: p) cout << i << " ";
    cout << "\n";*/
    
    if (sz(p) % 2 != 1) return 0;
    for (int& i: p) if (i < 0 || i >= sz(p)) return 0;
    if (sz(p) == 1) return 1;
    for (int i = 1; i < sz(p); i += 2) if (p[i] != i) return 0;
    vi le, ri;
    for (int i = 0; i < sz(p); i += 2) {
        if (p[i] < i) le.pb(p[i]);
        else if (p[i] == i) return 0;
        else ri.pb(p[i]);
    }
    F0R(i,sz(le)-1) if (le[i] > le[i+1]) return 0;
    F0R(i,sz(ri)-1) if (ri[i] > ri[i+1]) return 0;
    return 1;
}

bool ok(vi p) {
    for (int& i: p) i --;
    F0R(i,sz(p)) {
        int l = i, r = p[i]; if (l > r) swap(l,r);
        cum[l] ++; cum[r] --;
    }
    FOR(i,1,sz(p)) cum[i] += cum[i-1];
    F0R(i,sz(p)) {
        int I = i;
        while (cum[i]) i ++;
        vi tmp;
        FOR(j,I,i+1) tmp.pb(p[j]-I);
        if (!OK(tmp)) return 0;
    }
    return 1;
}

int main() {
    io();
    cin >> n; vi p(n);
    F0R(i,n) cin >> p[i];
    if (ok(p)) cout << "Yes\n";
    else cout << "No";
}

/* 
* (Actually read this pls)
    * Rlly bad errors: int overflow, array bounds
    * Less bad errors: special cases (n=1?), set tle
    * Common sense: do smth instead of nothing
*/

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

int main()
{
    int T[101][101], r,c;
    cin >> r >> c;
    
    for(int i=0; i<r; i++){
        for(int j=0; j<c; j++) cin >> T[i][j];
    }
    for(int i=0; i<=r; i++) T[i][c] = 0;
    for(int j=0; j<=c; j++) T[r][j] = 0;
    
    for(int i=0; i<r; i++){
        for(int j=0; j<c; j++){
            T[i][c] += T[i][j];
            T[r][j] += T[i][j];
            T[r][c] += T[i][j];
        }
    }
                            
    for(int i=0; i<=r; i++){
        for(int j=0; j<=c; j++){
            if(j) cout << ' ';
            cout << T[i][j];
        }
        cout << endl;
    }
}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
typedef long long ll;
const int N=1e5+5;
const int p=1e9+7;
#define PI acos(-1)
ll qpow(ll a,ll n){ll res=1;while(n){if(n&1)res=res*a%p;a=a*a%p;n>>=1;}return res;}
void work()
{
    int n;
    scanf("%d",&n);
    printf("%.5f\n",n*2*PI);
}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int T=1;
    //scanf("%d",&T);
    //cin>>T;
    while(T--){
        work();
    }
}

Measured memory_bytes: 3852
////=====BIsmillahir Rahmanir Rahim =====////

/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
         Comilla University

*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#define fi 2*acos(0.0)
#define ee 2.71828
#define ll  long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define ff first
#define ss second
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define edl printf("\n")
#define infinity 1e16
#define mod 1000000007
#define cn continue
#define csprint1 printf("Case %lld: ", cs++)
#define csprint2 printf("Case %lld:\n", cs++)
#define sf(a) scanf("%lld", &a)
#define sff(a,b) scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define sffff(a,b,c,d) scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define all(v) v.begin(),v.end()
#define pfn(a) printf("%lld\n",a)
#define pfs(a) printf("%lld ",a)

using namespace __gnu_pbds;
using namespace std;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<pl> vpi;
typedef vector<pl> vpl;
typedef tree<pair<ll, int> , null_type, less<pair<ll, int> >, rb_tree_tag, tree_order_statistics_node_update> ost;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a <<","<< spc;
    err(++it, args...);
    cout<<edl;
}
///Bit manipulation

bool checkbit(int mask,int bit){return mask & (1<<bit);}
int setbit(int mask,int bit){ return mask | (1<<bit) ; }
int clearbit(int mask,int bit){return mask & ~(1<<bit);}
int togglebit(int mask,int bit){return mask ^ (1<<bit);}
int bitno(int mask) {return (int)__builtin_popcount(mask);}

/*----------------------Graph Moves----------------*/
const int fx[]={+1,-1,+0,+0};
const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

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

const int  maX=1e5+10;
ll M = 10000007;
int main() {
    ll n,k;sff(n,k);
    ll ara[n];
    for(ll i=0;i<n;i++)sf(ara[i]);
    ll sum=0;
    ll dp[maX];
    dp[n-1]=0;
    for(ll i=n-2;i>=0;i--){
        dp[i]=infinity;
        //cout<<i<<spc;
        for(ll j=1;j<=k;j++){
            if(i+j>=n)continue;
            dp[i]=min(dp[i],dp[i+j]+abs(ara[i]-ara[i+j]));
           // cout<<dp[i]<<spc;
        }
       // edl;
    }
    pfn(dp[0]);
return 0;
}


Measured memory_bytes: 5352
def read_input():
    n, m = map(int, input().split())
    alist = list(map(int, input().split()))

    clist = []
    for i in range(m):
        b, c = map(int, input().split())
        clist.append([c, b])

    return alist, clist

def submit():
    alist, clist = read_input()

    alist.sort(reverse=False)
    clist.sort(key=lambda x: x[0], reverse=True)

    j = 0
    result = 0
    for a in alist:
        if j >= len(clist):
            result += a
        elif a >= clist[j][0]:
            result += a
        else:
            if clist[j][1] > 0:
                result += clist[j][0]
                clist[j][1] -= 1
                if clist[j][1] == 0:
                    j += 1

    print(result)



if __name__ == '__main__':
    submit()


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

#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, init, n) for(int i = init; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define Cout(obj) cout << obj << endl
#define Size(obj) (int)(obj).size()
#define fcout cout << fixed << setprecision(10)
#define fi first
#define se second

using namespace std;
using ll = long long int;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct
{
    int to, cost;
};

const int MOD = 1e9 + 7;
const int iINF = 1e9;
const long long int llINF = 1e18;
const double PI = acos(-1.0);

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

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

    int N, M, p;
    cin >> N >> M >> p;

    vector<int> d(M);
    
    REP(i, M)
    {
        cin >> d[i];
        d[i] -= p;
        d[i] = (d[i] + N) % N;
    }

    sort(ALL(d));

    int ans = min(d.back(), N - d[0]);

    REP(i, M - 1)
    {
        ans = min(ans, min(2 * d[i] + (N - d[i + 1]), 2 * (N - d[i + 1]) + d[i]));
    }

    Cout(ans * 100);

    return 0;
}


Measured memory_bytes: 3196
#include <stdio.h>
#include <math.h>

#define Min 1
#define Max pow(10,9)

int gcd_euclid(int a,int b);

int main(){
  int x,y,t,gcd;

  scanf("%d%d",&x,&y);
 
  if(x >= Min && y <= Max){
    if(x < y){
      t = x;
      x = y;
      y = t;
    }
    gcd = gcd_euclid(x,y);
   
    printf("%d\n",gcd);
  }

  return 0;
}

int gcd_euclid(int a, int b){
  int r;

  while(0!=b){
    r = a % b;
    a = b;
    b = r;
  }

  return a;
}
  



Measured memory_bytes: 2124
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int X;
    cin >> X;
    int total = 0;
    for (int i = 1; i <= 360; ++i) {
		total += X;
		if (total % 360 == 0) {
			cout << i << nl;
			break;
		}
	}
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 3636
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N=int(input())
    s=[input() for i in range(N)]
    M=int(input())
    t=[input() for i in range(M)]
    ans=0
    for a in set(s):
        ans=max(ans,s.count(a)-t.count(a))
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
S=input()
right=[0]*(len(S)+1)
for i in range(len(S)):
    if S[i]=="<":
        right[i+1]=right[i]+1
left=[0]*(len(S)+1)

for j in range(len(S)-1,-1,-1):
    if S[j]==">":
        left[j]=left[j+1]+1
        
total=0
for k in range(len(S)+1):
    total+=max(right[k],left[k])
print(total)

Measured memory_bytes: 33020
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

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

    UnionFind tree(N);

    for(int i = 0; i < M; i++) {
        int  x, y;
        cin >> x >> y;
        tree.unite(x-1, y-1); // xの木とyの木を併合する
    }

    int cnt=0;
    for(int i=0;i<N;i++){
        if(!tree.same(0,i)){
            tree.unite(0, i);
            cnt++;
        }
    }

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


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

bool isprime(int x) {
    if(x == 1) return false;
    for(int i = 2; i < x; i++) {
        if(x%i==0) return false;
    }
    return true;
}

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

    vector<int> v;
    for(int i = 11; i < 55555; i += 10) {
        if(isprime(i)) {
            if(i%5 == 1) {
                v.push_back(i);
                n--;
                if(n <= 0) break;
            }
        }
    }

    for(const auto& e : v) {
        cout << e << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<set>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define INF 1<<25
 
typedef long long ll;

int dy[8]={1,1,1,0,0,-1,-1,-1};
int dx[8]={-1,0,1,-1,1,-1,0,1};
struct S{
	int a,b,c;
};
bool asc(const S& left,const S& right){
	return left.c > right.c;
}

vector<int>A,B,C;
int main(){
	int N;
	cin>>N;
	int tmp;
	rep(i,N){
		cin>>tmp;
		A.push_back(tmp);
	}
	rep(i,N){
		cin>>tmp;
		B.push_back(tmp);
	}
	rep(i,N){
		cin>>tmp;
		C.push_back(tmp);
	}
	sort(ALL(A));
	sort(ALL(B));
	sort(ALL(C));
	ll ans=0;
	rep(i,N){
		ll u=lower_bound(ALL(A),B[i])-A.begin();
		ll o=C.end()-upper_bound(ALL(C),B[i]);
		ans+=u*o;
	}
	cout<<ans<<endl;
	return 0;
}



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

typedef long int lint;
typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<long, long> pll;

#define EACH(i, c) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)
#define endl '\n'
#define mod 1000000007
#define INF 100000000
#define fk first
#define sv second

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

template<typename T>
void print(const std::vector<T>& v, char sep=' ') {
  for (int i = 0; i < (int)v.size(); i++) {
    if (i != 0) cout << sep;
    cout << v[i];
  }
  cout << endl;
}

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

  while (cin >> n, n){
    int ct = 0;
    if (n % 1111 == 0){
      cout << "NA\n";
      continue;
    }
    
    while (n != 6174){
      int l, s, num[4];
      REP(i, 4){
        num[i] = n % 10;
        n /= 10;
      }
      sort(num, num + 4);
      l = s = 0;
      REP(i, 4){
        l = l * 10 + num[3 - i];
        s = s * 10 + num[i];
      }
      n = l - s;
      ct++;
    }
    cout << ct << endl;
  }
}

Measured memory_bytes: 3196
#include <stdio.h>
#include <string.h>
int main()
{
    char st[4];
    int i, s;
    gets(st);
    s=0;
    for(i=0; i<4; i++){
        if(st[i]=='+'){
           s = s+1;
        }
        else if(st[i]=='-'){
            s = s-1;
        }
    }
    printf("%d\n", s);
    return 0;
}


Measured memory_bytes: 128
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;

#define all(c) (c).begin(),(c).end()
#define endl "\n"
#define ff first
#define ss second
#define allr(c) (c).rbegin(),(c).rend()
#define ifr(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pof pop_front
#define pob pop_back
#define pb emplace_back
#define pf emplace_front
#define fstm(m,n,r) m.reserve(n);m.max_load_factor(r)
#define mp make_pair
#define mt make_tuple
#define inf LLONG_MAX
#define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
const double PI = acos(-1);
typedef complex<double> cd;
typedef long long ll;
ll gcd(){return 0ll;} template<typename T,typename... Args> T gcd(T a,Args... args) { return __gcd(a,(__typeof(a))gcd(args...)); }
typedef map<ll,ll> mll;
typedef map<string,ll> msll;
typedef unordered_map<ll,ll> umap;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mod 1000000007 
#define N 100001

ll dp[N],a[101];

ll fun(ll n,ll k) {
    if(dp[k]!=-1) return dp[k];
    set<int> s;
    ifr(i,0,n) {
        if(k<a[i]) continue;
        s.insert(fun(n,k-a[i]));
    }
    int mex=0;
    while(s.find(mex)!=s.end()) mex++;
    dp[k]=mex;
    return mex;
}

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

    int n,k;
    cin>>n>>k;
    ifr(i,0,n) cin>>a[i];
    ifr(i,0,N) dp[i]=-1;
    fun(n,k);
    if(dp[k]) cout<<"First\n";
    else cout<<"Second\n";
    return 0;
}

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

int n;
int v[25];
int w[25];
int dp[25][5000];

int main(){

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

    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>v[i];
    }
    for(int i=1;i<=n;i++){
        cin>>w[i];
    }
    for(int i=1;i<=n;i++){
        v[i]-=w[i];
    }
    for(int i=1;i<=n;i++){
        for(int j=-1000;j<=1000;j++){
            if(j>=w[i]){
                dp[i][j+2000]=max(dp[i][j+2000],dp[i-1][j-w[i]+2000]+v[i]);
            }
            dp[i][j+2000]=max(dp[i][j+2000],dp[i-1][j+2000]);
        }
    }
    int ans=0;
    for(int i=-1000;i<=1000;i++){
        ans=max(ans,dp[n][i+2000]);
    }
    cout<<ans<<endl;

    return 0;
}

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

int main(){
 
  long long X,m;
  cin >> X;
  
  m = 100;
  int ct = 0;
  
  while(m < X){
    m += m/100;
    ct++;
  }
  cout << ct << "\n";

  return 0;
}

Measured memory_bytes: 3632