akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<stack>
#include<queue>
#include<math.h>
#include<vector>
#include<algorithm>
#include<string.h>
#include<iomanip>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug" << x << endl;
using namespace std;

int n, A[21];

bool solve(int x, int count){
    if(count > n) return false;
    if(x == 0) return true;
    if(x < 0) return false;
    int res = solve(x - A[count], count + 1) || solve(x, count + 1);
    return res;
}

int main(){
    int m;
    cin >> n;
    rep(i, n){
        cin >> A[i];
    }
    cin >> m;
    int inp;
    rep(i, m){
        cin >> inp;
        if(solve(inp, 0)) cout << "yes" << endl;
        else cout << "no" << endl;
    }
}

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

using namespace std;

int main()
{
   int n; cin >> n;
   vector<int> w(n, 0);
   for(int i=0;i<n;i++) cin >> w[i];

   int bef = 0, aft = 0;
   int min = 10000;

   for(int i=1;i<n;i++){
      for(int j=0;j<i;j++) bef += w[j];
      for(int k=i;k<n;k++) aft += w[k];

      if(abs(bef-aft) < min) min = abs(bef-aft);
      bef = aft = 0;
   }

   cout << min <<  endl;

   return 0;
}


Measured memory_bytes: 256
N,M,K=map(int,input().split())
par=[i for i in range(N)]
siz=[1 for _ in range(N)]
rank=[0 for _ in range(N)]

def find(x):
    if(par[x]==x):
        return x
    else:
        par[x]=find(par[x])
        return par[x]

def union(a,b):
    a=find(a)
    b=find(b)
    if(a==b):
        return 0
    else:
        if rank[a]>rank[b]:
            par[b]=a
            siz[a]+=siz[b]
        else:
            par[a]=b
            siz[b]+=siz[a]
            if rank[a]==rank[b]:
                rank[b]+=1
            

def size(a):
    return siz[find(a)]

def same(a,b):
    return find(a)==find(b)

ans=[0 for i in range(N)]
for _ in range(M):
    A,B=map(int,input().split())
    A,B=A-1,B-1
    union(A,B)
    ans[A]-=1
    ans[B]-=1
for i in range(N):
    ans[i]+=size(i)-1
for _ in range(K):
    C,D=map(int,input().split())
    C,D=C-1,D-1
    if(same(C,D)):
        ans[C]-=1
        ans[D]-=1
        
print(*ans)

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

int main()
{
  int h, w;
  cin >> h >> w;
  rep(i, w + 2)
  {
    cout << '#';
  }
  cout << endl;
  rep(i, h)
  {
    string s;
    cin >> s;
    cout << '#' << s << '#' << endl;
  }
  rep(i, w + 2)
  {
    cout << '#';
  }

  cout << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#define Cin(T, x) T x; cin >> x
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cout(x) cout << (x) << "\n"
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) find(Range(c), x) != c.end()
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Vec2(T, vs, n, m) vector<vector<T>> vs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, n, xs, sxs) vector<T> sxs(n+1); For(i, n) sxs[i+1] = sxs[i] + xs[i]

using namespace std;
using ll = long long;

int main(void){
    Cin(int, n);
    int a = 0;
    For(i, n){
        Cin(int, t);
        a |= t;
    }
    int ans = 0;
    while(a % 2 == 0) a /= 2, ans ++; 
    Cout(ans);
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    tenka12019beginnerb()
}

fun tenka12019beginnerb() {
    val n = readLine()!!.toInt()
    val s = readLine()!!
    val k = readLine()!!.toInt()

    val c = s[k - 1]

    val answer = s.map { if (it == c) it else '*' }.joinToString("")

    println(answer)
}


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

int main() {
  int a, b;
  cin >> a >> b;
  
  if (a < b) {
    cout << "a < b" << endl;
  } else if (a > b) {
    cout << "a > b" << endl;
  } else {
    cout << "a == b" << endl;
  }
  

}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
 
int main(){
 int N;
 int K;
 int tmp;
 int val;
 double tmpval;
 cin >> N >> K;
 double pro = 0;
 int i;
 for(i=1;i<N+1;++i){
   if(i>=K)pro+=1.0;
   else{
    val=1;
   while(val*i<K){
       val*=2;
   }
   tmpval = 1.0/val;
   pro += tmpval;
   }}
 cout << setprecision(11) << pro*((double)(1.0/N)) << endl;
 }

Measured memory_bytes: 256
def euc(x,y):
  while x != y:
    if x > y:
      x -= y
    if x < y:
      y -= x
  return x

A,B = list(map(int, input().split()))
k = l = euc(A,B)
r = 1
s = 0
w = 1
while r**2 <= k:
  r += 1
  if k % r == 0:
    s += 1
    while k % r == 0:
      k /= r
    if k == 1:
      w = 0
s += w
if l != 1:
  s += 1
print(s)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define INF 1000000000000000000
using namespace std;
int main()
{
   int n;
   cin>>n;
   vector<long long int> v(n);int flag=0;long long int ans=1;
   for(int i=0;i<n;i++)
    {  long long int x;
        cin>>x;
         if(x==0)
           flag=1;
      v[i]=x;
    }
   
    if(flag==1)
     {cout<<0;
     return 0;}
    
     for(int i=0;i<n;i++)
       {
             if(v[i]>INF/ans)
                   {flag=1;
                   break;}
           ans=ans*v[i];
       }
     
     if(flag==1)
       cout<<-1;
       else
       cout<<ans;
}

Measured memory_bytes: 4056
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<long long> VL;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = (int)1e9;
const long long mod = (long long)1e9 + 7;
const double pi = acos(-1.0);

template <class T>void Sort(vector<T> & a) { sort(a.begin(), a.end()); }
template <class T>void ReSort(vector<T>& a) { sort(a.rbegin(), a.rend()); }
template <class T>void Reverse(vector<T>& a) { reverse(a.begin(), a.end()); }
template <class T>void Unique(vector<T>& a) { a.erase(unique(a.begin(), a.end()), a.end()); }
template <class T>T Sum(vector<T> a, T init = 0) { return accumulate(a.begin(), a.end(), init); }

//INPUT//
void CINPUT() {}
template<class H, class ...T> void CINPUT(H&& h, T&& ...t) { cin >> h; CINPUT(forward<T>(t)...); }
#define in(...) int __VA_ARGS__; CINPUT(__VA_ARGS__);
#define In(T,...) T __VA_ARGS__; CINPUT(__VA_ARGS__);
#define Vin(T,name,n) int n; cin>>n; vector<T> name(n); rep(i,n)cin>>name[i];
#define VIn(T,name,n) vector<T> name(n); rep(i,n)cin>>name[i];

//OUTPUT//
void print() { cout << endl; }
template <class H> void print(H&& h) { cout << h << endl; }
template <class H, class... T> void print(H&& h, T&& ... t) { cout << h << " "; print(forward<T>(t)...); }
template<class T>void out(T n) { cout << n << endl; }
template<class T>void out(vector<T> a, string sep = " ", string end = "\n") { for (int i = 0; i < (int)a.size(); ++i)cout << a[i] << (i == (int)a.size() - 1 ? end : sep); }
void yes(bool f) { puts(f ? "yes" : "no"); }
void Yes(bool f) { puts(f ? "Yes" : "No"); }
void YES(bool f) { puts(f ? "YES" : "NO"); }
void poss(bool f) { puts(f ? "possible" : "impossible"); }
void Poss(bool f) { puts(f ? "Possible" : "Impossible"); }
void POSS(bool f) { puts(f ? "POSSIBLE" : "IMPOSSIBLE"); }

int main() {
	in(n, l);
	VIn(string, s, n);
	Sort(s);
	out(s, "");
}

Measured memory_bytes: 256
#include <vector> 
#include <list> 
#include <map> 
#include <set> 
#include <deque> 
#include <queue> 
#include <stack> 
#include <bitset> 
#include <algorithm> 
#include <functional> 
#include <numeric> 
#include <utility> 
#include <sstream> 
#include <iostream> 
#include <iomanip> 
#include <cstdio> 
#include <cmath> 
#include <cstdlib> 
#include <cctype> 
#include <string> 
#include <cstring> 
#include <ctime> 

using namespace std;

#define _int64 long long
#define mo 1000000007

int a[400];
int b[400];
int can[400][400];
int num[400][400];
int used[400];
int sum[400][400][200];
int d[400][400][200];
int c[400][400];


int main()
{
  int i,j,l,n,o,p,k,tmp;
  for (i=0;i<400;i++)
  {
    c[i][0]=1;c[i][i]=1;
    for (j=1;j<i;j++)
    {
      c[i][j]=c[i-1][j-1]+c[i-1][j];
      if (c[i][j]>=mo) c[i][j]-=mo;
    }
  }
  scanf("%d",&n);
  for (i=0;i<n;i++)
    scanf("%d",&a[i]);
  for (i=0;i<n;i++)
    scanf("%d",&b[i]);
  for (i=0;i<n;i++)
    for (j=0;j<n;j++)
    {
      can[i][j]=1;
      for (k=0;k<=i;k++)
        if (a[k]==b[j]) can[i][j]=0;
      for (k=0;k<=j;k++)
        if (a[i]==b[k]) can[i][j]=0;

      num[i][j]=0;
      memset(used,0,sizeof(used));
      for (k=i+1;k<n;k++)
        used[a[k]]=1;
      for (k=j+1;k<n;k++)
        if (used[b[k]]==1) num[i][j]++;
    }
  for (i=n-1;i>=0;i--)
    for (j=n-1;j>=0;j--)
      for (k=0;k<n/3;k++)
      {
        if ((can[i][j]==0)||(num[i][j]<k+1)) d[i][j][k]=0;
        else
        {
          if ((k==0)||(i==n-1)||(j==n-1)) tmp=1;
          else tmp=sum[i+1][j+1][k-1];
          tmp=(_int64)tmp*c[k*3+2][2]%mo*2%mo*(num[i][j]-k*3)%mo;
          d[i][j][k]=tmp;
          //cout<<i<<" "<<j<<" "<<k<<" "<<d[i][j][k]<<endl;
        }  
        sum[i][j][k]=0;
        if (i+1<n)
        {
          sum[i][j][k]+=sum[i+1][j][k];
          if (sum[i][j][k]>=mo) sum[i][j][k]-=mo;
        }
        if (j+1<n)
        {
          sum[i][j][k]+=sum[i][j+1][k];
          if (sum[i][j][k]>=mo) sum[i][j][k]-=mo;
        }
        if ((i+1<n)&&(j+1<n))
        {
          sum[i][j][k]-=sum[i+1][j+1][k];
          if (sum[i][j][k]<0) sum[i][j][k]+=mo;
        }
        sum[i][j][k]+=d[i][j][k];
        if (sum[i][j][k]>=mo) sum[i][j][k]-=mo;
      }
  printf("%d\n",d[0][0][n/3-1]);
  return 0;
}

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

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

    string s, t;
    cin >> s >> t;

    int n = s.size();

    map<char, vector<int>> mp1, mp2;
    REP(i, n){
        mp1[s[i]].push_back(i);
        mp2[t[i]].push_back(i);
    }

    int a, b;
    a = mp1.size();
    b = mp2.size();

    if(a != b){
        cout << "No" << endl;
        return 0;
    }

    vector<vector<int>> S(a), T(b);
    int idx = 0;
    for(auto x : mp1){
        S[idx] = x.second;
        idx++;
    }
    idx = 0;
    for(auto x : mp2){
        T[idx] = x.second;
        idx++;
    }

    sort(S.begin(), S.end());
    sort(T.begin(), T.end());

    REP(i, a){
        REP(j, S[i].size()){
            if(S[i][j] == T[i][j]) continue;
            else{
                cout << "No" << endl;
                return 0;
            }
        }
    }

    cout << "Yes" << endl;

    /* check
    for(auto x : S){
        for(auto y : x){
            cout << y << " ";
        }
        cout << endl;
    }
    cout << "------------------" << endl;
    for(auto x : T){
        for(auto y : x){
            cout << y << " ";
        }
        cout << endl;
    }
    */

    return 0;
}

Measured memory_bytes: 4608
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const double INF = 1e10;
const ll MOD = 1000000007LL;

int64 N;
struct Points {
    vector<double> ma, mi;
    Points() : ma(3, -INF), mi(3, INF) {}
    void add_point(double x, int v) {
        v++;
        chmax(ma[v], x);
        chmin(mi[v], x);
    }
    double get_range(double t) {
        double mat = -INF, mit = INF;
        for(int i=0; i<3; i++) {
            chmax(mat, ma[i] + i * t);
            chmin(mit, mi[i] + i * t);
        }
        return mat - mit;
    }
    vector<double> get_events() {
        vector<double> res;
        // 速度 i と j のものがすれ違うタイミング (i > j)
        // i のものが j に追いつくイメージ、j のほうが最初遠くにいる
        for(int i=0; i<3; i++) {
            for(int j=0; j<i; j++) {
                {
                    double t = (ma[j] - ma[i]) / (i - j);
                    if(t > 0) res.push_back(t);
                }

                {
                    double t = (mi[j] - mi[i]) / (i - j);
                    if(t > 0) res.push_back(t);
                }
            }
        }
        sort(res.begin(), res.end());
        return res;
    }
};

int main() {
    cin >> N;
    Points xs, ys;
    for(int i=0; i<N; i++) {
        double x, y; char d; cin >> x >> y >> d;
        if(d == 'L') xs.add_point(x, -1), ys.add_point(y,  0);
        if(d == 'R') xs.add_point(x,  1), ys.add_point(y,  0);
        if(d == 'U') xs.add_point(x,  0), ys.add_point(y,  1);
        if(d == 'D') xs.add_point(x,  0), ys.add_point(y, -1);
    }

    vector<double> events, xt = xs.get_events(), yt = ys.get_events();
    events.push_back(0);
    events.push_back(1e10);
    events.insert(events.end(), xt.begin(), xt.end());
    events.insert(events.end(), yt.begin(), yt.end());

    double ans = 1e18;
    for(auto t : events) {
        double xr = xs.get_range(t);
        double yr = ys.get_range(t);
        chmin(ans, xr * yr);
    }
    printf("%.12f\n", ans);
    return 0;
}


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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

int N;

int main() {
	string s;
	cin >> N >> s;
	int a = 0;
	rep(i, N) {
		if (s[i] == 'R') {
			++a;
		} else {
			--a;
		}
	}
	puts(a > 0 ? "Yes" : "No");

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
 
#define rep(n) for(int i=0; i<(n); i++)
#define pb(n) push_back((n))
 
//typedef long long ll;
 
using namespace std;

// vector<bool> p(100000100,true);

// void makep(){
// 	for(int i=0; i<100000100; i++){
// 		if(i<2)p[i]=false;
// 		for(int j=2; j<=sqrt(i); j++){
// 			if(i%j==0){
// 				p[i]=false;
// 				break;
// 			}
// 		}
// 	}
// }

bool is_p(int n){
	if(n<2)return false;
	for(int i=2; i<=sqrt(n); i++){
		if(n%i==0)return false;
	}
	return true;
}

int main(){
	int n,cnt=0,a;
	cin>>n;
	for(int i=0; i<n; i++){
		cin>>a;
		if(is_p(a))cnt++;
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T1, typename T2> T1 pow_(T1 a, T2 b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b; if (a >= mod) a -= mod; }


void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);
  int T;
  T = 1;
  while (T--) solve();
}

void solve() {
  ll x;
  cin >> x;
  ll y = 100;
  rep3(i, 1, 4000) {
    if (y >= x) {
      cout << i - 1 << endl;
      return;
    }
    y = y + y / 100;
    // cout << i << " " << y << endl;
  }
}


Measured memory_bytes: 3652
#c = [[0 for i in range(3)] for i in range[3]];
c = [[0,0,0],[0,0,0],[0,0,0]];
c[0] = [int(x) for x in input().split()];
c[1] = [int(x) for x in input().split()];
c[2] = [int(x) for x in input().split()];

ans = 'true';

for i in range(1,3) :
    hdiff =  c[0][i] - c[0][i-1];
    for j in range(1,3) :
        if  c[j][i] - c[j][i-1] != hdiff :
            ans = 'false';
            break;

for i in range(1,3) :
    vdiff =  c[i][0] - c[i-1][0];
    for j in range(1,3) :
        if  c[i][j] - c[i-1][j] != vdiff :
            ans = 'false';
            break;            

if(ans == 'true') :
    print('Yes');
else :
    print('No');

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

int main() {
  int a, b;
  cin >> a >> b;
  
  if (a * b % 2 == 0) {
    cout << "Even" << endl;
  }
  
  else {
    cout << "Odd" << endl;
  }
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,ans=0;
	cin>>n;
	vl a(n),b(n+1,LINF);
	rep(i,n-1)cin>>b[i+1];
	rep(i,n)ans+=min(b[i],b[i+1]);
	puta(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define FORUL(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#define FORULE(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define FOREACH(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#if defined(_MSC_VER) || __cplusplus > 199711L
#define AUTOVAR(newvar,v) auto newvar = (v)
#else
#define AUTOVAR(newvar,v) __typeof(newvar) r = (v)
#endif
#define PB(x) push_back(x)
#define MP(x,y) make_pair((x),(y))
#define MEMSET(m,v) memset(m,v,sizeof(m))

typedef long long				 ll;
typedef unsigned long long		ull;

#define DEBUG 1

#if DEBUG
#define DOUT cout<<"["<<__LINE__<<"]:"
#else
#define DOUT 0 && cout
#endif

using namespace std;

string S,T;

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false);
	cin >> S;
	cin >> T;
	int ans = 0;
	FOR(i,3) {
		if(S[i]==T[i]) {
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}




Measured memory_bytes: 256
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <vector>
#include <string>
using namespace std;

int main()
{
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    cout << (a-c)*(b-d);
}

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

typedef signed long long ll;

int H,N;
int a[10100],b[10100];
ll dp[20100];

void solve(){
	int i,j,x,y,k,l,r;
	cin>>H>>N;
	
	for(i=0;i<20001;i++)
		dp[i]=1LL<<60;
		
	dp[0]=0;
	
	for(i=0;i<N;i++)
	{
		cin>>x>>y;
		for(j=0;j<H;j++)
			dp[j+x]=min(dp[j+x],dp[j]+y);
	}
	
	ll mi=1LL<<60;
	
	for(i=H;i<=20000;i++)
		mi=min(mi,dp[i]);
		
	cout<<mi<<endl;
}

int main(){
	solve();
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long int ll;

struct Edge{
	int to; ll dist;
	Edge(){}
	Edge(int to,ll dist):to(to),dist(dist){}
};

template <class E>
using Graph = vector<vector<E>>;
 
template<class D, D INF>
struct Dijkstra {
    vector<D> res; //res[i] = sからiまでの最短距離
    
    template<class E>
    Dijkstra(const Graph<E> &g, int s) {
        int V = (int)g.size();
        res = vector<D>(V, INF);
        
        using P = pair<D, int>;
        priority_queue<P, vector<P>, greater<P>> q;
        q.push(P(0, s));
        res[s] = 0;
        while (!q.empty()) {
            P p = q.top(); q.pop();
            if (res[p.second] < p.first) continue;
            for (E e: g[p.second]) {
                if (p.first+e.dist < res[e.to]) {
                    res[e.to] = p.first+e.dist;
                    q.push(P(res[e.to], e.to));
                }
            }
        }
    }
};

int main(){
	int n; cin >> n;
	Graph<Edge> g(n+1);
	for(int i=0;i<n-1;i++){
		int a,b; cin >> a >> b;
		a--; b--;
		g[a].push_back(Edge(b,1));
		g[b].push_back(Edge(a,1));
	}
	vector<int> fix(n,-1);
	int k; cin >> k;
	for(int i=0;i<k;i++){
		int v,p; cin >> v >> p; v--;
		fix[v]=p;
		g[n].push_back(Edge(v,p));
	}
	Dijkstra<ll,(ll)1e15> di(g,n);//頂点Nからダイクストラ
	for(int i=0;i<n;i++){
		int up=di.res[i];
		if(fix[i]!=-1&&fix[i]!=up){
			cout << "No" << endl;
			return 0; 
		}
		fix[i]=up;
	}
	for(int i=0;i<n;i++){
		for(auto e:g[i]){
			int j=e.to;
			if(abs(fix[i]-fix[j])!=1){
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
	for(int i=0;i<n;i++){
		cout << fix[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 13556
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
//#include <intrin.h>

#define fore(i,a,b) for(int i = a; i < (b); i++)
#define fr(i,a,b) for(int i = a - 1; i >= b; i--)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define N 300005
#define inf 2000000000
#define EPS 1e-6
#define MOD 998244353ll
#define __builtin_popcount(x) __popcnt(x)

using namespace std;

typedef long long ll;

inline void solve()
{
	int n;
	cin >> n;
	cout << (n / 500) * 1000 + ((n % 500) / 5) * 5;
}

int main()
{
	fast;
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int q = 1;
	//cin >> q;
	while (q--)
	{
		solve();
		cout << '\n';
	}
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace Test1 {

    


    class ClassMain {


        


        public static void Main(String[] args) {
            string line;
            while ((line = Console.ReadLine()) != null) {
                int[] ints = line.Split(' ').Select(int.Parse).ToArray();
                //int n = int.Parse(line);
                int x = ints[0];
                int y = ints[1];
                if (x == 0) { break; }
                int mod = 100000;

                int[,] curvN = new int[y, x];
                int[,] curvE = new int[y, x];
                int[,] straiN = new int[y, x];
                int[,] straiE = new int[y, x];

                for (int i = 1; i < x; i++) {
                    straiE[0, i] = 1;
                }
                for (int i = 1; i < y; i++) {
                    straiN[i, 0] = 1;
                }

                for (int yy = 1; yy < y; yy++) {
                    for (int xx = 1; xx < x; xx++) {
                        curvN[yy, xx] = straiE[yy - 1, xx];
                        straiN[yy, xx] = (curvN[yy - 1, xx] + straiN[yy - 1, xx]) % mod;
                        curvE[yy, xx] = straiN[yy, xx - 1];
                        straiE[yy, xx] = (curvE[yy, xx - 1] + straiE[yy, xx - 1]) % mod;
                    }
                }
                Console.WriteLine((curvE[y - 1, x - 1] + curvN[y - 1, x - 1] +
                    straiE[y - 1, x - 1] + straiN[y - 1, x - 1]) % mod);


            }
            
        }

        
    }

    

    
}

Measured memory_bytes: 6196
/*
貪欲
後ろから見る
DP
順位表をチェック
二分探索


*/
#pragma GCC optimize("Ofast")
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
#include<tuple>
using namespace std;
#define INF 3e18+7
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
//typedef pair<pair<int,int>,int> p;
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
struct edge{ll to,cost,val;};
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());

int s[110000],t[110000];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int Q;
    string S,T;
    cin>>S>>T>>Q;

    for(int i=0;i<(int)S.size();i++){
        s[i+1]=s[i];
        if(S[i]=='A') s[i+1]++;
        else s[i+1]+=2;
    }

    for(int i=0;i<(int)T.size();i++){
        t[i+1]=t[i];
        if(T[i]=='A') t[i+1]++;
        else t[i+1]+=2;
    }

    while(Q--){
        int a,b,c,d;
        cin>>a>>b>>c>>d;
        int sx=s[b]-s[a-1];
        int tx=t[d]-t[c-1];
        //cout<<sx<<" "<<tx<<endl;
        if(sx%3==tx%3) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }

}

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

using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)

typedef long long ll;
typedef unsigned long long int llt;

const int N = 5e5 + 10;

vector<int> g[N];
bool viss[N];
int vis[N];

// Normal DFS
void dfs(int curr, int par)
{
  for(auto x: g[curr])
    if(x != par)
      dfs(x, curr);
}

// DFS with visiting status
void dfs1(int curr, int par)
{
  viss[curr] = 1;
  for(auto x: g[curr])
    if(!viss[x])
      dfs1(x, curr);
}

// DFS with strongly connected component
void dfs2(int curr, int par, int num)
{
  vis[curr] = num;
  for(auto x: g[curr])
    if(vis[x] == 0)
      dfs2(x, curr, num);
}

// XOR from 0 to n
ll fxor(ll n)
{
  if(n < 0) return 0;
  if(n % 4 == 3) return 0;
  else if(n % 4 == 0) return n;
  else if(n % 4 == 1) return n^(n-1);
  else if(n%4 == 2) return n^(n-1)^(n-2);
}

// Power in logn with mod 1000000007
llt ppow(llt x, llt y)
{
  llt res = 1;
  while(y > 0){
    if(y&1)
      res = (res * x)%M;
    y = y >> 1;
    x = (x * x)%M;
  }
  return res;
}

// Factorial with dp
llt factdp[N];
llt fact(llt x)
{
  if(x == 0) return 1;
  if(x == 1) return 1;
  if(factdp[x] != -1) return factdp[x];
  return factdp[x] = (x*fact(x-1))%M;
}

// String return to base b
string ansConv ="";
void convert10tob(llt N, int b)
{
     if (N == 0)
        return;
     int x = N % b;
     N /= b;
     if (x < 0)
        N += 1;
     convert10tob(N, b);
     ansConv += to_string(x);
     return;
}

// Convert string to num wiht base b
llt convertstrtob(string a, int b)
{
  llt aa = 0;
  llt mul = 1;
  for(int i=a.length()-1; i>=0; i--)
  {
    int curr = a[i] - '0';
    aa += (curr * mul);
    mul *= b;
  }
  return aa;
}

// Union Find algo with array
// Find()
int findpar(int curr, int arr[])
{
  while(arr[curr] != curr) curr = arr[curr];
  return curr;
}
// Union()
void Union(int b, int spa, int arr[])
{
  while(arr[b] != b)
  {
    int c = arr[b];
    arr[b] = spa;
    b = c;
  }
  arr[b] = spa;
}

// Main Code

int main()
{
  int a, b;
  cin>>a;
  repn(i, 1, 9)
    repn(j, 1, 9)
      if(i*j == a)
      {
        puts("Yes");
        return 0;
      }
  puts("No");
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

const ll mod = 3;
const int N = 1e2 + 10, M = 1e7 + 10;
const ll INF = 1e18;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;

#define pi acos(-1)

int main()
{
    int x;
    cin >> x;
    if (x >= 30)
        puts("Yes");
    else
    {
        puts("No");
    }
    return 0;
}


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

int main(){
    int N; cin>>N;
    int X[110],Y[110],H[110];
    int xt,yt,ht;
    for(int i=0;i<N;i++){
        cin>>X[i]>>Y[i]>>H[i];
        if(H[i]>0){
            xt=X[i];
            yt=Y[i];
            ht=H[i];
        }
    }
    for(int y=0;y<101;y++){
        for(int x=0;x<101;x++){
            bool f=true;
            int height=ht+abs(y-yt)+abs(x-xt);
            for(int i=0;i<N;i++){
                if(H[i]!=max(height-abs(y-Y[i])-abs(x-X[i]),0)){
                    f=false;
                    break;
                }
            }
            if(f){
                cout<<x<<" "<<y<<" "<<height<<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 intt int64_t
#define all(vec) vec.begin(), vec.end()
#define INF 2000000000

int main() {
    int n;
    scanf("%d", &n);
    int ans = 1;
    while (n >= ans) ans *= 2;
    printf("%d\n", ans/2);
}

Measured memory_bytes: 384
#pragma GCC optimize("Ofast")

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    string s, t;
    cin >> s >> t;
    int diff = 0;
    for(int i = 0; i < s.size(); ++i){
        if(s[i] != t[i]) ++diff;
    }
    cout << diff << "\n";

    return 0;
}

Measured memory_bytes: 3824
#include "bits/stdc++.h"

using namespace std;
using int64 = long long int;

int Count(int value)
{
    int count = 0;

    while (value > 0)
    {
        count++;
        value /= 10;
    }

    return count;
}

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

    int ans = 0;
    for (int i = 1; i <= n; i++)
    {
        if (Count(i) % 2 == 1)
        {
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.awt.geom.Point2D;
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
//		new A().doIt();
		new GRL_6().doIt();
	}
	class GRL_6{
		void doIt(){
			int n = sc.nextInt();
			int e = sc.nextInt();
			int cost[][] = new int[n][n];
			for(int i = 0;i < e;i++){
				int from = sc.nextInt();
				int to = sc.nextInt();
				int cap = sc.nextInt();
				cost[from][to] = cap;
			}
			MF m = new MF(cost,n,0,n-1);
			System.out.println(m.maxflow());
		}
		class MF{
			int INF=1<<24;
			int n,s,t; //n->node,s->source,t->sink
			int [][] cap, flow;
			int [] levels;
			boolean [] finished;
			MF(int [][] cap, int n, int s, int t){
				this.cap = cap;
				this.n = n; 
				this.s = s; 
				this.t = t;
				flow = new int[n][n];
				finished = new boolean[n];
				levels = new int[n];
			}
			
			private int maxflow() {
				for(int i = 0 ; i < n; i++) Arrays.fill(flow[i], 0);
				int total = 0;
				for(boolean cont = true; cont; ){
					cont = false;
					levelize();
					Arrays.fill(finished, false);
					for(int f; (f = augment(s,INF)) > 0; cont = true)
						total += f;
					}
				return total;
			}
			private void levelize(){
				Arrays.fill(levels, -1);
				LinkedList<Integer> q = new LinkedList<Integer>();
				levels[s] = 0;
				q.add(s);
				while(! q.isEmpty()){
					int here = q.removeFirst();
		            for(int there = 0; there < n; there++){
		            	if(levels[there] < 0 && residue(here, there) > 0){
		            		levels[there] = levels[here] + 1;
		                    q.add(there);
		                }
		            }
				}
			}
			private int augment(int here,int cur){
				if(here == t || cur == 0)return cur;
				if(finished[here])return 0;
				finished[here] = true;
				for(int there = 0;there < n;there++){
					if(levels[there] > levels[here]){
						int f = augment(there, Math.min(cur, residue(here, there)));
						if(f > 0){
							flow[here][there] += f;
							flow[there][here] -= f;
							finished[here] = false;
							return f;
						}
					}
				}
				return 0;
			}
			private int residue(int i, int j) {
				return cap[i][j] - flow[i][j];
			}
		}
	}
	class A{
		BigInteger sum[] = new BigInteger[501];
		BigInteger bit[] = new BigInteger[501];
		void doIt(){
			sum[1] = new BigInteger("1");
			bit[1] = new BigInteger("1");
			for(int i = 2;i < 501;i++){
				bit[i] = bit[i-1].multiply(new BigInteger("2"));
				sum[i] = sum[i-1].add(bit[i]);
			}
			while(true){
				String str = sc.next();
				if(str.equals("0"))break;
				BigInteger num = new BigInteger(str);
				int length = num.toString(2).length() + 1;
				ArrayList<Par> array = new ArrayList<Par>(); 
				array.add(new Par(bit[length],1,length-1));
				System.out.println(bit[length - 1]+" "+sum[length - 1]);
				System.out.println(array.get(0).num+" "+array.get(0).cnt+" "+array.get(0).length);
			}
		}
		class Par{
			BigInteger num;
			int cnt,length;
			public Par(BigInteger num,int cnt,int length){
				this.num = num;
				this.cnt = cnt;
				this.length = length;
			}
		}
	}
}

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

using namespace std;

const int MOD = 1e9 + 7;

int add(int x, int y) {
   x += y;
   if (x >= MOD) x -= MOD;
   return x;
}

int mult(int x, int y) {
   return (long long) x * y % MOD;
}

int pw(int x, int y) {
   int ans = 1;
   for (; y > 0; y >>= 1, x = mult(x, x)) if (y & 1) ans = mult(ans, x);
   return ans;
}

int main() {
   ios_base::sync_with_stdio(false);
   int N, A, B, C, D;
   cin >> N >> A >> B >> C >> D;
   vector<int> fact(N + 1);
   vector<int> ifact(N + 1);
   vector<vector<int>> powIfact(N + 1, vector<int>(N + 1));
   fact[0] = 1;
   ifact[0] = 1;
   for (int i = 1; i <= N; ++i) {
      fact[i] = mult(fact[i - 1], i);
      ifact[i] = pw(fact[i], MOD - 2);
   }
   for (int i = 0; i <= N; ++i) {
      powIfact[i][0] = 1;
      for (int j = 1; j <= N; ++j) {
         powIfact[i][j] = mult(powIfact[i][j - 1], ifact[i]);
      }
   }
   vector<int> dp(N + 1);
   dp[N] = 1;
   for (int z = A; z <= B; ++z) {
      vector<int> ndp = dp;
      for (int i = 1; i <= N; ++i) {
         for (int j = 1; j <= D && j * z <= i; ++j) {
            if (j >= C) {
               /// fact(i) / fact(i - j * z) / fact(j) ^ z /
               int coeff = fact[i];
               coeff = mult(coeff, ifact[i - j * z]);
               coeff = mult(coeff, powIfact[z][j]);
               coeff = mult(coeff, ifact[j]);
               ndp[i - j * z] = add(ndp[i - j * z], mult(dp[i], coeff));
            }
         }
      }
      dp = ndp;
   }
   cout << dp[0] << "\n";
}


Measured memory_bytes: 4224
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String p[] = {"a", "e", "i", "o", "u"};
		
		String c;
		boolean vowel = false;
		
		c = sc.nextLine();
		for(int i = 0; i < p.length; ++i) {
			if(c.equals(p[i])) {
				vowel = true;
				break;
			}
		}
		
		if(vowel)System.out.println("vowel");
		else System.out.println("consonant");
		
		sc.close();
	}

}


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

int main() {
  char s[200002], t[200002];
  scanf("%s", s);
  scanf("%s", t);
  int n=strlen(s);
  int c=0;
  for(int i=0;i<n;i++){
    if(s[i]!=t[i]) c++;
  }
  printf("%d", c);
  return 0;
}

Measured memory_bytes: 2540
n = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)

cnt = 0
Alice = 0
Bob = 0
while cnt < n:
    cnt += 1
    if cnt % 2 != 0:
        Alice += a[cnt-1]
    else:
        Bob += a[cnt-1]

print(Alice - Bob)


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(15);

  int A, B, C, D;
  cin >> A >> B >> C >> D;

  int t = 0;
  if (min(B, D) > max(A, C)) {
    t = min(B, D) - max(A, C);
  }

  cout << t << '\n';

  return 0;
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    ll n,m;cin>>n>>m;
    string s,t;cin >>s>>t;
    ll g=__gcd(n,m);
    ll l=n*m/g;
    ll a=n/g;
    ll b=m/g;
    for (int i = 0; i < g; ++i) {
        if(s[a*i]!=t[b*i]){
            cout <<-1<<endl;
            return 0;
        }
    }
    cout <<l<<endl;
}


Measured memory_bytes: 3760
import sys
b=0
a=[{},{}]
for e in sys.stdin:
 if'\n'==e:b=1
 else:c=int(e.split(',')[0]);a[b][c]=1+a[b][c]if c in a[b]else 1
for k in sorted({*a[0]}&{*a[1]}):print(k,a[0][k]+a[1][k])


Measured memory_bytes: 5600
#include <iostream>
int main() {

  int A;
  int B;
  int C;

  std::cin >> A >> B >> C;

  if (A <= C && B >= C) {
    std::cout << "Yes" << std::endl;
  } else if (A >= C && B <= C) {
    std::cout << "Yes" << std::endl;
  } else {
    std::cout << "No" << std::endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int main(void)
{
	long long a1,a2,b1,b2,a,b;
	cin>>a1>>a2>>b1>>b2;
	a=a1*a2;
	b=b1*b2;
	if(a>=b)
	{
		cout<<a;
	}
	else{
		cout<<b;
	}
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define pri_que priority_queue
#define vint vector<int>
#define vvint vector<vector<int>>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vs vector<string>
#define vvc vector<vector<char>>
#define vc vector<char>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e15;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    string a; cin >> a; reverse(all(a));
    int n=a.size();
    vi s(n+1,0);
    int ten=1;
    rep(i,n){
        s[i+1]=s[i]+(a[i]-'0')*ten;
        ten*=10; ten%=2019;
        s[i+1]%=2019;
        //cout<<s[i+1]<<endl;
    }
    map<int,int> map;
    rep(i,n+1){
        map[s[i]]++;
    }
    int res=0;
    for(auto m:map){
        res+=(m.S)*(m.S-1)/2;
        //cout<<m.F<<' '<<m.S<<endl;
    }
    cout<<res<<endl;
    
}

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

int main()
{
	int L, R, d; cin >> L >> R >> d;
	int cnt = 0;
	for (int i = L; i <= R; ++i) {
		if (i % d == 0) ++cnt;
	}
	cout << cnt << endl;
	return 0;
}


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

vector<char> ope(vector<char> &op,vector<int> &num,int count,int sum,bool flg)
{
    if(flg && count != 0)
    {
        op.at(count-1) = '+';
        sum += num.at(count);
    }
    if(!flg && count != 0)
    {
        op.at(count-1) = '-';
        sum -= num.at(count);
    }
    if(count == 3)
    {
        if(sum == 7)
        {
            return op;
        }else{
            op.at(2) = '.';
            return op;
        }
    }
    vector<char> tmp1,tmp2;
    tmp1 = ope(op,num,count+1,sum,true);
    tmp2 = ope(op,num,count+1,sum,false);
    if(tmp1.at(2) == '.')
    {
        return tmp2;
    }else{
        return tmp1;
    }
}


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

    vector<int> num(4);
    vector<char> op(3);

    num.at(0) = n/1000;
    n %= 1000;
    num.at(1) = n/100;
    n %= 100;
    num.at(2) = n/10;
    n %= 10;
    num.at(3) = n;

    op = ope(op,num,0,num.at(0),false);

    cout<<num.at(0)<<op.at(0)
    <<num.at(1)<<op.at(1)
    <<num.at(2)<<op.at(2)
    <<num.at(3)<<"=7"<<endl;

}

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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back

using namespace std;

// #define DEBUG_IS_VALID

#ifdef DEBUG_IS_VALID
#define DEB 1 
#else
#define DEB 0
#endif
#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : "\n"); return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : "}\n"); return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline void chmax(T& a,T const& b){a=max(a,b);}
template<class T> inline void chmin(T& a,T const& b){a=min(a,b);}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<60; 

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N; cin >> N;
  vl a(N); rep(i,N) cin >> a[i];
  rep(i,N){
    if(a[i]>=i+1){
      cout << "-1" << endl;
      return 0;
    }
  }
  ll ans = 0;
  int nx = -1;
  RREP(i,N-1,0){
    if(a[i]<nx){
      cout << "-1" << endl;
      return 0;
    }else if(a[i]>nx){
      ans += a[i];
      nx = a[i];
    }
    nx--;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int main(void)
{
    long long n;
    cin >> n;
    long long ans = 1LL << 60;
    for (long long i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            long long j = n / i;
            ans = min(ans, i + j - 2);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
def area(a, b, c)
  z = (a + b + c) / 2
  return Math.sqrt(z * (z - a) * (z - b) * (z - c))  
end

def edge(p1x, p1y, p2x, p2y, p3x, p3y)
  a = dist(p1x, p1y, p2x, p2y)
  b = dist(p2x, p2y, p3x, p3y)
  c = dist(p3x, p3y, p1x, p1y)
  
  return [a, b, c]
end

def dist(x1, y1, x2, y2)
  return Math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
end

p, sum = [], 0

p << $_.split(",").map(&:to_f) while gets

(p.length - 2).times do |i|
  sum += area(*edge(*p[0], *p[i + 1], *p[i + 2]))
end

puts sum

Measured memory_bytes: 6164
l, r = map(int, input().split())
if r - l > 3000:
  print(0)
else:
  ans = 3000
  for i in range(l, r + 1):
    for j in range(i + 1, r + 1):
      ans = min(ans, i * j % 2019)
  print(ans)
  


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

int main()
{
	int nA, nB;
	while (1)
	{
		cin >> nA >> nB;
		if ((nA | nB) == 0)
		{
			break;
		}
		if (nA > nB)
		{
			swap(nA, nB);
		}
		cout << nA << " " << nB << endl;
	}

	//system("pause");
	return 0;
}

Measured memory_bytes: 3012