akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")
#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;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    while(1){
        int n, m; cin>>n>>m;
        if(n == 0) break;

        vector<int> hsum(n+1, 0), wsum(m+1, 0);
        for(int i=0; i<n; i++){
            int h; cin>>h;
            hsum[i+1] = hsum[i] + h;
        }
        for(int i=0; i<m; i++){
            int w; cin>>w;
            wsum[i+1] = wsum[i] + w;
        }

        map<int, int> hcnt;
        for(int i=0; i<=n; i++){
            for(int j=i+1; j<=n; j++){
                hcnt[hsum[j] - hsum[i]]++;
            }
        }

        int ans = 0;
        for(int i=0; i<=m; i++){
            for(int j=i+1; j<=m; j++){
                ans += hcnt[wsum[j] - wsum[i]];
            }
        }

        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 20968
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define all(x) (x).begin(), (x).end()
#define Sort(x) sort((x).begin(), (x).end())
#define Reverse(x) reverse((x).begin(), (x).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for (int i = m; i < n; i++)
#define INF INT_MAX
#define fcout cout << fixed << setprecision(15) // 15桁まで表示
#define en '\n'
using str = string;
using ll = long long;
using ull = unsigned long long;
using ui = unsigned int;
using puu = pair<ui, ui>;
using P = pair<int, int>;
using vi = vector<int>;
int gcd(int a, int b) {
  return b ? gcd(b, a % b) : a;
};
int lcm(int a, int b) {
  return a / gcd(a, b) * b;
};
int floor(int a, int b) {
  return (a + b - 1) / b;
};
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
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;
};
const ll mod = 1000000007;
const double PI = acos(-1.0);
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << setiosflags(ios::fixed);

  int n, a;
  cin >> n;
  multiset<int> q;
  rep(i,n){
    cin >> a;
    auto it = q.upper_bound(a - 1);
    if (it != q.begin())
      q.erase(--it);
    q.insert(a);
  }
  cout << q.size() << en;
}

Measured memory_bytes: 8292
from math import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

n, m = map(int, input().split())
a = list(map(int, input().split()))
l = [0] * n
for i in range(n):
    tmp = a[i]
    while tmp % 2 == 0:
        tmp //= 2
        l[i] += 1
    if i > 0 and l[i] != l[i - 1]:
        print(0)
        exit(0)
res = 1
for i in range(n):
    res = lcm(res, a[i] // 2)
print(m // res - m // (res * 2))


Measured memory_bytes: 20724
N = int(input())
A = [0] + [int(x) for x in input().split()] + [0]
m = 0
for i in range(N + 1):
  m += abs(A[i + 1] - A[i])
skip = 0
for i in range(N):
  skip = abs(A[i + 2] - A[i + 1]) + abs(A[i + 1] - A[i]) - abs(A[i + 2] - A[i])
  print(m - skip)

Measured memory_bytes: 14048
N,*as=$<.read.split.map(&:to_i)

ret = 0
sum = as[0]
l=0
r=1
while l < N
  if as[r].nil? || (sum & as[r]) != 0
    ret += r-l
    sum -= as[l]
    l += 1
  else
    sum += as[r]
    r += 1
  end
end

puts ret


Measured memory_bytes: 16892
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    int n;
    cin >> n;
    vector<int> H(n);
    int ans = 0;
    rep(i, n) cin >> H[i];
    for(int i = 100; i > 0; i--) {
        rep(j, n) {
            if(H[j] == i) {
                while(H[j] == i) {
                    H[j]--;
                    j++;
                }
                ans++;
            }
        }
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s; cin>>s;
  int skip=0;
  bool is_make = true;
  int size = s.length();
  for(int i=0; i<size; i+=skip){
    string a(s, i, 5);
    //cout << a<<endl;
    if(a == "dream"){
      if( i+6 <= size){
        string b(s, i+5, 2);
        if ( b == "er"){
          if( i+9 <= size){
            string c(s, i+5, 5);
            if( c == "erase") skip = 5;
            else skip = 7;
          }
          else skip = 7;
        }
        else skip = 5;
      }
      else skip = 5;
    }
    else if( a == "erase"){
      if ( i+5 <= size){
        string d(s, i+4, 2);
        if( d == "er") skip = 6;
        else skip = 5;
      }
      else skip = 5;
    }
    else{ 
      is_make = false;
      break;
    }
  }
  if ( is_make ) cout<< "YES"<<endl;
  else cout<< "NO"<<endl;
  return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}

int main(){
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	if(b<c)swap(c,b);
	if(a<b)swap(a,b);
	for(int i=0;i<d;i++)a*=2;
		printf("%d\n",a+b+c);
}


Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> P;
#define INF 10000000000000
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for(ll i = 1; i < (ll)(n); i++)
#define repN_1(i, n) for(ll i = 0; i < (ll)(n - 1); i++)
#define repM(i, n) for(ll i = (ll)(n - 1); i >= 0; i--)
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

int main()
{
	cout << fixed << setprecision(18);
	string s;
	ll n;
	
	cin >> n >> s;

	ll count_l = 0;
	ll count_r = 0;

	rep(i, n) {
		if (s[i] == ')') {
			if (count_r == 0)
				count_l++;
			else
				count_r--;
		}
		else if (s[i] == '(') {
			count_r++;
		}
	}

	rep(i, count_l)
		cout << '(';

	cout << s;

	rep(i, count_r)
		cout << ')';

	cout << endl;


	return 0;
}

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

int main() {
	int a, b;
	cin >> a >> b;

	if ((a * b * 1) % 2 != 0 || (a * b * 2) % 2 != 0 || (a * b * 3) % 2 != 0) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
import sys
import math

def primes(n):
    sieve = [1] * (n + 1)
    rt = int(math.sqrt(n))
    sieve[0] = sieve[1] = 0
    for p in range(2, rt + 1):
        if sieve[p] == 0:
            continue
        k = p * 2
        while k <= n:
            sieve[k] = 0
            k += p
    r = []
    for p in range(2, n + 1):
        if sieve[p] == 1:
            r.append(p)
    return r

def goldbach(prime, n):
    c = 0
    for p in prime:
        if p <= n - p and n - p in prime:
            c += 1
    return c

p = primes(2**15)
for line in sys.stdin:
    n = int(line)
    if n == 0:
        break
    c = goldbach(p, n)
    print(c)


Measured memory_bytes: 5840
#include<bits/stdc++.h>
using namespace std;
#define itn int
#define int long long
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,cnt,m=0,q;
  cin>>n;
  for(int i=1;i<=n;i++){
    cnt=0;
    itn p=i;
    while(true){
      if(p%2!=0) break;
      cnt++;
      p/=2;
    }
    m=max(m,cnt);
    if(m==cnt) q=i;
  }
  cout<<q<<"\n";
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
 
memo = {}
ans = 0
 
for a in A:
  v = str(a)
  if v in memo:
    memo[v] += 1
  else:
    memo[v] = 1

result = False
for key in memo.keys():
  if key == '0':
    if N%2 == 0:
      result=True
      break
    if memo[key] != 1:
      result=True
      break
  elif memo[key] != 2:
    result=True
    break
    
if not result:
  x = len(memo.keys())
  if N%2 != 0:
    x-=1
  ans = 2**x
  
div = 10**9 + 7
print(ans%div)

Measured memory_bytes: 15708
#include <stdio.h>

int main(int argc, char *argv[])
{
	int a, b, c;
	int tmp;
	scanf("%d %d %d", &a, &b, &c);
while (1)
{
	if (a <= b && b <= c)
	{
		printf("%d %d %d\n", a,b,c);
		break;
	}
	if(a > b){
		tmp = a;
		a = b;
		b = tmp;
	}
	if(a > c){
		tmp = a;
		a = c;
		c = tmp;
	}
	if(b > c){
		tmp = b;
		b = c;
		c = tmp;
	}
}

	return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

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

	string s;
	cin >> s;
	if (s == "ABC")
		cout << "ARC" << endl;
	else
		cout << "ABC" << endl;
}


Measured memory_bytes: 3612
#include <iostream>
using namespace std;
int main(){
  string s;
  cin >> s;
  char a = s[s.length()-1];
  if(a=='2'||a=='4'||a=='5'||a=='7'||a=='9'){
    cout << "hon" << endl;
  }else if(a=='3'){
    cout << "bon" << endl;
  }else{
    cout << "pon" << endl;
  }
}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ASC(x) sort(ALL((x)))
#define DESC(x) sort(ALL((x)),greater<ll>())
#define pb push_back

int main()
{
    ll N;
    cin >> N;
    vec A(N);
    REP(i,0,N) cin >> A[i];

    ll p = 1, c, sum = 0;
    REP(i,0,60) {
        c = 0;
        REP(j,0,N) c += ((A[j] >> i) & 1);
        c = c * (N - c) % MOD;
        sum = (sum + c * p) % MOD;
        p = p * 2 % MOD;
    }
    PR(sum);

    return 0;
}

/*



*/

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

int a_search(int a[], int l, int x){
  int max = x-1;
  int min = 0;
  int mid = (max-min)/2;
  while(max - min > 1){
    if(l > a[mid]){
      min = mid;
      mid = (max-min)/2;
    }else if(l < a[mid]){
      max = mid;
      mid = (max-min)/2;
    }else{
      return mid;
    }
  }
  if(l <= a[min]){
    return min;
  }else if(l > a[max]){
    return -1;
  }else{
    return max;
  }
}

int c_search(int a[], int r, int x){
  int max = x-1;
  int min = 0;
  int mid = (max-min)/2;
  while(max - min > 1){
    if(r > a[mid]){
      min = mid;
      mid = (max-min)/2;
    }else if(r < a[mid]){
      max = mid;
      mid = (max-min)/2;
    }else{
      return mid;
    }
  }
  if(r >= a[max]){
    return max;
  }else if(r < a[min]){
    return -1;
  }else{
    return min;
  }
}

int main(){
  int n,q;
  scanf("%d %d",&n,&q);
  char s[100000];
  scanf("%s",s);
  int l[100000];
  int r[100000];
  for(int i=0;i<q;i++){
    scanf("%d %d",&l[i],&r[i]);
    l[i]--;
    r[i]--;
  }
  int a[100000] ={};
  int c[100000] ={};
  int x = 0;
  for(int i=1;i<n;i++){
    if(s[i-1] == 'A' && s[i] == 'C'){
      x++;
      c[i] = x;
      a[i-1] = 1;
      //printf("a[%d] = %d\n",i,a[i]);
      //printf("c[%d] = %d\n",i,c[i]);
    }else{
      c[i] = x;
      a[i-1] = 0;
    }
  }
  a[n-1] = 0;
  int an,cn;
  for(int i=0;i<q;i++){
    cn = c[r[i]] - c[l[i]];
    printf("%d\n",cn);
  }
  return 0;
}

Measured memory_bytes: 2048
nums = gets.split.map(&:to_i).sort
if (nums[1] - nums[0]) % 2 == 0
  a = (nums[1] - nums[0]) / 2
  b = nums[2] - nums[1]
  puts a + b
else
  a = (nums[1] - nums[0]) / 2 + 1
  b = nums[2] - nums[1] + 1
  puts a + b
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define P pair<int, int>
#define V vector<int>
#define S set<int>
#define itn int
bool dbg = false;
itn N, d[100];
void solve() {
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N;
    FOR(i, 0, N) {
        cin >> d[i];
    }
    int ans = 0;
    FOR(i, 0, N) {
        FOR(j, i + 1, N) {
            ans += d[i] * d[j];
        }
    }
    cout << ans << endl;
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<array<int, 3>> dp(n);
  vector<array<int, 3>> happy(n);
  for (auto idx(0); idx < n; ++idx) {
    cin >> happy[idx][0] >> happy[idx][1] >> happy[idx][2];
  }
  dp[0][0] = happy[0][0];
  dp[0][1] = happy[0][1];
  dp[0][2] = happy[0][2];
  for (auto idx(1); idx < n; ++idx) {
    dp[idx][0] = max(dp[idx - 1][1], dp[idx - 1][2]) + happy[idx][0];
    dp[idx][1] = max(dp[idx - 1][0], dp[idx - 1][2]) + happy[idx][1];
    dp[idx][2] = max(dp[idx - 1][0], dp[idx - 1][1]) + happy[idx][2];
  }
  cout << max(max(dp.back()[0], dp.back()[1]), dp.back()[2]) << endl;
  return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define g(a, b) __gcd((a), (b))
#define l(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
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; }
template<class T, class U>T rem(T a, U b) { return a - b*floor(a/b); }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        string S;
        cin >> S;
        bool flg = true;

        if (S[0] != 'A') flg = false;

        ll tmp = count(S.begin()+2, S.end()-1, 'C');
        if (tmp != 1) flg = false;

        ll lc = 0;
        ll uc = 0;

        rep(i, 0, len(S)) {
                if (isupper(S[i])) ++uc;
                if (islower(S[i])) ++lc;
        }
        if (! (lc == len(S)-2 and uc == 2)) flg = false;

        if (flg) {
                cout << "AC" << endl;
        } else {
                cout << "WA" << endl;
        }
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <fstream>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <time.h>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) (min(a,b) <= (x) && (x) <= max(a,b)) //hei
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007LL
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589


#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
	std::fill((T*)array, (T*)(array + N), val);
}
pll Dir[4] = {
	{ -1 ,0 },{ 0 , 1 },{ 1 ,0 },{ 0 ,-1 }
};

//[a, b)
#define Getsum(ar, a,b) (ar[b] - ar[a])
#define chmax(a,b) a = max(a,b)
#define chmin(a,b) a = min(a,b)

struct Edge {
	int from, to;
	ll w;
	bool operator<(const Edge& rhs) const {
		return MP(w, MP(from, to)) < MP(rhs.w, MP(rhs.from, rhs.to));
	}

};
typedef vector<vector<Edge>> Graph;

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

ll factorial(ll n) {//階乗
	ll ret = 1;
	rep(i, 1, n + 1)
		ret = (ret *i) % MODU;

	return ret;
}

ll mod_pow(ll x, ll n, ll mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x %mod;
		x = x * x%mod;
		n >>= 1;
	}
	return res;
}
ll divmod(ll a, ll b, ll m) { // a/b(mod m)
								  // a/b (mod m)
								  // a*b^-1
								  // b^-1 * b = 1
								  // b^(m-1) = 1 
								  // b^(m-2) * b = 1
								  // b^-1 = b^(m-2)

								  // a/b = a * b^(m-2)

	return (a * 1LL * mod_pow(b, m - 2, m)) % m;
}
ll ncr(ll n, ll r) {
	return divmod(factorial(n), (factorial(r) * (factorial(n - r))) % MODU, MODU);
}


signed main() {
	unsigned long long n;
	cin >> n;
	if (n % 2) cout << 0;
	else {
		unsigned long long ans = 0, base = 10;
		for (int i = 0; base <= n; i++) {
			ans += n / base;
			base *= 5;
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define deb(x)     cerr << (#x) << " : " << (x) << "\n"
#define ll long long int
#define ld long double
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
using namespace std;
 
ll powmod(ll a, ll b, ll mod = MOD){
	if(!a and !b)	return 1ll;
	if(!a)	return a;
	ll res = 1ll;
	b %= (mod - 1ll), a %= mod;
	while(b){
		if(b%2 == 1)	res = (res * a) % mod;
		a = (a * a) % mod;
		b /= 2;
	}
	return res;
}

 
int main(){	

 
	ios::sync_with_stdio(false);
	cin.tie(NULL);
 
	int n, a, b;
	cin >> n >> a >> b;
	cout << min(a, b) << " " << max(0, a + b - n);	
}

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

#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descsort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main(void)
{
    string  s;
    cin>>s;
    int ans=0;
    string eval="CODEFESTIVAL2016";
    rep(i,0,s.size()){
        if(s[i]!=eval[i])ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)


int main(){

    vector<vector<int>> c(3,vector<int>(3));
    REP(i,3){
        REP(j,3){
            cin >> c[i][j];
        }
    }

    vector<int> a(3);
    for(a[0] = 0; a[0] <= c[0][0];a[0]++){
        for(a[1] = 0; a[1] <= c[1][0];a[1]++){
            for(a[2] = 0; a[2] <= c[2][0];a[2]++){
                if(c[0][0]-a[0]==c[1][0]-a[1]&&c[2][0]-a[2]==c[1][0]-a[1]){
                    if(c[0][1]-a[0]==c[1][1]-a[1]&&c[2][1]-a[2]==c[1][1]-a[1]){
                        if(c[0][2]-a[0]==c[1][2]-a[1]&&c[2][2]-a[2]==c[1][2]-a[1]){
                            cout << "Yes" << endl;
                            return 0;
                        }
                    }
                }
            }
        }
    }
    cout << "No" << endl;

    return 0;
}

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


class Program {

	const long mod = 1000000007;
	//public static int[] max;

	static void Main(string[] args) {

		char[] cs = new char[] { ' ', ',' };
		//int val = int.Parse(Console.ReadLine());
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();
		//string[] strs = Console.ReadLine().Split(cs);

		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//int n = vals[0];
		//string res="";

		//int y = vals[0];
		//int x = vals[1];

		string str = Console.ReadLine();
		int a = str.Split('o').Length-1;
			//deug
			Console.WriteLine(700+(a*100));

		return;
	}


	//　String[]  ----->  int[]
	static int[] parseAry(string[] str) {
		int[] nums = new int[str.Length];
		for (int i = 0; i < str.Length; i++) { nums[i] = int.Parse(str[i]); }
		return nums;
	}
	//　String[]  ----->  long[]
	static long[] parseAryl(string[] str) {
		long[] nums = new long[str.Length];
		for (int i = 0; i < str.Length; i++) { nums[i] = int.Parse(str[i]); }
		return nums;
	}



	//文字列を1文字ずつString[]に入れる
	static string[] strAry(String str) {
		string[] re = new string[str.Length];
		for (int i = 0; i < str.Length; i++) { re[i] = str[i].ToString(); }
		return re;
	}

}

Measured memory_bytes: 13140
def sa(x,j):
    c=[]
    for i in range(1,len(x)):
        c.append(abs(int(x[j])-int(x[i])))
    return max(c)

N=int(input())
A=list(map(str,input().split()))
ans=0
for j in range(N):
    y=sa(A,j)
    if y>ans:
        ans=y

print(ans)

Measured memory_bytes: 9048
#[allow(dead_code)]
fn is_whitespace(c: &char) -> bool {
    c.is_whitespace()
}

#[allow(dead_code)]
fn is_eol(c: &char) -> bool {
    ['\r', '\n'].contains(c)
}

#[allow(unused_macros)]
macro_rules! input {
    ($var:ident, $($r:tt)*) => {
        input_inner!{$var, $($r)*}
    };

    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_mut, unused_variables, bare_trait_objects)]
        let mut next = move |f: &Fn(&char)->bool| -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|f(&c))
                .take_while(|c|!f(&c))
                .collect()
        };
        input_inner!{next, $($r)*};
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; eol ]) => {
        $next(&is_eol).split(' ').map(|x| x.parse::<$t>().unwrap()).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

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

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

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

    ($next:expr, parser) => {
        $next
    };

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

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};

#[allow(dead_code)]
struct Edge {
    from: usize,
    to: usize,
}

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1_000_000_007;

fn main() {
    input! {
        n: usize,
        m: usize,
        mut a: [f64; n],
    }

    let sum = a.iter().sum::<f64>();
    let mut cnt = 0;
    for i in 0..n as usize {
        if a[i] >= sum / 4.0 / m as f64 {
            cnt += 1;
        }
    }
    if cnt >= m as usize {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
//RGB Cards
#include <iostream>
using namespace std;
int main(){
	
	int r,g,b;
	while (cin>>r>>g>>b){
		if ((r*100+g*10+b)%4==0){
			cout<<"YES"<<endl;
		}else {
			cout<<"NO"<<endl;
		}
	}
} 

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(long long i=(long long)(a);i<(long long)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 998244353
#define PI 3.1415926535
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	ll x, ans;

	cin>>x;

	if(x%11>6){
		ans=2;
	}else if(x%11>0){
		ans=1;
	}else{
		ans=0;
	}

	ans+=(x/11)*2;

	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z temp.cpp
//./a.exe

ll gcd(ll c, ll d) { return d ? gcd(d, c%d) : c;}
ll lcm(ll c, ll d) { return c / gcd(c,   d) * d;}


    


int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
int ans=0;
string s;
cin  >> s;
rep(i,s.size()){
    if (s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T')
    {
        s[i]='$';
    }
    
}

vector <int> v;
v.push_back(-1);

rep(i,s.size()){
    if (s[i] !='$')
    {
        v.push_back(i);
    }
    
}
v.push_back(s.size());
rep(i,v.size()-1){
    ans=max(ans,v[i+1]-v[i]-1);
}
if (v.size()==2)
{
    cout << s.size() << endl;
}else
{
    cout << ans << endl;
}




//////////////////////////////////////////////////////
return 0;}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()

using ll = long long;
using P = pair<int,int>;
using mp =  map<int,int>;

const int MOD = 1e9 + 7;

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

    int n, m;
    cin >> n >> m;
    int cnt[n+1] = {0};
    rep(i, m){
        int x ,y;
        cin >> x >> y;
        if(x == 1) cnt[y]++;
        if(y == n) cnt[x]++;
    }

    bool ok = false;
    for (int i = 1; i <= n; ++i) {
        if(cnt[i] == 2){
            ok = true;
            break;
        }
    }

    cout << (ok? "POSSIBLE": "IMPOSSIBLE") << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
#include<map>
using namespace std;
int main() {
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;
    double max = 0.0;
    int situryou = 100*A, yousitu = 0;
    int a = 0, b = 0, c = 0, d = 0;
    for(a = 0; a <= 30;a++){
        for(b = 0; b <= 30;b++){
            int l = 100*A*a + 100*B*b;
            for(c = 0; c <= 100;c++){
                for(d = 0; d <= 100;d++){        
                    int m = C*c + D*d;
                    if(l == 0) break;
                    if((100*a*A+100*b*B)/100*E>=C*c+D*d && l + m <= F){
                        //比較をする時はdouble型で格納するのが良い
                        double noudo = (double)100*m/(l + m);
                        if(max < noudo){
                            max = noudo;
                            situryou = 100*a*A+100*b*B+C*c+D*d;
                            yousitu  = C*c+D*d; 
                        }
                    } 
                }
            }
        }
    }
    cout << situryou << " " << yousitu << endl;
    return 0;
}

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

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n + 1)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// debug
#define test(x) cout << #x << " = " << x << endl

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define yes(c) cout << ((c) ? "yes" : "no") << endl;
 
#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;

int main() {
  
  int x,a;
  cin >> x;
  
  int saidai = 1;
  
  for ( int i = 2; i < sqrt(x); i++){
    a = i;
    while( a <= x ){
      a *= i;
    }
    if ( a != x ){
      a /= i;
    }
    if ( saidai < a ){
      saidai = a;
    }
  }
  
  cout << saidai << endl;
  
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int mod=1e9+7;
#define N 505
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int n,m,cnt[N],ans,fac[N],inv[N];
int dp[2][N][N],C[N][N]; // 区间长度到i，区间个数j，区间长度和 k。 
inline int qpow(int a,int b){
	int ans=1;
	while(b){
		if(b&1)ans=1LL*ans*a%mod;
		a=1LL*a*a%mod;
		b>>=1;
	}
	return ans;
}
void init(int n){
	C[0][0]=1;
	for(int i=1;i<=n;++i){
		C[i][0]=1;
		for(int j=1;j<=i;++j){
			C[i][j]=(C[i-1][j]+C[i-1][j-1])%mod;
		}
	}
}
int main(){
	n=read(),m=read();
	for(int i=1;i<=n;++i){
		++cnt[read()];
	}
	init(m);
	dp[(m+1)&1][0][0]=1;
	for(register int i=m;i>=1;--i){
		memset(dp[i&1],0,sizeof(dp[i&1]));
		for(int j=0;j<=m/i;++j){
			for(int k=0;k<=m;++k){
				if(!dp[(i+1)&1][j][k])continue;
				int lim=min((m-k)/i,m-j);
				for(int p=0;p<=lim;++p){
					dp[i&1][j+p][k+p*i]=(dp[i&1][j+p][k+p*i]+1LL*dp[(i+1)&1][j][k]*C[j+p][p])%mod;
				}
			}
		}
		for(int j=0;j<=m;++j){
			for(int k=j*(i-1);k<=m;++k){
				dp[i&1][j][k]=1LL*dp[i&1][j][k]*qpow(k-j*(i-1),cnt[i])%mod;
			}
		}
	}
	for(int j=0;j<=m;++j){
		for(int k=0;k<=m;++k){
			ans=(ans+1LL*dp[1][j][k]%mod*C[m-k+1][j]*((m-k)&1?-1:1))%mod;
		}
	}
	printf("%d\n",(ans+mod)%mod);
	return 0;
}



Measured memory_bytes: 6756
#include<bits/stdc++.h>
using namespace std;
int main(){
    string S;
    cin >> S;
    for(int i=S.length()-1; i>=0; i--){
        if(S.at(i)=='?') S.at(i)='D';
    }
    cout << S << endl;
    return 0;
}

Measured memory_bytes: 3752
#include<bits/stdc++.h>
using namespace std;
int s[4];
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	s[1]=a+b;
	s[2]=a+c;
	s[3]=b+c;
	int min=201;
	for(int i=1;i<=3;i++)
	{
		if(s[i]<min)
		    min=s[i];
	}
	cout<<min;
}

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

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);


            // 整数配列の入力
            var inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            // 整数配列の入力
            var inputLongArray2 = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            // 整数の入力
            var t = long.Parse(Console.ReadLine());

            string result = "";

            if (inputLongArray2[1] > inputLongArray[1])
            {
                result = "NO";

            } else {
                var initDifference = Math.Abs(inputLongArray[0] - inputLongArray2[0]);
                var difference = (inputLongArray2[1] - inputLongArray[1]) * t;
                if (initDifference + difference <= 0)
                {
                    result = "YES";
                }
                else
                {
                    result = "NO";
                }
            }

            

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


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

namespace ConsoleApp14
{
    class Program
    {
        static void Main(string[] args)
        {
            var solver = new Solver();
            solver.Calc();
        }
    }

    public class Solver
    {


        public void Calc()
        {
            var N = int.Parse(Console.ReadLine());
            var Ps = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();


            var min = Ps[0];
            var count = 1;
            for (var i = 1; i < N; i++)
            {
                if (min >= Ps[i])
                {
                    count++;
                }
                min = Math.Min(min, Ps[i]);
            }

            Console.WriteLine(count);

        }
    }
}

Measured memory_bytes: 34012
import sys
sys.setrecursionlimit(1000000000)
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())

def main():
    N = ii()
    A, B, C = lmis(), lmis(), lmis()
    ans = B[A[0]-1]
    for i in range(1, N):
        a = A[i]-1
        ans += B[a]
        if A[i]-A[i-1]==1:
            ans += C[a-1]
    
    print(ans)

main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n,m;
  cin >> n >> m;
  int j;
  vector<vector<long>> i(n,vector<long>(2));
  for (j = 0;j < n;j++){
    cin >> i[j][0] >> i[j][1];
  }
  sort(i.begin(),i.end());
  long sum = 0;
  long money = 0;
  for(j = 0;j < n;j++){
    if(i[j][1] + sum >= m){
      money += i[j][0] * (m - sum);
      break;
    }else{
      sum += i[j][1];
      money += i[j][0] * i[j][1];
    }
  }
  cout << money << endl;
}

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


int main()
{

    int N, K;
    cin >> N >> K;
    vector<int> h(N, 0);

    for (int i = 0; i < N; ++i){
        cin >> h[i];
    }
    sort(h.begin(), h.end());

    int ans = 1 << 30;
    for (int i = 0; i < N - K + 1; ++i){
        ans = min(ans, h[i + K - 1] - h[i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

vector<int> Zalgo(string s){
    int n=s.size();
    vector<int> a(n,0);
    int from=-1,last=-1;
    for(int i=1;i<n;i++){
        int &same=a[i];
        if(from!=-1){
            same=min(a[i-from],last-i);
            same=max(0,same);
        }
        while(i+same<n&&s[same]==s[i+same]){
            same++;
        }
        if(last<i+same){
            last=i+same;
            from=i;
        }
    }
    a[0]=n;
    return a;
}

struct UnionFind{
    vector<int> par,num;
    vector<bool> done;
    UnionFind(int n):par(n),num(n,1),done(n,false){
        iota(par.begin(),par.end(),0);  //include<numeric>
    }
    int find(int v){
        return (par[v]==v)?v:(par[v]=find(par[v]));
    }
    void unite(int u,int v){
        u=find(u),v=find(v);
        if(u==v)return;
        if(num[u]<num[v])swap(u,v);
        num[u]+=num[v];
        par[v]=u;
        done[u]=done[u]|done[v];
    }
    bool same(int u,int v){
        return find(u) == find(v);
    }
    bool ispar(int v){
        return v=find(v);
    }
    int size(int v){
        return num[find(v)];
    }
};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s,t; cin >> s >> t;
    string r=t;
    while(r.size()<t.size()+s.size()+t.size()){
        r+=s;
    }
    int n=s.size();
    int m=t.size();
    vector<bool> can(n,false);
    auto z=Zalgo(r);
    for(int i=m;i<m+n;i++){
        if(z[i]>=m)can[i-m]=true;
    }
    int res=0;
    UnionFind uf(n);
    for(int i=0;i<n;i++){
        if(can[i]){
            int j=(i+m)%n;
            if(uf.same(i,j)){
                printf("-1\n");
                return 0;
            }
            uf.unite(i,j);
        }
    }
    for(int i=0;i<n;i++){
        res=max(res,uf.size(i)-1);
    }
    printf("%d\n",res);
}

Measured memory_bytes: 17924
if __name__ == '__main__':
	A, B = map(int, input().split())
	MAX = B * 20
	c = 0
	for i in range(MAX):
		a = int(i * 0.08)
		b = int(i * 0.1)
		if a == A and b == B:
			print(i)
			c = 1
			break
	if c == 0:
		print(-1)

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		StringTokenizer st = new StringTokenizer(br.readLine());
		
		int A = Integer.parseInt(st.nextToken());
		int B = Integer.parseInt(st.nextToken());
		int C = Integer.parseInt(st.nextToken());
		
		if((A == B && A != C) || (A != B && A == C) || (B == C) && (B != A)){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}	

}

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

long long q,h,s,d,n,ans1,ans2;

int main()
{
	ans1=999999999999999999;
	ans2=999999999999999999;
	scanf("%lld %lld %lld %lld",&q,&h,&s,&d);
	scanf("%lld",&n);
	ans1=min(ans1,q*8);
	ans1=min(ans1,q*6+h);
	ans1=min(ans1,q*4+h*2);
	ans1=min(ans1,q*4+s);
	ans1=min(ans1,q*2+h*3);
	ans1=min(ans1,q*2+h+s);
	ans1=min(ans1,h*4);
	ans1=min(ans1,h*2+s);
	ans1=min(ans1,s*2);
	ans1=min(ans1,d);
	ans2=min(ans2,q*4);
	ans2=min(ans2,q*2+h);
	ans2=min(ans2,h*2);
	ans2=min(ans2,s);
	if((n&1)==1){
		printf("%lld",(n/2)*ans1+ans2);
	}else printf("%lld\n",(n/2)*ans1);
	return 0;
}

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

void main() {
    string s;
    scan(s);

    foreach (cmb ; 0 .. 8) {
        int ans = s[0] - '0';
        auto op = new char[](3);

        foreach (k ; 0 .. 3) {
            if (cmb & (1 << k)) {
                op[k] = '+';
                ans += s[k + 1] - '0';
            }
            else {
                op[k] = '-';
                ans -= s[k + 1] - '0';
            }
        }

        if (ans == 7) {
            writefln("%c%c%c%c%c%c%c=7", s[0], op[0], s[1], op[1], s[2], op[2], s[3]);
            return;
        }
    }
}



void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}



struct Queue(T) {
    private {
        int N, head, tail;
        T[] data;
    }

    this(int n) {
        N = n + 1;
        data = new T[](N);
    }

    bool empty() {
        return head == tail;
    }

    bool full() {
        return (tail + 1) % N == head;
    }

    T front() {
        return data[head];
    }

    void push(T x) {
        assert(!full);
        data[tail++] = x;
        tail %= N;
    }

    void pop() {
        assert(!empty);
        head = (head + 1) % N;
    }

    void clear() {
        head = tail = 0;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i, n) ;for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) ;for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF (922337203685477587+1)
#define sosuu 1000000007

int main()
{
  int N,M,C;
  cin >> N >> M >> C;
  int B[M],A[M];
  int check=0;
  int ans = 0;
  rep(i, M)
    cin >> B[i];
  rep(i, N){
  rep(j, M){
  
    cin >> A[j];
    check+=A[j]*B[j];    
  }
    if(check+C>0)
      ans++;
    check=0;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
//import java.lang.Math;
import java.util.*;
import java.util.Map.Entry;
//import java.util.ListIterator;
//import java.util.Iterator;
//import java.util.LinkedList;
 
public class Main{
	

	public static void main(String[] arg) {
               Scanner sc =new Scanner(System.in);
               TreeSet<Integer> ts= new TreeSet<Integer>();
               TreeSet<Integer> set1= new TreeSet<Integer>();
               int cnt=sc.nextInt();

               for(int i=0;i<cnt;i++){
            	  
                  set1.add(sc.nextInt());
                 }
               TreeSet<Integer> set2= new TreeSet<Integer>();
               int cnt2=sc.nextInt();

               for(int i=0;i<cnt2;i++){
                  set2.add(sc.nextInt());
                 }
                  
              ts.clear();
              ts.addAll(set1);
              ts.removeAll(set2);
             
               for(Iterator<Integer> it=ts.iterator();it.hasNext();){
               int xx=it.next();
               System.out.println(xx);
               }
	}
	}



Measured memory_bytes: 198476
#include<iostream>
using namespace std;
typedef long long ll;
#define N 100001
#define R 100001
#define MOD 1000000007
ll powmod(ll n,ll m){
  ll ans=1;
  for(int i=1;i<=n;i++){
    ans *= i;
    ans %= m;
  }
  return ans;
}
int main(){
  ll n,m,ans;
  cin >> n >> m;
  if(abs(n-m)>1){
    cout << "0\n";
    return 0;
  }
  ans = (powmod(n,MOD)*powmod(m,MOD))%MOD;
  if(n==m){
    ans *= 2;
  }
  ans %= MOD;
  cout <<ans << endl;
}


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

#define ll long long int
#define pb push_back
#define mk make_pair
#define mod 1000000007
//map<int, int>::iterator itr; 

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;t=1;
    while(t--){
        string s;
        cin>>s;
        cout<<s.substr(0,3);
    }
    return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <queue>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	ll h; cin >> h;
	ll cp=h;
	ll cnt=0;
	while(cp){
		cp/=2;
		cnt++;
	}
	ll k=1;
	for(int i=0;i<cnt;i++){
		k*=2;
	}
	cout << k-1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <time.h>
#include <algorithm>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <array>
#include <string>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define mp make_pair
#define eb emplace_back
#define F first
#define S second
using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ost;

const ll maxN = 1e7;
const ll INF = 1e17;
const ll MOD = 1e9 + 7;

ll xs[] = {-1, 1, 0, 0, -1, 1, 1, -1};
ll ys[] = {0, 0, -1, 1, -1, 1, -1, 1};

ll segtree[maxN << 2];
ll lazy[maxN << 2];
ll A[maxN];

inline ll left(ll x){
	return x << 1;
}

inline ll right(ll x){
	return (x<<1) + 1;
}

void build(ll node, ll start, ll end){
	if(start == end)
		segtree[node] = A[start];
	else{
		ll mid = (start + end)/2;
		build(left(node), start, mid);
		build(right(node), mid+1, end);
		segtree[node] = segtree[left(node)] + segtree[right(node)];
	}
}

void update(ll node, ll start, ll end, ll l, ll r, ll val){
	if(lazy[node] != 0){
		segtree[node] += (end-start+1)*lazy[node];
		if(start != end){
			lazy[left(node)] += lazy[node];
			lazy[right(node)] += lazy[node];
		}
		lazy[node] = 0;
	}
	if(start > end or l > start or r < end)
		return ;
	else if(start >= l and r >= end){
		segtree[node] += val;
		if(start != end){
			lazy[left(node)] += val;
			lazy[right(node)] += val;
		}
	}
	else{
		ll mid=(start + end)/2;
		update(left(node), start, mid, l, r, val);
		update(right(node), mid+1, end, l, r, val);
		segtree[node] = segtree[left(node)] + segtree[right(node)];
	}
}

ll sums(ll node, ll start, ll end, ll l, ll r){
	if(lazy[node] != 0){
		segtree[node] += (end-start+1)*lazy[node];
		if(start != end){
			lazy[left(node)] += lazy[node];
			lazy[right(node)] += lazy[node];
		}
		lazy[node] = 0;
	}
	if(l > end or r < start or start > end)
		return 0;
	if(l <= start and r >= end)
		return segtree[node];
	ll mid = (start+end)/2;
	return sums(left(node), start, mid, l , r) + sums(right(node), mid + 1, end, l , r);
}

int main(){
	cin.sync_with_stdio(false);
	cin.tie(0);
	ll a, b;
	cin >> a >> b;
	if(a > 8 or b > 8)
		cout << ":(";
	else
		cout << "Yay!";
	return 0;
}

Measured memory_bytes: 3508