akhauriyash/Code-Regression huggingface dataset:
import sys
import math
input = sys.stdin.readline


def main():
    sc = Scan()
    m1 = sc.intarr()[0]
    m2 = sc.intarr()[0]

    if m1 == m2:
        print("0")
    else:
        print("1")


class Scan():

    def intarr(self):
        line = input()
        array = line.split(' ')
        num_array = [int(n) for n in array]
        return num_array

    def intarr_ver(self, n):
        return [int(input()) for _ in range(n)]

    def strarr(self):
        line = input()
        array = line.split(' ')
        array[-1] = array[-1].strip('\n')
        return array


def display(array):
    for a in range(len(array)):
        if len(array) - a != 1:
            print(array[a], end=' ')
        else:
            print(array[a])


main()


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <set>
#include <map>
#include <math.h>

#define INT_MAX       2147483647

using namespace std;

void solve()
{
	int n; cin >> n;

	vector<int> slimes(n, 0);
	for (int i = 0; i < n; i++)
	{
		cin >> slimes[i];
	}
	int cnt = 0;
	for (int i = 1; i < n; i++)
	{
		if (slimes[i] == slimes[i - 1])
		{
			cnt++;
			i++;
		}
	}
	cout << cnt << endl;
}

int main()
{

	solve();
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<map>
using namespace std;
int main()
{
    long long N; cin >> N;
    vector<long long> A(N);
    for(long long i = 0; i < N; i++)
    {
        cin >> A.at(i);
    }
    vector<long long> tum(N+1);
    tum.at(0) = 0;
    for(long long i = 0; i < N; i++)
    {
        tum.at(i+1) = tum.at(i) + A.at(i);
    }
    map<long long, long long> M;
    for(long long i = 0; i < N+1; i++)
    {
        M[tum.at(i)] += 1;
    }
    long long ans = 0;
    for(auto m = M.begin(); m != M.end();  m++)
    {
        long long s = m -> second;
        ans += s*(s-1)/2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 15872
#include <iostream>
#include <cmath>
#define COST_MAX 1000000.0
using namespace std;

struct Cell{
  double x, y, z, r;
};

int main(void) {
  int n;
  while(1) {
    cin >> n;
    if(n == 0) break;

    Cell c[n];
    for(int i = 0; i < n; i++){
      cin >> c[i].x >> c[i].y >> c[i].z >> c[i].r;
    }

    bool visited[n];
    double cost[n];
    for(int i = 0; i < n; i++) {
      visited[i] = false;
      cost[i] = COST_MAX;
    }
    cost[0] = 0.0;
    while(1) {
      double min = COST_MAX;
      int p;
      for(int i = 0; i < n; i++) {
	if(!visited[i] && cost[i] < min) {
	  min = cost[i];
	  p = i;
	}
      }
      if(min == COST_MAX) break;

      visited[p] = true;
      for(int i = 0; i < n; i++) {
	if(i == p || visited[i]) continue;
	double dist = sqrt(pow(c[p].x-c[i].x, 2)+pow(c[p].y-c[i].y, 2)
			   +pow(c[p].z-c[i].z, 2))-(c[p].r+c[i].r);
	if(dist < cost[i]) {
	  cost[i] = dist;
	}
      }
    }
    double ans = 0.0;
    for(int i = 0; i < n; i++) {
      if(cost[i] > 0.0) {
	ans += cost[i];
      }
    }
    printf("%.3f\n", ans);
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <utility>
#include <numeric>
#include <iomanip>

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

using namespace std;

int main()
{
    int a,b;
    cin >> a >> b;
    cout << 6 - a - b << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <functional>
#include <stack>
#include <set>

using namespace std;

#define ll long long

int mv[1050] = {};

int main() {
	int a, b, t;
	int ans = 0;
	cin >> a >> b >> t;

	cout << b * (t / a) << endl;

	

}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] a = new int[n];
        int max = 0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            if(max < a[i]) max = a[i];
        }
        boolean ans = false;
        if(k <= max){
            int gcd = a[0];
            for (int i = 1; i < n; i++) {
                gcd = gcd(gcd, a[i]);
            }
            for (int i = 0; i < n; i++) {
                if(k <= a[i] && (a[i] - k) % gcd == 0){
                    ans = true;
                    break;
                }
            }
        }
        if(ans) System.out.println("POSSIBLE");
        else System.out.println("IMPOSSIBLE");
        sc.close();
    }

    public static int gcd(int a, int b){
        if(a < b) return gcd(b, a);
        if(b == 0) return a;
        return gcd(b, a%b);
    }

}



Measured memory_bytes: 49920
#include<iostream>
using namespace std;
int main(void){
  char a,b;
  cin>>a>>b;
  if(a=='H'){
    if(b=='H'){
      cout<<'H'<<endl;
    }else{
      cout<<'D'<<endl;
    }
  }else{
    if(b=='H'){
      cout<<'D'<<endl;
    }else{
      cout<<'H'<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}


int main(){
  
  vector<int> G[4];
  int a,b;
  REP(i,3){
    cin>>a>>b;
    a--;b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  bool flag = true;
  REP(i,4){
    int d = G[i].size();
    if(d == 3){
      flag = false;
      break;
    }
  }
  if(flag){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
  
  return 0; 
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <numeric>
#include <mutex>
#include <cmath>
#include <set>
#include <climits>
#define lli long long int
#define ll long long
#define mod 1000000007
#define pii pair<int,int>
#define mp make_pair
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;

int main(){
        int n;
        cin >> n;
        int a[n];
        rep(i, n){
               cin >> a[i];
        }
        sort(a, a+n);
        cout << a[n/2] - a[n/2 - 1];
        return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define x first
#define y second
#define pi acos(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x) memset(x,0,sizeof(x))
#define less Less
#define EPS 1e-4
#define arg ARG
#define cpdd const pdd
#define rank Rank
#define KK 500
#define N 100005
#define MXN 200005
int main(){
    LL a,b,c;
    scanf("%lld %lld %lld",&a,&b,&c);
    if(a%2==0||b%2==0||c%2==0){
        printf("0\n");
    }
    else{
        printf("%lld\n",min(a*b,min(b*c,c*a)));
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i) = 1; (i) < (n); i++)
#define ll long long
const int MOD=1e9+7;
//nが固定値でないとき
 
vector<long long> fact_inv, inv;
 
/*  init_nCk :二項係数のための前処理
    計算量:O(k)
*/
void init_nCk(int SIZE) {
    fact_inv.resize(SIZE + 5);
    inv.resize(SIZE + 5);
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < SIZE + 5; i++) {
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD;
    }
}
 
/*  nCk :MODでの二項係数を求める(前処理 int_nCk が必要)
    計算量:O(k)
*/
long long nCk(int n, int k) {
    assert(!(n < k));
    assert(!(n < 0 || k < 0));
    long long ans = 1;
    for (int i = n; i >= n - k + 1; i--) {
        ans *= i;
        ans %= MOD;
    }
    return ans * fact_inv[k] % MOD;
}
  
int main(){
  ll s;
  cin>>s;
  init_nCk(2000);
  ll ans=0;
  for(int i=1;3*i<=s;i++){
    int amari=s-3*i;
    ans+=nCk(amari+i-1,amari);
    ans%=MOD;
  }
  cout<<ans<<endl;
}
  
      
    
    
    
    
    

    
    
  






Measured memory_bytes: 3668
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(A: int, B: int, C: int):
    l = len(set((A, B, C)))
    if l == 3 or l == 1:
        return NO
    return YES


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    print(solve(A, B, C))

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
s=int(input())
i=1
arr=[]
arr.append(s)
while(1):
    i=i+1
    #print(i)
    if s % 2==0:
        s=s/2
    else:
        s=3*s+1
    #print(s)
    if s in arr:
        print(i)
        break
    else:
      arr.append(s)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define pq priority_queue
#define P pair<int, int>
#define P2 pair<int, P>
#define P3 pair<int, P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF = 1e9, MOD = 1e9+7, around[] = {0, 1, 1, -1, -1, 0, -1, 1, 0, 0};
const int vx[] = {1, 0, -1, 0}, vy[] = {0, 1, 0, -1};
const ld PI = abs(acos(-1));
const int sqrtN = 512;
const int logN = 32;
const ll LINF=1e18;

ll n, a[100010];

bool ch(ll pos){
	for(int i = 0; i < n; i++) pos -= pos % a[i];
	
	return pos != 2;
}

int main(){
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];
	reverse(a, a + n);
	
	ll mi = 2, ma = 2;
	for(int i = 0; i < n; i++){
		if(mi % a[i]) mi = (mi + a[i] - 1) / a[i] * a[i];
		ma = ma / a[i] * a[i] + a[i] - 1;
		
		if(mi > ma){cout << -1 << endl; return 0;}
	}
	
	reverse(a, a + n);
	if(ch(mi) or ch(ma)) cout << -1 << endl;
	else cout << mi << " " << ma << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ld pi = 3.14159265358;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
template<class T> inline bool change(T a,T b){if(a > b){swap(a,b);return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
ll fac[cmax], finv[cmax], inv[cmax];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; 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;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N,M;
    cin >> N >> M;
    vector<vector<char>> moto(N,vector<char>(N)),tem(M,vector<char>(M));
    rep(i,N)
    rep(j,N)cin >> moto[i][j];
    rep(i,M)
    rep(j,M)cin >> tem[i][j];
    ll ans = 0;
    rep(i,N - M + 1){
        rep(j,N - M + 1){
            bool ok = true;
            rep(k,M){
                rep(l,M){
                    if(moto[i + k][j + l] != tem[k][l])ok = false;
                }
            }/*
            rep(k,M){
                rep(l,M){
                    cout << moto[i + k][j + l];
                }
                cout << "\n";
            }
            cout << "\n";*/
            if(ok){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No\n";
}


Measured memory_bytes: 3500
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i,a,b) for(int  i=(a); i<(b);++i)
#define ff(i,a,b) for(int  i=(a); i>=(b);--i)
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s,ss;
    cin>>s>>ss;
    int mx=0;
    f(i,0,s.size()-ss.size()+1){
        int k=0,cnt=0;
        f(j,i,i+ss.size()){
            if(s[j]==ss[k++]) cnt++;
            }
            mx=max(mx,cnt);
        }
        //cout<<mx;
        if(mx>0) cout<<ss.size()-mx<<endl;
        else cout<<ss.size()<<endl;

    return 0;
}




Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,x=1,p=0,s=0,a,c;
    queue <int> q;
    scanf("%lld",&n);
    while(1){
        p++;
        x*=26;
        s+=x;
        if(n<=s) break;
    }
    c=0;
    if(n<27) q.push(n);
    else{
        for(int i=1;i<p;i++) n-=pow(26,i);
        while(1){
            a=pow(26,p-1);
            if(n>a) n-=a,c++;
            else{
                q.push(c+1);
                p--,c=0;
            }
            if(p==1){
                q.push(n);
                break;
            }
        }
    }
    while(!q.empty()){
        printf("%c",q.front()+'a'-1);
        q.pop();
    }
    return 0;
}


Measured memory_bytes: 4136
def BC132_D():
    n, k = list(map(int, input().split(' ')))
    f = [1] * max(k, n - k + 2)
    for i in range(1, len(f)):
        f[i] = f[i - 1] * i

    def comb(n, r):
        if n < r: return 0
        return f[n] // f[r] // f[n - r]

    for i in range(1, k + 1):
        print(comb(k - 1, i - 1) * comb(n - k + 1, i) % (10**9 + 7))

BC132_D()

Measured memory_bytes: 44400
n = int(input())
L = [[-1]*n for _ in range(n)]
for i in range(n):
    a = int(input())
    for j in range(a):
        x, y = map(int, input().split())
        x -= 1
        L[i][x] = y
#print(L)

ans = 0
for i in range(2**n):
    temp = 0
    for j in range(n):
        if (i >> j) & 1:
            temp += 1
    flag = True
    for j in range(n):
        if (i >> j) & 1:
            for k in range(n):
                #print((i >> k) & 0)
                if  L[j][k] == 1 and ((i >> k) & 1) == 0:
                    flag =  False
                elif L[j][k] == 0 and ((i >> k) & 1) != 0:
                    flag = False
                else:
                    pass
    if flag:
        ans = max(ans, temp)
print(ans)

Measured memory_bytes: 45532
#include <iostream>
// #include <vector>
// #include <algorithm>
// #include <cmath>
// #include <string>
// #include <map>
// #include <set>
// #include <iomanip>

// #define MOD 1000000007

using namespace std;
// typedef unsigned long long ull;
// typedef long long ll;

// void p() {
//     cout << "\n";
// }
// template<class Head, class... Body>
// void p(Head head, Body... body) {
//     cout << head << ",";
//     p(body...);
// }

// template<typename T>
// ostream& operator<<(ostream& os, const vector<T>& v) {
//     os << "[";
//     for (const auto i : v) {
//         os << i << " ";
//     }
//     os << "]";
//     return os;
// }


int main(int argc, char const *argv[]) {
    string O, E;
    cin >> O >> E;
    for (unsigned int i = 0; i < O.length(); ++i) {
        cout << O[i];
        if (i < E.length()) {
            cout << E[i];
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val ss = next().toSet()

    ('a'..'z').forEach {
        if (!ss.contains(it)) {
            println(it)
            return
        }
    }

    println("None")
}

fun next() = readLine()!!

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 34628
#include <stdio.h>
#include <string.h>

int main(void){
  char S[15];
  int num[15];
  int n;
  int i,j=1, x=0;
  
  gets(S);
  n=strlen(S);
  
  for(i=0; i<n; i++){
    if(S[i]=='o'){
      x++;
    }
    num[i]=x;
  }
  
  if(n<8){
    j=0;
  }
  
  for(i=7; i<n; i++){
    x=num[i];
    if(i-x<7){
      j=0;
    }else{
      j=1;
    }
  }
  
  if(j==0){
    printf("YES");
  }else{
    printf("NO");
  }
  
  return 0;
}

Measured memory_bytes: 128
import sys
 
class Node:
    def __init__(self, key):
        self.key = key
        self.left = self.right = None
 
root = None
 
def insert(key):
    global root
    x, y = root, None
    while x != None: x, y = x.left if key < x.key else x.right, x
    if y == None: root = Node(key)
    elif key < y.key: y.left = Node(key)
    else: y.right = Node(key)
 
def find(target):
    result = root
    while result and target != result.key:
        result = result.left if target < result.key else result.right
    return result == None
 
def inorder(node):
    return inorder(node.left) + f' {node.key}' + inorder(node.right) if node else ''
def preorder(node):
    return f' {node.key}' + preorder(node.left) + preorder(node.right) if node else ''
 
input()
for e in sys.stdin:
    if e[0] == 'i': insert(int(e[7:]))
    elif e[0] == 'f': print(['yes','no'][find(int(e[5:]))])
    else: print(inorder(root)); print(preorder(root))


Measured memory_bytes: 94736
#include<iostream>
#include<cmath>
#include<map>
#include<deque>
#include<string>
#include<algorithm>
typedef long long ll;

#define all(x) (x).begin(),(x).end()
#define puts(x) cout<< x << endl;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define fore(i,a) for(auto i:a)

using namespace std;
ll n,a,b;
ll d[20005];//leftからrightまでの距離
int main(){
    cin>>n>>a>>b;
    rep(i,0,2005){
        d[i]=0;
    }
    rep(i,1,n+1){
        rep(j,1,n+1){
            ll k = abs(i-j);
            k=min(k,abs(a-i)+abs(b-j)+1);
            k=min(k,abs(b-i)+abs(a-j)+1);
            d[k]+=1;
        }
    }
    for(ll i=1;i<n;i++){
        puts(d[i]/2);
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>

double Area( double r )
{
    return r * r * M_PI;
}
double Circumference( double r )
{
    return 2 * r * M_PI;
}

int main()
{
    double r;
    std::cin >> r;

    std::cout.setf( std::ios_base::fixed,std::ios_base::floatfield );
    std::cout << std::setprecision( 15 )
        << Area( r ) << " " << Circumference( r )
        << std::endl;

    return 0;
}

Measured memory_bytes: 1288
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 18;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

int main() {
	int N;
	scanf("%d", &N);
	printf("%d\n", 800 * N - 200 * (N / 15));
	return 0;
}

Measured memory_bytes: 256
import math
 
A, B = list(map(int, input().split()))
x_minA = math.ceil(100 / 8 * A)
x_minB =  10 * B
x_maxA = math.floor(100 / 8 * (A+1))
x_maxB = 10 * (B+1)
if x_minA > x_maxB or x_minB > x_maxA:
  print(-1)
else:
  for x in range(max(x_minA, x_minB), min(x_maxA, x_maxB)+1):
    if int(x * 8 / 100) == A and int(x / 10)==B:
      print(x)
      break
  else:
    print(-1)

Measured memory_bytes: 3064
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define P pair<int, int>
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
const int MAX_N = 200000;

int bit[MAX_N + 1], n, q;

void init(){
  memset(bit, 0, sizeof(bit));
}

int sum(int i){
  int ret = 0;
  while(i > 0){
    ret += bit[i];
    i -= (i & -i);
  }
  return ret;
}

void add(int i, int x){
  while(i <= n){
    bit[i] += x;
    i += (i & -i);
  }
}

int main() {
  cin >>n >>q;
  init();
  REP(i, q){
    int query, x, y;
    cin >>query >>x >>y;
    if(query){
      if(x == 0) cout <<sum(y) <<endl;
      else cout <<sum(y) - sum(x - 1) <<endl;
    } else
      add(x, y);
  }
  return 0;
}

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

bool isPrime(int n){
  if(n < 2) return false;
  for(int i=2;i*i <= n;i++){
    if(n % i == 0) return false;
  }
  return true;
}

int main(){
  int n;
  int a,d;

  /*vector<int> prime(N);
  for(int i=0;i < N;i++) prime[i]=i;
  
  for(int i=2;i < sqrt(N);i++){
    if(prime[i]){
      for(int j=0;i*(j+2) < N;j++){
	prime[i*(j+2)]=0;
      }
    }
    }*/
  
  while(scanf("%d%d%d",&a,&d,&n),a || d || n){
    int ans = a;
    while(1){
      if( isPrime(ans) ) n--;
      if(n==0)break;
      ans += d;
    }
    printf("%d\n",ans);
  }
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int N, M; cin >> N >> M;
	vector<int> bitA(N, 0);
	rep (i, N){
		int K; cin >> K;
		rep (j, K){
			int a; cin >> a;
			bitA[i] |= (1<<(a-1));
		} // end rep
	} // end rep
	
	int ans = (1<<M) - 1;
	rep (i, N){
		ans &= bitA[i];
	} // end rep

	int res = __builtin_popcount(ans);
	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace ConsoleApp2
{
    public class Program
    {

        static long D = (long)Math.Pow(10, 9) + 7;

        public struct Q_State
        {
            public int pNum;
            public bool ac;
        }

        public static void Main(string[] args)
        {
            int[] NM = Read(Console.ReadLine());
            int N = NM[0];
            int M = NM[1];

            Q_State[] Q_As = new Q_State[N+1];
            int pNum = 0;
            int acNum = 0;

            for (int i = 0; i < M; i++)
            {
                string[] read = Console.ReadLine().Split(' ');
                bool res = read[1] == "AC";
                int question = int.Parse(read[0]);

                if (res)
                {
                    if (!Q_As[question].ac)
                    {
                        Q_As[question].ac = true;
                        acNum++;
                        pNum += Q_As[question].pNum;
                    }
                }
                else
                {
                    if (!Q_As[question].ac) Q_As[question].pNum++;
                }

            }

            Console.WriteLine(acNum+" "+pNum);

            Console.ReadLine();
        }


        private static int[] Read(string input)
        {
            string[] aaa = input.Split(' ');
            int num = aaa.Length;
            int[] ints = new int[num];
            for (int i = 0; i < num; i++)
            {
                ints[i] = int.Parse(aaa[i]);
            }
            
            return ints;
        }


    }


}


Measured memory_bytes: 15816
#include <bits/stdc++.h>
#define mn(a, b) (a < b ? a : b)
#define mx(a, b) (a > b ? a : b)
#define f first
#define s second
#define all(v) (v).begin(), (v).end()
#define base 331

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int const MAXn = 2e5 + 2;

int h[MAXn];
ll ABI[MAXn];
int n;

void update(int pos, ll val){
    while(pos <= n){
        ABI[pos] = mx(ABI[pos], val);
        pos += (pos&-pos);
    }
}

ll query(int pos){
    ll sum = 0;
    while(pos >= 1){
        sum = mx(sum, ABI[pos]);
        pos -= (pos&-pos);
    }
    return sum;
}

int main(){

    //freopen(".in","r",stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    for(int i = 1; i <= n; i++)
        cin>>h[i];
    for(int j = 1; j <= n; j++){
        ll x;
        cin>>x;
        ll aux = query(h[j]);
        update(h[j], aux + x);
    }
    cout<<query(n);
    return 0;
}


Measured memory_bytes: 2560
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)
inline double sq(double a) { return a*a; }

struct MST {
    typedef double weight;
    static const weight INF = 1e100;
    static const int N = 128;

    int n, no[N], prev[N], mark[N], temp[N];
    vector<int> comp[N];
    weight g[N][N], mcost[N];
    
    void init(int _n) {
        n = _n;
        rep(i, n) rep(j, n) g[i][j] = INF;
    }

    void rec(int v, int s, int r, weight &cost, bool &found) {
        if(mark[v]) {
            found = true;
            memcpy(temp, no, sizeof(temp));
            for(;;) {
                cost += mcost[v];
                v = prev[v];
                if(v==s) break;
                while(comp[v].size()) {
                    no[comp[v].back()] = s;
                    comp[s].push_back(comp[v].back());
                    comp[v].pop_back();
                }
            }
            rep(j, n) if(j!=r && no[j]==s) {
                rep(i, n) if(no[i]!=s && g[i][j]<INF) g[i][j] -= mcost[temp[j]];
            }
        }
        mark[v] = 1;
        rep(i, n) if(no[i]!=no[v] && prev[no[i]]==v) {
            if(!mark[no[i]] || i==s) rec(i, s, r, cost, found);
        }
    }

    weight solve(int r) {
        rep(i, n) {
            no[i] = i;
            comp[i].clear();
            comp[i].push_back(i);
        }
        weight cost = 0;
        for(;;) {
            memset(prev, -1, sizeof(prev));
            rep(i, n) mcost[i] = INF;
            rep(i, n) rep(j, n) if(j!=r && no[i]!=no[j] && g[i][j]<INF) {
                if(g[i][j] < mcost[no[j]]) {
                    mcost[no[j]] = g[i][j];
                    prev[no[j]] = no[i];
                }
            }
            bool stop = true;
            memset(mark, 0, sizeof(mark));
            rep(i, n) if(i!=r && mark[i]==0 && comp[i].size()) {
                bool found = false;
                rec(i, i, r, cost, found);
                if(found) stop = false;
            }
            if(stop) {
                rep(i, n) if(prev[i]>=0) cost += mcost[i];
                return cost;
            }
        }
    }
} mst;

int N, M;
double v[128][128];
double w[128][128];

double dot(int a, int b) {
    double s = 0;
    rep(i, N) s += v[a][i]*v[b][i];
    return s;
}

double norm(int a) { return dot(a, a); }

int main() {
    scanf("%d%d", &N, &M);
    rep(i, M) rep(j, N) scanf("%lf", v[i]+j);
    mst.init(M+1);
    rep(i, M) mst.g[M][i] = norm(i);
    rep(i, M) rep(j, M) if(i!=j) {
        if(norm(i)==0) mst.g[i][j] = norm(j);
        else mst.g[i][j] = norm(j)-sq(dot(i, j))/norm(i);
    }
    printf("%.9f\n", mst.solve(M));
    return 0;
}

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

int main() {
    int x, a;
    cin >> x >> a;
    if (x < a) {
        cout << 0 << endl;
    } else {
        cout << 10 << endl;
    }

    return 0;
}

Measured memory_bytes: 3592
import java.util.*;


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

    Scanner sc = new Scanner(System.in);
    String ans = "";
    int N = sc.nextInt();
    int[] A = new int[N];
    for(int i = 0;i < N;i++){
      A[i] = sc.nextInt();
    }
    Arrays.sort(A);
    for(int i = 0;i < N-1;i++){
      if(A[i] == A[i+1]){
        ans = "NO";
        break;
      }else{
        ans = "YES";
      }
    }
    System.out.print(ans);
  }
}


Measured memory_bytes: 64652
#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>;
vector<int> vc(3);
bool ok = false;
void rec(int i, int a, int b) {
    if(i==3){
        if(a==b) ok = true;
        return;
    }
    rec(i+1, a+vc[i], b);
    rec(i+1, a, b+vc[i]);
}
int main(void) {
    rep(i, 3) cin >> vc[i];
    rec(0, 0, 0);
    if(ok) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 256
while true do

	inpuLines = gets.split.map(&:to_i);
	
	num = inpuLines[0];
	sum = inpuLines[1];
	
	if num == 0 && sum == 0 then
		break;
	end
	
	count = 0;
	
	for num1 in 1..num do
		for num2 in num1+1..num do
			for num3 in num2+1..num do
				if num1 + num2 + num3 == sum then
					count += 1;
				end
			end
		end
	end
	
	puts count.to_s;
end

Measured memory_bytes: 8776
b,k = map(int,input().split())
a = list(map(int,input().split()))

i = 0
check = [True]*b
his = []
n = 0
his.append(0)
while(1):
    #print(his)
    i = a[i] - 1
    if check[i]:
        check[i] = False
        his.append(i)
    else:
        n = len(his)-his.index(i)
        break
m = len(his) - n
p = 0
if k > m:
    p = (k-m)%n + m
else:
    p = k
i = 0
#print(n,m,p)
for j in range(p):
    #print(a[i])
    i = a[i] - 1
print(i+1)



Measured memory_bytes: 102188
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}
ll at[30][30];
ll bt[30][30];
ll ar[30];
ll upt[30][30][30];
ll mid(ll x, ll y, ll z) {
	if (x <= y && y <= z) {
		return y;
	}
	else if (y <= x && x <= z) {
		return x;
	}
	else return z;
}
int c[30];
bool ta[101][101];
void solv() {
	int h, w;
	cin >> h >> w;
	string t[101];
	for (size_t i = 0; i < h; i++)
	{
		cin >> t[i];
		for (size_t j = 0; j < w; j++)
		{
			c[t[i][j] - 'a']++;
		}
	}

	priority_queue<int> needs;
	for (size_t i = 0; i < h / 2 + (h % 2); i++)
	{
		for (size_t j = 0; j < w / 2 + (w % 2); j++)
		{
			int need = 0;
			if (i != (h - 1) - i) {
				need += 2;
			}
			else {
				need += 1;
			}
			if (j != (w - 1) - j) {
				need *= 2;
			}
			needs.push(need);
		}
	}
	while (!needs.empty())
	{
		int need = needs.top();
		needs.pop();
		bool find = false;

		for (size_t k = 0; k < 30; k++)
		{
			if (c[k] >= need) {
				c[k] -= need;
				find = true;
				break;
			}
		}
		if (!find) {
			cout << "No" << endl;
			return;
		}

	}
	cout << "Yes" << endl;

}


int main() {
	solv();

	return 0;
}


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

int main(){
  int n; cin >> n;
  int ans = 0;
  vector<vector<int>> ame(2, vector<int>(n));
  for(int i = 0; i < 2; i++){
    for(int j = 0; j < n; j++){
      cin >> ame.at(i).at(j);
    }
  }
  for(int i = 0; i < n; i++){
    int tmp = 0;
    tmp = ame.at(1).at(i);
    for(int j = 0; j < n; j++){
      if(j <= i) tmp += ame.at(0).at(j);
      else tmp += ame.at(1).at(j);
    }
    ans = max(tmp, ans);
  }
  cout << ans << endl;
}

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

namespace null_null {

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using usize = std::size_t;

} // namespace null_null

namespace null_null {

void main_() {
  i64 N;
  std::cin>>N;
  std::cout<<(N-1)*N/2<<std::endl;
}

} // namespace null_null

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  null_null::main_();
  return 0;
}

Measured memory_bytes: 256
//“Make it work, make it right, make it fast.” – Kent Beck
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double dd;
const int siz = 1e6 + 5;
const int MOD = 1e9 + 7;
#define endl '\n'
#define deb(x) cout << #x << " = " << x << endl;

void solve() {
  double d, t, s;
  cin >> d >> t >> s;
  if(d/s <= t)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout << fixed << setprecision(10);
  int t = 1;
  //cin >> t;
  for(int tt = 1; tt <= t; tt++) {
    //cout << "Case #" << tt << ": ";
    solve();
  }
  return 0;
}  

Measured memory_bytes: 3748
def resolve():
    N = int(input())
    h = [int(i) for i in input().split()]
    dp = [float("inf")] * N
    dp[0] = 0
    dp[1] = abs(h[1] - h[0])
    for i in range(2, N):
        dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]),
                    dp[i - 1] + abs(h[i] - h[i - 1]))
    print(dp[-1])


resolve()


Measured memory_bytes: 13976
fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(' ').map { it.toInt() }
    val xs = readLine()!!.split(' ').map { it.toInt() }.sorted()

    val ds = mutableListOf<Int>();

    for (i in (0 until m - 1)) {
        ds.add(Math.abs(xs[i] - xs[i + 1]))
    }

    ds.sort()

    var res = 0
    for (i in (0 .. ds.size - n)) {
        res += ds[i]
    }
    println(res)
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define RALL(a)     (a).rbegin(),(a).rend()
#define PRINT(a)   cout << (a) << endl

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second

#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

using ll = long long int;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

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

const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

int main(){
  int x;
  cin >> x;
  cout << 10 - (x / 200) << endl;
}



Measured memory_bytes: 3612
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static System.Console;
class Z { static void Main() => new K(); }
class K
{
	int[] G => ReadLine().Split().Select(int.Parse).ToArray();
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	int V, Mod;
	List<int>[] es;
	int[] par;
	long[] dp0, dp1;
	void Solve()
	{
		var I = G;
		V = I[0];
		Mod = I[1];
		es = new List<int>[V];
		par = new int[V];
		dp0 = new long[V];
		dp1 = new long[V];
		for (var u = 0; u < V; u++) es[u] = new List<int>();
		for (var e = 0; e < V - 1; e++)
		{
			I = G;
			es[I[0] - 1].Add(I[1] - 1);
			es[I[1] - 1].Add(I[0] - 1);
		}
		DFS1Exe(0, -1);
		DFS2(0);
		DFS3(0);
		for (var u = 0; u < V; u++) WriteLine(dp0[u] * (dp1[u] + 1) % Mod);
	}
	void DFS1Exe(int u, int p)
	{
		var st = new Stack<object>();
		st.Push(new A0 { u = u, p = p });
		while (st.Count > 0)
		{
			var f = st.Pop();
			if (f is A0)
			{
				var g = (A0)f;
				par[g.u] = g.p;
				es[g.u].Remove(g.p);
				st.Push(new A1 { u = g.u, p = g.p, i = 0 });
			}
			else //if (f is A1)
			{
				var g = (A1)f;
				if (g.i < es[g.u].Count)
				{
					st.Push(new A1 { u = g.u, p = g.p, i = g.i + 1 });
					st.Push(new A0 { u = es[g.u][g.i], p = g.u });
				}
			}
			//else if (f is A2)
			//{
				//var g = (A2)f;
				//st.Push(new A1 { u = g.u, p = g.p, i = g.i + 1 });
			//}
		}
	}
	void DFS1(int u, int p)
	{
	a0:
		par[u] = p;
		es[u].Remove(p);
		var i = 0;
	a1:
		if (i < es[u].Count)
		{
			DFS1(es[u][i], u);
		a2:
			i++;
			goto a1;
		}
	}
	void DFS2(int u)
	{
	b0:
		dp0[u] = 1L;
		var i = 0;
	b1:
		if (i < es[u].Count)
		{
			DFS2(es[u][i]);
		b2:
			dp0[u] = dp0[u] * (dp0[es[u][i]] + 1) % Mod;
			i++;
			goto b1;
		}
	}
	void DFS3(int u)
	{
	c0:
		{
			var W = es[u].Count;
			var x = new long[W + 1];
			var y = new long[W + 1];
			x[0] = y[W] = 1;
			for (var i = 0; i < W; i++) x[i + 1] = x[i] * (dp0[es[u][i]] + 1) % Mod;
			for (var i = W - 1; i >= 0; i--) y[i] = y[i + 1] * (dp0[es[u][i]] + 1) % Mod;
			for (var i = 0; i < W; i++) dp1[es[u][i]] = (dp1[u] + 1) * x[i] % Mod * y[i + 1] % Mod;
			x = y = null;
		}
		var j = 0;
	c1:
		if (j < es[u].Count)
		{
			DFS3(es[u][j]);
		c2:
			j++;
			goto c1;
		}
	}
}
struct A0 { public int u, p; }
struct A1 { public int u, p, i; }
struct A2 { public int u, p, i; }
struct B0 { public int u; }
struct B1 { public int u, i; }
struct B2 { public int u, i; }
struct C0 { public int u; }
struct C1 { public int u, j; }
struct C2 { public int u, j; }

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

int main() {
  int N;
  cin>>N;
  vector<int> a(N);
  for(int i=0;i<N;i++){
    cin>>a[i];
  }
  int ans=int(pow(3,N));
  int res=1;
  for(int i=0;i<N;i++){
    if(a[i]%2==0) res*=2;
    else res*=1;
  }
  cout<<ans-res<<endl;
  }


Measured memory_bytes: 256
n,k = map(int,input().split())
r, s, p = map(int,input().split())
t = list(input())

dic = {'r':p, 's':r, 'p':s}
score = 0
for i in range(n):
    if t[i] == 0:continue
    score += dic[t[i]]
    if i + k < n and t[i + k] == t[i]:
        t[i + k] = 0
print(score)

Measured memory_bytes: 4084
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
string s;
int i;
void print(int x){
  for(int j=x-1;j>=0;j--){
    cout << s[i-j];
  }
  cout << endl;
}
int main(){
 
  cin >> s;
   i=s.length()-1;
  while(i!=-1){
   
    if(i<4){
      printf("NO\n");
      return 0;
    }
    else if(s[i]=='m' && s[i-1]=='a' && s[i-2]=='e' && s[i-3]=='r' && s[i-4]=='d')i-=5;
    else if(s[i]=='e' && s[i-1]=='s' && s[i-2]=='a' && s[i-3]=='r' && s[i-4]=='e')i-=5;
    else if(s[i]=='r' && s[i-1]=='e' && s[i-2]=='s' && s[i-3]=='a' && s[i-4]=='r' && s[i-5]=='e')i-=6;
    else if(s[i]=='r' && s[i-1]=='e' && s[i-2]=='m' && s[i-3]=='a' && s[i-4]=='e' && s[i-5]=='r' && s[i-6]=='d')i-=7;
   
    else{
      printf("NO\n");
      return 0;
    }
    
  }
  printf("YES\n");
  return 0;
}


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

using namespace std;

const int MAX_N = 1<<17;

class RMQ{
public:
  int n,dat[2*MAX_N-1];
  
  void init(int n_){
    n = 1;
    while(n < n_){ n *= 2; }
    for(int i = 0 ; i < 2*n-1 ; i++){
      dat[i] = INT_MAX;
    }
  }
  
  void update(int k,int a){
    k += n - 1;
    dat[k] = a;
    while(k > 0){
      k = (k - 1) / 2;
      dat[k] = min(dat[k*2+1],dat[k*2+2]);
    }
  }

  int query(int a,int b,int k,int l,int r){
    if(r <= a || b <= l){ return INT_MAX; }
    if(a <= l && r <= b){
      return dat[k];
    }else{
      int vl = query(a,b,k*2+1,l,(l+r)/2);
      int vr = query(a,b,k*2+2,(l+r)/2,r);
      return min(vl,vr);
    }
  }
};

int main(){
  int n,q;
  RMQ rmq;
  cin >> n >> q;
  rmq.init(n);
  for(int i = 0 ; i < q ; i++){
    int com,x,y;
    cin >> com >> x >> y;
    if(com == 0){
      rmq.update(x,y);
    }else{
      cout << rmq.query(x,y+1,0,0,rmq.n) << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 2188
#include<stdio.h>
int main()
{
    char a,b;
    while(scanf("%c %c",&a,&b)==2)
    {
        if(a=='H'&&b=='H')
            printf("H\n");
        else if(a=='H'&&b=='D')
            printf("D\n");
        else if(a=='D'&&b=='H')
            printf("D\n");
        else if(a=='D'&&b=='D')
            printf("H\n");
            getchar();
    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <algorithm>

using namespace std;

int main() {
  int N;
  string buf;
  vector<string> A;
  unordered_map<string, int> Dict;
  
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> buf;
    if (Dict.find(buf) == Dict.end()) {
      Dict[buf] = 0;
    }
    Dict[buf]++;
  }
  
  int max_count = -1;
  vector<string> max_str;
  for (auto i = Dict.begin(); i != Dict.end(); ++i) {
    int count = i->second;
    string str = i->first;
    if (count > max_count) {
      max_count = count;
      max_str.clear();
      max_str.push_back(str);
    } else if (count == max_count) {
      max_str.push_back(str);
    }
  }
  
  sort(max_str.begin(), max_str.end());
  
  for (int i = 0; i < max_str.size(); i++) {
    cout << max_str[i] << endl;
  }
  
  return 0;
}

Measured memory_bytes: 26692
/************************************
 TEMPLATE FOR PROGRAM COMPETITION
 ***********************************/
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <vector>

const int V_MAX = 1e5;

int main(){
  
  // preparation
  int n, tmp;
  std::vector<int> count_odd(V_MAX);
  std::vector<int> count_even(V_MAX);
  
  for(int i = 0; i < 1e5; i++){
    count_odd[i] = 0;
    count_even[i] = 0;
  }
  
  //read problem from input
  scanf("%d", &n);
  for(int i = 0; i < n/2; i++){
    scanf("%d", &tmp);
    count_odd[tmp-1] ++;
    scanf("%d", &tmp);
    count_even[tmp-1] ++;
  }
  
  // solve problem
  int count1_odd = -1, count2_odd=-2, v1_odd, v2_odd;
  int count1_even = -1, count2_even = -2, v1_even, v2_even;
  
  for(int i = 0; i < V_MAX; i++){
    // update two max counts of odd
    if(count_odd[i] > count1_odd){
      count2_odd = count1_odd;
      v2_odd = v1_odd;
      count1_odd = count_odd[i];
      v1_odd = i;
    }
    else if(count_odd[i] > count2_odd){
      count2_odd = count_odd[i];
      v2_odd = i;
    }
    // update two max counts of even
    if(count_even[i] > count1_even){
      count2_even = count1_even;
      v2_even = v1_even;
      count1_even = count_even[i];
      v1_even = i;
    }
    else if(count_even[i] > count2_even){
      count2_even = count_even[i];
      v2_even = i;
    }
  }
  
  if(v1_odd != v1_even){
    std::cout << n - count1_odd - count1_even;
  }
  else{
    std::cout << n - std::max(count1_odd + count2_even, count2_odd + count1_even);
  }
  
  return 0;
}


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

using namespace std;

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    map<int,int>mp;
    mp[a]++;mp[b]++;
mp[c]++;

  if(mp[a]==1)cout<<a<<endl;
  else if(mp[b]==1)cout<<b<<endl;
  else if (mp[c]==1)cout<<c<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
int n,m;
ll mypow(int x,int t){
	ll ans=1,res=x;
	while(t){
		if(t&1)ans=ans*res%MOD;
		res=res*res%MOD,t>>=1;
	}
	return ans;
}
ll a[600004],inv[600004];
void init(){
	a[0]=1,inv[1]=1;
	for(int i=1;i<=6e5;i++)
		a[i]=a[i-1]*i%MOD;
	for(int i=2;i<=6e5;i++)
		inv[i]=(MOD-MOD/i)*inv[MOD%i]%MOD;
	inv[0]=1;
	for(int i=1;i<=6e5;i++)inv[i]=inv[i-1]*inv[i]%MOD;
}
ll C(int A,int B){
	return a[A]*inv[B]%MOD*inv[A-B]%MOD;
}
ll C1(int A,int B){
	return a[A]*inv[A-B]%MOD;
}
int main(){
	init();
	cin>>n>>m;
	ll ans=C1(m,n);
//	while(cin>>n>>m)cout<<C(m,n)<<"\n"; 
//	cout<<ans<<"\n";
	for(int i=1;i<=n;i++){
		ll ret=C(n,i)*C1(m-i,n-i)%MOD;
//		cout<<n<<" "<<i<<" "<<m-i<<" "<<n-i<<"\n";
		if(i%2==1)ans=(ans-ret+MOD)%MOD;
		else ans=(ans+ret)%MOD;
//		cout<<i<<" "<<ans<<"\n";
	}
	cout<<C1(m,n)*ans%MOD;
}

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

#define MOD 1000000007

int n;
string s;
long long cnt[200] = {};

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

    for(int i = 0;i < n;i++){
        cnt[s[i]]++;
    }

    long long ans = 1;
    for(int i = 'a';i <= 'z';i++){
        if(cnt[i] != 0){
            ans = (ans * (cnt[i]+1))% MOD;
        }
    }

    cout << (MOD+ans-1)%MOD << endl;

    return 0;
}




Measured memory_bytes: 512
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 17;
#define int ll
#define bit(n,k) ((n >> k) & 1)
template<class T>
bool chmax(T &a, T b){if(a < b){a = b; return true;} return false;}
template<class T>
bool chmin(T &a, T b){if(a > b){a = b; return true;} return false;}

vector<vector<ll>> a(n_max, vector<ll>(n_max));
vector<ll> dp((1LL << n_max)), flag((1LL << n_max));
ll dfs(ll mask){
    // ll mask = 0;
    // for(auto &i : vec)mask |= (1LL << i);
    // debug(mask);
    if(flag[mask])return dp[mask];

    // ll n = vec.size();
    if(__builtin_popcountll(mask) == 1){
        flag[mask] = 1;
        return dp[mask] = 0;
    }
    ll ans = 0;
    rep(i,n_max){
        for(int j = i+1; j < n_max; j++)if(bit(mask,i) && bit(mask,j))ans += a[i][j];
    }
    // ans /= 2;

    for(ll i=mask; i > 0; i = (i-1) & mask){
        if(i == mask || i == 0)continue;
        chmax(ans, dfs(i) + dfs(i ^ mask));
    }
    flag[mask] = 1;
    return dp[mask] = ans;
};

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    ll n; cin >> n;
    rep(i,n)rep(j,n)cin >> a[i][j];
    // vector<ll> vec(n);
    // std::iota(all(vec), 0);
    ll mask = (1LL << n) - 1;
    cout << dfs(mask) << endl;
}

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

int main()
{
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  for (auto&& e : s) cin >> e;

  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++) {
      if (s[y][x] == '#') {
        cout << '#';
        continue;
      }
      int cnt = 0;
      for (int dy = -1; dy <= 1; dy++) {
        for (int dx = -1; dx <= 1; dx++) {
          int nx = x + dx;
          int ny = y + dy;
          if (nx < 0 || nx >= w || ny < 0 || ny >= h) continue;
          if (s[ny][nx] == '#') cnt++;
        }
      }
      cout << cnt;
    }
    cout << endl;
  }
}


Measured memory_bytes: 256