akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::*;
use std::str::FromStr;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
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)*}};}
#[allow(unused_macros)]
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)*}};}
#[allow(unused_macros)]
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")};}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

#[allow(dead_code)]
const MAX: usize = 100006;
#[allow(dead_code)]
const INF_U32: u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32: i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64: u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64: i64 = 1 << 62;
#[allow(dead_code)]
const MOD: i64 = 1e9 as i64 + 7;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[allow(unused_imports)]
use std::f64;


fn main() {
    input!{a:[i64;2]};
    let mut a = a;
    a.sort();
    println!("{}", if a[0]!=1 {"1"} else if a[1]==2 {"3"} else {"2"});
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8



int main() {
    ll N,B,C;cin >> N >> B;
    rep(i,N-1){
        cin >> C;
        B=gcd(B,C);
    }
    cout << B << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define MOD 1000000007 
#define INF 1000000000000000000
#define uid uniform_int_distribution <int>
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

int main()
{
	int n;
	cin >> n;
	if(n % 2 == 0)
	{
		cout << n / 2 - 1;
	}
	else
	{
		cout << n / 2;
	}
}


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

using namespace std;
using ll = long long;

#define REP2(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; ++i)
#define REP3(i, l, r) for (int i = (l), i##_len = (int)(r); i < i##_len; ++i)
#define GET_MACRO_REP(_1, _2, _3, NAME, ...) NAME
#define REP(...) GET_MACRO_REP(__VA_ARGS__, REP3, REP2) (__VA_ARGS__)
#define RREP2(i, n) for (int i = (n - 1); i >= 0; --i)
#define RREP3(i, l, r) for (int i = (r - 1), i##_len = (l); i >= i##_len; --i)
#define GET_MACRO_RREP(_1, _2, _3, NAME, ...) NAME
#define RREP(...) GET_MACRO_REP(__VA_ARGS__, RREP3, RREP2) (__VA_ARGS__)
#define IN(type, n) type n; cin >> n
#define INALL(type, v) REP(i, v.size()) { IN(type, _tmp); v.at(i) = _tmp; }
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

#ifdef _DEBUG
#define DEBUG(x) cout << #x << ": " << x << endl
#else
#define DEBUG(x)
#endif

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; }
#pragma endregion

int main() {
  IN(string, S);
  if (S.at(S.length() - 1) == 's') {
    S += "es";
  } else {
    S += "s";
  }

  cout << S << endl;

  return 0;
}


Measured memory_bytes: 3596
package main

import (
	"fmt"
)

type Dice struct {
	T, S, E, W, N, B int
}

func (p *Dice) roll(direction rune) {

	if direction == 'S' {
		p.S, p.B, p.N, p.T = p.T, p.S, p.B, p.N
	} else if direction == 'N' {
		p.N, p.B, p.S, p.T = p.T, p.N, p.B, p.S
	} else if direction == 'W' {
		p.W, p.B, p.E, p.T = p.T, p.W, p.B, p.E
	} else if direction == 'E' {
		p.E, p.B, p.W, p.T = p.T, p.E, p.B, p.W
	}

}

func (p *Dice) matching(d Dice) bool {

	ret := false
	//6面がそれぞれ一度top
	for j := 0; j < 6; j++ {

		for j := 0; j < 4; j++ { //側面を一周
			if (p.T == d.T) && (p.S == d.S) && (p.E == d.E) && (p.W == d.W) && (p.N == d.N) && (p.B == d.B) {
				ret = true
				break
			} else {
				p.roll('N')
				p.roll('W')
				p.roll('S')
			}
		}

		if j%2 == 0 {
			p.roll('N')
		} else {
			p.roll('W')
		}
	}
	return ret
}

func main() {

	var t, s, e, w, n, b int

	fmt.Scanln(&t, &s, &e, &w, &n, &b)
	dice1 := Dice{t, s, e, w, n, b}

	fmt.Scanln(&t, &s, &e, &w, &n, &b)
	dice2 := Dice{t, s, e, w, n, b}

	if dice2.matching(dice1) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

}



Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
int main(){
        int n; cin >> n;
        int ans = 0;
        for (int x = 0; x < n; ++x){
            int q; cin >> q;
            ans += q - 1;
        }
        cout << ans << endl;
    return 0;
}
/*here (a*b*c-1) % k*/


Measured memory_bytes: 3648
n=int(input())
a=list(map(int,input().split()))
import fractions
mod=10**9+7
ans=0
l=a[0]
for i in range(1,n):
    l=l*a[i]//fractions.gcd(l,a[i])
for i in range(n):
    ans+=l//a[i]
print(ans%mod)
 



Measured memory_bytes: 5740
import pdb


def solve(a,n):
    if n==1:
        return max(a[0])
    dp = [[0,0,0] for i in xrange(n)]
    dp[0]= [a[0][0],a[1][0],a[2][0]]
    for i in xrange(1,n):
        try:
            dp[i][0] = a[0][i]+max(dp[i-1][1],dp[i-1][2])
            dp[i][1] = a[1][i]+max(dp[i-1][0],dp[i-1][2])
            dp[i][2] = a[2][i]+max(dp[i-1][0],dp[i-1][1])
        except:
            pdb.set_trace()
    return max(dp[n-1])

        
    

if __name__=='__main__':
    n = int(raw_input())
    
    a = [[],[],[]]
    for i in xrange(n):
        ai,bi,ci = map(int,raw_input().split())
        a[0].append(ai)
        a[1].append(bi)
        a[2].append(ci)
    print solve(a,n)


Measured memory_bytes: 30704
import sys
input = lambda: sys.stdin.readline().rstrip() 

def resolve():
    S = input()
    acgt = ('A', 'C', 'G', 'T')
    ans = 0

    for l in range(len(S)):
        for r in range(l+1, len(S)+1):
            # print(l, r, S[l:r])
            if S[r-1] not in acgt:
                ans = max(r-1-l, ans)
                break
            if r==len(S):
                ans = max(len(S)-l, ans)
 
    print(ans)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 3060
N,K=map(int,input().split())
X=list(map(int,input().split()))
if N==1:
  print(0);exit()

ans=float("Inf")
for i in range(N-K+1):
  ans=min(ans, X[i+K-1]-X[i]+ min(abs(X[i+K-1]),abs(X[i]))  )

print(ans)
  

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

int get(int x)
{
	if(x==1) return 300000;
	if(x==2) return 200000;
	if(x==3) return 100000;
	return 0;
}
int main()
{
	int X,Y;
	scanf("%d %d",&X,&Y);
	int ret=get(X)+get(Y);
	if(X==1&&Y==1) ret+=400000;
	printf("%d\n",ret);
	return 0;
}
	

Measured memory_bytes: 256
//------------------------------------------------------------------------------MANAS UNIYAL---------------------------------------------------------
//																				NEVER GIVE UP
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
#define ll long long
#define pb push_back
#define fi first
#define se second
#define pii pair<ll,ll>
#define INF 0x3f3f3f3f
#define mod 100000007
#define testcases() ll t; cin>>t; while(t--)
#define debug1(x) cout<<#x<<" "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define rep(i,start,end) for(ll i=start;i<end;i++)
 
//----------------------------------------------------------------------------------------------------------------------------------------------------

int main()
{
	fast;
	int a;
	unordered_map<int,pair<int,int>> mp;
	for(int i=1;i<=9;i++)
		for(int j=1;j<=9;j++)
			mp[i*j]={i,j};
	cin>>a;
	if(mp.find(a)!=mp.end())
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int H, W;
  int h, w;
  cin >> H >> W >> h >> w;
  cout << H * W - max(h * W + w * (H - h), w * H + h * (W - w)) << '\n';
  return 0;
}

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


int main()
{
  string s;
  cin >> s;
  rep(i, s.size())
    if ((i % 2 == 1 && s[i] == 'R') || (i % 2 == 0 && s[i] == 'L'))
    {
      puts("No");
      return 0;
    }
  puts("Yes");
  return 0;
}

Measured memory_bytes: 256
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))

temp_now = 0
temp_ans = 999999999
ans = 0

for i in range(n):
  temp_now = t-h[i]*0.006
  if abs(temp_now-a) < abs(temp_ans-a):
    ans = i+1
    temp_ans = temp_now

print(ans)

Measured memory_bytes: 38512
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();

		for (int i = 0; i < n - 1; i++) {
			for (int j = i + 1; j < n; j++) {
				for (int k = 0; k < 10; k++) {
					if ((i >> k & 1) != (j >> k & 1)) {
						System.out.println(k + 1);
						break;
					}
				}
			}
		}
	}
}


Measured memory_bytes: 37716
#include <iostream>
using namespace std;
int sum=0;
int num;

void check(int x){
	bool flag3=0, flag5=0, flag7=0;
  	while(x!=0){
    	if(num<x) break;
       	int v=x%10;
      	if(v==3)      flag3=1;
      	else if(v==5) flag5=1;
      	else if(v==7) flag7=1;
    	x/=10;
    }
    if(flag3 && flag5 && flag7) sum++;
}


void dfs(int x){
	check(x);
  	if(x<=100000000){
    	dfs(10*x+3);
      	dfs(10*x+5);
      	dfs(10*x+7);
    }
}


int main(){
  	cin >>num;
	dfs(0);
  	cout <<sum;
	return 0;
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

LL ex(LL x, LL y) { return (y == 0 ? 1 : x * ex(x, y - 1)); }
LL digit(LL x, LL y, LL b = 10) { return x / ex(b, y) % b; }

int main() {
	int n;
	cin >> n;
	
	int a[] = { 3, 5, 7 };
	int ans = 0;
	incII(d, 3, 9) {
		int t = ex(3, d);
		inc(i, t) {
			int v = 0, b[] = { 0, 0, 0 };
			dec(j, d) {
				v *= 10;
				v += a[digit(i, j, 3)];
				b[digit(i, j, 3)]++;
			}
			if(b[0] * b[1] * b[2] == 0) { continue; }
			
			// cout << v << endl;
			if(v <= n) { ans++; } else { break; }
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint INF = -1e18;

signed main(){
  lint N, M; cin >> N >> M;
  vector<lint> x(N), y(N), z(N);
  for(int i = 0; i < N; i++) cin >> x[i] >> y[i] >> z[i];
  lint ans = INF;
  for(lint bit = 0; bit < (1 << 3); bit++){
    vector<lint> data(N, 0);
    if(bit & (1 << 0)) for(lint i = 0; i < N; i++) data[i] += x[i];
    else for(lint i = 0; i < N; i++) data[i] -= x[i];
    if(bit & (1 << 1)) for(lint i = 0; i < N; i++) data[i] += y[i];
    else for(lint i = 0; i < N; i++) data[i] -= y[i];
    if(bit & (1 << 2)) for(lint i = 0; i < N; i++) data[i] += z[i];
    else for(lint i = 0; i < N; i++) data[i] -= z[i];
    sort(data.begin(), data.end(), greater<lint>());
    lint ans1 = 0;
    for(lint i = 0; i < M; i++) ans1 += data[i];
    ans = max(ans, ans1);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<cstdio>
#include<algorithm>
#include<set>
#include<vector>
#include<cstring>
using namespace std;

signed main() {
	int a;
	cin >> a;
		int b;
		for (int c = 0; c < a; c++) {
			cin >> b;
			int d[100];
			for (int e = 0; e < b; e++)cin >> d[e];
			int MIN = 0, MAX = 0;
			for (int f = 0; f < b - 1; f++) { MIN = max(MIN, d[f] - d[f + 1]); MAX = max(MAX, d[f + 1] - d[f]);
			}
			printf("%d %d\n", MAX, MIN);
		}
}

Measured memory_bytes: 3068
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> h(N);
    rep(i, N) cin >> h[i];
    
    sort(h.begin(), h.end());
    int ans = 2e9;
    rep(i, N - K + 1) {
        ans = min(ans, h[i + K - 1] - h[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
//#define _GLIBCXX_DEBUG
//#pragma GCC optimize "trapv"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
// #pragma optimization_level 3
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


#define pb push_back 
#define f first
#define s second
#define min3(a, b, c) min(min(a, b), c)
#define max3(a, b, c) max(max(a, b), c)
#define all(v) v.begin(), v.end()

typedef long long ll;
typedef double ld;
typedef long double lld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;

template <class T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;

const int INF = 1e9;
//const ll INF = 1e18;
const ll mod = 1000000007;
// const ll mod = 998244353;
vi divisors;
void divi(int n){
    divisors.resize(n+1);
    for(int i = 1; i <= n; i++){
        for(int j = i; j <= n; j += i){
            divisors[j]++;
        }
    }
}

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

    divi(n);    

    int ans = 0;

    for(int c = 1; c <= n-1; c++){
        ans += divisors[n-c];
    }

    cout << ans << "\n";
}

int main(){
    ios_base::sync_with_stdio(NULL);
    cin.tie(NULL);
    
    int tc = 1;
    //cin >> tc;
    for (int t = 0; t < tc; t++) solve(t);

    return 0;
}

Measured memory_bytes: 7096
from collections import defaultdict

H, W, N = map(int,input().split())
  
ans =[(H-2)*(W-2)]+[0]*9
blacks = defaultdict(int)
for i in range(N):
  a, b = map(int,input().split())
  for dx in [-1,0,1]:
    for dy in [-1,0,1]:
      if 2 <= a+dx <H and 2 <= b+dy <W:
        ans[blacks[(a+dx,b+dy)]]-=1
        ans[blacks[(a+dx,b+dy)]+1]+=1
      blacks[(a+dx,b+dy)]+=1
        
for i in range(10): print(ans[i])

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

#define int long long

template< typename T >
vector< T > slide_max(const vector< T > &v, int k)
{
  deque< int > deq;
  vector< T > ret;
  for(int i = 0; i < v.size(); i++) {
    while(!deq.empty() && v[deq.back()] <= v[i]) {
      deq.pop_back();
    }
    deq.push_back(i);
    if(i - k + 1 >= 0) {
      ret.emplace_back(v[deq.front()]);
      if(deq.front() == i - k + 1) deq.pop_front();
    }
  }
  return ret;
}

int dp[310][100010] = {};


signed main(){
    int n, m, k;

    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> m >> k;

    int a[100010];
    for(int i = 0;i < n;i++){
        cin >> a[i];
    }

    for(int i = 0;i < n;i++){
        dp[k][i] = a[i] * k;
    }

    for(int i = k-1;i >= 1;i--){

        vector<int> vec;

        for(int j = 0;j < n;j++){
            vec.push_back(dp[i+1][j]);
        }

        for(int j = 0;j < m;j++){
            vec.push_back(LLONG_MIN);
        }

        auto p = slide_max(vec, m);


        for(int j = 0;j < n;j++){
            dp[i][j] = a[j] * i + p[j+1];
        }
    }

    int ans = LLONG_MIN;
    for(int i = 0;i < n;i++){
        ans = max(ans, dp[1][i]);
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 240236
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main() {
    double ans = 0;
    ll n;
    cin >> n;
    rep(i, 0, n) {
        double x;
        string u;
        cin >> x >> u;
        if(u == "JPY") ans += x;
        else ans += 380000.0 * x;
    }
    printf("%.10lf\n", ans);
    return 0;
}

Measured memory_bytes: 3820
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <vector>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>
using namespace std;
#define x first
#define y second
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define ll long long
#define ld long double
#define ii pair<int,int>
#define heap priority_queue
#define all(k) k.begin(),k.end()
#define rall(k) k.rbegin(),k.rend()
#define len(v) ((int)v.size())
#define fa(a,c) for(auto &a:c)
#define endl '\n'





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

  int k,n;
  cin>>n>>k;
  int c=0;
  while(n--){
    int h;
    cin>>h;
    c+= h>=k;
  }

  cout<<c<<endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define V(i) vector<i>
#define rep(i, n) for (__typeof(n) i = 0; i < n; i++)
#define crep(i,N,n) for (__typeof(n) i = N; i < n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef long l;
#define fio                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
int main()
{
    ll t;
    cin>>t;
    V(ll) a(t),op(t);
    rep(i,t)
    {
        cin>>a[i];
    }
    op[0] = 0;
    op[1] = abs(a[1] - a[0]);
    crep(i,2,t)
    {
        op[i] = min(abs(a[i]-a[i-1]) + op[i-1],abs(a[i]-a[i-2])+op[i-2]);
    }
    cout<<op[t-1];
    

    return 0;
}

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

#define mod 1000000007
#define LOCAL 0
#define pb push_back
#define ll long long

ll po(ll a,ll b){
	ll x = 1,y=a;
	while(b>0){
		if(b%2){
			x = x*y;
			x %= mod;
		}
		y=y*y;
		y%=mod;
		b/=2;
	}
	return x;
}

int main(){
	if(LOCAL){
    	freopen("C:/Users/gold/Desktop/sublime IO/input.txt","r",stdin);
    	freopen("C:/Users/gold/Desktop/sublime IO/output.txt","w",stdout);
	}
	int T = 1;
	//scanf("%d",&T);
	while(T--){
		int n,m;
		scanf("%d %d",&n,&m);
		long long ans = 1ll;
		for(int i=0;i<m;i++){
			ans *= 2ll;
		}		
		printf("%lld\n",ans * (100ll*(n-m) + m * 1900ll));
	}
	return 0;	
}

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

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

const ll MOD = ll(1e9 + 7);
const ll LLINF = LLONG_MAX;
const int IINF = INT32_MAX;
const int MAX_N = int(1e5) + 5;
const double EPS = 1e-8;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)


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


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
const int MOD = 1e9+7;
#define PI 3.14159265359
typedef long long ll;
using namespace std;



int main(){
	int n;
	cin >> n;
	if (n % 1000 == 0) cout << 0 << endl;
	else cout << 1000 - n % 1000 << endl;
	return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <string>
#include <map>

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

using namespace std;

map<char, char> m;
int n;
string s;
int dfs(int l, int r, int len){
	if(l < 0 || r >= n) return len;
	if(s[l] == m[s[r]]) return dfs(l-1, r+1, len+2);
	return max(dfs(l-1, r, len), dfs(l, r+1, len));
}

int main(){
	m['('] = ')';
	m[')'] = '(';
	m['['] = ']';
	m[']'] = '[';
	m['{'] = '}';
	m['}'] = '{';
	m['i'] = 'i';

	cin >> s;
	n = s.size();
	int l = 0, r = n-1;
	while(s[l] != 'i') l++;
	while(s[r] != 'i') r--;
	cout << dfs(l, r, 1) << endl;
	
	return 0;
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    int N; cin >> N;
    vector<int> P(N);
    REP(i,N){
        int p; cin >> p;
        p--;
        P[i] = p;
    }
    int ans = 0;
    REP(i,N){
        if(P[i]==i){
            if(i!=N-1) swap(P[i],P[i+1]);
            else swap(P[i],P[i-1]);
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3756
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int dp[3005];

int main(){
  for(int i=0;i<3005;i++) dp[i] = 0;
  
  int n,t; cin >> n >> t;
  vector<pair<int,int>> v(n);
  for(int i=0;i<n;i++) cin >> v[i].first >> v[i].second;
  sort(v.begin(), v.end());
  int ans = 0;
  for(int i=0;i<n;i++){
    for(int j=t;j>=0;j--){
      if(j + v[i].first >= t) ans = max(ans, dp[j] + v[i].second);
      else dp[j + v[i].first] = max(dp[j + v[i].first], dp[j] + v[i].second);
    }
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
  val N = readInt()
  val A = readInts()
  if (A == A.distinct()) {
    println("YES")
  } else {
    println("NO")
  }
}

fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readInts() = readStrings().map { it.toInt() }
fun readLong() = readString().toLong()
fun readLongs() = readStrings().map { it.toLong() }


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

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

const int INF = 1e9 + 7;

using namespace std;

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

	int h, w, d;
	cin >> h >> w >> d;

	map<int, pair<int, int>> mp;
	int a;
	rep (i, 0, h) {
		rep (j, 0, w) {
			cin >> a;
			mp[a] = make_pair(i, j);
		}
	}

	vector<int> cum_sum(h * w + 1, 0);
	rep (i, d + 1, h * w + 1) {
		cum_sum[i] = cum_sum[i - d]
			+ abs(mp[i].first - mp[i - d].first)
			+ abs(mp[i].second - mp[i - d].second);
	}

	int q;
	cin >> q;

	int l, r;
	rep (i, 0, q) {
		cin >> l >> r;
		ll magic_cost = cum_sum[r] - cum_sum[l];
		cout << magic_cost << endl;
	}

	return 0;
}


Measured memory_bytes: 8320
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <fstream>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep(i, init, n) for(ll i = init; i <(ll)(n); i++)


ll pl(ll xx, ll target, vector<ll>& A){
    ll l = 0;
    ll hoge = A[xx];
    ll r = A.size();
    if (hoge * A[0] > target) return 0;
    if (hoge * A[r-1] <= target) return (r-1);
    while(r - l > 1){
        ll tmp = (r + l) / 2;
        if (A[tmp] * hoge - target <= 0) l = tmp;
        else r = tmp;
    }
    if (hoge <= A[l]) l--;
    return (l + 1);
}


ll ml(ll xx, ll target, vector<ll>& A){
    ll l = 0;
    ll hoge = A[xx];
    ll r = A.size();
    if (hoge * A[r-1] > target) return 0;
    if (hoge * A[0] <= target) return (r-1);
    while(r - l > 1){
        ll tmp = (r + l) / 2;
        if (A[tmp] * hoge > target) l = tmp;
        else r = tmp;
    }
    if (hoge >= A[r]) r++;
    return (A.size() - r);
}

int main() {


  //std::ifstream in("sub1_small_15.txt");
  //std::cin.rdbuf(in.rdbuf());

    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    REP(i, N) cin >> A[i];

    sort(A.begin(), A.end());

    ll l = -1e18 * 2;
    ll r = 1e18 * 2;
    while(r - l > 1){
        
        ll tmp = (l + r) / 2;
        ll s = 0;
        REP(i, N){
            if (A[i] >= 0) s += pl(i, tmp, A);
            else s += ml(i, tmp, A);
        }
        //cout << l << " " << r  << " " << tmp << " " << (s/2) << endl;
        if (s % 2 != 0){
            //cout << l << " " << r  << " " << tmp << " " << (s/2) << endl;
            return 0;
        }
        if (s/2 < K) l = tmp;
        else r = tmp;
    }
    //cout << l << " " << r << endl;
    cout << r << endl;

    return 0;
}



Measured memory_bytes: 1920
using System;
using System.Linq;

class B
{
	static void Main()
	{
		var a = new int[3].Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();
		var n = int.Parse(Console.ReadLine());
		var b = new int[n].Select(_ => int.Parse(Console.ReadLine())).ToHashSet();

		var r3 = new[] { 0, 1, 2 };
		Console.WriteLine(r3.Any(j => a.All(ai => b.Contains(ai[j]))) || a.Any(ai => ai.All(b.Contains)) || r3.All(i => b.Contains(a[i][i])) || r3.All(i => b.Contains(a[i][2 - i])) ? "Yes" : "No");
	}
}


Measured memory_bytes: 28328
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

void dfs(vector<vector<int>>& G, vector<ll>& c, vector<bool>& used, int u, ll sum)
{
	c[u] += sum;
	for (auto v : G[u])
	{
		if (used[v])
		{
			continue;
		}
		used[v] = true;

		dfs(G, c, used, v, c[u]);
	}
}

int main()
{
	int N, Q;
	cin >> N >> Q;
	vector<vector<int>> G(N);
	for (auto i = 0; i < N - 1; ++i)
	{
		int a, b;
		cin >> a >> b;
		G[a - 1].push_back(b - 1);
		G[b - 1].push_back(a - 1);
	}

	vector<ll> c(N);
	for (auto i = 0; i < Q; ++i)
	{
		int p, x;
		cin >> p >> x;
		c[p - 1] += x;
	}

	vector<bool> used(N);
	used[0] = true;
	dfs(G, c, used, 0, 0);

	for (auto i = 0; i < N; ++i)
	{
		cout << c[i];
		if (i < N - 1)
		{
			cout << " ";
		}
		else
		{
			cout << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 30592
from bisect import *
A,B,Q=map(int,input().split())
s=[int(input()) for _ in range(A)]
t=[int(input()) for _ in range(B)]
x=[int(input()) for _ in range(Q)]
#print(s,t,x)
for i in x:
    ans=float("inf")
    mins=-float("inf")
    mint=-float("inf")
    maxs=float("inf")
    maxt=float("inf")
    sind=bisect(s,i)
    tind=bisect(t,i)

    if sind!=0:
        mins=s[sind-1]
    if tind!=0:
        mint=t[tind-1]
    if sind!=len(s):
        maxs=s[sind]
    if tind!=len(t):
        maxt=t[tind]
    #print(mins,maxs,mint,maxt)
    slist=[mins,maxs]
    tlist=[mint,maxt]
    ans=min(ans,abs(i-mins)+abs(mins-mint))
    ans=min(ans,abs(i-mins)+abs(mins-maxt))
    ans=min(ans,abs(i-maxs)+abs(maxs-mint))
    ans=min(ans,abs(i-maxs)+abs(maxs-maxt))
    ans=min(ans,abs(i-mint)+abs(mint-mins))
    ans=min(ans,abs(i-mint)+abs(mint-maxs))
    ans=min(ans,abs(i-maxt)+abs(maxt-mins))
    ans=min(ans,abs(i-maxt)+abs(maxt-maxs))
    print(ans)






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

using namespace std;

using ll = long long;
constexpr ll MOD = 1e9 + 7;
constexpr ll INF = 1e18;

int main() {
    ll n, m, i, j, k;
    ll T[2];
    cin >> T[0] >> T[1];
    ll A[2], B[2];
    cin >> A[0] >> A[1];
    cin >> B[0] >> B[1];
    if(A[0] > B[0] && A[1] > B[1]) {
        cout << 0 << endl;
    } else if(A[0] < B[0] && A[1] < B[1]) {
        cout << 0 << endl;
    }else if(A[0]>B[0] && (A[0]-B[0])*T[0] + (A[1]-B[1])*T[1] >0){
        cout << 0 << endl;
    } else if(A[0] < B[0] && (-A[0] + B[0]) * T[0] + (-A[1] + B[1]) * T[1] > 0) {
        cout << 0 << endl;
    } else {
        ll x = A[0] * T[0] + A[1] * T[1];
        ll y = B[0] * T[0] + B[1] * T[1];
        ll dd = abs(x - y);
        if(dd == 0) {
            cout << "infinity" << endl;
            return 0;
        }

        ll ddx = abs(A[0] - B[0]) * T[0];
        ll cnt = (ddx+dd-1) / dd;
        cout << cnt * 2 - 1 + (ddx%dd==0) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;

/*int P[10010];
void init(int n){
    for(int i=0;i<n;++i)P[i]=i;
}
int root(int a) {
    if(P[a]==a)return a;
    return (P[a]=root(P[a]));
}
bool is_same_set(int a,int b){
    return root(a) == root(b);//代表元を求める
}
void unite(int a,int b){
    P[root(a)]=root(b);
}//対set,グラフ？
//セグメント木？？？
*/

double dot_product(xy_t a, xy_t b) { return (conj(a)*b).real(); }//内積
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }//外積
xy_t projection(xy_t p, xy_t b) { return b*dot_product(p,b)/norm(b); }//投影
//対図形

#define mod 1000000007
/*ll f[2001];
//int n,k とかしておく

ll pw(ll x, ll y){//euclidの互除法より
    ll a= 1;
    while(y){
        if(y&1){//奇数なら
            a = a*x%mod;
        }
        x = x*x%mod;
        y /= 2;
    }
    return a;
}

ll modinv(ll x){//逆元を求める
    return pw(x, mod - 2 );
}

ll comb(int n,int r){
    if(n<r){
        return 0;
    }
    return f[n] * modinv(f[r])%mod*modinv(f[n-r])%mod;
}//対combination//ただしfは用意してね
*/

struct BIT{
    vector<int> dat;
    int sz;
    BIT(int n){
        for(sz=1;sz<n;sz *= 2);
        dat.resize(++sz);
    }
    int q(int n){
        int ret = 0;
        for(int i=n;i>0;i-=i&-i)ret +=dat[i];//和の計算　iから最後の１のbit(i&-i 多分＆はビット積)を減算
        for(int i=n;i<sz;i+=i&-i) dat[i]++;//値の加算　iから最後mの１のbitを加算
        return ret;
    }
};

int main(){
    int a, b, c;
    cin >> a>> b>>c;
    if(b/a>c){
        cout<<c<<endl;
    }else{
        cout<<b/a<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <list>
#include <deque>
#include <string>
#include <algorithm>
#include <cmath>
#include <ctype.h>
using namespace std;
#define dump(a) cout << (a) << '\n';
typedef long long Int;
Int mod = 1e9+7;
Int MOD = 998244353;

Int H, W;
Int b, w;
bool visited[500][500];

void dfs(vector<string> s, Int x, Int y) {
    visited[y][x] = true;
    if (s[y][x] == '#') b++;
    else if (s[y][x] == '.') w++;
    if (y > 0 && s[y][x] != s[y-1][x] && !visited[y-1][x]) dfs(s, x, y-1);
    if (y < H-1 && s[y][x] != s[y+1][x] && !visited[y+1][x]) dfs(s, x, y+1);
    if (x > 0 && s[y][x] != s[y][x-1] && !visited[y][x-1]) dfs(s, x-1, y);
    if (x < W-1 && s[y][x] != s[y][x+1] && !visited[y][x+1]) dfs(s, x+1, y);
}

int main() {
    ios::sync_with_stdio(false);
    cin >> H >> W;
    vector<string> s(H);
    for (Int i = 0; i < H; i++) cin >> s[i];
    Int res = 0;
    for (Int i = 0; i < H; i++) {
        for (Int j = 0; j < W; j++) {
            if (visited[i][j]) continue;
            b = w = 0;
            dfs(s, j, i);
            //cout << b << " " << w << '\n';
            res += b*w;
        }
    }
    dump(res);
    return 0;  
}

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

int main() {
  int N,X;
  scanf("%d %d", &N,&X);
  int a[N];
  for (int i = 0; i < N; ++i) {
    scanf("%d", &a[i]);
  }

  for(int i = 0; i < N; ++i) {
    X -= a[i];
  }

  int counta;
  counta = 0;
  for(int i = 0; i < N; ++i) {
    if(a[i]<a[counta]){
      counta = i;
    }
  }

  cout << N + X/a[counta] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)     for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = m; i < (int)(n); i++)
#define MOD 1000000007
int64_t gcd(int64_t x,int64_t y){return y? gcd(y,x%y):x;}

int main() {
  int64_t A,B;
  cin >> A >> B;
   
  int64_t ans = (A * B) / gcd(A,B);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>


using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define clear(arr, val) memset(arr, val, sizeof(arr))

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

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

const double EPS = 1e-8;
const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };


const int MAX_PRIME = 123456 * 2;
bool is_prime[MAX_PRIME + 1];
void sieve(int n = MAX_PRIME)
{
	fill_n(is_prime, n + 1, true);
	is_prime[0] = is_prime[1] = false;
	for (int i = 2; i * i <= n; ++i)
	{
		if (is_prime[i])
		{
			for (int j = 2 * i; j <= n; j += i)
				is_prime[j] = false;
		}
	}
}
int main()
{
	sieve();
	int num[MAX_PRIME + 1];
	num[0] = 0;
	for (int i = 1; i <= MAX_PRIME; ++i)
		num[i] = num[i - 1] + is_prime[i];
	int n;
	while (scanf("%d", &n), n)
		printf("%d\n", num[n * 2] - num[n]);
}

Measured memory_bytes: 0
#include<iostream>
using namespace std;
int main(){
    int x,a,b;
    cin>>x>>a>>b;
    int eat=b-a;
    if(eat<=0){
        cout<<"delicious"<<endl;
    }
    else
    {
        if(eat<=x){
            cout<<"safe"<<endl;
        }
        else{
            cout<<"dangerous"<<endl;
        }
    }
    
}

Measured memory_bytes: 3612
#include <iostream>

using namespace std;

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

    if(a >= k){
        cout << k << endl;
    }
    else if(a + b >= k){
        cout << a << endl;
    }
    else{
        cout << a - (k - a - b) << endl;
    }

    return 0;
}

Measured memory_bytes: 3604
import java.util.Scanner;

class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String N = sc.next();
    int num = 0;
    int sum = 0;
    for(int i=0;i<N.length();i++){
      num = Integer.parseInt(N.substring(i,i+1));
      sum += num;
    }
    if((Integer.parseInt(N) % sum) == 0) System.out.println("Yes");
    else System.out.println("No");
  }
}

Measured memory_bytes: 22868
import sys
x,y = [int(x) for x in input().split()]
mod = 10**9+7
if (x+y)%3!=0:
    print(0)
    sys.exit()
n = (2*y-x)//3
m = (2*x-y)//3
if n<0 or m<0:
    print(0)
    sys.exit()

a = 1
for i in range(m+1,n+m+1):
    a = a * i % mod
b = 1
for i in range(1,n+1):
    b = b * i % mod
b = pow(b,mod-2,mod)
print(a*b%mod)


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

int N, M;

int root(int x, vector<int>& par) {
    if (par[x] == x) {
        return x;
    }
    
    return par[x] = root(par[x], par);
}

void unite(int x, int y, vector<int>& par) {
    x = root(x, par); y = root(y, par);
    if (x == y) {
        return;
    }
    
    par[y] = x;
}

int main() {
    cin >> N >> M;
    vector<int> A(N + 1), par(N + 1);
    for (int i = 1; i < N + 1; i++) {
        cin >> A[i];
        par[i] = i;
    }
    for (int i = 0; i < M; i++) {
        int x, y;
        cin >> x >> y;
        unite(x, y, par);
    }
    int ans = 0;
    for (int i = 1; i < N + 1; i++) {
        if (root(A[i], par) == root(i, par)) {
            ans++;
        }
    }
    cout << ans << endl;
}

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

using namespace std;

int main() {

	int a, b;
	string s, t, u;

	cin >> s >> t;
	cin >> a >> b;
	cin >> u;

	if (s == u) a--;
	else b--;

	cout << a << " " << b << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#include <cmath>
#include <map>
#include <set>
#define rep(i, m, n) for(int i = m;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define ll long long
#define ull unsigned long long
#define pb(a) push_back(a)
#define popb(a) pop_back(a)
#define debug(x) cout<<#x<<": "<<x<<endl
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define PI 3.14159265358979
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int main(){
  int n,m;
  string a[55]={},b[55]={};
  bool flag=false;
  cin>>n>>m;
  rep(i,0,n)cin>>a[i];
  rep(i,0,m)cin>>b[i];
      
  rep(i,0,n-m+1){
    rep(j,0,n-m+1){
      flag=true;
      rep(c,0,m){
        rep(d,0,m){
          if(a[i+c][j+d]!=b[c][d])flag=false;
          //cout<<flag<<endl;
        }
      }
      if(flag){
        cout<<"Yes"<<endl;
        return 0;
      }
    }
  }
  cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A, B;
  cin >> N >> A >> B;
  int pl1 = N*A;
  int pl2 = B;
  if ( pl1 < pl2 ){
    cout << pl1 << endl;
  }
  else{
    cout << pl2 << endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>
#include <set>

using namespace std;

const int N = 1 << 18;

int a[N];
int f[N];
int g[N][2];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < (1 << n); ++i) {
    scanf("%d", a + i);
  }
  g[0][0] = 0;
  g[0][1] = 0;
  f[0] = 0;
  for (int i = 1; i < (1 << n); ++i) {
    set<int> s;
    s.insert(i);
    for (int j = 0; j < n; ++j) {
      if (i >> j & 1) {
        s.insert(g[i ^ 1 << j][0]);
        s.insert(g[i ^ 1 << j][1]);
      }
    }
    vector<pair<int, int>> w;
    for (int e : s) {
      w.emplace_back(a[e], e);
    }
    sort(w.begin(), w.end());
    reverse(w.begin(), w.end());
    g[i][0] = w[0].second;
    g[i][1] = w[1].second;
    f[i] = max(f[i - 1], w[0].first + w[1].first);
    printf("%d\n", f[i]);
  }
}


Measured memory_bytes: 7168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define pf push_front
#define PI acos(-1)
#define EPS 1e-5
#define sz(v) ((int)(v).size())
#define all(v) v.begin(),v.end()
#define forn(i, n) for(ll i=0;i<(ll)n;i++)
#define fi first
#define se second
 

int main() {
	int n;
	cin >> n;
	set<int> s;
	forn(i, n) {
		int x;
		cin >> x;
		s.insert(x);
	}
	if(sz(s) == n) cout << "YES" <<endl;
	else cout << "NO" << endl;
	return 0;
}



Measured memory_bytes: 12976
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
const ll MOD = 1000000007;
const int inf = 1e9 + 10;
const ll INF = 4e18;
const int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
const int dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	int a[n];
	rep(i, n) cin >> a[i];
	sort(a, a + n);
	ll sum = 0;
	if (n % 2) {
		rep(i, (n + 1) / 2 - 2) sum += a[n - 1 - i] * 2 - a[i] * 2;
		sum += max(a[n / 2] + a[n / 2 + 1] - a[n / 2 - 1] * 2, a[n / 2 + 1] * 2 - a[n / 2] - a[n / 2 - 1]);
	} else {
		rep(i, n / 2 - 1) sum += a[n - 1 - i] * 2 - a[i] * 2;
		sum += a[n / 2] - a[n / 2 - 1];
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
using namespace std;
int n,a[(int)1e5+1],temp,oddc,sum;
int main(void){
    cin>>n;
    for(int i=1;i<n+1;i++){
        cin>>temp;
        a[temp]++;
    }
    for(int i=0;i<(int)1e5+1;i++){
        if(a[i]>0){
            if(a[i]%2 == 0)oddc+=1;
            sum+=1;
        }
    }
    if(oddc%2==1)cout<<sum-1<<endl;
    else cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 640
S = input()
c = 1
i = 1
tmp = S[0]
while i != len(S):
  for j in range(1,len(S)):
    t = S[i:i+j]
    if tmp != t:
      c += 1
      i += j
      break
 # print(t)
  if i == len(S)-1 and t == tmp:
    break
  tmp = t
  if i >= len(S):
    break

print(c)

Measured memory_bytes: 43228
#include <vector>
#include <sstream>
#include <algorithm>
#include <fstream>
#include <list>
#include <map>
#include <istream>
#include <bitset>
#include <sstream>
#include <unordered_map>
#include <stack>
#include <set>
#include <cmath>
#include <random>
#include <iostream>
#include <bitset>
#include <iomanip>
#include <queue>
#include <string>

#define int long long
#define endl "\n"
#define all(x) x.begin(),x.end()
#define rr return 0
#define xx first
#define yy second
#define pii pair<int,int>

using namespace std;

typedef long long ll;
typedef long double ld;

const int mod = 1000000007;

int n, k;
vector<vector<int>> g;
int ans;

void dfs(int v, int p, int dist1, int dist2){
    if((dist1 + dist2) >= k){
        cout << 0;
        exit(0);
    }
    int kek = dist1 + dist2;
    ans = (ans * (k - kek)) % mod;
    dist2 = dist1;
    dist1 = 1;
    for(auto i : g[v]){
        if(i != p){
            dfs(i, v, dist1, dist2);
            dist2++;
        }
    }
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> k;
    g.resize(n);
    for(int i = 0;i < n - 1;i++){
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    ans = 1;
    dfs(0, -1, 0, 0);
    cout << ans;
    rr;
}


Measured memory_bytes: 9216
// abc085_d
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF (1e9)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N, H;
    cin >> N >> H;
    vector<pair<ll, int>> A(N), B(N);
    REP(i, N){
        int a, b; cin >> a >> b;
        A[i] = {a, i};
        B[i] = {b, i};
    }
    sort(ALL(A), greater<P>());
    sort(ALL(B), greater<P>());
    ll a0 = A[0].first;

    ll cumsum = 0;
    ll ans = INF;
    REP(i, N){
        cumsum += B[i].first;
        if (cumsum < H){
            ans = min(ans, (i+1 + (H-cumsum+a0-1)/a0));
        } else {
            ans = min(ans, (ll)(i+1));
        }
    }

    print(ans);
    return 0;

    // ↓ なんとなくにぶたんしちゃったやつ
    auto func = [&](int n){

        int cnt = 0;
        ll damage = 0;
        REP(i, N){
            if (B[i].first > A[0].first){
                damage += B[i].first;
                cnt++;
                if (cnt >= n) break;
            }
        }

        if (cnt < n){
            damage += A[0].first * (n - cnt);
        }

        return damage;
    };

    int ok = 1e9;
    int ng = 0;
    while (ok - ng > 1){
        int mid = (ok + ng) / 2;
        if (func(mid) >= H){
            ok = mid;
        } else {
            ng = mid;
        }
    }

    print(ok);



    return 0;
}


Measured memory_bytes: 3456