akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <queue>
#include <random>
#include <bitset>
#include <time.h>
#include <string>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
#define endl '\n'
#define mp make_pair
#define pbc push_back
#define pob pop_back()
#define empb emplace_back
#define sp system("pause")
#define queuel queue<long long>
#define all(x) (x).begin(),(x).end()
#define matrix vector<vector<ll>>
#define pin(p) cin >> p.first >> p.second;
#define rev(v) reverse(v.begin(),v.end());
#define mx(v) max_element(v.begin(), v.end());
#define mn(v) min_element(v.begin(), v.end());
#define sout(s, c) for(auto i : s) cout << i << c;
#define pout(p) cout << p.first << " " << p.second;
#define er(v, l, r) erase(v.begin() + l, v.begin() + r);
#define vin(v) for(ll i = 0; i < v.size(); ++i) cin >> v[i];
#define vout(v, c) for(int i = 0; i < v.size(); ++i) cout << v[i] << c;
#define pushi(v, a) for(int i = 0; i < a.size(); ++i) v.push_back(a[i]);
#define sin(s, n) for(int i = 0; i < n; ++i){int a; cin >> a; s.insert(a);}
#define fastio() ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
using namespace std;
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
const ll INF = 1000LL * 1000 * 1000 * 1000 * 1000 * 1000;
const int inf = 1000 * 1000 * 1000;
const ld PI = acos(-1.0);
const ll mod1 = inf + 7;
const ll mod2 = inf + 9;
const int MAXN = 1000005;
const ld EPS = 1e-11;
int hp = 179;

signed main()
{
	fastio();
	int a, b, c;
	cin >> a >> b >> c;
	cout << max({ a * 10 + b + c,b * 10 + a + c, c * 10 + a + b });
	sp;
}

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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;

void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main()
{
 
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> c(n), f(n), s(n);
	rep(i,n-1) cin >>c[i] >>f[i] >>s[i];
	
	rep(i, n){
		
		ll ans =0, cr =0;
		//rep(t, 500) if(f[i] + s[i]*t > cr
		rep2(j, i, n-1){
			int p = max<ll>(0LL, (cr - f[j] + s[j] -1)/s[j]);
			cr = f[j] + s[j] * p + c[j];
			//dbg(i,j,p,cr);
		}
		cout << cr << "\n";
	}
	return 0;
}

Measured memory_bytes: 256
#define  REP(i, s, e) for (int i = s; i <= e; i++)
#define DREP(i, s, e) for (int i = s; i >= e; i--)
#define DEBUG fprintf(stderr, "Passing [%s] in Line %d\n", __FUNCTION__, __LINE__)

#include <algorithm>
#include <iostream>
#include <cstdio>
using namespace std;
const int MOD = 1e9 + 7, maxn = 20, maxN = 1 << maxn;
int bin[maxn], fac[maxN], inv[maxN], Inv[maxN];
inline int C(int n, int m) {return n < m ? 0 : 1ll * fac[n] * Inv[m] % MOD * Inv[n-m] % MOD;}

int n, m;
long long ans;
int a[maxn], dp[maxn][maxN], cnt[maxN];

int power_pow(long long base, int b)
{
	long long ans(1);
	while(b)
	{
		if (b & 1) (ans *= base) %= MOD;
		(base *= base) %= MOD;
		b >>= 1;
	}
	return (ans + MOD) % MOD;
}

signed main()
{
#ifdef CraZYali
	freopen("F.in", "r", stdin);
	freopen("F.out", "w", stdout);
#endif
	cin >> n >> m;
	cnt[0] = fac[0] = bin[0] = Inv[0] = inv[0] = inv[1] = 1;
	REP(i, 1, n) bin[i] = bin[i-1]<<1;
	REP(i, 1, bin[n]) fac[i] = 1ll * fac[i-1] * i%MOD;
	Inv[bin[n]] = power_pow(fac[bin[n]], MOD - 2);
	DREP(i, bin[n]-1, 1) Inv[i] = 1ll * Inv[i+1] * (i+1) % MOD;
	REP(i, 1, bin[n]) inv[i] = 1ll * Inv[i] * fac[i-1] % MOD;
	REP(i, 1, bin[n]) cnt[i] = (i&1) ? MOD - cnt[i>>1]:cnt[i>>1];
	REP(i, 1, m) scanf("%d", a + i);
	sort(a + 1, a + 1 + m);
	dp[m+1][0] = 1;
	DREP(i, m, 1)
		REP(S, 0, bin[n]-1)
			if(dp[i+1][S])
			{
				(dp[i][S] += dp[i+1][S]) %= MOD;
				int p = bin[n] - S - 1;
				REP(j, 0, n)
					if(!(S & (1<<j)))
						(dp[i][S | (1<<j)] += 1ll * C(p - a[i] + 1, (1<<j) - 1) * dp[i+1][S] % MOD * fac[1<<j] % MOD) %= MOD;
			}
	REP(i, 0, bin[n]-1)
		(ans += 1ll * dp[1][i] * fac[bin[n]-1-i] % MOD * cnt[i] % MOD) % MOD;
	printf("%lld\n", (1ll * ans * bin[n] % MOD + MOD) % MOD);
	return 0;
}


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

int N, A[100000];

int partition(int x) {
    int i = -1;
    int q = 0;
    for (int j = 0; j < N; j++) {
        if (A[j] == x) {
            q = i + 1;
        }
        if (A[j] <= x) {
            i++;
            int tmp = A[j];
            A[j] = A[i];
            A[i] = tmp;
        }
    }
    
    return q;
}

int main() {
    scanf("%d", &N);
    for (int i = 0; i < N; i++) {
        scanf("%d", &A[i]);
    }
    
    int x = A[N-1];

    int q = partition(x);
    
    for (int i = 0; i < N; i++) {
        if (i != 0) cout << " ";
        if (i != q) {
            cout << A[i];
        } else {
            printf("[%d]", A[i]);
        }
    }
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 3580
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define REP(i, n) FOR((i), 0, (n))

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}



int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    REP(i, n)
        cin >> a[i];

    
    ll ans = 0;
    map<ll, ll> cnt;
    REP(i, n){
        ll target = i - a[i];
        if(cnt.count(target)){
            ans += cnt[target];
        }
        cnt[i + a[i]]++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 16740
#include <iostream>

using namespace std;

const int dai[] = {0, 20, 39, 59, 78, 98, 117, 137, 156, 176, 195};

int spent(int y, int m, int d)
{
    int ret = 0;

    ret += (y - 1) / 3 * 200;
    ret += (y - (y - 1) / 3) * 195;

    if (y % 3 == 0) 
        ret += (m - 1) * 20;
    else 
        ret += dai[m - 1];
    ret += d;

    return ret;
}

int main()
{
    int n, millennium;

    millennium = spent(1000, 1, 1);
    cin >> n;
    while (n--) {
        int y, m, d;

        cin >> y >> m >> d;
        cout << millennium - spent(y, m, d) << endl;;
    }

    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <algorithm>
typedef long long lint;
const int N=2e5+5;
int n,val[N];

namespace utils{
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
	template <class T> inline void apn(T &x,const T y){x=x<y?x:y;}
	template <class T> inline void apx(T &x,const T y){x=x>y?x:y;}
	inline int nxi(){
		int x=0;
		char c;
		while(((c=getchar())>'9'||c<'0')&&c!='-');
		const bool f=(c=='-')&&(c=getchar());
		while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
		return f?-x:x;
	}
}
using namespace utils;

int main(){
	n=nxi();
	for(int i=1; i<=n; ++i){
		val[i]=nxi()+(n-i);
	}
	std::nth_element(val+1,val+((n+1)>>1),val+n+1);
	lint ans=0;
	for(int mid=(n+1)>>1,i=1; i<=n; ++i){
		ans+=i<=mid?val[mid]-val[i]:val[i]-val[mid];
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 4544
#include<bits/stdc++.h>
using namespace std;
int a[1024],flag=1;
int n;
int main()
{
	memset(a,0,sizeof(a));
	int pos=0;
	scanf("%d",&n);
	do
	{
		if(abs(n%2)==1)
		{
			if(flag)
				n--;
			else n++;
			a[pos++]=1;
		}
		else
		{
			a[pos++]=0;
		}
		n/=2;
		flag=!flag;
	}while(n);
	for(int i=pos-1;i>=0;i--)
		printf("%d",a[i]);
	return 0;
}

Measured memory_bytes: 256
x,n = map(int,input().split())
nump = list(map(int,input().split()))
nump.sort()
x_ind = -1
nump_io = [0]*103
for i in range(n):
    nump_io[nump[i]-1] = 1
    if(nump[i]==x):
        x_ind = i
if(x_ind == -1):
    print(x)
else:            
    for i in range(1,51):
        if(nump_io[(x-1)-i] == 0):
            print(x-i)
            break
        if(nump_io[(x-1)+i] == 0):
            print(x+i)
            break
# print(nump_io)



Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
const int mod = 1e9+7;

int main(){
    ll x;
    cin >> x;
    ll now = 100;
    int i = 0;
    while(now < x){
        now += now/100;
        i++;
    }    
    cout <<i << endl;
}

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

int sumDigit(int num) {
    int sum = 0;
    while(num > 0) {
        sum += num % 10;
        num /= 10;
    }
    return sum;
}

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

    int min_ans = 1e9;
    for (int i = 1; i < n; i++) {
        int ans = sumDigit(i) + sumDigit(n - i);
        min_ans = min(min_ans, ans);
    }
    cout << min_ans;
}

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

int main(){
    string s;
    cin >> s;

    vector<char> vec;
    for (int i = 0; i < s.size(); i++){
        vec.push_back(s.at(i));
    }
    sort(vec.begin(),vec.end());

    bool even = false;
    if(vec.size()%2 == 0){
        for(int i = 1; i<vec.size(); i += 2){
            even = true;
            if(vec.at(i) != vec.at(i-1)){
                even = false;
                break;
            }
        }
    }

    if(even){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    
    return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#define LL long long
#define M 2020
using namespace std;
int read(){
	int nm=0,fh=1; char cw=getchar();
	for(;!isdigit(cw);cw=getchar()) if(cw=='-') fh=-fh;
	for(;isdigit(cw);cw=getchar()) nm=nm*10+(cw-'0');
	return nm*fh;
}
int n,m,S[M],ans,now[M],mp[M],last[M];
char ch[M];
void upd(int dtx,int dty){ans=max(ans,dtx*dty);}
int main(){
	n=read(),m=read(),ans=max(n,m);
	for(int i=1;i<=n;i++){
		scanf("%s",ch+1);
		for(int j=1;j<=m;j++) mp[j]=(ch[j]=='#');
		for(int j=1;j<m&&i>1;j++) now[j]=(now[j]+1)*(((last[j]+last[j+1]+mp[j]+mp[j+1])&1)^1);
		for(int j=1;j<=m;j++) last[j]=mp[j];
		if(i==1) continue;
		for(int j=1,top=0;j<=m;S[++top]=j,j++){
			while(top>0&&now[S[top]]>=now[j]) upd(j-S[top-1],now[S[top]]+1),top--;
		}
	}printf("%d\n",ans); return 0;
}

Measured memory_bytes: 256
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll mod=(ll)1e9+7;
//}}}

int main(){
  int P, Q, R;
  cin >> P >> Q >> R;
  int ans = (P + Q + R) - max({P, Q, R});
  cout << ans << endl;
  return 0;
}


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

int main(){
  int n,l;
  cin>>n>>l;
  vector<string>s(n);
  
  FOR(i,n){
    cin>>s[i];
  }
  sort(s.begin(),s.end());
  
  FOR(i,n)
    cout<<s[i];
  return 0;
}

Measured memory_bytes: 256
import math
a,b,C=map(float,input().split())
S=(a*b*math.sin(math.radians(C)))/2
c=a**2+b**2-2*a*b*math.cos(math.radians(C))
L=a+b+c**(1/2)

if C==90:
    h=b
else:
    h=(2*S)/a
    
print(f'{S:10.8f}')
print(f'{L:10.8f}')
print(f'{h:10.8f}')


Measured memory_bytes: 5720
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<string>
#include<algorithm>
#include<iostream>
#include<bitset>
#include<functional>
#include<numeric>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cassert>
#include<cmath>
#include<random>
#include<ctime>
#include<complex>
using namespace std;
typedef long long LL;
mt19937 gene(233);
typedef complex<double> Complex;
#define fi first
#define se second
#define ins insert
#define pb push_back
inline char GET_CHAR(){
	const int maxn = 131072;
	static char buf[maxn],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,maxn,stdin),p1==p2)?EOF:*p1++;
}
inline int getInt() {
	int res(0);
	char c = getchar();
	while(c < '0') c = getchar();
	while(c >= '0') {
		res = res * 10 + (c - '0');
		c = getchar();
	}
	return res;
}

inline LL fastpo(LL x, LL n, LL mod) {
	LL res(1);
	while(n) {
		if(n & 1) {
			res = res * (LL)x % mod;
		}
		x = x * (LL) x % mod;
		n /= 2;
	}
	return res;
}

inline string itoa(int x, int width = 0) {
  string res;
  if(x == 0) res.push_back('0');
  while(x) {
    res.push_back('0' + x % 10);
    x /= 10;
  }
  while((int)res.size() < width) res.push_back('0');
  reverse(res.begin(), res.end());
  return res;
}
template<const LL mod> struct MI{
	LL a;
	MI operator + (const MI & b) {
		MI res{a + b.a};
		if(res.a >= mod) res.a -= mod;
		return res;
	}
	MI operator - (const MI & b) {
		MI res{a - b.a};
		if(res.a <= 0) res.a += mod;
		return res;
	}
	MI operator * (const MI & b) {
		return MI{a * b.a % mod};
	}
	MI operator / (const MI & b) {
		return MI{a * fastpo(b.a, mod - 2, mod) % mod};
	}
};
const int N = 300033;
const int LOG = 20;
const int mod = 1e9 + 7;
const int inf = 1e9 + 7;
int n, m;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main() {
	int a, b, c, d, k;
	cin >> a >> b >> c >> d >> k;
	int x = a * 60 + b;
	int y = c * 60 + d;
	cout << max(0, y - x - k) << endl;
}






Measured memory_bytes: 3604
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

typedef pair<int, int> P;
struct BIT {
  vector<long long> data;
  int n;
  BIT(int n) : n(n) {
    data.resize(n+1);
  }
  long long sum(int i) {
    long long s = 0LL;
    for (int x=i+1; x>0; x-=x&-x) s += data[x];
    return s;
  }
  void add(int i, long long v) {
    for (int x=i+1; x<=n; x+=x&-x) data[x] += v;
  }
};

int N;
P A[300000], B[300000];

int main() {
  cin >> N;
  for (int i=0; i<N; i++) {
    int a, b;
    cin >> a >> b;
    A[i] = P(a, b);
  }
  sort(A, A+N);

  BIT s(N), v(N);
  for (int i=0; i<N; i++) {
    B[i] = P(A[i].second, i);
    s.add(i, A[i].first);
    v.add(i, 1);
  }
  sort(B, B+N);

  int m = 0;
  for (int i=0; i<N; i++) {
    int u = B[i].second;
    long long b = A[u].second;

    int lo = 0, hi = N;
    while (hi - lo > 1) {
      int mid = (lo + hi) / 2;
      if (s.sum(mid) <= b*v.sum(mid))
        lo = mid;
      else
        hi = mid;
    }
    if (s.sum(lo) <= b*v.sum(lo)) {
      m = max(m, (int)v.sum(lo));
    }
    s.add(u, -A[u].first);
    v.add(u, -1);
  }
  cout << m << "\n";
  return 0;
}

Measured memory_bytes: 12336
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,h) for(int i = 0; i < h; ++i)
#define rep1(i,h) for(int i = 0; i <= h; ++i)
#define rep2(i,k,h) for(int i = k; i < h; ++i)
#define rep3(i,k,h) for(int i = k; i <= h; ++i)
#define INF LLong_MAX // long long INF
#define inf INT_MAX // int inf

typedef pair<int,int> int_pair;
typedef pair<string,string> string_pair;



int main() {
    string s,t;
    cin >> s >> t;
    cout << t + s << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

typedef long long ll;
ll MOD = 1000000007;

// a^p
// 2^3 = 2 * 2^2
// 2^2 = 2 * (2^1)
// 2^1 = 2
ll modpow(ll a, ll p, ll mod) {
  if (p == 0) return 1;

  if (p % 2 == 0) {
    ll half = modpow(a, p / 2, mod) % mod;
    return half * half % mod;
  } else {
    return a * modpow(a, p - 1, mod) % mod;
  }
}

// nCa を求める
ll modCombination(ll n, ll a, ll mod) {
  if (n - a < a) {
    return modCombination(n, n - a, mod);
  }

  ll denominator = 1;  // 分母
  ll numerator = 1;    // 分子

  for (ll i = 0; i < a; i++) {
    denominator *= a - i;
    numerator *= n - i;
    denominator %= mod;
    numerator %= mod;
  }

  return numerator * modpow(denominator, mod - 2, mod) % mod;
}

class UnionFind {
 private:
  vector<ll> parents;

 public:
  UnionFind(ll n) : parents(n, -1) {}

  bool issame(ll x, ll y) { return root(x) == root(y); }

  bool merge(ll x, ll y) {
    if (issame(x, y)) return false;

    ll rx = root(x);
    ll ry = root(y);
    if (parents[rx] > parents[ry]) swap(rx, ry);
    // サイズ情報を更新
    parents[rx] += parents[ry];
    // yの親を更新
    parents[ry] = rx;

    return true;
  }

  ll size(ll x) { return -parents[root(x)]; }

 private:
  ll root(ll x) {
    if (parents[x] < 0) return x;
    // 根の親の値に木の(-)サイズの情報を入れる
    return parents[x] = root(parents[x]);
  }
};

int main() {
  cout << fixed << setprecision(15);

  ll A, B, C, X, Y;

  cin >> A >> B >> C >> X >> Y;

  ll maxAB = max(X, Y) * 2;

  ll ans = 1LL << 62;
  for (ll i = 0; i < maxAB + 1; i += 2) {
    ll a = max(0LL, X - i / 2);
    ll b = max(0LL, Y - i / 2);
    // cout << a << " " << b << " " << i << " " << a * A + b * B + i * C <<
    // endl;
    ans = min(a * A + b * B + i * C, ans);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <functional>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
class Edge
{
	public:
	int cost;
	int from;
	int to;

	Edge(int n,int c)
	{
		to=n;
		cost=c;
	}

	Edge(int f,int t,int c)
	{
		from=f;
		to=t;
		cost=c;
	}
};

vector<Edge> g[400];
string s[20];

P bfs(int now,int n)
{
	int d[400];
	fill(d,d+400,1e8-1);
	priority_queue<P,vector<P>,greater<P>> q;
	q.push(P(0,now));
	d[now]=0;
	while(!q.empty())
	{
		P p=q.top();q.pop();
		if(p.first>d[p.second])
			continue;
		for(int i=0;i<g[p.second].size();i++)
		{
			Edge e=g[p.second][i];
			if(d[e.to]>d[p.second]+1)
			{
				d[e.to]=d[p.second]+1;
				q.push(P(d[e.to],e.to));
			}
		}
	}
	P ret=P(-1,-1);
	for(int i=0;i<400;i++)
	{
		if(d[i]!=1e8-1)
		{
			ret=max(ret,P(d[i],i));
			//cerr<<i<<" "<<d[i]<<endl;
		}
	}
	return ret;
}
int main()
{
	int h,w;
	int dx[4]={0,1,0,-1};
	int dy[4]={1,0,-1,0};
	cin>>h>>w;
	for(int i=0;i<h;i++)
		cin>>s[i];
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			for(int k=0;k<4;k++)
			{
				int nx=i+dx[k];int ny=j+dy[k];
				if(nx>=0 && nx<h && ny>=0 && ny<w)
				{
					if(s[i][j]=='.' && s[nx][ny]=='.')
						g[i*20+j].push_back(Edge(nx*20+ny,1));
				}
			}
		}
	}
	//cerr<<"doe"<<endl;
	P ans=P(-1,-1);
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			if(s[i][j]=='.')
				ans=max(ans,bfs(i*20+j,h*w));
		}
	}
	cout<<ans.first<<endl;
	return 0;
}

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

using ll = long long;

vector<ll> si( string s ){
    vector<char> A(s.size()) ;
    
    for( int i=0 ; i<s.size() ; i++ ){
        A.at(i) = s.at(i) ;
    }
    
    vector<ll> a(s.size()) ;
    for( int i=0 ; i<s.size() ; i++ ){
        a.at(i) = A.at(i) - '0' ;
    }
    
    return a ;
}

int main() {
    string S ;
    cin >> S ;
    
    for( int tmp=0 ; tmp< ( 1 << 4 ) ; tmp++ ){
        bitset<4> p(tmp) ;
        
        string K = S ;
        vector<ll> A = si(S) ;
        ll ans = 0 ;
        
        for( int i=0 ; i<4 ; i++ ){
            if( p.test(i) ){
                A.at(3-i) *= -1 ;
                K.insert( (3-i) , "-" ) ;
            }
            else{
                if( i != 3 ){
                    K.insert( (3-i) , "+" ) ;
                }
            }
            ans += A.at(3-i) ;
            
        }
        
        if( ans == 7 ){
            cout << K << "=7" << endl;
            break;
        }
        
    }
}


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

int main(){
  int N,M;
  bool f=false;
  cin>>N>>M;
  char A[N][N],B[M][M];
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++) cin>>A[i][j];
  }
  for(int i=0;i<M;i++){
    for(int j=0;j<M;j++) cin>>B[i][j];
  }
  for(int a=0;a<N;a++){
    for(int b=0;b<N;b++){
      int cnt=0;
      for(int i=0;i<M&&i+a<N;i++){
        for(int j=0;j<M&&j+b<N;j++){
          if(A[i+a][j+b]==B[i][j]) cnt++;
        }
      }
      if(cnt==M*M) f=true;
    }
  }
  if(f) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin>>n;
  vector<tuple<ll,ll>> vp;
  ll mxmn = 0;
  ll mnmx = 1e9+1;
  ll mn = 1e9+1;
  ll mx = 0;
  REP(i,n) {
    ll x,y;
    cin>>x>>y;
    if (x > y) swap(x, y);
    mxmn = max(mxmn, x);
    mnmx = min(mnmx, y);
    mn = min(mn, x);
    mx = max(mx, y);
    vp.emplace_back(x, y);
  }
  ll ans = (mx - mnmx) * (mxmn - mn);
  sort(ALL(vp));
  REP(i,n) {
    ll x,y;
    tie(x,y) = vp[i];
    ans = min(ans, (mx - mn) * (mxmn - min(mnmx, x)));
    mxmn = max(mxmn, y);
    if (x > mnmx) break;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6512
def main():
    N, K = (int(i) for i in input().split())
    P = [int(i) for i in input().split()]
    B = [(p+1)/2 for p in P]
    from itertools import accumulate
    S = list(accumulate([0] + B))
    # print(B, S)
    ans = 0
    for i in range(N-K+1):
        cur = S[i+K] - S[i]
        ans = max(ans, cur)
    print(ans)


if __name__ == '__main__':
    main()


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

//--------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

//--------------------------------------------
const double EPS = 1e-14;
const double PI  = acos(-1.0);

//--------------------------------------------

int main(){
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  if ((a <= c) && (c <= b)) printf("Yes\n");
  else printf("No\n");
}


Measured memory_bytes: 256
//list index out of rangeエラー表示用
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep1(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)


int main(){
  int n,m;
  cin >> n >> m;
  cout << n*(n-1)/2 + m*(m-1)/2;
}



Measured memory_bytes: 3624
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < ll , ll >
#define F first
#define S second
#define endl '\n'
#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#define kill(x) return cout<<x<<'\n', 0;
using namespace std;
const int N=2000;
ll vis[N][N];
struct CHT
{
    typedef pair < ll , ll > Line;
    vector < pair < ll , Line > > A;
    ll INF = 4e18;
    inline void Add(Line X)
    {
        while ((int)A.size() && Intersection(A.back().second, X) <= A.back().first)
            A.pop_back();
        if (A.size())
            A.push_back({Intersection(A.back().second, X), X});
        else
            A.push_back({-INF, X});
    }
    inline ll GetMax(ll X)
    {
        int lb = upper_bound(A.begin(), A.end(), pair < ll , Line > {X, {INF, INF}}) - A.begin() - 1;
        return (X * A[lb].second.first + A[lb].second.second);
    }
    inline ll Intersection(Line X, Line Y)
    {
        if (X.first == Y.first && X.second <= Y.second)
            return (-INF);
        if (X.first == Y.first)
            return (INF);
        return ((X.second - Y.second) / (Y.first - X.first)) + ((X.second - Y.second) % (Y.first - X.first) > 0);
    }
};
vector <vector <int> > f(ll x,ll y){
    memset(vis,0,sizeof vis);
    if (x==0){
       // cout << y << endl;
        vector <int> a;
        for (int i=0;i<=y;i++){
            a.pb((i+1)%2);
        }
        vector <vector <int> > z;
        z.pb(a);
        return z;
    }
    if (y==0){
        vector <vector <int> > y;
            vector <int> z;
            z.pb(1);
        for (int i=0;i<=x;i++){
            y.pb(z);
            z.clear();
            z.pb(i%2);
        }
        return y;
    }
    vector <vector <int> > z=f(x/2-1,y/2-1);
  //  cout << x/2 << " " << y/2 << " " << z.size() << " " << z[0][0] << endl;
    for (int i=0;i<=x;i++){
        for (int j=0;j<=y;j++){
            if (i==x/2 || j==y/2){
                vis[i][j]=1;
                if (i==x/2 && j==y/2) vis[i][j]=0;
                continue;
            }
            ll s=i,d=j;
            if (i>x/2) s-=(x+2)/2;
            if (j>y/2) d-=(y+2)/2;
            vis[i][j]=z[s][d];
        }
    }
    vector <vector <int> > ans;
    for (int i=0;i<=x;i++){
        vector <int> z;
        for (int j=0;j<=y;j++){
            z.pb(vis[i][j]);
        }
        ans.pb(z);
    }
    return ans;
}
int32_t main(){
    sync;
    ll n,m;
    cin >> n >> m;
    ll u=(1<<n)-1;
    ll o=(1<<m)-1;
    u--,o--;
    vector <vector <int> > w;
    w=f(u,o);
    for (int i=0;i<=u;i++){
        for (int j=0;j<=o;j++){
            cout << w[i][j] ;
        }
        cout << endl;
    }

}


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

int main() {
  int A,B,C,D;
  cin >> A>>B>>C>>D;
  if(A+B>C+D){
    cout<<"Left"<<endl;
  }

  if(A+B==C+D)
    cout << "Balanced" << endl;
  if(A+B<C+D)
    cout<<"Right"<<endl;

}

Measured memory_bytes: 256
def main():
    N, M = map(int, input().split())
    ans = [False for _ in range(N)]
    wa_list = [0 for _ in range(N)]

    ac = 0
    wa = 0

    for _ in range(M):
        i, result = input().split()
        i = int(i)
        if result == "AC":
            if ans[i-1] == False:
                ac += 1
                ans[i - 1] = True
                wa += wa_list[i-1]
        else:
            if ans[i - 1] == False:
                wa_list[i - 1] += 1
    if sum(ans) == 0:
        wa = 0

    print(ac, wa)
    return 0
if __name__ == '__main__':
    main()

Measured memory_bytes: 4760
#include <iostream>

using std::max;
using std::min;

int main()
{
  int a, b, c, d, e, k;
  std::cin >> a >> b >> c >> d >> e >> k;
  if (max(a, max(b, max(c, max(d, e)))) - min(a, min(b, min(c, min(d, e)))) > k) {
    std::cout << ":(\n";
  } else {
    std::cout << "Yay!\n";
  }
  return 0;
}


Measured memory_bytes: 256
// Copyright 2017 wu_qing
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
const int M = 1e8 + 10;
int n, r, c, tx1, ty1, tx2, ty2;
bool f1 = true, f2 = true;
struct point {
    int p, n;
    explicit point(int p = 0, int n = 0) : p(p), n(n) {
    }
};
bool cmp(point a, point b) {
    return a.p < b.p;
}
inline bool on(int x, int y) {
    return x == 0 || x == r || y == 0 || y == c;
}
inline int h(int x, int y) {
    if (x == 0)
        return y;
    if (y == c)
        return x + M;
    if (x == r)
        return c - y + M * 2;
    return r - x + M * 3;
}
std::vector<point> p;
std::stack<int> s;
int main() {
    scanf("%d%d%d", &r, &c, &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d%d%d%d", &tx1, &ty1, &tx2, &ty2);
        if (on(tx1, ty1) && on(tx2, ty2)) {
            p.push_back(point(h(tx1, ty1), i));
            p.push_back(point(h(tx2, ty2), i));
        }
    }
    std::sort(p.begin(), p.end(), cmp);
    for (point i : p) {
        if (!s.empty() && s.top() == i.n)
            s.pop();
        else
            s.push(i.n);
    }
    if (s.empty())
        printf("YES\n");
    else
        printf("NO\n");
    return 0;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define ll long long
#define br cout << "\n" ;
#define all(x) (x).begin() ,(x).end()
#define rall(x) (x).rbegin() ,(x).rend()
#define pb push_back
#define ff first
#define ss second 
const int MOD = 1000* 1000 * 1000 + 7;
const int MAXN = 1000*1000 + 10 ; 
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
 int n ;
cin >> n ;
ll sum = 0 ;
int l = min (n , 200 ) ;  
for( int i = 1 ; i <= l ; i++ ){
	for(int j = 1 ; j<= l  ; ++j )
{		for(int k = 1 ; k<= l  ; ++k )
			{int g = __gcd(i , j);
			sum+= __gcd(g,k); }
}
}	


cout << sum ; 
return 0 ; 
}	


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define P 3.14159265
using namespace std;
int main(){
  int a,b;
  double x=0,y=0,s=90;
  while(scanf("%d,%d",&a,&b),a){
    x+=a*cos(s*M_PI/180);
    y+=a*sin(s*M_PI/180);
    s-=b;
  }cout<<(int)x<<endl<<(int)y<<endl;
}

Measured memory_bytes: 3392
#include <bits/stdc++.h>
using namespace std;
/*---define tricks---*/
#define ALL(v) v.begin(),v.end()
#define UN(v) sort(ALL(v)),v.erase(unique(ALL(v)),v.end())
#define FILL(x,y) memset(x,y,sizeof(x))
#define EACH(v,it) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define FIO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define revsort(b,e) sort(b,e),reverse(b,e)
/*---define types---*/
typedef long long ll;
typedef unsigned int uint;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<pii> vii;
/*---define variables---*/
int a,p;
/*---define function---*/

/*---main code---*/
int main()
{
	FIO;
	cin>>a>>p;
	int s=a*3+p;
	cout<<s/2<<'\n';
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;
//using static System.Math;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";
    readonly string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    int N, A, B;
    void solve()
    {
        N = cin.nextint;
        A = cin.nextint;
        B = cin.nextint;
        var X = cin.scanint;
        long ans = 0;
        for (int i = 0; i < N - 1; i++)
        {
            ans += Math.Min((long)(X[i + 1] - X[i]) * A, B);
        }
        WriteLine(ans);
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 20576
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans,a[ohara],b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
ll dp[205][100010];

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n>>x;
    rep(i,n)cin>>a[i];
    sort(a,a+n);
    reverse(a,a+n);
    dp[0][x]=1;

    rrep(i,1,n+1){
        rep(j,x+1){
            (dp[i][j%a[i-1]]+=dp[i-1][j])%=MOD;
            (dp[i][j]+=dp[i-1][j]*(n-i))%=MOD;
        }
    }

    rep(i,x+1){
        (ans+=dp[n][i]*i)%=MOD;
    }
    Cout(ans);
    return 0;
}


Measured memory_bytes: 159232
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>

using namespace std;


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

	int a, p;
	cin >> a >> p;

	p += a * 3;


	cout << p / 2 << '\n';
	return 0;
}


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

typedef long long ll;

#define for(i, a, b) for(ll (i)=a;(i)<(b);++(i))
#define rep(i, n)    for(i, 0, n)
#define sz(x)        ((ll)(x).size())
#define inf          1<<25

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

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

int main() {
    int N;
    cin >> N;
    
    int sum = 0;
    int l, r;
    rep(i, N) {
        cin >> l >> r;
        sum += r - l + 1;
    }
    cout << sum << endl;
    
    return 0;
}

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

const int D = 60;
const int MAX_N = 200005;
int to[D][MAX_N];

int main(){
	ll N,K;
	cin >> N >> K;
	for(int i=0; i<N; i++){
		cin >> to[0][i]; to[0][i]--; 
	}
	for(int i=0; i<D-1; i++){
		for(int j=0; j<N; j++){
			to[i+1][j] = to[i][to[i][j]];
		}
	}

	int v = 0;
	for(int i=D-1; i>=0; i--){
		ll l = 1LL << i;
		if(l <= K){
			v = to[i][v];
			K -= l;
		}
	}
	cout << v+1 << endl;	

	return 0;
}



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

using namespace std;

int main() {
	int k, a, b;
	cin >> k >> a >> b;
	int q = a / k, w = b / k;
	if (a % k)
		++q;
	if (w - q >= 0)
		cout << "OK\n";
	else
		cout << "NG\n";
}


Measured memory_bytes: 3624
import sys
input = sys.stdin.readline

N, W = [int(x)for x in input().split()]
items = []
sum_value = 0
for i in range(N):
    v, w = map(int, input().split())
    items += [(v,w)]
    sum_value += v
dp = [0]+[float('inf')]*(sum_value)

for i in range(N):
    v, w = items[i]
    for j in reversed(range(v,sum_value+1)):
        dp[j] = min(dp[j],dp[j-v]+w)

for j in reversed(range(sum_value+1)):
    if dp[j] <= W:
        print(j)
        break
    


Measured memory_bytes: 5728
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;

int main(){

  int n;
  int x[100];
  int y;

  double sum1=0,sum2=0,sum3=0,sumi=0;

  cin >> n;

  for(int i=0; i<n; i++)
    cin >> x[i];

  for(int i=0; i<n; i++){
    cin >> y;
    sum1 += abs(x[i]-y);
    sum2 += (x[i]-y)*(x[i]-y);
    sum3 += abs( (x[i]-y)*(x[i]-y)*(x[i]-y) );

    if(sumi < abs(x[i]-y))
      sumi = abs(x[i]-y);

  }

  printf("%.8lf\n%.8lf\n",sum1, sqrt(sum2) );
  printf("%.8lf\n%.8lf\n", pow(sum3,1.0/3.0), sumi);

  return 0;

}



Measured memory_bytes: 3352
#include <stdio.h>
#include <math.h>

int main(void)
{
  long int N;
  int divider = 1;
  scanf("%ld", &N);
  
  for(int i=1; i<=sqrt((double)N); i++){
    if(N%i == 0){
      divider = i;
    }
  }
  
  printf("%ld", divider + N/divider -2);
  
  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 repp(i, n) for(int i = 1; i <= (int)(n); i++)
#define co(x) cout<<x<<endl
typedef long long int lint;
 
int main() {
  string S;
  cin >> S;
  if(S.at(2) == S.at(3) && S.at(4) == S.at(5)){co("Yes");}
  else{co("No");}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>
#define ll long long
using namespace std;
int main()
{
  ios_base::sync_with_stdio(0);
  int n,temp;
  cin >> n;
  int ans=0;
  int arr[8];
  for(int i=0;i<8;i++)
    arr[i]=0;
  while(n--){
    cin >> temp;
    if(temp>=1 && temp<=399){
      if(arr[0]==0)
        arr[0]=1;
    }
    else if(temp>=400 && temp<=799){
      if(arr[1]==0)
        arr[1]=1;
    }
    else if(temp>=800 && temp<=1199){
      if(arr[2]==0)
        arr[2]=1;
    }
    else if(temp>=1200 && temp<=1599){
      if(arr[3]==0)
        arr[3]=1;
    }
    else if(temp>=1600 && temp<=1999){
      if(arr[4]==0)
        arr[4]=1;
    }
    else if(temp>=2000 && temp<=2399){
      if(arr[5]==0)
        arr[5]=1;
    }
    else if(temp>=2400 && temp<=2799){
      if(arr[6]==0)
        arr[6]=1;
    }
    else if(temp>=2800 && temp<=3199){
      if(arr[7]==0)
        arr[7]=1;
    }
    else if(temp>=3200)
      ans++;
  }
  int val=0;
  for(int i=0;i<8;i++)
    val+=arr[i];
  if(val==0){
    int min = 1;
    int max = ans;
    cout << min << ' ' << max << endl;
  }
  else{
    int min = val;
    int max = val+ans;
    cout << min << ' ' << max << endl;
  }
  return 0;
}


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

int main() {
	int n;
	cin >> n;
	int c = 4;
	int d = 7;
	int max_d = n / d;
	for (int i =0; i < max_d + 1; ++i) {
		int remainder = n - d * i;
		if (remainder % c == 0) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll uint64_t
#define vi vector <int>
#define vl vector <ll>
#define dl pair <ll, ll>
#define ii pair <ll, ll>
#define vii vector <ii>
#define graph vector <vector <int> >
#define inf 1000000000

using namespace std;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

	int a, b, c;
	cin >> a >> b >> c;
	int x, y, z;
	x = min(a, min(b, c));
	z = max(a, max(b, c));
	y = a + b + c - x - z;
	if (x == 5 && y == 5 && z == 7) cout << "YES\n";
	else cout << "NO\n";
	return 0;
}

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

ll Fac(ll N);
ll Exp(ll N, ll x);
ll comb(ll n, ll r);
const int MOD = 1000000007;

int main()
{
    ll n, a, b, ans;
    cin >> n >> a >> b;
    ans = (Exp(n, 2) - comb(n, a) - comb(n, b) - 1) % MOD;
    if (ans < 0)
        ans += MOD;
    cout << ans << endl;
}

ll Fac(ll N)
{
    if (N == 0)
    {
        return 1;
    }
    else
    {
        ll M = (N * Fac(N - 1)) % MOD;
        return M;
    }
}

ll Exp(ll N, ll x)
{
    if (N == 0)
    {
        return 1;
    }
    else if (N % 2 == 0)
    {
        ll A = (Exp(N / 2, x) * Exp(N / 2, x)) % MOD;
        return A;
    }
    else
    {
        ll B = (x * Exp(N - 1, x)) % MOD;
        return B;
    }
}

ll comb(ll n, ll r)
{
    ll A = Fac(r);
    ll B = 1;
    for (int i = 1; i <= r; i++)
    {
        B = (B * (n - i + 1)) % MOD;
    }
    return (B * Exp(MOD - 2, A)) % MOD;
}


Measured memory_bytes: 3328
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>
#include<functional>
#include<numeric>
#include <tuple>

using namespace std;
using ll = long long;
using ld = long double;
#define int long long
#define all(a) (a).begin(),(a).end()
#define EPS (1e-13)
#define fs first
#define sc second
#define xx first
#define yy second.first
#define zz second.second
#define H pair<int, int>
#define P pair<int, pair<int, int>>
#define Q(i,j,k) mkp(i,mkp(j,k))
#define rep(i,n) for(int (i) = 0 ; (i) < (n) ; (i)++)
#define rng(i,s,n) for(int (i) = (s) ; (i) < (n) ; (i)++)
#define req(i,n) for(int (i) = (n) - 1 ; (i) >= 0 ; (i)--)
#define mkp make_pair
#define mem0(x) memset(x,0,sizeof(x))
#define vec vector
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define crdcomp(b) sort(all((b)));(b).erase(unique(all((b))),(b).end())
#define ssp(i,n) (i==n-1?"\n":" ")
#define ctoi(c) (int)(c-'A')
#define itoc(c) (char)(c+'A')
#define pb push_back
#define cauto const auto&
#define itn int
#define pri_que priority_queue
#define pp(x,y) pb(H{x,y})
#define ppp(x,y,z) pb(Q(x,y,z))
const int mod = 1e9 + 7;
const int Mod = 998244353;
const ll inf = 3 * 1e18;
const int Inf = 15 * 1e8;
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; }
ll read() { ll u, k = scanf(" %lld", &u); return u; }
string reads() { string s; cin >> s; return s; }
ll gcd(ll i, ll j) { return j ? gcd(j, i % j) : i; }
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
ll bitcount(ll x) {
	int sum = 0; for (int i = 0; i < 60; i++)if ((1ll << i) & x) sum++;
	return sum;}
const int fn_ = 600000;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll Mod = mod) {
	if (!fact_[0]) {
		fact_[0] = 1; comp_[0] = 1;
		for (int i = 1; i < fn_; i++) {
			fact_[i] = fact_[i - 1] * i % Mod;
			comp_[i] = mod_pow(fact_[i], Mod - 2, Mod);
		}
	}
	if (x < y) return 0;
	return fact_[x] * comp_[x - y] % Mod * comp_[y] % Mod;
}
//---------------------------------------------------------------
int n, m;
signed main() {
	cin >> n >> m;
	vec<int>b(n + 1, 0);
	int a = 0, c = 0;
	rep(i, m) {
		int k;
		string s;
		cin >> k >> s;
		if (s == "AC" && b[k] >= 0) {
			a++;
			c += b[k];
			b[k] = -1;
		}
		else if (b[k] >= 0) {
			b[k]++;
		}
	}
	cout << a << " " << c << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <iomanip>
#include <functional>
#include <cassert>

using namespace std;

typedef long long ll;

const int md = 1e9 + 7;

int mul(int a, int b) {
  return ((ll)a * b) % md;
}

int power(int a, ll b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) res = mul(res, a);
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}

int inv(int a) {
  return power(a, md - 2);
}

const int N = 2e5 + 7;
int f[N];
int rf[N];

int p[N];

int get(int a) {
  return (a == p[a] ? a : p[a] = get(p[a]));
}

void join(int a, int b) {
  a = get(a);
  b = get(b);
  p[a] = b;
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
#endif
  f[0] = 1;
  for (int i = 1; i < N; ++i) f[i] = mul(f[i - 1], i);
  rf[N - 1] = inv(f[N - 1]);
  for (int i = N - 2; i >= 0; --i) rf[i] = mul(rf[i + 1], i + 1);
  int n, x, y;
  cin >> n >> x >> y;
  vector <int> c(n), w(n);
  vector <vector <int>> who(n);
  for (int i = 0; i < n; ++i) {
    cin >> c[i] >> w[i];
    --c[i];
    who[c[i]].push_back(i);
  }
  for (int i = 0; i < n; ++i) {
    p[i] = i;
  }

  for (int i = 0; i < n; ++i) {
    sort(who[i].begin(), who[i].end(), [&] (int f, int s) {
      return w[f] < w[s];
    });
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 1; j < (int)who[i].size(); ++j) {
      if (w[who[i][0]] + w[who[i][j]] <= x) {
        join(who[i][0], who[i][j]);
      }
    }   
  }
  vector <int> best;
  for (int i = 0; i < n; ++i) {
    if (!who[i].empty()) {
      best.push_back(who[i][0]);
    }
  }
  sort(best.begin(), best.end(), [&] (int f, int s) {
    return w[f] < w[s];
  });
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < min(2, (int)best.size()); ++j) {
      if (c[i] != c[best[j]] && w[i] + w[best[j]] <= y) {
        join(i, best[j]);
      }
    }
  }
  map <int, int> cnt;
  map <pair <int, int>, int> cntc;
  for (int i = 0; i < n; ++i) {
    ++cnt[get(i)];
    ++cntc[{get(i), c[i]}];
  }
  int ans = 1;
  for (auto p : cnt) ans = mul(ans, f[p.second]);
  for (auto p : cntc) ans = mul(ans, rf[p.second]);
  cout << ans << '\n';
}



Measured memory_bytes: 34424
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int a[101];
int dp[11][2];

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	dp[0][0]=1;
	for(int i=0;i<n;i++){
		for(int j=0;j<2;j++){
			for(int k=a[i]-1;k<=a[i]+1;k++){
				if(k%2==0){
					dp[i+1][1]+=dp[i][j];
				}else{
					dp[i+1][j]+=dp[i][j];
				}
			}
		}
	}
	printf("%d\n",dp[n][1]);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;

long sumUp(long ini, long diff, long num){
  	return num  * (2*ini + (num-1)*diff)/ 2;
}

int main() {

    long N, K;
    cin >> N >> K;

    long ans = 0;
    for (int k = K; k <= N+1; k++) {
        //max
        long maxV = sumUp(N-k+1, 1, k);
        //min
        long minV = sumUp(0, 1, k);
        ans += maxV-minV+1;
    }

    long div = pow(10,9)+7L;
    cout << ans%div << endl;

    return 0;
}


Measured memory_bytes: 3676
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
using namespace std;

int main()
{
  int N;
  cin>>N;
  double ans=0;
  for(int i=0;i<N;i++){
    double x;
    string u;
    cin>>x>>u;
    if(u=="JPY"){
      ans+=x;
    }else{
      ans+=380000.0*x;
    }
  }
  cout<< ans <<endl;
}


Measured memory_bytes: 256