akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define uint unsigned long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
using vint = vector<int>;
using vvint = vector<vint>;
using vchar = vector<char>;
using vvchar = vector<vchar>;
constexpr double pi = 3.1415926535897932384626433832795028L;

int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) {
    return a / gcd(a, b) * b;
}
int sigma(int n){
    int sum=0;
    for (int i=1; i<=(n); i++){
        sum+=i;
    }
    return sum;
}
int sigma_2(int n) {
  if (n == 0) {
    return 0;
  }
  return n + sigma_2(n - 1);
}
int sum_range(int a, int b) {
  if (a == b) {
    return a;
  }
  return sum_range(a, b - 1) + b;
}
int distance(int yo,int xo,int yi,int xi){
    return (yo-yi)*(yo-yi)+(xo-xi)*(xo-xi);
}

int array_sum_from_i(vint &data, int i) {
  if (i == data.size()) {
    return 0;
  }
  int s = array_sum_from_i(data, i + 1);
  return data[i] + s;
}
int array_sum(vint &data) {
  return array_sum_from_i(data, 0);
}
bool has_divisor(int N, int i) {
  if (i == N) {
    return false;
  }
  if (N % i == 0) {
    return true;
  }
  return has_divisor(N, i + 1);
}

bool is_prime(int N) {
  if (N == 1) {
    return false;
  }
  else if (N == 2) {
    return true;
  }
  else {
    return !has_divisor(N, 2);
  }
}
bool is_even(int);
bool is_odd(int);

bool is_even(int n) {
  if (n == 0) {
    return true;
  }
  return is_odd(n - 1);
}

bool is_odd(int n) {
  if (n == 0) {
    return false;
  }
  return is_even(n - 1);
}








signed main() {
    int A,B,M;
    cin >> A >> B >> M;
    vint a(A);
    vint b(B);
    vint x(M);
    vint y(M);
    vint c(M);
    int amin=100000;
    int bmin=100000;
    rep(i,A){
        cin >> a[i];
        if(amin > a[i]){
            amin = a[i];
        }
    }
    rep(i,B){
        cin >> b[i];
        if(bmin > b[i]){
            bmin = b[i];
        }
    }
    rep(i,M){
        cin >> x[i] >> y[i] >> c[i];
    }
    int min = amin + bmin;
    rep(i,M){
        int ai = x[i];
        int bi = y[i];
        if(min > (a[ai-1]+b[bi-1]-c[i])){
            min = (a[ai-1]+b[bi-1]-c[i]);
        }
    }

    cout << min << endl;
    return 0;
}


Measured memory_bytes: 4224
N = int(input())
bar = list(map(int, input().split()))
triangles = []
for i in range(N-2):
    for j in range(i + 1, N - 1):
        for k in range(j + 1, N):
            if (bar[i] + bar[j] > bar[k]) and (bar[j] + bar[k] > bar[i]) and (bar[i] + bar[k] > bar[j]) and (len(set([bar[i], bar[j], bar[k]])) == 3):
                triangles.append([bar[i], bar[j], bar[k]])
print(len(triangles))


Measured memory_bytes: 25692
#include <bits/stdc++.h>
using namespace std;
int main()
{
    vector<pair<int, int>> dish(5, make_pair(0, 0));
    for (int i = 0; i < 5; i++)
    {
        cin >> dish[i].second;
        dish[i].first = -(dish[i].second % 10);
        if (dish[i].first == 0)
        {
            dish[i].first -= 10;
        }
    }
    sort(dish.begin(), dish.end());
    int ans = 0;
    for (int i = 0; i < 5; i++)
    {
        ans += dish[i].second + 10 + dish[i].first;
        if (i == 4)
        {
            ans -= dish[i].first + 10;
        }
    }
    cout << ans << endl;
}

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

#define fi first
#define se second
#define int long long

const int inf = 1e18 + 9;

typedef pair<int, int> P;
typedef pair<int, P> PP;

struct edge
{
  edge() {}
  edge (int t, int v, int c) { to = t; f = v; cost = c; }
  int to, f, cost;
};

int h, w, k;
vector<PP> a, b;
vector<edge> G[2][202020];
int d[2][202020];

void dijkstra(int s, int po)
{
  for (int i = 0; i < 202020; i++){
    d[0][i] = d[1][i] = inf;
  }
  priority_queue<PP, vector<PP>, greater<PP> > q;

  d[0][s] = 0;
  q.push(PP(0, P(s, 0)));

  while (!q.empty()){
    PP p = q.top(); q.pop();
    int v = p.se.fi;
    int f = p.se.se;

    if (p.fi > d[f][v]) continue;
    for (int i = 0; i < G[f][v].size(); i++){
      edge e = G[f][v][i];
      if (d[e.f][e.to] > d[f][v] + e.cost){
        d[e.f][e.to] = d[f][v] + e.cost;
        q.push(PP(d[e.f][e.to], P(e.to, e.f)));
      }
    }
  }
}

signed main()
{
  bool izryt = false, _izryt = false;
  cin >> w >> h >> k;
  for (int i = 1; i <= k; i++){
    int x, y;
    cin >> x >> y;
    x--; y--;
    if (x == 0 && y == 0){
      a.push_back(PP(x, P(y, 0)));
      b.push_back(PP(y, P(x, 0)));
      G[0][0].push_back(edge(0, 1, 1));
      G[1][0].push_back(edge(0, 0, 1));
      izryt = true;
    }
    else if (x + 1 == w && y + 1 == h){
      a.push_back(PP(x, P(y, k + 1)));
      b.push_back(PP(y, P(x, k + 1)));
      G[0][k + 1].push_back(edge(k + 1, 1, 1));
      G[1][k + 1].push_back(edge(k + 1, 0, 1));
      _izryt = true;
    }
    else {
      a.push_back(PP(x, P(y, i)));
      b.push_back(PP(y, P(x, i)));
      G[0][i].push_back(edge(i, 1, 1));
      G[1][i].push_back(edge(i, 0, 1));
    }
  }

  if (!izryt) a.push_back(PP(0, P(0, 0)));
  if (!_izryt){
    a.push_back(PP(w - 1, P(h - 1, k + 1)));
    b.push_back(PP(h - 1, P(w - 1, k + 1)));
  }

  sort(a.begin(), a.end());
  sort(b.begin(), b.end());

  for (int i = 0; i < a.size() - 1; i++){
    if (a[i].fi == a[i + 1].fi && a[i].se.fi != a[i + 1].se.fi){
      G[0][a[i].se.se].push_back(edge(a[i + 1].se.se, 0, abs(a[i].se.fi - a[i + 1].se.fi)));
      G[0][a[i + 1].se.se].push_back(edge(a[i].se.se, 0, abs(a[i].se.fi - a[i + 1].se.fi)));
    }
  }

  for (int i = 0; i < b.size() - 1; i++){
    if (b[i].fi == b[i + 1].fi && b[i].se.fi != b[i + 1].se.fi){
      G[1][b[i].se.se].push_back(edge(b[i + 1].se.se, 1, abs(b[i].se.fi - b[i + 1].se.fi)));
      G[1][b[i + 1].se.se].push_back(edge(b[i].se.se, 1, abs(b[i].se.fi - b[i + 1].se.fi)));
    }
  }

  dijkstra(0, 0);

  int ans = min(d[0][k + 1], d[1][k + 1]);
  cout << (ans == inf ? -1 : ans) << endl;
}

Measured memory_bytes: 71348
# -*- coding: utf-8 -*-

# 入力を各変数に格納
N = int(input())

ans = 0
# 10の〇乗は10になるパターン
if N == 10 ** 1 or N == 10 ** 2 or N == 10 ** 3 or N == 10 ** 4 or N == 10 ** 5:
	ans = 10
# 他は各桁を足した合計
else:
	# 数値を文字列にして1文字ずつのリストにする
	strN_list = list(str(N))
	# ループして各桁を足した合計を計算
	for strN in strN_list:
		ans += int(strN)
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int mx = 2e3+2;
int edge[mx][mx];
int cost[mx][mx];

int main()
{
    int n;
    cin >> n;
    int x, y;
    cin >> x >> y;
    int cnt[n] = {0};

    for(int i=1; i<=n; i++) {
        for(int j=i+1; j<=n; j++) {
            int dist;
            dist = min(j-i, abs(x-i)+1+abs(y-j));
            if(dist > 0) cnt[dist]++;
        }
    }

    for(int i=1; i<n; i++) {
        cout<<cnt[i]<<"\n";
    }

    return 0;
}




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

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

  

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( stdin . lock ( ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        r: u64
    }
    println!("{}", 3*r*r);
}

Measured memory_bytes: 4352
import itertools

number = input()
A, B, C, D = (int(number[i]) for i in range(4))
for op1, op2, op3 in itertools.product(['+','-'], repeat=3):
    result = A
    if(op1 == '+'):
        result+=B
    else:
        result-=B
    if(op2 == '+'):
        result+=C
    else:
        result-=C
    if(op3=='+'):
        result+=D
    else:
        result-=D
    if result == 7:
        print(A,op1,B,op2,C,op3,D,'=7',sep='')
        break

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

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

using namespace std;

using ll = long long;

bool solve() {

    int N;
    cin >> N;
    vector<int> A(N);
    REP(i, N) cin >> A[i];

    ll sum_A = accumulate(all(A), 0ll);
    ll n_stones_per_operation = (ll)N * (N + 1) / 2;

    if (sum_A % n_stones_per_operation) {
        return false;
    }

    ll n_operations = sum_A / n_stones_per_operation;

    vector<ll> diff_A(N);
    REP(i, N - 1) diff_A[i] = A[i] - A[i + 1];
    diff_A[N - 1] = A[N - 1] - A[0];
    
    REP(i, N) diff_A[i] += n_operations;

    return all_of(all(diff_A), [&](ll x) { return x >= 0 && x % N == 0; });
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << (solve() ? "YES" : "NO") << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;

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

	ll N;
	cin >> N;

	vector<ll> A(N);
	ll sm = 0;
	rep(i, N) {
		cin >> A[i];
		sm += A[i];
	}

	vector<ll> B(N);
	for(int i = 0; i < N; i += 2){
		B[0] += A[i];
	}

	for(int i = 2; i < N; i += 2){
		B[i] = B[i-2];
		B[i] -= A[i-2];
		B[i] += A[(i-1+N)%N];
	}

	for(int i = 0; i < N; i += 2){
		B[1] += A[(i+1) % N];
	}

	for(int i = 2; i < N; i+= 2){
		if(i+1 == N) continue;
		B[i+1] = B[(i-1+N)%N];
		B[i+1] -= A[(i-1+N)%N];
		B[i+1] += A[(i+N)%N];
	}

	rep(i, N){
		cout << 2 * B[i] - sm << " ";
	}
	cout << endl;

}


Measured memory_bytes: 2944
n,k,s=map(int,input().split())
A=[0]*n
for i in range(k):
  A[i]=s
j=1
if s>2:
  for i in range(k,n):
    A[i]=s-1
else:
  for i in range(k,n):
    A[i]=s+1
A=[str(i) for i in A]
print(' '.join(A))

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

int main()
{
  string s;
  cin >> s;
  if ((s[0] == s[1] && s[2] == s[3] || s[0] == s[2] && s[1] == s[3] || s[0] == s[3] && s[1] == s[2]) && !(s[0] == s[1] && s[0] == s[2] && s[0] == s[3])) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lo long long int
#define pb push_back
using namespace std;
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lo bir,iki,uc,x;
  cin>>bir>>iki>>uc>>x;
  lo t1=0;
  if(bir>x){
      cout<<x;
      return 0;
  }
  if(bir<=x){
  t1+=bir;
    x-=bir;
  }
  if(iki>x){
    cout<<t1;
    return 0;
  }
  if(iki<=x){
    x-=iki;
  }
  if(uc>x){
    t1-=x;
  }
  if(uc<=x){
    t1-=uc;
  }
  cout<<t1;
}

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

namespace Atcoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var fLine = Console.ReadLine().Split(' ');
			var K = int.Parse(fLine[0]);
			var S = int.Parse(fLine[1]);
			//X+Y+Z	=S
			int result = 0;
			//List<string> resultList = new List<string>();
			for (int x = 0; x <= K; x++)
			{
				for (int y = 0; y <= K; y++)
				{
					if (x + y > S)
					{
						continue;
					}
					var z = S - x - y;
					if (z <= K)
					{
						//resultList.Add(x.ToString() + y.ToString() + z.ToString());
						result++;
					}
				}
			}
			Console.Write(result);
		}
	}
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define ll long long 
#define vi vector<int>
#define vl vector<ll>
#define vll vector<pair<ll,ll> >
#define vii vector<pair<int,int> >
#define pb push_back
#define inf -1000000007
#define f(i,a,b) for(i=a;i<b;i++)

using namespace std;
bool cmp(string &a,string &b)
{
	if(a.size()==b.size())return a<b;
	return a.size()<b.size();
}
ll d[200001];
int main()
{
	
string s;
cin>>s;

int i=0;

if(s[i]=='R'&&s[i+1]=='R'&&s[i+2]=='R')cout<<3;
else if((s[0]=='R'&&s[1]=='R')||(s[1]=='R'&&s[2]=='R'))cout<<2;
else if(s[0]=='R'||s[1]=='R'||s[2]=='R')cout<<1;
else cout<<0;
}

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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define repr(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = 1e9 + 10;
const long long LLINF = (long long)1e18 + 10;
const long long MOD = (long long)1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

    int n;
    cin >> n;

    int now, prev = 0, ans = 0;
    rep(i, n){
        cin >> now;
        ans += max(now - prev, 0);
        prev = now;
    }

    cout << ans << endl;

    return 0;
}

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

class Program
{
    public Program() { }

    Scanner cin;

    void myon()
    {
        cin = new Scanner();

        int n = cin.nextInt();

        string s = cin.next();
        string t = cin.next();

        int start = Math.Max(0, s.Length - t.Length);

        int ans = s.Length + t.Length;
        for (int i = start; i < s.Length; i++)
        {
            bool flag = true;

            for (int j = i; j < s.Length; j++)
            {
                if (s[j] != t[j-i])
                {
                    flag = false;
                    break;
                }
            }

            if (flag)
            {
                ans = Math.Min(ans, i + t.Length);
            }
        }
        Console.WriteLine(ans);
    }


    static void Main(string[] args)
    {
        new Program().myon();
    }
}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        i = 0;
        return next();
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

}

Measured memory_bytes: 11220
import kotlin.math.*
import java.util.*
import java.io.*
val pn:Long = 1000000007L
var x:Long = 1L
var y:Long = 1L
var z:Long = 1L
var ans:Long =0L
fun main() {
    val N = readLine()!!.toLong()
    for(i in 1..N){
        x = (x * 10L)%pn
        y = (y * 9L)%pn
        z = (z * 8L)%pn
    }
    ans = x - (2*y) + z
    if(ans < 0){
        ans = ans + pn
    }
    if(ans < 0){
        ans = ans + pn
    }
    ans = ans%pn
    println(ans)
}

Measured memory_bytes: 34532
def main(a,n,b):
    check = [[0]*3 for _ in range(3)]
    for i in range(n):
        val = b[i]
        for row in range(3):
            for col in range(3):
                if a[row][col] == val:
                    check[row][col] = 1
    res = judge(check)
    return res

def judge(check):
    if ((check[0][0] * check[0][1] * check[0][2] == 1)
        or (check[1][0] * check[1][1] * check[1][2] == 1)
        or (check[2][0] * check[2][1] * check[2][2] == 1)
        or (check[0][0] * check[1][0] * check[2][0] == 1)
        or (check[0][1] * check[1][1] * check[2][1] == 1)
        or (check[0][2] * check[1][2] * check[2][2] == 1)
        or (check[0][0] * check[1][1] * check[2][2] == 1)
        or (check[2][0] * check[1][1] * check[0][2] == 1)):
        return "Yes"
    return "No"



a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]
print(main(a,n,b))

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-10;

template <typename T> void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}

inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}

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

int main() {
	IOS();
	int n;
	cin >> n;
	ll a[52];
	ll M = -INF, m = INF;
	int Mx, mx;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		if (a[i] > M) {
			M = a[i], Mx = i;
		}
		if (a[i] < m) {
			m = a[i], mx = i;
		}
	}
	vector<P> ans;
	if (m >= 0) {
		for (int i = 1; i <= n - 1; i++) {
			ans.push_back(P(i, i + 1));
		}
	} else if (M <= 0) {
		for (int i = n; i > 1; i--) {
			ans.push_back(P(i, i - 1));
		}
	} else if (abs(m) >= M) {
		for (int i = 1; i <= n; i++) {
			if (a[i] > 0) ans.push_back(P(mx, i));
		}
		for (int i = n; i > 1; i--) {
			ans.push_back(P(i, i - 1));
		}
	} else {
		for (int i = 1; i <= n; i++) {
			if (a[i] < 0) ans.push_back(P(Mx, i));
		}
		for (int i = 1; i <= n - 1; i++) {
			ans.push_back(P(i, i + 1));
		}
	}
	dump(ans.size());
	for (int i = 0; i < ans.size(); i++) {
		cout << ans[i].first << " " << ans[i].second << endl;
	}
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

//#include<bits/stdc++.h>


using namespace std;



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

    for (int i = 0; i < p.size(); i++) {
        p[i] += n;
        if (p[i] > 'Z')p[i] -= 'z'-'a'+1;
    }
    cout << p << endl;
    
    return 0;

}


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

using namespace std;
using ll=long long;

int main()
{
    int n;
    cin >> n;
    vector<ll> field(n,0);
    for(int i=0;i<n;i++)
    {
        cin >> field.at(i);
    }
    vector<ll> ans(n,0);
    ans.at(0)=0;
    ans.at(1)=abs(field.at(1)-field.at(0));
    for(int i=2;i<n;i++)
    {
        ans.at(i)=min(abs(field.at(i)-field.at(i-1))+ans.at(i-1),abs(field.at(i)-field.at(i-2))+ans.at(i-2));
    }
    cout << ans.at(n-1) <<endl;
    return(0); 
}

Measured memory_bytes: 4780
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double w=sc.nextDouble(),h=sc.nextDouble(),x=sc.nextDouble(),y=sc.nextDouble();
		double sum=w*h;
		if(w/2==x&&h/2==y) {
			System.out.println(sum/2+" "+1);
		}else{
			System.out.println(sum/2+" "+0);
		}
	}
}



Measured memory_bytes: 23124
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var c = Console.ReadLine();
            var d = Console.ReadLine();
            Console.WriteLine(c[0] == d[2] && c[1] == d[1] && c[2] == d[0]? "YES":"NO");
        }
    }
}


Measured memory_bytes: 11092
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
  int a,b;
  char ans[16];
  while(scanf("%d %d",&a,&b) != EOF){
    if(a == 0 && b == 0)break;
    sprintf(ans,"%d",a+b);
    int len = strlen(ans);
    cout << len << endl;
  }
}

Measured memory_bytes: 1244
n = int(input())
num = n
A = []
b = 2
while b*b <= n:
    while n % b == 0:
        n //= b
        A.append(b)
    b += 1
if n > 1:
    A.append(n)
print(str(num)+": "+' '.join(str(f) for f in A))



Measured memory_bytes: 5604
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <stdlib.h>
#include <stdio.h>

using namespace std;
using Graph = vector<vector<int>>;

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; }

vector<bool> seen;

void dfs(const Graph& G, int v) {
    seen[v] = true; // v を訪問済にする

    // v から行ける各頂点 next_v について
    for (auto next_v : G[v]) {
        if (seen[next_v]) continue; // next_v が探索済だったらスルー
        dfs(G, next_v); // 再帰的に探索
    }
}

int abs_A(int num) {
    if (num > 0)
        return num;
    else
        return -num;
}

int abs_B(long long num, long long numb) {
    if (num - numb >= 0)
        return num - numb;
    else
        return -1 * (num - numb);
}

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

bool permutation(vector<int>& vec, vector<int>& P) {
    bool ok = true;
    for (int i = 0; i < vec.size(); i++) {
        if (vec.at(i) != P.at(i)) {
            ok = false;
        }
    }
    return ok;
}

const long long MOD = 1000000007;
const int INF = 1001001001;

int main() {
    string S;
    cin >> S;
    if (S.at(0) == S.at(1) && S.at(1) == S.at(2) && S.at(0) == S.at(2)) cout << "No" << endl;
    else cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>

typedef long long ll;

using namespace std;

int main(int argc, const char * argv[]) {
  ll N;
  cin >> N;
  if(N%1000 == 0){
    cout << 0;
  }else{
  	cout << 1000 - N%1000;
  }
}



Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
#define FAST std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl '\n'
#define pb push_back
#define mod 1000000007
#define fr(i,n) for(int i=0;i<n;i++)
#define int long long int

int n,m;
map<int,std::vector<int> > edge;
stack<int> s;
std::vector<int> visited(100000,-1),answer(100000,-1);
std::vector<int> topsort;

void dfs(int node,int level)
{
    answer[node]=max(level,answer[node]);
    fr(i,edge[node].size())
        answer[edge[node][i]]=max(answer[node]+1,answer[edge[node][i]]);
}

void top(int node)
{
    visited[node]=1;
    fr(i,edge[node].size())
        if(visited[edge[node][i]]!=1)
            top(edge[node][i]);
    s.push(node);
}

signed main() 
{
    FAST
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    cin>>n>>m;
    int x,y;
    fr(i,m)
    {
        cin>>x>>y;
        x--;y--;
        edge[x].pb(y);
    }
    fr(i,n)
        if(visited[i]!=1)
            top(i);
    fr(i,n)
        {topsort.pb(s.top());s.pop();}//cout<<topsort[i]<<" ";}
        //cout<<endl;

    fr(i,n)
    {
        //if(answer[topsort[i]]==-1)
            dfs(topsort[i],0);
    }

    int ans=*max_element(answer.begin(),answer.end());
    cout<<ans;
    
    return 0;
}

Measured memory_bytes: 18088
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e8;

signed main() {
	int A, B;
	cin >> A >> B;
	int a = A + B;
	int b = A - B;
	int c = A * B;
	cout << max({ a,b,c });
}

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

using namespace std;

int main(){
    long long n;
    cin >> n;
    long long a[n];
    long long sum = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        sum += a[i];
    }
    long long v = (n + 1) * n / 2;
    if(sum % v != 0){
        cout << "NO"; return 0;
    }
    v = sum / v;
    long long x = a[0] - a[n - 1];
    long long k = v - x;
    if(k < 0){
        k = -k;
        k %= n;
        k = n - k;
    }
    if(k % n != 0){
        cout << "NO"; return 0;
    }
    for(int i = 1; i < n; i++){
        long long t = v - a[i] + a[i - 1];
        if(t < 0){
            t = -t;
            t %= n;
            t = n - t;
        }
        if(t % n != 0){
            cout << "NO"; return 0;
        }
    }
    for(int i = 0; i < n; i++){
        if(a[i] < v){
            cout << "NO"; return 0;
        }
    }
    cout << "YES";
}


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

int main()
{
	while (1) {
		int r0, w0, c, r;
		cin >> r0 >> w0 >> c >> r;

		if (w0 == 0)break;

		int ans = ceil(double(w0*c - r0) / r);

		cout << max(0,ans) << endl;
	}

    return 0;
}

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

int main() {
  int a,b;
  cin >>a>>b;
  int x=0;
  int c=max(a,b);
  int d=min(a,b);
  x+=c;
  c--;
  x+=max(c,d);
  cout<<x<<endl;
}

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

int n, k;
vector<int> a;
template <class T>
void readVector(int n, vector<T> &v){
	for(int i=0; i<n; ++i){
		T t;
		cin >> t;
		v.push_back(t);
	}
}
int p;
int ans;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n >> k;
	readVector(n, a);
	for(int i=0; i<n; ++i)
		if(a[i] == 1)
			p = i;
	ans += (p+k-2) / (k-1);
	int t = ans * (k-1);
	ans += (n-t+k-3) / (k-1);
/*	ans = 1;
	if(n != k){
		ans = (p+k-2) / (k-1) + (n-p-1+k-2) / (k-1);
		if(p < k || n - k <= p){
			ans = (n-1+k-2) / (k-1);
		}
	}
*/	cout << ans << "\n";
}

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

int main(){
  int n,m;
  cin >> n >> m;
  d t=0;
  vector<int> a;
  rep(i,n){
    int b;
    scanf("%d",&b);
    a.push_back(b);
    t+=b;
  }
  bool k=0;
  int c=0;
  rep(i,n){
    if(a[i]*4*m>=t)++c;
    if(c==m){
      k=1;
      break;
    }
  }
  if(k) printf("%s\n", "Yes");
  else printf("%s\n", "No");
  return 0;
}


Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) begin(x), end(x)
#define debug(x) cout << #x " => " << (x) << endl
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
#endif
using lint = long long;
constexpr int MOD = (int)1e9 + 7;
constexpr double EPS = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int a, b, m;
  cin >> a >> b >> m;
  vector<int> A(a), B(b);
  rep (i, a) cin >> A[i];
  rep (i, b) cin >> B[i];
  struct Ticket { int x, y, c; };
  vector<Ticket> C(m);
  rep (i, m) {
    cin >> C[i].x >> C[i].y >> C[i].c;
    --C[i].x, --C[i].y;
  }
  int mini = *min_element(all(A)) + *min_element(all(B));
  rep (i, m) mini = min(mini, A[C[i].x] + B[C[i].y] - C[i].c);
  cout << mini << endl;
  return 0;
}

Measured memory_bytes: 2176
#include <stdio.h>
#include <algorithm>
#include <complex>

int main()
{
    int ans = 700;
    char str[8];
    scanf("%s", str);
    for (int i = 0; i < 3; ++i)
        if (str[i] == 'o') ans += 100;
    printf("%d\n", ans);

    return 0;
}

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

using namespace std;

typedef long long llint;

int A, B, C, X, Y;

int main(void) {
  scanf("%d%d%d%d%d", &A, &B, &C, &X, &Y);

  if (2 * C > A + B) {
    printf("%d\n", X * A + Y * B);
    return 0;
  }

  int mab = min(X, Y);
  int sol = mab * 2 * C;

  X -= mab; Y -= mab;
  sol += X * min(2 * C, A);
  sol += Y * min(2 * C, B);

  printf("%d\n", sol);

  return 0;
}


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

int main(){
  std::string str1, str2;
  
  std::cin>>str1;
  std::cin>>str2;
  
  if(str1.length() + 1 == str2.length() && 
     std::equal(std::begin(str1), std::end(str1), std::begin(str2)))std::cout<<"Yes";
  else std::cout<<"No";
}

Measured memory_bytes: 3588
import os
import sys

import numpy as np


def solve(inp):
    SEGTREE_TABLES = []

    def bit_length(n):
        ret = 0
        while n:
            n >>= 1
            ret += 1
        return ret

    def segtree_init(n):
        n2 = 1 << bit_length(n)
        SEGTREE_TABLES.append(np.zeros(n2 << 1, dtype=np.int64))
        return len(SEGTREE_TABLES) - 1

    def segtree_build(ins, arr):
        table = SEGTREE_TABLES[ins]
        offset = table.size >> 1
        table[offset:offset + len(arr)] = arr
        for i in range(offset - 1, 0, -1):
            ch = i << 1
            table[i] = max(table[ch], table[ch + 1])

    def segtree_update(ins, i, x):
        table = SEGTREE_TABLES[ins]
        offset = table.size >> 1
        i += offset
        table[i] = x
        while i > 1:
            ch = i
            i >>= 1
            table[i] = max(table[ch], table[ch ^ 1])

    def segtree_query(ins, l, r):
        """ max [l, r) """
        table = SEGTREE_TABLES[ins]
        offset = table.size >> 1
        l += offset
        r += offset
        res = -1
        while l < r:
            if r & 1:
                res = max(res, table[r - 1])
            if l & 1:
                res = max(res, table[l])
                l += 1
            l >>= 1
            r >>= 1
        return res

    def segtree_search(ins, lo, x):
        """
        Get min i where lo <= i, A[i] >= x.
        Assume that a sentinel larger than x is inserted at the right end.
        """
        table = SEGTREE_TABLES[ins]
        offset = table.size >> 1
        i = lo + offset
        while table[i] < x:
            while i & 1:
                i >>= 1
            i += 1
        while i < offset:
            i <<= 1
            if table[i] < x:
                i += 1
        return i - offset

    def segtree_debug_print(ins):
        table = SEGTREE_TABLES[ins]
        offset = table.size >> 1
        i = 1
        while i <= offset:
            print(table[i:2 * i])
            i <<= 1

    n = inp[0]
    q = inp[1]
    aaa = inp[2:n + 2]
    ttt = inp[n + 2::3]
    xxx = inp[n + 3::3]
    yyy = inp[n + 4::3]
    INF = 1 << 60

    aaa = np.append(aaa, INF)
    ins = segtree_init(n + 1)
    segtree_build(ins, aaa)

    ans = []

    for i in range(q):
        if ttt[i] == 1:
            segtree_update(ins, xxx[i] - 1, yyy[i])
        elif ttt[i] == 2:
            res = segtree_query(ins, xxx[i] - 1, yyy[i])
            ans.append(res)
        else:
            res = segtree_search(ins, xxx[i] - 1, yyy[i])
            ans.append(res + 1)

    return ans


if sys.argv[-1] == 'ONLINE_JUDGE':
    from numba.pycc import CC

    cc = CC('my_module')
    cc.export('solve', '(i8[:],)')(solve)
    cc.compile()
    exit()

if os.name == 'posix':
    # noinspection PyUnresolvedReferences
    from my_module import solve
else:
    from numba import njit

    solve = njit('(i8[:],)', cache=True)(solve)
    print('compiled', file=sys.stderr)

inp = np.fromstring(sys.stdin.read(), dtype=np.int64, sep=' ')
ans = solve(inp)
print('\n'.join(map(str, ans)))


Measured memory_bytes: 53184
#include<iostream>
using namespace std;
int main(){
	int n,num,digit,rev=0;
	cin>>num;
	n=num;
	while(num!=0)
	{
		digit=num%10;
		rev=(rev*10)+digit;
		num=num/10;
	}
	if(n==rev)
	{
		cout<<"Yes";
	}
	else
	cout<<"No";
	
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 3e5 + 5;
const ll LINF = 1e18 + 5;
constexpr int mod = 1e9 + 7, two = (mod+1)/2;
int n, cnt[N];
ll a[N];
int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	cin >> n;
 	for(int i=1;i<=n;i++) cin >> a[i];
 	for(int i=1;i<=n;i++)
 		for(int j=0;j<=60;j++)
 			if((a[i]>>j)&1) cnt[j]++;
 	ll ans = 0;
 	for(int i=1;i<=n;i++)
 	{
 		for(int j=0;j<=60;j++)
 		{
 			if((a[i]>>j)&1)
 			{
 				ans += (n-cnt[j])*((1ll<<j)%mod)%mod;
 				ans %= mod;
 			}
 			else
 			{
 				ans += (cnt[j])*((1ll<<j)%mod)%mod;
 				ans %= mod;
 			}
 		}
 	}
 	ans = ans*two%mod;
 	ans = (ans+mod)%mod;
 	cout << ans;
	return 0;
}


Measured memory_bytes: 2560
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func line() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	input := strings.Split(line(), " ")
	k, _ := strconv.Atoi(input[1])
	str := []byte(line())
	char := strings.ToLower(string(str[k-1]))
	str[k-1] = []byte(char)[0]
	fmt.Println(string(str))
}


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

#define ln                '\n'
#define all(dat)           dat.begin(), dat.end()
#define loop(i, to)        for (int i = 0; i < to; ++i)
#define cont(i, to)        for (int i = 1; i <= to; ++i)
#define circ(i, fm, to)    for (int i = fm; i <= to; ++i)
#define foreach(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)

typedef long long          num;

using namespace std;

int n;
num ans;

int main() {
	scanf("%d", &n);
	cont (i, n) for (int j = i; j <= n; ans += j, j += i);
	printf("%lld\n", ans);
}

Measured memory_bytes: 3816
#include<bits/stdc++.h>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define endl  "\n"
#define ll long long
#define int long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);cout.tie(NULL);
using namespace std;
bool isPrime(int n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;
    for (int i = 5; i * i <= n; i += 6)
    {
        if ((n % i == 0) || (n % (i + 2) == 0))
            return false;
    }
    return true;
}
int32_t main()
{
	fast;
	ll n;
	cin >> n;
	ll a[n];
	set<ll> s;
	unordered_map<ll,ll> mp;
	for(ll i=0;i<n;i++)
	{
		cin >> a[i]; 
		s.insert(a[i]);
		mp[a[i]]++;
	}	
	ll c=0;
	for(ll i=0;i<n;i++)
	{
		
		if(mp[a[i]]>1)
		{
			continue;
		}
		ll x=a[i];
		ll raj=0;
		for(ll j=1;j<=sqrt(x);j++)
		{
			if(x%j==0)
			{
				if(x/j == j)
				{
					if(j!=x && s.find(j)!=s.end())
					{
						raj=1;
						break;
					}
				}
				else
				{
					if(j!=x && s.find(j)!=s.end())
					{
						raj=1;
						break;
					}
					if(x/j!=x && s.find(x/j)!=s.end())
					{
						raj=1;
						break;
					}
				}
			}
		}
		if(raj==0)
		c++;
	}
	cout << c;
}


Measured memory_bytes: 22564
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int (i)=(m);(i)<(n);++(i))
#define rREP(i,m,n) for(int (i)=(n)-1;(i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;
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;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	int m1, d1, m2, d2; cin >> m1 >> d1 >> m2 >> d2;
	if (m1 != m2)cout << 1 << "\n";
	else cout << 0 << "\n";

	return 0;
}

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

const int MAX = 100000;
int n, a[MAX];

int partition(int p, int r){
    int x=a[r], i = p-1;
    for(int j=p; j<r; ++j){
        if(a[j] <= x){
            ++i;
            swap(a[i], a[j]);
        }
    }
    swap(a[i+1], a[r]);
    return i+1;
}

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

    int k = partition(0, n-1);

    for(int i=0; i<n; ++i){
        if(i == k) cout << "[";
        cout << a[i];
        if(i == k) cout << "]";
        if(i == n-1) cout << endl;
        else cout << " ";
    }
}



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

int main() {
    bool submit[31] = {};
    int n;
    for (int i=0; i<28; ++i) {
        cin >> n;
        submit[n] = true;
    }
    for (int i=1; i<=30; ++i) {
        if ( ! submit[i]) {
            cout << i << endl;
        }
    }
    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define ALL(v) v.begin(), v.end()

int N;
string S;

int main() {
    cin >> N >> S;
    int ans = 0;
    REP (i, N-2) {
        if (S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C') ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ff first
#define ss second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define check(x) cout << #x << " : " << (x) << endl
#define all(v) v.begin(),v.end() 
#define allr(v) v.rbegin(),v.rend() 
//#define endl '\n'  
typedef  long long ll; 
typedef  unsigned long long ull; 
typedef vector< ll > edge; 
typedef pair< ll , ll > mypair;
typedef priority_queue <ll> max_heap;
typedef priority_queue <ll, vector<ll>, greater<ll> > min_heap;
 ll mod=1e9+7;
const ll inf=1e15+10;
const ll N=3e6;

struct matrix
{
	vector<vector<ll> > mat;
	void resize(ll a,ll b, ll initial)
	{
		mat.resize(a,vector<ll> (b,initial));
	}
	void identity()
	{
		for(auto &i:mat) for(auto &j:i) j=0;
		for(ll i=0;i<(ll)mat.size();i++) mat[i][i]=1;
	}
	ll get_rows()
	{
		return mat.size();
	}	
	ll get_cols()
	{
		return mat[0].size();
	}
	matrix operator + ( matrix & b)  const
	{
		matrix temp;
		ll ro,co;
		ro=b.get_rows();
		co=b.get_cols();
		temp.resize(ro,co,0);
		for(ll i=0;i<ro;i++)  
		{
			for(ll j=0;j<co;j++)
			{
				//temp.mat[i][j]=mat[i][j]+b.mat[i][j];
				temp.mat[i][j]=(mat[i][j]%mod)+(b.mat[i][j]%mod);
				temp.mat[i][j]%=mod;
			}
		}	
		return temp;
	}
	matrix operator * ( matrix & b)  const
	{
		matrix temp;
		ll ro,co;
		ro=mat.size();
		co=b.get_cols();
		ll mi=b.get_rows();
		temp.resize(ro,co,0);
		for(ll i=0;i<ro;i++)  
		{
			for(ll j=0;j<co;j++)
			{
				for(ll k=0;k<mi;k++)
				{
					//temp.mat[i][j]+=mat[i][k]*b.mat[k][j];
					temp.mat[i][j]+=((mat[i][k]%mod) * (b.mat[k][j]%mod));
					temp.mat[i][j]%=mod;
				}
			}
		}	
		return temp;
	}	
	void print()
	{
		for(auto &i:mat)
		{
			for(auto &j:i) cout<<j<<" ";
			cout<<endl;	
		}	

	}


};

matrix power(matrix a,ll b)
{
	matrix ans;
	ans.resize(a.get_rows(),a.get_cols(),0);
	ans.identity();
	while(b)
	{
		if(b & (ll)1)
		{
			ans=ans*a;
		}
		a=a*a;
		b>>=1;
	}
	return ans;
}
int main()
{
	// problem : https://atcoder.jp/contests/abc129/tasks/abc129_f
	// my solution  :  
 	boost;
	ll l,a,b,m;
	cin>>l>>a>>b>>m;
	mod=m;
	ll lo,hi;
	matrix ans;
	ans.resize(1,3,0);
	ans.mat[0][0]=a%mod;
	ans.mat[0][1]=(a+b)%mod;
	ans.mat[0][2]=1;
	ll term =1,d=10;
	while(term<l)
	{
		lo=max((ll)0,((d/10-1)-a)/b);
		hi=min(l-1,max((d-1-a)/b,(ll)0));
		term+=hi-lo;
		ll now=hi-lo;
		matrix temp;
		temp.resize(3,3,0);
		temp.mat[0][0]=d%mod;
		temp.mat[1][0]=1;
		temp.mat[1][1]=1;
		temp.mat[2][1]=b%mod;
		temp.mat[2][2]=1;
		temp=power(temp,now);
		ans=ans*temp;
		d*=10;
		//check(term);check(hi);check(lo);
	}
	cout<<ans.mat[0][0];
  	return 0;
}  

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll a, b;
    cin >> a >> b;
    if (a < b) cout << string(b, a + '0');
    else cout << string(a, b + '0');
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#define MAX_N 86
using namespace std;

long long fib[MAX_N + 1];

int main(int argc, const char * argv[]) {
    int N;
    scanf("%d", &N);
    
    fib[0] = 2;
    fib[1] = 1;
    for (int i = 2; i <= N; i++) {
        fib[i] = fib[i - 1] + fib[i - 2];
    }
    printf("%lld\n", fib[N]);
    
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
bool is_prime(int m) {
  for(int i=2;i*i<=m;i++)if(m%i==0)return false;
  return true;
}
int main(void){
  int n;
  cin>>n;
  for(int i=11;i<=55555;i+=5){
    if(is_prime(i)){
      if(i!=11)cout<<" ";
      cout<<i;
      n--;
    }
    if(n==0)break;
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 256
// E - Get Everything
#include <bits/stdc++.h>

using namespace std;

#define	INF	10000000000000000

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false); cin.tie(0);
	int n, m;
	cin >> n >> m;
	vector<int> a(m);
	vector<vector<int> > c(m);
	for (int i = 0; i < m; i++) {
		int b;
		cin >> a[i] >> b;
		c[i].resize(b);
		for (int j = 0; j < b; j++) cin >> c[i][j];
	}

	vector<long long> dp(1 << n, INF);
	dp[0] = 0;
	for (int i = 0; i < a.size(); i++) {
		long long x = 0;
		for (int j = 0; j < c[i].size(); j++) x |= (1LL << (c[i][j] - 1));
		for (int j = (1 << n) - 1; j >= 0; j--)
			dp[j | x] = min(dp[j | x], dp[j] + a[i]);
	}

	long long ans = dp[(1 << n) - 1];
	cout << (ans < INF ? ans : -1) << endl;

	return 0;
}


Measured memory_bytes: 384
import sys
import math
import itertools as it
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    n = I()
    t = Intl()
    m = I()
    px = [Intl() for i in range(m)]
    s = sum(t)
    ps = s
    for i in range(m):
        a,b = px[i][0],px[i][1]
        s -= t[a-1]
        s += b
        print(s)
        s -= b
        s += t[a-1]

Measured memory_bytes: 9156
#pragma region Macros
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())
#define IN(x, a, b) x >= a and x < b

using namespace std;
using ll = long long;

template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T> constexpr T INF = numeric_limits<T>::max() / 2;
#pragma endregion

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

  int N;
  string S;
  cin >> N >> S;
  if (N % 2 != 0) {
    cout << "No\n";
    return 0;
  }
  REP(i, N / 2) {
    if (S[i] != S[i + N / 2]) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";

  return 0;
}

Measured memory_bytes: 256
#47b
w,h,n = map(int,input().split())
x,y=0,0

for _ in range(n):
    xi,yi,a = map(int,input().split())
    if a==1:
        x = max(x,xi)
    elif a==2:
        w = min(xi,w)
    elif a==3:
        y = max(y,yi)
    else:
        h = min(h,yi)
   

print(0 if x>=w or y>=h else (w-x)*(h-y))

Measured memory_bytes: 3064
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("trapv")
#pragma GCC target("sse4")

#include <bits/stdc++.h>

using namespace std;

#define deb(x) cout << #x << " is " << x << "\n"
#define int long long
#define mod 1000000007
#define PI acos(-1)

void solve() {
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i < n; i ++) {
        for (int j = 1; j < n; j ++) {
            if (i * j < n) {
                ans ++;
            } else {
                break;
            }
        }
    }
    cout << ans << '\n';
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif
    int tc = 1;
    // cin >> tc;
    while (tc--) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define RREP(i, n) for(int i = n; i >= n; i--)

#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))

#define endl "\n"
#define pb push_back
#define rtn return
#define elif else if

#define INF 2000000000	//int型は2 * 10^9ぐらいまで
#define MOD 1000000007
 
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};

typedef long long ll;
typedef unsigned long long ull;

template <typename T>
inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T>
inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T>
inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T>
inline T nHr(T a,T b){return nCr(a+b-1,b);}
template <typename T>
inline T POW(T a,T b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

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

	int n, x[200000], xx[200000];
	cin >> n;
	REP(i, n){
		cin >> x[i];
		xx[i] = x[i];
	}

	sort(xx, xx+n);
	REP(i, n){
		if(x[i] <= xx[n/2 - 1]) cout << xx[n/2] << endl;
		else cout << xx[n/2 - 1] << endl;
	}

	rtn 0;
}

Measured memory_bytes: 3840