akhauriyash/Code-Regression huggingface dataset:
// Your code here!
use std::io::*;
use std::str::FromStr;

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")
}

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()
}

use std::convert::TryInto;

fn main(){
    let nums:Vec<usize> = read_vec();
    let mut a:Vec<i32> = read_vec();
    let m:i32 = nums[1].try_into().unwrap();
    
    let sum:i32 = a.iter().sum();  
    
    a.sort_by(|x, y| y.cmp(x));
    
    let mut judge = true;
    for i in 0..nums[1] {
        if a[i]*(4*m)<sum {
            judge=false;
        }
    }
    
    println!("{}",if judge {"Yes"} else {"No"});
    
    
    
}




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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};


int main(){
  
  int a[5];
  REP(i,5)cin >> a[i];
  int aa[5] = {0,1,2,3,4};
  int res = INF;
  do{
    int sum = 0;
    REP(i,5){
      sum += a[aa[i]];
      if(a[aa[i]]%10 && i != 4){
        sum += 10-a[aa[i]]%10;
      }
      
    }res = min(res,sum);
  }while(next_permutation(aa,aa+5));

  cout << res << endl;
  




  return 0;
}

Measured memory_bytes: 508
#include<iostream>
#include<cmath>
#include<stdio.h>
using namespace std;
const double PI = acos(-1);

int main(){
  double a, b, f, C;
  cin >> a >> b >> f;
  C = f * PI / 180.0;

  double S, L, h;
  h = b * sin(C);
  S = a * h / 2.0;
  L = a + b + sqrt(a*a + b*b - 2 * a * b * cos(C));
  printf("%f %f %f\n", S, L, h);
}



Measured memory_bytes: 3672
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
#define LL long long
int a[200005],f[200005];
int main()
{
	int n;scanf("%d",&n);int ans=0;
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	for (int i=1;i<=n;i++) f[a[i]]=f[a[i]-1]+1;
	for (int i=1;i<=n;i++) ans=max(ans,f[i]);
	printf("%d",n-ans);
}

Measured memory_bytes: 1792
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
from itertools import accumulate as acc
#======================================================#
def main():
    n,m,k = MII()
    aa = [0]+MII()
    bb = [0]+MII()
    aa = [a for a in list(acc(aa)) if a <= k]
    bb = [b for b in list(acc(bb)) if b <= k]
    maxcnt = 0
    for i in range(len(aa)):
        a = aa[i]
        left = 0
        right = len(bb)-1
        maxv = 0
        while left <= right:
            mid = (left+right)//2
            if a+bb[mid] > k:
                right = mid-1
            else:
                maxv = max(maxv, a+bb[mid])
                left = mid+1
        maxcnt = max(maxcnt, i+right)
    print(maxcnt)

if __name__ == '__main__':
    main()

Measured memory_bytes: 41904
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

int INF = INT_MAX / 2;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

struct unko {
	int l, r; i_i mi;
	unko *lch, *rch;
	unko(int l, int r) : l(l), r(r) {
		if (r - l == 1) return;
		lch = new unko(l, (l + r) / 2);
		rch = new unko((l + r) / 2, r);
	}
	i_i get(int i, int j) {
		if (j <= l || r <= i) return i_i(INF, -1);
		if (i <= l && r <= j) return mi;
		return min(lch->get(i, j), rch->get(i, j));
	}
	void set(int i, int x) {
		if (i < l || r <= i) return;
		if (r - l == 1) {
			mi = i_i(x, i);
			return;
		}
		lch->set(i, x);
		rch->set(i, x);
		mi = min(lch->mi, rch->mi);
	}
};

int N, K;
unko* z;
vector<int> a;

void f(int r, int x) {
	for (;;) {
		i_i p = z->get(0, r);
		if (p.first - x >= K) break;
		f(p.second, p.first);
	}
	z->set(r, INF);
	a.push_back(x);
}

int main() {
	cin >> N >> K;
	z = new unko(0, N);
	for (int i = 0; i < N; i++) {
		int p; scanf("%d", &p); p--;
		z->set(p, i);
	}
	f(N, N);
	vector<int> ans(N);
	for (int i = 0; i < N; i++)
		ans[a[i]] = i;
	for (int x: ans) printf("%d\n", x + 1);
}


Measured memory_bytes: 156020
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,x,n;
    cin>>n;
    vector< int >vec(n+1,0);

    for(i=1;i<n;i++){
        cin>>x;
        vec[x]++;
    }
    vec[n]=0;
    for(int j=1;j<=n;j++){
        cout<<vec[j]<<endl;
    }
    return 0;
}


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

int main(){
  int N;
  cin>>N;
  vector<int>L(N);
  string ans="No";
  for(int i=0;i<N;i++){
    cin>>L.at(i);
  }
  sort(L.begin(),L.end());
  int total=0;
  for(int i=0;i<N-1;i++){
    total+=L.at(i);
  }
  if(total>L.at(N-1))ans="Yes";
 cout<<ans<<endl;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr) => {
        {
            (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let s = scan!(usize);
    let y = s / 100;
    let m = s % 100;
    let mut yymm = false;
    if y < 100 && 1 <= m && m <= 12 {
        yymm = true;
    }

    let mut mmyy = false;
    if m < 100 && 1 <= y && y <= 12 {
        mmyy = true;
    }

    println!(
        "{}",
        if yymm && mmyy {
            "AMBIGUOUS"
        } else if yymm {
            "YYMM"
        } else if mmyy {
            "MMYY"
        } else {
            "NA"
        }
    )
}


Measured memory_bytes: 4352
#include <stdio.h>

long long ans[100001];

int main()
{
	long long n, k;
	long long a, b;
	scanf("%lld %lld", &n, &k);
	for (long long i = 0; i < n; i++)
	{
		scanf("%lld %lld", &a, &b);
		ans[a] = ans[a] + b;
	}
	for (long long i = 1; i <= 100000; i++)
	{
		if (ans[i] < k)
		{
			k = k - ans[i];
		}
		else
		{
			printf("%lld", i);
			break;
		}
	}
	return 0;
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rrepa(i,a,n) for(int i=n-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

int main(){

    int d,t,s;
    cin>>d>>t>>s;

    if(s*t<d)cout<<"No\n";
    else cout<<"Yes\n";

    return 0;

}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
#define MOD 1000000007LL
#define endl "\n"
const ll UNDEF = -1;
const ll INF=1e18;
template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }
template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }
int main() {
	ios_base::sync_with_stdio(false);
	string s; cin>>s;
	ll n=s.length();
	ll ans=0;
	for (ll x=0;x<n;x++) {
		ll my=x&1;
		ll e=s[x]=='g'?0:1;
		if (my>e) ans++;
		else if (my<e) ans--;
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
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; }
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;


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

int N,M;
cin >> N >> M;

vector<pll> V = {};
rep(i,N){
    int a;
    cin >> a;
    V.pb({a, 1});
}
rep(i,M){
    int b,c;
    cin >> b >> c;
    V.pb({c, b});
}

sort(all(V),greater<pll>());

ll cnt = 0;
ll ans = 0;

for(auto p : V){
    if(cnt + p.second <= N) {
        ans += p.first * p.second;
        cnt += p.second;
    }else{
        ans += p.first * (N - cnt);
        cnt = N;
        break;
    }
}

cout << ans << endl;

return 0;
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void anss(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=0,res2=INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0;
  bool judge = true;
  ll h,w; cin>>h>>w;
  vector<vector<char>> c(h+2,vector<char>(w+2,'#'));
  for(i=1;i<=h;i++){
    for(j=1;j<=w;j++){
      cin>>c[i][j];
    }
  }

  for(i=0;i<=h+1;i++){
    for(j=0;j<=w+1;j++){
      cout<<c[i][j];
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
<?php

    $N = intval(trim(fgets(STDIN)));

    $A = array_map('intval',explode(" ",trim(fgets(STDIN))));
    
    for($i=0;$i<count($A);$i++){
        $A_rev[] = 1/$A[$i];
    }
    $sum = array_sum($A_rev);
    
    $ans = 1/$sum;
    
    echo $ans;

?>

Measured memory_bytes: 16368
n=int(input())
#a,b=map(int,input().split())
al=list(map(int,input().split()))
bl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
ans=0
for i in range(n):
    current=min(bl[i],al[i])
    bl[i]=bl[i]-current
    al[i]=al[i]-current
    ans+=current
    nex=min(al[i+1],bl[i])
    al[i+1]=al[i+1]-nex
    ans+=nex

print(ans)


Measured memory_bytes: 18624
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}()

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func calcTaste(l, i int) int {
	return l + i - 1
}
func calcTasteAll(n, l int) int {
	return l*n + n*(n+1)/2 - n
}
func outputTaste(n, l int) int {
	all := calcTasteAll(n, l)
	switch {
	case l >= 0:
		return all - calcTaste(l, 1)
	case l+n >= 1:
		return all
	default:
		return all - calcTaste(l, n)
	}
}
func main() {
	n, l := nextInt(), nextInt()
	fmt.Println(outputTaste(n, l))
}


Measured memory_bytes: 640
n,m = map(int, input().split())
DIV = 10**9+7
a = [0]*(n+1)
dp = [0]*(n+1)
dp[0] = 1
for _ in range(m):
    broken = int(input())
    a[broken] = 1
for i in range(1,n+1):
    dp[i]=(dp[i-1]+dp[i-2]) % DIV
    if a[i] == 1:
        dp[i] = 0
print(dp[n])


Measured memory_bytes: 7668
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <iomanip>
using namespace std;
typedef long long int ll;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a, b, c, d, e, f;
	bool w[10010] = {}, s[10010] = {};
	w[0] = s[0] = 1;
	cin >> a >> b >> c >> d >> e >> f;
	a *= 100; b *= 100;
	for (int i = 0; i < f; i++) {
		if (w[i])w[i + a] = w[i + b] = 1;
		if (s[i])s[i + c] = s[i + d] = 1;
	}
	ll ansa = 0, ansb = 0;
	for (int i = 0; i <= f; i++) {
		if (w[i])for (int j = 0; j <= f; j++) {
			if (i + j <= f) {
				if (s[j]) {
					if (j <= i / 100 * e) {
						if (j*(ansa + ansb) >= (i + j)* (ansb))ansa = i, ansb = j;
					}
				}
			}
		}
	}
	cout << ansa + ansb << " " << ansb << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<numeric>
#include<cctype>
#include<random>

//#include<boost/circular_buffer.hpp>
using namespace std;

//cout << fixed << setprecision(10);
typedef long long ll;
#define PI 3.141592653589793
#define Yes(a) a ? "Yes" : "No";
#define YES(a) a ? "YES" : "NO";
#define rep(i,n) for(int i=0;i<n;i++)

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

long long int lcm(long long int a, long long int b) {
	long long int L;
	L = a / gcd(a, b);
	L *= b;
	return L;
}

vector<long long  int> Prime;
void Eratosthenes(long long int n) {
	vector<bool> is_prime(n, true);
	is_prime.at(0) = false;
	is_prime.at(1) = false;
	for (long long int i = 2; i * i <= n; i++) {
		if (is_prime.at(i)) {
			for (int j = i * i; j < n; j += i) {
				is_prime.at(j) = false;
			}
		}
	}
	for (int i = 2; i < n; i++) {
		if (is_prime.at(i))
			Prime.emplace_back(i);
	}
}

/*
map<int, int> prime;
void Prime_number(long long int n) {
	for (int i = 2; i <= n; i++) {
		int count = 0;
		while (n % i == 0) {
			count++;
			n /= i;
		}
		if (count != 0) {
			prime.insert(make_pair(i, count));
		}
	}
}
*/
//std::cout.fill('0');

int keta(long long int N) {
	int k = 0;
	while (N > 0) {
		N /= 10;
		k++;
	}
	return k;
}

int Combination(int n, int m) {
	long long int s = 1, t = 1;
	int tmp = n;
	while (n - m != tmp) {
		s *= tmp;
		tmp--;
	}
	tmp = m;
	while (tmp != 1) {
		t *= tmp;
		tmp--;
	}
	return s / t;
}


int main() {
	int m, d, cnt = 0;
	cin >> m >> d;

	for (int i = 4; i <= m; i++) {
		for (int d1 = 2; d1 < 10; d1++) {
			for (int d2 = 2; d2 < 10; d2++) {
				if (d1 + 10 * d2 <= d && i == d1 * d2) {
					cnt++;
				}
			}
		}
	}
	cout << cnt << endl;
	return 0;
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int a = sc.nextInt();
      int b = sc.nextInt();
      int c = sc.nextInt();
      if(a > b){
              int t = a;
              a = b;
              b = t;
      }
      
      if(b > c){
              int t = b;
              b = c;
              c = t;
      }
      
      if(a > b){
              int t = a;
              a = b;
              b = t;
      }
      
    System.out.println(a + " " + b + " " + c);
    }
    
  
    
}



Measured memory_bytes: 26216
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int size = 100001;
            int len = sc.nextInt();
            int[] num;
            num = new int[len];
            int[] box;
            box = new int[size];
            int i;
            int max=0;
            for(i = 0;i < size ;i++) box[i] = 0;
        try{
            for(i = 0;i < len ;i++)num[i] = sc.nextInt();
            for(int n : num){
                if(n!=0) box[n-1]++;
                box[n]++;
                box[n+1]++;
            }
            for(int b : box){
                if(max < b) max = b;
            }
            System.out.print(max);
        }
        catch(Exception e){
            System.out.print("error");
        }
	}
}

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

int main(){
    int k;
    cin >> k;
    int x = 7 % k;
    int i = 1;
    set<int> s;
    while(s.count(x) == 0){
        if(x == 0){
            cout << i << endl;
            return 0; 
        }
        s.insert(x);
        x = (x*10+7) % k;
        i++;
    }
    cout << -1 << endl;
}

Measured memory_bytes: 50488
import sys
import itertools
import copy

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():
    H, W, K = in_nn()
    c = [list(in_s()) for _ in range(H)]

    comb_h = list(itertools.product([0, 1], repeat=H))
    comb_w = list(itertools.product([0, 1], repeat=W))

    ans = 0
    for ch in comb_h:
        for cw in comb_w:
            tc = copy.deepcopy(c)
            for y, f in enumerate(ch):
                if f:
                    for x in range(W):
                        tc[y][x] = 'a'
            for x, f in enumerate(cw):
                if f:
                    for y in range(H):
                        tc[y][x] = 'a'

            count = 0
            for y in range(H):
                for x in range(W):
                    if tc[y][x] == '#':
                        count += 1

            if count == K:
                ans += 1

    print(ans)


if __name__ == '__main__':
    main()


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

#define F first
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 110, M = 110;

int x;

int get(int x)
{
	return x * x * x * x * x;
}

int main()
{
	cin >> x;
	for (int i = -118; i <= 120; i ++ )
		for (int j = -118; j <= 120; j ++ )
			if (get(i) - get(j) == x)
			{
				cout << i << ' ' << j << endl;
				return 0;
			}
	return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin>>n;
    int a;
    set<int> number{};
    for(int i=0;i<n;i++){
        cin>>a;
        number.insert(a);
    }
    cout<<number.size()<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double c = sc.nextDouble();
		double c1 = c*Math.PI/180;
		
		System.out.println(String.format("%f", 0.5*a*b*Math.sin(c1))
				+ " " + String.format("%f", a+b+Math.pow(a*a+b*b-2*a*b*Math.cos(c1), 0.5))
				+ " " + String.format("%f", b*Math.sin(c1)));
	}
}


Measured memory_bytes: 28168
#include <bits/stdc++.h>
using namespace std;
char arr[200001];
int main()
{
    scanf("%s",arr);
    int n=strlen(arr);
    long long int cnt=0,ans=0;
    for(int i=n-1;i>=0;i--) if(arr[i]=='B') cnt++;
    for(int i=n-1;i>=0;i--)
    {
        if(arr[i]=='W') ans+=cnt;
        else cnt--;
    }
    printf("%lld",ans);
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define all(v) (v).begin(), (v).end()
using namespace std;
typedef long long LL;
const int INF = 999999999;

int main(){
    int n;
    cin >> n;
    string S;
    cin >> S;
    vector<int> A(n+1, -1);
    A[0] = -1;
    int i=0, j = -1;
    for (i = 0; i < S.size(); i++) {
        while (j >= 0 && S[i] != S[j]) j = A[j];
        j++;
        A[i+1] = j;
    }
    int ans = n-A[n];
    string T = S.substr(0, ans);
    // cout << T << endl;

    vector<int> R(S.size()+1, -1);
    i=0; j=0;
    while (i < S.size()) {
        while (i-j >= 0 && i+j < S.size() && S[i-j] == S[i+j]) ++j;
        R[i] = j;
        int k = 1;
        while (i-k >= 0 && i+k < S.size() && k+R[i-k] < j) R[i+k] = R[i-k], ++k;
        i += k; j -= k;
    }
    // rep(i, T.size()) cout << R[i] << endl;
    if(T.size()%2 == 0 && R[T.size()/2] >= T.size()/2) ans = T.size()/2+1;
    else{
        // int r = T.size()/2+1;
        bool f = false;
      for(int i=T.size()/2+1; i<S.size(); i++){
          int r = n - i;
          if(r <= i && R[i] >= r){
              ans = i+1;
              f = true;
              break;
          }

      }
      if(!f) ans = n;
    }
    cout << max(ans, 2) << endl;

}


Measured memory_bytes: 12956
n=int(input())
time=0
ans=0
hoge=[]
for i in range(n):
  a,b=map(int,input().split())
  hoge.append([b,a])

hoge.sort()
  
for i in range(n):
  #print(hoge[i][0],hoge[i][1])
  time+=hoge[i][1]
  if(time>hoge[i][0]):
    ans+=1
    
if(ans==0):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 35608
#include <iostream>
#define MAX(a,b) ((a)>(b)?(a):(b))
using namespace std;

int main(void){
	int a,b,c,d,e,f,g,h;
	cin>>a>>b>>c>>d>>e>>f>>g>>h;
	cout<<MAX(a+b+c+d,e+f+g+h)<<endl;
	return 0;
}

Measured memory_bytes: 3080
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>

#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()

using namespace std;

const int MAX = 1010;
const int MOD = (ll)1000000000 + 7;
const ll INF = 1e17;
const double pi = acos(-1);
const double EPS = 1e-10;
//小さいほうから取り出すpriority queue
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
typedef pair<int, int>P;

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


int N;
string S[10010];
int B, A, BA, ans;
signed main() {
	cin >> N;
	B = 0, A = 0, BA = 0;
	REP(i, N) {
		cin >> S[i];
	}
	REP(i, N) {
		int n = S[i].size();
		REP(j, n - 1) {
			string str = S[i].substr(j, 2);
			if (str == "AB")ans++;
		}
		if (S[i][0] == 'B'&&S[i][n - 1] == 'A') {
			BA++;
		}
		else if (S[i][0] == 'B') {
			B++;
		}
		else if (S[i][n - 1] == 'A') {
			A++;
		}
	}
	while (BA >= 1 && (A>0 || B>0)) {
		if (A) {
			ans++; BA--;
		}
		if (BA >= 1) {
			if (B) {
				ans++;
				BA--;
			}
		}
	}
	if (BA == 0) {
		ans += min(A, B);
	}
	else {
		ans += BA-1;
	}

	print(ans);
}


Measured memory_bytes: 768
import java.util.Scanner;

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

			int[] x = new int[n];
			int[] y = new int[n];

			int minValue1 = Integer.MAX_VALUE;
			int maxValue1 = Integer.MIN_VALUE;
			int minValue2 = Integer.MAX_VALUE;
			int maxValue2 = Integer.MIN_VALUE;

			for (int i = 0; i < n; i++) {
				int a = x[i] = sc.nextInt();
				int b = y[i] = sc.nextInt();

				int u = a + b;
				if (u < minValue1) {
					minValue1 = u;
				}
				if (maxValue1 < u) {
					maxValue1 = u;
				}

				int v = a - b;
				if (v < minValue2) {
					minValue2 = v;
				}
				if (maxValue2 < v) {
					maxValue2 = v;
				}
			}

			System.out.println(Math.max(maxValue1-minValue1, maxValue2-minValue2));

		} catch (Exception e) {
			e.printStackTrace();
		}

	}

}

Measured memory_bytes: 61944
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n,k=INTM()
    l=LIST()
    ct=0
    for i in range(n):
        if l[i]>=k:
            ct+=1
    print(ct)
if __name__ == '__main__':
    do()

Measured memory_bytes: 11896
import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    if (args.length > 0 && args(0) == "TEST") {
      println(test())
    } else {
      val input = io.Source.stdin.getLines().mkString("\n")
      println(solve(input).trim())
    }
  }

  def solve(input: String): String = {
    val sc: Scanner = new Scanner(input)
    val n = sc.next.toCharArray.zipWithIndex
    val aPos = n.find {case(c, _) => c == 'A'}.map(_._2).get
    val zPos = n.filter {case(c, _) => c == 'Z'}.lastOption.map(_._2).get
    (zPos - aPos + 1).toString
  }

  val tests = List(
    """QWERTYASDFZXCV""".stripMargin -> """5""",
    """ZABCZ""".stripMargin -> """4""",
    "HASFJGHOGAKZZFEGA" -> "12"
  )

  def test(): String = tests.map { case (i, o) => (i.trim(), o.trim()) }
    .zipWithIndex.map {
    case ((input, outputExpect), i) =>
      val output = solve(input).trim()
      val tnum = i + 1
      s"test$tnum:" + (
        if (output == outputExpect) "Passed"
        else s"Failed\nexpect:\n$outputExpect\noutput:\n$output")
  }
    .mkString("\n")
}

Measured memory_bytes: 40096
n, m = map(int,input().split())
cake = [list(map(int, input().split())) for _ in range(n)]
ans = []

for p in [-1, 1]:
  for q in [-1, 1]:
    for r in [-1, 1]:
      tmp = []
      for i in range(n):
        tmp.append(cake[i][0]*p + cake[i][1]*q + cake[i][2]*r)
      tmp.sort(reverse = True)
      ans.append(sum(tmp[:m]))

print(max(ans))


Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline int read() {
    char c=getchar();int x=0,f=1;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0',c=getchar();}
    return x*f;
}
ll p[200000],c[200000];
ll m;
ll ans=0;
void divide(long long n){
	m=0;
	for(ll i=2;i<=sqrt(n);++i){
		if(n%i==0){
			p[++m]=i;
			c[m]=0;
			while(n%i==0){
				n/=i;
				c[m]++;
			} 
		}
	}
	if(n>1){
		p[++m]=n;
		c[m]=1;
	}
	for(int i=1;i<=m;++i){
		for(ll j=1;j<=10000;++j){
			if(j*(j+1)/2>c[i]){
				ans+=j-1;
				break;
			}
		}
		//cout<<ans<<endl;
		//cout<<p[i]<<"^"<<c[i]<<endl;
	}

}
int main(){
	long long n;
	cin>>n;
	divide(n);
	cout<<ans<<endl;
	return 0;
}

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

long long n, sum1, sum2, sum3, sum4, sum5, ans;
string s[100001];
int main()
{
	cin >> n;
	for(int i = 1; i <= n; i++)
		cin >> s[i];
	for(int i = 1; i <= n; i++)
	{
		if(s[i][0] == 'M')
			sum1++;
		if(s[i][0] == 'A')
			sum2++;
		if(s[i][0] == 'R')
			sum3++;
		if(s[i][0] == 'C')
			sum4++;
		if(s[i][0] == 'H')
			sum5++;
	}
	ans += sum1 * sum2 * sum3;
	ans += sum1 * sum2 * sum4;
	ans += sum1 * sum2 * sum5;
	ans += sum1 * sum3 * sum4;
	ans += sum1 * sum3 * sum5;
	ans += sum1 * sum4 * sum5;
	ans += sum2 * sum3 * sum4;
	ans += sum2 * sum3 * sum5;
	ans += sum2 * sum4 * sum5;
	ans += sum3 * sum4 * sum5;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6144
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
//using ll=long long;
#define int long long
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279; //円周率
/*---------------------便利な関数--------------------------------------*/
int fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
 
int gcd(int a, int b) {        //最大公約数
    if (b == 0) return a;
    return gcd(b, a % b);
}
 
int lcm(int a, int b) {      //最小公倍数
    return a * b / gcd(a, b);
}
 
int keta(int n) {        //桁数を求める
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
 
int ketasum(int n) {    //各桁の和
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
//最小化問題(DP)
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
//最大化問題(DP)
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//dp注意点
//問題の種類	 初期化する値	 備考
//最小化問題 	INF	
//最大化問題	    -INF	 テーブル全体で 00 以上の値しかとらないことがわかっていれば −1−1 でもいいですし、00 でもいい場合もあります
//数え上げ問題	00	
//確率問題	      00	
//Yes/No 判定問題	False
/*-------------ここまで---------------------------------------------*/
 
signed main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a+b+c>21) cout<<"bust"<<endl;
  else cout<<"win"<<endl;
  return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define cout16 cout << setprecision(16) 
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using P = std::pair<int,int>;
using vp = std::vector<P>;
using namespace std;
#define INF 1001001001
#define LL_INF 1001001001001001001
#define fi first
#define se second

vll digit(ll n){
	vll res;
	while(n){
		res.push_back(n%10);
		n /= 10;
	}
	return res;
}
ll n;
ll dfs(ll a){
	if(a>n) return 0;
//	cout << a << endl;
	ll res = 0;
	vll v = digit(a);
	vll cnt(3,0);
	if(a)rep(i,v.size()) cnt[(v[i]-1)/2-1]++;
	if(cnt[0]*cnt[1]*cnt[2]) res += 1;
	for(ll x=3; x<=7; x+=2)res += dfs(a*10+x);
	return res;
}

int main(void) {
	cin >> n;
	cout << dfs(0) << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N;
    cin >> N;
    int cnt[3] = {};
    rep(i,0,N){
        int a;
        cin >> a;
        if(a % 4 == 0)cnt[2]++;
        else if(a % 2 == 0)cnt[1]++;
        else cnt[0]++;
    }
    //cout << cnt[0] << " " << cnt[1] << " " << cnt[2] << endl;
    if(cnt[1])cnt[0]++;
    if(cnt[0] <= cnt[2] + 1)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
char f(int k) {
	if (k == 1)return '1';
	if (k == 2)return '2';
	if (k == 3)return '3';
	return '0';
}
int main() {
	int n;
	while (cin >> n) {
		if (n == -1)return 0;
		if (n == 0)cout << "0\n";
		else {
			string ans;
			while (n != 0) {
				ans = f(n % 4) + ans;
				n = (n - n % 4) / 4;
			}
			cout << ans << endl;
		}
	}
}

Measured memory_bytes: 3196
fun main(args:Array<String>) {
	val (h,w) = readLine()!!.split(" ").map{ it.toInt() }
	val s = (0..h+1).map {
		if(it == 0 || it == h+1) return@map ".".repeat(w+2)
		else return@map ".${readLine()!!}."
	}
	for(i in 1..h)for(j in 1..w){
		if("#...."=="%c%c%c%c%c".format(
						s[i][j],s[i+1][j],s[i-1][j],s[i][j+1],s[i][j-1])) {
			println("No")
			return
		}
	}
	println("Yes")
}

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

inline int read_int(void)
{
	int i;
	int c;
	i = 0;

	while(1) {
		c = getc(stdin);
		if (c >= '0' && c <= '9') {
			i = c - '0';
			break;
		}
	}
	while(1) {
		c = getc(stdin);
		if (c >= '0' && c <= '9') {
			i = i * 10 + (c - '0');
		} else {
			break;
		}
	}
	return i;
}

int compare_int(const void *a, const void *b)
{
	// 降順 
	return *(int *) b - *(int *) a;
}

typedef int value_type; /* ソートするキーの型 */

/* x, y, z の中間値を返す */
value_type med3(value_type x, value_type y, value_type z) {
    if (x < y) {
        if (y < z) return y; else if (z < x) return x; else return z;
    } else {
        if (z < y) return y; else if (x < z) return x; else return z;
    }
}

/* クイックソート
 * a     : ソートする配列
 * left  : ソートするデータの開始位置
 * right : ソートするデータの終了位置
 */
void quicksort(value_type a[], int left, int right) {
    if (left < right) {
        int i = left, j = right;
        value_type tmp, pivot = med3(a[i], a[i + (j - i) / 2], a[j]); /* (i+j)/2 ではオーバーフローしてしまう */
        while (1) { /* a[] を pivot 以上と以下の集まりに分割する */
            while (a[i] > pivot) i++; /* a[i] >= pivot となる位置を検索 */
            while (pivot > a[j]) j--; /* a[j] <= pivot となる位置を検索 */
            if (i >= j) break;
            tmp = a[i]; a[i] = a[j]; a[j] = tmp; /* a[i], a[j] を交換 */
            i++; j--;
        }
        quicksort(a, left, i - 1);  /* 分割した左を再帰的にソート */
        quicksort(a, j + 1, right); /* 分割した右を再帰的にソート */
    }
}

int main(int argc, char *argv[])
{
	int n, i, c;
	int j;
	int a[200000];
	
	int x, y;
	int min_sq, l_min_sq;
	
	scanf("%d", &n);

	for (i = 0; i < n; i++) {
	//	scanf("%d", &a[i]);
		a[i] = read_int();
	}
	
	//qsort(a, n, sizeof(int), compare_int);
	quicksort(a, 0, n - 1);

	c = 0;

	l_min_sq = -1;
	for (i = 0; i < n; i++) {
		x = a[i];
		if (x == 0) {continue;}
		min_sq = pow(2, (int) log2(x) + 1);

		if (l_min_sq != min_sq) {
			j = n - 1;
		}
		for (;j > i; j--) {
			y = a[j];
			if (y == 0) {continue;}
			if (y == min_sq - x) {
				a[j] = 0;
				c++;
				break;
			}
			if (y > min_sq - x) {
				break;
			}
		}
		l_min_sq = min_sq;
	}

	printf("%d\n", c);
	
	return 0;
}

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


int main(){
   int n,r;
   cin >> n >> r;
   int ans = 0;
   if (n >= 10) ans = r;
   else ans = r + 100*(10-n);
   cout << ans << endl;


  
  return 0;
}


Measured memory_bytes: 3564
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
struct mint{
    using ull=unsigned long long int;
    ull v;
    mint(ll vv=0){s(vv%mod+mod);}
    mint& s(ull vv){
        v=vv<mod?vv:vv-mod;
        return *this;
    }
    //オーバーロード
    mint operator-()const{return mint()-*this;}//mint型にキャスト
    mint&operator+=(const mint&val){return s(v+val.v);}
    mint&operator-=(const mint&val){return s(v+mod-val.v);}
    mint&operator*=(const mint&val){
        v=ull(v)*val.v%mod;
        return *this;
    }
    mint&operator/=(const mint&val){return *this*=val.inv();}
    mint operator+(const mint&val){return mint(*this)+=val;}
    mint operator-(const mint&val){return mint(*this)-=val;}
    mint operator*(const mint&val){return mint(*this)*=val;}
    mint operator/(const mint&val){return mint(*this)/=val;}
    mint pow(ll n)const{
        mint res(1),x(*this);
        while(n){
            if(n&1)res*=x;
            x*=x;
            n>>=1;
        }
        return res;
    }
    mint inv()const{return pow(mod-2);}
    //拡張ユークリッドの互除法
    /* mint inv()const{
        int x,y;
        int g=extgcd(v,mod,x,y);
        assert(g==1);
        if(x<0)x+=mod;
        return mint(x);
    }*/
    friend ostream& operator<<(ostream&os,const mint&val){
        return os<<val.v;
    }//出力
    bool operator<(const mint&val)const{return v<val.v;}
    bool operator==(const mint&val)const{return v==val.v;}
    bool operator>(const mint&val)const{return v>val.v;}
};
const ll MAX = 2000010;//設定
mint fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void init(){
    fac[0] = fac[1] = 1;
    for(int i=1;i<MAX;i++)fac[i]=fac[i-1]*i;
    finv[MAX-1]=fac[MAX-1].inv();
    for(int i=MAX-2;i>=0;i--)finv[i]=finv[i+1]*(i+1);
    for(int i=MAX-2;i>=1;i--)inv[i]=finv[i]+fac[i-1];
}
//階乗
mint factor(ll n,ll k){
  if (n<k) return 0;
  if (n<0 || k<0) return 0;
  return fac[n]*finv[k];
}
// 二項係数計算
mint COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * finv[k] * finv[n - k];
}
int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    init();
    int m=s.size();
    mint ans=1;
    for(int i=0;i<=n;i++){
        ans+=COM(m+i-1,i)*mint(25).pow(i)*mint(26).pow(n-i);
    }
    cout<<ans-mint(1)<<"\n";
}


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

typedef long long ll;
#define PI 3.1415926535897932384626433
#define mod 1000000007

int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

int lcm(int a, int b) { return a * b / gcd(a, b); }

int main(){
    string s;
    cin >> s;
    s.insert(4, " ");
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
using namespace std;

typedef long long ll;

vector<pair<int,int> > lst;

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n;
	cin>>n;
	for(int i = 0;i < n;i++) {
		int x, l;
		cin>>x>>l;
		lst.pb({x + l, x - l});
	}
	sort(lst.begin(), lst.end());
	int pre = -2e9;
	int total = 0;
	for(int i = 0;i < n;i++) {
		if(lst[i].S >= pre) {
			total++;
			pre = lst[i].F;
		}
	}
	cout<<total<<endl;
}

Measured memory_bytes: 1400
// Rooted Trees
#include <stdio.h>
#define MAX 100000 // 接点の個数の上限
#define NIL -1     // 接点番号として使われない値を設定(とりあえず-1としておく)

struct node{
  int parent; // 各接点の親を参照
  int left;   // 左の子を参照
  int right;  // 右の兄弟を参照
};
struct node T[MAX];

int getDepth(int);
int printNodeType(int);
void printChildren(int);

int main(){
  int i, j, id, k, child, c, n;

  scanf("%d", &n);

  for(i=0; i < n; i++){
    T[i].parent = T[i].left = T[i].right = NIL;
  }
  
  for(i=0; i < n; i++){
    scanf("%d%d", &id, &k);
    for(j=0; j < k; j++){
      scanf("%d", &child);
      if(j == 0)T[id].left = child;
      else T[c].right = child;
      c = child;
      T[child].parent = id;
    }
  }

  for(i=0; i < n; i++){
    printf("node %d: parent = %d, depth = %d, ", i, T[i].parent, getDepth(i));
    printNodeType(i);
    printChildren(i);
  }

  return 0;
}

// 接点の深さを得る
int getDepth(int u){
  int d=0;
  while(T[u].parent != NIL){
    u = T[u].parent;
    d++;
  }
  return d;
}

// 根、内部ノードまたは葉のどれかを判定して表示
int printNodeType(int u){
  if(T[u].parent == NIL)printf("root, ");
  else if(T[u].left == NIL)printf("leaf, ");
  else printf("internal node, ");
}

// 子のリストを表示
void printChildren(int u){
  int i, c;
  c = T[u].left;
  printf("[");
  for(i=0; c != NIL; i++){
    if(i != 0)printf(", ");
    printf("%d", c);
    c = T[c].right;
  }
  printf("]\n");
}



Measured memory_bytes: 2904
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
int main()
{
    int n, t, a;
    cin >> n >> t >> a;
    auto h = vector<double>(n, 0);
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        h[i] = abs(t - x * 0.006 - a);
    }

    cout << distance(h.begin(), min_element(h.begin(), h.end())) + 1;
}

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

struct Node{
    Node *left;
    Node *right;
    Node() { left = NULL, right = NULL; }
};

int findcc(string s) {
    int dd = 0;
    for(int i=0; i<s.length(); ++i) {
        if(s[i] == '(') dd++;
        else if(s[i] == ')') dd--;
        else if(s[i] == ',' && dd == 1) return i;
    }
    return -1;
}

Node* parse(string s) {
    Node *r = new Node();
    int ff = findcc(s);
    if(ff != 1) r->left = parse(s.substr(1,ff-1));
    if(ff != s.length()-2) {
        string tmp = s.substr(ff+1);
        r->right = parse(tmp.substr(0,tmp.length()-1));
    }
    return r;
}

Node *intersect(Node *r1,Node *r2) {
    Node *ret = new Node();
    if(r1->left != NULL && r2->left != NULL)
        ret->left = intersect(r1->left,r2->left);

    if(r1->right != NULL && r2->right != NULL)
        ret->right = intersect(r1->right,r2->right);

    return ret;
}

Node* uni(Node *r1,Node *r2) {
    if(r1 == NULL && r2 == NULL) return NULL;

    Node *ret = new Node();
    ret->left = uni(((r1 == NULL)?NULL:r1->left),(r2 == NULL)?NULL:r2->left);
    ret->right = uni(((r1 == NULL)?NULL:r1->right),(r2 == NULL)?NULL:r2->right);
    return ret;
}

string toStr(Node *tree) {
    string res = "(";
    if(tree->left != NULL) res += toStr(tree->left);
    res += ",";
    if(tree->right != NULL) res += toStr(tree->right);
    res += ")";
    return res;
}

void treedel(Node *node) {
    if(node->left != NULL) treedel(node->left);
    if(node->right != NULL) treedel(node->right);
    delete node;
    return;
}

int main() {
    string op,t1,t2;
    while(cin>>op>>t1>>t2) {
        Node *r1 = parse(t1);
        Node *r2 = parse(t2);
        Node *ans;
        if(op == "i") ans = intersect(r1,r2);
        else if(op == "u") ans = uni(r1,r2);

        cout<<toStr(ans)<<endl;
        treedel(r1); treedel(r2); treedel(ans);
    }
}

Measured memory_bytes: 1228
n,m=map(int,input().split())

l=[0]*n
ll=[0]*n
no_ac=0
no_pen=0

for i in range(m):
  a,b=map(str,input().split())
  a=int(a)
  if b=='AC':
    if l[a-1]==0:      
      no_ac+=1
      l[a-1]=1
  else:
    if l[a-1]==0:
      ll[a-1]+=1

for i in range(n):
  if l[i]==1:
    no_pen+=ll[i]
print(no_ac,no_pen)

Measured memory_bytes: 10436
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

using P = pair<int, int>;

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

    vector< P > a(5);
    rep (i, 5)
    {
        cin >> a[i].second;
        int temp = CEIL(a[i].second, 10) * 10;
        a[i].first = temp - a[i].second;
    }

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

    int ans = 0;
    rep (i, 4)
    {
        ans += CEIL(a[i].second, 10) * 10;
    }
    cout << ans + a[4].second << "\n";
    return 0;
}



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

//D日目時点のスコアを計算
int score(int D, int c[], int s[][26], int t[]){
    int pen_day[26]={1};
    for(int i=0; i<26; i++){
        pen_day[i]=1;
    }
    int score=0;
    
    for(int i=0; i<D; i++){
        int type=t[i]-1;
        pen_day[type]=0;
        //満足度増加
        score+=s[i][type];
        //満足度低下
        for(int j=0; j<26; j++){
            int dec=c[j]*pen_day[j];
            score-=dec;
        }
        //日数追加
        for(int j=0; j<26; j++){
            pen_day[j]++;
        }        
    }
    return score;
}

void Greedy(int D, int c[], int s[][26]){
    int t[D], max_type=0, max_score=0;

    for(int i=0; i<D; i++){
        max_score=0;
        for(int j=0; j<26; j++){
            t[i]=j+1;
            int S=score(i+1, c, s, t);
            if(max_score < S){
                max_score = S;
                max_type=j+1;
            }
        }
        t[i]=max_type;
    }

    //局所探索
    int new=0;
    int roop_num=0;
    int MAX=max_score;
    while(1){
        int a=rand()%D;
        int b=rand()%D;

        //a,bを入れ替え
        int tmp;
        tmp=t[a];
        t[a]=t[b];
        t[b]=tmp;

        //scoreを計算
        int now_score=score(D, c, s, t);
        if(MAX>now_score) MAX=now_score;
        else{
            tmp=t[a];
            t[a]=t[b];
            t[b]=tmp;  
        }
        new++;
        roop_num++;
        if(new==D/10) break;
        if(roop_num==365) break;
    }

    for(int i=0; i<D; i++){
        printf("%d\n", t[i]);
    }
}

int main(void){
    int D, c[26], s[365][26], t[365];

    //入力
    scanf("%d", &D);
    for(int i=0; i<26; i++){
        scanf("%d", &c[i]);
    }
    for(int i=0; i<D; i++){
        for(int j=0; j<26; j++){
            scanf("%d", &s[i][j]);
        }
    }
    /*
    for(int i=0; i<D; i++){
        scanf("%d", &t[i]);
    }
    */

   /*ここから処理*/
   /*
    int num=1;
    for(int i=0; i<D; i++){
        printf("%d\n", num);
        num++;
        if(num>26) num=1;
    }
    */

   Greedy(D, c, s);


    return 0;
}

Measured memory_bytes: 1772
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
  int X;
  cin >> X;
  if (X <= 599) {
    cout << 8 << endl;
  } else if (X <= 799) {
    cout << 7 << endl;
  } else if (X <= 999) {
    cout << 6 << endl;
  } else if (X <= 1199) {
    cout << 5 << endl;
  } else if (X <= 1399) {
    cout << 4 << endl;
  } else if (X <= 1599) {
    cout << 3 << endl;
  } else if (X <= 1799) {
    cout << 2 << endl;
  } else if (X <= 1999) {
    cout << 1 << endl;
  }    
  return 0;
}


Measured memory_bytes: 3160