akhauriyash/Code-Regression huggingface dataset:
/*
	  Chase
	   Your	
	  Legend

	英雄志逐传奇
*/

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;

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

	vector<vector<int>> vec(X, vector<int>(D));
	rep(i, X) {
		rep(j, D) {
			cin >> vec[i][j];
		}
	}

	vector<double>qvec(X);
	int ans = 0;

	for (int i = 0; i < X; i++) {
			for (int j = i + 1; j < X; j++) {

				int Z = 0;

				for (int k = 0; k < D; k++) {
					int def = abs(vec[i][k] - vec[j][k]);
					Z = Z + def * def;
				}

				for (int m = 0; m <= Z; m++) {
					if (m * m == Z) {
						ans++;
					}
				}
			}
		}
		cout << ans << endl;
}


Measured memory_bytes: 256
a,b,c,d = map(int,input().split())
import math
#最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

 #最小公倍数
def lcm(a,b):
    return a*b//gcd(a,b)

A = (a-1)//c + (a-1)//d - (a-1)//lcm(c,d)
B = b//c + b//d -b//lcm(c,d)

print((b-B)-((a-1)-A))

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
using namespace std;

string s;

int main(){

    cin>>s;
    int len=s.length();
    if(s[0]==s[len-1]){
        if(len&1){//odd number
            printf("Second");
        }
        else {
            printf("First");
        }
    }
    else {
        if(len&1){
            printf("First");
        }
        else {
            printf("Second");
        }
    }
    // getchar();
    // getchar();
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>

#define MAX 10

using namespace std;

int main() {

	int list[MAX];

	for (int i = 0; i < MAX; i++) {
		cin >> list[i];
	}

	sort(list, list+MAX);
	for (int i = 0; i < 3; i++) {
		cout << list[MAX-i-1] << endl;
	}

	return 0;
}

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

typedef long long ll;

ll A, B;
int res = 1;

ll gcd(ll x, ll y) { return x? gcd(y % x, x): y; }

int main()
{
    cin >> A >> B;
    ll g = gcd(A, B);
    for (ll i = 2; i * i <= g; i++) if (g % i == 0) {
        res++;
        while (g % i == 0) g /= i;
    }
    if (g > 1) res++;
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int Maxn=250005;
const int mod1=775731769,base1=551745917;
const int mod2=977783399,base2=537587201;
const int mod3=861044911,base3=571213603;
int n;
char c[Maxn];
constexpr int ksm(int x,int k,int mod){
	int ret=1,tmp=x;
	while(k){
		if(k&1)ret=1ll*ret*tmp%mod;
		tmp=1ll*tmp*tmp%mod;k>>=1;
	}
	return ret;
}
template<int mod,int base,int invbase=ksm(base,mod-2,mod)>
struct integer{
	int val;
	integer(){val=0;}
	integer(int v){val=(v%mod+mod)%mod;}
	int operator * (const int rhs){return 1ll*val*rhs%mod;}
	int operator + (const int rhs){return (val+rhs)%mod;}
	int operator - (const int rhs){return ((val-rhs)%mod+mod)%mod;}
	operator int(){return val;}
	void rf(){val=1ll*val*base%mod;}
	void rb(){val=1ll*val*invbase%mod;}
};
integer<mod1,mod2,mod3>a;
template<class T>
struct node{
	T hash,cur;
	void init(){hash=0;cur=1;}
	void add(char c){
		if(c=='>')cur.rf();
		if(c=='<')cur.rb();
		if(c=='+')hash=hash+cur;
		if(c=='-')hash=hash-cur;
	}
	node operator*(node rhs){
		node result;
		result.cur=cur*rhs.cur;
		result.hash=rhs.hash*cur;
		result.hash=result.hash+hash;
		return result;
	}
	bool operator<(const node&rhs)const{
		return hash.val<rhs.hash.val;
	}
	bool operator!=(const node&rhs)const{
		return hash.val!=rhs.hash.val;
	}
};
template<class T,class...args>
struct state{
	node<T>a;
	state<args...>b;
	void init(){a.init();b.init();}
	void add(char c){a.add(c);b.add(c);}
	bool operator<(const state&rhs)const{
		if(a!=rhs.a)return a<rhs.a;
		return b<rhs.b;
	}
	state operator*(const state&rhs){
		state w;
		w.a=a*rhs.a;
		w.b=b*rhs.b;
		return w;
	}
};
template<class T>
struct state<T>{
	node<T>a;
	void init(){a.init();}
	void add(char c){a.add(c);}
	bool operator<(const state&rhs)const{
		return a<rhs.a;
	}
	state operator*(const state&rhs){
		state w;w.a=a*rhs.a;
		return w;
	}
};
typedef integer<mod1,base1> Integer1;
typedef integer<mod2,base2> Integer2;
typedef integer<mod3,base3> Integer3;
typedef state<Integer1,Integer2,Integer3> State;
int main(){
	map<State,int>cnt;
	long long ans=0;
	scanf("%d%s",&n,c+1);
	State full,prefix;
	full.init();prefix.init();
	for(int i=1;i<=n;i++)full.add(c[i]);
	for(int i=1;i<=n;i++){
		cnt[prefix*full]++;
		prefix.add(c[i]);
		ans+=cnt[prefix];
	}
	cout<<ans<<"\n";
	return 0;
}


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

using namespace std;

int main()
{
	int a, b, c, X;
	cin >> a >> b >> c >> X;
	int count = 0;
	for (int x = 0; x <= a; x++)
		for (int y = 0; y <= b; y++)
			for (int z = 0; z <= c; z++)
				if (x*500 + y*100 + z*50 == X) count++;
	cout << count << 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;
using ll = long long;
using P = pair<int,int>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;

//---main---------------------------------------------
int main(){
    //main
    char al;
    cin >> al;

    string ans = "a";
    if(isupper(al)) ans = "A";

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin() , v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)


int main(){
    int n; cin >> n;
    int maxi = 0;
    int sum = 0;
    rep(i,n){
        int l; cin >> l;
        maxi = max(maxi, l);
        sum += l;
    }
    if(maxi < sum - maxi){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<ll> a(n), sa(n+1,0);
  REP(i,n) cin >> a[i];
  sort(ALL(a));
  REP(i,n) sa[i+1] = sa[i] + a[i];
  int t = 0;
  REP(i,n-1){
    if(sa[i+1]*2<a[i+1]) t=i+1;
  }
  cout << n-t << '\n';
  return 0;
}

Measured memory_bytes: 1792
#include <iostream>

using namespace std;
using ll = long long;

int main() {
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    ll ans = 0;
    if(a < k){
        ans += a;
    } else {
        ans += k;
    }
    k -= a;
    k -= b;
    if(k > 0){
        ans -= k;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3192
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
  int N, u, v;
  cin >> N >> u >> v;
  --u;
  --v;
  vector<vector<int> > g(N);
  vector<int> parents(N);
  vector<int> depths(N);
  for (int i = 0; i < N - 1; ++i) {
    int A, B;
    cin >> A >> B;
    --A;
    --B;
    g[A].push_back(B);
    g[B].push_back(A);
  }

  { // BFS
    queue<int> q;
    parents[v] = -1;
    depths[v] = 0;
    q.push(v);
    while (not q.empty()) {
      int x = q.front();
      q.pop();
      for (auto y : g[x]) {
	if (y == parents[x]) continue;
	parents[y] = x;
	depths[y] = depths[x] + 1;
	q.push(y);
      }
    }
  }

  int start = -1;
  { // set start
    int nsteps = (depths[u] - 1) / 2;
    int x = u;
    for (int i = 0; i < nsteps; ++i) {
      x = parents[x];
    }
    start = x;
  }

  int max_dist = 0;
  {
    queue<int> q;
    vector<int> dists(N, -1);
    dists[start] = 0;
    q.push(start);
    while (not q.empty()) {
      int x = q.front();
      q.pop();
      for (auto y : g[x]) {
  	if (y == parents[x]) continue;
  	dists[y] = dists[x] + 1;
  	max_dist = max(max_dist, dists[y]);
  	q.push(y);
      }
    }
  }

  cout << depths[start] + max_dist - 1 << endl;
  
  return 0;
}


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

int main(){
  int N; cin >> N;
  int a1[N], a2[N];
  
  for(int i=0; i<N; i++){
    cin >> a1[i];
  }
  
  int s2=0;
  for(int i=0; i<N; i++){
    cin >> a2[i]; s2=s2+a2[i];
  }
  
  int max=s2+a1[0]; int s=s2+a1[0];
  for(int i=1; i<N; i++){
    s = s + a1[i]-a2[i-1];
    if(s>max){max=s;}
  }
  
  cout << max;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;cin >> s;
	cout << s.substr(0,4) << " " << s.substr(4,8) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <complex>
#include <functional>
#include <numeric>
#include <random>
#include <memory.h>
#include <time.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

// Description: グラフの型定義(これは最小費用流)
// Verifyed: Many Diffrent Problem 

//Appropriately Changed
using edge=struct{int to;};
using G=vector<vector<edge>>;

//Appropriately Changed
void add_edge(G &graph,int from,int to){ 
	graph[from].push_back({to});
	graph[to].push_back({from});
}

const int limit=100010;
int color[limit];
bool visited[limit][11];

void bfs(const G &graph,int v,int d,int c){
	if(visited[v][d]) return;
	visited[v][d]=true;
	if(color[v]==0) color[v]=c;  

	for(auto &e:graph[v]){
		const int nv=e.to,nd=d-1;
		if(nd>=0) bfs(graph,nv,nd,c);
	}
}


int v[limit],d[limit],c[limit];

int main(void){
	int n,m;
	cin >> n >> m;

	G graph(n);

	rep(i,m){
		int a,b;
		cin >> a >> b;
		a--,b--;
		add_edge(graph,a,b);
	}

	int q;
	cin >> q;

	rep(i,q) cin >> v[i] >> d[i] >> c[i],v[i]--;
	rrep(i,q) bfs(graph,v[i],d[i],c[i]);
	rep(i,n) cout << color[i] << endl;

	return 0;
}

Measured memory_bytes: 9728
N, K = gets.chomp.split(" ").map(&:to_i)

ans = 0
(K+1).upto(N){|i|
  ans += N/i * (i-K)
  if K == 0 then
    ans += (N % i) - K if N % i > 0 && (N % i) - K > 0
  else
    ans += (N % i) - K + 1 if N % i > 0 && (N % i) - K >= 0
  end
}

puts ans


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

using namespace std;

vector<pair<int, int> > SideInfos;

bool cmp(const pair<int, int> &s1, const pair<int, int> &s2) {
	if (s1.first == s2.first) {
		return s1.second < s2.second;
	}
	return s1.first < s2.first;
}

int main() {
	int h, w;

	SideInfos.clear();
	for (int i = 0; i < 6; ++i) {
		cin >> h >> w;
		if (h > w) {
			swap(h, w);
		}
		SideInfos.push_back(make_pair(h, w));
	}
	sort(SideInfos.begin(), SideInfos.end(), cmp);

	for (int i = 0; i < 3; ++i) {
		if (SideInfos[i].first != SideInfos[i+1].first) {
			cout << "no" << endl;
			return 0;
		}
	}
	for (int i = 2; i < 5; ++i) {
		if (SideInfos[i].second != SideInfos[i + 1].second) {
			cout << "no" << endl;
			return 0;
		}
	}
	if (SideInfos[0].second != SideInfos[1].second || SideInfos[4].first != SideInfos[5].first) {
		cout << "no" << endl;
		return 0;
	}
	if (SideInfos[1].second != SideInfos[4].first) {
		cout << "no" << endl;
		return 0;
	}
	cout << "yes" << endl;

	return 0;
}


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

int main() {
    string S,T,U;
    int A,B;
    cin >> S >> T;
    cin >> A >> B;
    cin >> U;
    if(U==S) A--;
    else B--;
    cout << A << " " << B << endl;
    return 0;
}


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

int main() {
  int X,N;
  cin >> X >> N;
  
  if (N == 0)
    cout << X << endl;
 
  else {
    vector<int> V(N);
    for (int i = 0; i < N; i++) 
      cin >> V.at(i);
    
    vector<int> W;
    for (int j = 0; j < 102; j++) {
      int Z = 0;
      for (int k = 0; k < N; k++) {
        if (j == V.at(k))
          Z++;
      }
      if (Z == 0)
        W.push_back(j);
      
    }
    int ans = 0;
    int count = 100;
    for (int x : W) {
      if (max(X-x,x-X) < count) {
        count = max(X-x,x-X);
        ans = x;
      }
    }
     cout << ans << endl;
  }
  
  
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
typedef long long ll;
 
 
int main(){
    int N;
    cin >> N;
    vector<ll> a(N);
    rep(i,N)cin >> a[i];
    ll res = 0;
    rep(i,N){
        res += a[i]/2;
        a[i] %= 2;
        if(i < N-1){
            if(a[i] > 0 && a[i+1] >0){
				res++;
              a[i]--;
              a[i+1]--;
            }
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  string n; cin >> n;
  int ans = 0;
  for (char c : n) ans += c - '0';
  cout << (ans % 9 == 0 ? "Yes\n" : "No\n");
  return 0;
}


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

int main(){
    string s;
    cin>>s;
    int ans;
    int a[26]={0};
    for(int i=0;i<s.size();i++){
        a[s[i]-'a']++;
    }
  	bool flag=false;
    for(int i=0;i<26;i++){
        if(a[i]==0){
            cout<<char(i+'a');
          	flag=true;
            break;
        }
    }
  	if(flag==false)cout<<"None"<<endl;
   
    return 0;
}

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

int main() {
  
  
  string S;
  cin >> S;
  int N;
  N = S.size();
  
 if (S.at (N - 1) == 's'){
   cout << S << "es" << endl;
 }
  
 else {
  cout << S << "s" << endl;
 }
}


Measured memory_bytes: 3544
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdint>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <valarray>
#include <vector>

#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;

void solution()
{
    int64_t n;
    cin >> n;
    int count = 0;
    for(int64_t a = 1; a < n; ++a){
        for(int64_t b = a; a*b < n; ++b){
            count += 2;
        }
    }
    for(int64_t a = 1; a*a < n; ++a){
        count -= 1;
    }

    cout << count << '\n';
}

// n,n/2,n/3,...,1

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    solution();
    return 0;
}


Measured memory_bytes: 3676
#include<iostream>
#include<cstdio>
#define N 100001

using namespace std;

int main(){
  int kukaku = 0;
  char input[N], befor;
  scanf("%s", input);
  for(int i = 0;; i++){
    if(input[i] == '\0') break;
    if(i == 0 || befor != input[i]){
      kukaku++;
      befor = input[i];
    }
  }
  cout << kukaku-1 << endl;
  return 0;
}

Measured memory_bytes: 384
N = input()
if N[len(N) -1] == "3":
    print("bon")
elif (N[len(N) -1] =="0") or (N[len(N) -1] =="1")  or(N[len(N) -1] =="6") or (N[len(N) -1] =="8"):
    print("pon")
else:
    print("hon")

Measured memory_bytes: 8964
N=int(input())
A=[]
for i in range(1,(N//2)+1):
    A.append(list(str(i))+list(str(N-i)))
for i in range(len(A)):
    for j in range(len(A[i])):
        A[i][j]=int(A[i][j])
B=[]
for i in range(len(A)):
    B.append(sum(A[i]))
print(min(B))

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

struct Combination {
    Combination(ll n) {
        mNumTbl.resize(n + 1);
        mInverseNumTbl.resize(n + 1);
        mNumTbl[0] = 1;
        mInverseNumTbl[0] = 1;
        FOR(i, n + 1, 1) {
            mNumTbl[i] = (mNumTbl[i - 1] * i) % MOD;
        }
        FOR(i, n + 1, 1) {
            mInverseNumTbl[i] = modpow(mNumTbl[i]);
        }
    }

    ll get(ll n, ll r) {
        if (n < r || n < 0)
            return 0;
        return (((mNumTbl[n] * mInverseNumTbl[r]) % MOD) * mInverseNumTbl[n - r]) % MOD;
    }

    ll modpow(ll n) {
        ll s = 1, p = n;
        for (ll i = 0; (1LL << i) <= MOD - 2; ++i, p = (p * p) % MOD) {
            if (((MOD - 2) & (1 << i)) == 0)
                continue;
            s *= p;
            s %= MOD;
        }
        return s;
    }

    vector<ll> mInverseNumTbl;
    vector<ll> mNumTbl;
};

class Prime {
public:
    Prime(ll n) {
        mPrimeTbl.clear();
        vector<bool> u(n, false);
        for (ll i = 2; i <= n; ++i) {
            if (u[i])
                continue;
            mPrimeTbl.push_back(i);
            for (ll p = i; p <= n; p += i)
                u[p] = true;
        }
    }

    ~Prime() {}

    ll num() {
        return static_cast<ll>(mPrimeTbl.size());
    }

    ll get(ll index) {
        return mPrimeTbl[index];
    }

private:
    vector<ll> mPrimeTbl;
};

int main() {
    ll N, M;
    cin >> N >> M;
    Prime prime(100000);
    vector<ll> v;
    REP(i, prime.num()) {
        ll p = prime.get(i);
        ll n = 0;
        while (M % p == 0) {
            n++;
            M /= p;
        }
        if (n > 0)
            v.push_back(n);
    }

    if (M > 1)
        v.push_back(1);

    Combination cmb(200005);
    ll ans = 1;
    REP(i, v.size()) {
        ans = (ans * cmb.get(N + v[i] - 1, v[i])) % MOD;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
    char s;
    int counter5 = 0, counter7 = 0;
    for (int i = 0; i < 3; i++) {
        cin >> s;
        if (s == '5') {
            counter5++;
        } else if (s == '7') {
            counter7++;
        }
    }
    if (counter5 == 2 && counter7 == 1) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
const int maxn=(int)1e6+5;
map<char,char> counter;
int val[256];
int vis[maxn];
/* 
矛盾的时候只有出的一样的情况。、

 */
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    counter['r']='p';
    counter['p']='s';
    counter['s']='r';
    int n,k;cin>>n>>k;
    cin>>val['r']>>val['s']>>val['p'];
    string s;
    cin>>s;
    
    int ans=0;
    //debug(s);
    rep(i,0,n-1){
        if(vis[i])continue;
        vis[i]=1;
        int ii=i;
        while(ii<=n-1-k&&s[ii]==s[ii+k])ii+=k,vis[ii]=1;
        
        ans+=((ii-i)/k+2)/2*val[counter[s[i]]];
        debug(i),debug(ii),debug(s[i]),debug(val[counter[s[i]]]),debug(ans);
        //if(ii==i)ans+=val[counter[s[i]]];
    }
   cout<<ans<<endl;
}
/* 

 */

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

int main() {
    string S;
    cin >> S;
    int ans = 1;
    if (S.at(0) == S.at(1) && S.at(1) == 'R') ans++;
    if (S.at(1) == S.at(2) && S.at(1) == 'R') ans++;
    if (S.at(0) == S.at(1) && S.at(1) == S.at(2) && S.at(1) == 'S') ans = 0;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3548
import java.util.Scanner;

/**
 * Copyright © 2018 Chris. All rights reserved.
 *
 * @author Chris
 * 2018/6/23 11:55
 * @see meituan.n2018.Bturn
 */
public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int k = sc.nextInt();

        System.out.println((n - 1 + k - 2) / (k - 1));
    }
}


Measured memory_bytes: 23764
#include <iostream>
#include <cmath>
#include<iomanip>
using namespace std;

int main()
{
    double n,k;
    cin >> n >> k;
    double ans = 0;
    double i;
    for(i = 1;i <= n;++i){
        if(i <= k){
            double temp = log2(k/i);
            if((int)temp == temp){
                ans += pow(0.5,temp)/n;
            }else{
                ans += pow(0.5,(int)temp+1)/n;
            }
        }else{
            ans += 1/n;
        }
    }
    std::cout<<std::fixed<<std::setprecision(10) << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <algorithm>
#include <cmath>
using namespace std;
const int M = 100000;
const double pi = 3.141592653589;

int main()
{
	int a, b;
	while (cin>>a>>b) {
		a = a + b;
		int count = 0;
		while (a > 0) {
			a /= 10;
			count++;
		}
		printf("%d\n", count);
	}
}

Measured memory_bytes: 3056
h,w=map(int,input().split())
n=int(input())
a=list(map(int,input().split()))

from collections import deque

d=deque([])
for i in range(n):
    number=i+1
    cnt=a[i]
    for _ in range(cnt):
        d.append(number)

ans=[[0]*w for _ in range(h)]

flg_h=0
i=0
j=0
while d:
    v=d.popleft()
    ans[i][j]=v
    if flg_h==0:
        if i<h-1:
            i+=1
        else:
            j+=1
            flg_h=1
    elif flg_h==1:
        if i>0:
            i-=1
        else:
            j+=1
            flg_h=0

for i in range(h):
    print(*ans[i])

Measured memory_bytes: 9912
#include <bits/stdc++.h>
using namespace std;
int main() { 
    int n,a,b,val=0;
    std::vector<int> v;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a>>b;
        if(a==b) val+=1;
        else{
            v.push_back(val);
            val=0;
        }
    }
    v.push_back(val);
    sort(v.begin(),v.end());
    int x=v[v.size()-1];
    if(x>=3)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3636
#読み込み
bingo = []
for i in range(3):
    line = input().split(" ")
    bingo.append(line)

numbers = []
N = int(input())
for j in range(N):
    number = int(input())
    numbers.append(number)

#印付け
for i in range(3):
    for j in range(3):
        for k in range(N):
            if int(bingo[i][j]) == numbers[k]:
                bingo[i][j] = 101

#判定
if bingo[0][0] == bingo[0][1] == bingo[0][2]:
    print("Yes")
elif bingo[1][0] == bingo[1][1] == bingo[1][2]:
    print("Yes")
elif bingo[2][0] == bingo[2][1] == bingo[2][2]:
    print("Yes")
elif bingo[0][0] == bingo[1][0] == bingo[2][0]:
    print("Yes")
elif bingo[0][1] == bingo[1][1] == bingo[2][1]:
    print("Yes")
elif bingo[0][2] == bingo[1][2] == bingo[2][2]:
    print("Yes")
elif bingo[0][0] == bingo[1][1] == bingo[2][2]:
    print("Yes")
elif bingo[0][2] == bingo[1][1] == bingo[2][0]:
    print("Yes")

else:
    print("No")

Measured memory_bytes: 3064
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <queue>

using namespace std;

typedef pair<int,int> pii;

int dp[1001][1001];
int main(){

  int N;
  pii ps[1001];
  while(cin>>N&&N){
    for(int i=0;i<N;i++)cin>>ps[i].first>>ps[i].second;
    sort(ps,ps+N,greater<pii>());
    int rsum=0;
    int wsum=0;
    int res=0;
    for(int i=0;i<N;i++){
      rsum+=ps[i].first;
      wsum+=ps[i].second;
    }
    if(rsum-ps[0].first>=ps[0].first)res=rsum+wsum;
    else{
      const int leftTime=ps[0].first*2-rsum;
      // leftTimeを最大いくつ埋められるか?
      for(int i=N;i>=1;i--){
        for(int j=0;j<=leftTime;j++){
          int tmp=0;
          if(i==N)tmp=(leftTime-j);
          else{
            if(j-ps[i].second>=0)
              tmp=max(tmp,dp[i+1][j-ps[i].second]);
            tmp=max(tmp,dp[i+1][j]);
          }
          dp[i][j]=tmp;
        }
      }
      int add=leftTime-dp[1][leftTime];
      //cout<<leftTime<<" "<<add<<endl;
      res=add+rsum+wsum;
    }
    cout<<res<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 5080
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int (i)=(m);(i)<(n);++(i))
#define rREP(i,m,n) for(int (i)=(n)-1;(i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;
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;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	int a, b; cin >> a >> b;
	if (a == b)cout << "Draw" << "\n";
	else if (a == 1) cout << "Alice" << "\n";
	else if (b == 1)cout << "Bob" << "\n";
	else if (a > b)cout << "Alice" << "\n";
	else cout << "Bob" << "\n";

	return 0;
}

Measured memory_bytes: 3664
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn main() {
    let s = read::<String>();
    let mut ans = 0;
    for i in s.chars() {
        if i == '+' {
            ans = ans + 1;
        } else{
            ans = ans -1;
        }
    }
    println!("{}",ans );
}

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

int x;
vector<int> v = {1,2,3};
unordered_map<int,int> m;
int main() {
    cin >> x;
    if(x >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
} 


Measured memory_bytes: 3584
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP(I,N) cin>>V[I]
#define INS2(I,N,V1,V2) REP(I,N) cin>>V1[I]>>V2[I];
#define INS3(I,N,V1,V2,V3) REP(I,N) cin>>V1[I]>>V2[I]>>V3[I];
#define OUT(P) cout<<P<<endl
#define OUT2(P1,P2) cout<<P1<<" "<<P2<<endl
#define OUT3(P1,P2,P3) cout<<P1<<" "<<P2<<" "<<P3<<endl
#define OUTS(I,N,V) REP(I,N) cout<<V[i]<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
const int M=500;
int N,C[M],S[M],F[M],i,j,t;
inline void solve(){
  IN(N);
  INS3(i,N-1,C,S,F);
  REP(i,N){
    t=0;
    FOR(j,i,N-1){
      if(t<S[j])t=S[j];
      else if((t-S[j])%F[j]!=0)t=t+F[j]-t%F[j];
      t+=C[j];
    }
    OUT(t);
  }
}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int dx[]={1,0,0,-1,1,-1,-1,1};
const int dy[]={0,1,-1,0,1,1,-1,-1};
const int INF = 1<<30;
const double EPS = 1e-8;
#define PB push_back
#define mk make_pair
#define fr first
#define sc second
#define reps(i,j,k) for(int i = (j); i < (k); ++i)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
typedef pair<int,int> Pii;
typedef pair<int,Pii > P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
struct data
{
	int to;
	int fare;
	int hour;
	int admin;
	data(){}
	data(int _to,int _fare,int _hour,int _admin){
		to = _to;
		fare = _fare;
		hour = _hour;
		admin = _admin;
	}
	bool operator<(const data &a)const{
		if(fare != a.fare)return fare>a.fare;
		return hour>a.hour;
	}
};
vector < data > Graph[128];
int ps[258];
int dp[258];
int start,goal;
int H;
void init(){
	rep(i,128){
		Graph[i].clear();
	}
	rep(i,(1<<8)+1){
		dp[i] = INF;
	}
	return ;
}

int dijkstra(int pass,int ma){
	int memo[25][101];
	rep(i,25){
		rep(j,101){
			memo[i][j] = INF;
		}
	}
	int ans = INF;
	priority_queue < data > Q;
	Q.push(data(start,dp[pass],0,pass));
	while(!Q.empty()){
		data e = Q.top();Q.pop();
		if(e.hour > H)continue;
		if(memo[e.hour][e.to] != INF)continue;
		memo[e.hour][e.to] = e.fare;
		if(e.to == goal){
			ans = e.fare;
			break;
		}
		if(e.fare > ma){
			break;
		}
		rep(i,Graph[e.to].size()){
			if(e.admin&(1<<Graph[e.to][i].admin)){
				Q.push(data(Graph[e.to][i].to,e.fare,e.hour+Graph[e.to][i].hour,e.admin));
			}
			else{
				Q.push(data(Graph[e.to][i].to,e.fare+Graph[e.to][i].fare,e.hour+Graph[e.to][i].hour,e.admin));
			}
		}
	}
	return ans;
}

int main(){
	int N,M,K;
	while(true){
		scanf("%d%d%d%d",&N,&M,&H,&K);
		if(N == M && M == H && H == K && K == 0)break;
		init();
		rep(i,M){
			int a,b,c,h,r;
			scanf("%d%d%d%d%d",&a,&b,&c,&h,&r);
			--a;--b;--r;
			Graph[a].PB(data(b,c,h,r));
			Graph[b].PB(data(a,c,h,r));
		}
		scanf("%d%d",&start,&goal);
		--start;--goal;
		int P;
		scanf("%d",&P);
		rep(i,P){
			int m,c;
			scanf("%d%d",&m,&c);
			int bit = 0;
			rep(j,m){
				int tmp;
				scanf("%d",&tmp);
				bit += 1<<(tmp-1);
			}
			ps[i] = bit;
			dp[bit] = c;
		}
		int ans = INF;
		dp[0] = 0;
		rep(i,1<<K){
			if(dp[i] > ans)continue;
			ans = min(ans,dijkstra(i,ans));
			rep(j,P){
				dp[i|ps[j]] = min(dp[i|ps[j]],dp[i]+dp[ps[j]]);
			}
		}
		if(ans == INF){
			ans = -1;
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 5236
n = int(input())
a = input().split()
a = [int(m) for m in a]
dic = {}
dic2 = {}
for i in range(n + 1):
    dic[a[i]] = 0
    dic2[a[i]] = []
f = 0
s = 0
for i in range(n + 1):
    dic[a[i]] += 1
    dic2[a[i]].append(i)
    if dic[a[i]] == 2:
        f = dic2[a[i]][0]
        s = i
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
 
mod = 10**9+7 #出力の制限
N = n + 1
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
 
for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
 
 
for k in range(1,n + 2):
    if k == 1:
        print(n)
    else:
        if f + n - s +1>= k:
            if (cmb(n + 1, k, mod) - cmb(f + n - s, k-1, mod)) >= 0:
                print(cmb(n + 1, k, mod) - cmb(f + n - s, k-1, mod))
            else:
                print(cmb(n + 1, k, mod) - cmb(f + n - s, k-1, mod) + mod)
        elif f+n-s+1<k:
            print(cmb(n + 1, k, mod))

Measured memory_bytes: 48840
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int N, X, Y;
map<int,int> ans;

void init()
{
	for(int i=1;i<=N;++i)for(int j=i+1;j<=N;++j){
		int d = j-i;
		// i to x to y then to j
		d = min(d, abs(i-X)+1+abs(j-Y));
		// i to y to x then to j
		d = min(d, abs(i-Y)+1+abs(j-X));
		ans[d]++;
	}
}

void solve()
{
	init();
	cout << N << '\n';
	for(int d = 2; d < N; ++d) cout << ans[d] << '\n';
}

int main()
{
	cin >> N >> X >> Y;
	solve();
	return 0;
}

Measured memory_bytes: 384
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<list>
#include<queue>
#include<numeric>
#include<map>
#include<string>

using namespace std;

long long int gcd(long long int a, long long int b) {
    if (a == 0) return b;
    else return gcd(b%a, a);
}

int main() {
    long long int n, a, b;

    scanf("%lld", &n);
    scanf("%lld", &a);
    for (int i = 1; i < n; i++) {
        scanf("%lld", &b);
        a = gcd(a, b);
    }

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

    return 0;
}


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

typedef complex<double> point;
double cross(const point& a, const point& b) {
	return imag(conj(a)*b);
}

typedef vector<point> polygon;
double area2(const polygon& P) {
	double A = 0;
	for (int i = 0; i < P.size(); ++i) 
		A += cross(P[i], P[(i + 1) % P.size()]);
	return A;
}

int main() {
	int n; int idx = 1;
	while (cin >> n, n) {
		polygon pol(n);
		for (auto& p : pol) {
			int x, y;
			cin >> x >> y;
			p = point(x, y);
		}
		pol = polygon(pol.rbegin(), pol.rend());
		double a = area2(pol);
		printf("%d %.1lf\n",idx, a / 2);
		idx++;
	}
	return 0;
}

Measured memory_bytes: 1212
n = [int(i) for i in input().split()]
m = []
result = n[0]
for i in range(n[0]):
  m.append(int(input()))
m.sort()
n[1] -= sum(m)
while(n[1]>=0):
  result +=1
  n[1] -= m[0]
print(result-1)

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

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

    int ans = 1001001001;
    for (int i = 0; i <= 100000; i++) {
        int price = 2 * C * i + A * max(0, X - i) + B * max(0, Y - i);
        ans = min(ans, price);
    }

    cout << ans << endl;
}

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

using namespace std;

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

    int total = 0;
    int vi;
    for (int i = 0; i < n; ++i)
    {
        cin >> vi;
        total += vi;
        
        if  (total >= h)
        {
            cout << "Yes";
            return 0;
        }
    }

    cout << "No";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>

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

long long lcm(long a, long b)
{
    return a / gcd(a, b) * b; 
}



int main () {
    long long a, b, c, d;
    std::cin >> a >> b >> c >> d;

    long long cd = lcm(c, d);
    long long x = b / c;
    long long y = b / d;
    long long z = b / cd;

    long long sumAll = x + y - z;

    long long n = (a - 1) / c;
    long long m = (a - 1) / d;
    long long k = (a - 1) / cd;

    long long sumSub = n + m - k;

    std::cout << b - a + 1 - (sumAll - sumSub) << std::endl;

}


Measured memory_bytes: 256
#!/usr/bin/env python3

def main():
    na = list(map(int, input().split()))
    A, B, C, X, Y = na[0], na[1], na[2], na[3], na[4]

    r = 0
    if A + B <= C * 2:
        r = A * X + B * Y
    elif C * 2 < A and C * 2 < B:
        r = C * 2 * max(X, Y)
    elif C * 2 < A:
        r = C * 2 * X
        if X < Y:
            r += B * (Y - X)
    elif C * 2 < B:
        r = C * 2 * Y
        if Y < X:
            r += A * (X - Y)
    else:
        r = C * 2 * min(X, Y)
        if X < Y:
            r += B * (Y - X)
        else:
            r += A * (X - Y)

    print(r)


if __name__ == '__main__':
    main()



Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>
#include <queue>
#include <unordered_set>
#include <climits>
#include <set>
#include <list>
#include <cmath>
#include <map>

using namespace std;
typedef long long ll;

int main()
{
	int x;
	cin >> x;
	if(x == 0){
		cout << 1 << endl;
	}else{
		cout << 0 << endl;
	}
	return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> d(n);
    vector<ll> a(n);
    
    ll ans = 0;
    ll show = 0;
    vector<ll> amari(n);
    rep(i,n){
        cin>>d[i]>>a[i];
        ans += a[i];
        show += d[i]*a[i]/9;
        amari[i] = d[i]*a[i]%9;
    }
    ll sum_amari = 0;
    rep(i,n){
        sum_amari += amari[i];
    }
    show += sum_amari / 9;
    if((sum_amari)%9){
        cout << ans+show-1 << endl;
    }else{
        cout << ans+show-2 << endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    int count=0;
    for(int i=1;i<n-1;i++){
        if(a[i]>a[i-1]&&a[i]<a[i+1])count++;
        else if(a[i]>a[i+1]&&a[i]<a[i-1])count++;
    }

    cout<<count<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

ll n;
ll memo[100];

ll solve(int now) {
	if (now == 0)return 1;
	if (now < 0)return 0;
	if (memo[now] != -1)return memo[now];
	return memo[now] = solve(now - 1) + solve(now - 2) + solve(now - 3);
}

int main() {
	fill(memo, memo + 100, -1);
	solve(30);
	while (cin >> n&&n) {
		cout << memo[n] / 3650 + 1 << endl;
	}
}

Measured memory_bytes: 3060
#pragma once
#include <stdio.h>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <limits>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define bit(x,v) ((ll)x << v)

const ll INF = 1000000007;
const int MAX = 210000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}

// res[i][c] := i 文字目以降で最初に文字 c が登場する index (存在しないときは n)
vector<vector<int> > calcNext(const string& S) {
	int n = (int)S.size();
	vector<vector<int> > res(n + 1, vector<int>(26, n));
	for (int i = n - 1; i >= 0; --i) {
		for (int j = 0; j < 26; ++j) res[i][j] = res[i + 1][j];
		res[i][S[i] - 'a'] = i;
	}
	return res;
}
// mod 1000000007 の世界で a += b する関数
int n;
int bit[100010];
void add(int v, int x) {

	while (v <= n)
	{
		bit[v] += x;
		v += v & -v;
	}
}

ll sum(int v) {
	ll r = 0;
	while (v > 0)
	{
		r += bit[v];
		v -= v & -v;
	}
	return r;
}
void put(string v) {
	cout << "a" << v<< "b" << endl;
}
void solv() {

	int a, b, c;
	cin >> a >> b >> c;
	int co = 0;
	for (size_t i = a; i <= b; i++)
	{
		if (c % i== 0)co++;
	}
	cout << co << endl;;
}


int main() {
	//	COMinit();
	solv();

	return 0;
}



Measured memory_bytes: 3108
/*Arnab's Code
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define vll vector<ll>
#define vii vector<int>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define take(a,n) for(ll i=0;i<n;i++)cin>>a[i]
#define takes(a,n,st) for(ll i=st;i<n+st;i++)cin>>a[i]
ll sum(ll a[],ll n,ll s){ for(ll i=0;i<n;i++)s+=a[i]; return s;}
#define mod 1000000009
ll power(ll x, ll y, ll p)  {  
    ll res = 1;  
    x = x % p;   
    if (x == 0) return 0;  
    while (y > 0){  
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1;
        x = (x*x) % p;  
    }  
    return res;  
}
void solve(){
	ll tot,i,o,t,j,l,s,z;
	cin>>i>>o>>t>>j>>l>>s>>z;
	tot=o*2;
	tot+=((i/2)*4);
	tot+=((j/2)*4);
	tot+=((l/2)*4);
	tot+=(6*(i%2)*(j%2)*(l%2));
	if((i%2)+(j%2)+(l%2) == 2){
		if(i>0 and j>0 and l>0)
			tot+=2;
	}
	cout<<tot/2;
	return;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	ll t,T;
//	cin>>T;
	T=1;
	for(t=1;t<=T;t++){
//		cout<<"Case #"<<t<<": ";
		solve();
	}
	return 0;
}

Measured memory_bytes: 3652
n = int(input())
XYH = []
for i in range(n):
    x, y, h = map(int, input().split())
    XYH.append((h, x, y))

XYH.sort(reverse=True)


for i in range(101):
    for j in range(101):
        H = -1
        flag = True
        for k in range(n):
            h, x, y = XYH[k]
            if H == -1:
                H = abs(x-i)+abs(y-j)+h
            else:
                if max(H-abs(x-i)-abs(y-j), 0) != h:
                    flag = False
        if flag:
            print(i, j, H)
            exit()


Measured memory_bytes: 73868
import sys
def input():
	return sys.stdin.buffer.readline()[:-1]

class SegTree():
	def __init__(self, a, func, idem):
		#the number of nodes is 2n-1
		self.n = 1 << len(a).bit_length()
		self.size = len(a)
		self.func = func
		self.idem = idem
		self.node = [idem] * (2*self.n-1)
		for i in range(len(a)+self.n-2, -1, -1):
			if i >= self.n-1:
				self.node[i] = a[i-self.n+1]
			else:
				self.node[i] = self.func(self.node[2*i+1], self.node[2*i+2])

	def get(self, x):
		return self.node[x+self.n-1]

	def set(self, x, val):
		x += self.n-1
		self.node[x] = val
		while x > 0:
			x = (x-1)>>1
			self.node[x] = self.func(self.node[2*x+1], self.node[2*x+2])
		return

	#[l, r)
	def prod(self, l, r):
		L, R = l+self.n, r+self.n
		s_l, s_r = self.idem, self.idem
		while L<R:
			if R & 1:
				R -= 1
				s_r = self.func(self.node[R-1], s_r)
			if L & 1:
				s_l = self.func(s_l, self.node[L-1])
				L += 1
			L >>= 1
			R >>= 1
		return self.func(s_l, s_r)

	#maximum of r (within [l, n)) which satisfies val(prod(l, r))
	def max_right(self, l, val):
		if l == self.size:
			return self.size
		L = l + self.n
		s = self.idem
		while True:
			while (L % 2 == 0):
				L >>= 1
			if not val(self.func(s, self.node[L-1])):
				while L < self.n:
					L <<= 1
					if val(self.func(s, self.node[L-1])):
						s = self.func(s, self.node[L-1])
						L += 1
				return L - self.n
			s = self.func(s, self.node[L-1])
			L += 1
			if (L & -L) == L:
				return self.size

	#minimum of l (within [0, r)) which satisfies val(prod(l, r))
	def min_left(self, r, val):
		if r == 0:
			return 0
		R = r + self.n
		s = self.idem
		while True:
			R -= 1
			while R > 1 and R % 2:
				R >>= 1
			if not val(self.func(self.node[R-1], s)):
				while R < self.n:
					R = (R << 1) + 1
					if val(self.func(self.node[R-1], s)):
						s = self.func(self.node[R-1], s)
						R -= 1
				return R + 1 - self.n
			s = self.func(self.node[R-1], s)
			if (R & -R) == R:
				return 0


n, q = map(int, input().split())
a = list(map(int, input().split()))
st = SegTree(a, max, 0)
for _ in range(q):
	t, x, y = map(int, input().split())
	if t == 1:
		st.set(x-1, y)
	elif t == 2:
		print(st.prod(x-1, y))
	else:
		print(st.max_right(x-1, lambda z: z < y) + 1)

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

typedef long long ll;
// #define int long long

#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, r, n) for (int i = (r); i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); i--) // from n to r
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))

bool IsPrime(int);

/***** MAIN *****/
signed main() {
  string s;
  cin >> s;
  int stringLength = s.size();
  int numerical_sequence[stringLength+1];
  numerical_sequence[0] = 0;
  
  int count = 0;
  ll ans = 0;
  REP(i, stringLength) {
    if(s[i] == '>') count = 0;
    else count++;
    numerical_sequence[i+1] = count;
  }
  count = 0;
 
  ans += numerical_sequence[stringLength];
  REPR(i, stringLength-1) {
    if(s[i] == '<') count = 0;
    else count++;
    ans += max(numerical_sequence[i], count);
  }
 
  cout << ans;
 
  cout << "\n";
  return 0;
}
/***** MAIN *****/

bool IsPrime(int a) {
  if(a <= 1) return false;
  if(a == 2) return true;
  if(a%2 == 0) return false;
  for(int i = 3; i*i <= a; i+=2) {
    if(a%i==0) return false;
  }
  return true;
}

Measured memory_bytes: 2820
#include<bits/stdc++.h>
using namespace std;
#define ll         long long int
#define co         cout
#define ci         cin
#define sf1(n)     scanf("%lld",&n)
#define sf2(n,m)   scanf("%lld %lld",&n,&m);
#define sf3(n,m,p) scanf("%lld %lld %lld",&n,&m,&p);
#define pf1(n)     printf("%lld\n",n);
#define en         cout<<endl;
#define pb         push_back
#define fi         first
#define se         second
#define coy        cout<< "YES"<<endl;
#define con        cout<< "NO"<<endl;
#define f(a,b)     for(ll i=a;i<b;i++)
#define pi         pair<ll,ll>
#define br         break;
#define i64        long long

ll vis[150];

int main()
{
    ll t,n,g,k,m,mx=0,mn=1e9,c,res,c1,x,y,w,z,c2;
    ci>>x>>y;
    c=0;
    for(ll i=0;i<=x;i++)
    {
        if(i*2+(x-i)*4==y)
        {
            c=1;
            br
        }
    }
    if(c) co<< "Yes";
    else co<< "No";
}


Measured memory_bytes: 3620