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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    for (auto& a : A) {
        cin >> a;
        --a;
    }
    vector<bool> visited(N, false);
    int now = 0;
    for (ll i = 0; i < K; ++i) {
        if (visited[now]) {
            break;
        }
        visited[now] = true;
        now = A[now];
        if (i == K - 1) {
            cout << now + 1 << endl;
            return 0;
        }
    }
    ll cnt = 0;
    fill(all(visited), false);
    while (!visited[now]) {
        visited[now] = true;
        now = A[now];
        ++cnt;
    }
    ll start = now;
    now = 0;
    while (now != start) {
        --K;
        now = A[now];
    }
    K %= cnt;
    rep(i, 0, K) {
        now = A[now];
    }
    cout << now + 1 << endl;
    return 0;
}

Measured memory_bytes: 4784
N = int(input())
h = list(map(int, input().split()))
ans = 0
while True:
    i = 0
    if not any(h):
        break
    while i < N:
        if h[i] == 0:
            i += 1
        else:
            ans += 1
            while i < N and h[i] != 0:
                h[i] -= 1
                i += 1
print(ans)

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, m;
string s[100], t[100];

int main() {
	cin >> n;
	inc(i, n) { cin >> s[i]; }
	cin >> m;
	inc(i, m) { cin >> t[i]; }
	
	int ans = 0;
	inc(k, n) {
		int c = 0;
		inc(i, n) { if(s[i] == s[k]) { c++; } }
		inc(i, m) { if(t[i] == s[k]) { c--; } }
		setmax(ans, c);
	}
	
	cout << ans << endl;
	
	return 0;
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S; S='0'+S;
    int ans=0;
    for (int i=(int)S.size()-1;i>0;--i){
        int n=S[i]-'0';
        if (n<5||n==5&&S[i-1]<'5') ans+=n;
        else ans+=10-n,++S[i-1];
    }
    cout << ans+(S[0]>'0'?1:0) << endl;
}

Measured memory_bytes: 2332
#include<bits/stdc++.h>
using namespace std;
#define all(v) ((v).begin()),((v).end())
#define ll long long
#define fastIO cout << fixed << setprecision(9), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
double const EPS = 1e-9, PI = acos(-1);
const int N = 1e5 + 9, M = 5e2 + 9, OO = 1e9 + 7, MOD = 1e9 + 9;
const ll inf = 1e18;

ll dp[109][N], weight[109], val[109];

int main() {
  fastIO;
#ifdef LOCAL
  freopen("input.in", "rt", stdin);
#endif

  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; ++i)
    cin >> weight[i] >> val[i];

  ll ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= k; ++j) {
      dp[i][j] = max(dp[i][j], dp[i-1][j]);
      if(j >= weight[i])
        dp[i][j] = max(dp[i][j], dp[i-1][j - weight[i]] + val[i]);
      ans = max(ans, dp[i][j]);
    }
  }

  cout << ans;
  return 0;
}


Measured memory_bytes: 79360
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
//#pragma warning(disable : 4996)

#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#define __builtin_popcountll __popcnt64

#endif

#include <limits.h>
#include <math.h>
#include <time.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << '\n'
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) cout << v[i] << " \n"[i==(int)v.size()-1]
template <typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template <typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 1e9 + 7;
constexpr int MAX = 500050;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr ll LINF = 1e18 + 1;
constexpr int INF = 1e9 + 1;
//int dx[4] = { 0,0,-1,1 }, dy[4] = { 1,-1,0,0 };



const ll e9 = 1e9;
int c2[200020], c5[200020];
int cnt[60][60];
void solve() {
	int N; cin >> N;
	vector<int>A(N);
	REP(i, N) {
		long double x; cin >> x;
		x *= e9;
		x += 0.5;
		ll y = (ll)x;
		A[i] = y;
		//print(A[i]);
	}
	int c0 = 0;
	REP(i, N) {
		while (A[i] % 2 == 0) {
			c2[i]++;
			A[i] /= 2;
		}
		while (A[i] % 5 == 0) {
			c5[i]++;
			A[i] /= 5;
		}
		cnt[c2[i]][c5[i]]++;
	}
	ll ans = 0;
	//DEBUG(c0);
	//REP(i, 30)REP(j, 30) {
	//	if(cnt[i][j])cout << i << " " << j << " " << cnt[i][j] << endl;
	//}
	REP(i, N) {
		int res = 0;
		REP(j, 50)REP(k, 50) {
			if (c2[i] + j >= 18 && c5[i] + k >= 18) {
				res += cnt[j][k];
			}
		}
		if (c2[i] * 2 >= 18 && c5[i] * 2 >= 18)res--;
		ans += res;
	}
	//ans += c0 * (c0 - 1);
	ans /= 2;
	print(ans);
}



signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q;
	//cin >> q;
	//while (q--)
	solve();

}


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

int main(){
    int cnt[8] = {};
    int any = 0;
    int N = 0;
    int temp = 0;
    scanf("%d", &N);
    for(int i=0; i < N; i++){
        scanf("%d", &temp);
        if(temp >= 3200){
            any++;
        }else{
            cnt[temp/400]++;
        }
    }

    int mymin = 0;
    for(int i=0; i < 8; i++){
        if(cnt[i] > 0){
            mymin++;
        }
    }
    int mymax = mymin + any;

    if(any == N){
        printf("1 %d\n", any);
    }else{
        printf("%d %d\n", mymin, mymax);
    }

    return 0;
}

// when all are over 3200?

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

long long k,a,b,x;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    cin>>k>>a>>b;
    x=a/k*k;
         if (x==a) cout<<"OK\n";
    else if (x+k<=b) cout<<"OK\n";
    else cout<<"NG\n";
}


Measured memory_bytes: 3640
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define vii vector < pii >
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class P , class Q > ostream& operator<<(ostream& stream, pair < P , Q > v){ stream << "(" << v.fi << ',' << v.se << ")"; return stream;}
template < class T > ostream& operator<<(ostream& stream, const vector<T> v){ stream << "[ "; for (int i=0; i<(int)v.size(); i++) stream << v[i] << " "; stream << "]"; return stream;}
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
const int N = 1e6 + 5;
const int mod = 1e9 + 7;
char str[N];
map < char , int > M;
int main(void) {
    int n;
    cin>>n;
    cin>>(str + 1);
    for (int i = 1;i <= n;++i)
    	M[str[i]] += 1;
    int ans = 1;
    for (auto it : M)
    	ans = (1ll * ans * (it.se + 1)) % mod;
    cout << (ans + mod - 1) % mod << '\n';
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  string S,T="gp";
  cin>>S;
  int k=0;
  for(int i=0;i<S.size();i++){
    if(S[i]<T[i%2])
      k++;
    else if(S[i]>T[i%2])
      k--;
  }
  cout<<k<<endl;
}

Measured memory_bytes: 3724
//inlclude before define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<deque>
#include<iomanip>
#include<set>
#include<unordered_set>
#include<tuple>
#include<map>
#include<memory>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<double> VD;
typedef pair<int, int> P1;
typedef long long int ll;

//number
#define INF 1e9
#define NUM 1000000007

//itr
#define all(x) begin(x),end(x)

//repeat
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);i++)
#define RREPS(i,x) for(int i=((int)(x));i>=0;i--)

//max,min
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))

//function

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

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

/*int dig(int a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}*/

//grid template
int x[] = { -1, 0, 1, 0 };
int y[] = { 0,-1,0,1 };
int xx[] = { -1,-1,1,1 };
int yy[] = { 1,-1,1,-1 };

int main() {
	int n, m,c;
	cin >> n >> m>>c;
	VI b(m);
	
	rep(i, m) {
		cin >> b[i];
	}

	int a, cnt = 0,sum;
	rep(i, n) {
		sum = 0;
		rep(i, m) {
			cin >> a;
			sum += b[i] * a;
		}

		sum += c;
		if (sum > 0) {
			cnt++;
		}
	}
	cout << cnt << endl;
	
}




 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pll pair<ll,ll>
#define P push
#define R return
#define C continue
#define MEM(dp,i) memset(dp,i,sizeof(dp))
#define SI size()
#define F first
#define S second
#define B begin()
#define E end()
#define W while
using namespace std;
long long MOD=1e9+7;
long long INF=1e16+7;

int main()
{
    ll a,b;
    cin>>a>>b;
    if(a==1)a=14;
    if(b==1)b=14;
    if(a>b)cout<<"Alice";
    if(a<b)cout<<"Bob";
    if(a==b)cout<<"Draw";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a,b;
	while(cin>>a>>b){
		if(a==0&&b==0)
			break;
		for(int i=0;i<a;i++){
			if(i==0||i==a-1){
				for(int j=0;j<b;j++)
					cout<<'#';
			}else{
				for(int j=0;j<b;j++){
					if(j==0||j==b-1){
						cout<<'#';
					}else{
						cout<<'.';
					}
				}
			}
			cout<<endl;
		}
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 3084
n=int(input())
a=list(map(int,input().split()))
L=[]
R=[]

for i in range(n):
    if (i+1)%2==0:
        R.append(a[i])
    else:
        L.append(a[i])

#print(R,L)

if n%2==0:
    R.reverse()
    print(*R+L)
else:
    L.reverse()
    print(*L+R)

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

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

    pair<long, long> p[n];

    for (int i = 0; i < n; i++) {
        cin >> p[i].second >> p[i].first;
    }

    sort(p, p + n);

    /*
    for (int i = 0; i < n; i++) {
        cout << p[i].first << " " << p[i].second << endl;
    }
    */

    long time = 0;
    for (int i = 0; i < n; i++) {
        time += p[i].second;
        if (time > p[i].first) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 3328
/* Includes */
#include<stdio.h>
#include<ctype.h>
#include<string.h>

/* Defines */
#define MAX_INPUT_WORDS (201)

/* Prototypes */

/* Valuables */
char words_input[MAX_INPUT_WORDS];
char words_save[MAX_INPUT_WORDS];

int num_shuffle_times;
int num_input_words;
int num_take_cards;
int f;

/* Main */
int main ()
{    
    while(1){
        /* 文字列の取得 */
	    scanf("%s", words_input);

        /* 文字列の長さを取得 */
	    num_input_words = strlen(words_input);


        /* words_saveの末尾に終端文字を代入 */
        words_save[num_input_words] = '\0';

        /* 処理終了判定 */
	    if ((words_input[0] == '-') && (num_input_words == 1)) {
            break;
        }
        else {
            /* NOP */
        }

        /* シャッフルの回数の取得 */
		scanf("%d", &num_shuffle_times);

		for(int i = 0; i < num_shuffle_times; i++) {

			scanf("%d", &num_take_cards);

            for (int j = 0; j < num_input_words; j++) {
                if (j < num_take_cards) {
                    words_save[num_input_words - num_take_cards + j] = words_input[j];
                }
                else {
                    words_save[j - num_take_cards] = words_input[j];
                }
            }

			for (int j = 0; j < num_input_words; j++) {
				words_input[j] = words_save[j];
			}
            
		}
        
        printf("%s\n",words_input);

	}

}


Measured memory_bytes: 2028
// #pragma GCC optimize("O3", "unroll-loops")
// #pragma GCC target("avx2")

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;

typedef long long int ll;
#define endl '\n'
#define ld long double
#define all(a) a.begin(),a.end()
#define int long long
#define pb push_back
#define pii pair <int, int>
#define ff first
#define ss second
#define sz(v) (int)v.size() 
#define UB upper_bound
#define LB lower_bound
#define OST tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>

const int INF = 1e15 + 0;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const int N = 3e3 + 5;

int dp[N][N], n, m, seen[N][N];
string s, t, res;

int go(int i, int j) {
  if(i == n || j == m) return 0;
  
  int &x = dp[i][j];
  if(seen[i][j]) return x;
  
  seen[i][j] = 1;
  int a = 0, b = 0, c = 0;
  if(s[i] == t[j]) {
    a = (1 + (go(i+1, j+1)));
  }
  b = go(i+1, j);
  c = go(i, j+1);
  return (x = max(a, max(b, c)));
}

void print(int i, int j) {
  if(i == n || j == m) return;
  int a = dp[i+1][j], b = dp[i][j+1], c = -1;
  if(s[i] == t[j]) {
      c = 1 + dp[i+1][j+1];
  }
  if(c >= a && c >= b) {
    cout << s[i];
    print(i+1, j+1);
  }
  else if(a > c && a > b) print(i+1, j);
  else print(i, j+1);
}

void solve() {
 // memset(dp, -1, sizeof(dp));
  cin >> s >> t;
  n = sz(s); m = sz(t);
  int ans = go(0, 0);
  if(ans == 0) {
    cout << res << '\n'; return;
  } 
  print(0, 0);
}

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

   /* #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
    #endif */
    int t = 1; // cin >> t;
    for(int i = 1; i <= t; i++) {
        solve();
    }
}    


Measured memory_bytes: 141568
N, C, K = map(int,input().split())
para = [int(input()) for i in range(N)]
para.sort()
cnt = 1
p = 1
b = [para[0]]
while p <= N-1 :  
    if para[p] <= b[0] + K :
        if len(b) < C :
            b.append(para[p])
            p += 1 
        else :
            b = []
            cnt += 1 
            b.append(para[p])
            p += 1  
    else :
        b = [para[p]]
        p += 1
        cnt += 1

print(cnt)

Measured memory_bytes: 7384
#include <algorithm>
#include <iostream>
#include <string>
#include <random>
#include <cassert>
#include <cstring>
#include <chrono>
#include <set>
#include <map>

using namespace std;

typedef long long ll;

struct TCover {
  vector<int> cover;
  int total = 0;

  TCover(int n) {
    cover.resize(n);
  }

  void Add(int ind) {
    if (ind <= 0) return;
    if (cover[ind] == 0) total++;
    cover[ind]++;
  }

  void Remove(int ind) {
    if (ind <= 0) return;
    if (cover[ind] == 1) total--;
    cover[ind]--;
    assert(cover[ind] >= 0);
  }

  int GetTotal() {
    return total;
  }

  void DebugOutput() {
    return;
    for (int x : cover) cerr << x << " "; cerr << endl;
    cerr << "total = " << total << endl << endl;
  }
};


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

  vector<int> c(n + 1);
  for (int x : a) c[x]++;

  TCover cover(n + 1);

  for (int i = 1; i <= n; ++i) for (int t = i - c[i] + 1; t <= i; ++t) cover.Add(t);

  for (int i = 0; i < m; ++i) {
    int x, y;
    cin >> x >> y;
    x--;

    cover.Remove(a[x] - c[a[x]] + 1);
    c[a[x]]--;
    a[x] = y;
    c[a[x]]++;
    cover.Add(a[x] - c[a[x]] + 1);

    cover.DebugOutput();

    cout << n - cover.GetTotal() << endl;
  }

  return 0;
}


Measured memory_bytes: 3840
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(ll i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll h,n;
    cin >> h >> n;
    vll hp(h+1,INF);
    hp[0] = 0LL;
    REP(i,n){
        ll a,b;
        cin >> a >> b;
        REP(j,h+1){
            ll pre = max(0LL,j-a);
            hp[j] = min(hp[pre]+b,hp[j]);
        }
    }
    cout << hp[h] << endl;

    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#include <vector>
#include<algorithm>
using namespace std;

int main(){
    int K,X;
    scanf("%d",&K);
    scanf("%d",&X);

    int A[1000];

    for(int i = 0; i< 1 + 2*(K - 1);i++){
        A[i] = X - (K - 1) + i;
    } 

    for(int i = 0; i< 1 + 2*(K - 1);i++){
        printf("%d ",A[i]);
    }
    return 0;
}

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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
//typedef long long ll;
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = 10e15;
const ll MINF = -10e10;
const int INF = INT_MAX / 100;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("~/Downloads/02.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;
const int mod = 1000000007;

string to_upper(string str) {
    int diff = 'a' - 'A';
    for (int i = 0; i < str.size(); i++) {
        char c = str[i];
        if ('A' <= c && c <= 'Z') {
            c += diff;
            str[i] = c;
        }
    }
    return str;
}

int main() {
    int n;
    cin >> n;
    int t = 0;
    int h = 0;
    rep(i, n) {
        string taro, hanako;
        cin >> taro >> hanako;
        if (taro > hanako) t += 3;
        else if (taro < hanako) h += 3;
        else if (taro == hanako) {
            t++;
            h++;
        }

    }

    printf("%d %d\n", t, h);
}



Measured memory_bytes: 3276
#include <stdio.h>
 
int main(void)
{
    double a,b,c,d,e,f,x,y;
 
    while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF) {
        y=(a*f-c*d)/(a*e-b*d);
        x=(c-b*y)/a;
        printf("%.3f %.3f\n",x,y);
    }
    return 0;
}

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

#define debug(s) cout << s << endl
#define debug1(s, t) cout << s << " " << t << endl
#define debug2(s, t, u) cout << s << " " << t << " " << u << endl
#define printvec(v)       \
    for (auto &&i : v)    \
        cout << i << " "; \
    cout << endl

using namespace std;
using i64 = long long;

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

    vector<int> a(n), b(n), c(n - 1);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++)
    {
        cin >> b[i];
    }
    for (int i = 0; i < n - 1; i++)
    {
        cin >> c[i];
    }

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

    cout << sat << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	int k;
	cin>>k;
	for(int i=0;i<s.size();i++){
		if(s.at(i)!='1'){
			cout<<s.at(i)<<endl;
			return 0;
		}
		if(i+1==k){
			cout<<'1'<<endl;
			return 0;
		}
	}
	cout<<s.at(0)<<endl;
}

Measured memory_bytes: 256
//This is getting accepted!
#include<bits/stdc++.h>
#define ll long long
#define oo 1000000009
#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define INARR(a,n) for (int i = 1; i <= (n); ++i) cin >> a[i];
#define ITE(x) for(auto it = (x).begin(); it != (x).end(); ++it)
#define isset(x, i) (((x)>>(i))&1)
#define setbit(x, i) ((x)^(1ll<<(i)))
#define clearbit(x, i) ((x)&(~(1ll<<(i))))
#define twoexp(i) (1ll<<(i))
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define FI first
#define SE second
#define son1 (id*2)
#define son2 (id*2+1)

using namespace std;

const int MOD = 1000000007;
const double EPS = 1e-8;
const double PI = 2 * acos(0);
const int MAXN = 1e6 + 6;

string s;
int n;
ll dp[MAXN][13];
map<int, int> dict;

void input() {
	int u, v, w, x, y, qtype;
	
	cin >> s;
	n = s.size();
	s = ' ' + s;
	
}


void preprocess() {
	
	FOR(i, 0, 12)
		dict[i*4%13] = i;
	
	
	dp[0][0] = 1;
	
	FOR(i, 1, n) {
		if (s[i] == '?') {
			FOR(v, 0, 12) {
				int need_r = (13-v) % 13;
				int need = dict[need_r];
				for (int g = need; g <= 9; ++g)
					dp[i][g-need] += dp[i-1][v];
				for (int g = need-1; g >= 0; --g)
					if (g < 10)
						dp[i][13-(need-g)] += dp[i-1][v];
			}
		}
		else {
			int num = s[i] - '0';
			FOR(v, 0, 12) {
				int need_r = (13-v) % 13;
				int need = dict[need_r];
				
				if (need > num)
					dp[i][13-(need-num)] += dp[i-1][v];
				else
					dp[i][num-need] += dp[i-1][v];
			}
		}
		
		FOR(g, 0, 12)
			dp[i][g] %= MOD;
		
	}
	
}

void process(int itest) {
	int u, v, w, x, y, qtype;
	
	cout << dp[n][5] << endl;
	
}

void oneTest() {
	
	input();
	preprocess();
	process(0);
	
}

void multiTest() {
	
	int t;
	cin >> t;
	
	for (int it = 1; it <= t; ++it) {
		input();
		preprocess();
		process(it);
	}
}

int main(){
    #ifndef ONLINE_JUDGE
//    freopen("../out.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

	oneTest();
//	multiTest();

    return 0;

}


Measured memory_bytes: 10752
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll; // Long long
const int INF = 90000;
const ll INFL = 900000;

#define vi vector<int>
#define vii vector<vector<int> >
#define vi_(n) vector<int>((n))
#define vii_(n,m) vector<vector<int> >((n), vector<int>((m)))
#define vi_def(n, def) vector<int>((n), (def))
#define vii_def(n, m, def) vector<vector<int> >((n), vector<int>((m), (def)))

#define rep(i, n) for(int i=0; i < (n); ++i)
#define per(i, n) for(int i=(n)-1; i >= 0; --i)
#define range(i, begin, end) for(int i=(begin); i < (end); ++i)

int N;
vi H;
vi dp;

int main(){
	cin >> N;
	H = vi(N);
	rep(i, N){
		int h;
		cin >> h;
		H[i] = h;
	}

	dp = vi(N); // dp[i] := 足場0から足場iまでの最小のコスト
	dp[0] = 0;
	dp[1] = abs(H[0] - H[1]);
	range(i, 2, N){
		int c1 = abs(H[i] - H[i-1]) + dp[i-1];
		int c2 = abs(H[i] - H[i-2]) + dp[i-2];
		dp[i] = min(c1, c2);
	}

	int ans = dp[N-1];
	cout << ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
using namespace std;
signed main()
{
        int x=0,y=0,z=0;
        scanf("%d %d %d",&x,&y,&z);
        if (x<=y*z) cout<<"Yes\n";
        else cout<<"No\n";
        return 0;
}


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

// bool calc(vector<int> &in, vector<int> &dp, int n){
//     cout<<n<<endl;
//     if(n < in[0]){
//         return false;
//     }
//     if(dp[n] != -1){
//         return dp[n] == 1;
//     }
//     bool ans = true;
//     for(auto i : in){
//         ans &= calc(in, dp, n - i);
//     }
//     dp[n] = ans ? 0 : 1;
//     return !ans;
// }

int main(){
    ll n, k;
    cin>>n>>k;
    vector<ll> in(n);
    for(auto &it : in){
        cin>>it;
    }
    vector<bool> dp(10e6);
    // if(calc(in, dp, k)){
    //     cout<<"First";
    // }
    // else{
    //     cout<<"Second";
    // }

    for(ll i = 0; i <= k; i++){
        for(ll j = 0; j < n, i + in[j] <= k; j++){
            if(dp[i + in[j]] == false)
                dp[i + in[j]] = !dp[i];
        }
    }
    if(dp[k]) {
        cout<<"First";
    }
    else{
        cout<<"Second";
    }
    return 0;
}

Measured memory_bytes: 1408
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        String[] s = scanner.next().split("-");
        if (s.length != 2) System.out.println("No");
        else System.out.println(s[0].length() == a && s[1].length() == b ? "Yes":"No");
    }
}


Measured memory_bytes: 23252
Input_list = [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]

print(Input_list[int(input())-1])


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

int main() {
    /* Input */
    double D, T, S;
    cin >> D >> T >> S;
    
    /* Main Logic */      
    double time = D / S;
    /* Output */
    if(T < time) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3720
#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, K, Q; cin >> N >> K >> Q;
  vector<int> sankasya(N, 0);
  int A;
  
  for(int i = 0; i < Q; i++){
    cin >> A;
    sankasya[A-1]++;
  }
  
  for(int j = 0; j < N; j++){
    if(sankasya[j] > Q - K) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#define PI 3.14159265358979323846

int main(void) {
	char s[100];
	char a[100];
	char b[100];
	scanf("%s%s%s", &a, &s, &b);
	printf("%c%c%c", 'A', s[0],'C');


	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>

using ll = long long;
using namespace std;
#define modmod 1000000007

int N;
ll h[100006];
ll A,B;


bool enough(ll t){
    ll sum = 0;
    for(int i = 0; i < N; i++){
        if(h[i]-(B*t) <= 0){
            continue;
        }
        sum += (h[i]-(B*t))/(A-B);
        if((h[i]-(B*t))%(A-B) != 0){
            sum++;
        }
    }
    return sum <= t;
}

int main(){

    cin >> N >> A >> B;

    for(int i = 0; i < N; i++){
        cin >> h[i];
    }
    sort(h,h+N);
    ll max_h = h[N-1];
    ll left = 0, right = max_h/B + 1;
    while(right - left > 1){
        ll mid = (left+right) / 2;
        if(enough(mid)){
            right=mid;
        }else{
            left=mid;
        }
    }

    cout << right << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using pll = pair<long long,long long>;

int main(){
    int N; cin >> N;
    vector<pll> v(N);
    for(int i = 0; i < N; i++){
        long long a,l;
        cin >> a >> l;
        v[i] = {a-l,a+l};
    }
    
    sort(v.begin(),v.end(),[](pll a,pll b){
        return a.second < b.second;
    });
    
    int res = 0;
    long long cur = -(1LL << 60);
    for(int i = 0; i < N; i++){
        if(cur > v[i].first) continue;
        ++res;
        cur = v[i].second;
    }
    cout << res << endl;

}


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

#define ll long long
#define pll pair<ll, ll>
#define vll vector<ll>
#define rep(x, l, r) for (x = l; x < r; x++)

const ll mod=1000000007;

void solve()
{
	ll i, j, k, l, m, n, x, y, u, v, r, p,a,b,aa,bb;
	cin>>n>>k;
	vector<ll> arr(n);
	for(i=0;i<n;i++) cin>>arr[i];
	sort(arr.begin(),arr.end());
	ll ans=0;
	for(i=0;i<k;i++){
        ans+=arr[i];
	}
	cout<<ans;




}

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


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
 
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << ", " << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define f first
#define s second
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int len, jump;
    cin >> len >> jump;
    vector<int> arr(len);
    for(int i = 0; i < len; i++) cin >> arr[i];
    vector<int> dp(len, INT_MAX);
    dp[0] = 0;
    for(int i = 0; i < len - 1; i++) {
        int right = min(len - 1, i + jump);
        for(int j = i + 1; j <= right; j++) {
            int cost = abs(arr[j] - arr[i]);
            if(dp[i] + cost < dp[j]) dp[j] = dp[i] + cost;
        }
    }
    cout << dp[len - 1];
}

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

int main() {
	
  	int N;
  	int alice,bob = 0;
  	
  	cin >> N;
  	vector<int> score(N);
  	for (int i=0; i < N; i++){
		cin >> score.at(i);
	}
	
	sort(score.begin(), score.end());
	reverse(score.begin(), score.end());
	
	for(int i=0; i < N; i++){
		if (i%2 == 0){
			alice += score.at(i);
		}else{
			bob += score.at(i);
		}
	}
	
	cout << alice - bob;

}


Measured memory_bytes: 256
import scala.collection.mutable
import scala.io.StdIn._

case class UnionFind(parent: mutable.Seq[Int], rank: mutable.Seq[Int]) {

  def root(i: Int): Int = {
    if (parent(i) == i) return i
    parent(i) = root(parent(i))
    parent(i)
  }

  def same(x: Int, y: Int): Boolean = root(x) == root(y)

  def unite(x: Int, y: Int): Unit = {
    val _x = root(x)
    val _y = root(y)
    if (_x == _y) return

    if (rank(_x) < rank(_y)) parent(_x) = _y
    else {
      parent(_y) = _x
      if (rank(_x) == rank(_y)) rank(_x) += 1
    }
  }

}

object Main extends App {
  val Array(n, q) = readLine().split(" ").map(_.toInt)
  val uf = UnionFind(mutable.Seq.fill(n)(0), mutable.Seq.fill(n)(0))

  for (i <- 0 until n) {
    uf.parent(i) = i
  }

  for (i <- 1 to q) {
    val Array(com, x, y) = readLine().split(" ").map(_.toInt)
    com match {
      case 0 => uf.unite(x, y)
      case _ => if (uf.same(x, y)) println(1) else println(0)
    }
  }
}

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

int main()
{
	auto f = [](int64_t n) {
		int64_t r = 0;
		for (int64_t i = n; n / 4 * 4 <= i; i--)
		{
			r ^= i;
		}
		return r;
	};

	int64_t a, b;
	cin >> a >> b;

	cout << (f(b) ^ f(a) ^ a) << endl;

	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
typedef long long ll;
const int M = 40011;
bool dp[2][M];
bool solve(int n,ll *in,int m,int L,int R){
  int now=0;
  int allm=4*m+1;
  rep(i,M)dp[0][i]=dp[1][i]=false;
  dp[0][2*m]=true;

  rep(i,n){
    int next=(now+1)%2;
    rep(j,allm){
      if (!dp[now][j])continue;

      if ( j-R*in[i]*2 >= 0){
	//cout << j <<" " << j-L*in[i] << " " << j-R*in[i]*2 << endl;
	dp[next][max(0LL,  j-L*in[i])]=true;//j+(-L/2*mi+m)*2;
	dp[next][        j-R*in[i]*2]=true;//j+(-R*mi  +m)*2;
      }

      if (j+R*in[i]*2 <= 4*m){
	//cout << j <<" " << j+L*in[i] << " " << j+R*in[i]*2 << endl;
	dp[next][min(4LL*m,j+L*in[i])]=true;//j+(L/2*mi+m)*2;
	dp[next][        j+R*in[i]*2]=true;//j+(R*mi  +m)*2;
      }
    }
    //rep(j,allm)cout << dp[next][j]<<" ";cout << endl;
    rep(j,allm)dp[now][j]=false;
    now=next;
  }
  
  rep(i,allm){
    if (dp[now][i])return true;
  }
  return false;
}

const int N = 100;
ll in[N];
main(){
  int n,l,m,r;
  while(cin>>n>>l>>m>>r){
    rep(i,n)cin>>in[i];
    cout << (solve(n,in,m,l,r)?"Yes":"No") << endl;
  }
  return false;
}

Measured memory_bytes: 0
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

typedef long double ld;
typedef long long ll;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1.0);

void precalc() {
}

int xs[3], ys[3];

int read() {
  for (int i = 0; i < 3; ++i) {
    if (scanf("%d%d", xs + i, ys + i) < 2) {
      return 0;
    }
  }
  return 1;
}

ld getd(int a, int b) {
  int x = xs[a] - xs[b], y = ys[a] - ys[b];
  return sqrt(x * x + y * y);
}

void solve() {
  ld res = 0;
  for (int r = 0; r < 3; ++r) {
    ld c = getd(r, (r + 1) % 3);
    ld a = getd((r + 1) % 3, (r + 2) % 3);
    ld b = getd((r + 2) % 3, r);

    ld alfs[2];
    for (int it = 0; it < 2; ++it, swap(a, b)) {
      auto &cur = alfs[it];
      cur = (b * b + c * c - a * a) / (2 * b * c);
      cur = acos(max((ld) -1, min((ld) 1, cur)));
      cur /= 2;
    }
    ld val = c / (2 + cos(alfs[0]) / sin(alfs[0]) + cos(alfs[1]) / sin(alfs[1]));
    res = max(res, val);
  }
  printf("%.18f\n", (double) res);
}

int main() {
  precalc();
#ifdef LOCAL
  freopen(TASK ".out", "w", stdout);
  assert(freopen(TASK ".in", "r", stdin));
#endif

  while (1) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){

    std::fill( (T*)array, (T*)(array+N), val );
}

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

bool IsPrime(ll num){
    if(num < 2) return false;
    else if(num == 2) return true;
    else if(num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for(ll i = 3; i <= sqrtNum; i += 2){
        if(num%i==0){
            // 素数ではない
            return false;
        }
    }
    // 素数である
    return true;
}

signed main(){
  int n; cin>>n;
  vector<ll> d(n); rep(i,n) cin>>d[i];
  ll ans = 0;
  rep(i,n){
    rep(j,i){
      ans += d[i]*d[j];
    }
  }
  cout << ans << endl;



  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main(void){
    int a,b,c;
    cin>>a>>b>>c;
    double PI=acos(-1);
    double rad=c*PI/180;
    cout<<fixed<<setprecision(5);
    cout<<a*b*sin(rad)/2<<endl<<a+b+sqrt(a*a+b*b-2*a*b*cos(rad))<<endl<<b*sin(rad)<<endl;
}



Measured memory_bytes: 3468
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
using namespace std;
int main()
{
	string s;
	cin>>s;
	for(int i=0;i<s.length();i++)
		if(s[i]=='1')
			cout<<"9";
		else 
			cout<<"1";
}

Measured memory_bytes: 256
#pragma region

#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin); i < (end); i++)
#define _irep3(i, begin, end) for (register int i = (end)-1; i >= (begin); i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;
typedef long long ll;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "vec[ ";
  rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

ll gcd(ll a, ll b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16);

  ll N;
  cin >> N;
  if (N % 2 == 1) {
    out(0);
    return 0;
  }
  ll N2 = N;
  ll ans = 0;
  rep(i, 100) {
    ans += N / 10;
    N /= 5;
  }
  out(ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <array>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <iomanip>
#include <numeric>
#include <climits>
#include <algorithm>
#include <cstdint>
using namespace std;

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

    vector<int> a(n), b(n), c(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 0; i < n; i++)
        cin >> b[i];
    for (int i = 0; i < n - 1; i++)
        cin >> c[i];

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

    cout << sum;
}

Measured memory_bytes: 3580
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<math.h>
using namespace std;

#define int long long
#define endl "\n"
#define fir first
#define sec second
#define fro front
#define m_p make_pair
#define mod 1000000007
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define all(v)  v.begin(),v.end()
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}

int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res* a% mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}



signed main() {
	int n;
	string s;
	cin >> n;
	vector<int>ma(5);
	rep(i, n) {
		cin >> s;
		if (s[0]=='M') {
			ma[0]++;
		}
		if (s[0] == 'A') {
			ma[1]++;
		}
		if (s[0] == 'R') {
			ma[2]++;
		}
		if (s[0] == 'C') {
			ma[3]++;
		}
		if (s[0] == 'H') {
			ma[4]++;
		}
	}
	cout << ma[0] * ma[1] * ma[2] + ma[0] * ma[1] * ma[3] + ma[0] * ma[2] * ma[3] + ma[0] * ma[1] * ma[4] + ma[1] * ma[2] * ma[3] +
		ma[0] * ma[2] * ma[4] + ma[1] * ma[2] * ma[4] + ma[0] * ma[3] * ma[4] + ma[1] * ma[3] * ma[4] + ma[2] * ma[3] * ma[4] << endl;
}



Measured memory_bytes: 256
#include <iostream>


using namespace std;

int main()
{
    int a, b;
    char op = 'I';
    
    while(true)
    {
        cin >> a >> op >> b;
        
        if(op == '+')
            cout << a + b << endl;
        
        else if(op == '-')
            cout << a - b << endl;
        
        else if(op == '*')
            cout << a * b << endl;
        
        else if(op == '/')
            cout << a / b << endl;
            
        else
            break;
    }

    return 0;
} 
    

Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define _h cout<<"here"<<endl;
#define fill(a,v) memset(a,v,sizeof(a));
#define all(v) v.begin(),v.end()
#define rep(i,n) for(int i=0;i<n;i+=1)
#define prarr(a,n) rep(i,n) cout<<a[i]<<" \n"[i==n-1];// printf("%s\n"," " );
#define ff first
#define ss second
#define pu push_back
const int inf = 1e9+10;
const ll INF = 1e16+10;
const int MOD = 1e9+7;
const int MAXN = 2e5+10;

int main(){
    ll n,m;
    cin>>n>>m;
    vector<vector<int>> v(m);
    rep(i,n){
        int a,b;
        cin>>a>>b;
        if(a<=m){
        a--;

        v[a].push_back(b);        
        }
    }
priority_queue<int> heap;
ll ans=0;
rep(i,m){
    for(int b:v[i]){
        heap.push(b);
    }
    if(!heap.empty()){
        ans= ans+ heap.top();
        heap.pop();
    }
}
cout<<ans<<endl;
}

Measured memory_bytes: 5632
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
#include <utility>
#include <sstream>
#include <numeric>
#include <iterator>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef pair<int, int> P;

int main(int argc, const char * argv[]) {
  int x, y;
  cin >> x >> y;
  int ans = 0;
  if (x == 1){
    ans += 300000;
  }else if(x == 2){
    ans += 200000;
  }else if (x == 3){
    ans += 100000;
  }

  if (y == 1){
    ans += 300000;
  }else if(y == 2){
    ans += 200000;
  }else if (y == 3){
    ans += 100000;
  }

  if (x == 1 & y == 1){
    ans += 400000;
  }

  cout << ans << endl;
  return 0;
}


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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(auto i=0;i<(n);i++)
#define rep1(i,n) for(auto i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()

using namespace std;


struct init{ init(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20); }; }aaaaaaa;


int main(){
  ll a;
  string s;
  cin >> a;
  cin >> s;

  if(3200 <= a) cout << s << endl;
  else          cout << "red" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
from bisect import bisect_left
from itertools import product
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def LF(): return list(map(float, input().split()))
def LC(): return [c for c in input().split()]
def LLI(n): return [LI() for _ in range(n)]
def NSTR(n): return [input() for _ in range(n)]

def array2d(N, M, initial=0):
    return [[initial]*M for _ in range(N)]

def copy2d(orig, N, M):
    ret = array2d(N, M)
    for i in range(N):
        for j in range(M):
            ret[i][j] = orig[i][j]
    return ret


INF = float("inf")
MOD = 10**9 + 7


def main():
    S = input()
    if S == "RSR":
        print(1)
    else:
        print(S.count("R"))
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 8992