akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define ipr pair<int, int>
#define pb push_back
#define ff first
#define ss second
#define fr(i, j, k) for (int i = j; i < k; i++)
#define rf(i, j, k) for (int i = j; i >= k; i--)
#define int long long
#define ll unsigned long long
#define ld long double
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define mp make_pair
#define inf 1000000000000000000
#define cnt_ones(x) __builtin_popcountll(x)

#define IOS                           \
	std::ios::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL);

const int Maxn = 250001;
const ld pi = acos(-1);
const int mod = 998244353;

template <class T>
ostream &operator<<(ostream &out, vector<T> &A)
{
	for (auto x : A)
		out << x << " ";
	return out;
}


int32_t main(){IOS
	int n,x,y;	cin>>n>>x>>y;
	vector<int> ans(n,0);
	fr(i,1,n+1)	fr(j,i+1,n+1){
		int mindis = min(abs(j-i),abs(x-i)+abs(y-j)+1);
		ans[mindis]++;
		//cout << mindis << endl;
	}
	fr(i,1,n)	cout << ans[i] << '\n';
	return 0;
}


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

int main()
{
    int num;
    std::cin >> num;
    std::vector<int> v;
    for(int i = 0; i < num; ++i){
        int val;
        std::cin >> val;
        v.push_back(val);
    }

    int count = 0;
    for(int i = 0; i < num; ++i){
        int mini = i;
        for(int j = i+1; j < num; ++j){
            if(v[j] < v[mini]){
                mini = j;
            }
        }
        if(i == mini) continue;
        count++;
        int tmp = v[i];
        v[i] = v[mini];
        v[mini] = tmp;
    }

    std::cout << v[0];
    for(int i = 1; i < num; i++){
        std::cout << ' ' << v[i];
    }
    std::cout << std::endl;

    std::cout << count << std::endl;

    return 0;
}



Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,x;
  x=0;
  cin >> N;
  
  for (int i =0;i<N;i++){
  int l,r,a;
  
  cin>>l>>r;
  a=r-l+1;
    x+=a;
 
  }
  cout<<x<<endl;
}

Measured memory_bytes: 256
#[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" ) } ; }
#[allow(unused_macros)]
macro_rules ! input_inner {($ next : expr ) => {} ; ($ next : expr , ) => {} ; ($ next : expr , $ var : ident : $ t : tt $ ($ r : tt ) * ) => {let $ var = read_value ! ($ next , $ t ) ; input_inner ! {$ next $ ($ r ) * } } ; }
#[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 (std :: io :: BufReader :: new (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 ) * } } ; }

fn solve(v: &[i32]) {
    for s1 in 0..2 {
        let op1 = if s1 == 1 {
            "+"
        } else {
            "-"
        };
        for s2 in 0..2 {
            let op2 = if s2 == 1 {
                "+"
            } else {
                "-"
            };
            for s3 in 0..2 {
                let op3 = if s3 == 1 {
                    "+"
                } else {
                    "-"
                };
                if v[0] + (2 * s1 - 1) * v[1] + (2 * s2 - 1) * v[2] + (2 * s3 - 1) * v[3] == 7 {
                    println!("{}{}{}{}{}{}{}=7", v[0], op1, v[1], op2, v[2], op3, v[3]);
                    return;
                }
            }
        }
    }
}

fn main() {
    input! {
        abcd: String,
    }
    let v: Vec<i32> = abcd.chars().map(|c| c.to_digit(10).unwrap() as i32).collect();
    solve(&v);
}


Measured memory_bytes: 2096
#include <stdio.h>
#include <vector>
#include <algorithm>
#define pb push_back
using namespace std;

const int MAX_H = 105;

char mat[MAX_H][MAX_H];
int freq[26];
int has[10];
vector <int> v;


int main(void) {
    int h, w;
    bool ok = true;

    scanf(" %d %d", &h, &w);
    for (int i = 0; i < h; i++) {
        scanf(" %s", mat[i]);
        for (int j = 0; j < w; j++) {
            int idx = mat[i][j] - 'a';
            freq[idx]++;
        }
    }

    for (int i = 0; i < 26; i++) {
        for (int j = 4; j >= 1; j /= 2) {
            has[j] += freq[i] / j;
            freq[i] -= (freq[i] / j) * j;
        }
    }




    for (int i = 0, p = h - 1; i <= p; i++, p--) {
        for (int j = 0, k = w - 1; j <= k; j++, k--) {
            int need = 4;
            if (i == p) {
                need /= 2;
            }
            if (j == k) {
                need /= 2;
            }
            v.pb(need);
        }
    }

    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());

    for (int i = 0; i < (int)v.size(); i++) {
        int need = v[i];
        has[need] += 2 * has[need * 2];
        has[need * 2] = 0;
        if (has[need] > 0) {
            has[need]--;
        } else {
            ok = false;
        }
    }

    if (ok) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 256
private fun readStrings() = readLine()!!.split(" ")
private fun readInts() = readStrings().map { it.toInt() }

fun getCost(a: Int, b: Int) = Math.abs(a - b)
fun Pair<Int, Int>.getCost() = getCost(first, second)

fun computeMiddleOmitDiff(a: Int, b: Int, c: Int) = getCost(a, c) - (getCost(a, b) + getCost(b, c))

inline fun <T> T.also(block: (T) -> Unit): T { block(this); return this }

fun <T> List<T>.pairAdjacent() = when {
    isNotEmpty() -> {
        var prev = first()
        map { elem -> (prev to elem).also { prev = elem } }
    }
    else -> listOf()
}

fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val A = readInts()

    val paths = listOf(0) + A + listOf(0)
    val totalCost = paths.pairAdjacent().map { it.getCost() }.sum()

    (1 until N+1).forEach { index ->
        val (a, b, c) = listOf(index - 1, index, index + 1).map { paths[it] }
        println(totalCost + computeMiddleOmitDiff(a, b, c))
    }
}

Measured memory_bytes: 61888
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<cstdlib>
using namespace std;
#define REP(i,a,n) for(int i = a ; i < n ; i++)
#define rep(i,n) REP(i,0,n)

typedef long long ll;

void solve(){
}

int main(){
  char now = 'A';
  char a,b,ch;
  while(cin>>a>>ch>>b){
    if(a == now) now = b;
    else if(b == now) now = a;
  }
  cout<<now<<endl;
}

Measured memory_bytes: 0
#include<iostream>

int main(void){
	int n, min = 1000000, max = -1000000;
	long long sum = 0;
	
	std::cin >> n;
	if (n == 0) return 0;
	
	for (int i = 0; i < n; i++){
		int x;
		std::cin >> x;
		sum = sum + x;
		if (min > x) min = x;
		if (max < x) max = x;
	}
	
	std::cout << min << " " << max << " " <<  sum << std::endl;
	
	return 0;
}

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

int main()
{
	int A, P;
	cin >> A >> P;
	int count;
	count = (A * 3 + P) / 2;
	cout << count;
	return 0;
}


Measured memory_bytes: 256
n, m = map(int,input().split())
if n == 1 and m == 1:
    print(1)
elif n == 1 and m == 2:
    print(0)
elif n == 2 and m == 1:
    print(0)
elif n == 1:
    print(m-2)
elif m == 1:
    print(n-2)
elif n == 2 or m == 2:
    print(0)
else:
    print((m-2)*(n-2))

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N, C[200000], DP[200001], c[200000], d[200000];

int main() {
	cin >> N;
	for (int i = 0; i != N; ++i) {
		cin >> C[i];
		--C[i];
	}
	for (int i = 0; i < 200000; ++i) {
		c[i] = intmax;
	}
	for (int i = N - 1; i >= 0; --i) {
		d[i] = c[C[i]];
		c[C[i]] = i;
	}
	DP[0] = 1;
	for (int i = 0; i != N; ++i) {
		if (d[i] != i + 1 && d[i] != intmax) {
			DP[d[i]] = (DP[d[i]] + DP[i]) % mod;
		}
		DP[i + 1] = (DP[i + 1] + DP[i]) % mod;
	}
	cout << DP[N] << endl;
	return 0;
}

Measured memory_bytes: 3328
N = int(input())
vlist = list(map(int, input().split()))
odd, even = vlist[1::2], vlist[::2]
from collections import Counter
odd_c, even_c = Counter(odd).most_common(2), Counter(even).most_common(2)
# print(odd_c, even_c)
if odd_c[0][0] != even_c[0][0]:
    print(N - odd_c[0][1] - even_c[0][1])
else:
    if len(odd_c) >= 2 and len(even_c) >= 2:
        if odd_c[0][1] > even_c[0][1]:
            print(N - odd_c[0][1] - even_c[1][1])
        elif odd_c[0][1] < even_c[0][1]:
            print(N - odd_c[1][1] - even_c[0][1])
        else:
            print(N - odd_c[0][1] - max(odd_c[1][1], even_c[1][1]))
    else:
        if len(odd_c) == 1 and len(even_c) == 1:
            if odd_c[0][0] == even_c[0][0]:
                print(N - max(odd_c[0][1], even_c[0][1]))
        elif len(odd_c) == 1:
            if odd_c[0][0] != even_c[0][0]:
                print(N - odd_c[0][1] - even_c[0][1])
            else:
                if odd_c[0][1] > even_c[0][1]:
                    print(N - odd_c[0][1] - even_c[1][1])
                else:
                    print(N - even_c[0][1])
        elif len(even_c) == 1:
            if odd_c[0][0] != even_c[0][0]:
                print(N - odd_c[0][1] - even_c[0][1])
            else:
                if odd_c[0][1] < even_c[0][1]:
                    print(N - odd_c[1][1] - even_c[0][1])
                else:
                    print(N - odd_c[0][1])


Measured memory_bytes: 15972
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
  cin >>n;
  int l[2*n];
  for (int i=0;i<2*n;i++)cin >> l[i];
  sort(l,l+2*n);
  int ans=0;
  for (int i=0;i<2*n;i+=2)ans+=l[i];
  cout << ans <<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;

using namespace std;


const long long MOD = 1000000007;

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

	int n, m;
	cin >> n >> m;
	int* food;
	food = new int[m];
	memset(food, 0, sizeof(int)*m);

	rep(i, n) {
		int k;
		cin >> k;
		rep(j, k) {
			int a;
			cin >> a;
			++food[a - 1];
		}
	}

	int ans = 0;
	rep(i, m) if (food[i] == n) ++ans;

	cout << ans << "\n";

	return 0;
}


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

const int MAXN = 110;
const int MAXP = MAXN;
const int MAXM = MAXN * MAXN * 5;
typedef long long LL;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
int head[MAXP], nxt[MAXM], to[MAXM], tot = 1;
LL val[MAXM];
void addedge(int b, int e, LL v) {
	nxt[++tot] = head[b]; to[head[b] = tot] = e; val[tot] = v;
	nxt[++tot] = head[e]; to[head[e] = tot] = b; val[tot] = 0;
}
std::queue<int> q;
int dis[MAXP];
int S, T, idx;
bool bfs() {
	memset(dis, 0, idx + 1 << 2);
	q.push(S); dis[S] = 1;
	while (!q.empty()) {
		int t = q.front(); q.pop();
		for (int i = head[t]; i; i = nxt[i])
			if (val[i] && !dis[to[i]]) {
				dis[to[i]] = dis[t] + 1;
				q.push(to[i]);
			}
	}
	return dis[T] > 0;
}
LL dinic(int u, LL minv) {
	if (u == T || !minv) return minv;
	LL t, res = 0;
	for (int & i = head[u]; i; i = nxt[i])
		if (val[i] && dis[to[i]] == dis[u] + 1 && (t = dinic(to[i], std::min(minv, val[i])))) {
			val[i] -= t;
			val[i ^ 1] += t;
			res += t;
			minv -= t;
			if (!minv) break;
		}
	if (!res) dis[u] = -1;
	return res;
}
LL flow() {
	static int es[MAXP];
	memcpy(es, head, idx + 1 << 2);
	LL res = 0;
	while (bfs()) {
		res += dinic(S, INFL);
		memcpy(head, es, idx + 1 << 2);
	}
	return res;
}

LL A[MAXN]; int n;
int main() {
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	std::cin >> n;
	LL ans = 0;
	for (int i = 1; i <= n; ++i)
		std::cin >> A[i], ans += A[i], A[i] = -A[i];
	for (int i = 1; i <= n; ++i)
		for (int j = i + 1; j <= n; ++j)
			if (j % i == 0)
				addedge(i, j, INFL);
	S = 0, T = idx = n + 1;
	for (int i = 1; i <= n; ++i) {
		if (A[i] >= 0) addedge(S, i, A[i]), ans += A[i];
		else addedge(i, T, -A[i]);
	}
	std::cout << ans - flow() << std::endl;
	return 0;
}


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

#define ll long long
#define ar array

int main() {

    ios::sync_with_stdio(false);
	
	int n;
	
	scanf("%d", &n);
	
	if (n%2==0){
		printf("%d\n", n);
	}
	else{
		printf("%d\n", n*2);
	}

    return 0;
}


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

using namespace std;

const int INF = 1e9;
const int N = 1e5;
const int MOD = 1e9 + 7;

const double PI = acos(-1);

bool isPrime(int x) {
    for (int i = 2; i * i <= x; i++) {
        if (x % i == 0)
            return 0;
    }
    return 1;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int x;
    cin >> x;
    while (true) {
        if (isPrime(x)) {
            cout << x;
            return 0;
        }
        x++;
    }
}

Measured memory_bytes: 256
//
//  main.cpp
//  A
//
//  Created by Hashizo on 2019/10/27.
//  Copyright © 2019 Hashizo. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <regex>
#include <cmath>

using namespace std;
 
#undef LONG_MAX
#undef LONG_MIN
 
#define LONG_MAX    9223372036854775807
#define LONG_MIN    (-LONG_MAX  -1)
 
#define ll long long
 
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
 
#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())

int main(int argc, const char * argv[]) {
	ll a,b;
	cin >> a >> b;

	
	if ( a > 9 || b > 9) {
		cout << -1 << endl;
		return 0;
	}
	
		
	cout << a*b << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
 
#define x first
#define y second
#define ndl '\n'
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
 
using namespace std;
//using namespace __gnu_pbds;
 
//template<typename T> using indexed_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());//uniform_int_distribution<int> (l, r)
 
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<int, ull> piu;
typedef vector<vector<int>> matrix;
 
const ll INF = 1e18 + 123;
const ld EPS = 1e-9;
const int inf = 1e9 + 123;
const int MOD = 1e9 + 7;
const int N = 5e5 + 123;
const int M = 1e6 + 123;
const double pi = 3.14159265359;
const int dx[] = {0, 0, 1, -1};
const int dy[] = {1, -1, 0, 0};
 
ll ans = INF;
 
vector<ll>pr;
 
ll binpow(ll a, ll b, ll MOD){
    ll res = 1;
    a %= MOD;
    while (b){
        if (b&1){
            res = (res*a) % MOD;
            //cout << a << " " <<res<< ndl;
        }
        a = (a*a) % MOD;
        //cout << a << endl;
        b >>= 1;
    }
    return res;
}
 
ll phi(ll x){
    ll res = x;
    for (ll d : pr){
        if (x % d == 0){
            res -= res/d;
        }
    }
    return res;
}
 
void calc(ll x, ll y){
    
    ll b = binpow(y, phi(x)-1, x);
   // cout << x << " " << " " << y << " " << b << ndl;
    ans = min(ans, y*b-1);
    ll a =((y*b-1)/x % y * (x-1) + 1)%y;
    //cout << x << " " << " " << y << " " << a << ndl;
    ans = min(ans, x*a-1);
}
 
void factorize(ll n){
    for (ll i = 2;  i*i <= n; i++){
        if (n%i == 0){
            pr.pb(i);
            while (n % i == 0){
                n /= i;
            }
        }
    }
    if (n > 1){
        pr.pb(n);
    }
}
 
void solve(){
    ll n, x;
    cin >> n;
    n += n;
    pr.clear();
    factorize(n);
    ans = n-1;
    for (ll i = 2; i*i <= n; i++){
        if (n%i == 0 && gcd(i, n/i) == 1){
            calc(i, n/i);
        }
    }
    cout << ans;
}
 
int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    //cin >> t;
    for (int i = 1; i <= t; i++){
        //cout << "Case #" << i << ": ";
        solve();
    }
    #ifdef KAZAKH
      //  cout << endl << 1.0 * clock() / CLOCKS_PER_SEC << endl;
    #endif
    return 0;
}

Measured memory_bytes: 3612
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {

        string inpt = Reader.ReadLine();

        int ans = inpt.Count(a => a == '+') - inpt.Count(a => a != '+');
        Console.WriteLine(ans);



    }




    public class Reader
    {
        static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"
 
 
+-++
 
 
 
 
";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}

Measured memory_bytes: 13268
#include <iostream>
#include <climits>
#include <vector>

using namespace std;

#define MAXN 1000
vector<long int> table[MAXN];
vector<long int> v, w;

void initialize(int n, int w){
    for(int i = 0; i <= n; i++){
        table[i].resize(w + 1);
    }
}

long int knapsack(int n, int W) {
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= W; j++){
            if (i == 0 || j == 0) {
                table[i][j] = 0;
                continue;
            }
            if (j < w[i - 1]) {
                table[i][j] = table[i - 1][j];
            }
            else
                table[i][j] = max(table[i - 1][j], table[i - 1][j - w[i - 1]] + v[i - 1]);
        }
    }
    return table[n][W];
}

int main() {
    long int n, W;
    cin >> n >> W;
    
    v.resize(n);
    w.resize(n);
    for(int i = 0; i < n; i++){
        cin >> w[i] >> v[i];
    }
    initialize(n, W);
    cout << knapsack(n, W) << endl;
    // for(int i = 0; i <= n; i++){
    //     for(int j = 0; j <= W; j++){
    //       cout << table[i][j] << " ";
    //     }
    //     cout << endl;
    // }
}

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

int n; 
vector<string> result;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>n;
    queue<string> q;
    q.push("a");
    while(true){
        string str = q.front(); 
        if(str.length() > n-1) {
            break;
        } else{
            q.pop();
            set<char> cset;
            for(auto a : str){
                cset.insert(a);
            }
            char tmp;
            for(auto  a : cset){
                q.push(str+a);
                tmp = a;
            }
            tmp = tmp+1;
            q.push(str + tmp);
        }
    }
    vector<string> ans;
    while(!q.empty()){
        ans.push_back(q.front());
        q.pop();
    }
    sort(ans.begin(), ans.end());
    for(auto a : ans){
        cout << a << endl;
    }
 
}

Measured memory_bytes: 10744
/*  
    Come feed the rain
	Cos I'm thirsty for your love
	Dancing underneath the skies of lust
	Yeah feed the rain...
	Cos without your love my life
	Ain't nothing but this carnival of rust
    _________________________
    _________________________
    816 Hours of Solitude
    Quarantine_Day : 34
*/

#include<bits/stdc++.h>

using namespace std;

typedef long long int       ll;
typedef vector<int>         vi;
typedef vector<ll>          vl;
typedef pair<int, int>      pii;
typedef pair<ll, ll>		pll;

#define pb(n)           push_back(n)
#define GSORT(v)        sort(v.begin(), v.end(), greater<int>())
#define SORT(v)         sort(v.begin(), v.end());
#define REV(v)          reverse(v.begin(), v.end());
#define db(a)           cout<<#a<<" = "<<a<<endl;
#define FIN             freopen("in.txt","r",stdin);
#define FOUT            freopen("out.txt","w",stdout);
#define REP(i,n)        for(int i = (int)(0); i < (int)(n); i++)
#define FOR(i, a, b)    for(int i = (int)a; i <= (int)b; i++)    

#define MAX 50005
#define MOD 1000000007

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

	ll n, m; 
	cin>>n>>m;

	vector<pll>sp;
	vector<pll>cp;

	REP(i, n){
		ll a, b;
		cin>>a>>b;
		sp.pb(make_pair(a, b));
	}
	REP(i, m){
		ll a, b; 
		cin>>a>>b;
		cp.pb(make_pair(a, b));
	}
	REP(i, n){
		ll ans;
		ll temp = LONG_LONG_MAX;
		REP(j, m){
			ll dis = abs(sp[i].first - cp[j].first) + abs(sp[i].second - cp[j].second);
			if(dis < temp){
				ans = j + 1;
				temp = dis;
			}
		}
		cout<<ans<<"\n";
	}
	return 0;
}



Measured memory_bytes: 256
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let k: usize = iterator.next().unwrap().parse().unwrap();
    let s: Vec<char> = iterator.next().unwrap().chars().collect();

    let mut result = String::new();
    for i in 0..n {
        if i == k - 1 {
            result.push(s[i].to_ascii_lowercase());
        } else {
            result.push(s[i]);
        }
    }
    return result;
}


Measured memory_bytes: 2112
N = int(input())
a = [0] * N
for i in range(N):
    a[i] = int(input())

tmp = 1
count = 0
check = 0

while tmp != 2 :
    tmp = a[tmp-1]
    count += 1
    if count >= N:
        check = 1
        break

if check == 0:
    print(count)
else:
    print(-1)



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

int main(){
	int a, b;
	int num=0;
	cin >> a >> b;
	for (int i=a; i<=b; i++){
		if(i%10==i/10000){
			if((i/10)%10==(i/1000)%10){
				num ++;
			}
		}
	}
	cout << num << endl;
}


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

typedef long long ll;
typedef vector < ll > vl;
typedef vector < int > vi;
typedef vector < bool > vb;
typedef vector < vl > vvl;
typedef vector < vi > vvi;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
typedef vector < pll > vpll;
typedef vector < pii > vpii;
typedef vector < vpll > vvpll;
typedef vector < vpii > vvpii;

#define pb push_back
#define eb emplace_back
#define pf push_front
#define all(c) (c).begin(), (c).end()
#define ff first
#define ss second
#define mp(x,y) make_pair((x), (y))
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL)



void solve(){
    
    int h, w, k; cin >> h >> w >> k;
    int mat[h][w];
    for(int i = 0; i < h; i++){
        string s; cin >> s;
        for(int j = 0; j < w; j++){
            mat[i][j] = s[j] == '#';
        }
    }
    int ans = 0;
    for(int row = 0; row < (1 << h); row++){
        for(int col = 0; col < (1 << w); col++){
            int cnt = 0;
            for(int i = 0; i < h; i++){
                if(row & (1 << i)) continue;
                for(int j = 0; j < w; j++){
                    if(col & (1 << j)) continue;
                    if(mat[i][j]) cnt++;
                }
            }
            if(cnt == k) ans++;
        }
    }
    cout << ans << '\n';
}


int main(){
	boost;
	int t = 1;
// 	cin >> t;
// 	precompute();
	for(int i = 1; i <= t; i++){
	   // cout << "Case #" << i << ": ";
		solve();
	}
	return 0;
}

Measured memory_bytes: 3652
#include<stdio.h>
int main(void){
  int x1,x2,x3,x4;
  int y1,y2,y3,y4;
  int da,db;

  scanf("%d %d %d %d",&x1,&y1,&x2,&y2);

  da=x2-x1;
  db=y2-y1;

  x3=x2-db;
  y3=y2+da;

  x4=x3-da;
  y4=y3-db;

  printf("%d %d %d %d\n",x3,y3,x4,y4);

  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<int,int>;
int main()
{
    int x,y,z,k;
    cin >> x >>y >>z >>k;
    vector<ll> a(x),b(y),c(z);
    rep(i,x)cin >> a[i];
    rep(i,y)cin >> b[i];
    rep(i,z)cin >> c[i];
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());
    reverse(a.begin(),a.end());
    reverse(b.begin(),b.end());
    reverse(c.begin(),c.end());
    vector<ll> ans;
    rep(i,x)rep(j,y)rep(l,z){
        if(i*j*l > k+1)break;
        ans.push_back(a[i]+b[j]+c[l]);


    }
    sort(ans.begin(),ans.end());
    reverse(ans.begin(),ans.end());
    rep(i,k)cout << ans[i] << endl;
   
    
    return 0;
}

Measured memory_bytes: 35048
#include <iostream>
#include <stack>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <cstring>
#include <vector>
#include <cmath>
#include <stdlib.h>
#include <unordered_map>
#define ll long long
using namespace std;

int main() {
    int a,b;
    cin>>a>>b;
    for(int i=1;i<=3;i++)
        if((a*b*i)%2==1){
            cout<<"Yes";
            return 0;
        }
    cout<<"No";
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;


int main()
{
	int N;
	int sum = 0;
	int maxp;

	cin >> N;

	int* p = new int[N];

	for (int i = 0; i < N; i++) cin >> p[i];
	maxp = p[0];

	for (int i = 0; i < N; i++) {
		sum += p[i];

		if (maxp < p[i]) maxp = p[i];
	}

	sum -= maxp / 2;

	cout << sum << endl;

	delete[] p;

	return 0;
}


Measured memory_bytes: 256
def main():
  n,m=map(int,input().split())
  inf=10**9
  dp=[inf]*(1<<n)
  dp[0]=0
  
  #cost=[inf for i in range(m)]
  for i in range(m):
    a,b=map(int,input().split())
    c=[1<<(int(x)-1) for x in input().split()]
    t=sum(c)
    #cost[i]=[s,a]
    for s in range(1<<n):
      dp[t|s]=min(dp[t|s], dp[s]+a)
    
  #print(cost)
  """
  dp=[inf]*(1<<n)
  dp[0]=0
  for s in range(1<<n):
    for bit,c in cost:
      dp[s|bit]=min(dp[s|bit], dp[s]+c)
  #print(dp)
  """
  #print(dp)
  print(-1 if dp[-1]==inf else dp[-1])

if __name__=='__main__':
  main()

Measured memory_bytes: 9244
using System;
using CompLib.Util;

public class Program
{
    private int N;
    private long P;
    private char[] S;

    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        P = sc.NextLong();
        S = sc.NextCharArray();
        Array.Reverse(S);
        long ans;
        if (P == 2 || P == 5)
        {
            ans = 0;
            for (int i = 0; i < N; i++)
            {
                if ((S[i] - '0') % P == 0)
                {
                    ans += N - i;
                }
            }
            Console.WriteLine(ans);
            return;
        }

        long[] m = new long[N + 1];
        long pp = 1;
        for (int i = 0; i < N; i++)
        {
            m[i + 1] = m[i] + (S[i] - '0') * pp;
            m[i + 1] %= P;
            pp *= 10;
            pp %= P;
        }

        ans = 0;
        long[] cnt = new long[P];
        for (int i = N; i >= 0; i--)
        {
            ans += cnt[m[i]];
            // Console.WriteLine($"{i} {m[i]} {cnt[m[i]]}");
            cnt[m[i]]++;
        }

        Console.WriteLine(ans);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 14560
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

int main() {
    int n; cin >> n;
    vector<int> a(n); rep(i, n) cin >> a.at(i);

    int v1=0, v2 = 0;
    rep(i, n){
        v1 += a.at(i);
    }
    
    v2 = v1/n + 1;
    v1 /= n;

    ll sum1=0, sum2 = 0;
    rep(i, n){
        sum1 += pow(abs(a.at(i)-v1), 2);
        sum2 += pow(abs(a.at(i)-v2), 2);
    }
    
    cout << min(sum1, sum2) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int i,j,l,n;
  string s;
  cin>>s;
  l=s.size();
  j=l;
  j--;
  n=0;
  l/=2;
  for(i=0;i<l;i++){
    if(s[i]!=s[j]){
      n++;
    }
    j--;
  }
  cout<<n<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using piii = pair<int, pair<int, int>>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;

int solve(string &a, bool flag = false) {
    int N = a.length();
    bool iszero = false;
    bool isone = false;
    for (int i = 0; i < N; ++i) {
        int num = a[i] - '0';
        if (num & 1)
            iszero = true;
        if ((num & 1) && (N - 1 & i) == i)
            isone ^= 1;
    }

    if (isone)
        return 1;
    else if (iszero || flag)
        return 0;
    else {
        for (int i = 0; i < N; ++i)
            if (a[i] == '2')
                a[i]--;
        return solve(a, true) << 1;
    }
}

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

    int N;
    string a;
    cin >> N >> a;
    for (int i = 0; i < N; ++i)
        a[i]--;

    cout << solve(a) << endl;

    return 0;
}


Measured memory_bytes: 1948
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define all(x) begin(x),end(x)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const char newl = 10;
const string sep = "\n_____\n";
const ll MOD = 1000000007; // 998244353
const int maxN = 300005;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void run(){
   int n;
   cin >> n;
   ll sum = 0;
   for (int i = 1; i <= n; i++) if (i % 3 != 0 && i % 5 != 0){
      sum += i;
   }
   cout << sum;
}
int main(){
   ios_base::sync_with_stdio(0);cin.tie(0);
   cout.tie(0);
   // stress(); return 0;
   int t = 1;
   // cin >> t;
   for (int tc = 1; tc <= t; tc++) {
      // cout << "Case #" << tc << ": ";
      run();
      cout << newl;
   }
   return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <vector>

using namespace std;

template <class T> void to_min(T &var, T const &val) {
  var = std::min(var, val);
}

int main() {
  int N, X, Y;
  cin >> N >> X >> Y;

  vector<int> dp(N);
  for (int from = 1; from <= N; ++from) {
    for (int to = from + 1; to <= N; ++to) {
      auto dist = abs(to - from);
      to_min(dist, abs(from - X) + 1 + abs(Y - to)); // 内側の短絡
      to_min(dist, abs(from - Y) + 1 + abs(X - to)); // 外側の短絡
      ++dp[dist];
    }
  }

  for (int i = 1; i < N; ++i) {
    cout << dp[i] << "\n";
  }
  return 0;
}


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

using namespace std;

int main()
{
	int n, l;
	cin>>n>>l;
	vector<string> v(n);
	for(int i = 0; i < n; i++) {
		cin>>v[i];
	}
	sort(v.begin(), v.end());
	string ans = "";
	for(string s: v) {
		ans += s;
	}
	cout<<ans;
}


Measured memory_bytes: 3624
#include <stdio.h>
#include <inttypes.h>

#define MOD_BY UINT32_C(1000000007)

uint32_t add(uint32_t a, uint32_t b) {
	return a + b - MOD_BY * (a + b >= MOD_BY);
}

uint32_t mul(uint32_t a, uint32_t b) {
	uint32_t r = 0;
	while (b) {
		if (b & 1) r = add(r, a);
		a = add(a, a);
		b >>= 1;
	}
	return r;
}

int main(void) {
	uint32_t N, M;
	if (scanf("%" SCNu32 "%" SCNu32, &N, &M) != 2) return 1;
	if (N == M || N == M + 1 || N + 1 == M) {
		uint32_t answer = 1;
		uint32_t i;
		for (i = 1; i <= N; i++) answer = mul(answer, i);
		for (i = 1; i <= M; i++) answer = mul(answer, i);
		if (N == M) answer = mul(answer, 2);
		printf("%" PRIu32 "\n", answer);
	} else {
		puts("0");
	}
	return 0;
}


Measured memory_bytes: 128
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 * @brief Maximum Profit
 */

#include <iostream>
const int kMaxCount = 200000;
class CurrencyRates {
 public:
  CurrencyRates();
  ~CurrencyRates();
  void MaximumProfit(std::istream &input_stream);

 private:
  int LoadData(std::istream &input_stream);
  int CalculateMaximumProfit();

 private:
  int count_;
  int rates_[kMaxCount];
};

CurrencyRates::CurrencyRates() : count_(0), rates_{-1} {
}

CurrencyRates::~CurrencyRates() {}

void CurrencyRates::MaximumProfit(std::istream &input_stream) {
  int count = LoadData(input_stream);
  if(count >= 2) {
    const int result = CalculateMaximumProfit();
    std::cout << result << std::endl;
  }
}

int CurrencyRates::LoadData(std::istream &input_stream) {
  input_stream >> count_;
  if (count_ > kMaxCount) {
    count_ = -1;
  }

  for (int index = 0; index < count_; ++index) {
    input_stream >> rates_[index];
  }
  return count_;
}

int CurrencyRates::CalculateMaximumProfit() {
  int price_buy = rates_[0];
  int max_profit = -2000000000;
  for (int current_index = 1; current_index < count_; ++current_index) {
    const int current_profit = rates_[current_index] - price_buy;
    max_profit = (current_profit > max_profit) ? current_profit : max_profit;
    price_buy = (rates_[current_index] < price_buy) ? rates_[current_index] : price_buy;
  }
  return max_profit;
}

int main(int argc, char *argv[]) {
  CurrencyRates *currency_rates;
  currency_rates = new CurrencyRates;
  currency_rates->MaximumProfit(std::cin);
  delete currency_rates;
  return 0;
}




Measured memory_bytes: 3512
#![allow(unused_imports)]

use std::{i32, i64, u32, u64, usize, f64};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::io::{stdout, Write, BufWriter};
use std::mem::{swap};
use maplit::*;
use proconio::marker::{Isize1, Usize1, Bytes, Chars};

//#[proconio::fastout]
fn main() {
    proconio::input!(
        sa: Chars,
        sb: Chars,
        sc: Chars,
    );
    let (mut a, mut b, mut c) = (0usize, 0usize, 0usize);
    let (na, nb, nc) = (sa.len(), sb.len(), sc.len());
    let mut turn_of = 'a';
    loop {
        match turn_of {
            'a' => {
                if a == na {
                    println!("A");
                    return;
                }
                turn_of = sa[a];
                a += 1;
            },
            'b' => {
                if b == nb {
                    println!("B");
                    return;
                }
                turn_of = sb[b];
                b += 1;
            },
            _ => {
                if c == nc {
                    println!("C");
                    return;
                }
                turn_of = sc[c];
                c += 1;
            },
        }
    }
}


Measured memory_bytes: 2156
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int N, M, a[10] = { 0 }, p[10] = { 0 };
int S[10][10] = { 0 };
int dfs(int i, int sum);
int ddd = 0;
int main()
{
	cin >> N >> M;
	int k;
	int i,t=0;
	int n;
	for (i = 0; i < M; i++) {
		cin >> k;
		for (t = 0; t < k; t++) {
			cin >> n;
			S[i][n - 1] = 1;
		}
	}
	for (i = 0; i < M; i++) {
		cin >> p[i];
	}
	int count = 0;
	count= dfs(0, 0);

	cout << count;

	return 0;
}

int dfs(int i, int sum) {
	int t;
	bool check = true;
	int lsum, rsum;
	int v;
	int score[10] = { 0 };
	if (i == N) {
		for (v = 0; v < M; v++) {
			for (t = 0; t < N; t++) {
				if (S[v][t] == 1&&a[t]==1) {
					score[v]++;
				}
			}
		}

		for (t = 0; t < M; t++) {
			if (score[t] % 2 != p[t]) {
				check = false;
			}
		}

		if (check==true)
			return 1;
		else
			return 0;
	}

	a[i] = 0;
	lsum = dfs(i + 1, sum);

	a[i] = 1;
	rsum = dfs(i + 1, sum);



	return lsum + rsum;


}


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

using namespace std;

const int INF = 1e9;
int n, k;
vector<int> lis[2010];
int D[2010][2010];

int maxi[2010], sum[2010];
void dfs(int here, int p) {
    int i;
    for (int &there : lis[here]) if (there!=p) dfs(there,here);
    for (i=0;i<=k;i++) {
        maxi[i] = -INF;
        sum[i] = 0;
    }
    for (int &there : lis[here]) if (there!=p) {
        for (i=0;i<k;i++) {
            D[here][i+1] = max(D[here][i+1],D[there][i]+1);
            sum[i+1] += D[there][i];
            if (i<k-1) maxi[i+1] = max(maxi[i+1],D[there][i]-D[there][k-2-i]);
        }
    }
    D[here][0] = 1;
    for (i=1;i<=k;i++) D[here][i] = max({D[here][i-1],D[here][i],i+i<=k?sum[i]+1:sum[k-i]+maxi[i]+1});
}

int main() {
    int i;

    scanf("%d%d",&n,&k);
    for (i=0;i<n-1;i++) {
        int a, b;
        scanf("%d%d",&a,&b); --a; --b;
        lis[a].push_back(b);
        lis[b].push_back(a);
    }
    dfs(0,-1);
    int res = 0;
    for (i=0;i<n;i++) res = max(res,D[i][k]);
    printf("%d\n",n-res);

    return 0;
}


Measured memory_bytes: 16256
N = int(input())
s = input()
l = []
b = 0
w = s.count(".")

for i in range(N):
    if s[i] == "#":
        l.append(b+w)
        b += 1
    else:
        w -= 1
        l.append(b+w)
print(min(l))

        



Measured memory_bytes: 11368
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
using LP = pair<int, int>;
using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

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

const double PI=3.14159265358979323846;

int mod = 1e9+7;
int INF = 1e9+7;

struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x;}
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
};


int main(){

  ll N, M;
  cin >> N >> M;

  if(N==1){
    cout << M << endl;
    return 0;
  }

  ll ans = 1;
  rep(i, M/N+1){
    if(i==0) continue;
    if(i*N > M){
      break;
    }
    if(M%i==0){
      ans = i;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import sys, math, collections, heapq, itertools
F = sys.stdin
def single_input(): return F.readline().strip("\n")
def line_input(): return F.readline().strip("\n").split()
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while a % b > 0: a, b = b, a % b
    return b
  
def solve():
    N, K = map(int, line_input())
    S = single_input()
    print(S[:K-1] + S[K-1].lower() + S[K:])
    return 0
  
if __name__ == "__main__":
    solve()

Measured memory_bytes: 3440
#include<bits/stdc++.h>
using namespace std;
int a[200001];
int main()
{
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=k;i++)
		cin>>a[i];
	for(int i=k+1;i<=n;i++)
	{
		cin>>a[i];
		if(a[i]>a[i-k])
			cout<<"Yes\n";
		else
			cout<<"No\n";
	}
	return 0;
}

Measured memory_bytes: 4396
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    int ca=0,cb=0;
    for(int i=0;i<3;i++){
        if(s[i]=='A')
        ca++;
        if(s[i]=='B')
        cb++;
    }
    if(ca==3 || cb==3)
    cout<<"No";
    else
    cout<<"Yes";
    
    return 0;
}


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

int main(){
  int r,d,x; cin >> r >> d >> x;
  rep(i,10){
    x=r*x-d;
    cout << x << endl;
  }
 return 0;
}


Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever for (;;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector<double> vd;
typedef std::vector<std::string> vs;
typedef std::vector<pii> vpii;
typedef std::vector<vi> vvi;
typedef std::vector<vpii> vvpii;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { rep(i,v.size()) is >> v[i]; return is; }
template<typename A, typename B> std::istream &operator>>(std::istream &is, std::pair<A, B> &p) { is >> p.first; is >> p.second; return is; }
using namespace std;
// clang-format on

typedef int Weight;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(const int &s = 0, const int &d = 0, const Weight &w = 0) : src(s), dst(d), weight(w) {}
};

typedef std::vector<Edge> Edges;
typedef std::vector<Weight> Array;
typedef std::vector<Array> Matrix;

class Graph {
  std::vector<Edges> g;

public:
  Graph(const int &size = 0) : g(size) {}
  int size() const { return g.size(); }
  const Edges &operator[](const int &i) const { return g[i]; }
  void addArc(const int &src, const int &dst, const Weight &w = 1) { g[src].emplace_back(src, dst, w); }
  void addEdge(const int &node1, const int &node2, const Weight &w = 1) {
    addArc(node1, node2, w);
    addArc(node2, node1, w);
  }
};

template<int inf = std::numeric_limits<Weight>::max() / 8> std::pair<std::vector<Weight>, std::vector<int>> dijkstra(const Graph &g, const int &src) {
  using state = std::pair<Weight, int>;
  std::priority_queue<state, std::vector<state>, std::greater<state>> q;
  std::vector<Weight> dist(g.size(), inf);
  std::vector<int> via(g.size());
  dist[src] = 0;
  q.emplace(0, src);
  while (q.size()) {
    Weight d;
    int v;
    std::tie(d, v) = q.top();
    q.pop();
    if (dist[v] < d) continue;
    for (auto &e : g[v]) {
      if (cmin(dist[e.dst], dist[v] + e.weight)) {
        via[e.dst] = v;
        q.emplace(dist[e.dst], e.dst);
      }
    }
  }
  return {dist, via};
}
main {
  int n, k;
  while (cin >> n >> k, n) {
    Graph g(n);
    while (k--) {
      int q;
      cin >> q;
      if (q) {
        int c, d, e;
        cin >> c >> d >> e;
        --c, --d;
        g.addEdge(c, d, e);
      } else {
        int a, b;
        cin >> a >> b;
        --a, --b;
        vector<Weight> dist = dijkstra<INF>(g, a).first;
        cout << (dist[b] == INF ? -1 : dist[b]) << endl;
      }
    }
  }
}

Measured memory_bytes: 3204
#include <bits/stdc++.h>
#define rep(var,cnt) for(int (var)=0; (var)<(int)(cnt); ++(var))
#define Rep(var,init,cnt) for(int (var)=(init); (var)<(int)(cnt); ++(var))
#define ran(var,vec) for(auto &(var):(vec))
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(rall(v))
#define SUM(v) accumulate(all(v),0)
#define tget(tp,idx) get<idx>(tp)
#define TF(flag) ((flag)?1:0)
#define YN(flag) cout<<(flag?"YES":"NO")<<endl;
#define Yn(flag) cout<<(flag?"Yes":"No")<<endl;
#define yn(flag) cout<<(flag?"yes":"no")<<endl;
#define Cout(v) cout<<(v)
#define COUT(v) cout<<(v)<<endl
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using ti = tuple<int,int,int>;
using tl = tuple<ll,ll,ll>;

template<typename T>
using vec = vector<T>;
template<typename T>
using mat = vector<vec<T>>;
template<typename T>
using cub = vector<mat<T>>;
template<typename T>
using val = valarray<T>;

template<typename T>
using pq = priority_queue<T>;
template<typename T>
using rpq = priority_queue<T,vec<T>,greater<T>>;

template<typename T1,typename T2>
ostream &operator<<(ostream &os, const pair<T1,T2> &p){
  os<<p.first<<" "<<p.second;
  return os;
}

template<typename T1,typename T2>
istream &operator>>(istream &is, pair<T1,T2> &p){
  is>>p.first>>p.second;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  return os;
}

template<typename T>
istream &operator>>(istream &is, vector<T> &v){
  for(T &in:v) is>>in;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const valarray<T> &v){
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  return os;
}

template<typename T>
istream &operator>>(istream &is, valarray<T> &v){
  for(T &in:v) is>>in;
  return is;
}

// Usual Template End ===================
// Template End =========================

constexpr int MOD=1e9+7;
locale LOCATE=locale::classic();

int main(void){
  int N,K; cin>>N>>K;
  int ans=K;
  Rep(i,1,N) ans*=(K-1);
  COUT(ans);
}











Measured memory_bytes: 256
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readA(T)(size_t n,ref T[]t){t=new T[](n);auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int n, k; readV(n, k);
  int[] l; readA(n, l);

  l.sort!"a>b";
  writeln(l[0..k].sum);
}


Measured memory_bytes: 256