akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;

namespace Competitive
{
    internal class Solution
    {
        private long A, B, C, X, Y;

        public void Run()
        {
            var line1 = Input.ReadIntArray();
            A = line1[0];
            B = line1[1];
            C = line1[2];
            X = line1[3];
            Y = line1[4];

            var ret = long.MaxValue;
            for (int i = 0; i <= 200000; i++)
            {
                ret = Math.Min(ret, i * C + Math.Max(0, X - i / 2) * A + Math.Max(0, Y - i / 2) * B);
            }
            Console.WriteLine(ret);
        }

    }

    
    internal static class Input
    {
        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }

    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 13396
n,m=map(int,input().split())
par=[-1]*n

# this par & rank are initialized lists
def find(x):
    global par
    if par[x]<0:
        return x
    else:
        par[x]=find(par[x])
        return par[x]
        
def unite(x,y):
    x,y=find(x),find(y)
    global par
    if x==y:return False
    else:
        if par[x]>par[y]:x,y=y,x
        par[x]+=par[y]
        par[y]=x
        return True

def size(x):
    return -par[find(x)]
def same(x,y):
    return find(x)==find(y)

p=list(map(int,input().split()))
for i in range(n):
  p[i]-=1
ans=0

for i in range(m):
  x,y=map(int,input().split())
  x-=1;y-=1
  unite(x,y)

for i in range(n):
  if same(i,p[i]):
    #print("i,pi",i,p[i])
    ans+=1

print(ans)

Measured memory_bytes: 14580
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

#define all(a) (a).begin(), (a).end()

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

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

    int n, m; cin>>n>>m;
    vector<vector<int>> G(n);
    for(int i=0; i<m; i++){
        int a, b; cin>>a>>b;
        a--, b--;
        G[a].emplace_back(b);
        G[b].emplace_back(a);
    }

    queue<int> que;
    que.emplace(0);
    vector<int> ans(n, -1);
    while(que.size()){
        int cv = que.front(); que.pop();

        for(auto nv : G[cv]){
            if(ans[nv] == -1){
                ans[nv] = cv;
                que.emplace(nv);
            }
        }
    }

    cout << "Yes" << endl;
    for(int i=1; i<n; i++) cout << ans[i] + 1 << endl;

    return 0;
}

Measured memory_bytes: 9988
#include <bits/stdc++.h>
 
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef int ftype;
 
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second 
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#define fori(i, n) for (int i = 0; i < (int)(n); ++i)
#define forn(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n); i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define RETURN(x) do{cout << x << '\n'; return 0;}while(0)
#define FIRSTWIN do{cout << "Monocarp\n"; return 0;}while(0)
#define SECONDWIN do{cout << "Bicarp\n"; return 0;}while(0)

const int MAXN = 5e5+5;
const int MOD = 1e9+7;
const LL INF = 1e18+1;

int main() {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    int a,b;
    cin >> a >> b;
    cout << max(0, a-2*b) << endl;
    return 0;
}


Measured memory_bytes: 256
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define ld long double
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define pii pair<ll,ll>
#define vi(x) vector<x>
#define MAXN 1000005
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace std;
using namespace __gnu_pbds;
int spf[MAXN+10]; 
  
int ma[MAXN+10] ; 


void sieve() 
{ 
    spf[1] = 1; 
    for (int i = 2; i < MAXN; i++) 
  
        spf[i] = i; 
    for (int i = 4; i < MAXN; i += 2) 
        spf[i] = 2; 
  
    for (int i = 3; i * i < MAXN; i++) { 
  
        if (spf[i] == i) { 
            for (int j = i * i; j < MAXN; j += i) 
  
                if (spf[j] == j) 
                    spf[j] = i; 
        } 
    } 
} 

void getFactorization(int x) 
{ 
    int temp; 
    while (x != 1) { 
        temp = spf[x]; 
        if (x % temp == 0) { 
            ma[spf[x]]++; 
            x = x / spf[x]; 
        } 
        while (x % temp == 0) 
            x = x / temp; 
    } 
} 
signed main()
{
    fast;
   
    sieve();
    int n,i,j;
    cin>>n;
    int a[n+2];
    for(i=0;i<n;i++)
    {
    	cin>>a[i];
    	getFactorization(a[i]);
    }
    bool ok = 1;
    for(i=2;i<=MAXN;i++)
    {
    	if(ma[i]>1) 
    	{
    		ok=0;
    		break;
    	}
    }
    if(ok) cout<<"pairwise coprime";
    else
    {
    	int gc=0;
    	for(i=0;i<n;i++) gc = __gcd(gc,a[i]);
    	if(gc == 1) cout<<"setwise coprime";
        else cout<<"not coprime";
    }

}

Measured memory_bytes: 26872
import java.util.Scanner;

public class Main{
    public static void main(String[]args){
        Scanner sc = new Scanner(System.in);
        while(true){
            int H = sc.nextInt();
            int W = sc.nextInt();

            if(H == 0 && W == 0){
                break;
            }for(int i=0;i<H;i++){
                for(int j=0;j<W;j++){
                    System.out.print("#");
                }System.out.print("\n");
            }System.out.print("\n");
        }
    }
}


Measured memory_bytes: 37908
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define inf 1e9
#define INF 1000000000000000000

class UnionFind {
  public:
    vector<ll> par; // 各元の親を表す配列
    vector<ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1) {
        for (ll i = 0; i < sz_; ++i)
            par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1);
        for (ll i = 0; i < sz_; ++i)
            par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y)
            return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y])
            swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};

int main() {
    ll N, M, K;
    cin >> N >> M >> K;
    vector<set<ll>> no(N, set<ll>());
    UnionFind tree(N);

    rep(i, M) {
        ll a, b;
        cin >> a >> b;
        a--, b--;
        tree.merge(a, b);
        no[a].insert(b);
        no[b].insert(a);
    }

    rep(i, K) {
        ll c, d;
        cin >> c >> d;
        c--, d--;
        if (tree.issame(c, d))
            no[c].insert(d), no[d].insert(c);
    }

    rep(i, N) { cout << tree.size(i) - no[i].size() - 1 << " "; }
    cout << endl;
}

Measured memory_bytes: 28248
#include<bits/stdc++.h>
using namespace std;
int n,c;
int main(){
 cin>>n;
 for(int i=0;i<n;i++){
  int t;
  cin>>t;
  if(t%2)c++;
 }
 if(c%2)cout<<"NO"<<endl;
 else cout<<"YES"<<endl;
 return 0;
}

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

int main(){

  int a,b,c;
  cin>>a>>b>>c;
  int temp;
  int temp2;
  
  temp = a;
  a = b;
  b = temp;
  
  temp2 = a;
  a = c;
  c = temp2;
  
  cout<<a<<" "<<b<<" "<<c;
  

}

Measured memory_bytes: 3196
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
#include <cctype>

using namespace std;

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

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

int main()
{
	int n;
	cin >> n;
	vector<int> A(n);
	REP(i, n) cin >> A[i];

	int p = partition(A, 0, n - 1);
	REP(i, n) {
		if(i == p) cout << '[' << A[i] << ']';
		else cout << A[i];
		(i != n - 1)? cout << ' ' : cout << endl;
	}


	return 0;
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)

int seat[] = {0, 6000, 4000, 3000, 2000};
int main()
{
  int t, n;
  FOR(i, 1, 5){
    cin >> t >> n;
    cout << seat[t] * n << endl;
  }
}

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

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

Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))

av = sum(a) / N
mi = 101
c = 0
for i in range(N - 1, -1, -1):
    if abs(a[i] - av) <= mi:
        mi = abs(a[i] - av)
        idx = i
print(idx)


Measured memory_bytes: 3060
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n, d := scanInt(), scanFloat64()
	ans := 0
	for i := 0; i < n; i++ {
		x, y := scanFloat64(), scanFloat64()
		if math.Sqrt(x*x+y*y) <= d {
			ans++
		}
	}
	fmt.Fprintln(wr, ans)
}


Measured memory_bytes: 4908
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn mat_chars(&mut self, row: usize) -> Vec<Vec<char>> {
        (0..row).map(|_| self.chars()).collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let N: usize = sc.get();
    let M: usize = sc.get();
    let mut AB = Vec::new();
    for _ in 0..N {
        let A: usize = sc.get();
        let B: usize = sc.get();
        AB.push((A, B));
    }
    AB.sort();
    let mut rem = M;
    let mut ans = 0;
    for i in 0..N {
        let (A, B) = AB[i];
        if rem <= B {
            ans += A * rem;
            break;
        } else {
            rem -= B;
            ans += A * B;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 6396
#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<n;++i)
#define MOD 1000000007

#define MAX_N 100005

struct UnionFind{
    ll par[MAX_N]; // 親
    ll rank[MAX_N]; // 木の深さ
    ll siz[MAX_N]; // 素集合のサイズ

    // n要素で初期化
    void init(ll n){
        for(ll i=0;i<n;i++){
            par[i] = i;
            rank[i] = 0;
            siz[i] = 1;
        }
    }

    // 木の根を求める
    ll root(ll x){
        if(par[x] == x){
            return x;
        }else{
            return par[x] = root(par[x]);
        }
    }

    // xとyの属する集合を併合
    bool unite(ll x, ll y){
        x = root(x);
        y = root(y);
        if(x==y) return false; // 併合失敗
        if(rank[x] < rank[y]){
            par[x] = y;
            siz[y] += siz[x];
        }else{
            par[y] = x;
            siz[x] += siz[y];
            if(rank[x] == rank[y]) rank[x]++;
        }
        return true; // 併合成功
    }

    bool issame(ll x, ll y){
        return root(x)==root(y);
    }

    ll size(ll x){
        return siz[root(x)];
    }
};


int main(){
    UnionFind uf;
    int n, m;
    cin >> n >> m;
    ll a[m], b[m];
    rep(i, m){
        cin >> a[i] >> b[i];
        --a[i];
        --b[i];
    }

    uf.init(n);
    ll ans[m];
    ans[m-1] = (ll) n*(n-1)/2;
    for(int i=m-2;i>=0;i--){
        if(uf.issame(a[i+1], b[i+1])){
            ans[i] = ans[i+1];
        }else{
            ans[i] = ans[i+1] - uf.size(a[i+1]) * uf.size(b[i+1]);
            uf.unite(a[i+1], b[i+1]);
        }
    }
    rep(i, m){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 6016
//API???????????????
import java.util.Scanner;
import java.io.IOException;
class Main {
  	
	static int k = 10000;
	
	public static void main(String[] args)throws IOException{
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] A = new int[n];
		int[] B = new int[n];
		
		for(int i = 0; i < n; i++){
			A[i] = scan.nextInt();
		}
		
		CountingSort(A, B, n);
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < n; i++){
			if(i != n - 1){
				sb.append(B[i]).append(" ");
			}else{
				sb.append(B[i]);
			}
		}
		System.out.println(sb);
	}
	
	public static void CountingSort(int[] A, int[] B, int n){
		int[] C = new int[k + 1];
		int i;
		
		for(i = 0; i < n; i++){
			C[A[i]]++;
		}
		for(i = 1; i <= k; i++){
			C[i] += C[i - 1];
		}
		for(i = n - 1; i >= 0; i--){
			B[C[A[i]] - 1] = A[i];
			C[A[i]]--;
		}
	}
} 

Measured memory_bytes: 515544
import sys
input1 = list(map(int, input().split()))
X = input1[0]
N = input1[1]
p = list(map(int, input().split()))

if N == 0:
    print(X)
    sys.exit()
elif (X in p) == False:
    print(X)
    sys.exit()

# print(X)
flag = True
diff = 1
# print((X - diff) in p)
while(flag):
    if ((X - diff) in p) == False:
        answer = X - diff
        flag = False
    elif ((X + diff) in p) == False:
        answer = X + diff
        flag = False
    else:
        diff += 1

print(answer)



Measured memory_bytes: 9208
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  cout << (a + b + 1) / 2 << endl;

  return 0;
}


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

#define REP(type, i, a, b) for( type i = a; i < b; i++ )
typedef long long ll;

using namespace std;

int main (void) {
    ll N, ans;
    scanf("%lld", &N);
    vector<ll> L(N);
    REP(int, i, 0, N) scanf("%lld", &L.at(i));
    sort(L.begin(),L.end());
    ans = 0;
    REP(int, i, 0, N-2){
        REP(int, j, i+1, N-1){
            REP(int, k, j+1, N){
                //cout << i << j << k << endl;
                if (L[i] < L[j] + L[k] && L[j] < L[i] + L[k] && L[k] < L[i] + L[j]) {
                    ans++;
                }
            }
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 256
def read_list(t): return [t(x) for x in input().split()]
def read_line(t): return t(input())
def read_lines(t, N): return [t(input()) for _ in range(N)]

def rec(state, v):
    if dp[state][v] >= 0:
        return dp[state][v]
    if (1 << V) - 1 == state and v == 0:
        dp[state][0] = 0
        return 0

    ret = INF
    for to, cost in edge[v]:
        if not (state >> to & 1):
            ret = min(ret, rec(state | 1 << to, to) + cost)
    dp[state][v] = ret
    return ret

INF = float('inf')
V, E = read_list(int)
edge = [[] for _ in range(V)]
for _ in range(E):
    fr, to, cost = map(int, input().split())
    edge[fr].append((to, cost))

dp = [[-1] * V for _ in range(1<<V)]
print(dp[0][0] if rec(0, 0) != INF else -1)

Measured memory_bytes: 17036
from collections import Counter
n,k=map(int,input().split())
l=[]
for i in range(n):
    l.append(int(input()))
l.sort()
d=Counter(l)
for i in d:
    if(d[i]>=k):
        print(0)
        exit()
ans=10**9
for i in range(n-k+1):
    if(l[k+i-1]-l[i]<ans):
        ans=l[k+i-1]-l[i]
print(ans)

Measured memory_bytes: 16652
#include<bits/stdc++.h>
#define dbug printf("I am here\n");
#define Fast ios_base::sync_with_stdio(false); cin.tie(0);
#define vs             v.size()
#define ss             s.size()
#define sot(v)       sort(v.begin(),v.end())
#define rev(v)       reverse(v.begin(),v.end())
#define pii             pair<int,int>
#define ll               long long
#define ull             unsigned long long
#define pb             push_back
#define mpp          make_pair
#define Okay         0

const int m = 10+10e7;
static ll int inf = 1e18;
using namespace std;


void  solve(){
      ll int a;
      cin>>a;
      if(a>=400 && a<=599)cout<<8<<endl;
      else if(a>=600 && a<=799)cout<<7<<endl;
      else if(a>=800 && a<=999)cout<<6<<endl;
      else if(a>=1000 && a<=1199)cout<<5<<endl;
      else if(a>=1200 && a<=1399)cout<<4<<endl;
      else if(a>=1400 && a<=1599)cout<<3<<endl;
      else if(a >= 1600 && a <= 1799)cout<<2<<endl;
      else cout<<1<<endl;


}


int main() {
    Fast;

    int tst;


           solve();



    return Okay ;
}


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

int main(void)
{
	int m,n,sum=0,x;
	cin>>m>>n;
	while(n--)
	{
		cin>>x;
		sum+=x;
	}
	if(sum>m)
		cout<<"-1";
	else
		cout<<m-sum;
	return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 998244353;
inline int add(int a,int b){a+=b;return a>=mod?a-mod:a;}
inline int sub(int a,int b){a-=b;return a<0?a+mod:a;}
inline int mul(int a,int b){return 1ll*a*b%mod;}
inline int qpow(int a,int b){int ret=1;for(;b;b>>=1,a=mul(a,a))if(b&1)ret=mul(ret,a);return ret;}
/* math */
const int N = 410;
int a[N], b[N], c[N], n, suma, sumb;
int bin[1010][1010];
int f[N][N],g[N][N];

int main()
{
	cin >> n;
	for(int i=1;i<=n;i++)scanf("%d%d",&a[i],&b[i]),suma+=a[i], sumb += b[i];
	for(int i=0;i<=1000;i++){
		bin[i][0]=bin[i][i]=1;
		for(int j=1;j<i;j++)bin[i][j] = add(bin[i-1][j],bin[i-1][j-1]);
	}
	g[0][0] = mod-1;
	for(int i=1;i<=n;i++){
		for(int A = 0;A+a[i] <= suma; A++){
			for(int B = 0;B <= sumb; B++){
				int pw = 1;
				for(int ch=0;ch+B<=sumb&&ch<b[i];ch++,pw = mul(pw, a[i])){
					f[A+a[i]][B+ch] = sub(f[A+a[i]][B+ch], mul(mul(pw,g[A][B]), bin[B+ch][ch]));
				}
			}
		}
		for(int i=0;i<=suma;i++)for(int j=0;j<=sumb;j++)g[i][j] = add(g[i][j], f[i][j]), f[i][j] = 0;
	}
	int ans = 0;
	for(int i=1;i<=suma;i++){
		for(int j=0;j<=sumb;j++){
			// if(g[i][j])cout << i << ' ' << j << ":" << g[i][j] << endl;
			int sum = mul(suma, qpow(i,mod-2));
			int pw = qpow(qpow(i,j),mod-2);
			int F = mul(pw,g[i][j]);
			ans = add(ans, mul(sum,F));
		}
	}
	cout << ans << endl;
}

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

using namespace std;

int main()
{
    string str;
    bool result = false;

    getline(cin, str);

    int len = str.size();
    if(len >= 4)
    {
        if(str[len-1] == str[len-2] && str[len-3] == str[len-4])
            result = true;
    }

    if(result)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
n,m=map(int, input().split())
a=[list(input()) for i in range(n)]
b=[list(input()) for i in range(m)]
ans=0
for i in range(n-m+1):
    for j in range(n-m+1):
        a2=[k[j:j+m] for k in a[i:i+m]]
        if a2==b:
            ans=1
if ans==1:print('Yes')
else: print('No')

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head

void solve(){
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    s[k-1] += 32;
    cout << s << '\n';
}

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

    //int t; cin >> t; while (t--)
        solve();
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
int main()
{
    double n,m;
    cin>>n>>m;
    vector<int>A(n);
    double total = 0;
    for (int i = 0;i<n;i++){cin>>A[i];total+=A[i];}
    sort(A.begin(),A.end());
    if (A[n-m]<(1/(4*m)*total)){
        cout<<"No"<<endl;
    }
    else{
        cout<<"Yes"<<endl;
    }
    return 0;
}

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

int main()
{
	double x1, y1, x2, y2;
	
	scanf("%lf%lf%lf%lf", &x1, &y1, &x2, &y2);
	printf("%.8lf\n", hypot(x1-x2, y1-y2));
	return 0;
}



Measured memory_bytes: 2100
import java.util.*;

public class Main {
    public static final int MAX = 100;

    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        while(true) {
            int m = scn.nextInt(), f = scn.nextInt(), r = scn.nextInt();
            if(m < 0 && f < 0 && r < 0) {
                break;
            } else if(m < 0 || f < 0) {
                System.out.println("F");
            } else if(m + f > 79) {
                System.out.println("A");
            } else if(m + f > 64) {
                System.out.println("B");
            } else if(m + f > 49) {
                System.out.println("C");
            } else if(m + f > 29) {
                System.out.println(r > 49 ? "C" : "D");
            } else {
                System.out.println("F");
            }
        }
    }
}

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

int main(){
	int N;
  	long long p=1,b=1;
  	cin>>N;
  	for(int i=0;i<9;++i)b*=10;
  	for(int i=1;i<=N;++i){
      p*=i;
      if(p>=b+7){
        while(p>b+7){
        p-=(b+7);
        }
      }
    }
	cout<<p%(b+7)<<endl;
  	return 0;
}

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

int main(){
  
  string S;
  cin >> S;
  string a = "Sunny";
  string b = "Cloudy";
    string c = "Rainy";
   if(S == a) cout << "Cloudy";
     else if(S == b) cout << "Rainy";
  else cout << "Sunny" << endl;
  
  return 0;
}



Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.*;

public class Main {
    static Scanner scanner;
    static PrintWriter out;
    public static void main(String[] args) {
        scanner = new Scanner(System.in);
        out = new PrintWriter(System.out);

        char[] line = nextLine().toCharArray();

        char[] second = nextLine().toCharArray();
        int in = line.length - second.length;

        int min = Integer.MAX_VALUE;

        int in2 = second.length;

        for (int i = 0; i <= in; i++) {
            int a = 0;
            for (int j = 0; j < in2; j++) {
                if (line[j+i] != second[j]) {
                    a++;
                }
            }
            if (min >= a) {
                min = a;
            }
        }
        System.out.println(min);

        out.flush();
    }

    public static void println(Object o) {
        out.println(o);
    }

    public static void print(Object o) {
        out.print(o);
    }

    public static void printf(String format, Object... o) {
        out.printf(format, o);
    }

    public static String next() {
        return scanner.next();
    }

    public static int nextInt() {
        return Integer.parseInt(scanner.next());
    }

    public static long nextLong() {
        return Long.parseLong(scanner.next());
    }

    public static double nextDouble() {
        return Double.parseDouble(scanner.next());
    }

    public static short nextShort() {
        return Short.parseShort(scanner.next());
    }

    public static float nextFloat() {
        return Float.parseFloat(scanner.next());
    }

    public static void printYes() {
        System.out.println("Yes");
    }

    public static void printYES() {
        System.out.println("YES");
    }

    public static void printNo() {
        System.out.println("No");
    }

    public static void printNO() {
        System.out.println("NO");
    }

    public static String nextLine() {
        return scanner.nextLine();
    }

    public static double distance(double x, double y, double x2, double y2) {
        return Math.sqrt((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y));
    }

    public static int MOD = 1_000_000_007;
    public static int MAX = 100000;
    public static long[] fac = new long[MAX];
    public static long[] finv = new long[MAX];
    public static long[] inv = new long[MAX];

    public static void combinit() {
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < MAX; i++) {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }

    public static long combination(int n, int k) {
        if (n < k || n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }

    public static long factorial(long n) {
        return n <= 0 ? 1 : n * factorial(n - 1);
    }
}

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

int gcd(int a, int b) {
  return b ? gcd(b, a%b) : a;
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a.at(i);
  int ans =  gcd(a.at(0), a.at(1));
  rep(i,n) ans = gcd(ans, a.at(i));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstdlib>
#include <ctime>
#include <string>
#include <iostream>
#include <bitset>
#define PII pair <int, int>
#define PPI pair <PII, int>
#define x first
#define y second
#define M 200010
#define P 998244353

using namespace std;

typedef long long ll;

int n;

int A[310];

ll F[310][95050], G[310][95050];

void add(ll &x, ll y) {
    x = (x + y) % P;
}

int main() {
    scanf("%d", &n);
    for(int i = 1; i <= n; i++) scanf("%d", &A[i]);
    F[0][0] = 1, G[0][0] = 1;
    for(int i = 0; i < n; i++)
        for(int j = 0; j <= 90000; j++) {
            add(F[i + 1][j + A[i + 1]], F[i][j]);
            add(F[i + 1][j], F[i][j] * 2);
            add(G[i + 1][j + A[i + 1]], G[i][j]);
            add(G[i + 1][j], G[i][j]);
        }
    ll ans = 1;
    for(int i = 1; i <= n; i++) ans = ans * 3 % P;
    ll sum = 0;
    for(int i = 1; i <= n; i++) sum += A[i];
    for(int i = (sum + 1) / 2; i <= sum; i++) ans = (ans - 3 * F[n][i]) % P;
    if(sum % 2 == 0) ans = (ans + G[n][sum / 2] * 3) % P;
    printf("%lld\n", (ans % P + P) % P);
    return 0;
}

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

int main(){
    double N;
    cin >> N;
    int a[100];
    for(int i=0;i<N;i++) cin >> a[i];
    double ave=0;
    for(int i=0;i<N;i++) ave += a[i];
    ave = (int)round(ave/N);

    int k=0;
    for(int i=0;i<N;i++){
       
      k+= pow(a[i]-ave,2);

    }

    cout << k << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ri(x) scanf("%d",&(x))
#define ri2(x,y) scanf("%d %d",&(x),&(y))
#define ri3(x,y,z) scanf("%d %d %d",&(x),&(y),&(z))
#define rll(x) scanf("%lld",&(x))
#define rll2(x,y) scanf("%lld %lld",&(x),&(y))
#define rll3(x,y,z) scanf("%lld %lld %lld",&(x),&(y),&(z))
#define gc(x) ((x) = getchar())
using namespace::std;

const long double PI = acos(-1);
const long long MOD = 1000000000 +7;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> tll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<tll> vtll;
typedef vector<string> vs;
typedef set<int> si;
typedef set<ii> sii;
typedef set<iii> siii;

ll gcd(ll a, ll b){ return b==0?a:gcd(b,a%b);}

ll add(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a+b;
	if(res >= m or res <= -m) res %= m;
	if(res < 0) res += m;
	return res;
}

ll mul(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a*b;
	if(res >= m or res <= -m) res %= m;
	if(res < 0) res += m;
	return res;
}

ll pow_mod(ll a, ll b, ll m = MOD){
	ll res = 1LL;
	a = a%m;
	while(b){
		if(b&1) res = mul(res,a,m);
		b >>= 1;
		a = mul(a,a,m);
	}
	return res;
}

ll fastexp(ll a, ll b){
	ll res = 1LL;
	while(b){
		if(b&1) res = res*a;
		b >>= 1;
		a *= a;
	}
	return res;
}

int gcdExtendido(int a, int b, int *x, int *y){
	if(a == 0){
		*x = 0;
		*y = 1;
		return b;
	}
	int x1, y1;
	int gcd = gcdExtendido(b%a,a,&x1,&y1);
	
	*x = y1-(b/a)*x1;
	*y = x1;
	return gcd;
}

int modInverso(int a, int m){
	int x, y;
	int g = gcdExtendido(a,m,&x,&y);
	if(g!=1) return -1;
	else return (x%m + m)%m;
}

/****************************************
*************P*L*A*N*T*I*L*L*A************
*****************************************/

int main(){
	char c;
	c = getchar();
	puts(c == 'a' or c == 'e' or c == 'i' or c == 'o' or c == 'u'?"vowel":"consonant");
	return 0;
}


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

int N;
vector<string> W;

int main()
{
	cin >> N;
	W.resize(N);
	for (int i = 0; i < N; ++i)
		cin >> W[i];
	bool b = true;
	for (int i = 1; i < N; ++i) {
		if (W[i - 1].back() != W[i].front() || count(W.begin(), W.end(), W[i]) != 1) {
			b = false;
			break;
		}
	}
	cout << (b ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a,b;
     cin>>a>>b;
    if((a+b)==3)
    cout<<"3"<<endl;
    else  if((a+b)==4)
    cout<<"2"<<endl;
     else  if((a+b)==5)
    cout<<"1"<<endl;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15);
  }
} initializer;

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

template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
  for (const T &t : v) s << t << endl;
  return s;
}

int main() {
  int n;
  cin >> n;
  vector<int64_t> x(n), y(n), u(n), v(n);
  for (int i = 0; i < n; ++i) cin >> x[i] >> y[i];
  for (int i = 0; i < n; ++i) {
    u[i] = x[i] + y[i];
    v[i] = x[i] - y[i];
  }
  int o = 0, e = 0;
  for (int i = 0; i < n; ++i) {
    if (u[i] % 2) ++o;
    else ++e;
  }
  if (o && e) {
    cout << -1 << endl;
    return 0;
  }
  vector<int64_t> t;
  for (int64_t i = 1ll << 31; i; i /= 2) t.emplace_back(i);
  t.emplace_back(1);
  if (o) t.emplace_back(1);
  cout << t.size() << endl;
  for (int i = 0; i < int(t.size()); ++i) cout << t[i] << (i < int(t.size()) - 1 ? ' ' : '\n');
  vector<string> res(n);
  for (int i = 0; i < n; ++i) {
    for (auto j : t) {
      if (u[i] > 0) {
        if (v[i] > 0) res[i] += 'R';
        else res[i] += 'U';
      } else {
        if (v[i] > 0) res[i] += 'D';
        else res[i] += 'L';
      }
      if (u[i] > 0) u[i] -= j;
      else u[i] += j;
      if (v[i] > 0) v[i] -= j;
      else v[i] += j;
    }
  }
  cout << res;
}



Measured memory_bytes: 512
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn rep<T, F: FnMut() -> T>(n: usize, mut f: F) -> Vec<T> {
    (0..n).map(|_| f()).collect()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let n = scan(tokens);
    let k = scan(tokens);
    let a = rep(n, || scan(tokens));
    println!("{}", solve(n, k, a));
}

fn solve(n: usize, k: usize, a: Vec<i64>) -> i64 {
    let mut a = a;
    a.sort();
    let nx = a.iter().filter(|&&ai| ai > 0).count();
    let ny = a.iter().filter(|&&ai| ai < 0).count();
    let x = &a[a.len() - nx..];
    let y = &a[..ny];
    let n_all_prod = (n * n - n) / 2;
    let n_neg_prod = nx * ny;
    let n_pos_prod = (nx * nx - nx) / 2 + (ny * ny - ny) / 2;
    if k <= n_neg_prod {
        solve_negative(k, x, y)
    } else if k > n_all_prod - n_pos_prod {
        solve_positive(k - (n_all_prod - n_pos_prod), x, y)
    } else {
        0
    }
}

fn solve_negative(k: usize, x: &[i64], y: &[i64]) -> i64 {
    let mut a = -1_000_000_000_000_000_001;
    let mut b = -1;
    while a + 1 < b {
        let c = (a + b) / 2;
        let mut count = 0;
        let mut j = 0;
        for i in 0..x.len() {
            while j < y.len() && x[i] * y[j] <= c {
                j += 1;
            }
            count += j;
        }
        if count < k {
            a = c;
        } else {
            b = c;
        }
    }
    b
}

fn solve_positive(k: usize, x: &[i64], y: &[i64]) -> i64 {
    let mut a = 0;
    let mut b = 1_000_000_000_000_000_000;
    while a + 1 < b {
        let c = (a + b) / 2;
        let mut count = 0;
        let mut j = 0;
        for i in (0..x.len()).rev() {
            while j < i && x[i] * x[j] <= c {
                j += 1;
            }
            count += j;
            if i == j {
                count += (i * i - i) / 2;
                break;
            }
        }
        count += (y.len() * y.len() - y.len()) / 2;
        let mut j = 0;
        for i in (0..y.len()).rev() {
            while j < i && y[i] * y[j] > c {
                j += 1;
            }
            count -= j;
            if i == j {
                count -= (i * i - i) / 2;
                break;
            }
        }
        if count < k {
            a = c;
        } else {
            b = c;
        }
    }
    b
}

Measured memory_bytes: 8444
#include<iostream>
#include<string>
using namespace std;
int main(){
    string s;
    cin >> s;
    bool flg = false;
    int cnt=0;
    for(int i=0; i<3; i++){
        if(s[i] == 'R'){
            if(flg){
                cnt++;
            }else{
                flg = true;
                cnt = 1;
            }
        }else{
            flg = false;
        }
    }
    cout << cnt << endl;

}



Measured memory_bytes: 3624
N = int(input().strip())
if N % 4 == 0 or N % 7 == 0:
    print("Yes")
else:
    flag = False
    for i in range(1, N//7 + 1):
        if (N - 7 * i) % 4 == 0:
            flag = True
            break
    if flag:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
       

template <typename T>
class KnuthMorrisPratt {
  int M;
  T pattern;
  vector<int> next;

 public:
  KnuthMorrisPratt(const T& pattern) : pattern(pattern) {
    M = pattern.size();
    next.resize(M);
    next[0] = -1;
    for (int i = 1, j = -1; i < M; ++i) {
      while (j != -1 && pattern[i] != pattern[j + 1]) j = next[j];
      if (pattern[j + 1] == pattern[i]) ++j;
      next[i] = j;
    }
  }

  vector<int> search(const T& text) {
    int N = text.size();
    vector<int> res;
    for (int i = 0, j = -1; i < N; ++i) {
      while (j != -1 && text[i] != pattern[j + 1]) j = next[j];
      if (pattern[j + 1] == text[i]) ++j;
      if (j == M - 1) {
        res.push_back(i - j);
        j = next[j];
      }
    }
    return res;
  }
};

int N;

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

  vector<int> c(2 * N), d(N);
  for (int i = 0; i < (int)N; ++i) {
    c[i] = a[i] ^ a[(i + 1) % N];
    c[i + N] = c[i];
    d[i] = b[i] ^ b[(i + 1) % N];
  }

  KnuthMorrisPratt<vector<int>> kmp(d);

  for (int k : kmp.search(c)) {
    if (k >= N) continue;
    int x = b[0] ^ a[k];
    cout << k << " " << x << endl;
  }

  return 0;
}


Measured memory_bytes: 9844
#include <cstdio>
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(void){
    int n,k;
    string s;
    cin >>n >>s >>k;

    for(int i = 0; i < s.size(); i++){
        if(s[i] != s[k-1]){
        printf("*");
        }else{
            printf("%c", s[k-1]);
        }
    }
    printf("\n");

    return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
A = [int(a)-1 for a in input().split()]

order = [-1] * N
s = []
now = 0
c = 0
a = None
b = None
while True:
    order[now] = c
    s.append(now)
    now = A[now]
    c += 1
    if order[now] >= 0:
        a = c - order[now]
        b = order[now]
        break
if K <= b:
    print(s[K] + 1)
else:
    K -= b
    K %= a
    print(s[K + b] + 1)


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

const int INF = 2147483647;

//Segment Tree for Range Maximum Query
class SegmentTree{
public:
  int n;
  vector<int> node;
  SegmentTree(vector<int> a){
    int n_ = a.size();
    n=1;
    while(n<n_)n*=2;  // rounding to power of 2
    node.resize(2*n-1, INF);
    for(int i=0;i<n_;i++)node[n-1+i] = a[i];
    for(int i=n-2;i>=0;i--)node[i] = min(node[2*i+1], node[2*i+2]);
  }

  //return maximum value in [a,b). ( [l,r) is interval in which k is.)
  int RMQ(int a,int b,int k=0,int l=0,int r=0){
    if(l>=r)r = n;
    if(r<=a || b<=l)return INF;
    if(a<=l && r<=b)return node[k];
    int vl = RMQ(a,b,2*k+1,l,(l+r)/2);
    int vr = RMQ(a,b,2*k+2,(l+r)/2,r);
    return min(vl,vr);
  }
  
  void update(int k, int v){
    k += n-1;
    node[k] = v;
    while(k>0){
      k = (k-1)/2;
      node[k] = min(node[k*2+1],node[k*2+2]);
    }
  }
};

int main(){
  int n,q;
  cin >> n >> q;
  vector<int> a(n,INF);
  SegmentTree st(a);

  for(int i=0;i<q;i++){
    int c,x,y;
    cin >> c >> x >> y;
    if(c==0)st.update(x,y);
    else cout << st.RMQ(x,y+1) << endl;
  }
}

Measured memory_bytes: 2844
#"1"の座標を、最初のものを(0,0)として切り出し
def trim(mp):
  ret = []

  for x in range(8):
    for y in range(8):
      if mp[y][x] == "1":
        if not ret:
          refer = (x, y)
        ret.append((x, y))

  ret = [(x - refer[0], y - refer[1]) for x, y in ret]
  return ret

#座標が一致したものを出力
def put_ans(points):
  if points == [(0, 0), (0, 1), (1, 0), (1, 1)]: print("A")
  if points == [(0, 0), (0, 1), (0, 2), (0, 3)]: print("B")
  if points == [(0, 0), (1, 0), (2, 0), (3, 0)]: print("C")
  if points == [(0, 0), (0, 1), (1, -1), (1, 0)]: print("D")
  if points == [(0, 0), (1, 0), (1, 1), (2, 1)]: print("E")
  if points == [(0, 0), (0, 1), (1, 1), (1, 2)]: print("F")
  if points == [(0, 0), (1, -1), (1, 0), (2, -1)]: print("G")

while True:
  mp = [input() for _ in range(8)]
  put_ans(trim(mp))
  try:
    input()
  except EOFError:
    break


Measured memory_bytes: 5580
import sys

mod = 10**9+7

N,K = map(int,input().split())

A = list(map(int,input().split()))

det = -1###Aのすべての要素が負か否か
for i in range(K):
    if A[i] >= 0:
        det = 1
        break

if det == -1 and K%2 == 1:
    value = 1
    A.sort(reverse = True)
    for i in range(K):
        value *= A[i]
        value %= mod
    print(value)
    sys.exit(0)

A.sort(key = lambda x:abs(x), reverse = True)

###
#print(A[(K-100):K])
#print(A[K:(K+100)])
###

value = 1
sgn = 1
for i in range(K):
    value *= A[i]
    value %= mod
    if A[i] < 0:
        sgn *= -1
    elif A[i] == 0:
        sgn = 0

#print(sgn,value)

if N==K:
    print(value)

elif sgn >=0:
    print(value)
else:
    ###この場合、A[0],...,A[K-1]の中に0はないと断言できることに注意

    X = ['','']###A[K-1],A[K-2],...の中にある絶対値最小の正の数、負の数の絶対値
    num = K
    while (X[0] == '' or X[1] == '') and num > 0:
        #print(A[num])
        num -= 1
        if A[num] > 0 and X[0] == '':
            X[0] = A[num]
        elif A[num] < 0 and X[1] == '':
            X[1] = A[num]
        ###
        #print(X)
        ###
    
    Y = ['','']###A[K], A[k+1],...の中にある絶対値最大の非負の数、負の数
    ###こちらでは0が登場しないとは言えない
    ###前者にだけ0を入れることでカバー
    num = K-1
    while (Y[0] == '' or Y[1] == '') and num < N-1:
        num += 1
        if A[num] > 0 and Y[0] == '':
            Y[0] = A[num]
        elif A[num] < 0 and Y[1] == '':
            Y[1] = A[num]
    
    #print(X)
    #print(Y)

    if X[0] != '' and X[1] != '' and Y[0] != '' and Y[1] != '':
        if abs(X[0]*Y[0]) >= abs(X[1]*Y[1]):
            value *= Y[0]
            value *= pow(X[1],mod-2,mod)
            value %= mod
            print(value)
        else:
            value *= Y[1]
            value *= pow(X[0],mod-2,mod)
            value %= mod
            print(value)

    elif X[1] != '' and Y[0] != '':
        value *= Y[0]
        value *= pow(X[1],mod-2,mod)
        value %= mod
        print(value)
    
    else:
        value *= Y[1]
        value *= pow(X[0],mod-2,mod)
        value %= mod
        print(value)




Measured memory_bytes: 105444
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")
 
#define int  long long
#define rep(i,begin,end) for(__typeof(end)i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define F first
#define S second
#define sz(x) ((int)x.size())
#define pb push_back
#define pf push_front
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define mod 1000000007
#define what_is(x) cerr << #x << " is " << x <<"\n";
#define sortA(v) sort(v.begin(), v.end())
#define sortD(v) sort(v.rbegin(), v.rend())
#define PI 3.14159265358979323846
#define vout(a) for(auto x:a) cout<<x<<" ";
#define INF 10000000000000000 //1e16
 
// #define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
 
 
// using namespace __gnu_pbds;
using namespace std;
 
using ll  = long long;
using vi  = vector<int>;
using pii = pair<int,int>;
using vii = vector<pii>;
using mi  = multiset<int>;
using mii = multiset<pii>;
 
int lcm(int a,int b) {return (a*(b/__gcd(a,b)));}


 
void solve()
{
    int n,m,t,i,k,r,l,u,v,w,j,s,sum=0,pos,flag=0,count=0;
    string S,T,U; 
    // int a,b,c;
    cin>>n>>k;
    vi a(n);
    rep(i,0,n) cin>>a[i];
    int p=1;
    j=0;
    rep(i,k,n)
    {
        if(a[i]>a[j])
        {
            cout<<"Yes\n";
        }
        else cout<<"No\n";
        j++;
    }
}
 
 
signed main()
{
    #ifndef ONLINE_JUDGE 
       freopen("input.txt","r",stdin);
       freopen("output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();
        // if(t)cout<<"\n";
    }
    return 0;
}

Measured memory_bytes: 4764
N = int(input())
alp_list = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
ans = []
 
for i in range(1,12):
  if N <= 26 ** i:
    N -= 1
    for j in range(i):
      ans += alp_list[N % 26]
      N  = N // 26
    break
  else:
    N -= 26 ** i
ans.reverse()
print("".join(ans)) 

Measured memory_bytes: 9068