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

using namespace std;

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

#define chmax(a,x) a=max(a,x)

typedef long long ll;

int N, S, T;
ll dp[2][3100], ans;
ll A[3100], B[3100];

int main() {
  
  cin >> N >> T >> S;
  rep(i, N)
    cin >> A[i] >> B[i];
  
  rep(i, N) rep(j, T+1) {
    chmax(dp[(i+1)&1][j], dp[i&1][j]);
    if(j+B[i] <= T) {
      if(j < S && S < j+B[i]) continue;
      chmax(dp[(i+1)&1][j+B[i]], dp[i&1][j] + A[i]);
      chmax(ans, dp[(i+1)&1][j+B[i]]);
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 1264
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void assert_NO(T condition){ if(!condition){ cout << "NO" << endl; exit(0); } }
template<class T> inline void assert_No(T condition){ if(!condition){ cout << "No" << endl; exit(0); } }
template<class T> inline void assert_minus_1(T condition){ if(!condition){ cout << -1 << endl; exit(0); } }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd_calc(T a, T b){ if(b){ return gcd_calc(b, a % b); }else{ return a; }}
template<class T> T gcd(T a, T b){ if(a < b) swap(a, b); return gcd_calc(a, b); }
template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
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; }
inline int at(int x, int k){ return (x >> k) & 1; }
random_device rnd;
#define rep(i, n) for(int i = 0; i < (n); i++)

int main(){
    int X, Y, Z;
    cin >> X >> Y >> Z;
    cout << Z << " " << X << " " << Y << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>



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

using namespace std;
int a;

int main(){
  cin >> a;
  if(a%10 ==9||a/10==9) cout << "Yes" <<endl;
  else cout << "No" <<endl;
  return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: usize,
        b: usize,
        c: usize,
    }

    println!("{}", std::cmp::min((b / a), c));
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll a,b,n; cin>>a>>b>>n;
  ll x=min(b-1,n);
  ll ans=(a*x/b)-a*(x/b);
  cout<<ans<<endl;
}

Measured memory_bytes: 3640
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int N=in.nextInt();
		int M=in.nextInt();
		int[]arr=new int[N];
		int sum =0;
		int count=0;
		
		for (int i = 0; i < N; i++) {
			arr [i]=in.nextInt();
			sum=sum+arr[i];
		}
		double pop=(double)sum/(M*4);
		for (int i = 0; i < arr.length; i++) {
			if(arr[i]>=(pop))
				count++;
		}
		if(count>=M)
			System.out.println("Yes");
		else
			System.out.println("No");
		
	}
}


Measured memory_bytes: 27148
#include <stdio.h>

int main()
{
	int n;
	
	scanf("%d", &n);
	if(n == 1){
		printf("Hello World");
	}
	else if(n == 2){
		int a, b;
		
		scanf("%d %d", &a, &b);
		printf("%d", a+b);
	}
	
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;


int main() {
	int n;
	cin >> n;
	int sum = 0;
	for (int i = 1; i <= n; i++) sum += i;
	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
#![allow(unused_mut)]
#![allow(non_snake_case)]

#![allow(unused_imports)]
use std::collections::HashSet;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::collections::VecDeque;
use std::cmp::{max, min};

// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        l: u64,
        r: u64,
    }
    if l<= 2019 && 2019 <= r {
        println!("{}", 0);
        return;
    }
    if r-l+1 >= 2019 {
        println!("{}", 0);
        return;
    }
/*
    let mut m = u64::min_value();
    let si = l % 2019;
    for i in l..r {
        if i != l && i % 2019  == si {
            break;
        }
        let sj = (i+1) % 2019;
        for j in i+1..r +1{
            if j != i+1 && i % 2019  == sj {
                break;
            }
            m = std::cmp::max(m, (i * j) % 2019);
        }
    }
    println!("{}", m);
    */

    let mut l = l % 2019;
    let mut r = r % 2019;
    let s;
    let e;
    if l < r {
        s = l;
        e = r;
    } else {
        s = r;
        e = l;
    }
    let mut m = u64::max_value();
    for i in s..e+1 {
        for j in s..e+1 {
            if i == j {
                continue;
            }
            m = min(m, (i * j) % 2019);
        }
    }
    println!("{}", m);
}

Measured memory_bytes: 4352
import math

n, m = map(int, input().split())

if abs(n - m) > 1:
    print(0)
    exit()

a = max(n, m)
b = min(n, m)


if a - b == 1:
    print(math.factorial(a) * math.factorial(b) % (10 ** 9 + 7))
else:
    print(math.factorial(a) * math.factorial(b) * 2 % (10 ** 9 + 7))

Measured memory_bytes: 5184
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
typedef long long ll;
const ll INF = 1e15;
//dp[i][j] -> i番目までの品物を選んで価値ｊを達成する最小重み
int main(){
    int N,W;
    cin >> N >> W;
    vector<ll> w(N),v(N);
    rep(i,N)cin >> w[i] >> v[i];

    vector<vector<ll> > dp(N+1,vector<ll>(100001,INF));
    dp[0][0] = 0;
    rep(i,N){
        rep(j,100001){
            if(j - v[i] >= 0) {
                dp[i+1][j] = min(dp[i][j],dp[i][j - v[i]] + w[i]); 
            }else{
                dp[i+1][j] = dp[i][j];
            }
        }
    }
    for(int i = 100000; i > 0; i--){
        if(dp[N][i] <= W){
            cout << i << endl;
            break;
        }
    }
    return 0;
}

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


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

int main() {
	int n, d;
	double x, y;
	cin >> n >> d;

	int ans = 0;	
	for (int i = 0; i < n; i++) {
		cin >> x >> y;
		if (sqrt(x*x+y*y) <= d) ans++;
	}

	cout << ans << endl;	
}

Measured memory_bytes: 3748
#include<bits/stdc++.h>
using namespace std;
vector <int> des[1000100];
int vis[1000100];
bool dfs(int s,int d)
{
	vis[s]=d;
	for (int k=0;k<des[s].size();k++)
	{
		if (vis[des[s][k]]==d) return false;
		if (vis[des[s][k]]==-1)
		{
			if (!dfs(des[s][k],!d)) return false;
		}
	}
	return true;
}
int main()
{
	int n,m;scanf("%d%d",&n,&m);
	for (int i=1;i<=m;i++)
	{
		int u,v;scanf("%d%d",&u,&v);
		des[u].push_back(v);
		des[v].push_back(u);
	}
	memset(vis,255,sizeof(vis));
	if (!dfs(1,0)) {printf("%lld\n",(long long)n*(n-1)/2-m);return 0;}
	int p[2];p[0]=p[1]=0;
	for (int i=1;i<=n;i++) p[vis[i]]++;
	printf("%lld\n",(long long)p[0]*p[1]-m);
}
	

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

int main() {
	int w, n, a, b; cin >> w >> n; int arr[w]; char cha;
	for (int i = 0; i < w; i++) arr[i] = i + 1;
	for (int i = 0; i < n; i++) {
		cin >> a >> cha >> b; swap(arr[a - 1], arr[b - 1]);
	}
	for (int i = 0; i < w; i++) cout << arr[i] << endl;
	return 0;
}


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0; (i)<(n); ++(i))
#define rep1(i,n) for(int i=1; (i)<(n); ++(i))
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const long long llINF = 1LL<<60;
const int INF = 1e9;
int main(){
    ll n;  cin >> n;
    vector<ll> a(n+1), ans(n+1);
    rep(i,n) {
      cin>> a[i];
      ans[a[i]]=i;
    }
    rep1(i,n+1) cout << ans[i]+1 << " ";

        

    return 0;
}

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

int main()
{
  string s;
  cin >> s;
  
  int ans = 0;
  for (int i = 0; i < 3; i++)
  {
    if (s.at(i) == '1') ans++;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
using namespace std;

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

ll cal(int n, ll x) {
    if(n==0 && x==1) return 1;
    /*漸化式は自分で解く
    a(0)=1, a(n+1)=2*a(n)+3
    →a(n)=2^(n+2)-3
    同様に、b(n)=2^(n+1)-1*/
    ll sum=(1LL<<(n+1))-3, p=(1LL<<n)-1; //a(n-1),b(n-1)
    if(x<=1) return 0;
    else if(x<=sum+1) return cal(n-1, x-1); //半分未満
    else if(x<sum*2+3) return p+1+cal(n-1, x-sum-2); //半分以上全部未満
    else return p*2+1;
}

int main(){
  int n;
  ll x;
  cin >> n >> x;
  cout << cal(n,x) << endl;
  return 0;
}

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

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> x(n);
    rep(i, n) cin >> x.at(i);
    
    int sum = 0;
    rep(i, n) {
        int d = min(x.at(i), abs(k - x.at(i)));
        sum += 2*d;
    }
    cout << sum << endl;
    return 0;
}

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


int main(int argc, const char * argv[]){
    double a,b,c,d,e,f;
    double x,y;
    
    while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f) != EOF){
        if((-1000 > a || a > 1000) ||
           (-1000 > b || b > 1000) ||
           (-1000 > c || c > 1000) ||
           (-1000 > d || d > 1000) ||
           (-1000 > e || e > 1000) ||
           (-1000 > f || f > 1000)){
            exit(0);
        }
//        if (x == -0.0)
//            x = 0.0;
//        if (y == -0.0)
//            y = 0.0;
        x = (c * e - b * f)/(a * e - b * d);
        y = (c * d - a * f)/(b * d - a * e);
    
        printf("%.3lf %.3lf\n",x + 0.0001,y + 0.0001);
    }
    return 0;
}

Measured memory_bytes: 656
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

#include <bits/stdc++.h>
using namespace std;



int main() {
    int N, M;
    
    int sum = 0;
    int input;
    cin >> N >> M;
    rep(i,M){
        cin >> input;
        sum += input;
    }

    if(N-sum<0){
        cout << "-1" << endl;
    }else{
        cout << N-sum << endl;
    }
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

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

ll GCD(ll a, ll b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
ll LCM(ll a, ll b) { return a * b / GCD(a, b); }


int main(){
    int N, M; // N: 問題数 M: 提出数
    cin >> N >> M;

    map<int, int> ques; // 問題番号: pen数
    vector<bool> solved(N, false);

    vector<int> p(M);
    vector<string> S(M);

    rep(i, M) {
        cin >> p.at(i) >> S.at(i);
        ques.insert(make_pair(i, 0));
    }

    int ans = 0;
    int pen = 0;

    rep(i, M) {
        int q = p.at(i) - 1;
        if (S.at(i) == "AC") {
            if (!solved.at(q)){
                ans++;
                solved.at(q) = true;
            }
        } else {
            if (!solved.at(q)){
                ques.at(i)++;
            }
        }
    }

    rep(i, M) {
        int q = p.at(i) - 1;
        if (solved.at(q)) pen += ques.at(i);
    }

    cout << ans << " " << pen << endl;
}

Measured memory_bytes: 10752
//In The Name Of God
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<string> vs;
typedef pair<ll, ll> ii;
typedef pair<int, ii> iii;
typedef pair<double, double> dd;
typedef pair<dd, double> ddd;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<dd> vdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ii> vii;
typedef vector<vii> vvii;

#define forn(i, n) for (int i = 0; i < n; i++)
#define forr(i, n) for (int i = n; i >= 0; i--)
#define forne(i, x, n) for (int i = x; i < n; i++)
#define forre(i, x, n) for (int i = n; i >= x; i--)
#define all(a) (a).begin(), (a).end()
#define eps 1e-9
#define inf 1e9

const int maxn = 2e5 + 10;
ll arr[maxn], t[4 * maxn], lazy[4 * maxn];

ll query(int node, int a, int b, int i, int j) {
    if (a > b || a > j || b < i) return -inf;
    if (lazy[node] != 0) {
        t[node] += lazy[node];
        if (a != b) {
            lazy[node * 2] += lazy[node];
            lazy[node * 2 + 1] += lazy[node];
        }
        lazy[node] = 0;
    }
    if (a >= i && b <= j) return t[node];
    ll q1 = query(node * 2, a, (a + b) / 2, i, j);
    ll q2 = query(node * 2 + 1, (a + b) / 2 + 1, b, i, j);

    return max(q1, q2);
}

void update(int node, int a, int b, int i, int j, ll inc) {
    if (a > b) return;
    if (lazy[node] != 0) {
        t[node] += lazy[node];
        if (a != b) {
            lazy[node * 2] += lazy[node];
            lazy[node * 2 + 1] += lazy[node];
        }
        lazy[node] = 0;
    }
    if (a > b || a > j || b < i) return;

    if (a >= i && b <= j) {
        t[node] += inc;
        if (a != b) {
            lazy[node * 2] += inc;
            lazy[node * 2 + 1] += inc;
        }
        return;
    }
    update(node * 2, a, (a + b) / 2, i, j, inc);
    update(node * 2 + 1, (a + b) / 2 + 1, b, i, j, inc);
    t[node] = max(t[node * 2], t[node * 2 + 1]);
}

ll h[maxn], beu[maxn];

int main() {
    ios::sync_with_stdio(false);
    int n; cin >> n;
    forn(i, n) cin >> h[i];
    forn(i, n) cin >> beu[i];
    ll ans = 0;
    forn(i, n) {
        ll cur = query(1, 0, n - 1, 0, h[i]);
        ans = max(ans, cur + beu[i]);
        update(1, 0, n - 1, h[i], h[i], beu[i] + cur);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 10496
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x, n, y, z=0, i, t;
	scanf("%d", &n);
	if(n>=1 && n<=100){
			z=800*n;
		if(n>15){
			i=n/15;
			t=z-(i*200);
			printf("%d", t);
		}
		else{
			printf("%d", z);
		}
	}
	else{
		printf("Error");
	}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<string>
#include<queue>
using namespace std;

int main() {
  int key;
  char com[20];
  priority_queue<int> PQ;

  while (1) {
    scanf("%s", com);
    if (com[0] == 'e' && com[1] == 'n') break;

    if (com[0] == 'i') {
      scanf("%d", &key);
      PQ.push(key);
    } else if (com[1] == 'x') {
      printf("%d\n", PQ.top());
      PQ.pop();
    } else if (com[0] == 'e') {
      break;
    }
  }
}


Measured memory_bytes: 6532
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

signed main(){
	int a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;
	int z = max(x, y);
	int ans = 1e9;
	for(int i = 0; i <= 2 * z; i += 2){
		int x1 = i / 2, y1 = i / 2;
		int need_x = max(0, x - x1), need_y = max(0, y - y1);
		ans = min(ans, i * c + need_x * a + need_y * b);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3596
arr=Array.new
num=gets.split
num.each do |s|
  if s=='+'
    b=arr.pop
    a=arr.pop
    arr.push(a+b)
  elsif s=='-'
    b=arr.pop
    a=arr.pop
    arr.push(a-b)
  elsif s=='*'
    b=arr.pop
    a=arr.pop
    arr.push(a*b)
  else
    arr.push(s.to_i)
  end
end
puts arr.pop

Measured memory_bytes: 8640
module Main where

import Control.Applicative
import Text.Printf
import Numeric

main :: IO ()
main = do
  { _ <- getLine
  ; xs <- getInts
  ; let mx = maximum xs
  ; let mn = minimum xs
  ; let sm = sum xs
  ; putInts [mn, mx, sm]
  }

--

getInts :: IO [Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO ()
putInts = putStrLn . unwords . map show

getDoubles :: IO [Double]
getDoubles = map read . words <$> getLine

putDoubles :: [Double] -> IO ()
putDoubles = putStrLn . unwords . map showDouble

showDouble :: Double -> String
showDouble x = showFFloat Nothing x ""

getStrings :: IO [String]
getStrings = words <$> getLine 

readInt' :: String -> Int
readInt' = read



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


vector<int> arregloPatron(string patron){
	int i= 0, j = 1;
	vector<int> arr(patron.size());
	
	while( j < patron.size() ) {
		if( patron[i] != patron[j] ){
			if( i != 0){
				i = arr[i-1];
			}
			else {
				arr[j] = 0;
				j++;
			}
			
		}
		else if( patron[i] == patron[j] ){
			arr[j] = i+1;
			i++; j++;
		}
	}
	
	return arr;
	
}

void kmp(string texto, string patron, set<int> &res ){
	vector<int> lps;
	lps = arregloPatron(patron);
	
	int i = 0, j = 0;
	
	while( i < texto.length() ){
		if( texto[i] == patron[j] ){
			i++;
			j++;
		}
		else {
			if( j != 0 ){
				j = lps[j-1];
			}
			else {
				i++;
			}
		}
		
		//cout << i << " " << j << endl;
		if( j == patron.size() ){
			cout << i-patron.size() << endl;
			//res.insert(i-patron.size());
		}
	}
	
	//cout << j << endl;
	
	
	//return false;
}


int main(){
	
	
	string original, patron;
	cin >> original >> patron;
	set<int> res;
	kmp(original, patron, res);
	//for(set<int> i: res)
	//	cout << i << endl;
	//set <int> :: iterator it; 
	//for(it = res.begin(); it != res.end(); it++)
	//	cout << *it << endl;
	
	
	return 0;
}


Measured memory_bytes: 5048
import itertools

n = int(input())
AB = [(int(s[0]), int(s[-1])) for s in map(str, range(1,n+1))]

def count(a, b):
    return sum([1 for ab in AB if ab[0] == a and ab[1] == b])

ans = 0
for pair in itertools.product(range(10), range(10)):
    a, b = pair
    c1 = count(a, b)
    c2 = count(b, a)
    ans += c1 * c2
print(ans)

Measured memory_bytes: 55132
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int a = scan.nextInt();
    int b = scan.nextInt();
    int c = scan.nextInt();
    int d = scan.nextInt();
    for (int i = 0; i < 1000; i++){
      c -= b;
      if (c <= 0){
        System.out.println("Yes");
        break;
      }
      a -= d;
      if (a <= 0){
        System.out.println("No");
        break;
      }
    }
  }
}


Measured memory_bytes: 35684
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
from bisect import bisect_left, bisect_right

N, M = map(int, input().split())
AB = [[0, 0]] + [[int(i) for i in input().split()] for _ in range(N)] + [[1 << 40, 0]]
LR = [[int(i) for i in input().split()] for _ in range(M)]

N += 2

# 座圧
compressed = sorted([a for a, b in AB])
bomb = [0] * N
for a, b in AB :
  a = bisect_left(compressed, a)
  bomb[a] = b
diff = [bomb[i-1] ^ bomb[i] for i in range(1, N)]

# 辺を貼る
vec = [[] for _ in range(N)]
convert = {}
for i, (l, r) in enumerate(LR) :
  if compressed[-1] < l or r < compressed[0] : continue
  l = bisect_left(compressed, l) - 1
  r = bisect_right(compressed, r) - 1
  if r <= l : continue
  vec[l].append(r)
  vec[r].append(l)
  convert[(l, r)] = i

# 全域木の構築
visited = [False] * N
parent = [-1] * N
ret = []
def dfs(pre, cur) :
  for nex in vec[cur] :
    if nex == pre or visited[nex] :
      continue
    visited[nex] = True
    dfs(cur, nex)
  if pre == -1 and diff[cur] == 1 :
    return False
  if diff[cur] == 1 :
    diff[cur] ^= 1
    diff[pre] ^= 1
    ret.append(convert[(min(pre, cur), max(pre, cur))] + 1)
  return True

for i in range(N - 1) :
  if visited[i] : continue
  visited[i] = True
  if not dfs(-1, i) :
    print(-1)
    break
else :
  ret.sort()
  print(len(ret))
  print(*ret)

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

using namespace std;
const int N = 200010;
#define INF 1e16
typedef long long ll;
 
string to_string(string s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifndef ONLINE_JUDGE
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

int n;
pair<ll, int> tree[2][N<<2];
ll C, x[2][N], v[N], cum[2][N], arr[2][N];
void build(int id, int node, int l, int r) {
  if (l == r) { 
    if (id == 0) tree[0][node] = {cum[0][l] - x[0][l], l}; 
    else tree[1][node] = {cum[0][l] - 2LL*x[0][l], l};
    return;
  } 
  int mid = (l + r) >> 1;
  build(id, node << 1, l, mid);
  build(id, node << 1|1, mid + 1, r);
  if (tree[id][node << 1].first >= tree[id][node << 1|1].first) {
    tree[id][node] = tree[id][node << 1];
  } else tree[id][node] = tree[id][node << 1|1];
}
pair<ll, int> query(int id, int node, int l, int r, int i, int j) {
  if (r < i || l > j) return {-INF, -INF};
  if (i <= l && r <= j) {
    return tree[id][node]; 
  } int mid = (l + r) >> 1;
  auto lft = query(id, node << 1, l, mid, i, j);
  auto rgt = query(id, node << 1|1, mid+1, r, i, j);
  if (lft.first >= rgt.first) return lft;
  return rgt;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> C;
  for (int i = 1; i <= n; ++i) cin >> x[0][i] >> v[i];
  for (int i = 1; i <= n; ++i) x[1][n - i + 1] = C - x[0][i];
  for (int i = 1; i <= n; ++i) {
    cum[0][i] = cum[0][i - 1] + v[i];
    cum[1][i] = cum[1][i - 1] + v[n - i + 1];
  }
  build(0, 1, 1, n);
  build(1, 1, 1, n);
  ll ans = 0;
  for (int lft = 0; lft <= n; lft++) {
    pair<ll, int> val = query(0, 1, 1, n, 1, n-lft);
    if (val.first < 0) val = {0, 0};
    ll lval = cum[1][lft] - x[1][lft];
    ans = max(ans, lval);
    // debug(cum[1][lft] - x[1][lft]);
    ans = max(ans, val.first);
    // debug(ans);
    ans = max(ans, lval + val.first - x[1][lft]);
    val = query(1, 1, 1, n, 1, n-lft);
    if (val.first < 0) val = {0, 0};
    ans = max(ans, lval + val.first);
  }
  cout << ans << '\n';
}

Measured memory_bytes: 15748
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n,c;
  cin>>n>>c;
  int a,sum=0;
  rep(i,c){
    cin>>a;
    sum+=a;
  }
  if(sum%(n+1)!=0){
    cout<<sum/(n+1)+1<<'\n';
  }
  else{
    cout<<sum/(n+1)<<'\n';
  }
  return(0);
}



Measured memory_bytes: 3228
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define SIZE 20005

int H,N;
int dp[SIZE];

int main(){

	scanf("%d %d",&H,&N);

	dp[0] = 0;
	for(int i = 1; i < SIZE; i++){

		dp[i] = BIG_NUM;
	}

	//dp[総ダメージ] = 最小消費魔力

	int A,B;

	for(int i = 0; i < N; i++){

		scanf("%d %d",&A,&B);

		for(int i = 0; i <= H-1; i++){

			if(dp[i] == BIG_NUM)continue;

			dp[i+A] = min(dp[i+A],dp[i]+B);
		}
	}

	int ans = BIG_NUM;
	for(int i = H; i < SIZE; i++){

		ans = min(ans,dp[i]);
	}

	printf("%d\n",ans);

	return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
int n;
long long a[300];
long long r, s, k;
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%lld", a + i);
		if (i > 1) {
			r ^= a[i];
		}
	}
	s = a[0] + a[1];
	s -= r;
	if (s % 2) {
		printf("-1\n");
		return 0;
	}
	s /= 2;
	if (s > a[0] || (s | r) != (s + r)) {
		printf("-1\n");
		return 0;
	}
	for (int i = 60; i >= 0; i--) {
		k = 1;
		k <<= i;
		if (r & k) {
			if (s + k <= a[0])s += k;
		}
	}
	if (s != 0)printf("%lld\n", a[0] - s);
	else printf("-1\n");
}

Measured memory_bytes: 1700
def Base(X, n):
    if (int(X/n)):
        return Base(int(X/n), n)+str(X%n)
    return str(X%n)

def main():
  N, K = map(int, input().split())
  ans1 = Base(N, K)
  ans = len(ans1)
  print(ans)

main()

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

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VD = vector<double>;
using VVD = vector<VD>;
using VS = vector<string>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using VL = vector<long long>;
using VVL = vector<VL>;

#define sz(var) (int)var.size()
#define REP(var, start, end) for(int var = start; var < (int)end; ++var)
#define CLEAR(var, with) memset(var, with, sizeof(var))
#define ALL(x) x.begin(), x.end()
#define LL long long
#define ULL unsigned long long
#define TIME cout << "Time elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms" << endl;

const int INF = (int)1e9, MAXN = 40, MAXAB = 10;
VI A, B, C;
int n, ma, mb;

bool chk(int d, int e) {
	if(d == 0 && e == 0) return false;
	int div = __gcd(d, e);
	return d / div == ma && e / div == mb;
}

int DP[MAXN + 1][MAXN * MAXAB + 1][MAXN * MAXAB + 1];
int minPrice(int i, int a, int b)
{
	if(i == n)
		return chk(a, b) ? 0 : INF;
	
	int& ret = DP[i][a][b];
	if(ret != -1)
		return ret;
	
	ret = INF;
	ret = min(minPrice(i + 1, a + A[i], b + B[i]) + C[i],
	 minPrice(i + 1, a, b));
	return ret;
}

int bottomUp()
{
	const int COMB = MAXN * MAXAB;
	for(int i = 0; i <= MAXN; ++i)
		for(int j = 0; j <= COMB; ++j)
			for(int k = 0; k <= COMB; ++k)
				DP[i][j][k] = INF;

	DP[0][0][0] = 0;
	for(int i = 0; i < n; ++i)
		for(int j = 0; j <= COMB; ++j)
			for(int k = 0; k <= COMB; ++k) {
				if(DP[i][j][k] == INF) continue;
				DP[i + 1][j][k] = min(DP[i + 1][j][k], DP[i][j][k]);
				DP[i + 1][j + A[i]][k + B[i]] = 
				min(DP[i + 1][j + A[i]][k + B[i]], DP[i][j][k] + C[i]);
			}
	int ans = INF;
	for(int i = 1; i <= COMB; ++i)
		for(int j = 1; j <= COMB; ++j)
			if(chk(i, j))
				ans = min(ans, DP[n][i][j]);
	return ans == INF ? -1 : ans;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
#ifndef ONLINE_JUDGE
	//freopen("tmp.in", "r", stdin);
//	freopen("tmp.out", "w", stderr);
#endif
	cin >> n >> ma >> mb;
	
	A = B = C = VI(n);
	REP(i, 0, n) 
		cin >> A[i] >> B[i] >> C[i];

	cout << bottomUp() << endl;
	// CLEAR(DP, -1);
	// int ans = minPrice(0, 0, 0);
	// cout << (ans == INF ? -1 : ans) << endl;

//	TIME
	return 0;
}

Measured memory_bytes: 25984
#include<iostream>
#include<algorithm>
#include<cstdint>

int const MAXN = 1e5;
int N;
int64_t M, A[MAXN], sum[MAXN+1];

int64_t count(int th) {
  int64_t c = 0;
  int j = N-1;
  for(int i = 0; i < N; ++i) {
    if(A[i]*2 < th) break;
    while(j > i && A[i]+A[j] < th) --j;
    ++j;
    c += (int64_t)(j-i)*2-1;
    j = std::min(j, N-1);
  }
  return c;
}

int64_t calc(int th) {
  int64_t res = 0;
  int j = N-1;
  for(int i = 0; i < N; ++i) {
    if(A[i]*2 < th) break;
    while(j > i && A[i]+A[j] < th) --j;
    ++j;
    res += (sum[j-1] - sum[i] + (j-i)*A[i])*2;
    j = std::min(j, N-1);
  }
  return res;
}

int main() {
  std::cin >> N >> M;
  for(int i = 0; i < N; ++i) std::cin >> A[i];
  std::sort(A, A+N, [](int l, int r){ return l > r; });
  // 
  int thH = A[0]*2, thL = A[N-1]*2;
  while(thH > thL) {
    int thM = (thH+thL+1)/2;
    if(count(thM) >= M) thL = thM;
    else thH = thM-1;
  }
  sum[0] = A[0];
  for(int i = 1; i < N; ++i) sum[i] = sum[i-1]+A[i];
  int64_t ans =  calc(thL) - (count(thL) - M)*thL;
  std::cout << ans << std::endl;
  return 0;
}



Measured memory_bytes: 1792
from collections import defaultdict

H,W,N = map(int,input().split())
sr,sc = map(int,input().split())
S = input()
T = input()

u = 1
d = H
l = 1
r = W
flag = False
for i in range(N-1,-1,-1):
  if i != N-1:
    if T[i] == 'U': d = min(d+1,H)
    elif T[i] == 'D': u = max(u-1,1)
    elif T[i] == 'L': r = min(r+1,W)
    else: l = max(l-1,1)
  if S [i] == 'U': u += 1
  elif S[i] == 'D': d -= 1
  elif S[i] == 'L': l += 1
  else: r -= 1
  if l>r or u>d:
    flag = True
    break
#print(flag,u,d,l,r)
if flag or not (u<=sr<=d and l<=sc<=r):
  print('NO')
else:
  print('YES')


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

#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define fcin ios::sync_with_stdio(false); cin.tie(nullptr);
#define INF 0x3f3f3f3f
#define all(x) x.begin(), x.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

template <typename A, typename B>
string to_string(pair<A, B> p){
    return "(" + to_string(p.fi) + ", " + to_string(p.se) + ")";
}

template <typename T>
string to_string(T v){
    string s = "{";
    bool first = true;
    for(const auto & x : v){
        if(!first) s += ", ";
        first = false;
        s += to_string(x);
    }
    return s + "}";
}

void debug_out(){ cerr << endl;}
template <typename First, typename... Next>
void debug_out(First F, Next... N){
    cerr << " " << to_string(F);
    debug_out(N...);
}

#ifdef LOCAL
    #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
    #define debug(...) 1
#endif

const int N = 2e5 + 5;
vector<pii> e[N];
int ans[N];

void dfs(int u, int skip=-1, int p=-1){
    int c = 1;
    for(pii q : e[u]){
        int v = q.fi;
        int id = q.se;
        if(p == v) continue;
        if(c == skip) c++;
        dfs(v, c, u);
        ans[id] = c++;
    }
}

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

    int M = 0;
    for(int i = 0; i < n-1; i++){
        int u, v;
        cin >> u >> v;
        e[u].eb(v, i);
        e[v].eb(u, i);
        M = max(M, int(e[u].size()));
    }

    cout << M << endl;
    dfs(1);
    for(int i = 0; i < n - 1; i++) cout << ans[i] << "\n";
    return 0;
}



Measured memory_bytes: 11648
require 'prime'

a,b = gets.chomp.split(" ").map(&:to_i)
c = a.gcd(b)

pr = []
prime = Prime.each(Math.sqrt(c).to_i+1).to_a
prime.each do |e|
  while c % e == 0
    pr << e
    c = c / e
  end
end
if c > 1
  pr << c
end

#p prime
p (pr.uniq.count+1)

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

#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); ++i)
#define rep(i, n) repi(i, 0, n)
#define all(x) (x).begin(), (x).end()

inline void Main() {
  // code
  long long n;
  map<string, long long> count;
  cin >> n;
  rep(i, n) {
    string s;
    cin >> s;
    sort(all(s));
    count[s]++;
  }

  long long r = 0;

  for (const auto& value : count){
    if(value.second) {
      r += (value.second - 1) * value.second / 2;
    }
  }

  cout << r << endl;
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 11264
import collections

def myindex(l, x, default=-1):
    if x in l:
        return l.index(x)
    else:
        return default

def main():
    N = int(input())
    a = list(map(int, input().split()))
    
    A = [x//400 for x in a]
    A.sort()
    Aitems = list(zip(*collections.Counter(A).items()))
    cntmin = len([x for x in Aitems[0] if x < 8])
    cntmax = cntmin + len([x for x in A if x >= 8])
    if cntmin == 0:
        cntmin = 1
    print(cntmin, cntmax)

if __name__ == "__main__":
    main()


Measured memory_bytes: 3316
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <cmath>
#include <limits>
#include <utility>
#include <map>
#include <iomanip>
#include <queue>
#include <cctype>
#include <stack>
#include <random>
#include <list>
#include <numeric>
#include <chrono>
#include <set>


#define rep(i,p,q) for(ll i = p;i < q;i++)
#define ll long long

using namespace std;

vector<vector<ll>> graph;
vector<ll> query;
vector<ll> ans;
vector<ll> visited;


const long long MAX_N = 1 << 17;

long long dat[2 * MAX_N - 1];

ll ecd(ll a, ll b) {
	if (a < b) swap(a, b);
	if (b == 0) return a;
	else {
		return ecd(b, a % b);
	}
}

ll pow(ll a, ll b) {
	vector<ll> d = vector<ll>((ll)(log(b)) + 2);
	d[0] = a;
	rep(i, 1, d.size()) d[i] = d[i - 1] * d[i - 1];
	ll ret = 1;
	rep(i, 0, log(b) + 1) {
		if (b & 1 << i) ret *= d[i];
	}
	return ret;
}

//ARC 62 D

int main(void) {
	string s;
	cin >> s;
	ll ans = 0;
	rep(i, 0, s.size()) {
		if (i % 2 == 0 && s[i] == 'p') ans--;
		else if (i % 2 == 1 && s[i] == 'g') ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define PI acos(-1)
#define Mod (int)1000000007
#define INFTY (int)INT_MAX
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define All(vec) vec.begin(), vec.end()
#define Part(vec, b, e) vec.begin() + b, vec.begin() + e
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())
#define Count(vec, x) count(vec.begin(), vec.end(), x)
#define Next_permutation(vec) next_permutation(vec.begin(), vec.end())
#define Find(vec, s) vec.find(s) != vec.end()

int main() {
	multimap<string, int> MM;
	int q;
	cin >> q;
	Rep(i, q) {
		int n;
		cin >> n;
		if (n == 0) {
			string key;
			int x;
			cin >> key >> x;
			MM.insert(make_pair(key, x));
		}
		else if (n == 1) {
			string key;
			cin >> key;
			for (auto itr = MM.lower_bound(key); itr != MM.end() && itr != MM.upper_bound(key); itr++) {
				cout << get<1>(*itr) << endl;
			}
		}
		else if (n == 2) {
			string key;
			cin >> key;
			MM.erase(key);
		}
		else if (n == 3) {
			string L, R;
			cin >> L >> R;
			for (auto itr = MM.lower_bound(L); itr != MM.end() && itr != MM.upper_bound(R); itr++) {
				cout << get<0>(*itr) << " " << get<1>(*itr) << endl;
			}
		}
	}
	return 0;
}


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

int main(void){
    int N;
    cin >> N;
    
    long long p, tp=0, tpfront=0;
    for(int i=1; i<=N; i++){
        cin >> p;
        if(p==i){
            tpfront++;
        }
        if(p!=i || i==N){
            if(tpfront%2==0){
                tp += tpfront/2;
            }else{
                tp += (tpfront/2)+1;
            }
            tpfront=0;
        }
    }

    cout << tp << endl;

    return 0;
}

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

using namespace std;

#define rep(i,a,b) for (int i = a; i <= b; ++i)
#define repd(i,a,b) for (int i = b; i >= a; --i)
#define repn(i,n) for (int i = 0; i < n; ++i)
#define repnd(i,n) for (int i = n - 1; i >= 0; --i)
#define first fi
#define second se
#define all(v) v.begin(), v.end()
#define mp make_pair
#define eb emplace_back
#define v(T) vector<T>
#define vv(T) v(v(T))

typedef long long ll;
typedef long long int lli;
typedef pair <int,int> ii;
typedef vector <int> vi;
typedef vector <long> vl;

const ll MOD = 10e9 + 3;

template<typename T>string join(const v(T)&v){stringstream s;repn(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v){if(v.size())o<<join(v);return o;}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);  
	long a,b;
	cin >> a >> b;
	for (int i = b - a + 1; i <= b + a - 1; ++i){
	    cout << i << " ";
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N(555555);
char st[N];
long long a[N], d[N];
int main() {
	scanf("%s", st);
	int len(strlen(st));
	for(int i(0); i < len; i++)
		a[i] = st[i] - '0';
	int pos(len);
	for(int i(len - 2); i >= 0; i--) {
		if(a[i] > a[i + 1]) {
			a[i]--;
			d[i] -= 9;
			d[pos - 1] += 9;
			a[pos - 1] += 1;
			
			d[pos - 2] += d[pos - 1];
			a[pos - 1] += d[pos - 1];
			d[pos - 1] = 0;
			if(pos - 3 >= 0) {
				d[pos - 3] += d[pos - 2];
			}
			a[pos - 2] += d[pos - 2];
			d[pos - 2] = 0;
			if(a[pos - 1] >= a[pos - 2] + 10) {
				pos = pos - 1;
			}else {
				pos = len;
			}
		}
	}
	cout << (a[len - 1] + 8) / 9 << endl;
}


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

class Program
{
    static void Main()
    {
        string[] arr = Console.ReadLine().Split(' ');
        int N = int.Parse(arr[0]);
        int K = int.Parse(arr[1]);
        int[] H = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        Array.Sort(H);
        long sum = 0;

        for(int i = 0; i < N - K; i++)
        {
            sum += H[i];
        }

        Console.WriteLine(sum);
    }
}

Measured memory_bytes: 34560
#include<stdio.h>
#include <string.h>
int main() {
	char str[100010];
	int num=0;
	scanf("%s",str);
	int l=strlen(str);
	for(int i=0;i<l-1;i++) {
		if(str[i]!=str[i+1]) num++;
	}
	printf("%d\n",num);
}

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

int main() {
  int n,d;
  cin >> n >> d;
  if (n % (2*d + 1) == 0){
    cout << n/(2*d + 1) << endl;
  }
  else{
    cout << n/(2*d + 1) + 1 << endl;
  }
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include<iomanip>
using namespace std;
#define mp make_pair
#define pb push_back
#define re return
typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> pii;
int n,k; 
double ans;
int main() { 
    //freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin>>n>>k;
	ans=0.0;
	double nw;
	for(int i=1;i<=n;i++){
		nw=1.0/n;
		int nn=i;
		while(nn<k){
			nn*=2;
			nw/=2;
		}
		ans+=nw;
	}
	cout<<fixed<<setprecision(11)<<ans<<endl;
    return 0; 
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
using namespace std;
 
int main(){
  int n,q,t;
  string name;
  queue<pair<string,int> >Q;
  cin>>n>>q;
  for(int i=0;i<n;i++){
    cin>>name>>t;
    Q.push(make_pair(name,t));
  }
 
  pair<string,int>u;
  int elaps=0,a;
  while(!Q.empty()){
    u=Q.front();
    Q.pop();
    a=min(u.second,q);
    u.second-=a;
    elaps+=a;
    if(u.second>0){
      Q.push(u);
    }else{
    cout<<u.first<<" "<<elaps<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 4404
import java.util.Scanner;
import java.util.Random;
import static java.lang.System.out;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();

        out.printf("%d %d%n", a * b, (a * 2 + b * 2));                            

    }
}

Measured memory_bytes: 26268
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define rbg rbegin()
#define red rend()
#define all(x) x.bg,x.ed
#define rall(x) x.rbg,x.red
#define pb push_back
#define pf push_front
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b; return true;} return false;}
template<class t,class u> bool chmin(t&a,u b){if(a>b){a=b; return true;} return false;}
template<class t,class u> t MAX(t a,u b){if(a>=b) return a; return b;}
template<class t,class u> t MIN(t a,u b){if(a<=b) return a; return b;}
template<class t> int SIZE(t s){return (int)s.size();}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using vvi=vc<vc<int>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
const long long INF = 1LL << 60;

int main(){
    cout << fixed << setprecision(20);
    int a,b,c; cin >> a >> b >> c;
    cout << (b/c)-((a-1)/c) << endl;
    return 0;
}


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

int N, Q;
string s;

struct SegmentTree{
	int n;
	vector<int> data;
	vector<int> sum;
	int MAX = 100000000;

	SegmentTree(int nn){
		n = 1;
		while(n < nn) n *= 2;
		data.resize(2 * n - 1, 0);
		sum.resize(2 * n - 1, 0);
	}

	void add(int a, int b, int val){
		add(a, b, val, 0, 0, n);
	}

	void add(int a, int b, int val, int k, int l, int r){
		//cout << k << " " << l << " " << r << endl;
		if(r <= a || b <= l) return;
		//cout << "a";
		if(a <= l && r <= b){
			sum[k] += val;
			return;
		}
		//cout << "b";
		add(a, b, val, k * 2 + 1, l, (l + r) / 2);
		add(a, b, val, k * 2 + 2, (l + r) / 2, r);
		data[k] = min(data[k * 2 + 1] + sum[k * 2 + 1], data[k * 2 + 2] + sum[k * 2 + 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){
		//cout << k << " " << l << " " << r << endl;
		if(r <= a || b <= l) return MAX;
		if(a <= l && r <= b) return data[k] + sum[k];
		
		int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
		int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
		return min(vl, vr) + sum[k];
	}
};

int main(){
	cin >> N >> Q;
	cin >> s;
	SegmentTree tree(N);
	set<int> pset;
	for(int i = 0; i < s.size(); i++){
		if(s[i] == '(') tree.add(i, s.size(), 1);
		else{
			tree.add(i, s.size(), -1);
			pset.insert(i);
		}
		/*
		for(int i = 0; i < s.size(); i++){
			cout << tree.query(i, i + 1) << " " ;
		}

		cout << endl;
		*/
	}

	for(int i = 0; i < Q; i++){
		int idx;
		cin >> idx;
		idx--;
		if(s[idx] == '('){
			s[idx] = ')';
			pset.insert(idx);
			tree.add(idx, N, -2);
			int vv = *begin(pset);
			s[vv] = '(';
			pset.erase(vv);
			tree.add(vv, N, 2);
			cout << (vv + 1) << endl;

		}else{
			pset.erase(idx);
			s[idx] = '(';
			tree.add(idx, N, 2);
			int l = -1;
			int r = N - 1;
			while(r - l > 1){
				int m = (l + r) / 2;
				if(tree.query(m, N) >= 2){
					r = m;
				}else{
					l = m;	
				}
			}
			while(s[r] != '(') r++;
			tree.add(r, N, -2);
			s[r] = ')';
			pset.insert(r);
			cout << (r + 1) << endl;
		}
	}
}

Measured memory_bytes: 18552