akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#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 ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int main() {
    int X, N;
    cin >> X >> N;
    vector<int> p(N);
    REP(i, N) cin >> p[i];
    int dist = 1000, ans = 0;
    FOR(i, -10, 102) {
        bool flag = true;
        REP(j, N)
            if(p[j] == i) flag = false;
        if(!flag) continue;
        if(abs(X - i) < dist) {
            dist = abs(X - i);
            ans = i;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#define ll long long
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long

#define INF 999999999

using namespace std;

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
// input
int n, a;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> n;
    cin >> a;

    cout << (n * n) - a << "\n";
}

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

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  const string vowel = "aiueo";
  char c;
  cin >> c;
  bool ans = any_of(begin(vowel), end(vowel), [=](char i) { return i == c; });
  cout << (ans ? "vowel" : "consonant") << endl;
}


Measured memory_bytes: 256
def myinput(rownum):
    res = []
    for i in range(rownum):
        temp = input().split(" ")
        res += temp
    return res

def main():
    r = int(myinput(1)[0])
    if r == 1:
        print(1)
    elif r % 2 == 0:
        print(0.5)
    else:
        print((int(r/2)+1)/r)

if __name__ == '__main__':
    main()

Measured memory_bytes: 38356
total_cards = int(input())

taro_score = 0
hanako_score = 0

for _ in range(total_cards):
    taro_card, hanako_card = input().split()
    
    if taro_card > hanako_card:
        taro_score += 3
    
    if hanako_card > taro_card:
        hanako_score += 3
    
    if hanako_card == taro_card:
        taro_score += 1
        hanako_score += 1

print(str(taro_score) + " " + str(hanako_score))



Measured memory_bytes: 5596
#include<bits/stdc++.h>
const int N=500005,M1=900000011,M2=800000011;
using namespace std;
int n,now,a[N],b1[N],b2[N],w1,w2,tp,a1,a2;
char S[N];
long long ans;
map<pair<int,int>,int>mp;
inline int pls(int x,int y,int M){
	return ((x+y)%M+M)%M;
}
inline void sol(bool fl){
	now=n,w1=w2=0;
	for(int i=1;i<=n;i++){
		//cerr<<i<<"===now:"<<now<<endl;
		if(fl)mp[{pls(1ll*b1[now]*a1%M1,1ll*w1*b1[n]%M1,M1),
		pls(1ll*b2[now]*a2%M2,1ll*w2*b2[n]%M2,M2)}]++;
		//cerr<<"ins "<<pls(1ll*b1[now]*a1%M1,1ll*w1*b1[n]%M1,M1)<<','<<
		//pls(1ll*b2[now]*a2%M2,1ll*w2*b2[n]%M2,M2)<<endl;
		if(S[i]>59)now+=S[i]-61;
		else{
			//cerr<<S[i]<<"?";
			tp=44-S[i];
			w1=pls(w1,tp*b1[now],M1);
			w2=pls(w2,tp*b2[now],M2);
		}
		if(fl)ans+=mp[{1ll*w1*b1[n]%M1,1ll*w2*b2[n]%M2}];
		//cerr<<"("<<w1<<','<<w2<<")\n";
	}
}
int main(){
	//freopen("dat.txt","r",stdin);
	//cerr<<(int)'+'<<' '<<(int)'-'<<' '<<(int)'>'<<' '<<(int)'<'<<endl;
	scanf("%d%s",&n,S+1);
	b1[1]=b2[1]=1;
	for(int i=1;i<=2*n;i++)
	//b1[i+1]=1ll*b1[i]*7%M1,b2[i+1]=1ll*b2[i]*11%M2;
	b1[i+1]=1ll*b1[i]*524287%M1,b2[i+1]=1ll*b2[i]*19260817%M2;
	sol(0),a1=w1,a2=w2,//cerr<<"INI:("<<a1<<','<<a2<<")\n",
	sol(1);
	printf("%lld",ans);
}

Measured memory_bytes: 37376
#include<bits/stdc++.h>
using namespace std;
//#include<boost/multiprecision/cpp_int.hpp>
//using boost::multiprecision::cpp_int;

#define int long long
#define cint cpp_int
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) (((a)+(b)-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2
#define PI acos(-1.0)

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;
typedef priority_queue<int> PQi;

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;}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vvout(VVi &v){for(int i=0;i<(v).size();i++) vout(v[i]);}
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 mypow(int x, int n, int m){if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
int digit(int k,int i){string s = to_string(k);return s[s.size()-i]-'0';}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
int leng(int n){string s=to_string(n); return s.size();}
int lesscount(int x,Vi &a){return lower_bound(a.begin(),a.end(),x)-a.begin();} //vector aにおけるx未満の数の個数
int orlesscount(int x,Vi &a){return upper_bound(a.begin(),a.end(),x)-a.begin();} //vector aにおけるx以下の数の個数
int morecount(int x,Vi &a){return a.size()-orlesscount(x,a);} //vector aにおけるxより大きい数の個数
int ormorecount(int x,Vi &a){return a.size()-lesscount(x,a);} //vector aにおけるx以上の数の個数
int count(int x,Vi &a) {return upper_bound(ALL(a),x)-lower_bound(ALL(a),x);}
Vi accum(Vi &v){Vi ret((v).size()+1);REP(i,0,(v).size()) ret[i+1]=ret[i]+v[i];return ret;}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}


void solve(long long N, long long R){
    if(N<10) cout<<R+100*(10-N)<<endl;
    else cout<<R<<endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
signed main(){
    long long N;
    scanf("%lld",&N);
    long long R;
    scanf("%lld",&R);
    solve(N, R);
    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,mod2 = 998244353;

void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

int main() {
    int r;
    cin >> r;
    cout << fixed << setprecision(10) <<  2*3.141592653589*r << endl;
    return 0;
}

Measured memory_bytes: 3788
-- SPDX-License-Identifier: X11
-- 2020-08-23
-- Multiple of 9

module Main where

import Data.Char (digitToInt)
import Data.List (foldl')

solve :: [Int] -> String
solve l = if foldl' (\x y -> (x + y) `mod` 9) 0 l == 0
            then "Yes"
            else "No"

parse :: String -> [Int]
parse = map digitToInt

main :: IO ()
main = getLine >>= \x -> putStrLn . solve . parse $ x


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

typedef long long ll;
#define x first
#define y second

const int N = 2e3 + 10;
const ll mod = 1e9 + 7;


int n, k, q, a[N];
int used[N];
int ans = 1e9;
set < int > s;

main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	#ifdef KEK
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	cin >> n >> k >> q;

	for (int i = 1; i <= n; ++i)
	{
		cin >> a[i];
		s.insert(a[i]);
	}
	for (int u : s)
	{
		for (int i = 1; i <= n; ++i) used[i] = 0;
		for (int i = 1; i <= n; ++i) if (a[i] < u) used[i] = 1;
		vector < int > cur, ae;
		//cout << u << endl;
		used[n + 1] = 1;
		for (int i = 1; i <= n + 1; ++i)
		{
			if (!used[i]) cur.push_back(a[i]);
			else 
			{
				if (cur.size() == 0) continue;
				
				sort(cur.begin(), cur.end());
				for (int j = 0 ; j < (int)cur.size() - k + 1; ++j) ae.push_back(cur[j]);
				cur.clear();
			}
		}

		sort(ae.begin(), ae.end());
		if (ae.size() < q) continue;
		ans = min(ae[q - 1] - u, ans);
	}
	cout << ans;
	
	return 0;	
}

Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>
int main(int argc, const char * argv[]){
    int n, i, tp = 0, hp = 0;
    char taro[1001], hana[1001];
    scanf("%d",&n);
    for( i = 0 ; i < n ; i++ ) {
        scanf("%s %s", taro, hana);
        if( strcmp(taro,hana) == 0 ) {
            tp += 1;
            hp += 1;
        }
        else if( strcmp(taro,hana) > 0 ){
            tp += 3;
        }
        else{
            hp += 3;
        }
    }
    printf("%d %d\n",tp,hp);
    return 0;
}

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

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

    list<int> li;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (i % 2 == 0) {
            li.push_back(x);
        } else {
            li.push_front(x);
        }
    }

    if(n & 1) {
        reverse(li.begin(), li.end());
    }

    vector<int> v;
    for (int x : li) {
        v.push_back(x);
    }

    for (int i = 0; i < n; i++) {
        cout << v[i] << " ";
    }
    cout << endl;


    return 0;
}

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

int main() {

  string S;
  cin >> S;

  if (S == "Sunny") {
    cout << "Cloudy" << endl;
  }
  else if (S == "Cloudy") {
    cout << "Rainy" << endl;    
  }
  else if (S == "Rainy") {
    cout << "Sunny" << endl;        
  }
 
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
int main(void)
{
    int n,a,b;
    cin>>n>>a>>b;
    if (abs(a - b) & 1)
        puts("Borys");
    else
        puts("Alice");
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<bits/stdc++.h>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define LOG_F 1
#define LOG(...) if(LOG_F) fprintf(stderr, __VA_ARGS__)

using namespace std;

/*
n
s
 */
int x,n;
char s[101];

int main(){
  cin >> n >> s;
  int ans = 0;
  REP(i,n){
    if(s[i]=='I')
      x++;
    else
      x--;

    ans = max(ans, x);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a*b/gcd(a,b);}
ll MOD=1000000007;



int main(){
  int n,m;cin>>n>>m;
  vector<pair<ll,int>> ma(n);
  rep(i,n){
    ll a;cin>>a;
    int b;cin>>b;
    ma.at(i).first=a;
    ma.at(i).second=b;
  }
  sort(all(ma));
  ll ans=0;
  ll tmp=0;
  for(auto p:ma){
    ans+=p.first*p.second;
    tmp+=p.second;
    if(tmp>=m){
      tmp-=p.second;
      ans-=p.first*p.second;
      ans+=p.first*(m-tmp);
      break;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <cmath>
#include <cstdio>
#include <iostream>
#include <queue>
#include <vector>

#include <algorithm>
#include <functional>
#include <iterator>
#include <map>
#include <numeric>
#include <set>
#include <string>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define INF (1 << 30)
#define ALEN(ARR) (sizeof(ARR) / sizeof((ARR)[0]))
#define MP make_pair
#define mp make_pair
#define pb push_back
#define PB push_back

#if DEBUG
#define _DEBUG(x) cout << #x << ": " << x << endl
#define _DDEBUG(x, y) cout << #x << ": " << x << ", " << #y << ": " << y << endl
#else
#define _DEBUG(x) ;
#define _DDEBUG(x, y) ;
#endif

#define ll long long
#define ull unsigned long long
#define MOD 1000000007

/** FOR VECTOR DEBUG */
template <typename T> ostream &operator<<(ostream &out, const vector<T> &v) {
  if (!v.empty()) {
    out << '[';
    copy(v.begin(), v.end(), ostream_iterator<T>(out, ", "));
    out << "\b\b]";
  }
  return out;
}

/* template end */

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

  int n, m;
  cin >> n >> m;
  if (n >= m) {
    cout << 0 << endl;
    return 0;
  }
  vector<int> v(m);
  REP(i, m) cin >> v[i];

  sort(v.begin(), v.end());
  vector<int> dv(m);

  REP(i, m - 1) dv[i] = v[i + 1] - v[i];
  sort(dv.begin(), dv.end());
  _DEBUG(dv);

  ll ans = accumulate(dv.begin(), dv.end() - (n - 1), 0);

#if DEBUG
  cout << "** RESULT **" << endl; // debug
#endif

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
import sys


def input(): return sys.stdin.readline().strip()


def main():
    N, M, K = map(int, input().split())
    A = [int(i) for i in input().split()]
    B = [int(i) for i in input().split()]

    a, b = [0], [0]
    for i in range(N):
        a.append(a[i] + A[i])

    for i in range(M):
        b.append(b[i] + B[i])

    ans, j = 0, M
    for i in range(len(a)):
        if a[i] > K:
            break
        while a[i] + b[j] > K:
            j -= 1
        ans = max(ans, i + j)

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 47376
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <cstdio>
#include <climits>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

int arr[100010];
int main() {
    //cout << fixed << setprecision(8);

    LL A, B, C; cin >> A >> B >> C;
    LL K; cin >> K;
    if(K%2==0){
        cout << A-B << endl;
    }else{
        cout << B-A << endl;
    }
    return 0;
}

Measured memory_bytes: 256
a,b=map(int,input().split())
ret=[]
for i in range(50):
    ret.append(list("#"*100))
for i in range(50):
    ret.append(list("."*100))
a-=1
b-=1
i=0
j=0
while a>0:
    ret[i][j]="."
    j+=2
    a-=1
    if j>=99:
        j=0
        i+=2
i=99
j=0
while b>0:
    ret[i][j]="#"
    j+=2
    b-=1
    if j>=99:
        j=0
        i-=2
print(100,100)
for i in range(100):
    print("".join(ret[i]))

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

int main(){
  int n,now,next;cin>>n;bool f=1;
  vector<int> x(n,0);
  REP(i,n) cin>>x.at(i);
  sort(x.begin(),x.end());
  now=x.at(0);
  REP(i,n-1){
    next=x.at(i+1);
    if(now==next) f=0;
    now=next;
  }

  cout<<(f?"YES":"NO");
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int out_print(vector<int> b, int N, int num) {
  cout << num << endl;
  if(num == 0) return 0;
  
  for(int i = 0; i < N; i++) {
    if(b[i] == 1) {
      cout << (i+1) << " "; 
    }
  }
  return 0;  
}
 
int is_odd(vector<int> &b, int N, int k) {
  int sum = 0;
  for(int j = 1;;j++) {
    int index = k * j;
    if( index > N ) break;
    sum += b[index - 1];
  }
  return sum % 2;
}
 
int main(void) {
  int N;
  cin >> N;
  vector<int> a(N);
  vector<int> b(N);
  for(int i = 0; i < N; i++) {
    cin >> a[i]; 
    b[i] = 0;
  }
  
  if(N == 1) {
    b[N-1] = a[N-1];
    out_print(b, N, b[N-1]); return 0;
  }
  
  int num = 0;
  for(int i = N - 1; i >= 0; i--) {
    int _is_odd = is_odd(b, N, i+1);
    b[i] = _is_odd ^ a[i];
    num += b[i];
  }
 
  out_print(b, N, num);
  return 0; 
}

Measured memory_bytes: 3200
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;

/*BigInteger
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
namespace xxx = boost::multiprecision;
using Bint = xxx::cpp_int;
using Real = xxx::number<xxx::cpp_dec_float<1024>>;
*/

#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0LL, sizeof(x))
#define mm(x) memset((x), -1LL, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

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

// bit_macro
#define Bit(n) (1LL << (n))
#define Bitset(a, b) (a) |= (1LL << (b))
#define Bitunset(a, b) (a) &= ~(1LL << (b))
#define Bitcheck(a, b) ((((a) >> (b)) & 1LL) == 1LL)
#define Bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
constexpr int INF = (int)1e18;
constexpr int MOD = (int)1e9 + 7;
constexpr double PI = (double)acos(-1);
constexpr double EPS = (double)1e-10;
constexpr int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
constexpr int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
} Accelerate_Cin;

int N;
vector<string> s;

signed main() {
  cin >> N;
  s.resize(N);
  for (int i = 0; i < N; i++) cin >> s[i];

  int a = 0, b = 0, ab = 0, x = 0;
  for (int i = 0; i < N; i++) {
    if (s[i][0] == 'B' && s[i][s[i].size() - 1] != 'A') b++;
    if (s[i][s[i].size() - 1] == 'A' && s[i][0] != 'B') a++;

    if (s[i][0] == 'B' && s[i][s[i].size() - 1] == 'A') x++;

    for (int j = 0; j + 1 < s[i].size(); j++) {
      string tmp = s[i].substr(j, 2);
      if (tmp == "AB") {
        ab++;
      }
    }
  }

  if (x == 0) {
    cout << ab + min(a, b) << endl;
  } else {
    if (a + b > 0) {
      cout << ab + x + min(a, b) << endl;
    } else {
      cout << ab + x - 1 << endl;
    }
  }
  return 0;
}


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

int main()
{
    int M, D;
    cin >> M >> D;

    int ans = 0;
    for (int m = 1; m <= M; m++)
    {
        for (int day = 1; day <= D; day++)
        {
            int d1 = day % 10;
            int d10 = day / 10;
            if (d1 >= 2 && d10 >= 2 && (d1 * d10 == m))
            {
                ans++;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
def main():
    a, b, c = sorted([int(i) for i in input().split()])
    m = max(a,b,c)
    if 3*m%2 == (a+b+c)%2:
        print((3*m-(a+b+c))//2)
    else:
        print((3*(m+1)-(a+b+c))//2)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
import java.util.Scanner;

class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Scanner sc) {
		int A = sc.nextInt();
		int B = sc.nextInt();
		int M = sc.nextInt();
		int[] a = new int[A];
		int[] b = new int[B];
		int mina = Integer.MAX_VALUE;
		for (int i = 0; i < A; i++) {
			a[i] = sc.nextInt();
			mina = Math.min(mina, a[i]);
		}
		int minb = Integer.MAX_VALUE;
		for (int i = 0; i < B; i++) {
			b[i] = sc.nextInt();
			minb = Math.min(minb, b[i]);
		}
		int min = mina + minb;
		for (int i = 0; i < M; i++) {
			int f = a[sc.nextInt() - 1];
			int r = b[sc.nextInt() - 1];
			min = Math.min(f + r - sc.nextInt(), min);
		}
		System.out.println(min);
	}
}

class Main {
	public static void main(String... args) {
		Scanner in = new Scanner(System.in);

		Solver.INSTANCE.solve(in);

		in.close();
	}
}

Measured memory_bytes: 149256
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<algorithm>
using namespace std;

int main(void)
{
	int N, M;
	cin >> N >> M;

	vector<int> X(M);
	for(int i=0; i<M; i++)
		cin >> X[i];

	sort(X.begin(), X.end());

	vector<int> d(M-1);
	for(int i=0; i<d.size(); i++)
		d[i] = X[i+1] - X[i];

	sort(d.begin(), d.end());

	long long sum = 0;
	for(int i=0; i<(int)d.size()-(N-1); i++)
		sum += d[i];

	cout << sum << endl;

	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define endl "\n"
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=3e5+10;
int32_t main()
{
    IOS;
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='?')
        {
            s[i]='D';
        }
    }
    cout<<s<<endl;
    
 
}

Measured memory_bytes: 3736
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a[9],n=3;
	for(int i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n);
	a[2]*=10;
	cout<<a[0]+a[1]+a[2]<<endl;
	return 0;
}

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

using namespace std;

bool f(vector<long long> a, long long x){
  long long index = 0;
  for(int b = 59; b >= 0; b--){
    long long flag = 0;
    for(long long j = index; j < a.size(); j++){
      if(a[j] & (1ll << b)){
        flag = 1;
        swap(a[j], a[index]);
        break;
      }
    }
    for(long long j = index + 1; j < a.size(); j++){
      if(a[j] & (1ll << b)){
        a[j] ^= a[index];
      }
    }
    if(flag == 1){
      index++;
    }
  }
  
  index = 0;
  for(int b = 59; b >= 0; b--){
    if((1ll << b) & x){
      if(a[index] & (1ll << b)){
        x ^= a[index];
        index++;
      }
    }
    while(index < a.size() && (a[index] & (1ll << b))){
        index++;
    }
    if(x == 0) return true;
    if(index == a.size()) return false;
  }
  return false;
}

int main(){
  int T;
  cin >> T;
  
  while(T--){
    int N;
    cin >> N;
    
    vector<long long> A(N);
    for(int i = 0; i < N; i++) cin >> A[i];
    
    string S;
    cin >> S;
    
    if(S[N - 1] == '1'){
      puts("1");
      continue;
    }
    
    bool zero = true;
    vector<long long> a;
    for(int i = N - 1; i >= 0; i--){
      if(S[i] == '0'){
        a.push_back(A[i]);
      }else{
        if(!f(a, A[i])){
          zero = false;
          break;
        }
      }
    }
    
    if(zero) puts("0");
    else puts("1");
  }
  
  return 0;
}

Measured memory_bytes: 3536
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <set>
#include <map>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

using ll = long long;
using ldb = long double;

#define forn(i, x, n) for (int i = x; i < (int)(n); ++i)
#define forcin(a, n) for (int i = 0; i < n; cin >> a[i], ++i)
#define forb(i, x, n) for (int i = (int)(x); i >= n; --i)
#define mmax(a, b, c) max(a, max(b, c))
#define mmin(a, b, c) min(a, min(b, c))
#define pb push_back
#define mp make_pair

const int N = 100500 * 3;
const long double eps = 1e-11;

int a[N];
int cnt[3];

int main() {
    int x, y;
    cin >> x >> y;
    y /= 1000;
    forn(i, 0, x + 1) {
        forn(j, 0, x - i + 1) {
            if (i * 10 + j * 5 + (x - i - j) == y) {
                cout << i << " " << j << " " << (x - i - j);
                return 0;
            }
        }
    }

    cout << "-1 -1 -1\n";
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define SIZE_OF_ARRAY(a) (sizeof(a)/sizeof(a[0]))

unsigned GetDigit(unsigned num){
    return std::to_string(num).length();
}



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll ans = 0;
    string ans2;
    ll X;
    cin >> X;
    for(ll i = 1000;i > 1;i--){
        for(ll j = 1000;j > 0;j--){
            if(pow(j,i) <= X && pow(j,i) > ans){
                ans = pow(j,i);
                break;
            }
        }
    }
    cout << ans <<endl;
}

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

int main() {
  int N;
  cin >> N;
  set<int> st;
  int x = N;

  while (st.count(x) == 0) {
    st.insert(x);
    if (x % 2 == 0) {
      x /= 2;
    } else
      x = x * 3 + 1;
  }

  cout << (st.size() + 1) << endl;
}

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

int main() {
  int perimeter,numHouses;
  cin >> perimeter >> numHouses;
  int houses[numHouses];
  for(int i=0;i<numHouses;i++){
  	 cin >> houses[i];
  }
  int distances[numHouses];
  int maxDist = houses[0]+perimeter - houses[numHouses - 1];
  distances[numHouses-1] = maxDist;
  for(int i=0;i<numHouses-1;i++){
  	distances[i] = houses[i+1] - houses[i];
    if(distances[i]>maxDist){
      maxDist=distances[i];
    }
  }
  int result = 0;
  for(auto& num : distances){
    result += num;
  }
  result -= maxDist;
  cout << result;
}

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

#define endl '\n'
#define int ll
typedef long long ll;

const int MAX_N = 1e5 + 87;

int h[MAX_N] = {};
int dp[MAX_N] = {};

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

    int N, K;
    cin >> N >> K;
    for (int i = 1; i <= N; i++)
        cin >> h[i];
    for (int i = 1; i <= N; i++)
        dp[i] = -1;
    
    dp[1] = 0;
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= K; j++) {
            int pos = i + j;
            if (pos > N) continue;
            int cost = dp[i] + abs(h[i] - h[pos]);
            if (dp[pos] > cost || dp[pos] == -1) {
                dp[pos] = cost;
            }
        }
    }

    cout << dp[N];

    return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <iomanip>
#include <sstream>

using namespace std;
using ll = long long;

// inf
constexpr ll infl = 1LL << 60;
const int inf = 1 << 30;

int gcd(int a, int b) {
    if (b > a) swap(a, b);
    return a % b != 0 ? gcd(b, a % b) : b;
}

int main() {
    int N, X; cin >> N >> X;
    int ans = -1;
    for (int i = 0; i < N; ++i) {
        int x; cin >> x;
        if (ans == -1) {
            if (abs(x - X) > 0) ans = abs(x - X);
        }
        else {
            ans = gcd(ans, abs(x - X));
        }
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;

int main(){
    int n;
    cin >> n;
    if(n%2==0){
        cout << (n/2)*(n/2) << endl;   
    }else{
        cout << (n/2)*(n/2+1) << endl;
    }
    return 0;
}

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

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

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
#define pb  					push_back
#define mp 						make_pair
#define all(v) 					((v).begin()) ,((v).end())
#define let(o,v)				memset(o,v,sizeof (o))
typedef long long 				ll;
typedef vector<int>				vi;
typedef vector<vi>				vvi;
typedef vector<string>			vs;

const int MOD = 1e9+7;
const int oo = (int)1e9;
const ll OO = (ll)1e18;
const double PI = acos(-1.0);
const int N = (int)1e5 + 9;

bool isprime(ll n) {
	if (n <= 1)
		return 0;
	for (ll i = 2; i*i <= n; i++)
		if (n%i == 0)
			return false;
	return 1;
}
ll intlog(ll base, ll x) {
	return (log(x) / log(base));
}
bool prime[N];
void primee()
{

	for (int p = 2; p*p <= N; p++)
	{

		if (prime[p] == true)
		{
			for (int i = p * 2; i < N; i += p)
				prime[i] = false;
		}
	}

}
string decToBinary(ll n)
{
	string z = "";
	int i = 0;
	while (n > 0) {

		z += (n % 2) + 48;
		n = n / 2;
		i++;
	}
	reverse(all(z));
	return z;
}
ll gcd(ll a, ll b) {
	return b == 0 ? a : gcd(b, a%b);
}
ll power(ll x, int y)
{
	ll temp;
	if (y == 0)
		return 1;
	temp = power(x, y / 2);
	if (y % 2 == 0)
		return temp * temp;
	else
		return x * temp*temp;
}
int n, m;
string s, t, ans="";
int dp[3000][3000];
int calc(int idx,int idx2) {
	if (idx == n || m == idx2) {
		return 0;
	}
	int &ret = dp[idx][idx2];
	if (ret != -1) return ret;
	ret = 0;
	if (t[idx2] == s[idx]) {
		ret = 1 + calc(idx + 1, idx2 + 1);
	}
	else ret = max(calc(idx, idx2 + 1), max(calc(idx+1,idx2),calc(idx + 1, idx2 + 1)));
	return ret;
}
void build(int idx, int idx2) {
	if (idx == n || idx2 == m) return;
	if (t[idx2] == s[idx]) {
		ans += s[idx];
		build(idx + 1, idx2 + 1);
	}
	else {
		if (calc(idx, idx2 + 1) == dp[idx][idx2]) {
			build(idx, idx2 + 1);
		}
		else if (calc(idx + 1, idx2) == dp[idx][idx2]) {
			build(idx + 1, idx2);
		}
		else build(idx + 1, idx2 + 1);
	}
}
int main()
{
	cin >> s >> t;
	n = s.size();
	m = t.size();
	let(dp, -1);
	calc(0, 0);
	build(0,0);
	cout << ans << endl;
	return 0;
}

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

int main(void){
    int a,b,c,x;
    cin >> x;
    bool flag = false;
    for (int i = 0; i <= 26; i++){
        for (int j = 0; j <= 15; j++){
            if(4*i+7*j == x){
                flag = true;
                break;
            }
        }
        if(flag == true) break;
    }
    if(flag == true){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}

Measured memory_bytes: 256
package main

import (
    "fmt"
)

func main() {
    var str string
    fmt.Scanf("%s", &str)

    count := 0
    maxCount := 0
    for i := 0; i < len(str); i++ {
        if str[i] == 'R' {
            count++
        } else {
            if count != 0 && maxCount < count {
                maxCount = count
            }
            count = 0
        }
    }

    if (maxCount < count) {
        maxCount = count
    }

    fmt.Println(maxCount)
}

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

const int maxN = 2e3 + 10;
int a[maxN] = {0};

int main(){
    int n, x, y, ans = 0;
    cin >> n >> x >> y;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j < i; j++){
            a[min(i-j, abs(x - j) + abs(y - i) + 1)]++;
        }
    }
    for(int i = 1; i < n; i++)
        cout << a[i] << endl;
}


Measured memory_bytes: 256
n,m=map(int,input().split())

a=list(map(int,input().split()))
a.sort(reverse=True)

ans = []

for i in range(n):
    if a[i] >=sum(a)/4/m:
        ans.append(a[i])

if len(ans)>=m:
    print('Yes')
else:
    print('No')
        

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<cassert>
#include<numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
const int INF = 1001001001;
const long long LINF = 1001002003004005006ll;
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; }
typedef long long ll;
typedef pair<int,int> P;

int main(){
  int n;
  cin >> n;
  int a[n];
  rep(i,n)cin >> a[i];
  int s = 0;
  int r = 0;
  ll ans = 0;
  rep(l,n){
    while(r<n&&(s+a[r])==(s^a[r])){
      s+=a[r];
      r++;
    }
    ans += r-l;
    if(l==r){
      r++;
    }else{
      s-=a[l];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 4288
K = int(input())
S = input()
 
MAX = 2 * 10 ** 6 + 10
MOD = 10 ** 9 + 7
 
# Factorial
fac = [0] * (MAX + 1)
fac[0] = 1
fac[1] = 1
 
# Inverse
inv = [0] * (MAX + 1)
inv[1] = 1
 
# Inverse factorial
finv = [0] * (MAX + 1)
finv[0] = 1
finv[1] = 1
 
for i in range(2, MAX + 1):
    fac[i] = fac[i - 1] * i % MOD
    inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
    finv[i] = finv[i - 1] * inv[i] % MOD
 
 
def comb(n, k):
    if n < k or k < 0:
        return 0
    return (fac[n] * finv[k] * finv[n - k]) % MOD
 
 
ans = 0
n = len(S)
for k in range(K + 1):
    tmp = (pow(25, K - k, MOD) * pow(26, k, MOD)) % MOD
    ans += comb(n + K - k - 1, n - 1) * tmp % MOD
    ans %= MOD
 
print(ans)

Measured memory_bytes: 138160
#include<bits/stdc++.h>
#define fi 			first
#define se 			second
#define pb 			push_back
#define pf 			push_front
#define mod 		1000000007
//#define mod 998244353
//#define mod 1000000009
#define Pi 			3.14159265359
#define eps 		1e-9
#define all(v) 		v.begin(),v.end()
#define sz(v) 		((int)(v).size())
#define each(x, v)  for (auto &x : v)
#define pii         pair<int,int>
#define vi          vector<int>
#define vvi         vector<vi>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define endl        '\n'
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
typedef long long ll;
ll pw(ll a, ll b)
{
    ll ans = 1;
    while(b)
    {
        if(b & 1)
            ans = (ans * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans;
}
void Solution();

int main(){
    int T = 1;
//    ios::sync_with_stdio(false);
//    cin.tie(0);
//    cout.tie(0);
   // cin>>T;
    while(T--){
        Solution();
    }
    return 0;
}
void Solution(){
    int n,k;
    cin>>n>>k;
    int g[n+5];
    for (int i = 0; i < n+5; ++i) {
        g[i]=0;
    }
    int t,f;
    for (int i = 0; i < k; ++i) {
        scanf("%d",&t);
        for (int j = 0; j < t; ++j) {
            scanf("%d",&f);
            g[f]++;
        }
    }
    int count=0;
    for (int i = 0; i < n+5; ++i) {
        count+=g[i]?1:0;
        //cout<<g[i]<<" "<<i<<endl;
    }
    cout<<n-count<<endl;
}

Measured memory_bytes: 3764
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#include <queue>
    
#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;
using ll = long long;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    map<string, ll> mp;
    
    int N;
    cin >> N;
    REP(i, N){
        string S;
        cin >> S;
        sort(S.begin(), S.end());
        mp[S]++;
    }
    ll ans = 0;
    for(auto itr = mp.begin(); itr != mp.end(); itr++){
        //cout << itr->first << ":" << itr->second << endl;
        if(itr->second >= 2){
            ans += (itr->second)*(itr->second - 1)/2;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 11264
#include <bits/stdc++.h>
using namespace std;
int main() {
  long int a,b,c,d;
  long int e = 0;
  vector<int> x = {1,2,0,4,0,0,7,8,0,0,11,0,13,14};
  cin >> a;
  b = a/15;
  c = a%15;
  d = b*b*60;
    for (int i=0; i<c; i++){
      if (x.at(i) != 0){
        e += x.at(i)+(b*15);
      }
    }
  cout << d+e;
}

Measured memory_bytes: 3624
#include <map>
#include <set>
#include <ctime>
#include <queue>
#include <stack>
#include <cmath>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cctype>
#include <string>
#include <numeric>
#include <cstring>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std ;
#define int long long
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define loop(s, v, it) for (s::iterator it = v.begin(); it != v.end(); it++)
#define cont(i, x) for (int i = head[x]; i; i = e[i].nxt)
#define clr(a) memset(a, 0, sizeof(a))
#define ass(a, sum) memset(a, sum, sizeof(a))
#define lowbit(x) (x & -x)
#define all(x) x.begin(), x.end()
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define mp make_pair
#define pb push_back
#define pof pop_front
#define pob pop_back
#define fi first
#define se second
#define iv inline void
#define enter cout << endl
#define siz(x) ((int)x.size())
#define file(x) freopen(x".in", "r", stdin),freopen(x".out", "w", stdout)
typedef double db ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair <int, int> pii ;
typedef vector <int> vi ;
typedef vector <pii> vii ;
typedef queue <int> qi ;
typedef queue <pii> qii ;
typedef set <int> si ;
typedef map <int, int> mii ;
typedef map <string, int> msi ;
const int N = 100010 ;
const int INF = 0x3f3f3f3f ;
const int iinf = 1 << 30 ;
const ll linf = 2e18 ;
const int MOD = 1000000007 ;
const double eps = 1e-7 ;
void douout(double x){ printf("%lf\n", x + 0.0000000001) ; }
template <class T> void print(T a) { cout << a << endl ; exit(0) ; }
template <class T> void chmin(T &a, T b) { if (a > b) a = b ; }
template <class T> void chmax(T &a, T b) { if (a < b) a = b ; }
template <class T> void upd(T &a, T b) { (a += b) %= MOD ; }
template <class T> void mul(T &a, T b) { a = (ll) a * b % MOD ; }

int n ;
ll ans ;

signed main() {
	scanf("%lld", &n) ;
	// n = x * m + q
	rep(q, 1, 1000000) {
		if (q > n) continue ;
		if (n % q == 0) {
			ll x = n / q ;
			if (x >= 2 && q < x - 1) ans += (x - 1) ;
		}
	}
	cout << ans << endl ;
	return 0 ;
}

/*
写代码时请注意：
	1.ll？数组大小，边界？数据范围？
	2.精度？
	3.特判？
	4.至少做一些
思考提醒：
	1.最大值最小->二分？
	2.可以贪心么？不行dp可以么
	3.可以优化么
	4.维护区间用什么数据结构？
	5.统计方案是用dp？模了么？
	6.逆向思维？
*/




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
const ll MOD = 1e9 + 7;
const long long INF = 1LL << 60;

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

    ll answer = 0;
    for (ll i = 1; i <= n;i++){
        if(i%3!=0 && i%5!=0)
            answer += i;
    }
    cout << answer << endl;
}


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

using ll = int64_t;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

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

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

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  string s, t; std::cin >> s >> t;
  int a, b; std::cin >> a >> b;
  string u; std::cin >> u;
  if (s == u) a--;
  else if (t == u) b--;
  std::cout << a << " " << b << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main() {

  int n ;
  cin >> n;
  // long a[100];

  long min = 10000000000, max= 0;

  for(size_t i = 0; i < n; i++)
  {
    // cin >> a[i] ;
    int a;
    cin >> a;
    if (a > max) {
      max = a;
    }
    if (a < min) {
       min = a;
    }
    // cout << max << " " << min << endl;
  }

  cout << max - min << endl;

}


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

int n,a[100005][3],dp[100005][3];

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


Measured memory_bytes: 2688
k, x = map(int, input().split())
dif = k - 1
if dif == 0:
    print(x)
else:
    mini = x - dif
    maxi = x + dif
    a = []
    for i in range(mini, maxi + 1):
        a.append(str(i))
    s = ' '.join(a)
    print(s)

Measured memory_bytes: 61892
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"
#define pi 3.1415926535897932384626433832795028841971693993751058
#define maxn 100005

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define pq priority_queue
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
#define ceil(a,b) (a+b-1)/b
 
using namespace std;

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

//START OF CODE ->->->->->->->

void solve()
{
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,0,a.size()){
        cin>>a[i];
    }
    int dp[n] = {0};
    int sum = 0;
    rep(i,0,a.size()){
        if ( i == 0 ){
            dp[i] = a[i];
        }
        else if ( i == 1 ){
            dp[i] = a[i]*a[i-1];
        }
        else{
            int x = sum;
            x %= mod;
            x *= a[i];
            x %= mod;
            x += dp[i-1];
            x %= mod;
            dp[i] = x;
        }
        sum += a[i];
    }

    cout<<dp[n-1]%mod<<endl;
}

//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 6360
#include<bits/stdc++.h>
using namespace std;
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
//define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define faster() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const long long int infLL = 9000000000000000000;
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(a) (a).begin(),(a).end()
#define mx_int_prime 999999937
const int inf = 2000000000;
const double PI = acos(-1);
const double eps = 1e-9;
typedef long double ld;
#define MOD 1000000007
typedef long long ll;
const int mx=2e5+125;
//ll p[mx],a[mx],b[mx];
#define PB push_back
#define endl '\n'
#define S second
#define F first
int main()
{
    faster();
    int n,m;
    cin>>n>>m;
    int sum=0;
    for(int i=n-1; i>=1; i--)
        sum+=i;
    for(int i=m-1; i>=1; i--)
        sum+=i;
    cout<<sum<<endl;


    return  0;
}


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

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

	bool ans = false;
	while(true) {
		C -= B;
		if(C <= 0) {
			ans = false;
			break;
		}
		A -= D;
		if(A <= 0) {
			ans = true;
			break;
		}
	}

	if(!ans)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3592
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

o = S()
e = S()
for i in range(len(o)+len(e)):
    if i%2 == 0:
        print(o[i//2],end = "")
    else:
        print(e[i//2],end = "")

Measured memory_bytes: 3064
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import fractions
import copy
from itertools import permutations
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

N = getN()
A = Counter(getList())

ans = 0
for i in A.items():
    if i[0] < i[1]:
        ans += i[1] - i[0]
    elif i[0] > i[1]:
        ans += i[1]
print(ans)

Measured memory_bytes: 90140
inputPolygonNum = int(input())
inputLengthList = input().split(" ")
intInputLengthList = [int(s) for s in inputLengthList]
intInputLengthList.sort(reverse = True)
if inputPolygonNum > 2:
    maxLength = intInputLengthList.pop(0)
    for i in intInputLengthList:
        maxLength = maxLength - i
    if(maxLength < 0):
        print("Yes")
    else:
     print("No")   
else:
    print("No")

Measured memory_bytes: 3060