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

const int vx[]={1,0,-1,0};
const int vy[]={0,-1,0,1};
const char vec[]={'R','U','L','D'};

int main(void){
    string s;
    int cd=0;
    int cm[2]={0,1};
    vector<vector<vector<bool> > >m(5,vector<vector<bool> >(5,vector<bool>(4,false)));
    for (int i = 0; i < 9; ++i) {
        cin >> s;
        for (int j = 0; j < s.length(); ++j) {
            if (i % 2 == 0) {
                if (s[j] == '1') {
                    m[i / 2][j][0] = true;
                    m[i / 2][j + 1][2] = true;
                }
            } else {
                if (s[j] == '1') {
                    m[(i - 1) / 2][j][3] = true;
                    m[(i + 1) / 2][j][1] = true;
                }
            }
        }
    }
        int nd[4];
        int d;
        cout<<"R";
        while(cm[0]!=0||cm[1]!=0){
            for (int i = 0; i < 4; ++i) {
                d=(cd+1-i>3)?0:cd+1-i;
                if(d<0)d+=4;
                nd[i]=d;
            }
            for (int i = 0; i < 4; ++i) {
                if(m[cm[0]][cm[1]][nd[i]]){
                    cm[0]+=vy[nd[i]];
                    cm[1]+=vx[nd[i]];
                    cd=nd[i];
                    cout<<vec[nd[i]];
                    break;
                }
            }
        }
        cout<<endl;
    return 0;
}


Measured memory_bytes: 3072
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n, a, b = MAP()
if b < a:
    print(0)
    exit()
if a == b and n == 1:
    print(1)
    exit()
if a != b and n == 1:
    print(0)
    exit()
if n == 2:
    print(1)
    exit()
if b - a - 1 <= 0:
    print(1)
    exit()
print(a + (n - 1) * b - (n - 1) * a - b + 1)

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

 
 
int main(){
    int N;
    cin >> N;
    if(N % 10 == 9){cout << "Yes" << endl;}
    else if (N >= 90){cout << "Yes" << endl;}
    else{cout << "No" << endl;}
    
}
 

Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<functional>
#include<set>
using namespace std;
#define int long long
typedef pair<int, int>P;

signed main() {
	int n, m; cin >> n >> m;
	if (n > m)swap(n, m);
	cout << abs((n - 2)*(m - 2)) << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
 
public class Main{
	
	int N;
	int Q;
	String S;
	int[] dp;
	
	public void solve(){
		N = nextInt();
		Q = nextInt();
		S = next();
		dp = new int[S.length() + 1];
		dp[0] = 0;
		dp[1] = 0;
		for(int i = 1; i < S.length(); i++) {
			if(S.charAt(i - 1) == 'A' && S.charAt(i) == 'C') {
				dp[i + 1] = dp[i] + 1;
			}else {
				dp[i + 1] = dp[i];
			}
		}
		
		for(int i = 0; i < Q; i++) {
			int l = nextInt() - 1;
			int r = nextInt() - 1;
			
			int ans = dp[r + 1] - dp[l];
			if(l >= 1 && S.charAt(l - 1) == 'A' && S.charAt(l) == 'C') {
				ans--;
			}
			out.println(ans);
		}
	}
	
	
	
	private static PrintWriter out;
	public static void main(String[] args){
		out = new PrintWriter(System.out);
		new Main().solve();
		out.flush();
	}
	
	
	
	public static int nextInt(){
		int num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10 + (c - '0');
		}
		return minus ? -num : num;
	}
	
	public static long nextLong(){
		long num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10l + (c - '0');
		}
		return minus ? -num : num;
	}
	public static String next(){
		int c;
		while(!isAlNum(c = read())){}
		StringBuilder build = new StringBuilder();
		build.append((char)c);
		while(isAlNum(c = read())){
			build.append((char)c);
		}
		return build.toString();
	}
	
	
	private static byte[] inputBuffer = new byte[1024];
	private static int bufferLength = 0;
	private static int bufferIndex = 0;
	private static int read(){
		if(bufferLength < 0) throw new RuntimeException();
		if(bufferIndex >= bufferLength){
			try{
				bufferLength = System.in.read(inputBuffer);
				bufferIndex = 0;
			}catch(IOException e){
				throw new RuntimeException(e);
			}
			if(bufferLength <= 0) return (bufferLength = -1);
		}
		return inputBuffer[bufferIndex++];
	}
	
	private static boolean isAlNum(int c){
		return '!' <= c && c <= '~';
	}
}

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

#define debug(s) cout << s << endl
#define debug1(s, t) cout << s << " " << t << endl
#define debug2(s, t, u) cout << s << " " << t << " " << u << endl
#define printvec(v)       \
    for (auto &&i : v)    \
        cout << i << " "; \
    cout << endl

using namespace std;
using i64 = long long;

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

    int ans = 0;
    for (size_t i = 1; i <= n; i++, i++)
    {
        int ct = 0;
        for (size_t j = 1; j <= n; j++, j++)
        {
            if (i%j==0) ct++;
        }
        if (ct == 8) ans++;
    }

    cout << ans << endl;

    return 0;
}

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

int main() {
int A,B=0;
  string S="";
  cin>>A>>B;
	if(A>=9||B>=9) cout<<":("<<endl;
  else cout<<"Yay!"<<endl;
//  cout<<A<<endl;
}

Measured memory_bytes: 256
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
Q = int(input())

S = sum(A)
counter = Counter(A)
for i in range(Q):
    B,C = list(map(int,input().split()))
    S += counter[B]*C - counter[B]*B
    counter[C] += counter[B]
    counter[B] = 0
    print(S)


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

int main() {
    int N,K;
    string S;
    cin >> N >> K;
    cin >> S;
    char small = S.at(K - 1);

    if (small == 'A') {
        S.at(K-1) = 'a';
    }

    if (small == 'B') {
        S.at(K-1) = 'b';
    }

    if (small == 'C') {
        S.at(K-1) = 'c';
    }

    cout << S << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a,b,c;
  int s;
  scanf("%d %d %d",&a,&b,&c);
  s=100*a+10*b+c;
  if(s==557||s==575||s==755){
    printf("YES");
  }else{
    printf("NO");
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define INF 2147483647
#define INF_LL 9223372036854775807
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {
	int A, B;
	cin >> A >> B;
	if (A == 1) A = 14;
	if (B == 1) B = 14;
	if (A == B)cout << "Draw" << endl;
	else if (A < B) cout << "Bob" << endl;
	else cout << "Alice" << endl;
	return 0;
}

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

using namespace std;

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

int main (void){

    int N,M,X,Y;
    
    cin >> N>>M>>X>>Y;

    vector<int> x(N);
    vector<int> y(M);

    rep(i,N){
        cin >> x[i];
    }
    rep(i,M){
        cin >> y[i];
    }
    
    sort(x.begin(),x.end());
    sort(y.begin(),y.end());

    int max_x = x[x.size()-1];
    int min_y = y[0];

   if(max_x >= Y || min_y <= X){
       cout << "War";
   }else if(min_y <= max_x){
       cout << "War";
   }else if(max_x < X || min_y > Y){
       cout << "War";
   }else{
       cout << "No War";
   }

}

Measured memory_bytes: 256
def GCD(a,b):
    if b == 0:
        return a
    else:
        r = a % b
        return GCD(b, r)
        
while True:
    try:
        data = map(int, raw_input().split())
    except:
        break
    if data[0] > data[1]:
        a = data[0]
        b = data[1]
    else:
        a = data[1]
        b = data[0]
    x = GCD(a, b)
    y = a*b / x
    
    print x, y

Measured memory_bytes: 4220
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

pub trait InputValue {
    fn parse(s: &str) -> Self;
}

pub fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

pub fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

pub fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);
parse_tuple!(A, B, C);
parse_tuple!(A, B, C, D);
parse_tuple!(A, B, C, D, E);

// ===

fn main() {
    let (x, y, z): (i32, i32, i32) = read();
    let p = x - z*2 - y;
    println!("{}", 1 + (p / (y + z)));
}


Measured memory_bytes: 4352
N, M = gets.split.map(&:to_i)
A = M.times.map { gets.split.map(&:to_i) }

0.upto(999) do |n|
  str = n.to_s
  l = str.size

  next if l < N

  valid = true

  A.each do |s, c|
    i = s - 1

    if l <= i
      valid = false
    else
      if str[i].to_i != c
        valid = false
      end
    end
  end

  if valid
    puts n
    exit
  end
end

puts -1


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

#if __has_include(<local.h>)
#include <local.h>
#endif

using namespace std;

typedef long long int LL;
typedef long long int LLint;

//Faster Program
#define endl "\n"

//Faster Coding
#define ED return
#define GET(a) int a;cin >> a
#define DGET(a) double a;cin >> a
#define SGET(a) string a;cin >> a
#define CGET(a) char a;cin >> a
#define PRINT(a) cout << a << "\n"
#define ANS(a,b) int a;cin >> a;cout << b << "\n"
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define SORT(vec) sort(vec.begin(),vec.end())
#define REV(vec) reverse(vec.begin(),vec.end())
#define ALL(x) (x).begin(),(x).end()

//As Function
#define UP(a,b) ((a+(b-1))/b)
#define IPOW(x,y) LL(pow(x,y))

//Debug
#ifdef LOCAL_H
#define TEST cout << "OK\n"
#define DEBUG(a) a
#else
#define TEST
#define DEBUG(a)
#endif

#ifdef LOCAL_H
[[maybe_unused]]
#endif
const double PI = M_PI;
#ifdef LOCAL_H
[[maybe_unused]]
#endif
const int INF = int(999999999);
#ifdef LOCAL_H
[[maybe_unused]]
#endif
const long long MOD = int(1000000007);

//Settings
#ifdef LOCAL_H
const bool DO_BENCHMARK = true;
#endif
const int DOUBLE_ACCURACY = 15;

#ifndef LOCAL_H
    const bool DO_BENCHMARK = false;
#endif

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(DOUBLE_ACCURACY);
    void solve();
    if(DO_BENCHMARK){
        clock_t clock_start = clock();
        solve();
        clock_t clock_end = clock();
        const double time = static_cast<double>(clock_end-clock_start)/CLOCKS_PER_SEC*1000.0;
        cout << "\n" << time << "[ms]\n";
    }
    else solve();
}

/************************************************************************************************************************************************/

void solve(){
    int N, K;
    cin >> N >> K;
    vector<int> H (N);
    for(int i = 0;i < N;i++){
        cin >> H[i];
    }
    SORT(H);
    REV(H);
    LL ans = 0;
    for(int i = K;i < N;i++){
        ans += H[i];
    }
    cout << ans << endl;
}


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

int main(){
  string s;
  int k;
  int count = 0;
  cin >> s >> k;
  map<string,int> mp;
  bool fin = false;
  string finstr;

  vector<int> v;
  char c = 'a'-1;
  while(!fin){
    if(v.empty()){
      c++;
      for(int i = 0;i < s.size();i++){
        if(s[i] == c){
          v.push_back(i);
        }
      }
    }
    if(!v.empty()){
      char str[10000];
      str[0] = s[v[0]];
      string fs(str,1);
      if(mp[fs] != 1){
        mp[fs] = 1;
        count++;
        if(count == k){
          finstr = fs;
          fin = true;
          break;
        }
      }

      int maxv = v[0];
      int rmi;
      int rm;
      for(rmi = 1;rmi < v.size();rmi++){
        if(v[rmi]+1 < s.size()){
          if(s[v[rmi]+1] < s[maxv+1]){
            maxv = v[rmi];
            rm = rmi;
          }else if(s[v[rmi]+1] == s[maxv+1]){
            for(int ch = 2;ch-2 < 5 && v[rmi]+ch < s.size();ch++){
              if(s[v[rmi]+ch] < s[maxv+ch]){
                maxv = v[rmi];
                rm = rmi;
                break;
              }else if(s[rmi]+ch > s[maxv+ch]){
                break;
              }
            }
          }
        }
      }
      v.erase(v.begin()+rm);
      for(int i = 1;maxv + i < s.size() && !fin;i++){
        str[i] = s[maxv+i];
        string tmpstr(str,i+1);
        if(mp[tmpstr] != 1){
          mp[tmpstr] = 1;
          count++;
          finstr = tmpstr;
          if(count == k) fin = true;
        }
      }
    }
  }

  cout << finstr << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using namespace std;

int main() {
	int a, b;
	int c;
	cin >> a >> b;
	if (a - 2 * b < 0) c = 0;
	else c = a - 2 * b;
	cout << c << endl;
}

Measured memory_bytes: 256
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//例外処理は最初にする
//x = p^m + q^n...の約数の個数:(n+1)*(m+1)....
//N!のどの素因数で何回割れるか
//⇔1~Nまでの数がそれぞれどの素因数で何回割り切れるかの和
//パズルの問題->一般化して全探索
//数が大きい時のせぐふぉはコードテストで試してみる
//stack<ll> s;
//s.push(要素);s.top();s.pop();
//queue<ll> q;
//q.push(要素);q.front();q.pop();
//同じ作業繰り返す系の問題：収束先を見つける
//関係性は隣接行列で記録
//過半数：N/2.0で判定
//ある量からある量を引く系の問題：端から定義してやる
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll MOD = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

//a,bの最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n * f(n - 1));
}

//Nのd桁目の数
ll dignum(ll N, ll d) {
	ll x = pow(10, d);
	N %= x;
	ll y = pow(10, d - 1);
	N /= y;
	return N;
}

//Nをdで何回割れるか
ll divcnt(ll N, ll d) {
	ll ans = 0;
	while (1) {
		if (N%d == 0) {
			ans++;
			N /= d;
		}
		else break;
	}

	return ans;
}

//素数判定
bool prime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) return false;
	}
	return true;
}

//フィボナッチ数列
vector<ll> memo(pow(10, 6) + 1);
ll fibo(ll n) {
	if (n == 1) return 1;
	else if (n == 2) return 1;
	else if (memo[n] != 0) return memo[n];
	else return memo[n] = fibo(n - 1) + f(n - 2);
}

int main() {
	ll N; cin >> N;
	string S; cin >> S;
	ll K; cin >> K;

	rep(i, N) {
		if (S[i] != S[K - 1])S[i] = '*';
	}

	cout << S << endl;
}

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

using namespace std;
typedef long long ll;



int N,M;
vector<pair<int,int>> E;

vector<int> par;
vector<ll> node;


int find(int a){
    if(a == par[a]) return a;
    else return par[a] = find(par[a]);
}


void unit(int a, int b){
    int x = find(a);
    int y = find(b);
    if (x == y) return;
    
   
    if(node[x] < node[y]){
        par[x] = y;
        node[y] += node[x];
        node[x] = 0;
    }else{
        par[y] = x;
        node[x] += node[y];
        node[y] = 0;
    }
  
    
    
}


bool same(int a, int b){
    return find(a) == find(b);
}


int main()
{
    cin >> N >> M;
    E.resize(M);
    rep(i,M) cin >> E[i].first >> E[i].second;
    rep(i,M) E[i].first--, E[i].second--;
    par.resize(N);
    node.assign(N,1);
    rep(i,N) par[i] = i;
    
    
    
    ll ans = (ll) (N-1)*N/2;
    vector<ll> D;
    D.push_back(ans);
    
  
    for (int i = M-1; i >= 1; i--) {
        int x = E[i].first;
        int y = E[i].second;
        if(!same(x,y)){
            int xx = find(x);
            int yy = find(y);
            ans -= (ll) node[xx]*node[yy];
            unit(x,y);
        }
        D.push_back(ans);
    }
    
    reverse(all(D));
  
    for (int i = 0; i < M; i++) {
        cout << D[i] << endl;
    }
    
    return 0;
}



Measured memory_bytes: 4212
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>

static const int MOD = 1000000007;
using ll = int64_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int d, n, m;
    while(cin >> d , d){
        cin >> n >> m;
        vector<int> v(n+1);
        for (int i = 1; i < n; ++i) scanf("%d", &v[i]);
        v[n] = d;
        sort(v.begin(), v.end());
        int ans = 0;
        for (int i = 0; i < m; ++i) {
            int x;
            scanf("%d", &x);
            int k = static_cast<int>(upper_bound(v.begin(), v.end(), x) - v.begin());
            ans += min(abs(v[k]-x), abs(v[k-1]-x));
        }
        cout << ans << "\n";
    }
    return 0;
}



Measured memory_bytes: 3344
def LI():return map(int,input().split())
def I(): return input().split()
while(True):
    a,op,b=I()
    a,b=int(a),int(b)
    if op=="?":
        break
    elif op=="+":
        print(a+b)
    elif op=="-":
        print(a-b)
    elif op=="*":
        print(a*b)
    elif op=="/":
        print(a//b)


Measured memory_bytes: 5600
#include<bits/stdc++.h>
using namespace std;
vector<vector<int> > dp(100001,vector<int>(4,-1));
int dfs(vector<int>& swim,vector<int>& bugs,vector<int>& homework,int index,int prev){

if(index==swim.size()){
	return 0;
}
if(dp[index][prev]!=-1) return dp[index][prev];
int happiness=0;
if(prev!=1){
	happiness = max(happiness,dfs(swim,bugs,homework,index+1,1)+ swim[index])	;
}
if(prev!=2){
	happiness = max(happiness,dfs(swim,bugs,homework,index+1,2)+bugs[index]);
}
if(prev!=3){
happiness = max(happiness,homework[index]+dfs(swim,bugs,homework,index+1,3));
}

	dp[index][prev] = happiness;
	return happiness;
}

int main(){
	
	int n;cin>>n;
	vector<int> swim(n), bugs(n), homework(n);
	
	for(int i=0;i<n;i++){
		cin>>swim[i]>>bugs[i]>>homework[i];
	}
	
	cout<<dfs(swim,bugs,homework,0,0);
	
	
}

Measured memory_bytes: 16256
using System;

namespace AtCoder.Abc
{
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var sp = Console.ReadLine().Split(' ');
            var l = int.Parse(sp[0]);
            var r = int.Parse(sp[1]);
            var d = int.Parse(sp[2]);

            int cnt = 0;
            for(int i = l; i <= r; i++)
            {
                if(i%d==0)
                {
                    cnt++;
                }
            }
            Console.WriteLine(cnt);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 27508
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int K,N;
  cin >> K >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int ans = 0;
  sort(A.begin(),A.end());
  for (int i = 0; i < N; i++) {
    if (i == 0) {
      ans = max(ans,A[0] + K - A[N - 1]);
    }
    else {
      ans = max(ans,A[i] - A[i - 1]);
    }
  }
  cout << K - ans << endl;
  return 0;
}


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

int main(){
  int k, s, count=0;;
  cin >> k >> s;
  for(int i=0;i<=k;i++){
    if(i>s)break;
    for(int j=0;j<=k;j++){
      if(i+j>s)break;
      if(s-i-j<=k)count++;
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#define nmax_def 110000
#define Cmax_def 2200
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

int main() {
	ll N, K;
	cin >> N >> K;
	vl A(N);
	vl F(N);
	rep(i, N) {
		cin >> A[i];
	}
	rep(i, N) {
		cin >> F[i];
	}
	sort(A.begin(), A.end(), less<ll>());
	sort(F.begin(), F.end(), greater<ll>());
	ll i = 0;
	ll L = 0;
	ll R = pow(10, 13);
	while (1)
	{
		ll M = (L + R) / 2;
		if (L == M)
			break;
		ll cost_sum = 0;
		rep(i, N) {
			ll highA = M / F[i];
			highA = min(highA, A[i]);
			cost_sum += (A[i] - highA);
		}
		if (cost_sum <= K) {
			R = M;
		}
		else {
			L = M;
		}
	}
	ll ans = R;
	ll M = 0;
	ll cost_sum = 0;
	rep(i, N) {
		ll highA = M / F[i];
		highA = min(highA, A[i]);
		cost_sum += (A[i] - highA);
	}
	if (cost_sum <= K) {
		ans = 0;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define pie 3.141592653589793238462643383279
#define int long long
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mood) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mood;
		}
		x = x * x % mood;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

int n;
string s[300];
int ans;

signed main() {
	cin >> n;
	for (int i = 0; i < n; i++)cin >> s[i];
	for (int i = 0; i < n; i++) {
		bool bl = true;
		for (int j = 0; j < n; j++) {
			for (int k = 0; k < n; k++) {
				if (s[j][(k + i) % n] != s[k][(j + i) % n]) {
					bl = false;
				}
			}
		}
		if (bl)ans += n;
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define per(a,b,c) for(int a=b;a>=c;a--)
#define ios; ios::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define mem(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f
#define ls(x) (x<<1)
#define rs(x) (ls(x)|1)
#define eps 1e-11
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<int> VI;
typedef double db;
mt19937 rnd(random_device{}());
const int mod = 1e9 + 7;
const int N = 1e6 + 5;
const int M = 1e3 + 5;
inline ll gcd(ll a,ll b){ return b?gcd(b,a%b):a; }
inline ll lcm(ll a,ll b){ return a*b/gcd(a,b); }
inline ll ksm(ll x,ll y){ ll res=1; while(y){if(y&1) res=res*x%mod;
x=x*x%mod; y>>=1;} return res; }
ll n, m, k;

int main(){
    ll ans=0;
    scanf("%lld%lld",&n,&k);
    rep(i,1,n){
        ll x,y;
        scanf("%lld%lld",&x,&y);
        ans+=(x*x+y*y<=k*k);
    }
    printf("%lld\n",ans);
    return 0;
}
/*
0 1
0 1 1 2
0 1 1 2

0 1 1 2
1 2 2 3
1 2 2 3
2 3 3 4
*/
//
//                            _ooOoo_
//                           o8888888o
//                           88" . "88
//                           (| -_- |)
//                           O\  =  /O
//                        ____/`---'\____
//                      .'  \|     |//  `.
//                     /  \|||  :  |||//  \
//                    /  _||||| -:- |||||-  \
//                    |   | \  -  /// |   |
//                    | \_|  ''\---/''  |   |
//                    \  .-\__  `-`  ___/-. /
//                  ___`. .'  /--.--\  `. . __
//               ."" '<  `.___\_<|>_/___.'  >'"".
//              | | :  `- \`.;`\ _ /`;.`/ - ` : | |
//              \  \ `-.   \_ __\ /__ _/   .-` /  /
//         ======`-.____`-.___\_____/___.-`____.-'======
//                            `=---='
//        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//                     佛祖保佑      永无BUG


Measured memory_bytes: 3792
import sys
input = sys.stdin.readline
sys.setrecursionlimit(100007)

def main():
    h, w = map(int, input().split())
    grid = [None]*h
    for i in range(h):
        grid[i] = input()
    
    mod = pow(10, 9)+7
    dp = [[0]*w for _ in range(h)]
    dp[0][0] = 1
    for i in range(h):
        for j in range(w):
            dp[i][j] %= mod
            if i != h-1 and grid[i+1][j] == ".":
                dp[i+1][j] += dp[i][j]
            if j != w-1 and grid[i][j+1] == ".":
                dp[i][j+1] += dp[i][j]
    
    print(dp[h-1][w-1])
    
if __name__ == "__main__":
    main()


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

long long int gcd(long long int a, long long int b){
    if(a < b){
        swap(a, b);
    }
    while(a%b != 0){
        a = a%b;
        swap(a,b);
    }
    return b;
}

int main(){
    int n, i;
    long long int t, time = 1;
    cin >> n;
    for (i=0; i<n; i++){
        cin >> t;
        time *= t/gcd(time, t);
    }
    cout << time;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
using namespace std;
 
int a[100000];
 
int main() {
	int N; cin >> N;
	for (int i = 0; i < N; i++)
		cin >> a[i];
 
	map<int, int> mp;
	for (int i = 0; i < N; i++)
		mp[a[i]]++;
 
	int ans = 0;
	for (auto p: mp) {
		int x = p.first;
		int n = p.second;
		if (n < x) ans += n;
		else ans += n - x;
	}
 
	cout << ans << endl;
}


Measured memory_bytes: 5120
#include<iostream>
#include<vector>
#include<queue>
#include<functional>
using namespace std;
vector<int>Y[5005]; vector<pair<int, int>> X[5005];
int n, m, c[5005], p[5005], dist[5005], a, b; queue<int>Q1;
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> Q;
int main() {
	cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> c[i] >> p[i]; }
	for (int i = 1; i <= m; i++) { cin >> a >> b; Y[a].push_back(b); Y[b].push_back(a); }
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++)dist[j] = 100000000; Q1.push(i); dist[i] = 0;
		while (!Q1.empty()) {
			int a1 = Q1.front(); Q1.pop();
			for (int j = 0; j < Y[a1].size(); j++) {
				if (dist[Y[a1][j]] == 100000000) {
					dist[Y[a1][j]] = dist[a1] + 1;
					Q1.push(Y[a1][j]);
				}
			}
		}
		for (int j = 1; j <= n; j++) { if (dist[j] <= p[i])X[i].push_back(make_pair(j, c[i])); }
	}
	for (int i = 1; i <= n; i++)dist[i] = 1000000000;
	Q.push(make_pair(0, 1)); dist[1] = 0;
	while (!Q.empty()) {
		int a1 = Q.top().first, a2 = Q.top().second; Q.pop();
		for (int i = 0; i < X[a2].size(); i++) {
			if (dist[X[a2][i].first] > a1 + X[a2][i].second) {
				dist[X[a2][i].first] = a1 + X[a2][i].second;
				Q.push(make_pair(dist[X[a2][i].first], X[a2][i].first));
			}
		}
	}
	cout << dist[n] << endl;
	return 0;
}

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

#define ll long long
#define EPSION numeric_limits<double>::epsilon()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

//ifstream f("input.in");
//ofstream g("output.out");

signed main(int argc, char **argv)
{
    IOS;
    int r, c, h, w;
    cin>>r>>c>>h>>w;

    int sum = r * c;

    sum -= c * h;
    sum -= w * (r - h);

    cout<<sum;

    return 0;
}



Measured memory_bytes: 256
def ryu(x,y):
    count=0
    for p in range(1,x-1):
        for q in range(p+1,x):
            for r in range(q+1,x+1):
                if p+q+r==y:
                    count+=1
    return count

while 1:
    a,b=map(int,input().split())
    if a+b==0:
        break
    print(ryu(a,b))


Measured memory_bytes: 5596
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rep3(var, min, max) for (ll (var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll (var) = (max) - 1; (var) + 1 > (min); --(var))
#define Mp(a,b) make_pair((a),(b))
#define F first
#define S second
#define Icin(s) ll (s);cin>>(s);
#define Scin(s) ll (s);cin>>(s);
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; }
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll MOD = 1e9 + 7;
ll INF =1e18;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x,y;
    cin>>x>>y;
    if(abs(x-y)<=1){
        cout<<"Brown"<<endl;
    }else{
        cout<<"Alice"<<endl;
    }
}

Measured memory_bytes: 256
N = int(input())
S = input()
letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] * 3

ans = ''
for i in S:
    curidx = letters.index(i) + N
    ans += letters[curidx]
print(ans)


Measured memory_bytes: 3060
--https://www.lua.org/pil/11.4.html
local List = {}
function List.new ()
  return {first = 0, last = -1}
end

function List.pushleft (list, value)
  local first = list.first - 1
  list.first = first
  list[first] = value
end

function List.pushright (list, value)
  local last = list.last + 1
  list.last = last
  list[last] = value
end

function List.popleft (list)
  local first = list.first
  if first > list.last then return false end
  local value = list[first]
  list[first] = nil
  list.first = first + 1
  return value
end

function List.popright (list)
  local last = list.last
  if list.first > last then return false end
  local value = list[last]
  list[last] = nil
  list.last = last - 1
  return value
end

----------

local k=io.read("n")

local que=List.new()
for i=1,9 do
    List.pushright(que,i)
end

for i=1,k-1 do
    local pop=List.popleft(que)
    for j=-1,1 do
        local add=(pop%10)+j
        if 0<=add and add<=9 then
            List.pushright(que,pop*10+add)
        end
    end
end
print(List.popleft(que))

Measured memory_bytes: 6692
def main(size, text):
    pattern = ""
    matchlen = 0

    for i in range(size):
        pattern += text[i]
        while (len(pattern) > 0 and len(pattern) <= len(text[i+1:])):
            if pattern in text[i+1:]:
                matchlen = max(matchlen, len(pattern))
                break
            else:
                pattern = pattern[1:]
    
    return matchlen

if __name__ == '__main__':
    N = int(input())
    S = input()
    print (main(N, S))

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main (void)
{
  int a,b,c;
  cin >> a >> b >> c;

  if(a + b >= c){
    cout << "Yes" << endl;
  }

  else {
    cout << "No" << endl;
  }

  return 0;
}


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

int main() {
    ll n, d, a;
    cin >> n >> d >> a;
    vector<pair<ll, ll>> xh(n);
    rep(i, n) cin >> xh[i].first >> xh[i].second;
    sort(xh.begin(), xh.end());

    ll ans = 0, running_sum = 0;
    queue<pair<ll, ll>> bombs;
    rep(i, n) {
        while (!bombs.empty() && bombs.front().first < xh[i].first) {
            running_sum -= bombs.front().second * a;
            bombs.pop();
        }
        xh[i].second = max(0ll, xh[i].second - running_sum);
        if (xh[i].second <= 0) continue;

        ll cur_till = xh[i].first + 2 * d;
        ll cur_need = (xh[i].second + a - 1) / a;
        ans += cur_need;
        running_sum += cur_need * a;
        bombs.push({cur_till, cur_need});
    }
    cout << ans << endl;
}


Measured memory_bytes: 4992
from typing import List


def main():
    X, N = map(int, input().split())

    if N == 0:
        print(X)
        exit()

    p_lst: List[int] = list(map(int, input().split()))

    for i in range(100):
        if X - i not in p_lst:
            print(X - i)
            exit()
        if X + i not in p_lst:
            print(X + i)
            exit()


if __name__ == "__main__":
    main()


Measured memory_bytes: 10272
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
constexpr int MX = 200005, MOD = 1e9+7;
int n, k;
ll ans;
ll exp(ll b, ll n){
	ll res = 1;
	for(; n; n/=2,(b*=b)%=MOD) if(n%2) (res *= b) %= MOD;
	return res;
}
ll fact[MX] = {1}, invf[MX];
void setcomb(int n){
	for(int i = 1; i <= n; i++) fact[i] = (fact[i-1] * i) % MOD;
	invf[n] =  exp(fact[n] ,MOD-2);
	for(int i = n; i > 0; i--) invf[i-1] = (invf[i] * i) % MOD;
}
inline ll comb(int a, int b){return fact[a] * invf[a-b] % MOD * invf[b] % MOD;}
int main(){
	scanf("%d%d", &n, &k);
	setcomb(MX-1);
	k = min(k+1,n);
	rep(i,k) ans += comb(n,i) * comb(n-1,i) % MOD;
	printf("%lld\n", ans % MOD);
}

Measured memory_bytes: 3328
#include<stdio.h>
#include<string.h>
#define N 11
int main(void){


     
  int i,j;
  double iv[N];
  char in[100],w[10];
  char *e;
  while( scanf("%s",&in) != EOF){    
    
    double m=0,isom=0,point=0;
    int k=0; 
    e=strtok(in,",");
    iv[0]=atoi(e);
    for(i=1;i<=N;i++){ 
      e=strtok(NULL,",");
      iv[i]=atoi(e);
    }
    m=iv[10]/(iv[10]+iv[11]);
    for(j=0;j<10;j++){
      isom=isom+iv[j];
    }
    while(point<m*isom){
      point=point+iv[k];
      k++;
    }
    printf("%d\n",k);
  }
  
  return 0;
}

Measured memory_bytes: 1728
#include <bits/stdc++.h>
typedef uint64_t ULL;
using namespace std;
ULL GCD(ULL x,ULL y){return y==0?x:GCD(y,x%y);}
int main()
{
  ULL A,B,greatest,index=2;
  set<ULL> p;
  cin>>A>>B;
  greatest=GCD(A,B);
  p.insert(1);
  while(greatest>=index*index)
  {
    if(greatest%index==0){p.insert(index);while(greatest%index==0){greatest/=index;}}
    else if(index==2)index++;
    else index+=2;
  }
  p.insert(greatest);
  cout<<p.size()<<endl;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
num=[abs(a[0])]
def ab(num1):
    return abs(num1)
def ap(num2):
    num.append(num2)
for i in range(n-1):
    ap(ab(a[i]-a[i+1]))
ap(ab(a[-1]))
num4=sum(num)
print(num4-num[0]-num[1]+ab(a[1]))
for i in range(n-2):
    print(num4-num[i+1]-num[i+2]+ab(a[i+2]-a[i]))
print(num4-num[-1]-num[-2]+ab(a[-2]))


Measured memory_bytes: 14048
import itertools as itr

n, a, b, c = list(map(int, input().split()))
l = []
for _ in range(n):
    l.append(int(input()))
    
l.sort()

cost = 10**9
for cr in range(1, n-1):
    for ccomb in itr.combinations(l, cr):
        ccosti = abs(c-sum(ccomb)) + (cr-1)*10
        cl = l[:]
        for icomb in ccomb:
            cl.remove(icomb)
        for br in range(1, n-cr):
            for bcomb in itr.combinations(cl, br):
                bcosti = abs(b-sum(bcomb)) + (br-1)*10
                bl = cl[:]
                for icomb in bcomb:
                    bl.remove(icomb)
                for ar in range(1, n+1-cr-br):
                    for acomb in itr.combinations(bl, ar):
                        acosti = abs(a-sum(acomb)) + (ar-1)*10
                        if cost > ccosti + bcosti + acosti:
                            cost = ccosti + bcosti + acosti

print(cost)

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

int main(){
    int X;
    cin >> X;
    if(X>=30){
        cout << "Yes";
    }else{
        cout << "No";
    }
}

Measured memory_bytes: 3620
n = int(input())

a_list=[]
for i in range(n):
  a = int(input())
  a_list.append(a)

saidai1=max(a_list)
saidai1_index=a_list.index(saidai1)
saidai2=max(a_list[:saidai1_index]+a_list[saidai1_index+1:])

for i in range(n):
  if a_list[i]==saidai1:
    print(saidai2)
  else:
    print(saidai1)
    



Measured memory_bytes: 68512
#include <stdio.h>

int fb[50];

int fib(int n){
  if(n==0||n==1)return fb[n]=1;
  if(fb[n]!=-1)return fb[n];
  return fb[n]=fib(n-1)+fib(n-2);
}

int main(){
  int n,i;
  for(i=0;i<50;i++){
    if(i<50)break;
  }
  for(i=0;i<50;i++)fb[i]=-1;

  scanf("%d",&n);
  printf("%d\n",fib(n));

  return 0;
}



Measured memory_bytes: 2112
#include<iostream>
#include<string>
using namespace std;
int numS = 0,numT = 0;
int sum = 0;
int main(){
	string s;
	cin>>s;
	for(int i=0;i<s.length();i++){
		if(s[i] == 'S'){
			numS++;
			sum+=numT;
			numT=0;
		}else{
			if(numS==0){
				numT++;
			}else{
				numS--;
			}
		}
	}
	sum+=numS;
	cout<<sum<<endl;
	return 0;
} 

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

int main()
{
    int N, h = 0, t = 0;

    cin >> N;

    int H[N];

    for( int i = 0; i < N; i++ )
    {
        cin >> H[i];
    }

    for( int i = 0; i < N; i++ )
    {
        if( h <= H[i] )
        {
            h = H[i];
            t++;
        }
    }

    cout << t << endl;

}



Measured memory_bytes: 256
#include<cstdio>
#include<utility>
#include<cassert>
#include<algorithm>

using namespace std;

typedef pair<int,int> P;
typedef pair<int,P> PP;

const int B=1500;

struct Segtree{
	struct Node{
		int lch,rch;
		int val;
		long long all;
		Node(){
			lch=-1,rch=-1,val=0,all=0;
		}
	};
	Node nodes[B*80];
	int c;
	void init(){
		c=1;
		for(int i=0;i<B*80;i++) nodes[i]=Node();
	}
	void add(int l,int r,int k,int a,int b){
		if(l<=a&&b<=r){
			nodes[k].val++;
			nodes[k].all+=(b-a);
			return;
		}else if(r<=a||b<=l) return;
		if(nodes[k].lch==-1){
			nodes[k].lch=c++;
			nodes[k].rch=c++;
			assert(c<=B*80);
		}
		add(l,r,nodes[k].lch,a,(a+b)/2);
		add(l,r,nodes[k].rch,(a+b)/2,b);
		int le=max(l,a);
		int ri=min(r,b);
		nodes[k].all+=(ri-le);
	}
	void add(int l,int r){
		add(l,r,0,0,1001001001);
	}
	long long sum(int l,int r,int k,int a,int b){
		if(l<=a&&b<=r){
			return nodes[k].all;
		}else if(r<=a||b<=l) return 0;
		long long res=0;
		if(nodes[k].lch!=-1){
			res+=sum(l,r,nodes[k].lch,a,(a+b)/2);
			res+=sum(l,r,nodes[k].rch,(a+b)/2,b);
		}
		int le=max(a,l),ri=min(b,r);
		res+=(long long)nodes[k].val*(ri-le);
		return res;
	}
	long long sum(int l,int r){
		return sum(l,r,0,0,1001001001);
	}
};

Segtree segs[100100/B+1];

PP pps[100100];

int N,M,Q;

int main(){
	scanf("%d%d%d",&N,&M,&Q);
	for(int i=0;i<M;i++){
		int a,b,v;
		scanf("%d%d%d",&a,&b,&v);
		pps[i]=PP(v,P(a,b));
	}
	sort(pps,pps+M);
	for(int i=0;i<M/B;i++) segs[i].init();
	for(int i=0;i<M;i++){
		int a=pps[i].second.first;
		int b=pps[i].second.second;
		segs[i/B].add(a,b+1);
	}
	for(int q=0;q<Q;q++){
		int a,b;
		long long x;
		scanf("%d%d%lld",&a,&b,&x);
		long long sum=0;
		int id=0;
		for(id=0;id<M/B;id++){
		//	long long cur=val[id][b]-val[id][a-1];
			long long cur=segs[id].sum(a,b+1);
			if(sum+cur>=x) break;
			sum+=cur;
		}
		for(int i=id*B;;i++){
			int ca=pps[i].second.first,cb=pps[i].second.second;
			int le=max(ca,a),ri=min(cb,b);
			int ad=max(0,ri-le+1);
			sum+=ad;
			if(sum>=x){
				printf("%d\n",pps[i].first);
				break;
			}
		}
	}
	return 0;
}

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

int main() {

  int N, A, min, tmp_min;
  cin >> N;
  min = 36;
  for (int i=0; i < N; i++) {
    cin >> A;
    tmp_min = 0;
    while (A % 2 == 0) {
      A /= 2;
      tmp_min += 1;
    }
    if (tmp_min < min)
      min = tmp_min;
    else
      continue;
  }
  cout << min << endl;
}

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

struct UnionFind {
	vector<int> par;
	vector<int> rank;
	
	UnionFind(int N){
		rep(i,N){
			par.push_back(i);
			rank.push_back(0);
		}
	}
	
	int root(int x) {
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}
	
	void unite(int x, int y){
		int rx = root(x);
		int ry = root(y);
		if(rx == ry) return;
		if(rank[x] < rank[y]){
			par[rx] = ry;
		}else{
			par[ry] = rx;
			if(rank[rx] == rank[ry]) rank[rx]++;
		}
	}
	
	bool same(int x, int y){
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

int main(){
	int N,Q;
	cin >> N >> Q;
	UnionFind tree(N);
	
	rep(i,Q){
		int p,a,b;
		cin >> p >> a >> b;
		if(p == 1){
			cout << tree.same(a,b) << endl;
		}
		if(p == 0){
			tree.unite(a,b);
		}
	}
	
	return 0;
}




Measured memory_bytes: 3288
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;

int main(){
    double N, M, A, B, C;
    string s1, s2;
    cin >> A >> B >> C;
    if(A / C <= B)cout << "Yes" << endl;
    else cout << "No" << endl;

}

Measured memory_bytes: 3744
package main

import (
	"fmt"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

func main() {

	var x uint64
	fmt.Scan(&x)

	m := x / 11
	r := x % 11
	m *= 2
	if r == 0 {

	} else if r <= 6 {
		m++
	} else {
		m += 2
	}
	out(m)

}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define uniq(x) (x).erase(unique(ALL(x)),(x).end())
#define SORT(x) sort(ALL(x))
#define REV(x) reverse(ALL(x))
#define foreach(it,x) for(__typeof((x).begin()) it=(x).begin();it!=(x).end();it++)
#define debug(x) cerr<<#x<<"="<<(x)<<endl
#define gett() cerr<<"Time:"<<clock()<<"ms."<<endl
#define ri(x) scanf("%d",&x)
#define rl(x) scanf("%lld",&x)
#define rlcfpoj(x) scanf("%I64d",&x)
#define pi(x) printf("%d",x)
#define pl(x) printf("%lld",x)
#define plcfpoj(x) printf("%I64d",x)
#define lfd() printf("\n")
#define sp() printf(" ")
#define inrep(x) int x;scanf("%d",&x);while(x--)
#define testbit(mask,i) (((mask)>>(i))&1)
#define setbit(mask,i) ((mask)|(1<<i))
#define delbit(mask,i) ((mask)^(1<<i))
int a,b;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>a>>b;
	cout<<max(0,a-b*2)<<endl;
	return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()


int N = 100010;
int prime[100010];//i番目の素数
bool is_prime[100011]; //is_prime[i] がTrueならiは素数

int sieve(int n){
  int p = 0;
  for (int i = 0; i <= n; i++) is_prime[i] = true;
  is_prime[0] = is_prime[1] = false;
  for (int i = 2; i <= n; i++){
    if (is_prime[i]){
      prime[p++] = i;
      for (int j = 2*i; j <=n; j+=i) is_prime[j] = false;
    }
  }
  return p;//pは素数の数
}

int main(){
  sieve(N);
  int ans[N];
  ans[0] = 0;
  rep (i, N-1){
    if ((i + 1) % 2 == 1 && is_prime[i+1] && is_prime[(i + 2)/2]){
        ans[i+1] = ans[i] + 1;
    }
    else{
      ans[i + 1] = ans[i];
    }
  }
  int Q;
  int l, r;
  cin >> Q; 
  rep(i, Q){
    cin >> l >> r;
    cout << ans[r]-ans[l-1] <<endl;
  }
}


Measured memory_bytes: 1152
N = int(input())
S = list(input())

white = [0] * N
black = [0] * N

for i in range(N):
    if S[i] == '#':
        white[i] += 1
    else:
        black[i] += 1

for i in range(N-1):
    white[i+1] += white[i]
    black[i+1] += black[i]

ans = min(white[N-1],black[N-1])
for i in range(N-1):
    ans = min(ans,white[i]+(black[-1] - black[i]))
print(ans)



Measured memory_bytes: 65520
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>

#include <string>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>
#include <algorithm>
#include <random>
#include <iomanip>
using namespace std;

const long long int maxd = 0x3f3f3f3f3f3f3f3f;
int main(int argc, char *argv[]) {
    vector<pair<int, pair<int, long long int>>> vp;
    int n, mm;
    cin >> n >> mm;
    
    for (int i = 0; i < mm; i++) {
        long long int l, r, c;
        cin >> l >> r >> c;
        vp.push_back(make_pair(l, make_pair(r, c)));
    }
    sort(vp.begin(), vp.end());
    
    map<int, long long int> m;
    m[1] = 0;
    for (int i = 0; i < vp.size(); i++) {
        long long int mind = -1;
        int start = vp[i].first, end = vp[i].second.first;
        if (start == end)
            continue;
        long long int d = vp[i].second.second;
        
        auto it1 = m.lower_bound(start);
        if (it1 == m.end()) {
            cout << -1 << endl;
            return 0;
        }

        mind = it1 -> second + d;
        auto it2 = m.lower_bound(end);
        if (it2 == m.end()) {
            m[end] = mind;
        }
        else if (it2 -> second > mind) {
            m[end] = mind;
        }
        it2 = m.lower_bound(end);
        it1 = it2;
        for (it1--; it1 != m.begin() && it1 -> second >= it2 -> second; it1--) {

        }
        it1++;
        m.erase(it1, it2);
    }
    if (m.find(n) == m.end())
        m[n] = -1;
    cout << m[n] << endl;
}



Measured memory_bytes: 8688
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();

    int sum = a + b + c;

    if(sum >= 22){
      System.out.println("bust");
    }else{
      System.out.println("win");
    }
  }
}

Measured memory_bytes: 21844