akhauriyash/Code-Regression huggingface dataset:
//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <numeric>
#include<bitset>

using namespace std;
#define modd 1000000007


typedef pair<long long, long long> pl;



#define ll long long




/*
class UnionFind {
public:
	vector <ll> par;
	vector <ll> siz;
	vector <ll> gr;

	// Constructor
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) ,gr(sz_){
		for (ll i = 0; i < sz_; ++i) par[i] = i;
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;

		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}



	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}


};*/


long long N, M, K, a, b, c, d, e, H, W, L;
long long A[200005] = {};
long long B[205][205] = {};
long long C[205][205] = {};
long long D[200005] = {};
long long E[200005] = {};
bool f, ff;
string S;
set <long long>sll;
pl bufpl;
vector <long long>vl;
vector <pl>vpl;
vector <string> vs;
set<ll> llset;

/*struct ST
{
	long long Kati;
	int bangou;

	bool operator<(const ST& another) const
	{
		return Kati < another.Kati;//比較
	};

};



vector <ST> vst;
ST st[200005];
ST bufst;
bitset<5000> bits;*/


long long modinv(long long aa, long long mm) {
	long long bb = mm, uu = 1, vv = 0;
	while (bb) {
		long long tt = aa / bb;
		aa -= tt * bb; swap(aa, bb);
		uu -= tt * vv; swap(uu, vv);
	}
	uu %= mm;
	if (uu < 0) uu += mm;
	return uu;
}


bool fs[2005][2005] = {};
char cc[1000000] = {};

int main() {


	cin >> a >> b >> c >> N;

	for (int i = 0; i <= a; i++) {
		for (int j = 0; j <= b; j++) {
			d = N;
			d -= i * 500;
			d -= j * 100;
			if (d <= 50 * c && d>=0) {
				A[0]++;
			}

		}
	}



	cout << A[0] << endl;

	return 0;

}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define MOD 1000000007 
#define INF 1000000000000000000
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

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


Measured memory_bytes: 256
import sys

def main():
  N, x = map(lambda i: int(i), input().split(' '))
  a = list(map(lambda i: int(i), input().split(' ')))
  a.sort()
  answer = 0
  for i in range(N):
    if x >= a[i]:
      x -= a[i]
      answer += 1
    else:
      print(answer)
      sys.exit()
  print(answer if x == 0 else answer - 1)

main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main()
{
     string str;
  
     cin>>str;
  
     int i=0 , cnt=0;
    int n=str.size() , j=n-1;
  
     while(i<j)
     {
         if(str[i]!=str[j])
           cnt++;
       
         i++;
         j--;
     }
  
     cout<<cnt<<endl;
  
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl

int toi(char b) {
  switch(b) {
    case '0': return 0;
    case '1': return 1;
    default: return -1;
  }
}

int main() {
  int n, k;
  string s;
  cin >> n >> k >> s;

  vector<int> acc;
  acc.push_back(0);
  int j = 1;
  int lc = 1;
  int cnt = 0;
  rep(i, s.size()) {
    if(toi(s[i]) ^ lc) {
      acc.push_back(acc[j - 1] + cnt);
      j++;
      lc ^= 1;
      cnt = 1;
    } else {
      ++cnt;
    }
  }
  acc.push_back(acc[j - 1] + cnt);
  if(!lc) acc.push_back(acc[j]);

  int m = acc.size();
  if(k >= m / 2) {
    cout << n << endl;
    return 0;
  }

  int ans = 0;
  for(int l = 1, r = k; r < m / 2; l++, r++) {
    ans = max(ans, acc[2 * r + 1] - acc[2 * l - 2]);
  }
  cout << ans << endl;

  return 0;
}


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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define fi first
#define se second
#define setpre(x) cout << fixed << setprecision(x)
#define out(x) cout << (x) << endl

inline void logger(){ cout << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 100005;

/* ...o(^-^)o... */

int main(){
    int sum = 0, m = 0;
    rep(i, 3){
        int x; cin >> x;
        sum += x; m = max(m, x);
    }
    int k; cin >> k;
    out(sum + m * (pow(2, k) - 1));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main() {
	int d;
	cin >> d;
	const int n = 26;
	vector<int> c(n);
	vector<vector<int>> s(d, vector<int>(n));
	rep(i, n) cin >> c[i];
	rep(i, d) rep(j, n) cin >> s[i][j];
	vector<int> t(d), last(n);
	// rep(i, d) {
	// 	cin >> t[i];
	// 	t[i]--;
	// }
	
	ll ans = 0;
	rep(i, d) {
		ll mx = -1001001001;
		int now = 0;
		
		rep(j, n) {
			ll tmp = ans;
			tmp += s[i][j];
			rep(k, n) {
				if(j == k) continue;
				ans -= c[k] * (i+1-last[k]);
			}
			if(mx < tmp) {
				mx = tmp;
				now = j;
			}
		}
		last[now] = i;
		t[i] = now+1;
	}
	rep(i, d) printf("%d\n", t[i]);
	return 0;
}

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

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

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

const int MOD = 1e9 + 7;

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

    int x, y;
    cin >> x >> y;

    ll ans = 0;
    if(x == 1) ans += 300000; 
    if(y == 1) ans += 300000; 
    if(x == 2) ans += 200000; 
    if(y == 2) ans += 200000; 
    if(x == 3) ans += 100000; 
    if(y == 3) ans += 100000; 
    if(x == 1 && y == 1) ans += 400000;

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}



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

  ll N; cin >> N;
  vector<ll> T;
  rep(i,N*3){
    ll inp; cin >> inp;
    T.pb(inp);
  }

  sort(all(T));

  ll ans = 0;
  for(ll i = T.size()-2; i >= N; i-=2)
    ans += T[i];
  cout << ans << endl;
  
  

  //cout << fixed << setprecision(16) << ans << endl;
  return 0;
}


Measured memory_bytes: 6000
import java.util.*;
import java.io.*;

public class Main {
  public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	String S = s.next();
	String T = s.next();
	int count = 0;
	for(int i = 0; i < S.length(); i++){
		if(S.charAt(i) != T.charAt(i)) count++;
	}
	System.out.println(count);
    
  }
}

Measured memory_bytes: 41180
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <fstream>
#include <set>
#include <stack>
#include <queue>
#include <list>
using namespace std;
typedef long long int64;
typedef vector<int> vec;
typedef vector<int64> vec64;
#define db(x) cout << "> " << #x << ": " << x << "\n";
#define ss cout << " ";
#define ct(x) cout << x;
#define nn cout << "\n";
// // // // // // // // // // // // // // // // // // //


int q, n;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    cout << c << " " << a << " " << b;
    return 0;
}


Measured memory_bytes: 764
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>

int main() {
  char buf[1<<17];
  scanf("%s", buf);
  std::string s = buf;
  scanf("%s", buf);
  std::string t = buf;

  size_t n = s.length();
  size_t m = t.length();
  std::vector<int> as(n+1), at(m+1);
  for (size_t i = 0; i < n; ++i)
    as[i+1] = as[i] + ((s[i] == 'A')? 1: 2);
  for (size_t i = 0; i < m; ++i)
    at[i+1] = at[i] + ((t[i] == 'A')? 1: 2);

  size_t q;
  scanf("%zu", &q);
  for (size_t i = 0; i < q; ++i) {
    size_t a, b, c, d;
    scanf("%zu %zu %zu %zu", &a, &b, &c, &d);
    int vs = (as[b]-as[a-1]) % 3;
    int vt = (at[d]-at[c-1]) % 3;
    puts((vs == vt)? "YES": "NO");
  }
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

int L[100];

int main()
{
	int N, ans = 0;

	cin >> N;
	rep(i, 2 * N) cin >> L[i];

	sort(L, L + 2 * N);
	rep(i, 2 * N) if (i % 2 == 0) ans += L[i];

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll mod = 1e9 + 7;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

int main() {
   float a;
   cin >> a;
   float pi = 3.14159;
   float ans = a * 2 * pi;
   cout << ans << endl;
}


Measured memory_bytes: 3788
function Main(input) {
  lines = input.split("\n");
  N = lines[0];
  numbers = lines[1].split(" ");
  
  //大きさ順で並び変えて真ん中の２数字の間の数字
  
  //sortのための比例関数
  function compareFunc(a, b) {
  return a - b;
  }
  numbers.sort(compareFunc);
  
  //真ん中の二つの数字の差分が答え
  console.log(numbers[N/2] - numbers[N/2-1]);
  
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));



Measured memory_bytes: 18108
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin, n;
    vector<ll> a(n);
    REP(i, 0, n) {
        cin, a[i];
    }
    ll a0 = a[0], a1 = a[1], a2 = 0;
    REP(i, 2, n) {
        a2 ^= a[i];
    }
    ll sum = a0 + a1;
    if (sum < a2 || (sum - a2) % 2 == 1) {
        print(-1);
        return 0;
    }
    ll d = (sum - a2) / 2;
    // a & (a ^ sumx) == d
    const int bits = 50;
    ll ans = 0;
    int prev = -1;
    for (int i = bits; i >= 0; i--) {
        ll b1 = (d >> i) & 1, b2 = (a2 >> i) & 1;
        if (b1 == 1 && b2 == 1) {
            print(-1);
            return 0;
        }

        ll app = ans + (1LL << i);
        if (b1 == 1 && b2 == 0) {
            if (app <= a0) {
                ans = app;
            } else if (prev != -1 && ((app ^ (1LL << prev)) <= a0)) {
                ans = app ^ (1LL << prev);
            } else {
                print(-1);
                return 0;
            }
        } else if (b1 == 0 && b2 == 1) {
            if (app <= a0) {
                prev = i;
                ans = app;
            }
        }
        //if (b1 == 0 && b2 == 0) continue;
    }
    if (ans == 0)
        ans = -1;
    else
        ans = a0 - ans;
    print(ans);
    return 0;
}


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

int main() {
  int n;
  while(cin >> n, n) {
    int ans = 0;
    for(int i = 1; i*2 < n; i++) {
      int sum = 2*i + 1;
      for(int j = 2; sum <= n; j++) {
	if(sum == n) {
	  ans++;
	  break;
	}
	else sum += i+j;
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>
#include <math.h>
#include <iomanip>
#include <queue>
#define inp(X) cin >> X
#define out(X) cout << X << endl
#define out16(X) cout << setprecision(16) << X << endl
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vd = std::vector<double>;
using vvd = std::vector<std::vector<double>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using namespace std;
#define MOD 1000000007
#define INF 1000000001
#define LL_INF 1001001001001001001

ll gcd(ll x, ll y){
	if(y==0) return x;
	return gcd(y,x%y);
}

bool bfs(vector<vector<int>> g, vector<int> &dist, int sv){
	queue<int> q;
	q.push(sv);
	dist[sv]=0;
	while(!q.empty()){
		int now = q.front(); q.pop();
		for(auto v : g[now]){
			if(dist[v]!=-1) continue;
			dist[v] = dist[now]+1;
			q.push(v);
		}
	}
}

int main(void) {
	int n; cin >> n;
	vi a(n); rep(i,n) cin >> a[i];
	int ans = 0;
	int now = 0;
	int now_i = 0;
	bool flg = true;
	rep(i,n){
		if(now+1==a[i]){
			ans += i-now_i;
			now_i = i+1;
			now++;
			flg = false;
		}
	}
	ans += n-now_i;
		
	if(flg) out(-1);
	else out(ans);
}




Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
const int INF = 1e9;
const LL MOD = 1e9 + 7;

template<class T> inline bool chmin(T &a, T b){if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){if (a < b) {a = b; return true;} return false;}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  if ((n+1)/2 >= k) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}

Measured memory_bytes: 256
/**
  * @brief atcoder
  * @author yao
  */
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <climits>
#define ft first
#define sd second
#ifdef DBG
#   define dbg_pri(x...) fprintf(stderr,x)
#else
#   define dbg_pri(x...) 0
#   define NDEBUG
#endif //DBG
#include <cassert>

typedef unsigned int uint;
typedef long long int lli;
typedef unsigned long long int ulli;

int main()
{
    int n;
    scanf("%d", &n);
    printf("%d\n", (n+999) / 1000 * 1000 - n);
    return 0;
}


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

int main() {
  int a, b;
  cin >> a >> b;
  if(a > b){
    cout << a - 1;
  }
  else{
    cout << a;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>
#include <vector>
#include <map>
using namespace std;

#define cio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ll long long
#define ii pair < int, int >
#define iii pair < int, ii >
#define INF 987654321
#define LINF 987654321987654321

int main()
{
	cio;

	int L, R, d;
	cin >> L >> R >> d;

	L = (L - 1) / d;
	R = R / d;

	cout << R - L;
}

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

signed main(void)
{
	string s;
	int n, ans;
	bool ok;

	cin >> s;
	n = s.size();
	ans = 0;
	rep(i, n)
	{
		for (int j = i; j < n; j++)
		{
			string t = s.substr(i, j - i + 1);
			ok = true;
			rep(k, t.size())
			{
				if (t[k] != 'A' && t[k] != 'T' &&\
						t[k] != 'G' && t[k] != 'C')
					ok = false;
			}
			int m = t.size();
			if (ok) ans = max(ans, m);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
 
int main() {
 string s;
  cin >> s;
  
  int ans=0;
  
  if(s=="SUN"){
    ans = 7;
  }
  if(s=="MON"){
    ans = 6;
  }
  if(s=="TUE"){
    ans = 5;
  }
  if(s=="WED"){
    ans = 4;
  }
  if(s=="THU"){
    ans = 3;
  }
  if(s=="FRI"){
    ans = 2;
  }
  if(s=="SAT"){
    ans = 1;
  }
  
  cout << ans << endl;
}




Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <map>
#include <algorithm>
#include <cmath>
#include <vector>
#include <fstream>
#include <string>
#include <random>
#include <queue>
#include <iomanip>

using namespace std;

using ll = unsigned long long int;

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

	return gcd(b%a,a);
}

int main() {

	ll n,res,g;
	cin >> n >> g;

	res = g;

	for (int i = 1; i < n; i++) {
		ll a;
		cin >> a;
		g = gcd(res, a);
		res /= g;
		res *= a;
		//cout << "g: " << g << endl;
		//cout << "res: " << res << endl;
	}

	cout << res << endl;


}



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

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Read();
            var startPos = s.IndexOf('A');
            var endPos = s.LastIndexOf('Z');
            Console.WriteLine(endPos - startPos + 1);
        }
        private static readonly Func<string> Read = () => Console.ReadLine();
        private static readonly Func<string[]> ReadStringArray = () => Console.ReadLine().Split();
        private static readonly Func<int> ReadInt = () => int.Parse(Console.ReadLine());
        private static readonly Func<long> ReadLong = () => long.Parse(Console.ReadLine());
        private static readonly Func<int[]> ReadIntArray = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
        private static readonly Func<long[]> ReadLongArray = () => Console.ReadLine().Split().Select(long.Parse).ToArray();
        private static readonly Action<string> Cw = str => Console.WriteLine(str);
    }
}

Measured memory_bytes: 11744
#include <stdio.h>

int main(){

  int n,s,sg,h,max,min,i;
  max=0;
  min=1000;
  sg=0;
  while(1){
    scanf("%d",&n);
    if(n==0)break;
    for(i=0;i<n;i++){
      scanf("%d",&s);
      if(max<s)max=s;
      if(min>s)min=s;
      sg=sg+s;
    }
    h=(sg-max-min)/(n-2);
    printf("%d\n",h);
    max=0;
    min=1000;
    sg=0;
  }
  return 0;
}

Measured memory_bytes: 600
from itertools import accumulate
from collections import Counter
import math


def combinations_count(n, r):
    return math.factorial(n)//(math.factorial(n-r) * math.factorial(r))

n,m = map(int,input().split())
a = list(map(int, input().split()))

a = [0]+a
b = list(accumulate(a))

for i in range(len(b)):
    b[i]%=m


c = Counter(b)

ans = 0

for x in c:
    if c[x]>1:
        ans += combinations_count(c[x],2)

print(ans)


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

struct entry {
    string city;
    int score;
    int id;
};

bool compare_entries(entry left, entry right){
    if(left.city != right.city){
        return left.city < right.city;
    }
    return left.score > right.score;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    
    int n;
    cin >> n;

    vector<entry> entries;

    for(int i = 0; i < n; i++){
        string city;
        int score;

        cin >> city >> score;

        entries.push_back(entry{city, score, i+1});
    }

    sort(entries.begin(), entries.end(), &compare_entries);

    for(entry e: entries){
        cout << e.id << '\n';
    }

}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>
#include <map>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	int n, a, b;
	cin >> n >> a >> b;
	if((b-a)%2==0) cout << "Alice" << endl;
	else cout << "Borys" << endl;
 	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
 
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll MOD = 1e9+7;
vector < P > pairs;
 
#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)
#define ALL(c) (c).begin(), (c).end()
 
// pair (降順, 降順)
bool compare_pair(P a, P b) {
    if (a.first > b.first) return true;//firstが先に書いてあるからfirst基準ソート
    if (a.first < b.first) return false;
    if (a.second > b.second) return true;//今は降順、true falseひっくり返せば降順、昇順切り替え
    if (a.second < b.second) return false;
    return false;
}

int main(){
    int M[2];
    int N[2];
    int ans;
    rep(i,0,2){
        cin>> M[i] >> N[i];
    }
    if(M[0] == M[1]){
        ans = 0;
    }else{
        ans = 1;
    }
    cout << ans;
    return 0;
}

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

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

  map<string, int> a;
  string s[n];
  for(int i=0; i<n; ++i){
    cin >>s[i];

    a[s[i]]++;
  }

  cout << a.size();
}

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

int main() {
	int n;

	std::cin >> n;

	std::vector<int> v(n);

	for (int& x : v) {
		std::cin >> x;
	}

	std::sort(v.begin(), v.end());

	std::cout << v.back() - v.front() << std::endl;

	return 0;
}

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

typedef long long int ll;
const int N_MAX = 100005;

int main(){
  int A[N_MAX], B[N_MAX];
  int n;

  scanf("%d", &n);

  for(int i = 0; i <= n; i++){
    scanf("%d", &A[i]);
  }
  for(int i = 0; i < n; i++){
    scanf("%d", &B[i]);
  }

  ll ans = 0;

  for(int i = n; i >= 0; i--){
    if (i == n){
      if (A[n] >= B[n - 1]){
        ans += B[n - 1];
        B[n - 1] = 0;
      }
      else{
        ans += A[n];
        B[n - 1] -= A[n];
      }
    }
    else if (i == 0){
      if (A[0] >= B[0]){
        ans += B[0];
        B[0] = 0;
      }
      else{
        ans += A[0];
        B[0] -= A[0];
      }
    }
    else{
      if (A[i] >= B[i]){
        ans += B[i];
        A[i] -= B[i];
      }
      else{
        ans += A[i];
        A[i] = 0;
      }
      if (A[i] >= B[i-1]){
        ans += B[i-1];
        B[i-1] = 0;
      }
      else{
        ans += A[i];
        B[i-1] -= A[i];
      }
    }
  }

  printf("%lld\n", ans);

  return 0;
}

Measured memory_bytes: 896
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <assert.h>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main(){
  ll h1,m1,h2,m2,k;
  cin>>h1>>m1>>h2>>m2>>k;
  cout << h2*60+m2-h1*60-m1-k << endl;
  return 0;
}

Measured memory_bytes: 3620
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		char[] s=S.toCharArray();
		int N=S.length();
		int count=0;
		
		for(int i=0;i<N/2;i++) {
			if(s[i]!=s[N-(i+1)]) {
				count++;
			}
		}
		System.out.println(count);
	}
}


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

const int INF = 1000000007;
const int MOD = 1000000007;


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

const int PRC = 15;

double dp[100001][PRC + 1];
double e[100001];

int main(){
    for(int i = 0; i <= 100000; i++){
        fill(dp[i], dp[i] + PRC + 1, 0);
    }
    dp[0][0] = 1;
    for(int i = 0; i < 100000; i++){
        for(int j = 0; j < PRC; j++){
            dp[i + 1][j + 1] += dp[i][j] / pow(2, j);
            dp[i + 1][0] += dp[i][j] * (1 - 1 / pow(2, j));
        }
    }
    e[0] = 0;
    for(int i = 1; i <= 100000; i++){
        e[i] = e[i-1];
        for(int j = 0; j < PRC; j++){
            e[i] += dp[i-1][j] / pow(2, j);
        }
    }
    while(true){
        int n;
        scanf("%d", &n);
        if(n == 0) break;
        printf("%.12f\n", e[n]);
    }
    return 0;
}

Measured memory_bytes: 14540
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#define int long long
using namespace std;

inline int read(){
    int s=0,w=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-')w=-1;ch=getchar();
    }
    while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
    return s*w;
}

inline void read(int& a){
    int s=0,w=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-')w=-1;ch=getchar();
    }
    while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
    a=s*w;
    return;
}

inline void write(int x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
}

inline void writeln(int x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
    puts("");
}

bool cmp(int a,int b){
    return a>b;
}

signed main(){
    int a=read(),b=read(),c=read(),k=read();
    
    for(int i=1;i<=k;i++){
        if(b<=a){
            b*=2;
            continue;
        }
        else if(c<=b){
            c*=2;
            continue;
        }
        else{
            c*=2;
            continue;
        }
    }
    
    if(b>a && c>b){
        puts("Yes");
        return 0;
    }
    
    puts("No");        
    return 0;
}

Measured memory_bytes: 3620
n=int(input())
a=[int(input()) for _ in range(n)]

import bisect
#a=[0,2,3,4,67,8]
#a.sort()
#bisect.bisect_left(a, 4) #被ったら左側のindexを返す
#bisect.bisect_right(a, 4)#被ったら右側のindexを返す

color=[1]
lencolor=1
for aa in a:
    aa=-1*aa
    i=bisect.bisect_right(color, aa)
    if i==lencolor:
        color.append(aa)
        lencolor+=1
        #print("insert")
    else:
        color[i]=aa
        #print("update")
    #print(color,aa) 
print(lencolor)


Measured memory_bytes: 54616
from collections import defaultdict
#法と基数設定
mod1 = 10 ** 9 + 7
base1 = 1007

def getlist():
	return list(map(int, input().split()))

class UnionFind:
	def __init__(self, n):
		self.par = [i for i in range(n + 1)]
		self.rank = [0] * (n + 1)
		self.size = [1] * (n + 1)
		self.judge = "No"

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

	def same_check(self, x, y):
		return self.find(x) == self.find(y)

	def union(self, x, y):
		x = self.find(x); y = self.find(y)
		if self.rank[x] < self.rank[y]:
			if self.same_check(x, y) != True:
				self.size[y] += self.size[x]
				self.size[x] = 0
			else:
				self.judge = "Yes"
			self.par[x] = y
		else:
			if self.same_check(x, y) != True:
				self.size[x] += self.size[y]
				self.size[y] = 0
			else:
				self.judge = "Yes"
			self.par[y] = x
			if self.rank[x] == self.rank[y]:
				self.rank[x] += 1

	def siz(self, x):
		x = self.find(x)
		return self.size[x]

#Nの文字からなる文字列AのM文字のハッシュ値を計算
def rollingHash(N, M, A):
	mul1 = 1
	for i in range(M):
		mul1 = (mul1 * base1) % mod1

	val1 = 0
	for i in range(M):
		val1 = val1 * base1 + A[i]
		val1 %= mod1

	hashList1 = [None] * (N - M + 1)
	hashList1[0] = val1

	for i in range(N - M):
		val1 = (val1 * base1 - A[i] * mul1 + A[i + M]) % mod1
		hashList1[i + 1] = val1

	return hashList1

#処理内容
def main():
	s = list(input())
	t = list(input())
	N = len(s)
	M = len(t)
	#sのほうを長く調整
	if N < M:
		var = int(M // N) + 1
		s = s * var
		N = N * var
	
	s = s + s
	for i in range(2 * N):
		s[i] = ord(s[i]) - 97
	for i in range(M):
		t[i] = ord(t[i]) - 97

	sHash1 = rollingHash(2 * N, M, s)
	tHash1 = rollingHash(M, M, t)
	tHash1 = tHash1[0]


	value = "No"
	UF = UnionFind(N)
	for i in range(N):
		j = (i + M) % N
		if sHash1[i] == tHash1:
			value = "Yes"
			if sHash1[j] == tHash1:
				UF.union(i, j)

	if value == "No":
		print(0)
		return

	if UF.judge == "Yes":
		print(-1)
		return

	for i in range(N):
		UF.par[i] = UF.find(i)
	ans = 0
	for i in range(N):
		ans = max(ans, UF.size[i])

	print(ans)

if __name__ == '__main__':
	main()

Measured memory_bytes: 223496
input = require('fs').readFileSync(process.stdin.fd, 'utf8')
lines = input.split('\n')
N = lines.shift() * 1
ans = 0
for (i = 1; i <= N; i++) {
    if (((i + '').length) % 2 == 1) {
        ans++
    }
}
console.log(ans)


Measured memory_bytes: 10828
#include <stdio.h>
#include <string.h>

#define A "delicious"
#define B "safe"
#define C "dangerous"

int main() 
{
        int r, g, b;

        scanf("%d %d %d", &r, &g, &b);

        int temp = (r*100) + (g*10) + b;

        temp %= 4;

        if (temp == 0)
                printf("YES\n");
        else
                printf("NO\n");

        return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
using namespace std;
typedef long double ld;
typedef long long lli;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
#define deb(x) cout << #x": " << (x) << endl;

const int N = 1e3;
const lli INF = 1e18;
const lli MOD = 200003;

vi m;
vi primes(1,2);
vector<vector<ld>>nk;
void sieve(){
	m = vi(N+1,0);
	for(int i = 4; i<N; i+=2)m[i]=1;
	for(int i = 3; i*i<=N; i+=2)if(!m[i])for(int j = i*i; j<N; j+=i)m[j]=1;
	for(int i = 3; i<N; i+=2)if(!m[i])primes.pb(i);
}

void pascal(){
	nk =vector<vector<ld>>(N,vector<ld>(N,0.0));
	fore(i,0,N)nk[i][0]=nk[i][i]=1.0;
	fore(i,1,N)fore(j,1,i)nk[i][j]=nk[i-1][j-1]+nk[i-1][j];
}

lli gcd(lli a, lli b){return (b?gcd(b,a%b):a);}

lli lcm(lli a, lli b){
	if(a<b)swap(a,b);
	lli c = gcd(a,b);
	a/=c;
	return a*b;
}

int popcount(lli x) { return __builtin_popcountll(x); }

lli poww(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = res * a;
		a = a*a;
		b/=2;
	}
	return res;
}

lli powm(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = (res * a)%MOD;
		a = (a*a)%MOD;
		b/=2;
	}
	return res;
}

bool isPrime(lli x){
	if(x==1)return 0;
	for(auto i:primes){
		if(i*i>x)return 1;
		if(x%i==0)return 0;
	}
	return 1;
}

// ---- コーディングはここから！ ('-')7

int main(){_
	lli n,k,d; cin>>n>>k>>d;
	n = abs(n);
	lli l = 0, r = INF, last = r;
	auto f=[&](lli x){
		lli h=abs(n-x)/d;
		h = min(h,k);
		if((k-h)&1){
			bool p = 0;
			p|=abs(n- (h+1)*d)<=abs(x);
			if(h>0)p|=abs(n-(h-1)*d)<=abs(x);
			return p;
		}
		return abs(n- h*d)<=abs(x);
	};
	while(l<=r){
		lli mid = (l+r)/2;
		if(f(mid) or f(-mid))r=mid-1,last=mid;
		else l = mid+1;
	}
	cout<<last<<ENDL;


}


Measured memory_bytes: 3604
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include <numeric>
#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 REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 9999999

using namespace std;


int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };


ll m = 1000000007;

ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll 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;
}



ll T[101];
int main() {
	int N;
	cin >> N;
	if (N < 105) {
		cout << 0 << endl;
	}
	else if (N < 135)
		cout << 1;
	else if (N < 165) {
		cout << 2 << endl;
	}
	else if (N < 189)cout << 3;
	else if (N < 195) {
		cout <<4 << endl;
	}
	else cout << 5 << endl;
}

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


// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
}comb(200005);


//nPk
 mint f(int n, int k) {
    if (n < 0) return 0;
    // nPk = nCk * k!
    mint res = comb(n,k);
    res *= comb.fact[k];
    return res;
}




//組み合わせの数nCrを計算
   int calcNumOfCombination(int n, int r){
       int num = 1;
       for(int i = 1; i <= r; i++){
           num = num * (n - i + 1) / i;
       }
       return num;
   }




int main() {
  ll n,m,k;
  cin >> n >> m >>k;
  mint ans=0;
  for(ll i=1;i<n;i++){
  //  cout<<"i"<<i<<endl;
    mint c=comb(n*m-2,k-2);
    mint c1=(n-i)*m;
    c1*=m;
    c*=c1;
    c*=i;
    //cout<<c<<endl;
    ans+=c;
  }
  for(ll i=1;i<m;i++){
  //  cout<<"i"<<i<<endl;

    mint c=comb(n*m-2,k-2);
    mint c1=(m-i)*n;
    c1*=n;
    c*=c1;
    c*=i;
    ans+=c;
  //  cout<<c<<endl;

  }
  cout<<ans;
}


Measured memory_bytes: 6216
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;

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

vector<ll> enum_divisor(ll n)
{
	vector<ll> divisor;
	for (ll i = 2; i * i <= n; i++) {
		if (n % i)
			continue;
		divisor.push_back(i);
		if (i * i != n)
			divisor.push_back(n / i);
	}
	divisor.push_back(n);
	return divisor;
}

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

	ll ans = 0;
	
	vector<ll> divisor = enum_divisor(n);	

	for (ll k : divisor) {
		ll m = n;
		while (1) {
			ll s = m % k;
			if (s == 0) {
				m /= k;
			}
			else {
				ans += s == 1;
				break;
			}
		}
	}

	divisor = enum_divisor(n - 1);

	for (ll k : divisor) {
		ans += n % k == 1;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <algorithm>
#include <unordered_map>
#include <iomanip>
#include <time.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;

int main(){
  int n, k, h;
  int sum=0;
  cin >> n >>k;
  rep(i, n){
    cin >> h;
    if (h >= k)
      sum++;
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
/******************************************
* AUTHOR : SHUBHAM KUMAR *
* NICK : { "CODECHEF" : "SCHELEON",
		   "CODEFORCES" : "SCH3130N" } * 	
* INSTITUTION : BIT MESRA *
******************************************/

#include "bits/stdc++.h"

using namespace std;

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define sd(x) scanf("%lld",&x)
#define pds(x) printf("%lld", x)
#define large 100005
#define MOD 1000000007
#define dd double
#define pb push_back
#define mk make_pair
#define rep0(i,b) for(int i=0;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define rep2(i,a,b) for(int i=a;i<=b;i++)
#define pll pair<ll, ll>
#define ld long double
#define vll vector<ll>
#define vpll vector<pll>
#define sortv(v) sort(v.begin(),v.end())  

template <typename T> void max_self(T& a, T b) {
    a = max(a, b);
}

using ll = long long int;
using ull = unsigned long long int;

ll ModE(ll x, ull y, ll p = MOD) 
{ 
    ll res = 1;
    x = x % p;    
    while (y > 0) 
    {   if (y & 1) 
            res = (res*x) % p; 
        y = y>>1;
        x = (x*x) % p;   
    } 
    return res; 
}

string chars[] = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};

string maxString(string s1, string s2){
	if(s1.size() > s2.size())
		return s1;
	return s2;
}
string s1, s2;
map<pair<int, int>, string> mp;
int dp[3001][3001];

int solve(int p1, int p2){
	if(dp[p1][p2] != -1)
		return dp[p1][p2];
	
	if(p1 > s1.size()-1 || p2 > s2.size()-1)
		return 0;

	if(s1[p1] == s2[p2])
		dp[p1][p2] = 1 + solve(p1+1, p2+1);
	else
		dp[p1][p2] = max(solve(p1+1, p2), solve(p1, p2+1));

	return dp[p1][p2];
}

int main() {
	#ifdef M_DEBUG
    //#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
	#endif

	fastio
	//ios_base& scientific (ios_base& str);

	//ll T; cin>>T; while(T--){}
	rep0(i,3001)
		rep0(j,3001)
			dp[i][j]=-1;
	cin >> s1 >> s2;
	string ans= "";
	int p1=0, p2=0;
	
	solve(0 ,0);
	// rep0(i, s1.size()){
	// 	rep0(j, s2.size()){
	// 		cout<<dp[i][j]<<" ";
	// 	}
	// 	cout<<endl;
	// }
	while(p1 <= s1.size()-1 && p2 <= s2.size()-1){
		if(s1[p1] == s2[p2]){
			ans += s1[p1];
			p1++;p2++;
			continue;
		} 
		if(dp[p1+1][p2] > dp[p1][p2+1]){
			p1++;
		} else {
			p2++;
		}
	}
	cout<<ans;
	return 0;
}

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

int main(){
  int a,b,c;
  cin >> a >>b >>c;
  int k;
  cin >>k;
  for(int i=1;i<=k;i++){
    if(b<=a){
      b*=2;
    }
    else if(c<=b){
      c*=2;
    }
  }
  if(a<b&&b<c){
      cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3608
n, k = map(int,input().split())
a = list(map(int,input().split()))
d = {}
for i in a:
    if i in d:
        d[i] += 1
    else:
        d[i] = 1
c = sorted(d.items(),key = lambda x:x[1], reverse=True)
ans = 0
for i in range(min(k,len(c))):
    ans += c[i][1]

print(n-ans)

Measured memory_bytes: 98376
#include<bits/stdc++.h>
using namespace std;
int main() {
    string s,t;
    cin>>s;
    int tot=1;
    t+=s[0];
    string tmp;
    for(int i=1;i<s.size();i++){
        tmp+=s[i];
        if(tmp!=t){
            tot++;
            t=tmp;
            tmp="";
        }
    }
    cout<<tot<<endl;
    return 0;
}


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

template <int64_t N>
class modint {
    int64_t x;
public:
    modint(int64_t x = 0) : x((x % N + N) % N) {}
    modint operator-() const { return modint(-x); }
    modint& operator+=(const modint& a) { if ((x += a.x) >= N) x -= N; return *this; }
    modint& operator-=(const modint& a) { if ((x += N - a.x) >= N) x -= N; return *this; }
    modint& operator*=(const  modint& a) { (x *= a.x) %= N; return *this; }
    modint operator+(const modint& a) const { return modint(*this) += a; }
    modint operator-(const modint& a) const { return modint(*this) -= a; }
    modint operator*(const modint& a) const { return modint(*this) *= a; }
    modint pow(int64_t t) const {
        if (not t) return 1;
        modint a = pow(t >> 1); a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    // for prime mod
    modint inv() const { return pow(N - 2); }
    modint& operator/=(const modint& a) { return (*this) *= a.inv(); }
    modint operator/(const modint& a) const { return modint(*this) /= a; }
    friend ostream& operator<<(ostream& os, const modint& m){ os << m.x; return os; }
};

const int64_t mod = 1e9 + 7;
using mint = modint<mod>;

int main(){
    int n; cin >> n;
    vector<int> a(n); vector<mint> sum(n, 0); mint ans = 0;
    for (auto i = 0; i < n; i++) cin >> a[i];
    for (auto i = n - 1; i >= 0; i--) {
        if(i == n - 1) sum[i] += a[i];
        else sum[i] += (mint)a[i] + sum[i + 1];
    }
    for (auto i = 0; i < n - 1; i++) ans += (mint)a[i] * sum[i + 1];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5632
import Control.Monad

getInData = map read . words <$> getLine :: IO [Int]

solve :: [[Int]] -> Int -> Int
solve inData ans
 | ans == 3     = 3
 | inData == [] = ans
 | otherwise    = solve (tail inData) newAns
   where inFstData = head inData
         newAns    = if ((inFstData !! 0) == (inFstData !! 1)) then (ans + 1) else 0

main = do
 n <- read <$> getLine
 inData <- replicateM n getInData
 putStr $ if (solve inData 0) == 3 then "Yes" else "No"

Measured memory_bytes: 4712
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

internal static class CR
{
    public static string Get() { return Console.ReadLine(); }
    public static IEnumerable<string> GetTexts() { return Console.ReadLine().Split(' '); }
    public static int GetInteger() { return int.Parse(Console.ReadLine()); }
    public static IEnumerable<int> GetIntegers() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)); }
}

namespace AtCoder.E
{
    public class Program
    {
        public static int H { get; private set; }
        public static int N { get; private set; }

        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var inputs = CR.GetIntegers().ToList();
            H = inputs[0];
            N = inputs[1];

            var magics = new List<Magic>();
            for (int i = 0; i < N; i++)
            {
                inputs = CR.GetIntegers().ToList();
                magics.Add(new Magic
                {
                    A = inputs[0],
                    B = inputs[1],
                }); ;
            }

            var aMax = magics.Max(x => x.A);
            var dp = new long[H + aMax];
            for (int i = 1; i < H + aMax; i++)
            {
                var min = long.MaxValue;
                for (int j = 0; j < N; j++)
                {
                    var preH = i - magics[j].A;
                    if (preH >= 0 && dp[preH] != long.MaxValue)
                    {
                        min = Math.Min(min, dp[preH] + magics[j].B);
                    }
                }
                dp[i] = min;
            }

            return dp.Skip(H).Min(x => x);
        }

        class Magic
        {
            public int A { get; set; }
            public int B { get; set; }
        }
    }
}


Measured memory_bytes: 13552
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int A = scan.nextInt();
		int B = scan.nextInt();
		scan.close();
        int lg = A+B;
        lg = A-B>lg? A-B : lg;
        lg = A*B>lg? A*B : lg;
        System.out.println(lg); 
    }
}

Measured memory_bytes: 21844
#include <stdio.h>
 int main () 
{ int i,j; char n[100000] = {0}; int x[1001] = {0}; i = 0; j = 0;
 while(1)
 { scanf("%c",&n[i]);
 if(n[i] == '0' && n[i-1] == '\n'|| n[0] == '0') {break;}
 if(n[i] >= '1' && '9' >= n[i] && n[i] != '\n')
 { x[j] += n[i]-48; } 
if(n[i] == '\n') { j = j + 1; } i= i+1; }
 for(i=0; i < j;i++)
 { printf("%d",x[i]);
 printf("\n"); } 
return 0; 
}



Measured memory_bytes: 2104
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
using namespace std;
int main()
{ 
	int x,a,b;
	cin>>x>>a>>b;
	x-=a;
	while(x>=b)
	{
		x-=b;
	}
	cout<<x;
	return 0;
}

Measured memory_bytes: 256