akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
     
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define mp  make_pair
#define all(v) (v).begin(), (v).end()
#define mod 1000000007  
#define mod2 998244353  
#define pi 3.14159265358979323846 

int solve(){
    int k,a,b;
    cin>>k>>a>>b;
    if(a/k!=b/k||a%k==0||b%k==0) cout<<"OK";
    else cout<<"NG";
    
    return 0;
}   
     
signed main(){
    IOS;
    int t=1;
   // cin>>t;
    while(t--){
        solve();   
        cout<<"\n";
      // cout<<" * "<<t<<"\n";
    }
//    return 0;
} 

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

typedef long long ll;

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

    int n;
    cin>>n;
    int A[n];

    for (int i=0;i<n;++i) cin>>A[i];
    sort(A, A+n);

    cout<<A[n/2]-A[n/2 - 1]<<endl;
    
    return 0;
}

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

using namespace std;
using ll =long long;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
const ll INF = 1LL << 60;
const int mod = 1e9+7;
//Write From this Line

int main()
{
//すごろく
	int n , m ;
	cin >> n >> m ;
	string s ;
	cin >> s ;
	rSORT(s);
	vector<int> ans(0); //こいつをリバースシテ最終的に出力
	int now = 0 ;
	while(1){
		for(int i = m ; i >= 0 ; i--){
			if(now + i > n ) continue;
			if(i==0){
				puts("-1");
				return 0 ;
			}
			if(s[now+i] =='0'){
				//ok
				now += i; 
				ans.push_back(i);
				break;
			}
		}
		if(now==n) break;
	}
	rSORT(ans);
	for(auto x: ans){
		cout << x << " " ;
	}cout << endl;
}


Measured memory_bytes: 1144
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
a_list = []
for i in range(n):
    a = list(map(int, input().split()))
    a_list.append(a)

count = 0
for i in range(n):
    sum = 0
    for j in range(m):
        sum += a_list[i][j] * b[j]
    sum += c
    if sum > 0:
        count += 1

print(count)


Measured memory_bytes: 3060
#include <iostream>
#include <math.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <stdlib.h>
#include <deque>  
#include <iomanip>

using namespace std;

int main(){
    int A,B;
    cin>>A>>B;
    cout<<max(max(A+B,A-B),A*B)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath> // 変数名にy1が使えなくなるかも…。
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <limits>
#include <functional>
#include <string>

typedef __int128_t int128_t;
std::istream &operator>>(std::istream& input, int128_t& value) { // int128_tの入力。入力が64bitに収まる前提。
    long long tmp; input >> tmp; value = tmp;
    return input;
}
std::ostream &operator<<(std::ostream& output, const int128_t value) { // int128_tの出力。出力が64bitに収まる前提。
    output << (long long)value;
    return output;
}

// 文字列Sに各文字が何回出現するかカウント。始まりの文字がcで、文字種類数がk
// 例えばSに含まれる文字が'a-z'であれば、c='a', k=26とする。
std::vector<int> count_char(const std::string& S, const char c, const int k) {
    std::vector<int> ret; ret.resize(k, 0);
    for (int i = 0; i < S.size(); i++) {
        assert(S[i] - c < k);
        ret[S[i] - c]++;
    }
    return ret;
}

#define rep(i, begin, end) for(int64_t i = (begin); i <= (end); i++)
#define rev(i, begin, end) for(int64_t i = (begin); (end) <= i; i--)

void printvec(const std::vector<int>& vec) {
    for (int i = 0; i < vec.size(); i++) { std::cout << vec[i] << " "; } std::cout << std::endl;
}

const int MAX_N = 1e5 + 10;
int N;
std::string S[MAX_N];
std::map<std::string, int128_t> mp;


int main(int argc, char **argv) {
    std::cin >> N;
    rep (i, 1, N) {
        std::cin >> S[i];
        std::sort(S[i].begin(), S[i].end());
        mp[S[i]]++;
    }

    int128_t ret = 0;
    for (auto p : mp) {
        ret += (p.second * (p.second - 1)) / 2;
    }

    std::cout << ret << std::endl;

    

    return 0;
}

Measured memory_bytes: 19712
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
  int r,g,b,n;
  cin >> r >> g >> b >> n;
  int ans = 0;

  for (int i = 0; i <= n; i += r)
  {
    for (int j = 0; i + j <= n; j += g)
    {
      int now = n - i - j;
      if (now % b == 0) ans++;
    }
  }
  
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3628
n=int(input())
s=[int(input()) for _ in range(n)]
s=sorted(s)
ans=sum(s)
i=0
while ans%10==0:
    if s[i]%10!=0:
        ans-=s[i]
    i+=1
    if i==n:
        break
if ans%10==0:
    print(0)
else:
    print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<map>
#include<set>
#include<queue>

using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(a) (a).begin(),(a).end()
#define PI 3.141592653589793238
#define INF 1050000000
#define INFL (long long)(4e18)

using vi = vector<int>;

template<class T>
struct Edge {
    int to;
    T cost;
    Edge() {};
    Edge(int to, T cost) : to(to), cost(cost) {};
};

template<class T>
class Graph {
    int n;
    bool directed;
    vector<vector<Edge<T>>> edges;
public:

    Graph(int n, bool directed) :n(n), directed(directed), edges(vector<vector<Edge<T>>>(n)){};
    Graph() {};

    void add(int from,int to, T cost) {
        edges[from].emplace_back(to, cost);
        if(!directed){
            edges[to].emplace_back(from,cost);
        }
    }

    int size() {
        return n;
    }
};


int main() {

    int N;

    cin >> N;

    vi P(N);
    vi Q(N);

    REP(i,N)cin >> P[i];
    REP(i,N)cin >> Q[i];

    vi A(N);

    REP(i,N)A[i] = i+1;

    int p = 0;
    while(A != P){
        next_permutation(ALL(A));
        p++;
    }

    REP(i,N)A[i] = i+1;

    int q = 0;
    while(A != Q){
        next_permutation(ALL(A));
        q++;
    }


    cout << abs(p-q) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#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>
using namespace std;

int main()
{
    for(;;){
        int n, m, p;
        cin >> n >> m >> p;
        if(n == 0)
            return 0;

        vector<int> px(p), py(p);
        for(int i=0; i<p; ++i)
            cin >> px[i] >> py[i];

        vector<vector<vector<int> > > ball(n+2, vector<vector<int> >(n+2, vector<int>(n+2, -1)));
        bool draw = true;
        for(int i=0; i<p; ++i){
            int x = px[i];
            int y = py[i];
            int z = 1;
            while(ball[x][y][z] != -1)
                ++ z;
            ball[x][y][z] = i % 2;

            for(int j=0; j<27; ++j){
                if(j == 9+3+1)
                    continue;
                int dx = 1 - j % 3;
                int dy = 1 - j / 3 % 3;
                int dz = 1 - j / 9;
                int num = -1;
                for(int k=0; k<2; ++k){
                    int x1 = x;
                    int y1 = y;
                    int z1 = z;
                    while(ball[x1][y1][z1] == ball[x][y][z]){
                        x1 += dx;
                        y1 += dy;
                        z1 += dz;
                        ++ num;
                    }
                    dx *= -1;
                    dy *= -1;
                    dz *= -1;
                }
                if(num >= m){
                    if(i % 2 == 0){
                        cout << "Black ";
                    }else{
                        cout << "White ";
                    }
                    cout << (i+1) << endl;
                    draw = false;
                    break;
                }
            }
            if(!draw)
                break;
        }

        if(draw)
            cout << "Draw" << endl;
    }
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <bitset>
#include<vector>
#include<utility>
#include<fstream>
#include<queue>
#include <iomanip>
#include<numeric>
#include<set>
#include<map>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef unsigned long long ull;
#define rep(i,n) for(int i=0;i<n;i++)
char ca;
const int MOD = 1000000007;
ull  c, d = 0, e, i,n, j, k, h, w, o, a[300005], b[10000] = {};
queue<ll> q;
string s;
pair<ll, ll> p[20][20];
vector<ll> v;
const int MAX = 2005;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	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;
	}
}
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() {

	cin >> n;
	ull ma = 0;
	rep(i, n) {
		cin >> a[i];
		ma = max(a[i], ma);
	}
	rep(i, n) {
		rep(j, 60) {
			if (a[i] & 1 )b[j]++;
			a[i] = (a[i] >> 1);
			if (a[i] == 0)break;
		}
	}
	c = 1;
	rep(i, 60) {
		c = (c * 2) % MOD;
			if (i == 0)c = 1;
		k = (b[i] * (n - b[i])) % MOD;
		d = (d + c * k) % MOD;
	//	cout << b[i] << " " << c << " " << d << "\n";
	}

	cout << d;
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	string s;cin >> s;
	int ans=100000000,cnt=0;
	rep(i,n) if(s.at(i)=='E') cnt++;
	rep(i,n){
		if(i==0){
			if(s.at(i)=='E') cnt--;
		}
		else{
			if(s.at(i)=='E') cnt--;
			if(s.at(i-1)=='W') cnt++;
		}
		ans=min(ans,cnt);
	}
	cout << ans << endl;
}

Measured memory_bytes: 720
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<math.h>
#include <string>
#define cinf(n,x,y) for(int i=0;i<(n);i++) cin >> x[i]>>y[i];
typedef long long int ll;
using namespace std;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }

int cnt[100010];
int main(){
	int n; cin >>n;
	vector<int> a(n),b(n);
	cinf(n,a,b);
	for(int i=0;i<n;i++){
		cnt[a[i]]++;
		cnt[b[i]+1]--;
	}
	for(int i=0;i<100010;i++){
		cnt[i+1]+=cnt[i];
	}
	int ans=0;
	for(int i=0;i<100010;i++){
		if(i<=cnt[i]+1){
			ans=max(ans,i);
		}
	}
	cout << max(ans-1,0) << endl;
}


Measured memory_bytes: 4004
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String t = in.next();
        System.out.println(commonSubsequence(s, t));
    }

    private static int[][] commonSubsequenceMatrix(String s, String t) {
        int n = s.length();
        int m = t.length();
        int[][] dp = new int[n + 1][m + 1];
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                if (s.charAt(i - 1) == t.charAt(j - 1)) {
                    dp[i][j] = dp[i - 1][j - 1] + 1;
                } else {
                    dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - 1]);
                }
            }
        }
        return dp;
    }

    public static String commonSubsequence(String s, String t) {
        int n = s.length();
        int m = t.length();
        int[][] matrix = commonSubsequenceMatrix(s, t);
        StringBuilder sb = new StringBuilder();
        int i = n;
        int j = m;
        while (i > 0 || j > 0) {
            if (i > 0 && j > 0 && s.charAt(i - 1) == t.charAt(j - 1)) {
                sb.append(s.charAt(i - 1));
                i--;
                j--;
            } else {
                if (i > 0 && j > 0 && matrix[i - 1][j] > matrix[i][j - 1]) i--;
                else {
                    if (i <= 0) j--;
                    else if (j <= 0) i--;
                    else j--;
                }
            }
        }
        return sb.reverse().toString();
    }
}


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

#define rep(i,n)  for(int i=0;i<n;++i)
#define per(i,n)  for(int i=n-1;i>=0;--i)
#define sc1(a)  scanf("%d",&a)
#define sc2(a,b)  scanf("%d %d",&a,&b)
#define sc3(a,b,c)  scanf("%d %d %d",&a,&b,&c)
#define sl1(a)  scanf("%lld",&a)
#define sl2(a,b)  scanf("%lld %lld",&a,&b)
#define sl3(a,b,c)  scanf("%lld %lld %lld",&a,&b,&c)
#define PI 3.1415926535897932

int main(){
    char a;
    for (;;) {
        scanf("%c",&a);
        if (a=='\n' || a=='\0') break;
        if (isupper(a)) printf("%c",a+32);
        else if (islower(a)) printf("%c",a-32);
        else printf("%c",a);
    }
    puts("");
    return 0;
}



Measured memory_bytes: 3124
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  ll n,d;
  vector<ll> a,b,c;
  ll ans=0;
  ll p,q;
  cin>>n;
  rep(i,n){cin>>d;a.push_back(d);}
  rep(i,n){cin>>d;b.push_back(d);}
  rep(i,n){cin>>d;c.push_back(d);}
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  sort(c.begin(),c.end());
  rep(i,n){
    ll f=b[i];
    p=lower_bound(a.begin(),a.end(),f)-a.begin();
    q=upper_bound(c.begin(),c.end(),f)-c.begin();
    
    
    ans+=p*(n-q);
  }
  cout<<ans<<endl;

  return 0;
}




Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)(n);i++)
#define Rep(i,n) for(int i=0;i<=(int)(n-1);i++)

int card[9];
int N;

bool is_same_number(int a,int b,int c){
	return a==b && b==c;
}
bool is_sequence(int a,int b,int c){
	return a+1 == b && b+1 ==c;
}
bool is_good_set(int a,int b,int c){
	return is_same_number(a,b,c) || is_sequence(a,b,c);
}

bool is_all_good_set(){
	return is_good_set(card[0],card[1],card[2]) && is_good_set(card[3],card[4],card[5]) && is_good_set(card[6],card[7],card[8]);
}

int win(){
	sort(card,card+9);
	do{
		if(is_all_good_set()){
			return 1;
		}
		
	}while(next_permutation(card,card+9));
	return 0;
}

int main() {
	cin>>N;
	Rep(i,N){
		Rep(j,9) cin>>card[j];
		string color;
		Rep(j,9){
			cin>>color;
			if(color=="G") card[j]+=10;
			else if(color=="B") card[j]+=20;
		}
		cout<<win()<<endl;
	}
	
	return 0;
}



Measured memory_bytes: 3164
import sys
#input = sys.stdin.readline
#input = sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

#import numpy as np

def main():
	s=input()
	t=input()

	ans=0

	for i in range(len(s)):
		if s[i]!=t[i]:
			ans+=1

	print(ans)





if __name__ == "__main__":
	main()


Measured memory_bytes: 9464
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::ops::Bound::*;
use itertools::Itertools;
use num_traits::clamp;
use ordered_float::OrderedFloat;
use proconio::{input, marker::*, fastout};
use superslice::*;

#[fastout]
fn main() { // Yes/No
    input! {
        s: String,
        mut xy: [i64; 2],
    }

    let moves = s.split('T').map(|s| s.len() as i64).collect_vec();
    let mut move2 = vec![Vec::new(); 2];
    xy[0] -= moves[0];
    let mut get_y = true;
    for num in moves.into_iter().skip(1) {
        if get_y {
            move2[1].push(num);
        } else {
            move2[0].push(num);
        }
        get_y = !get_y;
    }
    let moves = move2;
    for (i, mv) in (0..).zip(moves) {
        let mut dp = HashSet::new();
        dp.insert(0);
        for num in mv {
            let mut set = HashSet::new();
            for v in dp {
                set.insert(v + num);
                set.insert(v - num);
            }
            dp = set;
        }
        if !dp.contains(&xy[i]) {
            println!("No");
            return;
        }
    }
    println!("Yes");
}


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

int64_t calc(const vector<int64_t> acc, int l, int r) {
    return acc[r] - acc[l];
}

int main() {
    int n;
    cin >> n;
    vector<int64_t> acc(n + 1, 0);
    for (int i = 1; i < n + 1; i++) {
        int64_t tmp;
        cin >> tmp;
        acc[i] = acc[i - 1] + tmp;
    }
    int l = 0;
    int r = 0;
    int64_t ans = INT64_MAX;
    for (int m = 0; m < n; m++) {
        while (l + 1 < m && abs(acc[l + 1] - (acc[m] - acc[l + 1])) <
                                abs(acc[l] - (acc[m] - acc[l]))) {
            l++;
        }
        while (r < n && abs((acc[r + 1] - acc[m]) - (acc[n] - acc[r + 1])) <
                            abs((acc[r] - acc[m]) - (acc[n] - acc[r]))) {
            r++;
        }
        int64_t tmp = abs(
            max({acc[l], acc[m] - acc[l], acc[r] - acc[m], acc[n] - acc[r]}) -
            min({acc[l], acc[m] - acc[l], acc[r] - acc[m], acc[n] - acc[r]}));
        ans = min(ans, tmp);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <functional>
#include <map>
#include <string>
using namespace std;
#define INF 1000000000;
#define MOD 1000000007;
typedef long long int ll;
int main(void){
    int n,m;
    cin>>n>>m;
    vector<int>vec(n+5,0);
    for(int i=0;i<m;i++){
        int l,r;
        cin>>l>>r;
        l--;
        r--;
        vec[l]+=1;
        vec[r+1]-=1;
    }
    for(int i=0;i<n;i++){
        vec[i+1]+=vec[i];
    }
    int ans=0;
    for(int i=0;i<n;i++){
        if(vec[i]>=m)ans++;
        //cout<<vec[i]<<endl;
    }
    cout<<ans<<endl;
}

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

int main() {
  int a , b , c;
  cin >> a >> b >> c;
  
 
    vector<int> vec = {a, b , c};
    sort(vec.begin(), vec.end());

    for (int i = 0; i < vec.size(); i++) ;
  
  if ((vec.at(1)-vec.at(0)) == (vec.at(2)-vec.at(1))){
    cout << "YES" << endl;
    }
      else if ((vec.at(1)-vec.at(0)) != (vec.at(2)-vec.at(1))){
        cout << "NO" << endl;
               
}

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pa;
const ll MOD = 1e9 + 7;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (int i = (l); i < (r); i++)
#define reper(i, l, r) for (int i = (r)-1; i >= (l); i--)

void init() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
}
//-----------------------------------------------------------//

int main() {
    init();
    string S;
    cin >> S;
    int n = count(all(S), 'N'), s = count(all(S), 'S'), e = count(all(S), ('E')), w = count(all(S), 'W');
    int ns = ((n >= 1) && (s >= 1)) || ((n == 0) && (s == 0)), ew = ((e >= 1) && (w >= 1)) || ((e == 0) && (w == 0));
    if (ns && ew)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

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

using namespace std;

struct SegmentTree{
    int n;
    vector<int> data;
    SegmentTree(int N){
        n = 1;
        while(n < N) n *= 2;
        data.assign(2 * n, INT_MAX);
    }
    void update(int k, int x){
        k += n - 1;
        data[k] = x;
        while(k > 0){
            k = (k - 1) / 2;
            data[k] = min(data[2 * k + 1], data[2 * k + 2]);
        }
    }
    int query(int a, int b){
        return query(a, b, 0, 0, n);
    }
    int query(int a, int b, int k, int l, int r){
        if(b <= l || r <= a){
            return INT_MAX;
        }else if(a <= l && r <= b){
            return data[k];
        }else{
            int vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
            int vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
            return min(vl, vr);
        }
    }
    void print(){
        for(int i = 0; i < 2 * n - 1; i++){
            printf("data[%d] = %d\n", i, data[i]);
        }
    }
};

int main(){
    int N, Q;
    while(cin >> N >> Q){
        SegmentTree tree(N);
        REP(i, Q){
            int com;
            cin >> com;
            if(com == 0){
                int k, x;
                cin >> k >> x;
                tree.update(k, x);
            }else{
                int a, b;
                cin >> a >> b;
                cout << tree.query(a, b + 1) << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 2052
const main = (inputs) => {
  var array = inputs[0].split(" ");
  var A = Number(array[0]);
  var B = Number(array[1]);
  var countA = 1;
  var countB = 1;

  if (A === 1 && B === 1) {
    console.log(0);
  } else {
    for (var i = A; i >= A - 1; i--) {
      countA = countA * i;
    }
    countA = countA / 2;

    for (var j = B; j >= B - 1; j--) {
      countB = countB * j;
    }
    countB = countB / 2;
    console.log(countA + countB);
  }

}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8').trim().split("\n"));

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

typedef long long ll;
typedef long double ld;
#define size(a) int((a).size())
#define present(c, x) (c.find(x) != c.end()) 

template <class T>
void printArray(vector<T> arr) {for (T a: arr) cout << a << '\n';}
void printVerdict(bool verdict) {cout << (verdict ? "YES": "NO") << '\n';}
void printDecimal(double d) {printf("%.9f\n", d);}
bool inrange(int val, int start, int end) {return val >=start && val <= end;}
template <class T1, class T2, class T3> 
void printTuple(tuple<T1, T2, T3> t) {cout << get<0>(t) << " " << get<1>(t) << " " << get<2>(t) << '\n';}
template <class T1, class T2>
void printPair(pair<T1, T2> p) {cout << p.first << " " << p.second << '\n';}

class myComparator {
public: 
	int operator() (pair<int, int> a, pair<int, int> b) {
		return a.second > b.second;
	}
};

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n,m; cin >> n >> m;
	int a[n];
	for (int i = 0; i<n; i++) cin >> a[i];
	vector<pair<int, int>> bc(m);
	for (int i = 0; i<m; i++) {
		int b,c; cin >> b >> c;
		bc[i] = make_pair(b, c);
	}
	sort(a, a+n);
	sort(bc.begin(), bc.end(), myComparator());
	ll curr_ret = 0;
	int ptr1 = 0, ptr2 = 0;
	for (int i = 0; i<m; i++) {
		if (a[ptr1] < bc[i].second) {
			ptr2 = ptr1;
			while (ptr2 < n && a[ptr2] < bc[i].second && bc[i].first > 0) {
				a[ptr2] = bc[i].second; 
				ptr2++;
				bc[i].first--;
			}
			ptr1 = ptr2;
		}
	}
	for (int i = 0; i<n; i++) curr_ret += a[i];
	cout << curr_ret << '\n';
}



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

using namespace std;

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

int main() {
  int n, k;
  cin >> n >> k;
  cout << k * (int)pow(k - 1, n - 1) << endl;
}


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

int main(){

    int n, m;
    cin >> n >> m;
    
    vector<vector<int>> a(n, vector<int>(m));
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < m; ++j){
            cin >> a[i][j];
        }
    }

    vector<int> b(m);
    for(int i = 0; i < m; ++i){
        cin >> b[i];
    }

    vector<int> ans(n);
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < m; ++j){
            ans[i] += a[i][j] * b[j];
        }
    }

    for(int i = 0; i < n; ++i){
        cout << ans[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 3208
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  std::cout << std::setprecision(10) << std::fixed;
  int N, K; std::cin >> N >> K;
  std::vector<double> dp(K, -1.0);
  dp[0] = 0.0;
  auto calc = [&](auto&& f, int k)-> double {
    if(k >= K) return 1.0;
    if(dp[k] >= 0.0) return dp[k];
    return dp[k] = f(f, k*2)*0.5;
  };
  double ans = 0.0;
  for(int k = N; k > 0; --k) ans += calc(calc, k);
  fin(ans/N);
  return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
     
    int main(){
      int n,x,m[100],sum=0,i,min;
      scanf("%d %d",&n,&x);
      for(i=0;i<n;i++){
        scanf("%d",&m[i]);
        sum+=m[i];
        if(i==0||min>m[i])
          min=m[i];
      }
      printf("%d\n",n+(x-sum)/min);
    }

Measured memory_bytes: 128
(let* ((n (cons (read) (read)))
       (m (cons (read) (read)))
       (x (read)))
  (if (<= (car n) (car m))
      (if (<= (+ (car m) (* (cdr m) x))
              (+ (car n) (* (cdr n) x)))
          (princ "YES")
          (princ "NO"))
      (if (>= (- (car m) (* (cdr m) x))
              (- (car n) (* (cdr n) x)))
          (princ "YES")
          (princ "NO"))))

Measured memory_bytes: 24132
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "functional"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
int N, M, K, H, W, L, R;


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

	cin >> H >> W >> N;
	while(H){
	    vector<vector<short>>v(H, vector<short>(W));
	for (auto &i : v)for (auto &j : i)cin >> j;
	//0-south 1-east
	vector<vector<int>>turn(H, vector<int>(W));
	vector<vector<short>>last(H, vector<short>(W, -1));
	turn[0][0] = N;
	last[0][0] = v[0][0] ^ ((N ^ 1) & 1);
	for (int i = 1; i < W; i++) {
		turn[0][i] = (turn[0][i - 1] + v[0][i - 1]) / 2;
		if (last[0][i - 1] == 1) {
			last[0][i] = v[0][i] ^ (((turn[0][i]) ^ 1) & 1);
		}
	}
	for (int i = 1; i < H; i++) {
		turn[i][0] = (turn[i - 1][0] + 1 - v[i - 1][0]) / 2;
		if (last[i - 1][0] == 0) {
			last[i][0] = v[i][0] ^ (((turn[i][0]) ^ 1) & 1);
		}
	}
	for (int i = 1; i < H; i++) {
		for (int j = 1; j < W; j++) {
			turn[i][j] = (turn[i][j - 1] + v[i][j - 1]) / 2 + (turn[i - 1][j] + 1 - v[i - 1][j]) / 2;
			if (last[i - 1][j] == 0) {
				last[i][j] = v[i][j] ^ (((turn[i][j]) ^ 1) & 1);
			}
			if (last[i][j - 1] == 1) {
				last[i][j] = v[i][j] ^ (((turn[i][j]) ^ 1) & 1);
			}
		}
	}
	bool flag=true;
	for (int i = 0; i < H; i++) {
		if (last[i].back() == 1) {
			if(flag)cout << i + 1 << " " << W + 1 << endl;
			flag=false;
		}
	}
	for (int i = 0; i < W; i++) {
		if (last.back()[i] == 0) {
			if(flag)cout << H + 1 << " " << i + 1 << endl;
			flag=false;
		}
	}
	cin>>H>>W>>N;
	}
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    int h,w;
    cin>>h>>w;
    vector<vector<char>>hw(h+1,vector<char>(w+1));
    for(int i=1;i<=h;++i){
        for(int j=1;j<=w;++j)cin>>hw[i][j];
    }
    ll dp[1005][1005];mem(dp,0);
    dp[1][1]=1;
    for(int i=1;i<=h;++i){
        if(hw[i][1]=='.'){
            dp[i][1]=1;
        }
        else {dp[i][1]=0;break;}
    }
    for(int i=1;i<=w;++i){
        if(hw[1][i]=='.'){
            dp[1][i]=1;
        }
        else {dp[1][i]=0;break;}
    }
    for(int i=2;i<=h;++i){
        for(int j=2;j<=w;++j){
            if(hw[i][j]=='.'){
                dp[i][j]=dp[i-1][j]+dp[i][j-1];
                dp[i][j]%=MOD;
            }
            else{
                dp[i][j]=0;
            }
        }
    }
    cout<<dp[h][w]%MOD;
}


Measured memory_bytes: 9216
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

int main() {
	long long A, B, C, K; std::cin >> A >> B >> C >> K;
	if (std::abs(A - B) > 1000000000000000000) {
		std::cout << "Unfair" << std::endl;
		return 0;
	}
	if(K % 2 == 1)
		std::cout << B - A << std::endl;
	else
		std::cout << A - B << std::endl;


	return 0;
}

Measured memory_bytes: 3640
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{

    internal class Solution
    {
        public int N, P;
        public int[] A;

        public void Run()
        {
            {
                var line = Input.ReadIntArray();
                N = line[0];
                P = line[1];
                A = Input.ReadIntArray();
            }

            int[] mods = new int[2];
            for (int i = 0; i < N; i++)
            {
                int m = A[i] % 2;
                mods[m]++;
            }

            // corner case
            if (P == 1 && mods[1] == 0)
            {
                Console.WriteLine(0);
                return;
            }

            int c = mods[0] + Math.Max(mods[1] - 1, 0);
            long ret = Power(2, c);
            Console.WriteLine(ret);
        }

        public long Power(long x, long n)
        {
            long tmp = 1;

            if (n > 0)
            {
                tmp = Power(x, n / 2);
                if (n % 2 == 0) tmp = tmp * tmp;
                else tmp = tmp * tmp * x;
            }

            return tmp;
        }

    }

    // libs ----------


    // common ----------

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

        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 long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.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
#include <bits/stdc++.h>
#define ll long long
#define rw freopen("input.txt","r",stdin),freopen("output.txt","w",stdout);
#define pb push_back
#define F first
#define S second
#define pf push_front
#define lp(i,a,b) for (int i=a;i<=(int)b;++i)
#define lp2(i,a,b) for (int i=a;i>=b;--i)
#define f(x) return cout<<x<<"\n",0
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define p(x) cout<<#x<<" = { "<<x<<" } \n"
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define EPS 1e-6
// to convert string to number use int a = stoi(string);
// to convert number to string use string s = to_string(int);
#define FAST ios::sync_with_stdio(0),ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define clr(c,x) memset(c,x,sizeof(c));
using namespace std;
const int N=2e5+5,mod=(int)1e9+7;
bool trans(ll b,ll n,ll s)
{
    ll fs=0;
    while(n>0)
    {
        fs+=n%b;
        n/=b;
    }
    return (fs==s);
}
int main()
{
#ifdef ONLINE_JUDGE
    FAST;
#endif
    ll n,s;
    cin>>n>>s;
    ll d=n-s;
    if (d<0)
        f(-1);
    if (d==0)
        f(n+1);
    ll fans=1e16;
    for (ll i=1; i*i<=d+1; ++i)
    {
        if (d%i)
            continue;
        if (trans(i+1,n,s))
            fans=min(fans,i+1);
        if (trans(d/i+1,n,s))
            fans=min(fans,d/i+1);
    }
    if (fans==1e16)
        f(-1);
    cout<<fans<<"\n";
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A,B = map(int,input().split())
cnt = [0,0,0]
for p in list(map(int,input().split())):
  if p<=A:
    cnt[0] += 1
  elif A<p and p<=B:
    cnt[1] += 1
  else:
    cnt[2] += 1
print(min(cnt))

Measured memory_bytes: 38256
#pragma region
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	ll a, b, k; cin >> a >> b >> k;
	if (a >= k)
	{
		cout << a - k << " " << b << endl;
	}
	else
	{
		k -= a;
		b = max(b - k, 0LL);
		cout << 0 << " " << b << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a) for(auto i=0; i<a; i++)
#define rep1(i, a, b) for(auto i=a; i<b; i++)
#define p_b push_back
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
 
int main() {
    ll n, m, t;
    cin>>n>>m>>t;
    vvi g(n, vi(n, INT_MAX));
    vi r(t);
    rep(i, t)
        cin>>r[i];
    sort(r.begin(), r.end());
    rep(i, m){
        ll x, y, w;
        cin>>x>>y>>w;
        x--;
        y--;
        if(g[x][y] > w)
            g[x][y] = g[y][x] = w;
    }
    rep(k, n)
        rep(i, n)
            rep(j, n)
                if(g[i][k]!=INT_MAX && g[k][j]!=INT_MAX)
                if(g[i][j] > g[i][k] + g[k][j])
                    g[i][j] = g[i][k] + g[k][j];
    ll ans = LLONG_MAX;
    do{
        ll cur = 0;
        rep(i, t-1){
            cur += g[r[i]-1][r[i+1]-1];
            // cout<<r[i]<<" ";
        }
        // cout<<r[t-1]<<endl;
        ans = min(ans, cur);
    }while(next_permutation(r.begin(), r.end()));
    cout<<ans<<endl;
    return 0;
}

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

inline long long read(){
    long long s = 0, w = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9'){
        if (ch == '-') w = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9'){
        s = s * 10 + ch - '0';
        ch = getchar();
    }
    return s * w;
}

long long n, ans;
int main(){
    n = read();
    for (int i = 1; i <= n; i++){
        if (i % 3 != 0 && i % 5 != 0){
            ans += i;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  int N;
  cin>>N;
  int A[N];
  for (int i=0;i<N;i++){
    cin>>A[i];
  }
  int ns=N/2;
  int mi[N];
  int ma[N];
  for (int i=0;i<N;i++){
    mi[i]=A[i];
    ma[i]=A[i];
  }
  sort(mi,mi+N);
  sort(ma,ma+N,greater<int>());
  long s=0;
  for (int j=0;j<ns;j++){
    if (j==0){
      s+=ma[j]-mi[j];
    }
    else {
      s+=ma[j-1]-mi[j];
      s+=ma[j]-mi[j-1];
    }
  }
  int b,c;
  if (N%2!=0){
    b=ma[ns-1]-mi[ns];
    c=ma[ns]-mi[ns-1];
    if (b>c){
      s+=b;
    }
    else{
      s+=c;
    }
  }
  cout<<s;
  return 0;
}

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

typedef long long int ll;
typedef pair<int,int> pi;
priority_queue<pi, vector<pi>, greater<pi> > pq; //min heap

#define dodebug(i, n, arr)	for(int i=0;i<n;++i)	cout<<arr[i]<<" ("<<i<<")\n";

ll gcd(ll a,ll b){	if(b == 0)	return a;return gcd(b,a%b);}
ll binpow(ll n,ll x){	ll ans = 1;while(x){if(x & 1)	ans *= n;n *= n;x >>= 1;}return ans;}

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

	string s,t;
	cin>>s>>t;

	int n = s.length();
	int m = t.length();
	vector<vector<int> > dp(n+1, vector<int>(m+1, 0));
	vector<vector<int> > track(n+1, vector<int>(m+1, 10));

	for(int i=1;i<=n;++i){
		for(int j=1;j<=m;++j){
			if(s[i-1] == t[j-1]){
				dp[i][j] = dp[i-1][j-1] + 1;
				track[i][j] = 0;
			}
			else{
				dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
				if(dp[i][j] == dp[i-1][j])	track[i][j] = 1;
				else						track[i][j] = 2;
			}
		}
	}
	
	// cout<<dp[n][m]<<"\n";
	vector<char> ans;
	while(track[n][m] != 10){
		if(track[n][m] == 0){
			ans.push_back(s[n-1]);
			n--;
			m--;
		}
		else if(track[n][m] == 1){
			n--;
		}
		else{
			m--;
		}
	}

	reverse(ans.begin(), ans.end());

	for(auto i:ans)	cout<<i;
	cout<<"\n";

	return 0;
}

Measured memory_bytes: 73596
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef pair<int,int> P;
int n;
vector<P> t;
P change(P p){
  return P(-p.second,p.first);
}

vector<P> ro(vector<P> vec){
  while(1){
    if(vec[0].first==0&&vec[0].second>0)break;
    for(int i=0;i<(int)vec.size();i++){
      vec[i]=change(vec[i]);
    }
  }
  return vec;
}

vector<P> input(){
  vector<P> res;
  int m,x[100],y[100];
  cin>>m;
  for(int i=0;i<m;i++){
    cin>>x[i]>>y[i];
    if(i==0)continue;
    res.push_back(P(x[i]-x[i-1],y[i]-y[i-1]));
  }
  return ro(res);
}

int main(){
  while(1){
    cin>>n;
    if(n==0)break;
    t.clear();
    t=input();
    for(int i=0;i<n;i++){
      vector<P> u=input();
      vector<P> v=u;
      reverse(v.begin(),v.end());
      for(int i=0;i<(int)v.size();i++){
	v[i].first*=-1;	v[i].second*=-1;
      }
      v=ro(v);
      if(t==u||t==v){
	cout<<i+1<<endl;
      }
    }
    cout<<"+++++"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1200
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <cstring>
#include <numeric>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define F0(i,n) for (int i = 0; i < n; i++)
#define F1(i,n) for (int i = 1; i <= n; i++)
#define CL(a,x) memset(x, a, sizeof(x));
#define SZ(x) ((int)x.size())
const double eps = 1e-10;
const int inf = 1000000009;
int i, j, k, m, n, l;
int ans;

int main() {
	//freopen("x.in", "r", stdin);

	int X, Y;
	cin >> X >> Y;
	if (X % Y == 0) cout << -1; else cout << X << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		System.out.println(calcEuclidDistance(sc.nextDouble(), sc.nextDouble(), sc.nextDouble(), sc.nextDouble()));
		
	}
	
	static double calcEuclidDistance (double x1, double y1, double x2, double y2) {
		double d = Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
		return d;
	}
	
}


Measured memory_bytes: 28040
#include<iostream>
#include<sstream>
#include<string>
using namespace std;
int main(){
  string s;
  int id,k,i;
  int d[1005][2]={};
  while(getline(cin,s),s!=""){
    for(i=0;i<s.size();i++) if(s[i]==',') s[i]=' ';
    stringstream ss(s);
    ss>>id>>k;
    d[id][0]++;
  }
  while(getline(cin,s),s!=""){
    for(i=0;i<s.size();i++) if(s[i]==',') s[i]=' ';
    stringstream ss(s);
    ss>>id>>k;
    d[id][1]++;
  }
  for(i=0;i<1005;i++){
    if(d[i][0]>0&&d[i][1]>0) cout << i << " " << d[i][0]+d[i][1] << endl;
  }
}


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

#define ll long long
#define ld long double
#define db double
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(v) for(int i=0;i<_sz(v);i++)
#define rep1(i,b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)
#define tc int tt=1;cin>>tt;while(tt--)

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__,__VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr<<name<<" : "<<arg1<<nl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma=strchr(names+1,',');cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1, args...);
}
#else
#endif

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const ld pi=2*acos(0.0);

int main(){
    nimble
    string s,t;
    cin>>s>>t;
    int x=0;
    for(int i=0;i<_sz(s);i++){
        if(s[i]!=t[i])x++;
    }
    cout<<x<<nl;
    return 0;
}


Measured memory_bytes: 3796
/*
 KUNAL RAUT (ZUKONIT14)  :- "DO WHAT YOU LIKE!"
 -PICT,PUNE! :)
 */
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mod 1000000007
#define mod9 1000000009
#define pi 3.1415926535
#define MAXN 1000005
#define N 1000001
#define MAX2N 1*1000 + 10
#define all(v) v.begin(), v.end()
#define ms(s, n) memset(s, n, sizeof(s))
#define prec(n) fixed<<setprecision(n)
#define forci(p,n) for(ll i=p;i<(ll)n;i++)
#define forcj(p,n) for(ll j=p;j<(ll)n;j++)
#define bolt ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define bits(a) __builtin_popcount(a)
#define test ll t;cin>>t;for(ll testi=1;testi<=t;testi++)
#define djokovic  freopen("input00.txt", "r", stdin);freopen("output00.txt", "w", stdout);
ll zero = 0;
ll one = 1;
ll gcd(ll a, ll b) {    if (b == 0) return a;    return gcd(b, a % b);}
ll lcm(ll a, ll b) {    return (a / gcd(a, b) * b);}
ll expo(ll x, ll y) {
    ll res = 1; x = x % mod; while (y > 0) {
        if (y & 1)res = (1ll * res * x) % mod;
        y = y >> 1; x = (1ll * x * x) % mod;
    } return res;
}
ll ncr(ll n, ll r) { ll res = 1; if (r > n - r)r = n - r; for (ll i = 0; i < r; i++) {  res *= n - i;  res /= i + 1; } return res;}
ll max(ll a, ll b) {return (a > b) ? a : b;}
bool prime(ll n) {ll i; for (i = 2; i <= sqrt(n); i++) {if (n % i == 0)return false;} return true;}
bool sortbysec(const pair<ll, ll> &a, const pair<ll, ll> &b)
{   if (a.second == b.second)
        return a.first < b.first;
    return (a.second < b.second);
}
//https://www.youtube.com/watch?v=WTJSt4wP2ME

ll rr[] = {0, 1, 1, 1, 0, -1, -1, -1,};
ll cc[] = {1, 1, 0, -1, -1, -1, 0, 1};
ll n, m, x, k, a[MAXN], p[MAXN];
void solve()
{
    ll n, m; cin >> n >> m; ll sum = 0;
    forci(0, n)   cin >> a[i], sum += a[i];
    sort(a, a + n);
    reverse(a, a + n);
    ll ans = 0;
    if (sum % (4 * m))  sum+=4*m;
    sum /= (4 * m);
    
    forci(0, n)
    {
        if (a[i] >= sum)   ans++;
    }
    if (ans >= m)   cout << "Yes\n";
    else cout << "No\n";
}
signed main()
{
    bolt;
    //djokovic;
    solve();
}








Measured memory_bytes: 2304
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
//#define all(x , n) x+1,x+n+1
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define sz(x) (int)x.size()
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;


using ll = long long;

//#define int ll

const int N = 1e6+54, mod = 1e9 + 7, mod1 = 998244353;
const int MAX = 1e5 + 11 , T = 2000;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const long double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const int LOG = 20;
const double EPS = 1e-4;
const double PI = acos(-1.0);

template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }


typedef pair <int, int> pii;        // #include <ext/pb_ds/assoc_container.hpp>
typedef pair <ll, ll> pll;         // #include <ext/pb_ds/tree_policy.hpp>
typedef vector <int> vi;          // #include <ext/rope>
                // #include <ext/rope>
                                 // #include <ext/rope>
bool prime(int n) {             // template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
    for(int i=2;i<=sqrt(n);i++){
        if(n%i==0){return 0;}
    }return 1;}
bool query = 0;
ll bp(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
///////////////////////////////////////////////////////////

int u[N];
int a[N];

void solve() {
    int n;
    cin >> n;
    for(int i = 1; i <= n; i ++) {
        int x;
        cin >> x;
        a[i] = x;
        u[x] ++;
    }
    int ans = 0;
    for(int i = 1; i <= n; i ++) {
        u[a[i]] --;
        int f = 1;
        for(int j = 1; j*j <= a[i]; j ++) {
            if(a[i] % j == 0 && (u[j] || u[a[i] / j])) {
                f = 0;
                break;
            }
        }
        ans += f;
        u[a[i]] ++;
    }
    cout << ans;
}

/*
*/

main() {
    ios;
    int tt = 1;
    if(query)
        cin >> tt;
    while(tt --) {
        solve();
    }
    return 0;
}


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

int main() {
	int h[10],tmp;
	for(int i=0; i<10; i++) cin>>h[i];
	sort(h, h+10, greater<int>());
	for(int i=0; i<3; i++) cout<<h[i]<<endl;
	return 0;
}

Measured memory_bytes: 1176