akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
// #include "ane.cpp"

const int INF  = 1e9;
const long long INFLL = 1e18;
const int NMAX = 100005;
const int MMAX = 100005;
const int KMAX = 1005;
const int MOD  = 1e9 + 7;
using namespace std;

// comment to disable debug functions
#define DEBUG

// frequently used macros

#if __cplusplus >= 201103L
#define ALL(v) begin(v),end(v)
#define SORT(v) sort(begin(v), end(v))
#define FIND(v,x) find(begin(v), end(v), (x))
#else
#define ALL(v) (v).begin(),(v).end()
#define SORT(v) sort(v.begin(), v.end())
#define FIND(v,x) find(v.begin(), v.end(), (x))
#endif

#define MEMNEXT(from, to) do{ memmove((to), (from), sizeof(from)); \
memset((from), 0, sizeof(from)); } while(0)
#ifdef DEBUG
#define DUMP(x) do{ std::cerr << (#x) << ": " << x << std::endl; }while(0)
#else
#define DUMP(x) do{}while(0)
#endif

// frequent used aliases
typedef long long ll;
typedef pair<int, int> p;
typedef pair<ll, int> pl;
typedef pair<ll, ll> pll;
typedef vector<int> vec;
typedef vector<ll> vecll;
typedef vector<vec> mat;
typedef vector<vecll> matll;

// frequently used constants
static const int di[] = {-1, 0, 1, -1, 1, -1, 0, 1};
static const int dj[] = {-1, -1, -1, 0, 0, 1, 1, 1};

// frequently used structs
struct edge{
  int to,cost;
};

// printf for debug
#ifndef DEBUG
void debug(const char* format, ...){}
#else
void debug(const char* format, ...){
  va_list arg;
  va_start(arg, format);
  vprintf(format, arg);
  va_end(arg);
}
#endif

// dump vector
#ifdef DEBUG
#define DUMPV(v, c) do{       \
  printf("%s: ", #v);         \
  for (int i = 0; i < (c); ++i) \
  {                           \
  cout << (v)[i] << " ";      \
  }                           \
  cout << endl;               \
} while(0)
#else
#define DUMPV(v,c)
#endif

// std::fill of multi dimensions
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
  std::fill( (T*)array, (T*)(array+N), val );
}

// binary search
ll BSearch(ll _begin, ll _end, bool (*f)(int)){
  ll mid;
  while(_end - _begin > 1LL) {
  mid = (_begin + _end) / 2LL;
  if(f(mid)) {
    debug("BSearch: f(%d) == true\n", mid);
    _end = mid;
  }
  else
  {
    debug("BSearch: f(%d) == false\n", mid);
    _begin = mid;
  }
  }
  return _end;
}


ll N,M,K,A,B,C,D,E;
int dp[NMAX] = {};

string S;
vec v;

ll ans = 0;

void solve(){
  // main algorithm
  for (int i = 1; i < S.size(); ++i)
  {
    if (S[i] == S[i-1])
    {
      cout << i << " " << i + 1 << endl;
      return;
    }else if(i > 1 && S[i] == S[i-2]){
      cout << i - 1 << " " << i + 1 << endl;
      return;
    }
  }
  cout << "-1 -1\n";
}
void debug(){
  // output debug information

}
void answer(){
  // output answer
  // printf("%lld\n", ans);
}
int main(int argc, char const *argv[])
{
  // operate inputs

  // Fill(dp, -1);
  cin >> S;
  solve();
  #ifdef DEBUG
  debug();
  #endif
  answer();

  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <functional>
#include <cassert>
#include <utility>
#include <stack>
#include <queue>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef pair<int,int> Pi;
typedef long long int ll;
const int INF=(ll)(1<<30)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
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 dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

int m,n;

int main() {
	int q=1;
	cin>>n>>m;
	for(int i=0;i<m;i++)
		q*=2;
	ll ans=q*100*(n+18*m);
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int>> vvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;
typedef vector<P> vp;
typedef vector<vector<P>> vvp;
const int INF = 1001001001;
const ll LINF = 1e18;
const string endstr = "\n";

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    T r;
    while((r=a%b)) {
        a = b; b = r;
    }
    return b;
}
bool p_comp_fs(const P p1, const P p2){ return p1.first < p2.first;};
bool p_comp_fg(const P p1, const P p2){ return p1.first > p2.first;};
bool p_comp_ss(const P p1, const P p2){ return p1.second < p2.second;};
bool p_comp_sg(const P p1, const P p2){ return p1.second > p2.second;};
    
int main(){
    ll N, M; cin >> N >> M;
    if(N >= 2 && M >= 2) cout << (N - 2) * (M - 2) << endstr;
    if(N == 1 && M >= 2) cout << M - 2 << endstr;
    if(N >= 2 && M == 1) cout << N - 2 << endstr;
    if(N == 1 && M == 1) cout << 1 << endstr;
   
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007;
int dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};
int main() {
    int h,w,a,b;
    cin >> h >> w >> a >> b;
    vector<vector<int>> g(h);
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if(i < b && j < a || i >= b && j >= a) cout << 0;
            else cout << 1;
        }
        cout << endl;
    }

    return 0;
}

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

int main() {
    long long n;
    cin >> n;
    vector<long long> vec(n);
    for(int i=0; i<n; i++){
        cin >> vec.at(i);
    }
    sort(vec.begin(),vec.end());
    cout << vec.at(0) << " ";
    
    reverse(vec.begin(),vec.end());
    cout << vec.at(0) << " ";
    
    long long T=0;
    for(int i=0; i<n; i++){
        T+=vec.at(i);
    }
    cout << T << endl;
}


Measured memory_bytes: 3164
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

int main(){

	int n;
	while(cin>>n&&n!=0){
		vector<ll> v;
		for(int i = 0; i < n; i++){
			int t;
			cin>>t;
			v.push_back(t);
		}
		sort(v.begin(),v.end());
		
		ll sum=0;
		ll wait=0;
		for(int i = 0; i < n-1; i++){
			wait+=v[i];
			sum+=wait;
		}
		cout<<sum<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int N, Q, L;
int x[100010];
int h[25][100010];
int p2[30];

int main(){
    int p = 1;
    for(int i = 0; i < 30; i++){
        p2[i] = p;
        p *= 2;
    }

    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> x[i];
    }
    cin >> L;

    for(int i = 0; i < N; i++){
        int l = i, r = N;
        while(r - l > 1){
            int m = (r + l) / 2;
            if(x[m] - x[i] <= L)   l = m;
            else r = m;
        }
        h[0][i] = l;
    }

    for(int k = 1; k < 25; k++){
        for(int i = 0; i < N; i++){
            h[k][i] = h[k-1][h[k-1][i]];
        }
    }

    cin >> Q;
    for(int q = 0; q < Q; q++){
        int a, b; cin >> a >> b;
        a--; b--;
        if(a > b)   swap(a, b);
        int res = 0;
        int cur = a;

        for(int k = 23; k >= 0; k--){
            if(h[k][cur] < b){
                res += p2[k];
                cur = h[k][cur];
            }
        }

        cout << res + 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 11008
#include <bits/stdc++.h>
using namespace std;
//NOT TO SUBMIT IN WRONG PLACE OR BY WRONG COMPILER
//ABC, task C, 2020/04/26
//ms, ac
/*
*/

int main(void){
  int64_t N;
  map<string, int> s;
  int counter=0;
  string temp;

  cin >>N;
  while(counter<N){
    cin >>temp;
    s[temp]=counter;
    counter++;
  }

  cout <<s.size();

  return 0;
}
/*
*/


Measured memory_bytes: 19120
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>

using namespace std;


int card[10],n,k,sen[10];
vector<int> vec;

void dfs(int h,int num){

    if(h==k){
        for(int i=0;i<vec.size();i++)
            if(vec[i]==num) return;
        vec.push_back(num);
        return;
    }
    
    for(int i=0;i<n;i++){
        if(!sen[i]){
            sen[i]=true;
            dfs(h+1,num*pow(10,((int)log10(card[i])+1))+card[i]);
            sen[i]=false;
        }
    }
    
    return;
}

void solve(){
    
    for(int i=0;i<n;i++)
        scanf("%d",&card[i]);

    dfs(0,0);
    
    printf("%d\n",(int)vec.size());
    
    vec.clear();
    
    return;
}


int main(){
    
    while(1){
        scanf("%d%d",&n,&k);
        if(n+k==0) break;
        solve();
    }
    
    return 0;
}

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

int main(){
  for(int H;cin>>H,H!=0;){
    int sum = 0;
    vector<vector<int>> stone(5,vector<int> (H));

    // input
    for(int i=0;i<H;++i)
      for(int j=0;j<5;++j)
        cin>>stone[j][i];

    while(1){
      int count=0;

     /* for(int i=0;i<H;++i){
        for(int j=0;j<5;++j){
          cout<<stone[j][i];
        }
        cout<<"\n";
      }
      cout<<"\n";*/
      // count, and make stones 0
      for(int i=0;i<H;++i){ // Rows
        for(int j=1,num=1;j<5;++j){ // Columns
          if(stone[j-1][i]==stone[j][i]){ ++num; }
          else{
            if(num>=3){
              count += num * stone[j-1][i];
              // make stones 0
              for(int k=j-1;k>=j-num;--k) { stone[k][i]=0; }
            }
            num=1;
            if(j>3) { break; }
          }

          if(j==4&&num>=3){
            count += num * stone[j][i];
            for(int k=j;k>=j-num+1;--k) { stone[k][i]=0; }
            num=1;
          }
        }
      }

      if(count==0) { break; }

      sum += count;
     /* for(int i=0;i<H;++i){
        for(int j=0;j<5;++j){
          cout<<stone[j][i];
        }
        cout<<"\n";
      }
      cout<<"\n";
*/
      // fall
      for(int j=0;j<5;++j){
        for(int i=H-1;i>=0;--i){
          if(stone[j][i]==0) { 
            for(int k=i-1;k>=0;--k){
              if(stone[j][k]!=0){
                swap(stone[j][k], stone[j][i]); 
                break;
              }
            }
          }
        }
      }


 /*     for(int i=0;i<H;++i){
        for(int j=0;j<5;++j){
          cout<<stone[j][i];
        }
        cout<<"\n";
      }
      cout<<"\n";
      cout<<"sum = "<<sum<<"\n";*/
    }
    printf("%d\n",sum);
  }
  return EXIT_SUCCESS;
}

Measured memory_bytes: 1184
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
#define rep(i, a, n) for (int i = (a); i < (n); i++)
#define repr(i, n, a) for (int i = (n)-1; i >= (a); i--)
#define each(it, v) for (auto(it) = (v).begin(); (it) != (v).end(); (it)++)
#define all(v) (v).begin(), (v).end()
#define vi vector<int>
#define vvi vector<vi>
#define vd vector<double>
#define vvd vector<vd>
#define co(x) cout << (x)
#define con(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define out(x) rep(i, 0, x.size()) cout << x[i] << ((i != x.size() - 1) ? " " : "\n")
const double PI = 3.14159265;
const int MAXN = 1 << 15;
const ll LINF = 1LL << 60;
const int INF = 1 << 30;
#define Pr(a) (#a) << "=" << (a) << " "
#define pr(a) cout << Pr(a) << '\n'
///////////////////////////////////////////////////////////

int N;
vector<int> V;
deque<int> D;
list<int> L;

int main() {
  int q;
  cin >> N >> q;
  vector<vector<int>> A(N);
  while (q--) {
    int cmd, t;
    cin >> cmd >> t;
    if (cmd == 0) {
      int x;
      cin >> x;
      A[t].push_back(x);
    }
    if (cmd == 1) {
      if (A[t].size() != 0) {
        out(A[t]);
      } else {
        cout << '\n';
      }
    }
    if (cmd == 2) {
      A[t].clear();
    }
  }
  return 0;
}


Measured memory_bytes: 5696
#!/usr/bin/env python3
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a = [0]
b = [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])
ans = 0
j = M
for i in range(N+1):
    if a[i] > K:
        break
    while b[j] + a[i] > K:
        j -= 1
    ans = max(ans, i + j)
print(ans)

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

int main(){
  int a, b;
  cin >> a >> b;
  
  if (a < b) {
    cout << "a < b" << endl;
  }
  else if (a > b)
  {
    /* code */
    cout << "a > b" << endl;
  }
  else
  {
    cout << "a == b" << endl;
  }
  return 0;
}



Measured memory_bytes: 3124
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <string>

using namespace std;
int main(int argc, const char * argv[]) {
    
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    bool z=false;
    for (int i = 0; i < n; i++)
    {
        cin >> h[i];
        if (h[i]==0) z = true;
    }

    // if (z) k--; 

    int m=1000000000;
    for (int i = 0; i < n-k+1; i++)
    {
        m = min(m, abs(h[i]) + abs(h[i+k-1] - h[i]));
        m = min(m, abs(h[i+k-1]) + abs(h[i+k-1] - h[i]));
    }
    
    cout<<m<<endl;
    
    return 0;
}

Measured memory_bytes: 640
//Utkarsh.25dec
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// ordered_set s ; s.order_of_key(val)  no. of elements strictly less than val
// s.find_by_order(i)  itertor to ith element (0 indexed)
typedef vector<vector<ll>> matrix;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=100023;
bool vis[N];
vector <int> adj[N];
ll fact[N];
ll invfact[N];
ll inv[N];
void factorialsComputation()
{
    inv[0]=inv[1]=1;
    fact[0]=fact[1]=1;
    invfact[0]=invfact[1]=1;
    for(int i=2;i<N;i++)
    {
        inv[i]=(inv[mod%i]*(mod-mod/i))%mod;
        fact[i]=(fact[i-1]*i)%mod;
        invfact[i]=(invfact[i-1]*inv[i])%mod;
    }
}
void solve()
{
    ll n;
    cin>>n;
    vl v;
    v.pb(0);
    rep(i,n)
    {
        ll c;
        cin>>c;
        v.pb(c);
    }
    ll presum[n+1]={0};
    for(int i=1;i<=n;i++)
    {
        presum[i]+=presum[i-1];
        presum[i]+=inv[i];
        presum[i]%=mod;
    }
    ll ans=0;
    for(int i=1;i<n;i++)
    {
        ans+=((v[i+1]-v[i])*(presum[i]));
        ans%=mod;
    }
    ans*=fact[n-1];
    ans%=mod;
    cout<<ans<<'\n';
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    //cin>>T;
    int t=0;
    factorialsComputation();
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 9596
using System.Collections.Generic;
using System.Linq;
using System;

public class C
{
    public const int INF = 999999999;
}

public class P
{
    public int x { get; set; }
    public int y { get; set; }
}

public class Hello
{
    public static void Main()
    {
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var w = int.Parse(line[0]);
            var h = int.Parse(line[1]);
            if (w == 0 && h == 0) break;
            var map = new List<P>[5];
            var sp = new P(); var gp = new P();
            for (int i = 0; i < 5; i++) map[i] = new List<P>();
            for (int i = 0; i < h; i++)
            {
                var s = Console.ReadLine().Trim();
                for (int j = 0; j < w; j++)
                    if (s[j] == 'S') { sp.x = i; sp.y = j; }
                    else if (s[j] == 'G') { gp.x = i; gp.y = j; }
                    else if (s[j] != '.')
                    {
                        var a = int.Parse(s[j].ToString()) - 1;
                        map[a].Add(new P { x = i, y = j });
                    }
            }
            var maxc = 0;
            foreach (var x in map)
                maxc = Math.Max(maxc, x.Count());
            var minret = C.INF; var minc = -1;
            for (int i = 0; i < 5; i++)
            {
                var dp = new int[5, maxc];
                for (int j = 0; j < 5; j++)
                    for (int k = 0; k < maxc; k++) dp[j, k] = C.INF;
                var ret = GoDP(map, dp, sp, gp, i);
                if (ret < minret) { minret = ret; minc = i; }
            }
            if (minret == C.INF) Console.WriteLine("NA");
            else Console.WriteLine("{0} {1}", minc + 1, minret);
        }
    }
    public static int GoDP(List<P>[] map, int[,] dp, P sp, P gp, int sc)
    {
        var goal = C.INF;
        var t = sc + 1;
        if (t == 5) t = 0;
        for (int i = 0; i < map[t].Count(); i++)
            dp[t, i] = getMD(sp, map[t][i]);
        var nt = t + 1;
        if (nt == 5) nt = 0;
        for (int i = 0; i < 3; i++)
        {
            for (int j = 0; j < map[t].Count(); j++)
                for (int k = 0; k < map[nt].Count(); k++)
                    dp[nt, k] = Math.Min(dp[nt, k], dp[t, j] + getMD(map[nt][k], map[t][j]));
            t++;   nt++;
            if (t == 5) t = 0;
            if (nt == 5) nt = 0;
        }
        for (int i = 0; i < map[t].Count(); i++)
            goal = Math.Min(goal, dp[t, i] + getMD(gp, map[t][i]));
        return goal;
    }
    public static int getMD(P a, P b)
    {
        return Math.Abs(a.x - b.x) + Math.Abs(a.y - b.y);
    }
}

Measured memory_bytes: 10368
#文字列を取得する(QWERTYASDFZXCV)
strings = list(input())

#Aの一番小さいインデックス番号
place_smallest_A= 200000
place_largest_Z= 0

#for文で一番小さいインデックスのAを取り出す
for number in range(len(strings)):
  if strings[number] == "A":
    if number < place_smallest_A:
      place_smallest_A = number
      
#for文で一番大きいインデックスのZを取り出す
for number in range(len(strings)):
  if strings[number] == "Z":
    if number > place_smallest_A:
      place_smallest_Z = number

#A~Zの間でスライスする
ans = strings[place_smallest_A:place_smallest_Z+1]
#配列の長さを答える
print(len(ans))


Measured memory_bytes: 6308
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int n;
    cin>>n;
    vector<int>a(n);
    rep(i,n)cin>>a[i];
    sort(a.begin(),a.end());
    int z=a[n-1];
    double x=z;
    a.pop_back();
    int y=0;
    double mn=1e9+1;
    rep(i,n-1){
        if(abs((x+1)/2-a[i])<mn){
            mn=abs((x+1)/2-a[i]);
            y=a[i];
        }
    }
    cout<<z<<" "<<y<<endl;
    return 0;
}


Measured memory_bytes: 640
from bisect import bisect_left
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
S.sort()
ans = 0
for t in T:
    i = bisect_left(S, t)
    if 0<=i<n and S[i]==t:
        ans += 1
print(ans)


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

int main(){
  int food[30]={};
  int N, M;
  cin >> N >> M;
  for(int i=0; i<N; i++){
    int k; cin >>k;
    for(int j=0; j<k; j++){
      int a; cin >> a;
      food[a-1]++;
    }
  }
  int count=0;
  for(int i=0; i<M; i++){
    if(food[i]==N) count++;
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():
        n=int(input())
        H=list(map(int,input().split()))
        H.reverse()
        val=H[0]
        for i in range(1,n):
            if val>=H[i]:
                val=H[i]
            elif val==H[i]:
                continue
            elif H[i]-val==1:
                continue
            else: return 'No'
        return 'Yes'
    print(main())

    
resolve()

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

 int main()
 {
 	int n;
 	cin>>n;
 	long long sum = 0;
 	for(int i = 1;i<=n;++i){
 		if(i%3 != 0 && i%5 != 0) sum += i;
	}
	cout<<sum<<endl;
 	return 0;
 }

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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define mp make_pair
#define ll long long
#define all(x) x.begin(), x.end()
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2010
#define inf 1e9
#define MOD 1000000007

int main()
{

    ll n, m, x, y;
    cin >> n >> m >> x >> y;
    ll mx=-inf, my=inf;
    for(ll i = 0; i < n; i++)
    {

        ll z;
        cin >> z;
        mx = max(mx, z);
    }
    for(ll i = 0; i < m;i++)
    {

        ll z;
        cin >> z;
        my = min(z,my);
    }
    bool tf = 0;
    for(ll i = x+1; i <= y; i++)
    {

        if(i > mx && my>=i)
        {

            tf=1;
            break;
        }
    }
    if(tf) cout << "No War";
    else cout << "War";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using P = pair<int,int>;
using vl = vector<ll>; using vvl = vector<vl>;
#define mp make_pair
#define pb push_back
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,n) for (int i=(n-1);i >= 0;i--)
#define all(v) v.begin(),v.end()
#define sz(v) (int)((v).size())
#define MAX(v) *max_element(all(v))
#define MIN(v) *min_element(all(v))
#define Sort(v) sort(all(v))
#define Rev(v) reverse(all(v))
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,w) vector<vector<type>>name(h,vector<type>(w));in(name)
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cout << H << " ";
    debug_out(T...);
}
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
    for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
    return os;
}
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
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;}
const ll INF = 1LL << 60;
const ll mod = 1000000007;
const int dx[8] = {1,0,-1,0,1,1,-1,-1}; const int dy[8] = {0,1,0,-1,1,1,-1,-1};

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    int n;
    cin >> n;
    cout << (1000 - n % 1000)%1000 << endl;
}

Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
#define ll long long
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define clr(x,y) memset(x,y,sizeof(x))
#define in(a) a=read()
#define out(a) printf("%d\n",a)
inline ll read(){
    char c=getchar();ll f=1,x=0;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9')x=x*10+(c-'0'),c=getchar();
    return x*f;
}
#define mod 1000000007
void MOD(int &x){if(x>=mod)x-=mod;}
#define maxn 100010
#define inf (1<<30)

int main(){
	ll a,b;
	in(a);in(b);
	a--;
	ll ans1=0,ans2=0;
	if(!(a&1))a++,ans1=a;
	ll num=(a+1ll)/2ll;
	if(num&1)ans1^=1; 
	if(!(b&1))b++,ans2=b;
	num=(b+1ll)/2ll;
	if(num&1)ans2^=1; 
	if(a<0)cout<<ans2<<endl;
	else cout<<(ans2^ans1)<<endl;
}

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


#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()


using namespace std;
using namespace __gnu_pbds;

template<class T> using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
using ll  = long long;

using point = complex<double>;


void err(istream_iterator<string> it) {cerr << endl;}
template<typename T, typename... Args>void err(istream_iterator<string> it, T a, Args... args) {cerr << *it << " = " << a << endl;err(++it, args...);}


const double EPS = 1e-8;
const long long mod = 1e9 + 7;

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

const int N = 1e5 + 5;


int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string str,s;
    bool can = 1;
    vector<string>a,b;
    for(int i = 0; i < 2; ++i){
        cin >> str;
        a.push_back(str);
        s = str;
        reverse(all(s));
        b.push_back(s);
    }
    swap(b[0],b[1]);
    if(a == b)can = 1;
    else can = 0;
    cout << (can ? "YES\n" : "NO\n");

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

long	ft_abs(int abs)
{
	if (abs < 0)
		abs *= -1;
	return (abs);
}

int		main(void)
{
	long N, K, a;
	scanf("%ld%ld",&N,&K);
	if (N < K)
	{
		a = K - N;
		if (a > N)
			printf("%ld", N);
		else
			printf("%ld", a);
	}
	if (N >= K)
	{
		N %= K;
		if (N < K)
			a = K - N;
		if (a >= N)
			printf("%ld", N);
		else if (a < N)
			printf("%ld", a);
	}

	return 0;
}


Measured memory_bytes: 128
using System;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] In = Console.ReadLine().Split(' ');
            int[] P = new int[n];
            for(int i=0; i < n; i++)
            {
                P[i] = int.Parse(In[i]);
            }
            int cnt =0;
            for(int i = 1; i <= P.Length; i++)
            {
                if (P[i-1] != i) cnt++;
            }
            if (cnt == 0 || cnt == 2) Console.WriteLine("YES");
            else Console.WriteLine("NO");
        }
    }
}


Measured memory_bytes: 27532
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
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; }


int main() {
    string s, t;
    cin >> s >> t;
    ll n = s.size();
    ll m = t.size();
    ll cnt = 0;
    for (ll i=0; i<(n-m+1); i++) {
        ll count = 0;
        for (ll j=0; j<m; j++) {
            if (s[i+j]==t[j]) count++;
        }
        cnt = max(cnt, count);
    }
    ll ans = m - cnt; 
    cout << ans << endl;
    //printf("%.12f", ans);
}

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

const int mxN=100;
int n, x[mxN], y[mxN], h[mxN];

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for(int i=0; i<n; ++i)
		cin >> x[i] >> y[i] >> h[i];
	//Find a given point that has a positive h
	int a=-1;
	while(++a<n&&!h[a]);
	if(a>=n) {
		//No given points have positive h
		//Find any point not given in the input
		for(int cx=0; cx<=mxN; ++cx) {
			for(int cy=0; cy<=mxN; ++cy) {
				//Make sure the center doesn't coincide with any given points
				bool ok=1;
				for(int i=0; i<n&&ok; ++i)
					ok=cx!=x[i]||cy!=y[i];
				if(ok) {
					cout << cx << " " << cy << " 1";
					return 0;
				}
			}
		}
	}
	//Iterate through all possible O(n^2) center coordinates
	for(int cx=0; cx<=mxN; ++cx) {
		for(int cy=0; cy<=mxN; ++cy) {
			//Find the height
			int ch=h[a]+abs(cx-x[a])+abs(cy-y[a]);
			//Iterate through all points to make sure the information isn't contradicting
			bool ok=1;
			for(int i=0; i<n&&ok; ++i)
				ok=h[i]==max(ch-abs(cx-x[i])-abs(cy-y[i]), 0);
			if(ok) {
				cout << cx << " " << cy << " " << ch;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  cout<<n*n*n<<endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
  int n;
  cin >> n;
  int a[n];
  int b = 0;
  int cnt = 0;
  for(int i=0;i<n;i++){
    cin >> a[i];
    if(a[i] == b){
      cnt++;
      b = 0;
    }else{
      b = a[i];
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <functional>
using namespace std;

int main()
{
	int h, w, m;
	cin >> h >> w >> m;
	auto cntH = vector<int>(h);
	auto cntW = vector<int>(w);
	auto exist = set<pair<int, int>>();
	for(int i = 0; i < m; ++i){
		int x, y;
		cin >> y >> x;
		exist.insert(make_pair(x - 1, y - 1));
		++cntH[y - 1];
		++cntW[x - 1];
	}
	auto sortedH = vector<pair<int, int>>(h);
	auto sortedW = vector<pair<int, int>>(w);
	for(int i = 0; i < h; ++i){
		sortedH[i] = make_pair(cntH[i], i);
	}
	for(int i = 0; i < w; ++i){
		sortedW[i] = make_pair(cntW[i], i);
	}
	sort(sortedH.begin(), sortedH.end(), greater<pair<int, int>>());
	sort(sortedW.begin(), sortedW.end(), greater<pair<int, int>>());
	int maxHCnt = sortedH[0].first;
	int maxWCnt = sortedW[0].first;
	int ans = maxHCnt + maxWCnt;
	if(exist.find(make_pair(sortedW[0].second, sortedH[0].second)) != exist.end()){
		--ans;
		bool done = false;
		for(int i = 0; i < h; ++i){
			if(sortedH[i].first < maxHCnt) break;
			for(int j = 0; j < w; ++j){
				if(sortedW[j].first < maxWCnt) break;
				int x = sortedW[j].second;
				int y = sortedH[i].second;
				int s = sortedH[i].first + sortedW[j].first - (exist.find(make_pair(x, y)) == exist.end() ? 0 : 1);
				if(s > ans){
					ans = s;
					done = true;
				}else if(s < ans){
					done = true;
				}
				if(done) break;
			}
			if(done) break;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 24372
import sys

read = sys.stdin.buffer.read


def main():
    N, *A = map(int, read().split())

    ans = 0
    right = 0
    s = 0

    for left in range(N):
        while right < N and s & A[right] == 0:
            s ^= A[right]
            right += 1

        ans += right - left

        if left == right:
            right += 1
        else:
            s ^= A[left]

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 27720
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int main(){
    int n,m; cin >> n >> m;
    vector<vector<char>> a(50,vector<char> (50)),b(50,vector<char> (50));
    vector<char> B;
    rep(i,n) rep(j,n) cin >> a[i][j];
    rep(i,m) rep(j,m) cin >> b[i][j]; 
    
    bool exist = false;
    rep(i,n-m+1) rep(j,n-m+1){
        B.clear();
        for(int k=i;k<i+m;k++){
            for(int l=j;l<j+m;l++){
            B.push_back(a[k][l]);
            }
        }
        bool ok = true;
        rep(k,m){
            rep(l,m){                      //cout << B[k * m + l] << " " << b[k][l] << endl;;
                if(B[k * m + l] != b[k][l]){
                    ok = false;
                }
            }
        }
        //cout << ok << endl;
        if(ok) exist = true;
    }

    if(exist){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
}

    

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

using namespace std;

typedef long long ll;

const ll q = 10000000000 + 7;

int main() {
	
	int n;
	cin >> n;
	vector<int> a(n), b(n - 1);
	for (int i = 0; i < n-1; i++)
	{
		cin >> b[i];
	}
	a[0] = b[0];
	a[n - 1] = b[n - 2];
	for (int i = 1; i < n-1; i++)
	{
		a[i] = min(b[i - 1], b[i]);
	}
	int sum = 0;
	for (int i = 0; i < n; i++)
	{
		sum += a[i];
	}
	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <fstream>
using namespace std;
const long long M = 1000000007;
long long n, k, a[105], F[105][100005], S[105][100005];
int main()
{
    //freopen("CANDY.INP", "r", stdin);
    cin >> n >> k;
    for (int i = 1; i <= n; i++) cin >> a[i];

    F[0][0] = 1;
    for (int i = 0; i <= k; i++) S[0][i] = 1;
    for (int i = 1; i <= n; i++)
        for (int left = 0; left <= k; left++)
        {
                if (left - a[i] - 1 < 0) F[i][left] = S[i - 1][left];
                else F[i][left] = (S[i - 1][left] - S[i - 1][left - a[i] - 1] + M) % M;

                if (left - 1 < 0) S[i][left] = F[i][left];
                else S[i][left] = (S[i][left - 1] + F[i][left]) % M;
        }
    cout << F[n][k];
    return 0;
}


Measured memory_bytes: 160560
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {

    public static void main(String args[]) throws IOException {
        FastReader in = new FastReader();
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);
        Task.solve(in, out);
        out.close();
    }

    static class Task {

        public static void solve(FastReader in, PrintWriter out) {
            int n = in.nextInt();
            long k = in.nextLong();
            int[] a = new int[40];
            long[] d = new long[n];
            for(int i=0;i<n;i++){
                long x = in.nextLong();
                d[i] = x;
                int j=0;
                while(x!=0){
                    a[j] += (int)(x&1);
                    x=x>>1;
                    j++;
                }
            }
//            System.out.println(Arrays.toString(a));
            String s="";
            for(int i=0;i<40;i++){
                s+="0";
            }
            int j=0;
            while (j<=39){
                if(a[39-j]>=((n+1)/2)){

                }else{
                    s=s.substring(0,j)+"1"+s.substring(j+1);
                }
                if(Long.parseLong(s,2)>k){
                    s=s.substring(0,j)+"0"+s.substring(j+1);
                }
                j++;
//                System.out.println(s);
            }
            long x;
            if(s.equals("")){
                x = 0;
            }else{
                x = Long.parseLong(s,2);
            }

//            System.out.println(x);
            long ans = 0;

            for(long f:d){
                ans+=f^x;
            }
            System.out.println(ans);
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

Measured memory_bytes: 46200
//C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int maxn=2000003;
int main(){
  int n,t;
  ll now=0LL;
  ll bef=0LL;
  cin>>n>>t;
  for(int i=0;i<n;i++){
    ll tmp;
    cin>>tmp;
    if(tmp>=bef){
      now+=t;
      bef=tmp+(ll)t;
    }
    else{
      now+=max(0LL,tmp+(ll)t-bef);
      bef=max(bef,tmp+(ll)t);
    }
  }
  cout<<now<<endl;
  return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let r = read::<usize>();
    println!(
        "{}",
        if r < 1200 {
            "ABC"
        } else if r < 2800 {
            "ARC"
        } else {
            "AGC"
        }
    );
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define f(i,a,b) for(register int i=a;i<=b;++i)
#define ff(i,a,b) for(register int i=a;i>=b;--i)
#define debug(x) cerr << #x << " : " << x << " " << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
const ll mod = 998244353;
const ll mod1 = 2e18 + 7;
const double tiaohe = 0.57721566490153286060651209;
const int inf = 0x3f3f3f3f;
ll oula(ll x) { ll res = x;f(i, 2, x / i) { if (x % i == 0) { res = res / i * (i - 1);while (x % i == 0) x /= i; } }if (x > 1) res = res / x * (x - 1);return res; }
ll quickmod(ll a, ll n, ll m) { ll s = 1;while (n) { if (n & 1) { s = s * a % m; }a = (a*a) % m;n = n / 2; }return s; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
void ex_gcd(ll a, ll b, ll &x, ll &y, ll &d) { if (!b) { d = a, x = 1, y = 0; } else { ex_gcd(b, a % b, y, x, d);y -= x * (a / b); } }
ll inv(ll t, ll p) { ll d, x, y;ex_gcd(t, p, x, y, d);return d == 1 ? (x % p + p) % p : -1; }
//double a = log(n) +tiaohe + 1.0 / (2 * n);
double eqa = (1 + sqrt(5.0)) / 2.0;
const int N = 6e5 + 5;
int t;

int main()
{
	//freopen("in.txt", "r", stdin);
	int n, k;
	while (cin >> n >> k)
	{
		cout << ((int)ceil(n*1.0 / k)) << endl;
	}
	return 0;
}

Measured memory_bytes: 3604
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {
	static final long MIN = -1000000001;
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		int Q = sc.nextInt();
		MultiSet first = new MultiSet(), second = new MultiSet();
		long constant = 0;
		for (int i = 0; i < Q; i++) {
			int type = sc.nextInt();
			if (type == 1) {
				int a = sc.nextInt();
				constant += sc.nextInt();
				if (!second.isEmpty()) first.add(second.removeSmallest());
				first.add(a);
				while (first.size > second.size + 1) {
					second.add(first.removeBiggest());
				}
			} else {
				long x = first.getBiggest();
				long ans = first.sumOfDists(x) + second.sumOfDists(x) + constant;
				out.println(x + " " + ans);
			}
		}
		
		out.flush();
	}
	
	static class MultiSet {
		private TreeMap<Integer, Integer> map = new TreeMap<>();
		long sumFromMin;
		int size;
		
		void add(int value) {
			Integer old = map.get(value);
			if (old == null) old = 0;
			map.put(value, old + 1);
			size++;
			sumFromMin += value - MIN;
		}
		
		boolean isEmpty() {
			return size == 0;
		}
		
		int removeSmallest() {
			Map.Entry<Integer, Integer> ret = map.pollFirstEntry();
			int key = ret.getKey();
			int value = ret.getValue();
			if (value > 1) {
				map.put(key, value - 1);
			}
			sumFromMin -= key - MIN;
			size--;
			return key;
		}
		
		int removeBiggest() {
			Map.Entry<Integer, Integer> ret = map.pollLastEntry();
			int key = ret.getKey();
			int value = ret.getValue();
			if (value > 1) {
				map.put(key, value - 1);
			}
			sumFromMin -= key - MIN;
			size--;
			return key;
		}
		
		int getBiggest() {
			return map.lastKey();
		}
		
		long sumOfDists(long value) {
			return Math.abs((value - MIN) * size - sumFromMin);
		}
	}
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 64980
x,y=gets.split.map!(&:to_i)
max=10000
for i in 1..10000
  if (i*0.08).to_i==x && (i*0.1).to_i==y
    if max>i
      max=i
    end
  end
end
if max==10000
  puts -1
else
  puts max
end


Measured memory_bytes: 14428
import itertools
import math

n = int(input())
length = list(map(int, input().split()))

if n <= 2 :
    print(0)
    exit()
per = list(itertools.combinations(length, 3))
count = 0
for i in range(len(per)):
    if len(per[i]) == len(set(per[i])) :
       if (math.fabs(per[i][0] - per[i][1]) < per[i][2]) and (per[i][2] < per[i][0] + per[i][1]):
           count += 1
print(count)

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

using namespace std;
#define pb push_back
#define db(x) cerr << #x << " = " << x << endl;
#define INF 0x3f3f3f3f3f3f3f3f
#define fi first
#define se second
#define vi vector<int>
#define vll vector<ll>
#define all(x) x.begin(), x.end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vii vector<pii>
#define ll long long
#define ull unsigned long long
typedef long double ld;

#define MAXN 312

int n;
int freq[4];
double ev[MAXN][MAXN][MAXN];
double evw[MAXN][MAXN][MAXN];
int vis[MAXN][MAXN][MAXN];

void solve(int a, int b, int c)
{
    if (a == 0 && b == 0 && c == 0)
    {
        ev[0][0][0] = 0;
        evw[0][0][0] = 0;
        return;
    }

    if (vis[a][b][c])
        return;
    vis[a][b][c] = 1;

    double p_waste = (n - (a + b + c))/double(n);
    evw[a][b][c] = p_waste / (1 - p_waste);
    ev[a][b][c] = 1;
    if (a)
    {
        solve(a - 1, b, c);
        double p = a/double(a+b+c);
        ev[a][b][c] += p * ev[a - 1][b][c];
        evw[a][b][c] += p * evw[a - 1][b][c];
    }
    if (b)
    {
        solve(a + 1, b - 1, c);
        double p = b/double(a+b+c);
        ev[a][b][c] += p * ev[a + 1][b - 1][c];
        evw[a][b][c] += p * evw[a + 1][b - 1][c];
    }
    if (c)
    {
        solve(a, b + 1, c - 1);
        double p = c/double(a+b+c);
        ev[a][b][c] += p * ev[a][b + 1][c - 1];
        evw[a][b][c] += p * evw[a][b + 1][c - 1];
    }
}

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        int v;
        scanf("%d", &v);
        freq[v]++;
    }
    solve(freq[1], freq[2], freq[3]);
    printf("%.10lf\n", ev[freq[1]][freq[2]][freq[3]] + evw[freq[1]][freq[2]][freq[3]]);
    
}

Measured memory_bytes: 577792
#include "bits/stdc++.h"
using namespace std;
#define repi(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)
#define rep(i,n) repi(i,0,n)
#define all(x) (x).begin(),(x).end()
#define tsort(v) sort((v).begin(), (v).end())
#define trev(v) tsort(v); reverse((v).begin(), (v).end())
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define el "\n"
#define co(x) cout<<(x)<<el
#define coc(c, a, b) if(c)co((a));else co((b))
#define YES(c) coc(c,"YES", "NO")
#define Yes(c) coc(c,"Yes", "No")
#define yes(c) coc(c,"yes", "no")
#ifdef tqktmp_1
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif
typedef long long lint;

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() {
    cin.tie(0);
    ios::sync_with_stdio(0);

    lint r, g;
    cin>>r>>g;
    co(2*g-r);
}

Measured memory_bytes: 256
s = input()

n = len(s)-1
s = int(s)
ans = 0

for i in range(1 << n):
    num = s
    c = 1
    for j in range(n):
        if i >> j & 1:
            ans += num % (10**c)
            num //= (10**c)
            c = 1
        else:
            c += 1
    ans += num

print(ans)



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

int cnt;

int main()
{
	int k,s;
	cin>>k>>s;
	for(int i=0;i<=k;i++)
	{
		for(int j=0;j<=k;j++)
		{
			int ij=s-i-j;
			if(ij>=0&&ij<=k) cnt++;
		}
	}
	cout<<cnt<<endl;
	return 0;
}

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

int main()
{

     int n;
     int k;
     scanf("%d",&n);
     scanf("%d",&k);
     char s[100];
     scanf("%s",s);
     if(s[k-1]>='A'&&s[k-1]<='Z')
     s[k-1]=s[k-1]+32;
     cout<<s<<endl;




    return 0;
}


Measured memory_bytes: 256