akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

const int INF = 1001001001;

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

  int n;
  cin >> n;

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

  int currMin = INF;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (currMin > p[i]) {
      ans++;
      currMin = p[i];
    }
  }

  cout << ans << endl;

  return 0;
}

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

using namespace std;

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

    int w[n], v[n];
    for(int i = 0; i < n; i++) cin >> w[i] >> v[i];

    long long dp[n+1][W+1];
    for(int i = 0; i <= W; i++) {
        dp[0][i] = 0;
    }

    for(int i = 0; i < n; i++) {
        for(int j = 0; j <= W; j++) {
            long long m = dp[i][j];
            if(j - w[i] >= 0) {
                m = max(m, dp[i][j-w[i]] + v[i]);
            }
            dp[i+1][j] = m;
        }
    }

    cout << dp[n][W] << endl;
}

Measured memory_bytes: 79104
#include<iostream>
#include<cstdlib>
#include<stack>
#include<queue>
#include<string>
#include<algorithm>
using namespace std;

int main(){
    int n;
    int a[150];

    int alice=0,bob=0;

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

    sort(a,a+n);

    for(int i=0;i<=n-1;i++){
        if(i%2==0){
            alice+=a[i];
        }else{
            bob+=a[i];
        }
    }
    cout<<abs(alice-bob);
    

    return 0;
}

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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

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

//INT_MAX	2,147,483,647 = 2*1.0e9

ll gcd_euclid(ll a, ll b){
    if(b == 0) return a;
    else return gcd_euclid(b, a%b);
}

ll calc_lcm(ll a, ll b){
    return a * b / gcd_euclid(a, b);
}

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

    vector<int> a(N);
    ll ans = 0;
    for(int i = 0; i < N; i++){
        cin >> a[i];
        a[i]--;
        ans += a[i];
    }

    cout << ans << endl;

    return 0;
}


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

int main(){
    int n;
    vector<int> f(101, 0);
    while (1){
	cin >> n;
	if (cin.eof()) break;
	f[n]++;
    }
    int max = 0;
    for (int i = 0; i < f.size(); i++) if (max < f[i]) max = f[i];
    for (int i = 0; i < f.size(); i++) if (f[i] == max) cout << i << endl;
}

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

int main() {
    string s;
    int q;
    cin >> s >> q;
    REP(i,q){
        string op;
        int a, b;
        cin >> op >> a >> b;
        if(op=="replace"){
            string t;
            cin >> t;
            s.replace(s.begin()+a,s.begin()+b+1,t);
        }
        if(op=="reverse"){
            reverse(s.begin()+a, s.begin()+b+1);
        }
        if(op=="print"){
            cout << s.substr(a,b-a+1) << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3200
import sys
from collections import Counter

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()
A = LI()
counter_a = Counter(A)
choice_total = sum([(count*(count-1)//2) for count in counter_a.values() if count > 1])

for i in range(0, N):
    sub_num = A[i]
    count_sub_num = counter_a[sub_num]
    print(choice_total - ((count_sub_num*(count_sub_num-1) - (count_sub_num-1)*(count_sub_num-2)) // 2))

Measured memory_bytes: 33844
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

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

ll factorial(ll n) {
  ll answer = 1;
  while (n > 1) {
    answer *= n;
    answer %= mod;
    n--;
  }
  return answer;
}

ll combination(ll n, ll r) {
  return factorial(n) / (factorial(r) * factorial(n - r));
}

ll permutation(ll n, ll r) { return factorial(n) / factorial(n - r); }

template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}
// for (auto p : prime_factor(n)) {
//	while (p.second--) {
//		cout << p.first << endl;
//	}
//}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

vector<ll> Eratosthenes(const ll N) {
  bool is_prime[1000000 + 1];
  vector<ll> P;
  for (ll i = 0; i <= N; i++) {
    is_prime[i] = true;
  }
  for (ll i = 2; i <= N; i++) {
    if (is_prime[i]) {
      for (ll j = 2 * i; j <= N; j += i) {
        is_prime[j] = false;
      }
      P.emplace_back(i);
    }
  }
  return P;
}

typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

int func(int x) {
  if (x % 100 != 0) {
    return 0;
  }
  return func(x / 100) + 1;
}

int main() {
  int d, n;
  cin >> d >> n;
  int cnt = 0;
  for (int x = 1;; x++) {
    if (func(x) == d) {
      cnt++;
      if (cnt == n) {
        cout << x << endl;
        return 0;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
#define pb push_back
#define fi first
#define se second
 
const ll MOD = 1000000007;

int main() {
   int n, d; scanf("%d%d", &n, &d);
   vector<vector<int>> x(n, vector<int>(d));
   for (auto &i : x) {
      for (auto &j : i)
         scanf("%d", &j);
   }
   int ans = 0;
   for (int i = 0; i < n; ++i) {
      for (int j = i + 1; j < n; ++j) {
         int cur = 0;
         for (int k = 0; k < d; ++k)
            cur += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
         if ((int) sqrt(cur) * (int) sqrt(cur) == cur)
            ++ans;
      }
   }
   printf("%d", ans);
   return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main() {
 
  int n,i,j;
  int card[4][13];
  int num;
  long long moji;
 
  scanf("%d", &n);
 
  for(j=0; j<4; j++) {
  for(i=0; i<13 ;i++){
    card[j][i] = 0;
  }
  }
 
  for(i=0; i<2*n ; i++) {
    scanf("%c ",&moji);
    scanf("%d",&num);
    if(moji == 'S') {
      card[0][num-1] = 1;
    } else if(moji == 'H') {
      card[1][num-1] = 1;
    } else if(moji == 'C') {
      card[2][num-1] = 1;
    } else if(moji =='D') {
      card[3][num-1] = 1;
    }
  }
 
  for(j=1;j<=13;j++) {
    if(card[0][j-1] != 1) {
      printf("S %d\n",j);
    }
  }
  for(j=1;j<=13;j++) {
    if(card[1][j-1] != 1) {
      printf("H %d\n",j);
    }
  }
  for(j=1;j<=13;j++) {
    if(card[2][j-1] != 1) {
      printf("C %d\n",j);
    }
  }
  for(j=1;j<=13;j++) {
    if(card[3][j-1] != 1) {
      printf("D %d\n",j);
    }
  }
   return 0;
}


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

public static class Program
{
    public static void Main(params string[] args)
    {
        var ary = "MARCH".ToArray();
        var hash = new HashSet<Char>(ary);
        var n = int.Parse(Console.ReadLine());
        var d = Enumerable
            .Range(0, n)
            .Select(x => Console.ReadLine())
            .Where(x => hash.Contains(x[0]))
            .GroupBy(x => x[0])
            .ToDictionary(x => x.Key, x => (long)x.Count());

        long r = 0;
        for (int i = 0; i < ary.Length; i++)
        {
            for (int j = i + 1; j < ary.Length; j++)
            {
                for (int k = j + 1; k < ary.Length; k++)
                {
                    long v1, v2, v3;
                    if (d.TryGetValue(ary[i], out v1) && d.TryGetValue(ary[j], out v2) && d.TryGetValue(ary[k], out v3))
                    {
                        r += v1 * v2 * v3;
                    }
                }
            }
        }
        Console.WriteLine(r);
    }
}


Measured memory_bytes: 15584
import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Main {
    static public class pair {
        int u;
        int idx;
        int val;

        public pair(int x, int i) {
            u = x;
            idx = i;
            val = -1;
        }
    }



    static ArrayList<pair>[] adj;
    static int[] Arr, Arry;
    static int inf = (int) 1e9,n;
    static boolean[][] matrix;
    static long[][] memo;
    static long mod = 998244353;

    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
       int[]arr=new int[]{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};
       int kth=sc.nextInt();
        pw.println(arr[kth-1]);
        pw.close();
    }

    public static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(String s) throws FileNotFoundException {
            br = new BufferedReader(new FileReader(s));

        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException, IOException {
            return br.ready();
        }

    }
}


Measured memory_bytes: 21204
from itertools import accumulate
n = int(input())
a = list(map(int,input().split()))
p = list(accumulate(a))
plan = 0
cou = 0
for i in range(n):
    if i % 2 == 0:
        if p[i] + cou > 0:
            continue
        elif p[i] + cou <= 0:
            plan += abs(p[i]+cou) + 1
            cou = 1-p[i]
    elif i % 2 == 1:
        if p[i] + cou < 0:
            continue
        elif p[i] + cou >= 0:
            plan += p[i] + cou + 1
            cou = -1-p[i]
mian = 0
cou = 0
for i in range(n):
    if i % 2 == 1:
        if p[i] + cou > 0:
            continue
        elif p[i] + cou <= 0:
            mian += abs(p[i]+cou) + 1
            cou = 1-p[i]
    elif i % 2 == 0:
        if p[i] + cou < 0:
            continue
        elif p[i] + cou >= 0:
            mian += p[i] + cou + 1
            cou = -1-p[i]
print(min(mian,plan))

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

using namespace std;
using ll = long long;
inline int ri() { int n; cin >> n; return n;}


int main()
{
	int n;
	string k;
	cin >> n;
	for(int i = 0; i < n; i++)k += "ACL";
	cout << k << endl;
}

Measured memory_bytes: 3552
#include <bits/stdc++.h>
#define INF LLONG_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(int i=0; i<n; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

ull ncr(ull n, ull r) {
  ull m = 1, p = 1;
  rep(i,r) m = m * (n-i);
  rep(i,r) p = p * (i+1);
  return m/p;
}

int main() {
  int N; cin >> N;
  vector<string> S(N);
  rep(i,N){
    cin >> S[i];
    sort(S[i].begin(), S[i].end());
  }
  sort(S.begin(), S.end());
  ull ans = 0, tmp = 1;
  string cmp = S[0];
  for(int i=1; i<N; ++i) {
    if(cmp == S[i]) {
      ++tmp;
    } else {
      if(tmp > 1)
        ans += ncr(tmp,2);
      tmp = 1;
      cmp = S[i];
    }
  }
  if(tmp > 1)
    ans += ncr(tmp,2);
  cout << ans << endl;
}

Measured memory_bytes: 7296
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

#define pb push_back
#define mk make_pair
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define sf(a) scanf("%d",&a);
#define sfl(a) scanf("%lld",&a);
#define pf(a) printf("%d\n",a);
#define pfl(a) printf("%lld\n",a);
#define TEST int test; cin >> test;while(test--)
#define ii pair<int,int>
#define iil pair<ll,ll>
#define loop(i,a,b) for(int i = a ; i < b ; i++)
#define INF 2147483647


int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const double pi = acos(-1.0);


ll n, m, x;

void solve()
{

    ll cost = 1e18;
    cin >> n >> m >> x;
    vector<vector<ll> > book(n, vector<ll>(m + 1));
    for(int i = 0 ; i < n ; i++)
        for(int j = 0 ; j <= m ; j++)
            cin >> book[i][j];

    for(int i = 1 ; i < (1 << n); i++)
    {
        ll total = 0;
        vector<ll> val(m,0);
        for(int j = 0 ; j < n ; j++)
        {
            if(i & (1 << j))
            {
                total += book[j][0];
                for(int k = 0 ; k < m ; k++)
                {
                    val[k] += book[j][k+1];
                }
            }
        }
        bool f = true;
        for(int k = 0 ; k < m ; k++)
        {
            if(val[k] < x)
            {
                f = false;
                break;
            }
        }
        if(f)
        {
            cost = min(cost, total);
        }

    }
    if( cost == 1e18) cout << "-1" << endl;
    else cout << cost << endl;

}


int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    solve();
    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define fRead(x)       freopen(x,"r",stdin)
#define fWrite(x)      freopen (x,"w",stdout)
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);  
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#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) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}
 
template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind(){double x; scanf("%lf",&x);return x;}

///*....Bitmask....*///
int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

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

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;


int main()
{
    int t=1,te=0;
    //Int(t);
    while(t--){
        ll a,b,c,d;
        Int(a,b);
        ll mi1=min(a,b),ma1=max(a,b);
        Int(c,d);
        ll mi2=min(c,d),ma2=max(c,d);

        printf("%lld\n", max({a*c,a*d,b*c,b*d}));

        //printf("Case %d: ",++te);
    }

    //cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
    return 0;
}






Measured memory_bytes: 3760
#include<stdio.h>
#include<stdlib.h>

int main(){
	int *a;
	int loop;
	int K, T;
	int i, d;

	scanf("%d %d", &K, &T);
	a = malloc(sizeof(int)*T);
	for (loop = 0; loop < T; loop++)scanf("%d", &a[loop]);

	for (loop = T; loop > 0; loop--)
		for (i = 0; i < loop;i++)
			if (a[i] < a[i + 1]){
				d = a[i];
				a[i] = a[i + 1];
				a[i + 1] = d;
			}

	for (loop = 1; loop < T; loop++)a[0] -= a[loop];

	if (a[0] <= 0)printf("0\n");
	else printf("%d\n", --a[0]);
	return 0;
}

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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define what_is(x) cerr << #x << " is " << x << endl;

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	int n, m;
	scanf("%d%d", &n, &m);
	vii v(n);
	for (int i = 0; i < n; i++) scanf("%d%d", &v[i].first, &v[i].second);
	sort(all(v));
	ll answer = 0;
	for (int i = 0; i < n && m > 0; i++) {
		int buy = (v[i].second <= m)? v[i].second : m;
		answer += (ll)buy * v[i].first;
		m -= buy;
	}
	printf("%lld\n", answer);
}


Measured memory_bytes: 1024
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue = BinaryHeap!(Array!long, "a<b");
// dfmt on

void main()
{
    long N = lread();
    auto A = aryread();
    auto B = aryread();
    auto C = aryread();
    long ans;
    foreach (i; 0 .. N)
    {
        long a = A[i] - 1;
        ans += B[a];
        if (A[i - 1] == a)
        {
            ans += C[a - 1];
        }
    }
    writeln(ans);
}


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

int main(){
    ll a,b,t;
    cin>>a>>b>>t;
    ll time=t/a;
    ll ans=b*time;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
s=input()

b_charged=False
s1 = []

for i in range(len(s)):
    if s[i]=="B":
        b_charged = True
        s1.append("B")
    elif s[i]=="C":
        if b_charged:
            b_charged=False
            s1[-1]="BC"
        else:
            s1.append("C")
    else:
        b_charged=False
        s1.append("A")

a_count = 0
count = 0
for i in range(len(s1)):
    if s1[i]=="A":
        a_count+=1
    elif s1[i]=="BC":
        count+=a_count
    else:
        a_count=0

print(count)

Measured memory_bytes: 5096
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()


def resolve():
    N = I()
    A = LI()

    AA = [A[i] - (i + 1) for i in range(N)]
    AA.sort()
    b = AA[N//2]
    ans = sum([abs(A[i] - (b + i + 1)) for i in range(N)])

    print(ans)

if __name__ == '__main__':
    resolve()


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

int main(){
    int number = 0;
    cin >> number;
    char** input = new char*[number];

    for(int i = 0; i < number; i++){
        input[i] = new char[51];
        cin >> input[i];
    }
    char same[51] = {0};
    int count = 0;
    for(int i = 0; i < strlen(input[0]); i++){
        bool find = true;
        for(int j = 1; j < number; j++){
            char* ptr = NULL;
            ptr = strchr(input[j],input[0][i]);
            if(ptr== NULL){
                find = false;
            }
        }
        if(find){
            for(int j = 1; j < number; j++){
                char* ptr = NULL;
                ptr = strchr(input[j],input[0][i]);
                if(ptr != NULL){
                    *ptr = '*';
                }
            }
            same[count] = input[0][i];
            count ++;
        }
        
    }
    same[count] = '\0';
    sort(same,same+strlen(same));
    cout << same;
    return 0;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back 
#define pf push_front 
#define mp make_pair
#define fr first
#define sc second
#define Rep(i,n) for(int i=0;i<(n);i++)
#define All(v) v.begin(),v.end()
typedef pair<int, int> Pii; typedef pair<int, Pii> Pip;
const int INF = 1107110711071107;


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

  int l = 0, r = 0;
  int L = 0, R = 0;

  Rep(i, n) {
    if( s[i] == ')' ) l++;
    else r++;

    if( l > r ) {
      R++;
      l--;
    }
    if( l && r ) {
      l--; r--;
    }
  }

  Rep(i, R) cout << '(';
  cout << s;
  Rep(i, r) cout << ')';

  cout << endl;
  
}


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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  string s;
  cin >> s;
  s[3]='8';
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

int comp(const void *a,const void *b){
    return *(int*)a - *(int*)b;
}

int main(void){
    register int i;
    int n,k;
    scanf("%d%d",&n,&k);
    int a[n];
    for(i = 0;i < n;i++)scanf("%d",&a[i]);
    qsort(a,n,sizeof(int),comp);
    long ans = 0;
    for(i = 0;i < k;i++)ans += a[i];
    printf("%ld",ans);
}

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

int main()
{
    int n, x[200010] = {}, t[200010] = {};
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> x[i];
        t[i] = x[i];
    }
    sort(t, t + n);

    for (int i = 0; i < n; i++) {
        if (x[i] < t[n / 2]) cout << t[n / 2] << endl;
        else cout << t[n / 2 - 1] << endl;
    }

    return 0;
}


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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < (n); i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define REP(i, vec) for(auto i = vec.begin(); i != vec.end(); ++i)

const int mod = 1000000007;
const int inf = (1 << 21);
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline T GCD(T a, T b) { return b ? GCD(b, a % b) : a; }
template<class T> inline T LCM(T a, T b) { return (a + (b - 1)) / b; }

int round_int(int a, int b) { return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

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

	for (int i = 1; i <= 1000; ++i) {
		//cout << i << " : " << i * 0.08 << " " << i * 0.1 << endl;
		if ((int)(i * 0.08) == a && (int)(i * 0.1) == b) {
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {

		Scanner sc=new Scanner(System.in);
		
		int n=sc.nextInt();
		
		int a=sc.nextInt();
		
		int b=sc.nextInt();
		
		int sukima=Math.abs(b-a-1);
		
		
		
		if(sukima%2==1) {
			System.out.println("Alice");
		}else {
			System.out.println("Borys");
		}
		

		sc.close();


	}



}


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

using namespace std;

#define ALL(x) x.begin(), x.end()
#define RALL(x) x.rbegin(), x.rend()
#define MP make_pair
#define PB push_back
#define X first
#define Y second

typedef long long int lld;
typedef pair<int, int> pii;
typedef pair<lld, lld> pll;

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

    vector<int> v(n + 1);
    vector<vector<int>> mark(n + 1);

    for (int i = 1; i <= n; i++) {
        cin >> v[i];
        if (i + v[i] <= n) {
            mark[i + v[i]].push_back(i);
        }
        if (i - v[i] > 0) {
            mark[i - v[i]].push_back(i);
        }
    }

    lld ans = 0;

    for (int i = 1; i <= n; i++) {
        int cnt = 0;
        for (int j = 0; j < (int) mark[i].size(); j++) {
            if (mark[i][j] < i)
                cnt++;
        }

        ans += 1LL * cnt * ((int) mark[i].size() - cnt);
    }

    cout << ans << '\n';



    return 0;
}

// g++ sol.cpp -o sol.out -Wall -Wextra -Wshadow -fsanitize=undefined -std=c++17

Measured memory_bytes: 14200
#include<bits/stdc++.h>
#define Bye return 0
#define ll long long

using namespace std;

void solve(){
    long long a, mult; string b;
    cin>>a>>b;
    int b_c = (b[0]-'0')*100 + (b[2]-'0')*10 + (b[3]-'0');
    mult = (long long) (a*b_c)/100;

    cout<<mult<<endl;
}

int main(){
    solve();
    Bye;
}

Measured memory_bytes: 3560
import sys
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
count = 1
print()
temp = a[0]
for i in range(n):
    if temp ==2:
        print(count)
        sys.exit()
    else:
        temp = a[temp-1]
        count += 1
print(-1)


Measured memory_bytes: 7084
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <math.h>
#define REP(i, b, n) for (Int i = b; i < Int(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
using Int = long long;
Int inf = 1000000000000000001LL;
using vi = vector<Int>;
using vvi = vector<vi>;
using pii = pair<Int,Int>;
using mapis = unordered_map<Int,string>;
using mapii = unordered_map<Int,Int>;

Int GCD(Int a, Int b){
    if(b==0) return a;
    if(a < b) return GCD(b, a);
    unsigned r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

Int LCM(Int a, Int b){
    return a*b/GCD(a,b);
}


int main() {
    Int N, Y;

    cin >> N >> Y;

    rep(i,N+1){
        rep(j,N+1){
            if(i+j<=N){
                Int z =Y-i*1000-j*5000;
                int zc = z/10000;
                if(z%10000 == 0 && z>=0 && zc+i+j == N){
                    cout << z/10000 << " " << j << " " << i << endl;
                    return 0;
                }
            }
        }
    }

    cout << -1 << " " << -1 << " " << -1 << endl;




    return 0;
}

Measured memory_bytes: 256
n,k = map(int ,input().split())
A = tuple(map(int, input().split()))
seen = [-1]*n
tmp = 0
count = 0

while True:
    tmp = A[tmp]-1
    count +=1
    if seen[tmp] != -1:
        seennum = seen.count(1)

        tm = tmp
        se = [-1]*n
        roopmem = []
        while True:

            if se[tm] != -1:
                roop = se.count(1)
                break
            else:
                roopmem.append(tm)
                se[tm] = 1
                tm = A[tm] - 1

        break
    else:
        seen[tmp] = 1

if k<=n:
    no = 0
    for i in range(k):
        no = A[no]-1
    print(no+1)
else:
    tmp = k-seennum
    tmp %= roop
    print(roopmem[tmp-1]+1)


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

# define ll long long
ll mod=pow(10,9)+7;

ll pw(ll n,ll mod){
    ll ans=1;

    ll x=2,y=n;
    while(y!=0){
        if(y%2)
            ans=((ans%mod)*(x%mod))%mod;
        x=((x%mod)*(x%mod))%mod;
        y/=2;
    }
    return ans;
}

ll cunt(ll n){
    ll cnt=0;
    while(n!=0){
        if(n%2)
            cnt++;
        n/=2;
    }
    return cnt;
}

void func(ll n){
    ll cnt=1;
    while(n>0){
        ll temp=cunt(n);
        cnt++;
        n=n%temp;
    }
    cout<<cnt<<endl;
}



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    string s;
    cin>>s;
    ll mn=0,mx=0;
    for(ll i=0;i<n;i++){
        if(s[i]=='1')
            mn++;
    }
    if(mn<n){
        mx=mn+1;
        mn--;
    }
    else{
        mn--;
        mx=mn;
    }
  
  if(mn==0 || mx==0){ for(ll i=0;i<n;i++){ if(s[i]=='1') cout<<0<<endl; else{ if(i==n-1) cout<<2<<endl; else cout<<1<<endl; } } return 0; }

    ll chota=0,bada=0;

    reverse(s.begin(),s.end());
    ll temp1=1,temp2=1;
    for(ll i=0;i<n;i++){
        if(s[i]=='1'){
        chota=((chota%mn)+(temp1%mn))%mn;
        bada=((bada%mx)+(temp2%mx))%mx;
        }
        temp1=((temp1%mn)*2)%mn;
        temp2=((temp2%mx)*2)%mx;
    }
    vector<ll> ans;
    for(ll i=n-1;i>=0;i--){
        if(s[i]=='1'){
            ll temp=chota - pw(i,mn);
            temp+=mn;
            temp=temp%mn;
            func(temp);
        }
        else{
            ll temp=bada + pw(i,mx);
            temp=temp%mx;
            func(temp);
        }
    }

}

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

int main()
{
  int a, b;
  cin >> a >> b;
  if((a * b) % 2 == 1) cout << "Odd" <<endl;
  else cout << "Even" <<endl;
  return 0;
}


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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = LLONG_MAX;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;
}

signed main() {
	ll a, b, c, x, y;

	cin >> a >> b >> c >> x >> y;

	ll s = min(x, y) * 2 * c + max((x - y) * a, (y - x) * b);
	ll t = a * x + b * y;
	ll u = max(x, y) * 2 * c;

	ll ans = min(s, min(t, u));

	cout << ans << endl;
}

Measured memory_bytes: 256
// by newbiechd
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>

// DELETE the debugging information!
#define debug(x) std::cerr << #x << " = " << (x) << std::endl

const int N_MAX = 200003;
int a[N_MAX], b[N_MAX];

const int mod = 1e9 + 7;
int power(int x, int y) {
  int ret = 1;
  while (y > 0) {
    if (y & 1)
      ret = 1ll * x * ret % mod;
    x = 1ll * x * x % mod, y >>= 1;
  }
  return ret;
}

const int M_MAX = 4003;
void add(int &x, const int &y) {
  x += y - mod;
  x += (x >> 31 & mod);
}
void dec(int &x, const int &y) {
  x -= y;
  x += (x >> 31 & mod);
}
int dp[M_MAX][M_MAX];

const int F_MAX = 8003;
int fac[F_MAX], iFac[F_MAX];

int main() {
  int n;
  scanf("%d", &n);
  const int delta = 2000;
  for (int i = 1; i <= n; ++i) {
    scanf("%d%d", &a[i], &b[i]);
    ++dp[delta - a[i]][delta - b[i]];
  }
  
  const int mx = 4000;
  for (int i = 0; i <= mx; ++i)
    for (int j = 0; j <= mx; ++j) {
      add(dp[i + 1][j], dp[i][j]);
      add(dp[i][j + 1], dp[i][j]);
    }
  int ans = 0;
  for (int i = 1; i <= n; ++i)
    add(ans, dp[delta + a[i]][delta + b[i]]);
  
  const int lim = 8000;
  fac[0] = 1;
  for (int i = 1; i <= lim; ++i)
    fac[i] = 1ll * i * fac[i - 1] % mod;
  iFac[lim] = power(fac[lim], mod - 2);
  for (int i = lim; i > 0; --i)
    iFac[i - 1] = 1ll * i * iFac[i] % mod;
  for (int i = 1; i <= n; ++i)
    dec(ans, 1ll * fac[2 * (a[i] + b[i])] *
        iFac[2 * a[i]] % mod * iFac[2 * b[i]] % mod);
  ans = 1ll * ((mod + 1) / 2) * ans % mod;
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 64512
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}void pr(){ln;}
template<class A,class...B>void pr(const A &a,const B&...b){cout<<a<<(sizeof...(b)?" ":"");pr(b...);}
template<class A>void PR(A a,ll n){rep(i,n)cout<<(i?" ":"")<<a[i];ln;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[8]={-1,0,1,0,-1,-1,1,1},dy[8]={0,1,0,-1,-1,1,1,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n,m;
  cin >> n >> m;
  ll a[n];
  rep(i,n) R a[i];
  vector<ll> v[3];
  rep(i,n) {
    if(a[i]<0) v[0].pb(abs(a[i]));
    else if(a[i]>0) v[1].pb(a[i]);
    else v[2].pb(a[i]);
  }
  rep(i,3) sort(all(v[i]),greater<ll>());
  priority_queue<ll,vector<ll>,greater<ll> > que;
  for(ll i=0; i+1<min(m,(ll)v[0].size()); i+=2) {
    que.push(v[0][i]);
    que.push(v[0][i+1]);
  }
  ll c=que.size(),k=0;
  vector<ll> ans;
  while(c<m&&k<v[1].size()) {
    ans.pb(v[1][k]);
    k++;
    c++;
  }
  if(c<m) {
    if(v[2].size()) pr(0);
    else {
      ll d=1;
      int l=0,r=0;
      rep(i,2) sort(all(v[i]));
      while(m--) {
        ll x=MAX,y=MAX;
        if(l<v[0].size()) x=v[0][l];
        if(r<v[1].size()) y=v[1][r];
        if(x<y) {
          d*=-x;
          d%=MAX;
          if(d<0) d+=MAX;
          d%=MAX;
          l++;
        } else {
          d*=y;
          d%=MAX;
          r++;
        }
      }
      pr(d);
    }
    return;
  }
  while(!que.empty()) {
    ll x1=que.top();que.pop();
    ll x2=que.top();que.pop();
    ll z1=0,z2=0;
    if(k+1<v[1].size()) {
      z1=v[1][k];
      z2=v[1][k+1];
      k+=2;
    }
    if(x1*x2>=z1*z2) {
      que.push(x1);
      que.push(x2);
      break;
    } else {
      ans.pb(z1);
      ans.pb(z2);
    }
  }
  ll d=1;
  while(!que.empty()) {
    ll x1=que.top();que.pop();
    d*=x1;
    d%=MAX;
  }
  rep(i,ans.size()) {
    d*=ans[i];
    d%=MAX;
  }
  pr(d);
}

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


Measured memory_bytes: 9420
n = int(input())
a_lst = list(map(int, input().split()))
max_ = 10 ** 18

if 0 in a_lst:
    print(0)
    quit()
else:
    res = a_lst[0]
    for a in a_lst[1:]:
        res *= a
        if res > max_:
            print(-1)
            quit()
    print(res)

Measured memory_bytes: 21716
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second


int n; ll x, d;
int c[50];
ll s[50];
ll m[50];
vector<int> g[50];

void dfs(int v) {
	c[v] = 1; s[v] = m[v];
	rep(j, g[v].size()) {
		int to = g[v][j];
		dfs(to);
		s[v] += s[to];
		c[v] += c[to];
	}
}
typedef pair<LP, int> speP;
vector<speP> v;
bool comp(speP x_, speP y_) {
	LP x = x_.first; LP y = y_.first;

	if (x.first*y.second != x.second*y.first)return x.first*y.second < x.second*y.first;
	if (x.second != y.second)return x.second > y.second;
	return x_.second < y_.second;
}
void solve() {
	cin >> n >> x >> d;
	cin >> m[0];
	rep1(i, n - 1) {
		cin >> m[i];
		int p; cin >> p; p--;
		g[p].push_back(i);
	}
	dfs(0);
	rep(i, n) {
		v.push_back({ { s[i],c[i] },i });
	}
	sort(v.begin(), v.end(), comp);
	vector<ll> rest(n, d); rest[0] = INF;
	vector<ll> rd(n);
	rep(i, n) {
		int id = v[i].second;
		if (rest[id] >= 51) {
			rest[id] -= 51; rd[id] = 51;
		}
		else {
			rd[id] = rest[id]; rest[id] = 0;
		}
	}
	vector<ll> dp(51 * 51 * 51, INF); dp[0] = 0;
	rep(i, n) {
		int id = v[i].second;
		per(j, 51 * 51 * 51) {
			if (dp[j] == INF)continue;
			rep1(k, rd[id]) {
				int nj = j + c[id] * k;
				if (nj >= 51 * 51 * 51)continue;
				dp[nj] = min(dp[nj], dp[j] + s[id] * k);
			}
		}
	}
	ll ans = 0;
	rep(i, 51*51*51) {
		//if(i<500)cout << i << " " << dp[i] << endl;
		if (dp[i] > x)continue;
		ll sum = i;
		ll cost = dp[i];
		rep(j, n) {
			int id = v[j].second;
			ll dd = (x - cost) / s[id];
			if (dd > rest[id])dd = rest[id];
			sum += dd * c[id];
			cost += dd * s[id];
			ans = max(ans, sum);
		}
	}
	cout << ans << endl;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	//stop
	return 0;
}


Measured memory_bytes: 1280
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();

		loop: for(;;) {
		String num = br.readLine();
		String[] set = num.split(" ");

		int a = Integer.parseInt(set[0]);
		int b = Integer.parseInt(set[2]);

		switch(set[1]){
		case "+":
			sb.append(a + b).append("\n");
			break;
		case "-":
			sb.append(a - b).append("\n");
			break;
		case "*":
			sb.append(a * b).append("\n");
			break;
		case "/":
			sb.append(a / b).append("\n");
			break;
		case "?":
			break loop;
       }
	}

		System.out.print(sb);

	}

}

Measured memory_bytes: 24020
#include<bits/stdc++.h>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
using namespace std;
 /*temp*/

int main(){
    REP1(i,10){
        REP1(j,10){
            cout << i << 'x' << j << '=' << i*j << '\n';
        }
    }
}

Measured memory_bytes: 3076
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<set>
typedef long long ll;
using namespace std;

int main(void) {
	int n;
	bool can = true;
	cin >> n;
	set<string>st;
	vector<string>s(n);
	for (int i = 0;i < n;i++) {
		cin >> s[i];
		if (i == 0)st.insert(s[i]);
		else {
			if (st.count(s[i]) == 1)can = false;
			else st.insert(s[i]);
		}
	}
	if (!can) {
		cout << "No" << endl;
		return 0;
	}
	else {
		for (int i = 0;i < n - 1;i++) {
			if (s[i][s[i].length() - 1] != s[i + 1][0]) {
				cout << "No" << endl;
				return 0;
			}
		}
		cout << "Yes" << endl;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
#define ll long long 
const int maxn=10000010;
int notprime[maxn];
int prime[maxn],d[maxn],num[maxn];
int tot;
int n;
void init(){
    d[1]=1;
    for (int i=2;i<=10000000;++i){
        if (!notprime[i]){
            prime[++tot]=i; num[i]=1;
            d[i]=2;
        }
        for (int j=1;j<=tot&&(ll)i*prime[j]<=(ll)10000000;++j){
            notprime[i*prime[j]]=1;
            if (!(i%prime[j])){
                num[i*prime[j]]=num[i]+1;
                d[i*prime[j]]=d[i]/(num[i]+1)*(num[i*prime[j]]+1);
                break;
            }
            d[i*prime[j]]=d[i]*d[prime[j]];
            num[i*prime[j]]=1;
        }
    }
}
ll ans;
int main(){
    scanf("%d",&n); init();
    for (int i=1;i<=n;++i){
        ans+=(ll)i*d[i]; 
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 123468
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define isNum(a) (a>='0'&&a<='9')
#define SP putchar(' ')
#define EL putchar('\n')
#define inf 2147483647
#define File(a) freopen(a".in", "r", stdin), freopen(a".out", "w", stdout)
template<class T>inline void read(T&);
template<class T>inline void write(const T&);
typedef long long int ll;
int main () {
    ll k, a, b;
    read(k), read(a), read(b);
    if (b<=a+1||a>=k) {
        write(k+1), EL;
        return 0;
    }
    k-=a-1;
    write((k>>1)*(b-a)+a+(k&1)), EL;
    return 0;
}
template<class T>void read(T &Re) {
    T k=0;
    char ch=getchar();
    int flag=1;
    while (!isNum(ch)) {
        if (ch=='-') {
            flag=-1;
        }
        ch=getchar();
    }
    while (isNum(ch)) {
        k=(k<<1)+(k<<3)+ch-'0';
        ch=getchar();
    }
    Re=flag*k;
}
template<class T>void write(const T& Wr) {
    if (Wr<0) {
        putchar('-');
        write(-Wr);
    }else {
        if (Wr<10) {
            putchar(Wr+'0');
        }else {
            write(Wr/10);
            putchar((Wr%10)+'0');
        }
    }
}


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

int w, h, n;
int buttom[100000];

int main()
{
	cin >> w >> h >> n;
	for (int i = 0; i < n; i++)
	{
		int x, y;
		cin >> x >> y;
		buttom[x] = max(buttom[x], y);
	}

	int ans = 9999999;
	int b = 0;
	for (int i = w - 1; i >= 0; i--)
	{
		ans = min(ans, i + b);
		b = max(b, buttom[i]);
	}

	cout << ans << endl;

	return 0;
}

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

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

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;


int main(){
   int n;
   cin >> n;
   vector<ll>a(n);
   rep(i, 0, n)cin >> a[i];
   bool p = true;
   rep(i, 1, n){
       if(a[i]==a[i-1])continue;
       if(a[i]>a[i-1]){
           a[i]--;
           continue;
       }
       p = false;
   }
   if(p)cout << "Yes" << endl;
   else cout << "No" << endl;
}

Measured memory_bytes: 4036
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#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 Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};


int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(15);
    double a,b,h,m;
    cin>>a>>b>>h>>m;
    double hx=60.0*h+m;
    double mx=12.0*m;
    if(h==0.0 && m==0.0){
        cout<<abs(a-b)<<endl;
        return 0;
    }
    double ans2=a*a+b*b-2.0*a*b*cos(PI*(mx-hx)/360.0);
    double ans=sqrt(ans2);
    cout<<ans<<endl;
}/*
./problem.exe
*/

Measured memory_bytes: 4200
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int) n; i++)
using ll = long long;
template <class T>
using vt = vector<T>;
using vvi = vector<vector<int>>;

int main(){
  //type
  ll a,b,c;
  cin >> a >> b >> c;

  //solve
  if(a == b && b == c && c == a){
    cout << (a%2 == 1 ? 0 : -1) << endl;
    return 0;
  }

  int cnt = 0;
  while(a%2==0 && b%2==0 && c%2==0){
    int at,bt,ct;
    at = (b+c)/2;
    bt = (a+c)/2;
    ct = (a+b)/2;
    a = at;
    b = bt;
    c = ct;
    cnt++;
  }

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


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

int main() {
  int n;
  cin>>n;
  int minv=1001001;
  int p[n];
  
  rep(i,n){
    cin>>p[i];
  }
  int ans=0;
  rep(i,n){
    minv=min(minv,p[i]);
   
    if(minv==p[i])ans++;
  }
           
  cout<<ans<<endl;
}


Measured memory_bytes: 1024