akhauriyash/Code-Regression huggingface dataset:
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define PER(i, n) for (int i = (n-1); i >= 0; --i)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

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

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

int f(string s) {
  int n = s.size();
  int sum = 0;
  for(int i = 0, j = 0; i < n; i = j) {
    while(j < n && s[i] == s[j]) ++j;
    sum += (j-i) / 2;
  }
  return sum;
}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  int k;
  IN2(s,k);

  bool all_same = true;
  REP(i,s.size()-1) {
    if(s[i]!=s[i+1]){
      all_same = false;
    }
  }

  if(all_same) {
    OUT(s.size()*k/2);
  } else {
    int cnt1 = f(s);
    int cnt2 = f(s+s);
    OUT(cnt1 + (k-1) * (cnt2-cnt1));
  }
}

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

typedef long long ll;

#define pb push_back
#define mp make_pair
#define fi first
#define se second

const int N = 1e5 + 5;
int a[N][3], n;
ll dp[N][3];

ll solve(int d, int f) {
    if (d == 0) return 0;
    if (dp[d][f - 1] != -1) return dp[d][f - 1];
    ll &ret = dp[d][f - 1];
    ret = a[d][f - 1];
    ll val = 0;
    for (int i = 1; i <= 3; i++) {
        if (i == f) continue;
        val = max(val, solve(d - 1, i));
    }
    ret += val;
    return ret;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i][0] >> a[i][1] >> a[i][2];
    memset(dp, -1, sizeof(dp));
    ll v1 = solve(n, 1), v2 = solve(n, 2), v3 = solve(n, 3);
    ll ans = max({v1, v2, v3});
    cout << ans;
    
    return 0;
}


Measured memory_bytes: 9984
#[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)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $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, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        x: usize,
        y: usize,
    }
    let mut result = 0;
    if x <= 3 {
        result += (4 - x) * 100000;
    }
    if y <= 3 {
        result += (4 - y) * 100000;
    }
    if x == 1 && y == 1 {
        result += 400000;
    }
    println!("{}", result);
}


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

int main()
{
    int A, B;
    cin >> A >> B;

    if ((A % 3) == 0)
        cout << "Possible" << endl;
    else if ((B % 3) == 0)
        cout << "Possible" << endl;
    else if ((A + B) % 3 == 0)
        cout << "Possible" << endl;
    else
        cout << "Impossible " << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define int long long
typedef long long ll;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  int N, M, K;
  cin >> N >> M >> K;
  repp(n, 0, N) {
    repp(m, 0, M) {
      if (n * M + m * N - n * m * 2 == K) {
        cout << "Yes\n";
        return 0;
      }
    }
  }
  cout << "No\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>

using namespace std;

long gcd(long a, long b) {
    if (a == 0)
        return b;
    if (b == 0)
        return a;


    if (a == b)
        return a;

    if (a > b)
        return gcd(a - b, b);
    return gcd(a, b - a);
}

int main() {

    long A, B;
    cin >> A >> B;



    cout << (A*B)/gcd(A,B) << endl;
    return 0;

}

Measured memory_bytes: 256
#include <stdio.h>

int a,b,c;
int ans = 0;
char x[110][110],y[110][110];
int check[110];
void func(int k)
{
	if(k>a+b)
	{
		for(int i=1;i<=a;i++) for(int j=1;j<=b;j++) y[i][j] = x[i][j];
		for(int i=1;i<=a;i++) if(check[i]==1) for(int j=1;j<=b;j++) y[i][j] = '.';
		for(int j=1;j<=b;j++) if(check[a+j]==1) for(int i=1;i<=a;i++) y[i][j] = '.';
		
		int count = 0;
		for(int i=1;i<=a;i++) for(int j=1;j<=b;j++) if(y[i][j]=='#') count++;
		if(count==c) ans++;
		
		return;
	}
	
	func(k+1);
	check[k] = 1;
	func(k+1);
	check[k] = 0;
}
int main()
{
	scanf("%d%d%d",&a,&b,&c);
	for(int i=1;i<=a;i++) scanf("%s",x[i]+1);
	func(1);
	printf("%d",ans);
}

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

using namespace std;

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

int main() {
  char a, b;
  cin >> a >> b;
  cout << (a == b ? 'H' : 'D') << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>

using namespace std;

using PLI = pair<long long, int>;

const long long inf = 1e18;
const long long initial = 1e15;

vector<long long> dijkstra(int n, int st, vector<vector<PLI>> &connect) {
	priority_queue<PLI, vector<PLI>, greater<PLI>> que;
	vector<long long> dist(n + 1, inf);
	dist[st] = 0;
	que.push(PLI(0, st));

	while (!que.empty()) {
		auto p = que.top();
		que.pop();

		auto v = p.second;
		if (dist[v] < p.first) {
			continue;
		}

		for (auto e: connect[v]) {
			if (dist[e.second] > dist[v] + e.first) {
				dist[e.second] = dist[v] + e.first;
				que.push(PLI(dist[e.second], e.second));
			}
		}
	}

	return dist;
}

int main() {
	int n, m, s, t, u, v, a, b;
	cin >> n >> m >> s >> t;

	vector<vector<PLI>> connect_yen(n + 1), connect_snuke(n + 1);
	for (int i = 0; i < m; i++) {
		cin >> u >> v >> a >> b;
		connect_yen[u].emplace_back(PLI(a, v));
		connect_yen[v].emplace_back(PLI(a, u));

		connect_snuke[u].emplace_back(PLI(b, v));
		connect_snuke[v].emplace_back(PLI(b, u));
	}

	auto cost_yen = dijkstra(n, s, connect_yen);
	auto cost_snuke = dijkstra(n, t, connect_snuke);

	vector<long long> cost(n + 1, 0);
	for (int i = 1; i < cost.size(); i++) {
		cost[i] = cost_yen[i] + cost_snuke[i];
	}

	long long mini = inf;
	vector<long long> ans(n + 1, inf);
	for (int i = n; i >= 1; i--) {
		mini = min(mini, cost[i]);
		ans[i] = mini;
	}

	for (int i = 1; i < ans.size(); i++) {
		cout << initial - ans[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 19780
S = list(input())
L = len(S)
ans = 1

for i in range(L):
    if i % 2 == 0:
        if S[i] == 'R' or S[i] == 'U' or S[i] == 'D':
            continue
        else:
            ans = 0
    else:
        if S[i] == 'L' or S[i] == 'U' or S[i] == 'D':
            continue
        else:
            ans = 0

if ans:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

int readint() {
    return readln.chomp.to!int;
}

int[] readints() {
    return readln.split.map!(to!int).array;
}

void calc(long N) {
    for (int i = 1; i <= 3500; i++) {
        for (int j = i; j <= 3500; j++) {
            long h = i;
            long n = j;

            long nume = N * h * n;
            long deno = 4 * h * n - N * n - N * h;
            if (deno > 0 && nume % deno == 0) {
                long w = nume / deno;
                writefln("%d %d %d\n", h, n, w);
                return;
            }
        }
    }
}

void main() {
    long n = readln.chomp.to!long;
    calc(n);
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(void)
{
	int a,s,d,f[10001],g[10001],h[10001],j,i,k=0,z=0,x,c,v;
	scanf("%d %d %d",&a,&s,&d);
	for(i=0;i<s;i++) scanf("%d",&f[i]);
	for(i=0;i<s;i++){
		if(d<f[i]){
			g[i]=f[i]-d;
			h[i]=d+a-f[i];
		}
		else if(d>f[i]){
			g[i]=(a+f[i])-d;
			h[i]=d-f[i];
		}
		else{
			g[i]=0;
			h[i]=0;
		}
		if(g[i]>k) k=g[i];
		if(h[i]>z) z=h[i];
	}
	if(k<z) z=k;
	for(i=0;i<s;i++){
		for(j=i+1;j<s;j++){
			if(g[i]<g[j]){
				c=g[i]; g[i]=g[j]; g[j]=c;
				c=h[i]; h[i]=h[j]; h[j]=c;
			}
		}
	}
	v=0;
	k=0;
	for(i=0;i<s-1;i++){
		v=h[i]*2+g[i+1];
		k=h[i]+g[i+1]*2;
		if(z>v) z=v;
		if(z>k) z=k;
		v=h[i+1]*2+g[i];
		k=h[i+1]+g[i]*2;
		if(z>v) z=v;
		if(z>k) z=k;
	}
	printf("%d\n",z*100);
	return 0;
}

Measured memory_bytes: 2736
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 100000007
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define FOR(i,k,n) for(int i=k;i<n+k;i++)
#define ALL(x) x.begin(),x.end()
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);
#define deg(x) cout<<"--"<<x<<endl;
int II(){int q;scanf("%d",&q);return q;}
int dx[]={0,-1,0,1};
int dy[]={-1,0,1,0};
int dxx[]={0,-1,-1,-1,0,1,1,1};
int dyy[]={-1,-1,0,1,1,1,0,-1};
#define int ll
void solve(){
	int n;cin>>n;
	int ar[n+10];
	for(int i=1; i<=n; i++){
		int q;cin>>q;
		ar[i]=q-i;
	}
	sort(ar+1,ar+1+n);
	int arr[]={ar[n/2],ar[min((n/2)+1,n)],ar[max((n/2)-1,1LL)]};
	int mi=1e16;
	for(int i=0; i<3; i++){
		int to=0;
		for(int j=1; j<=n; j++){
			to+=abs(ar[j]-arr[i]);
		}
		mi=min(mi,to);
	}
	cout<<mi<<endl;
}
 
main(){
 	
    int tt=1;
    int cas=1;
    while(tt--){
        //printf("Case %d: ",cas++);
        solve();
    }
}

Measured memory_bytes: 1792
N, K = list(map(int, input().split())) 
A = list(map(int, input().split())) 

H0 = 1
H1 = 1

for i in range(N-K):
    # for j in range(K):
    #     H0 = int(H0 * A[j])
    # H1 = int(H0/A[i] * A[K+i])
    H0 = A[i]
    H1 = A[K+i]

    if H1 > H0:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 31540
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;
int main(){
	int n,m;
	cin >> n >> m;
	vector<P> ab(n);
	for(int i = 0;i < n;i++){
		int a,b;
		cin >> a >> b ;
		ab[i] = P(a,b);
	}

	ll ans = 0;
	sort(ab.begin(),ab.end());
	for(int i = 0;i < n;i++){
		ll plus = (ll)min(m,ab[i].second) * ab[i].first;
		m -= min(m,ab[i].second);
		ans += plus;
		if(m == 0)break;
	}

	cout << ans << endl;
}


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

int main() {
    int N;
    cin >>N;
    vector<int>data(N);
    for(int i=0;i<N;i++)cin >>data[i];
    sort(data.begin(),data.end());
    int ans = data[N/2]-data[N/2-1];
    cout <<ans<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

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; }

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//
ll modpow(ll a, ll n, ll mod_) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod_;
        a = a * a % mod_;
        n >>= 1;
    }
    return res;
}

const ll mod = 998244353;
// const ll mod = 1e9 + 7;
const ll MAX_SIZE = 1000005;
array<ll, MAX_SIZE> fac, inv, finv;
ll fac_init() {
    // combination init
    fac[0] = 1;
    for (ll i = 1; i < MAX_SIZE; i++) fac[i] = fac[i - 1] * i % mod;
    finv[0] = modpow(fac[MAX_SIZE - 1], mod - 2, mod);
    repe(i, 1, MAX_SIZE) finv[i] = finv[i - 1] * (MAX_SIZE - i) % mod;
    reverse(all(finv));

    //inv init
    repe(i, 1, MAX_SIZE) inv[i] = modpow(i, mod - 2, mod);
}

ll perm(ll a, ll b) { return fac[a] * finv[a - b] % mod; }

ll comb(ll a, ll b) { return fac[a] * finv[b] % mod * finv[a - b] % mod; }

// ax+by=gcd(a,b)を満たすx,yを求める
ll extgcd(ll a, ll b, ll &x, ll &y){
    ll gc = a;
    if(b!=0){
        gc = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    }else{
        x = 1, y = 0;
    }
    return gc;
}
// 値A, B
// ll x, y;
// extgcd(A, B, x, y); //x,yにAx+By=gcd(a,b)を満たす値を返す

int main() {
    init();
    ll N, A, B, K;
    cin >> N >> A >> B >> K;
    if(N==0){
        cout << 1 << endl;
        return 0;
    }

    fac_init();
    ll ans = 0;
    rep(a,N+1){
        ll dk = K - a * A;
        if (dk < 0) break;
        ll b = dk / B;
        if (dk % B || b > N) continue;

        ans += comb(N, a) * comb(N, b) % mod;
    }
    cout << ans%mod << endl;
}

Measured memory_bytes: 23680
N,Y = map(int,(input().split()))
r = Y - N*1000
if r < 0:
    print(-1,-1,-1)
else:
    for i in range(N+1): #5000
        for j in range(N+1-i): #10000
            if i*4000 + j*9000 == r:
                print(j,i,N-i-j)
                break
        else:
            continue
        break
    else:
        print(-1,-1,-1)

Measured memory_bytes: 40556
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n - 1);
  rep(i, n) {
    cin >> a[i];
    a[i]--;
  }
  rep(i, n) { cin >> b[i]; }
  rep(i, n - 1) { cin >> c[i]; }
  int res = b[a[0]];
  repz(i, 1, n) {
    res += b[a[i]];
    if (a[i] == a[i - 1] + 1) res += c[a[i - 1]];
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if not arr:
        arr.append([n, 1])

    return arr


N = int(input())
MOD = 10 ** 9 + 7
x = dict()
for i in range(N, 1, -1):
    for f in factorization(i):
        if not f[0] in x:
            x[f[0]] = 1
        x[f[0]] += f[1]
ans = 1
for i in x.values():
    ans = (ans * i) % MOD
print(ans)


Measured memory_bytes: 74244
use std::cmp::{max, min};

fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let n: usize = read(&mut stdin_lock, &mut buf, b' ');
    let m: usize = read(&mut stdin_lock, &mut buf, b' ');
    let x: i32 = read(&mut stdin_lock, &mut buf, b' ');
    let y: i32 = read(&mut stdin_lock, &mut buf, b'\n');
    let mut xv = vec![0i32; n];
    for i in 0..(n - 1) {
        xv[i] = read(&mut stdin_lock, &mut buf, b' ');
    }
    xv[n - 1] = read(&mut stdin_lock, &mut buf, b'\n');
    let mut yv = vec![0i32; m];
    for i in 0..(m - 1) {
        yv[i] = read(&mut stdin_lock, &mut buf, b' ');
    }
    yv[m - 1] = read(&mut stdin_lock, &mut buf, b'\n');
    let max_x = *xv.iter().max().unwrap();
    let min_y = *yv.iter().min().unwrap();
    let ans = if max(x, max_x) < min(y, min_y) {
        "No War"
    } else {
        "War"
    };
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
//#include <stdio.h>
//#include <stack>
//#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <fstream>
//#include <list>
//#include <iomanip>
#include <stdlib.h>
#include <cctype>

using namespace std;

#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(),z.end())
#define rsort(z) sort(z.rbegin(),z.rend())
#define eerase(z) z.erase(unique(z.begin(),z.end()),z.end())
#define ccnt(z,w) count(z.begin(),z.end(),w)


void printVec(std::vector<int> & vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec2(std::vector<Int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a / gcd(a, b) *b;
	//a*bは64bit integer overflow
}

bool comp(const string a, const string b) {
	return a.length() < b.length();
}

bool integer(double num) {
	return floor(num) == num;
}

string gen(int num) {
	string str = "";
	for (int i = 0; i < num; i++) str += ".";
	return str;
}
Int fact(int num) {
	if (num == 0) return 1;
	else return num * fact(num - 1);
}


int main() {
	int count = 0;
	string str;
	cin >> str;
	for (char c : str) {
		if (c == '1') count++;
	}
	cout << count;
	


	cout << endl;
	return 0;
}

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

ll p[1000][1000];

ll power(ll x,ll y){
    if(y==0){
        return 1;
    }else if(y==1){
        return x;
    }else if(y==2){
        return x*x;
    }
    if(p[x][y]==0){
        if(y%2==0){
            p[x][y]=power(power(x,y/2),2);
        }
        else{
            p[x][y]=power(power(x,y/2),2)*x;
        }
    }
    return p[x][y]%1000000007;
}

int t[1000000];

int main(){
    int n;
    cin>>n;
    int b[n];
    for(int i=0;i<n;i++){
        cin>>b[i];
        t[b[i]]++;
    }
    for(int i=n-1;i>=0;i--){
        if(t[abs(i-((n-1)-i))]!=2 && (abs(i-((n-1)-i))!=0||n%2==0)){
            return cout<<0,0;
        }
    }
    //cout<<"*";
    for(int i=0;i<n;i++){
        if((n%2==1 && b[i]%2!=0)||(n%2==0 && b[i]%2!=1)){
            return cout<<0,0;
        }
    }
    cout<<power(2,n/2);
}

Measured memory_bytes: 5120
program SumofGCD;
var
    k, mid, fin, h, i, j  : Longint;

function findgcd(x : longint; y : longint):longint;
begin 
    if (y = 0) then findgcd := x
        else findgcd := findgcd(y, x mod y); 
end;

begin
    readln(k);
    fin := 0;
    for h := 1 to k do begin
        for i := 1 to k do begin
            for j := 1 to k do begin
                mid := findgcd(i, j);
                fin += findgcd(h, mid)
            end;
        end;
    end;
    writeln(fin);
end.


Measured memory_bytes: 1376
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int n, b, f, r, v, c;
		int i = 0;
		c = 0;// ?????¶?????????????????????
		n = scan.nextInt();
		StringBuilder sb = new StringBuilder();
		List<Integer> list = new ArrayList<Integer>();
		// ?????????????????????????????±???????????\???????????§????????????
		// ???????????????????????±?????\?????????
		for (; i < 120; i++) {
			list.add(0);
		}

		for (int count = 0; count < n; count++) {// n??????????????????
			b = scan.nextInt();
			f = scan.nextInt();
			r = scan.nextInt();
			v = scan.nextInt();

			// ?£?????????? ???1?£??¢????????????¨???+30 ???1?£?????±0
			if (b == 1) {// 1?£?
				// ????????¢ ???1????????¢?¢????????????¨???+10 ???1????????¢????±0
				if (f == 1) {// ????????¢???
					// ??¨?±?????????????1~10
					c = r - 1;// ??¨?±????????????????????????????????????????
				} else if (f == 2) {// ????????¢2
					c = 10 + r - 1;
				} else if (f == 3) {// ????????¢3
					c = 20 + r - 1;
				}
			} else if (b == 2) {// 2?£? +30??????
				if (f == 1) {// ????????¢???
					// ??¨?±?????????????1~10
					c = 30 + r - 1;// ??¨?±????????????????????????????????????????
				} else if (f == 2) {// ????????¢2
					c = 30 + 10 + r - 1;
				} else if (f == 3) {// ????????¢3
					c = 30 + 20 + r - 1;
				}
			} else if (b == 3) {// 3?£? +60??????
				if (f == 1) {// ????????¢???
					// ??¨?±?????????????1~10
					c = 60 + r - 1;// ??¨?±????????????????????????????????????????
				} else if (f == 2) {// ????????¢2
					c = 60 + 10 + r - 1;
				} else if (f == 3) {// ????????¢3
					c = 60 + 20 + r - 1;
				}
			} else if (b == 4) {// 4?£? +90??????
				if (f == 1) {// ????????¢???
					// ??¨?±?????????????1~10
					c = 90 + r - 1;// ??¨?±????????????????????????????????????????
				} else if (f == 2) {// ????????¢2
					c = 90 + 10 + r - 1;
				} else if (f == 3) {// ????????¢3
					c = 90 + 20 + r - 1;
				}

			}
			if (list.get(c) != 0) {// 0??\??????????????¨?????????????????¨???????????????
				list.set(c, list.get(c) + v);
			} else {
				list.set(c, v);
			}

		}

		// ?????????????????????StringBuilder?????\??????
		i = 0;
		sb.append(" ");
		for (; i < 120; i++) {
			if ((i) % 10 == 0) {// 10???????????????
				if ((i) % 30 == 0) {// 30????????????#?????????????????\
					if (i != 0) {
						sb.append("\n");
						sb.append("####################");
						sb.append("\n");
						sb.append(" ");
					}
				} else {
					sb.append("\n");
					sb.append(" ");
				}
			}
			sb.append(list.get(i));
			if ((i) % 10 == 9) {
			} else {
				sb.append(" ");
			}
		}

		System.out.println(new String(sb));

	}
}

Measured memory_bytes: 29600
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin>>s;
  cout<<s.substr(0,4)<<" "<<s.substr(4)<<endl;
  return 0;
}


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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//==================================

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

    ll N, A, B;
    cin >> N >> A >> B;

    ll num = N / (A + B);

    ll ans = A * num + min(N - num * (A + B), A);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string.h>
#define s(n)                        scanf("%d",&n)
#define sc(n)                       scanf("%c",&n)
#define sl(n)                       scanf("%I64d",&n)
#define sf(n)                       scanf("%lf",&n)
#define ss(n)                       scanf("%s",n)
#define INF                         (int)1e9
#define EPS                         1e-9
#define bitcount                    __builtin_popcount
#define gcd                         __gcd
#define forall(i,a,b)               for(int i=a;i<b;i++)
#define foreach(v, c)               for( typeof( (c).begin()) v = (c).begin();  v != (c).end(); ++v)
#define all(a)                      a.begin(), a.end()
#define in(a,b)                     ( (b).find(a) != (b).end())
#define pb                          push_back
#define fill(a,v)                    memset(a, v, sizeof a)
#define sz(a)                       ((int)(a.size()))
#define mp                          make_pair
#define MOD                         1000000007
typedef long long ll;
/*For you see , each day i love you
 more.Today more than yesterday
  less than tomorrow.*/
using namespace std;
int dp[101][101];

int main()
{
	int h,w;
	cin>>h>>w;
	
	vector<string> vec;
	
	for(int i = 0;i<h;i++)
	{
		string str;
		cin>>str;
		vec.push_back(str);
	}
	
	if(vec[0][0] == '#') dp[0][0] = 1;
	
	for(int i = 0;i<h;i++)
	{
		for(int j = 0;j<w;j++)
		{
			if(i == 0 && j == 0) continue;
			int val = INF;
			if(i-1 >= 0)
			{
				val = dp[i-1][j];
				if(vec[i-1][j] == '.' && vec[i][j] == '#') val += 1;
			}
			
			if(j-1 >=0)
			{
				int temp = dp[i][j-1];
				
				if(vec[i][j-1] == '.' && vec[i][j] == '#') temp+=1;
				
				val = min(val , temp);
			}
			dp[i][j] = val;		}
	}
	
	cout<<dp[h-1][w-1]<<endl;
	
	return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<cstring>
#include<cmath>
#include<map>
#include<stack>
#include<queue>
#include<cstdio>
#include<algorithm>
using namespace std;
#define REP(i,x,y) for(int i=x;i<=y;i++)
#define rep(i,n) REP(i,1,n)
#define rep0(i,n) REP(i,0,n-1)
#define repG(i,x) for(int i=pos[x];~i;i=e[i].next)
const int N=1e3+7;
const int INF=1e9+7;
char f[N];
int k;
int main(){
	scanf("%s",f);
	scanf("%d",&k);
	for(int i=0;i<strlen(f);i+=k)printf("%c",f[i]);
	printf("\n");
	return 0;
}


Measured memory_bytes: 256
Imports System

Public Class Program


    Public Shared Sub Main(args As String())

        Dim input() As ULong = Array.ConvertAll(Of String, ULong)(Console.ReadLine.Split(" "), AddressOf ULong.Parse)

        If input(0) >= input(2) Then
            input(0) -= input(2)
            input(2) = 0
        Else

            input(2) -= input(0)
            input(0) = 0
        End If

        If input(1) >= input(2) Then
            input(1) -= input(2)
            input(2) = 0
        Else

            input(2) -= input(1)
            input(1) = 0
        End If

        Console.WriteLine("{0} {1}", input(0), input(1))

    End Sub



End Class


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

int main() {
  vector<int> A(10,0);  // 答えの数値を各桁毎の整数配列で持つ
  int C=-1;  // 何番目かのカウンタ：最初の０は除外の為
  int K; cin >> K; // 判定対象番目

  int i0,i1,i2,i3,i4,i5,i6,i7,i8,i9,i10;
  for(i0=0; i0<=9; i0++){
    for(i1=0; i1<=9; i1++){
      if ( i0==0  ||  abs(i0-i1)<=1 ) {
      for(i2=0; i2<=9; i2++){
        if ( i0==0 && i1==0  ||  abs(i1-i2)<=1 ) {
        for(i3=0; i3<=9; i3++){
          if ( i0==0 && i1==0 && i2==0   ||  abs(i2-i3)<=1 ) {
          for(i4=0; i4<=9; i4++){
            if ( i0==0 && i1==0 && i2==0 && i3==0   ||  abs(i3-i4)<=1 ) {
            for(i5=0; i5<=9; i5++){
              if ( i0==0 && i1==0 && i2==0 && i3==0 && i4==0  ||  abs(i4-i5)<=1 ) {
              for(i6=0; i6<=9; i6++){
                if ( i0==0 && i1==0 && i2==0 && i3==0 && i4==0 && i5==0  ||  abs(i5-i6)<=1 ) {
                  for(i7=0; i7<=9; i7++){
                    if ( i0==0 && i1==0 && i2==0 && i3==0 && i4==0 && i5==0 && i6==0  ||  abs(i6-i7)<=1 ) {
                      for(i8=0; i8<=9; i8++){
                        if ( i0==0 && i1==0 && i2==0 && i3==0 && i4==0 && i5==0 && i6==0 && i7==0  ||  abs(i7-i8)<=1 ) {
                          for(i9=0; i9<=9; i9++){
                            if ( i0==0 && i1==0 && i2==0 && i3==0 && i4==0 && i5==0 && i6==0 && i7==0 && i8==0  ||  abs(i8-i9)<=1 ) {
//                                cout << "test:" << C << ":" << i0 << i1 << i2 << i3 << i4 << i5 << i6 << i7 << i8 << i9 << endl;
                              if(K==++C){
                                bool neZ = false;
                                if (i0!=0){neZ=true; cout << i0;}
                                if (neZ || i1!=0){neZ=true; cout << i1;}
                                if (neZ || i2!=0){neZ=true; cout << i2;}
                                if (neZ || i3!=0){neZ=true; cout << i3;}
                                if (neZ || i4!=0){neZ=true; cout << i4;}
                                if (neZ || i5!=0){neZ=true; cout << i5;}
                                if (neZ || i6!=0){neZ=true; cout << i6;}
                                if (neZ || i7!=0){neZ=true; cout << i7;}
                                if (neZ || i8!=0){neZ=true; cout << i8;}
                                if (neZ || i9!=0){neZ=true; cout << i9;}
                                cout << endl;
//                                cout << i0 << i1 << i2 << i3 << i4 << i5 << i6 << i7 << i8 << i9 << endl;
                                return 0;
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  }
  }
  }
  }
  }

//   cout << Ans << endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;
namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
    int N=int.Parse(Console.ReadLine());
      string[] str=Console.ReadLine().Split(' ');
      int[] L=str.Select(int.Parse).ToArray();
      Array.Sort(L);
      Array.Reverse(L);
   //   int[] Lsub=new int[N-1];
  //    L.CopyTo(Lsub,1);
      if(L[0]<L.Sum()-L[0]){
        Console.WriteLine("Yes");
      }else{
        
        Console.WriteLine("No");
      }
    }
    
  }

}


Measured memory_bytes: 28152
use std::io::Read;
use std::collections::HashMap;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    
    let mut m: HashMap<char, u32> = HashMap::new();
    for c in buf.trim().chars() {
        let mut count = m.entry(c).or_insert(0);
        *count += 1;
    }
    
    if m.values().all(|c| c % 2 == 0) {
        println!("Yes");
    } else {
        println!("No");
    }
}

Measured memory_bytes: 4352
import scala.io.{StdIn => in}

object Main extends App {
  val n = in.readInt
  val d = in.readLine.split(" ").map(_.toInt).sorted

  val low = d((n-1) / 2)
  val hi  = d(n / 2)

  val ans = hi - low

  println(ans)
}

Measured memory_bytes: 45160
#include <stdio.h>
#include <string.h>

int card[3][10];

void format_card(void);
int check(void);

int main(void) {
	char color[10];
	int value[9];
	int i, j, num, flag = 0;
	scanf("%d", &num);										//データセット数の取得
	getchar();												//改行の読み飛ばし
	if (num < 0) { num = 0; }								//下限値のチェック
	if (num > 50) { num = 50; }								//上限値のチェック
	for (i = 0; i < num; i++) {
		format_card();										//配列の初期化
		scanf("%d%d%d%d%d%d%d%d%d", &value[0], &value[1], &value[2], &value[3], &value[4], &value[5], &value[6], &value[7], &value[8]);
		getchar();
		scanf("%c %c %c %c %c %c %c %c %c", &color[0], &color[1], &color[2], &color[3], &color[4], &color[5], &color[6], &color[7], &color[8]);
		getchar();
		for (j = 0; j < 9; j++) {							//配列へ格納
			switch (color[j]) {
			case 'R':
				card[0][value[j] - 1] ++;
				break;
			case 'G':
				card[1][value[j] - 1] ++;
				break;
			case 'B':
				card[2][value[j] - 1] ++;
				break;
			default:
				break;
			}
		}
		flag = check();
		if (flag == 3) {
			printf("1\n");
		}
		else {
			printf("0\n");
		}
	}
	return 0;
}

int check(void) {
	int i, j, flag = 0;
	for (i = 0; i < 3; i++) {							//オーバーのチェック
		for (j = 0; j < 9; j++) {
			if (card[i][j] > 4) {
				card[i][j] = 4;
				flag++;
			}
		}
	}
	for (i = 0; i < 3; i++) {							//連番のチェック
		j = 0;
		do {
			if (card[i][j] > 0 && card[i][j + 1] > 0 && card[i][j + 2] > 0) {
				card[i][j]--, card[i][j + 1]--, card[i][j + 2]--;
				flag++;
			}
			else {
				j++;									//連番が無い場合は次へ
			}
		} while (j < 9 - 2);
	}
	for (i = 0; i < 3; i++) {							//同数のチェック
		for (j = 0; j < 9; j++) {
			if (card[i][j] > 2) {
				card[i][j] -= 3;
				flag++;
			}
		}
	}
	return flag;
}
void format_card(void) {
	int i, j;
	for (i = 0; i < 3; i++) {
		for (j = 0; j < 9; j++) {
			card[i][j] = 0;
		}
	}
}



Measured memory_bytes: 2040
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  if (a == 1) {
    a = 14;
  }
  if (b == 1) {
    b = 14;
  }
  if (a > b) {
    cout << "Alice" << endl;
  } else if (a < b) {
    cout << "Bob" << endl;
  } else if (a == b) {
    cout << "Draw" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll n,k;
  cin >> n >> k;
  vec a(n);
  for(ll i=0;i<n;i++) cin >> a[i];
  sort(a.begin(),a.end());
  ll ans=0;
  for(ll i=0;i<k;i++) ans+=a[i];
  cout << ans << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pll = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define Rep(i, m, n) for(ll i = m; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x, y, z) max((x), max((y), (z)))
#define tmin(x, y, z) min((x), min((y), (z)))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define ZERO(a) memset(a, 0, sizeof(a))
const ll INF = 1LL << 60;
const ll MM = 1000000000; const ll MOD = MM + 7; const ll MMM=9223372036854775807;//2^63 -1
#define ADD(a,b) a = (a + ll(b)) % MOD
#define MUL(a,b) a = (a * ll(b)) % MOD
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true;} return false;}
template<typename A, size_t N, typename T> void FILL(A (&array)[N], const T &val){ fill( (T*)array, (T*)(array+N), val );}
// struct edge{ ll from, to, cost; };
// struct edge{ ll to, cost; };
// using Graph = vector<vector<ll>>;  // 重み無し
// using Graph = vector<edge>;  // 辺
// using Graph = vector<vector<edge>>;  // 重み付き
ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
ll ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//cout << fixed << setprecision(10);

int main(){
    ll n, ans = 0; cin >> n;
    map<ll, ll> mp;
    rep(i, n){
        ll a; cin >> a;
        mp[a]++;
    }
    for(auto p: mp){
        if(p.second - p.first < 0){
            ans += p.second;
        }
        else{
            ans += p.second - p.first;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 9624
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	int n,x;
	cin>>n;
	vector<pair<int,int>>a(n);
	for(int i=0;i<n;i++){
		cin>>x;
		a[i]=make_pair(x,i+1);
	}
	sort(a.begin(),a.end());
	for(auto i:a){
		cout<<i.second<<' ';
	}
	cout<<'\n';
    return 0;
}

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

// #define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REPS(i, 0, n)
#define REP0(i, n) for (ll i=0; i <= (ll)(n); ++i)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
// clang-format on
/* }}} */

signed main() 
{
  int a,b,c;
  cin>>a>>b>>c;
  if(a+b>=c) cout << "Yes" << endl;
  else cout << "No"  << endl;
  return 0;
}

Measured memory_bytes: 256
H, W = map( int, input().split())
S = [["#"]*(W+2)]+[ "#"+input()+"#" for _ in range(H)]+ [["#"]*(W+2)]
H += 2
W += 2
L = [[0]*(W+2) for _ in range(H+2)]
R = [[0]*(W+2) for _ in range(H+2)]
D = [[0]*(W+2) for _ in range(H+2)]
U = [[0]*(W+2) for _ in range(H+2)]
cnt = 0

for i in range(1,H-1):
    for j in range(W):
        if S[i][j] == "#":
            cnt = 0
        else:
            cnt += 1
            R[i][j] = cnt
            
for i in range(1,H-1):
    for j in range(W-1,-1,-1):
        if S[i][j] == "#":
            cnt = 0
        else:
            cnt += 1
            L[i][j] = cnt

for j in range(1,W-1):
    for i in range(H):
        if S[i][j] == "#":
            cnt = 0
        else:
            cnt += 1
            D[i][j] = cnt

for j in range(1,W-1):
    for i in range(H-1,-1,-1):
        if S[i][j] == "#":
            cnt = 0
        else:
            cnt += 1
            U[i][j] = cnt

ans = 0
for i in range(1,H-1):
    for j in range(1,W-1):
        if ans < L[i][j] + R[i][j] + U[i][j] + D[i][j]:
            ans =  L[i][j] + R[i][j] + U[i][j] + D[i][j]
print(ans-3)


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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int A; cin >> A;
    int n = (A-400)/200;
    cout << 8-n << endl;
    return 0;
}

Measured memory_bytes: 3636
import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}
import scala.collection.mutable.{Map, Stack, Queue, PriorityQueue, Set}
import scala.collection.mutable.TreeSet

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val N = in.next().toInt
  val S = "0" + in.next()
  val Q = in.next().toInt


  //
  val dp = Array.fill[TreeSet[Int]](26)(TreeSet.empty)
  val s = new Array[Int](N+1)
  for (i <- 1 to N) {
    val now = S(i).toInt - 97
    dp(now) += i
    s(i) = now
  }

  for (_ <- 1 to Q) {
    val com = in.next().toInt
    if (com == 1) {
      val i = in.next().toInt
      val c = in.next()(0)

      val del = s(i)
      val now = c.toInt - 97
      s(i) = now

      dp(del) -= i
      dp(now) += i
    }
    else {
      val l, r = in.next().toInt
      var ans = 0
      for (i <- 0 until 26) {
        dp(i).minAfter(l).foreach { k =>
          if (k <= r)
            ans += 1
        }
      }
      pw.println(ans)
    }
  }

  pw.flush()
}

object Sub {
  def print2DimArray[A](mat: Array[Array[A]]): Unit = {
    mat.foreach(lin => println(lin.toList))
  }
}

class InputReader(stream: InputStream) {
  private[this] val reader = new BufferedReader(new InputStreamReader(stream))
  private[this] var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}


Measured memory_bytes: 102656
A,V=map(int, input().split())  
B,W=map(int, input().split())  
T=int(input())

if V<=W:
  print('NO')
else:
  x = abs(A-B)
  y = abs(V-W)
  if y*T<x:
    print('NO')
  else:
    print('YES')

Measured memory_bytes: 9188
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <map>

#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  int N; cin >> N;
  int p[N]; rep(i, N) cin >> p[i];

  sort(p, p+N); p[N-1]/=2;
  int result = 0; rep(i, N) result += p[i];
  cout << result << endl;
  return 0;
}

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


void input(); template<typename First,typename... Rest> void input(First&,Rest&...);
void inputVector(); template<typename First,typename... Rest>  void inputVector(std::vector<First>&,Rest&...);


void calculate(){
    int a,b;
    input(a,b);
    if(a < b) std::swap(a,b);
    for(int i = 0;i < a;++i)
    {
        std::cout << b;
    }
    std::cout << '\n';
}

int main(int,char**){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    calculate();
}



void input(){return;}
template<typename First,typename... Rest>
void input(First &first,Rest&... rest){
    std::cin >> first;
    input(rest...);
}

void inputVector(){return;}
template<typename First,typename... Rest> 
void inputVector(std::vector<First> &first,Rest&... rest){
    int N = first.size();
    for(int i = 0;i < N;i++){
        std::cin >> first[i];
    }
    inputVector(rest...);
}

Measured memory_bytes: 256