akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<(n);i++)
#define all(t) (t).begin(),(t).end()
#define MOD 1000000007
typedef long long ll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}else{return 0;}}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}else{return 0;}}
template <class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <class T> inline T LCM(T a,T b){return a*b/GCD(a,b);}

int main(){
	ll a,b;
	cin >> a >> b;
	ll x=GCD(a,b);
	ll num=x,ans=1;
	for(ll i=2;i*i<=x;i++){
		if(num%i==0)ans++;
		while(num%i==0)num/=i;
	}
	if(num!=1)ans++;
	cout << ans << endl;

}



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


int main(){
    int a1,a2,a3;
    cin >> a1 >> a2 >> a3;
    if(a1+a2+a3>=22){
        cout << "bust" << endl;

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

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

#define sz(x) (int)x.size() 
#define pb push_back 
#define mp make_pair 
#define fi(a, b) for(int i=a; i<=b; i++) 
#define fj(a, b) for(int j=a; j<=b; j++) 
#define fo(a, b) for(int o=a; o<=b; o++) 
#define fdi(a, b) for(int i=a; i>=b; i--) 
#define fdj(a, b) for(int j=a; j>=b; j--) 
#define fdo(a, b) for(int o=a; o>=b; o--) 

#ifdef LOCAL
#define err(...) fprintf(stderr, __VA_ARGS__)
#else
#define err(...) while(false) {}
#endif

typedef long long ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef vector<int> vi; 
typedef vector<ll> vll;
typedef vector<pii> vpii; 
typedef vector<pll> vpll; 
typedef long double ld;
typedef unsigned long long ull;

/////////////////////////////////

int const MAX = 2e5 + 41;

int n;
int a[MAX];
ll pref[MAX];
ll suf[MAX];

ll const INF = 1e18;
ll ans;

int cutpref(int len) {
	ll need = pref[len] / 2;
	auto it = lower_bound(pref + 1, pref + len + 1, need);
	int p = (int) (it - pref);
	if (p == len + 1) {
		p = len - 1;
	}
	return p;
}

int cutsuf(int lp) {
	ll need = suf[lp] / 2;
	auto it = lower_bound(suf + lp, suf + n + 1, need);
	int p = (int) (it - suf);
	if (p == n + 1) {
		p = n - 2;
	}
	return p;
}

ll calc(vi v) {
	v.pb(0);
	v.pb(n);
	sort(v.begin(), v.end());
	ll maxi = -INF;
	ll mini = INF;
	fi(1, sz(v) - 1) {
		maxi = max(maxi, pref[v[i]] - pref[v[i - 1]]);
		mini = min(mini, pref[v[i]] - pref[v[i - 1]]);
	}
	return maxi - mini;
}

bool inside(int x) {
	return (1 <= x && x <= n);
}

void solve() {
	fi(1, n) {
		pref[i] = pref[i - 1] + a[i];
	}
	fdi(n, 1) {
		suf[i] = suf[i + 1] - a[i];
	}

	ans = INF;
	fi(2, n - 2) {
		int p1 = cutpref(i);
		int p2 = cutsuf(i + 1);		
		for (int d1 = -2; d1 <= 2; d1++) {
			for (int d2 = -2; d2 <= 2; d2++) {
				int np1 = p1 + d1;
				int np2 = i;
				int np3 = p2 + d2;
				if (np1 >= np2) continue;
				if (np2 >= np3) continue;
				if (!inside(np1) || !inside(np2) || !inside(np3)) continue;
				/*
				if (i == 4) {				
					err("np1 = %d np2 = %d np3 = %d\n", np1, np2, np3);
				}
				*/
				vi vp;
				vp.pb(np1);
				vp.pb(np2);
				vp.pb(np3);
				ans = min(ans, calc(vp));				                         		
			}
		}
	}

	printf("%lld\n", ans);
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	scanf("%d", &n);
	fi(1, n) {
		scanf("%d", &a[i]);
	}
	solve();		

	
#ifdef LOCAL
	err("ELAPSED TIME: %.3Lf\n", (ld) clock() / CLOCKS_PER_SEC);
#endif	
	
	return 0;
}

Measured memory_bytes: 4224
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <cstring>
using namespace std;

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


int main(){
	int n,k,x,y;
	scanf("%d%d",&n,&k);
	rep(i,k){ // 1base
		scanf("%d%d",&x,&y);
		//printf("minx %d\n",min((n+1)-x,x));
		//printf("miny %d\n",min((n+1)-y,y));
		x = (n+1)/2 - min((n+1)-x,x) + 1;
		y = (n+1)/2 - min((n+1)-y,y) + 1;
		//printf("x,y : %d,%d\n",x,y);
		int m = (n+1)/2 - 1;
		int t = max(x,y)-1;
		//printf("m:%d  , t:%d\n",m,t);
		if( m%3==t%3 ){
			puts("1");
		}else if( m%3==(t+1)%3 ){
			puts("2");
		}else{
			puts("3");
		}
	}
	return 0;
}

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

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


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

int main()
{
    long long t,n;
    cin>>t>>n;
    
    long long a[n];
    
    for(int i=0;i<n;i++)cin>>a[i];
    
    long long s=0;
    
    for(int i=0;i<n;i++)s+=a[i];
    
    
    if(s<=t)
    cout<<t-s;
    else
    cout<<"-1";
    
  
    
    return 0;
}

Measured memory_bytes: 3672
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>
#include <map>
#include <set>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <stack>
#include <queue>
#include <cstring>
#include <iterator>

#define FOR(n) for(int i=0;i<(n);++i)
#define FOR_R(it,cont) for(auto it=rbegin(cont);it!=rend(cont);++it)
#define FOR_F(it,cont) for(auto it=begin(cont);it!=end(cont);++it)
#define ALL(cont) begin(cont), end(cont)
#define LB(b,e,v) lower_bound(b,e,v)
#define UB(b,e,v) upper_bound(b,e,v)
#define AS_MOD(a,b) ((((a) % (b) ) + (b)) % (b))
#define MODDING(a,b) (a) = AS_MOD(a,b)

using namespace std;
typedef pair<long long,int> P;
typedef pair<P, P> PP;
typedef long long ll;
int N,K;
struct FenwickTree {
  static const int MAX_N = 200011;
  ll storage[MAX_N+1];
  int N;
  void init(int n) {
    N=n;
  }
  ll sum(int i) { // 0<i<=N
    if (i==0) return 0;
    int ret = 0;
    while(i>0) {
      ret+=storage[i];
      i -= i&-i;
    }
    return ret;
  }
  void add(int i, ll x) {// 0<=i<N
    ++i;
    while(i<=N) {
      storage[i] += x;
      i += i&-i;
    }
  }
  ll rangeSum(int l, int r) {
    return sum(r)-sum(l);
  }
};
int A[200020];
long long sumA[200021];
P values[200020];
FenwickTree ft;
int main() {
  scanf("%d%d", &N, &K);
  ft.init(N+1);
  FOR(N) {
    int a;
    scanf("%d", &a);
    A[i]=a;
  }
  sumA[0]=0;
  FOR(N) {
    sumA[i+1]=A[i];
    sumA[i+1]+=sumA[i]-K;
  }
  FOR(N+1) {
    values[i]=P(sumA[i],i);
  }
  sort(values, values+N+1);
  FOR(N+1) {
    A[values[i].second]=i;
  }
  long long answer = 0;
  for(int i=0;i<N+1;++i) {
    int v=A[i];
    answer+=1ll*ft.rangeSum(0, v+1);
    ft.add(v,1);
  }
  printf("%lld\n", answer);
  return 0;
}


Measured memory_bytes: 7168
#include<iostream>
using namespace std;
#include<algorithm>
using namespace std;
int main(){
    int n;
    cin>>n;
    int cnt[6]={0};
    for(int i=0;i<n;i++){
        double h;
        cin>>h;
        int a=(int)(h*10);
        if(a<1650)cnt[0]++;
        else if(a<1700)cnt[1]++;
        else if(a<1750)cnt[2]++;
        else if(a<1800)cnt[3]++;
        else if(a<1850)cnt[4]++;
        else cnt[5]++;
    }
    for(int i=0;i<6;i++){
        cout<<i+1<<":";
        for(int j=0;j<cnt[i];j++)cout<<"*";
        cout<<endl;
    }
}

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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

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

  CIN(N);
  if (N % 2 == 0) cout << N << endl;
  else cout <<  2 * N << endl;

  return 0;
}


Measured memory_bytes: 256
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto a = RDR.ARR;
	a.sort();

	writeln(a[$-1] - a[0]);
	stdout.flush();
	debug readln();
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

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

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;

    vector<ll> A(N);

    REP(i, N){
        cin >> A[i];
    }

    vector<ll> B(N);
    vector<ll> C(N);

    REP(i, N){
        if(i == 0){
            B[i] = A[i];
            continue;
        }
        B[i] = B[i-1] + A[i];
    }

    REP(i, N){
        if(i==0){
            C[i] = A[N-1-i];
            continue;
        }
        C[i] = C[i-1] + A[N-1-i];
    }

    ll ans = LINF;

    for(ll i=0; i<=N-2; i++){
        // cout << B[i] << " " << C[i] << endl;
        ans = min(ans, abs(B[i]-C[N-2-i]));
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
	//freopen("in.txt","r",stdin);
	int x,y;
		
	cin>>x>>y;
		for(int i=0;i<=x;i++)
		{
			int forl=x-i;
			if(i*2+4*forl==y)
			{
				cout<<"Yes";
				return 0;
			}
		}
		cout<<"No";
	return 0;
}


Measured memory_bytes: 3564
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;

using ld= long double;

struct aa {
	vector<int>v;
	int cost;
};
class Compare {
public:
	bool operator()(const aa&l, const aa&r) {
		return l.cost>r.cost;
	}
};

int main() {
	string st;cin>>st;
	vector<int>v;
	int n=0;
	while (n != st.size()) {
		if (st.substr(n, 3) == "egg") {
			v.push_back(0);
			n+=3;
		}
		else {
			v.push_back(1);
			n+=7;
		}
	}

	vector<vector<int>>sp_v;
	vector<int>nv;
	int pre=-1;
	for (int i = 0; i < v.size(); ++i) {
		if (pre == v[i]) {
			sp_v.emplace_back(nv);
			nv.clear();
		}
		nv.push_back(v[i]);
		pre=v[i];
	}
	sp_v.push_back(nv);

	stable_sort(sp_v.begin(), sp_v.end(), [](const vector<int>&l, const vector<int>&r) {
		return l.size()>r.size();
	});
	int ans=sp_v[0].back();
	if (ans) {
		cout<<"chicken"<<endl;
	}
	else {
		cout<<"egg"<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 3264
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		int n = sc.nextInt();
		String[] strs = new String[n];
		String[] strss = new String[n];
		for (int i = 0; i < n; i++) {
			strs[i] = sc.next();
			strss[i] = strs[i] + strs[i];
		}
		int r = 0;
		for (int i = 0; i < n; i++)
			if (strss[i].contains(str))
				r++;
		System.out.println(r);
		sc.close();
	}
}

Measured memory_bytes: 17236
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define check system("pause")
#define all(x) (x).begin(),(x).end()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 0x3f3f3f3f
const ll mod = 1e9+7;
const int N = 2e5+20;
#define dep(i,a,b) for(int i=(a);i>=(b);i--)
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define mes(p,b) memset(p,b,sizeof(p))
#define sz(x) int(x.size())
ll b[N],a[N];int n;
int main()
{
  	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	cin>>n;
	rep(i,1,n) cin>>a[i]>>b[i];
	sort(a+1,a+1+n);
	sort(b+1,b+1+n);
	if(n&1){
		cout<<b[n/2+1]-a[n/2+1]+1;
	}
	else{
		cout<<b[n/2+1]+b[n/2]-a[n/2]-a[n/2+1]+1;
	}
  	return 0;
}



Measured memory_bytes: 6724
#[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! {
        n: usize,
        k: usize,
        s: chars,
    }
    let mut s = s;
    s[k - 1] = (s[k - 1] as u8 - 'A' as u8 + 'a' as u8) as char;
    for i in 0..n {
        print!("{}", s[i]);
    }
    println!("");
}


Measured memory_bytes: 4352
#include <iostream>
#include <map>
using namespace std;
typedef long long ll;

map<ll, ll> _f;
ll f(ll x) {
  if (_f.find(x) != _f.end()) return _f[x];
  if (x == 1) return _f[x] = 1;
  return _f[x] = f(x / 2) * 2 + 1;
}


int main() {
  long long int h;
  cin >> h;
  cout << f(h) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int n,h,m,s;
	h < 60;
	m < 60;
	s < 60;
	scanf("%d\n",&n);
	h = n/3600;
	m = n%3600/60;
	s =n%60;
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}



Measured memory_bytes: 2040
use proconio::input;


fn main() {
    input! {
        n: i32,
    };

    let mut ans: i128 = 0;
    for i in 1..n+1 {
        if i % 3 == 0 || i % 5 == 0 {
            continue;
        }
        ans += i as i128;
    }

    print!("{}\n", ans);
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
//#define int long long  
int main(){
    char A[52][52],B[52][52];
    bool c=0;
    int N,M;
    cin >> N >> M;
    REP(i,N){
        REP(j,N){
            cin >> A[i][j];
        }
    }
    REP(i,M){
        REP(j,M){
            cin >> B[i][j];
        }
    }
    REP(k,N-M+1){
        REP(l,N-M+1){
            c=0;
            REP(i,M){
                REP(j,M){
                    if(A[k+i][l+j]!=B[i][j]){
                        c=1;
                    }
                }
            }
            if(c==0){
                cout << "Yes" << endl;
                return 0;
            }
            
        }
    }
    cout << "No" << endl;
    return 0;
}


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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

int gcd(int a, int b) {
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}

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

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    ll ans = 0;
    cin >> n >> m;
    priority_queue<int> pq;
    rep (i, n) {
        int a;
        cin >> a;
        pq.push(a);
    }
    rep (i, m) {
        int x = pq.top();
        pq.pop();
        x /= 2;
        pq.push(x);
    }
    while (!pq.empty()) {
        ans += pq.top();
        pq.pop();
    }
    cout << ans << endl;
    
    return 0;
}



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

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;

const ll MOD = 1000000007;
const long double EPS = 10e-10;

ll gcd(ll a, ll b){
    if(b == 0) return a;
    else return gcd(b, a%b);
}

int main(){
    ll n,m;
    string s,t;
    cin >> n >> m;
    cin >> s;
    cin >> t;

    ll lcm = n * m / gcd(n, m);
    cerr << lcm << endl;
    ll ds = lcm/n, dt = lcm/m;
    ll dlcm = ds * dt / gcd(ds, dt);
    int i = 0, j = 0;
    int exist = 1;
    while(i < n && j < m){
        if(s[i] != t[j]){
            exist = 0;
            break;
        }
        i += int(dlcm/ds);
        j += int(dlcm/dt);
    }

    if(exist){
        cout << lcm << endl;
    }else{
        cout << -1 << endl;
    }

}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vchar = vector<char>;
using vvchar = vector<vchar>;
using vp = vector<P>;
using vpp = vector<pair<P, P>>;
using vvp = vector<vp>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
istream &operator>>(istream &is, P &a)
{
    return is >> a.first >> a.second;
}
ostream &operator<<(ostream &os, const P &a) { return os << "(" << a.first << "," << a.second << ")"; }

template <typename T>

void view(const std::vector<T> &v)
{
#ifndef ONLINE_JUDGE
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
#endif
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

int main()
{
    ll n;
    cin >> n;
    ll ans = 0;
    for (ll i = 1; i < 5000; i++)
        for (ll j = i; j < n / i + 1; j++)
        {
            if (i * j >= n)
                break;

            ans += 2 - (j == i);
        }

    cout << ans << endl;

    return 0;
}

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

//def
#define debug(x) cout << #x << ": " << x << '\n'
#define out(x) cout << x << '\n'
#define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
constexpr int MOD = 1e9 + 7;
constexpr int INF = __INT_MAX__;               // 2^31 - 1
constexpr long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
constexpr int MAX_N = 1e5 + 5;
constexpr double PI = acos(-1);

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

    int n, m;
    cin >> n >> m;
    vi a(m);
    rep(i, m) cin >> a[i];

    rep(i, m) n -= a[i];
    out(max(-1, n));
    return 0;
}


Measured memory_bytes: 3700
import java.util.HashSet;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main{
	static final Scanner s=new Scanner(System.in);
	static IntStream REPS(int v){return IntStream.range(0,v);}
	static IntStream REPS(int l,int r){return IntStream.rangeClosed(l,r);}
	static IntStream INS(int n){return REPS(n).map(i->getInt());}
	static int getInt(){return Integer.parseInt(s.next());}

	public static void main(String[]$){
		int n=getInt(),m=getInt();
		HashSet<Integer> ione=new HashSet<>(),in=new HashSet<>();

		for(int i=0;i<m;++i) {
			int a=getInt(),b=getInt();
			if(a==1)
				ione.add(b);
			if(b==1)
				ione.add(a);
			if(a==n)
				in.add(b);
			if(b==n)
				in.add(a);
		}

		System.out.println(
				ione.stream().anyMatch(in::contains)
				?"POSSIBLE":"IMPOSSIBLE"
				);
	}
}


Measured memory_bytes: 81436
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <time.h>
#define MOD 1000000007LL

using namespace std;
typedef long long int ll;


int main()
{
	int n;
	int c;
	ll a[401], b[401];
	scanf("%d %d", &n, &c);
	for(int i=1; i<=n; i++){
		scanf("%lld", &a[i]);
	}
	for(int i=1; i<=n; i++){
		scanf("%lld", &b[i]);
	}
	ll xp[401][401];
	for(ll x=1; x<=400; x++){
		xp[x][0]=1;
		for(int i=1; i<=c; i++){
			xp[x][i]=xp[x][i-1]*x%MOD;
		}
	}
	ll s[401][401];
	for(int i=0; i<=c; i++){
		s[0][i]=0;
		for(ll x=1; x<=400; x++){
			s[x][i]=(s[x-1][i]+xp[x][i])%MOD;
		}
	}
	ll dp[401][401];
	for(int i=0; i<=c; i++){
		dp[i][1]=(s[b[1]][i]-s[a[1]-1][i]+MOD)%MOD;
	}
	for(int i=2; i<=n; i++){
		for(int t=0; t<=c; t++){
			dp[t][i]=0;
			for(int u=0; u<=t; u++){
				dp[t][i]=(dp[t][i]+dp[t-u][i-1]*(s[b[i]][u]-s[a[i]-1][u]+MOD))%MOD;
			}
		}
	}
	printf("%lld\n", dp[c][n]);
	return 0;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define INF 100000000000000


using namespace std;


int main()
{
   FAST/**/
   
   ll n,k;
   cin>>n>>k;
   
   if(k == n)
   {
       cout<<0;
       return 0;
   }
   
   ll arr[n];
   for(ll i=0;i<n;i++)
        cin>>arr[i];
   
   ll dp[n][k+1];
   for(ll i=0;i<n;i++)
        for(ll j=0;j<k+1;j++)
            dp[i][j] = INF;
   
   dp[0][0] = arr[0];
   
   for(ll i=1;i<n;i++)
   {
       if(i<=k)
            dp[i][i] = arr[i];
       for(ll j=i-1;j>-1;j--)
       {
           ll ct = i-1-j;
           for(ll k1=0;k1<=k;k1++)
           {
               if(k1+ct>k)
                    continue;
               ll temp = dp[j][k1];
               if(arr[i]>arr[j])
                    temp+=arr[i]-arr[j];
               dp[i][k1+ct] = min(dp[i][k1+ct],temp);    
           }
       }
   }
   ll ans = INF;
   for(ll i=0;i<n;i++)
   {
       for(ll j=0;j<=k;j++)
       {
           ll rem = n-1-i;
           if(rem+j<=k)
                ans = min(ans, dp[i][j]);
       }
   }
   cout<<ans;        
   
   
   return 0;
}  
   

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
# define M_PIl          3.141592653589793238462643383279502884L
int main()
{
	ll n;
	cin>>n;
	cout<<fixed<<setprecision(20)<<(2*M_PIl*n)<<endl;
}

Measured memory_bytes: 3776
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Int32;
using static System.Math;

class Program
{

    static void Main(string[] args)
    {
        label:
        ReadLine();
        if (ReadLine().Contains('Y')) WriteLine("Four");
        else WriteLine("Three");
    }
}


Measured memory_bytes: 13268
import sys
from itertools import combinations, permutations

def solve():
    input = sys.stdin.readline
    N = int(input())
    S = input()
    left = [set() for _ in range(N)]
    right = [set() for _ in range(N)]
    for i in range(N - 1):
        left[i+1] |= left[i] | {int(S[i])}
        right[N - i - 2] |= right[N - i - 1] | {int(S[N - i - 1])}
    canuse = set()
    for i in range(1, N - 1):
        for l in left[i]:
            for r in right[i]:
                canuse |= {str(l) + S[i] + str(r)}
    print(len(canuse))

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 48732
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 998244353
mans = 998244353 ;ans = 0 ;count = 0 ;pro = 1
sys.setrecursionlimit(10**6)

n = int(input())
XD = [tuple(map(int,input().split())) for i in range(n)]
XD.append((-10**10,inf))
XD.sort()

now = 0
visited1 = [] 
def dfs(node):
  visited1.append(node)

  global now
  pro = 1
  while now < n :
    if XD[now+1][0] < XD[node][0] + XD[node][1]:
      now += 1
      pro *= dfs(now)
      pro %= mod
    else:break
  return pro + 1
ans = dfs(0)
print((ans-1)%mod)


Measured memory_bytes: 205188
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		int price = 700 + S.replaceAll("x", "").length() * 100;
		System.out.println(price);
		sc.close();
	}
}

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

int main(){

  int N;
  char tmp;
  set<char> st;

  cin >> N;

  for(int i = 0; i < N; i++){
    cin >> tmp;
    st.insert(tmp);
  }

  if(st.size() == 3) cout << "Three" << endl;
  else cout << "Four" << endl;

  return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <iomanip>
#include <iostream>
#include <vector>    
#include <cstdlib>
#include <set>
#include <map>
#include <queue>
#define fast_io()                \
    ios::sync_with_stdio(false); \
    std::cin.tie(0);
#define mod 998244353
typedef long long ll;
typedef long double ld;
using namespace std;

int main()
{
    fast_io();
    ll n;
    string s;
    vector<int> r;
    vector<int> g;
    vector<int> b;
    cin >> n >> s;
    ll num = 0;
    for (ll i = 0; i < n;i++)
    {
        if(s[i]=='R')
            r.push_back(i+1);
        if(s[i]=='G')
            g.push_back(i+1);
        if(s[i]=='B')
            b.push_back(i+1);
    }
    for(auto i:r)
        for(auto j:g)
            for(auto k:b)
            {
                if(2*j==i+k)
                    continue;
                if(2*k==i+j)
                    continue;
                if(2*i==j+k)
                    continue;
                num++;
            }
    cout << num;
    return 0;
}

Measured memory_bytes: 3208
#include<bits/stdc++.h>
using namespace std;
vector<vector<pair<int, int> > > g;
vector<int> color;
bool v[111001];
void col(int N) {
   queue<int> q;
   int c = 0;
   set<int> vertex_colored;
   if(v[N])
      return;
      v[N] = 1;
   for(int i = 0;i<g[N].size();i++) {
      if(color[g[N][i].second]!=-1) {
         vertex_colored.insert(color[g[N][i].second]);
      }
   }
   for(int i = 0;i<g[N].size();i++) {
      if(!v[g[N][i].first]) {
         q.push(g[N][i].first);
      }
      if(color[g[N][i].second]==-1) {
         while(vertex_colored.find(c)!=vertex_colored.end())
            c++;
            color[g[N][i].second] = c;
            vertex_colored.insert(c);
            c++;
      }
   }
   while(!q.empty()) {
      int temp = q.front();
      q.pop();
      col(temp);
   }
   return;
}
int main() {
   int u,w;
   set<int> empty;
   int N; cin >> N;
   g.resize(N); //number of vertices
   color.resize(N-1,-1); //number of edges
   memset(v,0,sizeof(v));
   for(int i = 0;i<N-1;i++) {
      int u, w;
      cin>>u>>w;
      u--; w--;
      g[u].push_back(make_pair(w,i));
      g[w].push_back(make_pair(u,i));
   }
   col(0);
   vector<int> ans;
   int ma = 0;
   for(int i = 0;i<N-1;i++) {
      ma = max(ma, color[i]+1);
      ans.push_back(color[i]+1);
   }
   cout << ma << endl;
   for(int i = 0; i < N - 1;i++) cout << ans[i] << endl;
}

Measured memory_bytes: 58368
import java.util.*;
class Main {
 
	//最大公約数・最小公倍数（セットで使う）
static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
static int lcm (int a, int b) {return a*b/gcd(a,b);}
   //整数かどうかを判定する
 static boolean isInteger(double number){return Math.ceil(number) == Math.floor(number); }

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

		for(int i=0;i<n;i++)a[i] = sc.nextLong();
		
		Long ans = 0l;
		Long max = -1l;

		for(int i=0;i<n;i++){
			if(max < a[i]){
				max = a[i];
			} else {
				ans += max - a[i];
			}
		}

		
		System.out.println(ans);
	}
}

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

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000000
#define MOD 1000000007
#define MAXR 100000
#define _GLIBCXX_DEBUG

void chmaxl(ll &a,ll b){
	if(a<b){
		a=b;
	}
	return;
}

void chminl(ll &a,ll b){
	if(a>b){
		a=b;
	}
	return;
}

void chmaxi(int &a,int b){
	if(a<b){
		a=b;
	}
	return;
}

void chmini(int &a,int b){
	if(a>b){
		a = b;
	}
	return;
}



int main() {
  string S;
  cin >> S;
  string A,B;
  A="ABC";
  B="ARC";
  if(S==A){
    cout << B;
  }
  else{
    cout << A;
  }
}

Measured memory_bytes: 3600
import math
import itertools
#n = int(input())
#n, d = list(input().split())
N, M, X= list(map(int, input().split()))
A = list(map(int, input().split()))

total = 0
for i in range(1,X):
    if i in A:
        total+=1
    
total2 = 0
for i in range(X, N):
    if i in A:
        total2+=1


print(min(total, total2))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
  cin>>s;
  vector<int >pos(26,0);
  for(int i=0;i<s.length();i++){
  	pos[s[i]-'a']++;
  }
  int yes = 1;
  for(int i=0;i<26;i++){
  	if(pos[i]>1){yes=0;break;}
  }
  if(yes==1)cout<<"yes";
  else cout<<"no";
}

Measured memory_bytes: 256
n = int(input())
m = []
apple = []
r = []
cat = []
h = []

for _ in range(n):
    s = str(input())
    if s[0]=="M":
        m.append(s)
    elif s[0]=="A":
        apple.append(s)
    elif s[0]=="R":
        r.append(s)
    elif s[0]=="C":
        cat.append(s)
    elif s[0]=="H":
        h.append(s)
    else:
        pass
a = len(m)
b = len(apple)
c = len(r)
d = len(cat)
e = len(h)
print(a*b*c + a*b*d + a*b*e + b*c*d + b*c*e + c*d*e + a*c*d + a*c*e + a*d*e + b*d*e)

Measured memory_bytes: 16412
#include <iostream> 
#include <vector>
#include <queue>
#include <cmath>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define rep2(i,a,b) for(int i=a;i>=b;i--)
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
#define ll long long
#define pb push_back
int a[3005];
ll dp[3005];
const ll mod=998244353;
ll ad(ll a,ll b)
{
	return ((a%mod)+(b%mod))%mod;
}
ll ap(ll a,ll b)
{
	return ((a%mod)*(b%mod))%mod;
}
int main(int argc, char** argv) {
	int n,s;
	cin>>n>>s;
	rep(i,1,n)
	{
		scanf("%d",&a[i]); 
	}
	ll ans=0;
	rep(i,1,n)
	{
		if(s<a[i])continue;
		if(s==a[i])ans=ad(ans,ap(i,n-i+1));
		if(dp[s-a[i]])
		ans=ad(ans,ap((dp[s-a[i]]),(n-i+1)));
	//	cout<<s-a[i]<<" "<<dp[s-a[i]]<<" "<<i<<endl;
		rep2(j,s,1)
		{
			if(j+a[i]>s)continue;
			dp[j+a[i]]=ad(dp[j+a[i]],dp[j]);
		}
		dp[a[i]]=ad(dp[a[i]],i);
	
		
	}
	cout<<ans;
	
	return 0;
}

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

using namespace std;
int main(){
  int n,m;
  cin >> n >> m;
  vector<vector<long>> AB(n,vector<long>(2));
  for(int i = 0;i < n;i++){
    for(int j = 0;j < 2;j++){
      cin >> AB.at(i).at(j);
    }
  }
  long ans = 0;
  sort(AB.begin(),AB.end());
  for(int i = 0;i < n;i++){
    if(AB.at(i).at(1) <= m){
      ans += AB.at(i).at(0) * AB.at(i).at(1);
      m -= AB.at(i).at(1);
    }else{
      ans += AB.at(i).at(0) * m;
      cout << ans << endl;
      return 0;
    }
  }
  if(m == 0){
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 5760
#include<iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if(n>=400&&n<=599)
        cout<<8<<endl;
    if(n>=600&&n<=799)
        cout<<7<<endl;
    if(n>=800&&n<=999)
        cout<<6<<endl;
    if(n>=1000&&n<=1199)
        cout<<5<<endl;
    if(n>=1200&&n<=1399)
        cout<<4<<endl;
    if(n>=1400&&n<=1599)
        cout<<3<<endl;
    if(n>=1600&&n<=1799)
        cout<<2<<endl;
    if(n>=1800&&n<=1999)
        cout<<1<<endl;
        return 0;

}


Measured memory_bytes: 3628
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();
        int count = 0;
      
        for(int i=0; a * i <= b && i <= c; i++) { 
            count = i;
		}
        System.out.print(count);
	}
}

Measured memory_bytes: 23764
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<map>
#include<vector>
#include<cstring>
using namespace std;
inline int read(){
	int x = 0; char ch = getchar(); bool positive = 1;
	for (; !isdigit(ch); ch = getchar())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = getchar())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(int a){
	if(a>=10)write(a/10);
	putchar('0'+a%10);
}
inline void writeln(int a){
	write(a); puts("");
}
int n,k; 
inline int gcd(int a,int b){
	return b?gcd(b,a%b):a;
}
int main(){
	n=read(); k=read(); int zs=read(); int mmax=zs; 
	for(int i=2;i<=n;i++){
		int s1=read(); zs=gcd(s1,zs); mmax=max(mmax,s1);
	}
	if(mmax<k||(k%zs!=0))puts("IMPOSSIBLE");else puts("POSSIBLE");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if(a+b==15)cout<<"+"<<endl;
    if(a*b==15)cout<<"*"<<endl;
    if(a+b!=15&&a*b!=15) cout<<"x"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cassert>
#include<vector>
#include<fstream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<cmath>
#include<typeinfo>

using namespace std;
#define rep(i,m,n) for(int i=m;i<n;++i)
#define llrep(i,m,n) for(ll i=m;i<n;++i)
#define inf 1000000000
#define llinf 1000000000000000000
#define MOD 1000000007
#define ll long long
#define mp make_pair
#define all(v) v.begin(),v.end()

int dp[50][500][500];

int main() {
	int n, ma, mb;
	cin >> n >> ma >> mb;
	rep(i, 0, 50) {
		rep(j, 0, 500) {
			rep(k, 0, 500) {
				dp[i][j][k] = inf;
			}
		}
	}
	dp[0][0][0] = 0;
	rep(i, 0, n) {
		int a, b, c;
		cin >> a >> b >> c;
		rep(j, 0, n * 10 + 1) {
			rep(k, 0, n * 10 + 1) {
				if (dp[i][j][k] != inf) {
					dp[i + 1][j][k] = min(dp[i][j][k],  dp[i + 1][j][k]);
					dp[i + 1][j + a][k + b] = min(dp[i + 1][j + a][k + b], dp[i][j][k] + c);
				}
			}
		}
	}
	int ans = inf;
	rep(j, 1, n * 10 + 1) {
		rep(k, 1, n * 10 + 1) {
			if (j * mb == k * ma) {
				ans = min(ans, dp[n][j][k]);
			}
		}
	}
	if (ans == inf) {
		ans = -1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 49024
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    map<int, int> v_odd;
    map<int, int> v_even;

    cin >> n;
    for (int i=0; i<(n/2); i++) {
        int v1, v2;
        cin >> v1 >> v2;
        v_even[v1] += 1;
        v_odd[v2] += 1;
    }

    vector<pair<int, int>> v_even_a;
    vector<pair<int, int>> v_odd_a;
    for (auto& e : v_even) {
        v_even_a.push_back(e);
    }
    for (auto& e : v_odd) {
        v_odd_a.push_back(e);
    }

    sort(v_even_a.begin(), v_even_a.end(), [](pair<int, int> a, pair<int, int> b){
            return a.second > b.second;
        });
    sort(v_odd_a.begin(), v_odd_a.end(), [](pair<int, int> a, pair<int, int> b){
            return a.second > b.second;
        });

    if (v_even_a[0].first == v_odd_a[0].first && v_even_a.size() == 1 && v_odd_a.size() == 1) {
        cout << n/2 << endl;
        return 0;
    }

    if (v_even_a[0].first != v_odd_a[0].first) {
        cout << (n - v_even_a[0].second - v_odd_a[0].second) << endl;
        return 0;
    }

    if (v_even_a[0].second > v_odd_a[0].second) {
        cout << (n - v_even_a[0].second - v_odd_a[1].second) << endl;
    } else if (v_even_a[0].second < v_odd_a[0].second) {
        cout << (n - v_odd_a[0].second - v_even_a[1].second) << endl;
    } else {
        int a = (n - v_even_a[0].second - v_odd_a[1].second);
        int b =(n - v_odd_a[0].second - v_even_a[1].second);
        cout << min(a, b) << endl;
    }

    return 0;
}


Measured memory_bytes: 6136
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let n = get!(usize);
    let a = get!([usize]);
    let b = get!([usize]);
    let c = get!([usize]);

    let mut sum = 0usize;
    let mut before = -2;
    for e in a {
        let e = e-1;
        if e == (before+1) as usize {
            sum += c[e-1];
        }
        sum += b[e];
        before = e as isize;
    }
    println!("{}", sum);

}


Measured memory_bytes: 8572
#include<iostream>
#include<cmath>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

    string ans = "No";
    if ((A == B && A != C) || (A == C && A != B) || (B == C && A != B)) {
        ans = "Yes";
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int arr[3];
    int f=0;
    int s=0;
    for(int i=0;i<3;i++)
    {
        cin>>arr[i];
        if(arr[i]==5)
        {
            f++;
        }
        else if(arr[i]==7)
        {
            s++;
        }
    }
    if(f==2 && s==1)
    {
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep1(i,n) for (int i = 1; i <= n; ++i)
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const long long MOD = 1e9+7;
#define precout(val) cout << std::fixed << std::setprecision(20) << val;
const string alphabet = "abcdefghijklmnopqrstuvwxyz";
const int dy[4] = { 0, 1, 0, -1 };
const int dx[4] = { 1, 0, -1, 0 };

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

  long long a,b,n; cin >> a >> b >> n;

  long long x = min(b - 1, n);
  long long ans = ceil(a * x / b);
  cout << ans << endl;
}


Measured memory_bytes: 3652
#include<cstdio>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;

const int MAXN = 100000+9;
int n,C;
struct PAIR{
	int l,r;
	PAIR(int _l=0,int _r=0):l(_l),r(_r){}
};
vector<PAIR> vec[40];
int sum[MAXN<<1];//差分
int tot[MAXN<<1];
int ans;

int main(){
	scanf("%d%d",&n,&C);
	for(int i=1;i<=n;i++){
		int l,r,c;
		scanf("%d%d%d",&l,&r,&c);
		vec[c].push_back(PAIR(l,r));
	}
	for(int i=1;i<=C;i++){
		memset(sum,0,sizeof(sum));
		for(int j=0;j<vec[i].size();j++){
			sum[(vec[i][j].l<<1)-1]++;
			sum[vec[i][j].r<<1]--;
		}
		for(int i=1;i<MAXN<<1;i++)
			sum[i]+=sum[i-1];
		for(int i=0;i<MAXN<<1;i++)
			tot[i]+=sum[i]>0?1:0;
	}
	for(int i=0;i<MAXN<<1;i++)
		ans=max(ans,tot[i]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
 #define ma 999
int main(){
    
    int n; cin>>n;

    for(int i=n; i<=ma; i++){

        if(i % 10 == i / 100 && i % 100 / 10 == i / 100){
             cout<<i<<endl;
             break;
        }
    }

    return 0;

}

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

using namespace std;
const int maxn=100;
int N;
int arr[maxn];
vector<pair<int,int>> out;
#define mp(a,b) make_pair(a,b)
int main(){
  scanf("%d",&N);
  for(int i=1;i<=N;i++){
    scanf("%d",arr+i);
  }
HERE:
  int m=max_element(arr+1,arr+1+N)-arr;
  int n=min_element(arr+1,arr+1+N)-arr;
  if(0){
    puts("0");
    return 0;
  }
  if(arr[m]<=0){
    for(int i=N-1;i>=1;i--){
      if(1){
        arr[i]+=arr[i+1];
        out.push_back(mp(i+1,i));
      }
    }
  }
  else if(arr[n]>=0){
    for(int i=2;i<=N;i++){
      if(1){
        arr[i]+=arr[i-1];
        out.push_back(mp(i-1,i));
      }
    }
  }
  else {
    int f=arr[m]>-arr[n]?m:n;
    for(int i=1;i<=N;i++){
      arr[i]+=arr[f];
      out.push_back(mp(f,i));
    }
    goto HERE;
  }
  printf("%d\n",int(out.size()));
  for(int i=0;i<out.size();i++){
    printf("%d %d\n",out[i].first,out[i].second);
  }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>

using namespace std;
 
int main() {
  string s;
  cin >> s;
  vector<string> dow = { "XXX", "SAT", "FRI", "THU", "WED", "TUE", "MON", "SUN" };
  
  auto it = find(dow.begin(), dow.end(), s);
  int x = it - dow.begin();
  cout << x << endl;
  return 0;
}

Measured memory_bytes: 760
import java.util.Scanner;

class Main {

	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int a;
		int b;
		int c;
		int count=0;
		a = scan.nextInt();
		b = scan.nextInt();
		c = scan.nextInt();
		for (int i = a; i <= b; i++) {
			if(c%i==0) {
				count+=1;
			}
		}

		System.out.println(count);

		scan.close();

	}

}


Measured memory_bytes: 26400
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define vll vector<ll>
#define sz size()
#define pb emplace_back
#define mp make_pair
#define MOD 1000000007
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL))
const int N = 100005;

int main()
{
	ll n;
	cin>>n;
	cout<<n*n;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int res = 0;
  for (int a = 1; a <= n; a++) {
    for (int b = 1; a * b < n; b++) {
      ++res;
    }
  }
  cout << res << '\n';
  return 0;
}

Measured memory_bytes: 3644
num = int(input())
input_data = list(map(int,input().split()))

for i in input_data:
	if i == 0:
		print(0)
		exit()

result = 1
for i in range(num):
	result = result * int(input_data[i])
	if pow(10, 18) < result:
		print(-1)
		exit()

print(result)

Measured memory_bytes: 21656
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>


ll func(ll n, ll k, ll w[], ll P){ // 最大積載量Pを決めた時、積載可能な荷物の量
  ll j = 0;
  for (ll t = 0;t<k;t++){
    ll sekisai = 0;

    while (sekisai+w[j]<=P){
      sekisai += w[j];
      j++;

      if (j==n) return n;
    }
  }
  return j;
}

int main(){
  ll n, k; cin >> n >> k;
  ll w[n];
  rep(i,n) cin >> w[i];

  ll left = 0, right = 1000000000000, mid;
  while (right-left > 1){
    mid = (left+right)/2;
    auto P = func(n,k,w,mid);
    if (P==n) right = mid;
    else left = mid;

    // cout << left << " " << right << endl;
  }

  cout << right << endl;
  // cout << fixed << setprecision(6);
  return 0;
}



Measured memory_bytes: 3876
# B
# 4, 8, 12, 16, 20, 24
# 7, 11, 15, 19, 23
# 14, 18, 22
# 21, 25
N = int(input())
if N in [1, 2, 3, 5, 6, 9, 10, 13, 17]:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
double dp[3001][3001];
double solve(vector<double> &a, int i, int x){
	if(x==0)
		return 1;
	if(i==0)
		return 0;
	if(dp[i][x]>-0.9)
		return dp[i][x];
//	if(i<x)
//		dp[i][x]=0;
	return dp[i][x] = a[i-1]*solve(a,i-1, x-1) + (1-a[i-1])*solve(a,i-1, x);
	
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	memset(dp,-1,sizeof(dp));
	int n;
	cin>>n;
	vector<double> a(n);
	for (int i=0;i<n;i++)cin>>a[i];
	
	printf("%.10f",solve(a, n, (n+1)/2));
	
	return 0;
}

Measured memory_bytes: 74360