akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
using namespace std;

int main() {
    string suit;
    int n, nb;
    bool table[52] = {false};

    cin >> n;

    for (int i = 0; i < n; ++i) {
        int t;

        cin >> suit >> nb;
        if (suit == "S") {
            t = 0;
        } else if (suit == "H") {
            t = 1;
        } else if (suit == "C") {
            t = 2;
        } else {
            t = 3;
        }

        table[(nb-1)+t*13] = true;
    }

    for (int i = 0; i < 52; ++i) {
        if (table[i] == false) {
            if(i < 13) {
                cout << "S " << i + 1 << endl;
            } else if (i < 26) {
                cout << "H " << i - 12 << endl;
            } else if (i < 39) {
                cout << "C " << i - 25 << endl;
            } else {
                cout << "D " << i - 38 << endl;
            }
        }
    }

    return 0;
}




Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
multiset <string> s;
int x,y,z;
int main(){
	cin>>x>>y>>z;
	while(x--)s.insert("a");
	while(y--)s.insert("b");
	while(z--)s.insert("c");
	while(s.size()>1){
		string a=*s.begin();
		string b=*s.rbegin();
		s.erase(s.lower_bound(a));
		s.erase(s.lower_bound(b));
		s.insert(a+b);
	}
	cout<<*s.begin()<<endl;
}

Measured memory_bytes: 384
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
   
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n=int(input())

l=sorted(list(map(int,input().split())))

a=1
if l[0]==0:
	print("0")

else:
	for i in range(0,n):
		a=a*l[i]
		if a>10**18:
			print(-1)
			break
		
	if a<10**18+1:
		print(a)	 

Measured memory_bytes: 84544
#[allow(unused_macros)]
macro_rules! parse_line {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            iter.next().unwrap().parse::<$t>().unwrap()
        }
    );

    ( $( $t:ty), +) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ( $(iter.next().unwrap().parse::<$t>().unwrap()),* )
        }
    );
}

#[allow(unused_macros)]
macro_rules! read_line {
    () => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            line.pop();
            line
        }
    )
}

#[allow(unused_macros)]
macro_rules! parse_vec {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let iter = line.split_whitespace();
            iter.map(|v| v.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    )
}

fn solve(mut aa: Vec<i64>) -> Vec<i64> {
    use std::cmp::min;

    let n = aa.len();
    aa.insert(0, 0);
    aa.push(0);
    let sum = aa.iter().fold((0,0), |(sum, p), a| (sum + (p-a).abs(), *a) ).0;

    (1..(n+1)).map(|i| {
        if (aa[i-1] <= aa[i] && aa[i] <= aa[i+1]) ||
            (aa[i+1] <= aa[i] && aa[i] <= aa[i-1])
        {
            sum
        } else {
            sum - (2*min((aa[i-1] - aa[i]).abs(), (aa[i+1]-aa[i]).abs()))
        }
    }).collect::<Vec<_>>()
}

fn main() {
    read_line!();
    let aa = parse_vec!(i64);

    for a in solve(aa) {
        println!("{}", a);
    }
}

#[test]
fn solve_test() {
    assert_eq!(solve(vec![3,5,-1]), vec![12,8,10]);
    assert_eq!(solve(vec![1,1,1,2,0]), vec![4,4,4,2,4]);
    assert_eq!(solve(vec![-679, -2409, -3258, 3095, -3291, -4462]),
               vec![21630,21630,19932,8924,21630,19288]);
}


Measured memory_bytes: 7292
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 1000000000
#define MOD 1000000007

typedef  long long ll;

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

double euclid_distance(double a,double b){
    return sqrt(a*a+b*b);
}

ll gcd(ll  a,ll b){
    ll r;
    if(a < b){
        ll tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r = a % b){
        a = b;
        b = r;
    }
    return b;
}

void Integer_factorization(long long int b,long long int n){
    long long int a = 2;
    long long int count = 0;
    long long int ans = 1;
    long long int ndash = n;
    if(b == 1) cout << n << endl;
    else{
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }

    cout<<  ans << endl;
    }
}

ll r_fuct[2000];
ll fuct[2000];

//MOD逆元
void conb(ll n,ll k){
    fuct[0] = 1;
    for(int i = 1;i < k+1;i++){
        fuct[i] *= fuct[i-1]%MOD;
        
        ll b = MOD, u = 1, v = 0;
        ll value = fuct[i];
        while (b) {
            ll t = value / b;
            value -= t * b;
            swap(value, b);
            u -= t * v;
            swap(u, v);
        }
        u %= MOD;
        if (u < 0) u += MOD;
        r_fuct[i] = u;
    }
}

void solve() {
    ll n,q;
    cin >> n >> q;
    string s;
    cin >> s;
    ll r[q],l[q];
    for(int i = 0;i < q;i++){
        cin >> r[i] >> l[i];
        r[i]--;
        l[i]--;
    }
    ll right[n];
    for(int i = 0;i < n;i++){
        right[i] = 0;
        
    }

    for(int i = 0;i < n-1;i++){
        if(s[i] == 'A' && s[i+1] == 'C') right[i+1]=right[i]+1;
        else right[i+1] = right[i];
    }

    for(int i = 0;i < q;i++){
        cout << right[l[i]] - right[r[i]] <<endl;
    }
}
int main() {

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

	solve();

	return 0;
}


Measured memory_bytes: 3408
n=int(input())
a=list(map(int,input().split()))

s=[0]*8
c=0
for ai in a:
    if ai<3200:
        s[ai//400]=1
    else:
        c+=1

ssum=sum(s)
smin=max(1,ssum)
smax=ssum+c
print(smin,smax)

Measured memory_bytes: 3064
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

#n,*ab = map(int,read().split())

cnt = 0

def ask(n):
    print(f"? {n}")
    sys.stdout.flush()
    return input() == "Y"
"""

def ask(n):
    global cnt
    cnt += 1
    print(f"? {n}, cnt = {cnt}")
    if n <= N:
        return str(n) <= str(N)
    else:
        return str(n) > str(N)
"""


def ans(n):
    print(f"! {n}")
    sys.stdout.flush()


N = 901234567

ok = 10
ng = 1
while ok-ng > 1:
    mid = (ok+ng)//2
    if ask(mid*10**15-1): ok = mid
    else: ng = mid
    #print(ok,ng)

v = top = ng # 先頭桁

for _ in range(9):
    ok = 10
    ng = 0
    while ok-ng > 1:
        mid = (ok+ng)//2
        
        r = 10*v+mid
        while r < 10**12: r *= 10
        r -= 1
        
        if ask(r): ok = mid
        else: ng = mid
        #print(ok,ng)
    v = v*10+ng

#print(v,"vvv")
        
while v%10==0:
    v //= 10


#print(v)

res = [ask(10**i) for i in range(10)]

if all(res):
    two = [ask(2*10**i) for i in range(10)]
    if all(two):
        ans(1)
    else:
        idx = two.index(True)
        ans(10**(idx))

else:
    idx = res.index(False) # 桁数
    while v < 10**(idx-1):
        v *= 10
    ans(v)    
    




Measured memory_bytes: 9192
#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 DEBUG
#ifdef DEBUG
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << '(' << p.first << ',' << p.second << ')';
    return os;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << '{';
    for(int i = 0; i < (int)v.size(); i++) {
        if(i) {
            os << ',';
        }
        os << v[i];
    }
    os << '}';
    return os;
}
void debugg() { cerr << endl; }
template <class T, class... Args>
void debugg(const T &x, const Args &... args) {
    cerr << " " << x;
    debugg(args...);
}
#define debug(...)                                                             \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]:", debugg(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

struct Setup {
    Setup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __Setup;

using ll = long long;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    string s;
    cin >> s;
    if(s.back() == 's') {
        cout << s << "es\n";
    } else {
        cout << s << "s\n";
    }
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);

char itoc(int i)
{
    if (i < 26)
        return i + 'a';
    if (i < 26 * 2)
        return i - 26 + 'A';
    return i - 26 * 2 + '0';
}

int ctoi(int c)
{
    if ('a' <= c && c <= 'z')
        return c - 'a';
    if ('A' <= c && c <= 'Z')
        return c - 'A' + 26;
    return c - '0' + 26 * 2;
}

int qq;
int qry(string s)
{
    ++qq;
    assert(qq <= 850);
    cout << "? " << s << endl;
    int ans;
    cin >> ans;
    return ans;
}

const int N = 128;
int n;
const int m = 62;

bool issub(string s)
{
    return (qry(s) == n - s.size());
}

int q[m];

string rec(int l, int r)
{
    if (l == r)
    {
        string s = "";
        for (int i = 0; i < q[l]; ++i)
            s += itoc(l);
        return s;
    }
    int m = (l + r) / 2;
    string a = rec(l, m);
    string b = rec(m + 1, r);
    string s = "";
    while (!a.empty() && !b.empty())
    {
        if (issub(s + a[0] + b))
        {
            s += a[0];
            a.erase(a.begin());
        }
        else
        {
            s += b[0];
            b.erase(b.begin());
        }
    }
    s += a;
    s += b;
    return s;
}

void solv()
{
    for (int i = 0; i < m; ++i)
    {
        string s = "";
        for (int j = 0; j < N; ++j)
            s += itoc(i);
        q[i] = N - qry(s);
    }
    for (int i = 0; i < m; ++i)
        n += q[i];
    string ans = rec(0, m - 1);
    cout << "! " << ans << endl;
}

int main()
{
    #ifdef SOMETHING
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


Measured memory_bytes: 3760
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long T,x,y;
	cin>>T;
	while(T--){
		cin>>x>>y;
		long long a=(long long)(sqrt(x*y));
		int ans=2*(int)(a)-1;
		if(a*a==x*y&&x!=y)--ans;
		if(a*(a+1)>=x*y)--ans;
		cout<<ans<<endl;
	}return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    a, b = LI()
    if b % a == 0:
        print(a+b)
        return
    print(b-a)


main()



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

using namespace std; 
#define REP(i, n) for (int i = 0; i < (n); i++)

typedef long long ll;
int main(int argc, char const *argv[])
{
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int N; cin >> N;
    string S; cin >> S;
    int cnt = 0;
    REP(i, N) {
        if (S[i] == 'A' && i < N - 2 && S[i+1] == 'B' && S[i+2] == 'C') cnt++; 
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) (a).size() 
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,n) for(int i=1;i<=n;i++)
#define ford(i,n) for(int i=n;i>=0;i--) 
#define REP(i,a,n) for(int i=a;i<n;i++)
#define foreach(itr,c) for(__typeof((c).begin(),(c).end())itr=c.begin();itr!=c.end();itr++) 
#define fill(a,b) memset(a,b,sizeof(a))
#define re return
#define INF 1e9
#define LINF 1e18
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi > vpi; 
int main(){
	int n;
	cin>>n;
	int d[n][2];
	rep(i,n){
		cin>>d[i][0]>>d[i][1];
	}
	bool f=0;
	for(int i=0;i+2<n;i++){
		if(d[i][0]==d[i][1]&&d[i+1][0]==d[i+1][1]&&d[i+2][0]==d[i+2][1]){
			cout<<"Yes";
			re 0;
		}
	}
	cout<<"No";
	re 0;
}

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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()

int main(){
    ll n, m;
    cin >> n >> m;
    vvll st(n, vll(n, 0));
    vll p(n, 0);

    rep(i, m){
        ll s, t;
        cin >> s >> t;
        st[s-1][t-1] = 1;
        ++p[s-1];
    }

    vector<double> e(n, 0);
    IREP(i, n-1, 0){
        double s = 0;
        ll count = 0;
        REP(j, i+1, n){
            if(st[i][j]==1){
                ++count;
                s += e[j]+1;
            }
        }
        e[i] = s/count;
    }
    vector<double> rp(n, 0);
    rp[0] = 1;
    REP(i, 1, n){
        rep(j, i){
            if(st[j][i]==1){
                rp[i] += rp[j]/p[j];
            }
        }
    }
    double res = e[0];
    rep(i, n){
        if(p[i]>=2){
            double t = 0;
            REP(j, i+1, n){
                if(st[i][j]==1){
                    t = max(t, e[j]+1);
                }
            }
            double ne = (e[i]*p[i]-t) / (p[i]-1);
            res = min(res, e[0]-(e[i]-ne)*rp[i]);
        }
    }
    cout << setprecision(20) << res << endl;
}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define F0R(i, N) for (long i = 0; i < (N); i++)

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;

    int c_LR = 0;
    int c_RL = 0;
    for (int i = 0; i < S.size() - 1; i++) {
        if ((S[i] == 'L') && (S[i + 1] == 'R')) {
            c_LR++;
        } else if ((S[i] == 'R') && (S[i + 1] == 'L')) {
            c_RL++;
        }
    }

    int c_happy = 0;
    for (int i = 0; i < S.size(); i++) {
        if (S[i] == 'L') {
            if (i == 0) {
                continue;
            } else {
                if (S[i - 1] == S[i]) {
                    c_happy++;
                }
            }
        } else {
            if (i == S.size() - 1) {
                continue;
            } else {
                if (S[i + 1] == S[i]) {
                    c_happy++;
                }
            }
        }
    }

    if (c_RL == c_LR) {
        cout << c_happy + min(min(c_LR, c_RL), K) * 2 << "\n";
    } else {
        int nanika = min(c_LR, c_RL);
        int amari = max(c_LR, c_RL) - nanika;
        if ((amari > 0) && (K > nanika)) {
            cout << c_happy + min(min(c_LR, c_RL), K) * 2 + 1 << "\n";
        } else {
            cout << c_happy + min(min(c_LR, c_RL), K) * 2 << "\n";
        }
    }

    return 0;
}


Measured memory_bytes: 512
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

vvi g;
int n, m;
vvi dp;

void dp_run(int va, int da, int ca) {
  if (dp[va][da] > 0) return;
  dp[va][da] = ca;
  if (da == 0) return;
  dp_run(va, da-1, ca);
  for (int u : g[va]) {
    dp_run(u, da-1, ca);
  }
}

int main() {
  scanf("%d%d", &n, &m);
  g.resize(n);
  rep (i, m) {
    int a, b;
    scanf("%d%d", &a, &b);
    a -= 1; b -= 1;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  dp.assign(n, vi(11, 0));
  int q;
  scanf("%d", &q);
  vi v(q), d(q), c(q);
  rep (i, q) {
    scanf("%d%d%d", &v[i], &d[i], &c[i]);
    v[i] -= 1;
  }

  reverse(all(v));
  reverse(all(d));
  reverse(all(c));

  rep (i, q) {
    dp_run(v[i], d[i], c[i]);
  }
  rep (i, n) {
    printf("%d\n", dp[i][0]);
  }

  return 0;
}


Measured memory_bytes: 16248
#include <bits/stdc++.h>
#define ll long long
using namespace std;
char s[10];
int main() {
    //freopen("in.txt","r",stdin);
    scanf("%s",s);
    if(s[2]==s[3]&&s[4]==s[5]) printf("Yes\n");
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S;
const ll MOD = 998244353;
//const ll MOD = (1e+9) + 7;
const ll INF = 1LL<<60;
typedef pair<ll, ll> P;

int main() {
    cin>>S;
    cout<<(S[2] == S[3] && S[4] == S[5] ? "Yes" : "No")<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define PRINT(x) cout<<(x)<<endl
#define INF 1000000000000 // 10^12
#define MOD 1000000007 // 10^9+7
#define PB push_back
#define MP make_pair

int N;

int main() {
    cin >> N;
    int a = N % 1000;
    if (a == 0) PRINT(0);
    else PRINT(1000-a);
    return 0;
}

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

#define INF_LL (int64)1e18
//#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

class UnionFind{
private:
    ::std::vector<int_fast32_t> par, edge;
    size_t n;

public:
    UnionFind(){}
    UnionFind(size_t n):n(n){
        par.resize(n, -1);
        edge.resize(n, 0);
    }

    uint_fast32_t find(uint_fast32_t x){
        return par[x] < 0 ? x : par[x] = find(par[x]);
    }

    size_t size(uint_fast32_t x){
        return -par[find(x)];
    }

    bool unite(uint_fast32_t x, uint_fast32_t y){
        x = find(x);
        y = find(y);
        edge[x] += 1;
        if(x == y) return false;
        if(size(x) < size(y)) std::swap(x, y);
        par[x] += par[y];
        edge[x] += edge[y];
        par[y] = x;
        return true;
    }

    bool same(uint_fast32_t x, uint_fast32_t y){
        return find(x) == find(y);
    }

    size_t esize(uint_fast32_t x) {
        return edge[find(x)];
    }
};

int main(void) {
    int64 P, Q, R;
    cin >> P >> Q >> R;
    cout << P+Q+R-max({P, Q, R}) << endl;
}


Measured memory_bytes: 256
def main():

    N = int(input())
    K = int(input())
    S = str(N)

    if K == 1:
        v = (len(S) - 1) * 9
        v += int(S[0])
        return v
    if K == 2:
        v = (len(S)-1) * (len(S)-2) * 9 * 9 // 2
        v += (int(S[0]) - 1) * 9 * (len(S)-1)
        u = int(S[0]) * pow(10, len(S)-1)
        for j in range(len(S)-1):
            for k in range(1, 10):
                if u + k * pow(10, j) <= N:
                    v += 1
        return v
    if K == 3:
        v = (len(S)-1) * (len(S)-2) * (len(S)-3) * 9 * 9 * 9 // 6
        v += (int(S[0]) - 1) * 9 *9 * (len(S)-1) * (len(S)-2) // 2
        u = int(S[0]) * pow(10 ,len(S)-1)
        ps = [1]
        for i in range(len(S)+1):
            ps.append(ps[-1] * 10)
        for j1 in range(len(S)-1):
            for j2 in range(j1):
                for k1 in range(1, 10):
                    for k2 in range(1, 10):
                        if u + k1 * ps[j1] + k2 * ps[j2] <= N:
                            v += 1
        return v


if __name__ == '__main__':
    print(main())

Measured memory_bytes: 41452
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main(){
	int n;cin>>n;
	double ans=0;
	rep(i,n){
		double x;string u;cin>>x>>u;
		if(u=="JPY")ans+=x;
		else ans+=x*380000;
	}
	printf("%.12lf\n",ans);
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){

    
    int h,w;
    cin>>h>>w;
    char s[h][w];
    rep(i,h){rep(j,w){cin>>s[i][j];}}
    bool he[h],we[w];
    
    
    
    rep(i,h){
        int a=0;
        rep(j,w){
            if(s[i][j]=='.'){
                a++;
            }
        }
        if(a==w){he[i]=false;
        }else{he[i]=true;}
    }
    
    rep(i,w){
        int a=0;
        rep(j,h){
            if(s[j][i]=='.'){
                a++;
            }
        }
        if(a==h){we[i]=false;
        }else{
            we[i]=true;
        }
    }

    
    
     rep(i,h){
         bool f=0;
         rep(j,w){
         if(he[i]==true&&we[j]==true){
             cout<<s[i][j];
             f=1;
         }
     }
         if(f==1)cout<<endl;
     }

return 0;
}


Measured memory_bytes: 256
/**
 *    author:  Mohamad Milhem
 *    created: 2020-03-07-14.07.07
**/

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

using namespace std;
typedef long long ll;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define MOD ll(1000000007)
#define debug(x) cout << '[' << #x << " is: " << x << "] " <<endl;
#define decimalpoint cout << std::fixed << setprecision(5)


int main(){

    FAST;

    long long a,b;
    cin >> a >> b;

    long double first = (a / 0.08);
    long double second = (b / 0.1);

    long long be = floor(first);
    for (long long i = max(1LL,be - 1000) ; i  < be + 1000 ; i++){

    first = floor(i * 0.08);
    second = floor(i *  0.1);
    if ((first == a)&&(second == b)){cout << i <<endl; return 0;}

    }

    cout << -1 <<endl;
    return 0;
}


Measured memory_bytes: 256
def calcTotalOfRowAndCol(matrix, r, c):
    for l in matrix:
        total = 0
        for val in l:
            total += val
        l.append(total)
    matrix.append([])
    for i in range(c + 1):
        total = 0
        j = 0
        while j < r:
            total += matrix[j][i]
            j += 1
        matrix[r].insert(i, total)

    return matrix


if __name__ == '__main__':
    matrix = []
    row, col = [int(x) for x in input().split()]
    i = row
    while i > 0:
        matrix.append([int(y) for y in input().split()])
        i -= 1
    matrix2 = calcTotalOfRowAndCol(matrix, row, col)
    for l in matrix:
        print(' '.join(str(x) for x in l))

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

int main(){
    int n;
    string s,t;
    cin>>n>>s>>t;
    int cnt=n;
    for(int i=0; i<n; ++i){
        if(t.substr(0,i+1)==s.substr(n-i-1,i+1))cnt=n-i-1;
    }
    cout<<n+cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
ll dp[103][1800][103] = {},mod = 1000000007,mx[103] = {},sum[103][1800] = {},s[103] = {};
ll pw(ll a, ll x){
	ll ret = 1;
	while(x){
		while(!(x&1)){
			(a *= a) %= mod;
			x /= 2;
		}
		x--;
		(ret *= a) %= mod;
	}
	return ret;
}

int main(){
	ll i,j,x,n,k;
	cin >> n >> k;
	for(i=n;i>=1;i--){
		s[i] = s[i+1];
		mx[i] = s[i]/i;
		if(i<=k) mx[i]++;
		s[i] += mx[i];
	}
	for(i=0;i<=k;i++){
		for(j=0;j<=s[2];j++){
			if(i<=1 && j + i>=1) dp[1][j][i] = 0;
			else dp[1][j][i] = j + i;
			sum[1][j] += dp[1][j][i];
		}
	}
	for(i=2;i<=n;i++){
		for(j=0;j<=s[i+1];j++){
			for(x=0;x<=k;x++){
				if(x<=i) dp[i][j][x] = (sum[i-1][j+(j+x)/i] + (j + x)%i*pw(k+1,i-1))%mod;
				else dp[i][j][x] = (sum[i-1][j] + (j + x)*pw(k+1,i-1))%mod;
				(sum[i][j] += dp[i][j][x]) %= mod;
			}
		}
	}
	cout << sum[n][0] << endl;
}

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

using namespace std;
typedef pair<int,int> pii;
typedef long long int ll;

#define INF 1 << 30
#define REP(i,n) for(ll i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(ll i=(k);i<(int)(n);i++)




ll c[4][100001] = {{0}};
string s;
ll ans = 0;
ll mod = 1e9+7;

ll f(ll a, ll x){
  if(x<0) return 0ll;
  ll res = 1;
  a %= mod;
  while(x > 0){
    if(x&1) res = res * a % mod;
    a = a * a % mod;
    x >>= 1;
  }
  return res;
}


int main(){
  cin >> s;
  REP(i,s.size()){
    if(s[i]=='A') c[0][i]++;
    else if(s[i]=='B') c[1][i]++;
    else if(s[i]=='C') c[2][i]++;
    else c[3][i]++;
    REP(j,4) c[j][i+1] = c[j][i];
  }
  FOR(i,1,s.size()-1){
    if(s[i] == 'A' || s[i] == 'C') continue;
    ll a = c[0][i-1];
    ll d = c[2][s.size()]-c[2][i];
    ll a2 = c[3][i-1];
    ll c2 = c[3][s.size()]-c[3][i];
    ans += (a*d%mod)*(f(3,a2+c2)%mod)%mod;
    ans %= mod;
    ans += (a2*f(3,a2-1)%mod)*(d*f(3,c2)%mod)%mod;
    ans %= mod;
    ans += (c2*f(3,c2-1)%mod)*(a*f(3,a2)%mod)%mod;
    ans %= mod;
    ans += (a2*c2%mod)*(f(3,c2-1)*f(3,a2-1)%mod)%mod;
    ans %= mod;
  }
  ans %= mod;
  cout << ans <<endl;
}


Measured memory_bytes: 3584
/**
 *     author: qodjf
 *     created: 06.03.2020 16:55:13
 */
#include <bits/stdc++.h>
using namespace std;

#define mst(x, a) memset(x, a, sizeof(x))
#define all(a) begin(a), end(a)
#define rep(i, begin, end)                            \
  for (__typeof(end) i = (begin) - ((begin) > (end)); \
       i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

using ll = long long;
constexpr ll MOD = 998244353;

inline ll add(ll a, ll b) { return (a + b) % MOD; }
inline ll mul(ll a, ll b) { return (a * b) % MOD; }
int N, S;
vector<int> A;
void solve() {
  vector<vector<int>> dp(N + 1, vector<int>(S + 10, 0));
  dp[0][0] = 1;
  for (int i = 1; i <= N; i++) {
    for (int s = 0; s <= S; s++) {
      dp[i][s] = add(mul(dp[i - 1][s], 2),
                     s >= A[i - 1] ? dp[i - 1][s - A[i - 1]] : 0);
    }
  }
  cout << dp[N][S] << endl;
}

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

  cin >> N >> S;
  A.resize(N);
  rep(i, 0, N) { cin >> A[i]; }
  solve();
}


Measured memory_bytes: 38580
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)

const ll MOD = (ll)1e9 + 7;
const ll HIGHINF = (ll)1e18;

struct Card {
  char suit, val;
};

V<Card> BubbleSort(V<Card> c) {
  REP(i, c.size()) {
    for (ll j=c.size()-1; j>i; j--) {
      if (c.at(j).val < c.at(j-1).val)
        swap(c.at(j), c.at(j-1));
    }
  }
  return c;
}

V<Card> SelectionSort(V<Card> c) {
  REP(i, c.size()) {
    ll mini = i;
    rep(j, i, c.size()) {
      if (c.at(j).val < c.at(mini).val) mini = j;
    }
    swap(c.at(i), c.at(mini));
  }
  return c;
}

int main() {
  ll n; cin >> n;
  V<Card> c1(n), c2(n);
  REP(i, n) cin >> c1.at(i).suit >> c1.at(i).val;
  REP(i, n) c2.at(i) = c1.at(i);
  c1 = BubbleSort(c1);
  c2 = SelectionSort(c2);
  cout << c1.at(0).suit << c1.at(0).val;
  rep(i, 1, n) cout << ' ' << c1.at(i).suit << c1.at(i).val;
  cout << endl;
  cout << "Stable" << endl;
  cout << c2.at(0).suit << c2.at(0).val;
  rep(i, 1, n) cout << ' ' << c2.at(i).suit << c2.at(i).val;
  cout << endl;
  bool is_stable = true;
  REP(i, n) if (c1.at(i).suit != c2.at(i).suit || c1.at(i).val != c2.at(i).val) {
    is_stable = false; break;
  }
  if (is_stable) cout << "Stable" << endl;
  else cout << "Not stable" << endl;
  return 0;
}



Measured memory_bytes: 3152
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int t,n,i,j,mmax;
	int a[11];
	cin>>t;
	while(t--) {
		for(i=1;i<=10;i++) cin>>a[i];
		mmax=a[1];
		a[1]=-1;
		for(i=2;i<=10;i++) {
			if(a[i]>mmax) {
				mmax=a[i];
				a[i]=-1;
			}
		}
		mmax=-1;
		for(i=1;i<=10;i++) {
			if(a[i]==-1) continue;
			if(a[i]<mmax) break;
			mmax=a[i];
		}
		if(i==11) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 2952
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"
using Weight = long long int;
struct Edge {
	int src, dst;
	Weight weight;
	int tate;
	Edge(int src_, int dst_, Weight weight_,bool a) :
		src(src_), dst(dst_), weight(weight_),tate(a) { }
	Edge(int src, int dst, Weight weight) :
		src(src), dst(dst), weight(weight) { }
	Edge() :src(0), dst(0), weight(0) {

	}
};
struct Node {
	int x;
	int y;
	int id;
};
struct aa {
	int id;
	int tate;
	Weight time;
};
class Compare {
public:
	//aa?????????????????¶
	bool operator()(const aa&l, const aa&r) {
		return l.time> r.time;
	}
};
Weight getans(vector<vector<Edge>>&g, const bool startswitch,int s,int t) {
	priority_queue<aa,vector<aa>,Compare>que;
	que.push(aa{ 0,true,0 });
	if (startswitch) {
		que.push(aa{ 0,false,1 });
	}
	vector<vector<Weight>>memo(g.size(), vector<Weight>(2,1e18));

	while (!que.empty()) {
		aa atop(que.top());
		if (atop.id == t)return atop.time;
		que.pop();
		if (atop.id) {
			if (memo[atop.id][!atop.tate]>atop.time+1) {
				memo[atop.id][!atop.tate] = atop.time + 1;
				que.push(aa{ atop.id,!atop.tate,atop.time + 1 });
			}
		}
		for (auto e : g[atop.id]) {
			if (e.tate != atop.tate)continue;
			const Weight nexttime = atop.time + e.weight;
			if (memo[e.dst][e.tate] > nexttime) {
				memo[e.dst][e.tate] = nexttime;
				que.push(aa{ e.dst,e.tate,nexttime });
			}
		}
	}
	return -1;
}
int main() {
	int M, N, K; cin >> M >> N >> K;
	vector<Node>ps;
	bool startswitch = false;
	int id = 0;
	ps.push_back(Node{ 0,0,id++ });
	for (int i = 0; i < K; ++i) {
		int x, y; cin >> x >> y; x--; y--;
		if (x == 0 && y == 0) {
			startswitch = true;
		}
		else if (x == M-1&&y == N-1) {

		}
		else {
			ps.push_back(Node{ x,y,id++ });
		}
	}
	ps.push_back(Node{ M-1,N-1,id });
	vector<vector<Edge>>g(K + 2);
	sort(ps.begin(), ps.end(), [](const Node&l, const Node&r) {
		return l.x == r.x ? l.y < r.y : l.x < r.x;
	});
	for (int i = 0; i < ps.size() - 1; ++i) {
		Node l = ps[i];
		Node r = ps[i + 1];
		if (l.x == r.x) {
			Weight dis = abs(r.y - l.y); 
			g[l.id].push_back(Edge(l.id, r.id, dis, true));
			g[r.id].push_back(Edge(r.id, l.id, dis, true));
		}
	}
	sort(ps.begin(), ps.end(), [](const Node&l, const Node&r) {
		return l.y == r.y ? l.x < r.x : l.y < r.y;
	});
	for (int i = 0; i < ps.size() - 1; ++i) {
		Node l = ps[i];
		Node r = ps[i + 1];
		if (l.y == r.y) {
			Weight dis = abs(r.x - l.x);
			g[l.id].push_back(Edge(l.id, r.id, dis, false));
			g[r.id].push_back(Edge(r.id, l.id, dis, false));
		}
	}
	long long int ans = getans(g,startswitch,0,id);
	cout << ans << endl;
	
	return 0;
}

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

const int N = 305, M = 998244353;

int n, m, c;
bitset<N> b[N];

int f(int x){
    int r = 1;
    for(; x--; ) r = r * 2 % M;
    return r;
}

int main(){
    scanf("%d%d", &n, &m);
    for(int i = 0; i < n; i++){
        for(int j = 0, x; j < m; j++){
            scanf("%d", &x);
            b[i][j] = x;
        }
    }
    for(int i = 0; i < m; i++){
        int k = -1;
        for(int j = c; j < n; j++) if(b[j][i]){ k = j; break; }
        if(k < 0) continue;
        swap(b[c], b[k]);
        for(int j = c + 1; j < n; j++) if(b[j][i]) b[j] ^= b[c];
        c++;
    }
    printf("%lld\n", 1LL * f(n + m - 1 - c) * (f(c) + M - 1) % M);
}

Measured memory_bytes: 256
object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val N = sc.nextInt()
    // 素数を N個 選んで, この選んだ素数のうち, 5個を選ぶと
    // どれでもその合計が合計数になるようなもの

    // まず, 候補となる素数は √55555 個以下なので, たった235個しかない
    // 全探索系だと非現実的っぽいので, 法則を探す
    // 必ず存在する..
    // 逆にどれか合わせたら素数になるケース...?

    // 回答を見ると, 5n + 1 で表せる数かつ素数を列挙する.
    // 対象の素数を全列挙, 5n + 1 で表せる数 を N 個取り出す

    def eratosthenes(n: Int): Seq[Int] = {
      val upper = Math.sqrt(n)
      def loop(lst: List[Int], used: List[Int]): List[Int] =
        if (lst.head < upper) {
          loop(lst.tail.filter(_ % lst.head != 0), lst.head :: used)
        } else used.reverse ++ lst
      loop((2 to n).toList, Nil)
    }

    def solve(N: Int): List[Int] = {
      eratosthenes(55555).filter(_ % 5 == 1).take(N).toList
    }

    println(solve(N).mkString(" "))
  }

}


Measured memory_bytes: 38336
K, N = [int(i) for i in input().split(" ")]
A = [int(i) for i in input().split(" ")]
diff = []

sum_num = 0
max_num = 0
tmp = K - A[-1] + A[0]
max_num = tmp
sum_num += tmp
diff.append(tmp)
for i in range(N - 1):
    tmp = A[i + 1] - A[i]
    diff.append(tmp)
    if tmp >= max_num:
        max_num =tmp
    sum_num += tmp

ans = sum_num - max_num
print(ans)

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

#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(x) (ll) __builtin_popcount(x);1
#define fs first
#define sc second
#define pb push_back
#define po pop_back
#define mp make_pair	
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

using namespace std;
typedef long long ll;
typedef long double ld;	
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
	 
const ll MAX = 10000000;
const ll inf = 5e18-1;
	

int main() {
	fastio;
	ll x;
	cin>>x;
	ll m=100;
	ll k=0;
	while(m<x){
		k++;	
		m=m+(m/100);
	}
	cout<<k<<endl;
	return 0;
	}

Measured memory_bytes: 3640
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		ArrayList<Integer>a = new ArrayList<>();
		int mc=0;
		int zc=0;
		int mmin = Integer.MAX_VALUE;
		int mi = -1;
		for(int i=0; i<n; i++) {
			int v=sc.nextInt();
			a.add(v);
			if(v<0) {
				mc++;
			}
			if(Math.abs(v)<mmin) {
				mmin = Math.abs(v);
				mi = i;
			}
			if(v==0) {
				zc++;
			}
		}
		long sum=0;

		for(int i=0; i<n; i++) {
			if((mc % 2 != 0 && zc == 0) && i == mi) {
				sum -= Math.abs(a.get(i));
			}else {
				sum += Math.abs(a.get(i));
			}
		}

		System.out.println(sum);
		sc.close();
	}

}


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

int main (){
  int W, H, N;
  cin >> W >> H >> N;
  int x[N];
  int y[N];
  int a[N];
  for (int i = 0; i < N; i ++){
    cin >> x[i] >> y[i] >> a[i];
  }
  
  int left = 0, right = W, top = H, bottom = 0;
  
  for (int i = 0; i < N; i ++){
    switch (a[i]){
      case 1:
        if (x[i] > left) {
          left = x[i];
        }
        break;
      case 2:
        if (x[i] < right) {
          right = x[i];
        }
        break;
      case 3:
        if (y[i] > bottom) {
          bottom = y[i];
        }
        break;
      case 4:
        if (y[i] < top) {
          top = y[i];
        }
        break;
    }
  }
  if (right < left || top < bottom){
    cout << 0 <<  '\n';
  } else {
    cout << (right - left) * (top - bottom) << '\n';
  }
}

Measured memory_bytes: 3148
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
from decimal import Decimal
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
co = dict()
g = [[] for _ in range(n)]
cost = [-1] * n
for i in range(n-1):
    a,b,c = inpl()
    a -= 1; b -= 1
    g[a] += [b]; g[b] += [a]
    co[(a,b)] = c; co[(b,a)] = c
Q,k = inpl()
k -= 1; cost[k] = 0
q = deque()
q.append(k)
while q:
    nv = q.popleft()
    for v in g[nv]:
        if cost[v] > 0:
            continue
        cost[v] = cost[nv] + co[(v,nv)]
        q.append(v)
for _ in range(Q):
    a,b = inpl()
    a -= 1; b -= 1
    print(cost[a] + cost[b])

Measured memory_bytes: 123804
n = int(input())
list_a = list(map(int, input().split()))
list_a.insert(0, 0)
list_a.append(0)

sum_price = 0
list_diff = []
pre = abs(list_a[1] - list_a[0])
for i in range(1, n+1):
  sum_price += pre
  temp = abs(list_a[i+1] - list_a[i])
  list_diff.append(abs(list_a[i+1] - list_a[i-1]) - (temp + pre))
  pre = temp
sum_price += pre

for one_diff in list_diff:
  print(sum_price + one_diff)

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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#ifdef _DEBUG_
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl
#else
#define dump(val)
#endif

using namespace std;

typedef long long int ll;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}
template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a, p;
    cin >> a >> p;
    p += a * 3;
    cout << p / 2 << endl;
    return 0;
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const ll MAX = 1000000;
static const ll INFTY = 1e12;

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;
// 入力
int H, W;
vector<vector<char>> field;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// 深さ優先探索
vector<bool> seen;
vector<int> colors;


int main() {

    int K, X;
    cin >> K >> X;
    
    if(500 * K >= X)cout << "Yes" << endl;
    else cout << "No" << endl;
    
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


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

using namespace std;

int n;
vector<vector<int>> g;

int dfs(int r) {

    vector<int> v;

    for (int to : g[r]) {
        int t = dfs(to);
        v.push_back(t);
    }
    
    sort(v.begin(), v.end(), greater<>());

    int ret = 0;

    for (int i = 0; i < (int)v.size(); i++) {
        ret = max(ret, v[i] + i + 1);
    }

    return ret;
}

int main() {
    cin >> n;

    g.resize(n);

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

        g[a - 1].push_back(i + 1);
    }

    cout << dfs(0) << endl;
}


Measured memory_bytes: 16640
#include<stdio.h>
int main()
{
  int a,b;
  char op;
  while(1){scanf("%d %c %d",&a,&op,&b);
    if(op=='+'){printf("%d\n",a+b);
  }else if(op=='-'){printf("%d\n",a-b);
  }else if(op=='*'){printf("%d\n",a*b);
  }else if(op=='/'){printf("%d\n",a/b);
    }else if(op=='?'){break;}
  }
  return 0;
  }

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

typedef long long ll;

inline int read() {
	int x = 0, f = 1;
	char ch = getchar();
	for(; !isdigit(ch); ch = getchar()) if(ch=='-') f=-1;
	for(; isdigit(ch); ch = getchar()) x = (x*10)+(ch^48);
	return x * f;
}

char s[20];
int ans, n;

int main() {
	scanf("%s", s);
	n = strlen(s);
	int cur = 0, i;
	for(i = 0; i < n; i++) {
		if(s[i] != '0') {
			ans = max(ans, cur+s[i]-'0'-1+9*(n-i-1));
		}
		cur += s[i]-'0';
	}
	ans = max(ans, cur);
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  int n;
  int w[105];
  int sum1,sum2,sa,minsum = 100000007;
  cin >> n;
  for(int i=0; i<n; i++) cin >> w[i];

  for(int i=0; i<n; i++){
    sum1 = 0;
    sum2 = 0;
    for(int j=0; j<i; j++){
      sum1 += w[j];
    }
    for(int j=i; j<n; j++){
      sum2 += w[j];
    }
    sa = abs(sum1 - sum2);
    if(sa < minsum) minsum = sa;
  }

  cout << minsum << endl;
  return 0;
}


Measured memory_bytes: 256
s=list(input())
t=list(input())
for i in range(len(s)+1):
  if s == t:
    print("Yes")
    break
  else:
    k = s[0]
    for i in range(len(s)-1):
      s[i]=s[i+1]
    s[-1] = k
else:
  print("No")

Measured memory_bytes: 3060
#include<stdio.h>

static const int N = 1000;

void trace(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

int main(){
  int n, i, j, key;
  int A[N+1];
  scanf("%d", &n);

  for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);
  
  trace(A, n);

  for(j=2; j<=n; j++)
    {
      key = A[j];
      i = j - 1;
      while(i>0 && A[i]>key)
	{
	  A[i+1] = A[i];
	  i = i - 1;
	}
	  A[i+1] = key;
	  trace(A, n);
    }

  return 0;
}

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

#define F first
#define S second
#define prev azaza
#define MP make_pair
#define PB push_back

using namespace std;
typedef long long ll;
typedef long double ld;

const int max_n = 1000111, max_log = 22, inf = 1000111222;

int p2[max_log];

vector<pair<pair<int, int>, int>> ans;
int ed[max_n];

int main()
{
    //freopen("input.txt", "r", stdin);
    int L;
    cin >> L;
    p2[0] = 1;
    for (int i = 1; i < max_log; ++i) {
        p2[i] = p2[i - 1] * 2;
    }
    int n = 0;
    for (int i = 0; i < max_log; ++i) {
        if (p2[i] <= L) {
            n = i;
        }
    }
    for (int i = 0; i < n; ++i) {
        ans.push_back(MP(MP(i, i + 1), p2[n - i - 1]));
        ans.push_back(MP(MP(i, i + 1), 0));
        ed[i] = p2[n - i - 1];
    }
    L -= p2[n];
    ll have = p2[n];
    while (L > 0) {
        int mp = 0;
        for (int i = 0; i < max_log; ++i) {
            if (p2[i] <= L) {
                mp = i;
            }
        }
        if (mp == 0) {
            ans.push_back(MP(MP(0, n), have));
        } else {
            for (int i = 0; i < n; ++i) {
                if (ed[i] == p2[mp - 1]) {
                    ans.push_back(MP(MP(0, i), have));
                }
            }
        }
        have += p2[mp];
        L -= p2[mp];
    }
    cout << n + 1 << ' ' << ans.size() << endl;
    for (auto p : ans) {
        cout << p.F.F + 1 << ' ' << p.F.S + 1 << ' ' << p.S << endl;
    }
    return 0;
}




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

int main(){
/*
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;
    bool left, right, top, bottom;

    if(x - r >= 0) left = true;
    if(x + r <= w) right = true;
    if(y - r >= 0) bottom = true;
    if(y + r <= h) top = true;

    if(left && right && bottom && top)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
*/
    //cout << ((left && right && bottom && top) ? "Yes" : "No") << endl;

    int W,H,x,y,r; cin>>W>>H>>x>>y>>r;
    bool f=true;
    if(x-r<0) f=false;
    if(x+r>W) f=false;
    if(y-r<0) f=false;
    if(y+r>H) f=false;
    if(f) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    
    
}




Measured memory_bytes: 3092
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        int ans = 0;

        for (int i=0; i<3; i++) {
            ans += (s % 10);
            s /= 10;
        }

        System.out.printf("%d\n", ans);
    }
}

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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
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; }
typedef long long ll;

const long long INF = 1LL << 60;

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

    vector<ll> H(N), res(N, 0);
    rep(i, N) {
        cin >> H[i];
    }

    for (int i = N - 2; i >= 0; i--) {
        if (H[i + 1] <= H[i]) res[i] = res[i + 1] + 1;
    }

    sort(res.begin(), res.end());

    cout << res[N - 1] << endl;
    return 0;
}

Measured memory_bytes: 1792