akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<stack>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<cctype>
#include<iomanip>
#include<limits>
#include<bitset>

using namespace std;
typedef long long int ll; typedef pair<int, int> P;
const ll mod = 1e9 + 7;
const int inf = 1e9 + 7;
const ll linf = 1LL << 60;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define REP(i,m,n) for(int i=(m);i<(int)n;i++)
#define all(a) (a).begin(),(a).end()
#define allg(a) (a).begin(),(a).end(),greater<>()
#define SUM(a) accumulate((a).begin(),(a).end(),0)
#define d10 std::setprecision(10)
#define d20 std::setprecision(20)
#define sz size()
using str = string;
const double PI = 3.14159265359;
ll gcd(ll a, ll b) { ll t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
int gcd(int a, int b) { int t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
ll recfact(ll start, ll n) {
	ll i;
	if (n <= 16) {
		ll r = start;
		for (i = start + 1; i < start + n; i++) r = r * i % mod;
		return r % mod;
	}
	i = n / 2;
	return recfact(start, i) % mod * recfact(start + i, n - i) % mod;
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}
ll fct(ll n) { return recfact(1, n); }
ll ncm(ll n, ll m) {
	if (n < m)return 0;
	ll x = (fct(n) % mod / (fct(m) * fct(n - m)) % mod) % mod;
	return x;
}
bool isincluded(char x, string str) {
	bool f = 0;
	for (size_t i = 0; i < str.size(); i++) {
		if (str.at(i) == x)f = 1;
	}
	return f;
}
int ctoi(char c) {
	if ('0' <= c && c <= '9') {
		return c - '0';
	}
	return 0;
}




int main(void) {
	ll a, b; cin >> a >> b;
	cout << a * b / gcd(a, b) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>

using namespace std;

int main(int argc, char const *argv[])
{
	int n;
	int m,p;
	int k,l;

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

		map<int,set<int> > mp;
		map<int,set<int> >::iterator it;
		
		for(int i1=0;i1<n;i1++){
			cin>>m;
			set<int> s;
			for(int i2=0;i2<m;i2++){
				cin>>p;
				s.insert(p);
			}
			mp[i1]=s;
		}
		cin>>k;
		for(int i1=0;i1<k;i1++){
			cin>>l;

			for(it=mp.begin();it!=mp.end();it++){
				if((*it).second.find(l)==(*it).second.end()) {
					mp.erase(it);
					
				}
			}
		}


		if(mp.size()==1) {
			it=mp.begin();
			cout<<(*it).first+1<<endl;
		}
		else cout<<-1<<endl;

	}
	return 0;
}

Measured memory_bytes: 1632
n, k = map(int, input().split())
*A, = map(int, input().split())
p = 10**9 + 7
A.sort()
ans = 1
if A[n - 1] <= 0 and k % 2 == 1:
    for i in range(k):
        ans *= A[n - 1 - i]
        ans %= p
    print(ans)
    exit()
i = 0
j = n - 1
if k % 2 == 1:
    ans *= A[j]
    ans %= p
    j -= 1
    k -= 1
for _ in range(k // 2):
    left = A[i] * A[i + 1]
    right = A[j] * A[j - 1]
    if (left > right):
        ans *= left
        ans %= p
        i += 2
    else:
        ans *= right
        ans %= p
        j -= 2
print(ans)


Measured memory_bytes: 104316
#-*- coding: utf_8 -*-

data = []
data.append([int(input())])
length = 2
counter = 0
while length != 1:
    r = [int(x) for x in input().split(",")]
    data.append(r)
    length = len(r)
    counter += 1

N = int((counter + 1 )/ 2) + 1
dp = [[0 for i in range(N)] for j in range(N)]
data_arr = [[0 for i in range(N)] for j in range(N)]

left = data[:N]
right = data[N:]

i = 0
for v in left:
    for idx, r in enumerate(v):
        data_arr[i - idx][idx] = r
    i += 1
right.reverse()
for i, v in enumerate(right):
    for idx, r in enumerate(v):
        data_arr[N - 1 - idx][N - 1 - i + idx] = r


dp[0][0] = data_arr[0][0]

for i in range(1, N):
    dp[0][i] = dp[0][i - 1] + data_arr[0][i]
    dp[i][0] = dp[i - 1][0] + data_arr[i][0]

for i in range(1, N):
    for j in range(1, N):
        dp[i][j] += data_arr[i][j] + max(dp[i - 1][j], dp[i][j - 1])

print(dp[N - 1][N - 1])

Measured memory_bytes: 7892
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <iostream>
#include <queue>
#include <utility>
#include <vector>
using namespace std;
#define ll long long
#define INFTY 1 << 21
int x[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
int y[8] = {1, 0, -1, 1, -1, 1, 0, -1};

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


Measured memory_bytes: 256
h, w = map(int, input().split())
n = int(input())
color = list(map(int, input().split()))
colors = []
for c, num in enumerate(color):
    colors += [c+1]*num
mat = [[0]*w for _ in range(h)]
color_idx = 0

for row in range(h):
    if row %2 == 0:
        for col in range(w):
            mat[row][col] = colors[color_idx]
            color_idx += 1
    else:
        for col in range(w-1, -1, -1):
            mat[row][col] = colors[color_idx]
            color_idx += 1

for row in mat:
    print(' '.join(map(str, row)))

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

std::vector<int> day[31];
std::vector<int> temp;
std::list<int> member[51];
int n,m,a;
int gi;

bool condi(int x){
	for(int i=0;i<temp.size();i++){
		if(x==temp[i])return true;
	}
	return false;
}

int main(void){
	while(cin>>n,n){
		for(int i=0;i<31;i++)day[i].clear();
		for(int i=0;i<n;i++)member[i].clear();
		for(int i=0;i<n;i++)member[i].push_front(i);
		bool flag=false;
		for(int i=0;i<n;i++){
			cin>>m;
			for(int j=0;j<m;j++){
				cin>>a;
				day[a].push_back(i);
			}
		}

		for(int gi=0;gi<31;gi++){
			// cout<<"day"<<gi<<":"<<endl;
			if(day[gi].size()<=1)continue;
			for(int i=1;i<day[gi].size();i++){
				member[day[gi][0]].merge(member[day[gi][i]]);
			}
			member[day[gi][0]].sort();
			member[day[gi][0]].unique();
			for(int i=1;i<day[gi].size();i++){
				member[day[gi][i]]=member[day[gi][0]];
			}
			/*
			for(int i=0;i<n;i++){
				cout<<"list:"<<i<<endl;
				for(list<int>::iterator it=member[i].begin();it!=member[i].end();it++){
					cout<<*it<<" ";
				}
				cout<<endl;
			}
			*/
			for(int i=0;i<n;i++){
				if(member[i].size()==n){
					flag=true;
					cout<<gi<<endl;
					goto LAB;
				}
			}
		}
LAB:
		if(!flag)cout<<"-1"<<endl;
	}
	return 0;
}

Measured memory_bytes: 3144
# -*- coding: utf-8 -*-
import numpy as np
def fnSolv():
  iNum, iK = map(int, input().split())
  naHn  = np.array(list(map(int, input().split())))
  naDP  = np.zeros(iNum, dtype='int64')
  naLen = np.ones(iK) * 10**9
  for iI0 in range(1, iNum):
    iK0 = min([iK, iI0])
    naLen = naDP[iI0-iK0:iI0] + np.abs(- naHn[iI0-iK0:iI0] + naHn[iI0])
    naDP[iI0] = naLen.min()
  print(naDP[iNum-1])

if __name__ == '__main__':
  fnSolv()

Measured memory_bytes: 22916
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

// ここまで

fn trans (dp: &mut Vec<bool>, a: usize) {
    let mut i = dp.len() - 1;
    while i >= a {
        dp[i] = dp[i] || dp[i - a];
        i -= 1;
    }
}

fn calc (x: &Vec<usize>, l: usize, r: usize, mut dp: &mut Vec<bool>) -> usize {
    if l + 1 == r {
        let mut k = dp.len() - 1;
        while !dp[k] {
            k -= 1;
        }
        return if x[l] + k >= dp.len() {0} else {1};
    }
    let save = dp.clone();
    let m = (l + r) / 2;
    for i in l..m {
        trans (&mut dp, x[i]);
    }
    let front = calc (x, m, r, &mut dp);
    dp.clone_from (&save);
    for i in m..r {
        trans (&mut dp, x[i]);
    }
    front + calc (x, l, m, &mut dp)
}

fn run() {
    input! {
        n: usize,
        k: usize,
        a: [usize; n],
    }
    let mut dp = vec![false; k];
    dp[0] = true;
    let ans = calc (&a, 0, n, &mut dp);
    println! ("{}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 4352
l = list(map(int, input().split()))

l.sort()

count = 0
while l[2] - l[0] > 1:
    l[0] += 2
    count += 1
    l.sort()

if l[2] == l[1] != l[0]:
    count += 2
elif l[0] == l[1] != l[2]:
    count += 1

print(count)

Measured memory_bytes: 38384
#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 ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
  int n;
  cin >> n;
  vector<int> v(n);
  rep(i,n) cin >> v[i];
  int t = INF;
  int ans = 0;
  rep(i,n) {
    if (v[i] <= t) ans++;
    t = min(t, v[i]);
  }
  cout << ans << endl;
}

int main() {
  solve();
  return 0;
}

Measured memory_bytes: 4068
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define floop(i,a,n) for (int i=a;i<n;i++)
#define rfloop(i,a,n) for (int i=n-1;i>=a;i--)
#define mloop(it,x) for(it=x.begin();it!=x.end();it++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((ll)(x).size())
#define cases ll t; cin>>t; while(t--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long ll;
typedef unsigned long long int ull;
typedef vector<ll> vec;
typedef pair<ll,ll> pll;
typedef double db;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const ll mod=1000000007;
ll pm(ll x,ll n) {ll result=1; while(n>0){if(n%2==1) result=((result%mod)*(x%mod))%mod; x=((x%mod)*(x%mod))%mod; n/=2;} return result;}
ll p(ll x,ll n) {ll result=1; while(n>0){if(n%2==1) result=result*x; x=x*x; n/=2;} return result;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll ncr(ll n,ll r) { ll p=1,k=1; if(n-r<r) r=n-r; if(r!=0) {while(r!=0) {p*=n; k*=r; ll temp=gcd(p,k); p/=temp; k/=temp; n--; r--;} } else p=1; return p;}
ll factorial[200000+1];
void fact(ll n) { factorial[0]=1; factorial[1]=1; floop(i,2,n+1) factorial[i] = (i * factorial[i-1]%mod) % mod; }
ll d,coeff1,coeff2; 
void euclid(ll a, ll b) { if(b==0) { d=a; coeff1=1; coeff2=0; } else { euclid(b,a%b); ll temp=coeff1; coeff1=coeff2; coeff2=temp-(a/b)*(coeff2); } }
ll modinv(ll a) { euclid(a,mod); return (coeff1%mod+mod)%mod; }
int prime[1000001]={};
int spf[1000001]={};
void sieve(ll n)
{
	prime[0]=1;
	prime[1]=1;
	for(ll i=2;i*i<=n;i++)
	{
		if(prime[i]==0)
		{
			for(ll j=i*i;j<=n;j+=i)
			{
				prime[j]=1;	
				if(spf[j]==j)
				spf[j]=i;	
			}		
		}
	}
}
/*
vec s(300000,0);
vec si(300000,1);
ll root(ll a)
{
	while(s[a]!=a)
	a=s[a];
	return a;
}
void uni(ll a,ll b)
{
	ll r1=root(a);
	ll r2=root(b);
	if(si[r1]<si[r2])
	{
		s[r1]=s[r2];
		si[r2]+=si[r1];
	}
	else
	{
		s[r2]=s[r1];
		si[r1]+=si[r2];
	}
}
vector<vec > adj(300000);
vec vis(300000,0);
vec dist(300000,0);
void dfs(ll t,ll n)
{
	vis[t]=1;
	floop(i,0,sz(adj[t]))
	{
		if(vis[adj[t][i]]==0)
		{
			dist[adj[t][i]]=dist[t]+1;
			vis[adj[t][i]]=1;
		//	sum[adj[t][i]]=sum[t]+c[t][adj[t][i]];
			dfs(adj[t][i],n);
		}
	}
}*/
int main()
{
	string s,t;
	cin>>s>>t;
	int flag=0;
	floop(i,0,sz(s))
	{
		if(s[i]!=t[i])
		{
			flag=1;
			break;
		}
	}
	if(flag==0)
	cout<<"Yes\n";
	else
	cout<<"No\n";
	return 0;
}

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

int main(){
  int N,M;
  cin >> N >> M;
  int a[M][2];
  for (int i=0; i < M; i++){
    cin >> a[i][0] >> a[i][1];
  }
  int count[N]={};
  for (int c=1; c < N+1; c++){
    for (int i=0; i < M; i++){
      if (a[i][0] == c){
        count[c-1] +=1;
      }
      if (a[i][1] == c){
        count[c-1] +=1;
      }
    }
  }
  for (int i=0; i < N; i++){
    cout << count[i] << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e9;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
int main(){
	int n,s,t;
	while(cin>>n>>s>>t,n+s+t){
		s=s/100*60+s%100;
		t=t/100*60+t%100;
		vi in(2000);
		rep(i,n){
			int m;cin>>m;
			while(m--){
				int c,d;
				cin>>c>>d;
				c=c/100*60+c%100;
				d=d/100*60+d%100;
				in[c]++;in[d]--;
			}
		}
		int out=0;
		int co=0;
		int sum=0;
		loop(i,s,t){
			sum+=in[i];
			if(sum!=n)co++;
			else{
				out=max(out,co);
				co=0;
			}
		}
		cout<<max(out,co)<<endl;
	}
}

Measured memory_bytes: 1196
#include<bits/stdc++.h>
using namespace std;
main(){
    vector<pair<int,int> > v;
    int n;
    cin>>n;
    for(int i =1 ;i <= n; i++){
        int a,b;
        cin>>a>>b;
        v.push_back({a-b,a+b});
    }
    int M = -1e9, ans = 0;
    sort(v.begin(),v.end());
    for(int i =0 ;i < v.size(); i++){
        if(v[i].first >= M){
            ans++;
            M = v[i].second;
        }
        else{
            M = min(M, v[i].second);
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1400
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF (1<<30)-1
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }

int main(){
  int n; cin >> n;
  vi a(n); rep(i,n) cin >> a[i];
  ll x = 0;
  rep(i,n){
    if(i % 2 == 0) x += a[i];
    else x -= a[i];
  }
  x /= 2;
  vi ans(n);
  ans[0] = x;
  rep(i,n-1) ans[i+1] = a[i] - ans[i];
  rep(i,n) cout << ans[i]*2 << " ";
  cout << "\n";
  return 0;
}


Measured memory_bytes: 4032
#include <iostream>
#include <algorithm>
using namespace std;
int n,m,d[1005],t,i,j,ans[1005];
int main(){
      cin>>n>>m;
      for(i=0;i<n;i++)cin>>d[i];
      for(i=0;i<m;i++){
            cin>>t;
            for(j=0;j<n;j++)if(t>=d[j]){ans[j]++;break;}
      }
      t=-1;
      for(i=0;i<n;i++)if(t<ans[i]){t=ans[i];m=i+1;}
      cout<<m<<endl;
}

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

int main() {
    //餅の枚数の指定
    int N = 0;
    cin >> N;

    //餅ベクトル
    vector<int> vec(N);
    for(int i = 0;i < N;i++){
        cin >> vec.at(i);
    }
    sort(vec.begin(),vec.end());
    reverse(vec.begin(),vec.end());

    //枚数チェック
    int count = 1;
    for(int i = 1;i < N;i++){
        if(vec.at(i) != vec.at(i - 1)){
            count++;
        }
    }
    cout << count << endl;

}


Measured memory_bytes: 256
X = int(input())

if X >= 500:
  gohyaku = X // 500
  nokori = X - (gohyaku * 500)
  go = nokori // 5

  uresi = (1000 * gohyaku) + (5 * go)

else:
  go = X // 5
  uresi = (5 * go)

print(uresi)

Measured memory_bytes: 2940
H,W=map(int, input().split())

S=[]
for i in range(H):
  s=list(input())
  S.append(s)
D=[(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1),(-1,0),(-1,1)]
#print(S)
ans=[[] for _ in range(H)]
for h in range(H):
  for w in range(W):
    if S[h][w]=="#":
        ans[h].append("#")
    else:
      count=0
      for d in D:
        dh,dw=d
        nh=h+dh
        nw=w+dw
        if 0<=nh and nh<H and 0<=nw and nw<W and S[nh][nw]=="#":
          count+=1
      ans[h].append(str(count))
for A in ans:
  print("".join(A))

Measured memory_bytes: 3188
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N;
	string s;
	while(cin>>N) {
		map<string, ll> h;
		REP(i, N) {
			cin>>s;
			h[s]++;
		}
		ll mx = 0;
		for(auto kv: h) {
			maxUpdate(mx, kv.SE);
		}
		vector<string> ss;
		for(auto kv: h) {
			if(kv.SE==mx) ss.PB(kv.FI);
		}
		sort(ALL(ss));
		
		REP(i, ss.size()) cout<<ss[i]<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 25584
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define repA(i, a, n) for(ll i = a; i <= (n); ++i)
#define repD(i, a, n) for(ll i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (long long) (x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
#define MAXN 5000000
const long double PI = 3.141592653589793238462643383;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long int> vll;
typedef vector<double> vd;
typedef vector<pii> vii;
const long long mod = 1000000007;
int Ceil(int a, int b){
    if(a%b==0) return a/b;
    else return (a/b)+1;
}
ll pow(ll a,ll b,ll mod){
    ll ans = 1;
    while(b){
        if(b&1)
            ans*= a;
        ans%= mod;
        a*= a;
        a%= mod;
        b/=2;
    }
    return ans;
}
int main(){
 
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);   
    freopen("output.txt", "w", stdout);
    #endif
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
    int n;
    cin>>n;
    vector<ll> v(n);
    for(int i = 0;i<n;i++){
        cin>>v[i];
    }
    vector<ll> prefix(n,0);
    prefix[0] = v[0];
    prefix[1] = v[1];
    vector<ll> dp(n,0);
    dp[0] = 0;
    dp[1] = max(v[0],v[1]);

    for(int i = 2;i<n;i++){
        prefix[i] = v[i]+prefix[i-2];
        if(i&1){
            dp[i] = max(v[i]+dp[i-2],prefix[i-1]);
        }
        else{
            dp[i] = max(dp[i-2]+v[i],dp[i-1]);
        }
    }
    cout<<dp[n-1];
    return 0;
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = INT_MAX / 2;

int main() {
  int N, K; cin >> N >> K;
  int R, S, P; cin >> R >> S >> P;
  string T; cin >> T;
  // K 回後に勝つために今引き分けor負ける意味はない。
  // 引き分け or 負けの何れを出しても0点なので、K回後には必ず勝てる。
  map<char, int> m;
  m['r'] = P, m['s'] = R, m['p'] = S;
  ll ans = 0;
  bool oyasumi[100010] = {};
  rep(i, N) {
    if (i - K < 0 || !oyasumi[i]) {
      ans += m[T[i]];
    }
    if (i + K < N) {
      oyasumi[i + K] = !oyasumi[i] && (T[i] == T[i + K]);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>; // グラフ型
typedef long long ll;
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (n); ++i)



int main() {
  ll N;
  cin >> N;
  //vector<ll> a(N);
  //vector<vector<int>> data(3, vector<int>(4));

  ll a, b;
  ll ans =0;
  for (ll a = 1; a < N-1; a++){
    ll tmp = (N-1)/a;
    ans += tmp;
  }
  
  cout << ans+1 << endl;

  return 0;
}


Measured memory_bytes: 3628
import java.util.Scanner; 

class Main{

 public static void main(String[] args){

 Scanner scan = new Scanner(System.in);

 int S = scan.nextInt();
 int W = scan.nextInt();
   
   if (W >= S){
     
      System.out.println("unsafe");
   }
   else {
     System.out.println("safe");
   }
 }
}

Measured memory_bytes: 35748
while True:
    H, W = [int(i) for i in input().split()]
    if H == W == 0:
        break
    for i in range(H):
        if i == 0 or i == H - 1:
            print('#' * W)
        else:
            print('#{0}#'.format('.' * (W - 2)))
    print('')

Measured memory_bytes: 7716
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<string>
#include <functional>
using namespace std;
#define INF 1<<21
#define DIV 1000000007

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

int main() {
  int n = 0, s = 0, w = 0, e = 0;
  string S;
  int k;
  
  cin >> S;

  k = S.length();

  for (int i = 0; i < k; i++) {
	switch (S[i]) {
	case 'N': n++;
	  break;
	case 'S': s++;
	  break;
	case 'W': w++;
	  break;
	case 'E': e++;
	  break;
	}
  }
  if ((n == 0 && s != 0) || (s == 0 && n != 0) || (w == 0 && e != 0) || (e == 0 && w != 0)) {
	cout << "No" << endl;
  }
  else {
	cout << "Yes" << endl;
  }


}

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

int main() {
  
  string s;
  cin >> s;
  
  if (s.at(0) == s.at(1) || s.at(1) == s.at(2) || s.at(2) == s.at(3))
    cout << "Bad" << endl;
  else
    cout << "Good" << endl;
}

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

#define int long long
#define ALL(x) x.begin(),x.end()
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb(x) push_back(x)
#define eb emplace_back
#define SORT(ls) sort(ls.begin(), ls.end())
#define DESC(ls) sort(ls.rbegin(), ls.rend()) 
#define mp(x, y) make_pair(x, y)
#define INF 1000000000
#define MOD 1000000007
#define F(i, a, n) for(i=a;i<n;i++)
#define B(i, a, n) for(i=n-1;i>=0;i--)
#define SI(x) cin>>x
#define DI(x, y) cin>>x>>y
#define TI(x, y, z) cin>>x>>y>>z
#define FI(w, x, y, z) cin>>w>>x>>y>>z
#define SO(x) cout<<x<<"\n"
#define DO(x, y) cout<<x<<" "<<y<<"\n"
#define TO(x, y, z) cout<<x<<" "<<y<<" "<<z<< "\n"
#define FO(w, x, y, z) cout<<w<<" "<<x<<" "<<y<<" "<<z<<"\n"
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

void dfs(int dp[], vi adj[], bool visited[], int x)
{
    visited[x] = true;
    int &res = dp[x];
    for(auto i: adj[x])
    {
        if(!visited[i])
            dfs(dp, adj, visited, i);
        res = max(res, 1 + dp[i]);
    }
}

int32_t main(void)
{
    FASTER;
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int i, j;
    int n, m;
    DI(n, m);
    vi adj[n];
    F(i, 0, m)
    {
        int x, y;
        DI(x, y);
        --x, --y;
        adj[x].pb(y);
    }
    int dp[n];
    memset(dp, 0, sizeof(dp));
    bool visited[n];
    memset(visited, 0, sizeof(visited));
    F(i, 0, n)
    {
        if(!visited[i])
            dfs(dp, adj, visited, i);
    }
    SO(*max_element(dp, dp + n));
    return 0;
}


Measured memory_bytes: 9984
# coding: utf-8

import sys
import math
import collections
import itertools
import bisect
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return x if y == 0 else gcd(y, x%y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")
def YesNo(B) : print("Yes" if B else "No")
def YESNO(B) : print("YES" if B else "NO")

def prime_factorize(N):
    res = []
    for i in range(2, int(math.sqrt(N)) + 1):
        if N % i != 0:
            continue

        num = 0
        while N % i == 0:
            N //= i
            num += 1
        
        res.append([i, num])

    if N != 1:
        res.append([N, 1])

    return res

A, B = LI()

g = gcd(A, B)
pf = prime_factorize(g)

print(len(pf) + 1)


Measured memory_bytes: 38512
n = gets.to_i
a = gets.chomp.split(" ").map(&:to_i)
a.unshift(0)
a.push(0)
sum = 0
(n+1).times do |i|
  sum += (a[i] - a[i+1]).abs
end
n.times do |i|
  puts sum + (a[i] - a[i+2]).abs - ((a[i] - a[i+1]).abs + (a[i+1] - a[i+2]).abs)
end

Measured memory_bytes: 24216
n=int(input())
li=[list(map(int,input().split())) for i in range(n)]

#print(li)

dp = [[0 for j in range(3)] for i in range(n)]
#print(dp)

dp[0][0] = li[0][0]
dp[0][1] = li[0][1]
dp[0][2] = li[0][2]
#print(dp)

for i in range(1, n):
    dp[i][0] = max(dp[i-1][1]+li[i][0], dp[i-1][2]+li[i][0])
    dp[i][1] = max(dp[i-1][2]+li[i][1], dp[i-1][0]+li[i][1])
    dp[i][2] = max(dp[i-1][0]+li[i][2], dp[i-1][1]+li[i][2])
#print(dp)

print(max(dp[-1][0], dp[-1][1], dp[-1][2]))

Measured memory_bytes: 47368
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"
#include "queue"
#include "functional"
#include "map"
#include "unordered_map"
#include "set"
#include "stack"

#define lp(n) for (int i = 0; i < n; i++)
#define LP(n,i) for (int i = 0; i < n; i++)
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
#define mp make_pair
typedef long long ll;
using namespace std;

string s;
int x, y, cnt;
vector<int>vx, vy;
bool xy;
set<int>stx[5000], sty[5000];
int main() {
	cin >> s >> x >> y;
	xy = true;
	cnt = 0;
	lp(s.size()) {
		if (s[i] == 'T') {
			if (xy)
				vx.push_back(cnt);
			else vy.push_back(cnt);
			xy = !xy;
			cnt = 0;
		}
		else cnt++;
	}
	if (xy)
		vx.push_back(cnt);
	else vy.push_back(cnt);
	stx[0].insert(vx[0]);
	sty[0].insert(0);
	lp(vx.size() - 1) {
		for (auto it = stx[i].begin(); it != stx[i].end(); it++) {
			stx[i + 1].insert(*it + vx[i + 1]);
			stx[i + 1].insert(*it - vx[i + 1]);
		}
	}
	lp(vy.size()) {
		for (auto it = sty[i].begin(); it != sty[i].end(); it++) {
			sty[i + 1].insert(*it + vy[i]);
			sty[i + 1].insert(*it - vy[i]);
		}
	}
	if (stx[vx.size() - 1].find(x) != stx[vx.size() - 1].end() && sty[vy.size()].find(y) != sty[vy.size()].end())
		cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


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

bool bigb(pair<ll,ll> a,pair<ll,ll> b){
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first > b.first;
    }
}

  
int main(){
    ll n;
    cin>>n;
    vector<pair<ll, ll>> v(n);
    
    rep(i,n){
        ll a,b;
        cin>>a>>b;
        v[i]=make_pair(a,b);
    }
    sort(v.begin(),v.end(),bigb);
    
    bool check=true;
    ll now =v[0].first;
    if(now>v[0].second)check=false;
    for(int i=1;i<n;i++){
        if(now+v[i].first<=v[i].second){
            now+=v[i].first;
        }else{
            now+=v[i].first;
            check=false;
        }    
    }

    string ans=(check)?"Yes":"No";

    cout<<ans<<endl;
    
    return 0;
}

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

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

	deque<int> yakusuu;

	for(int i=1; i<=100; i++){
		if(a%i==0 && b%i==0) yakusuu.push_front(i);
	}
	
	cout << yakusuu[k-1] << endl;

	return 0;
}

Measured memory_bytes: 256
module app;

import core.bitop;

import std.algorithm;
import std.array;
import std.bigint;
import std.conv;
import std.stdio;
import std.string;
import std.traits;

struct Input
{
	int n, m;
	int[] s, c;
}

void parseInput(T)(out Input input, T file)
{
	with (file) with (input)
	{
		auto ar = readln().strip().split().map!(to!int).array();
		n = ar[0].to!int;
		m = ar[1].to!int;
        foreach (i; 0..m)
        {
    		ar = readln().strip().split().map!(to!int).array();
            s ~= ar[0];
            c ~= ar[1];
        }
	}
}

auto main2(Input* input)
{
	with (input)
	{
        int[] result;
        result.length = n;
        result[] = -1;
        foreach (i, ss; s)
        {
            if (result[ss-1] != -1 && result[ss-1] != c[i])
                return -1;
            result[ss-1] = c[i];
        }
        if (result[0] == 0)
        {
            if (n == 1)
                return 0;
            else
                return -1;
        }
        if (n == 1 && result[0] == -1)
            return 0;
        foreach (i, ref r; result)
        {
            if (i == 0)
            {
                if (r == -1) r = 1;
            }
            else
            {
                if (r == -1) r = 0;
            }
        }

        int intResult = 0;
        foreach (r; result)
        {
            intResult *= 10;
            intResult += r;
        }
        return intResult;
	}
}

alias retType = ReturnType!main2;
static if (!is(retType == void))
{
	unittest { writeln("begin unittest"); }
	auto _placeholder_ = ReturnType!main2.init;

	unittest // example1
	{
		string example =
`3 3
1 7
3 2
1 7`;
		if (example.empty) return;
		Input input = void;
		parseExample(input, example);
		auto result = main2(&input);
		printResult(result);
		assert(result == 702);
	}

	unittest // example2
	{
		string example =
`3 2
2 1
2 3`;
		if (example.empty) return;
		Input input = void;
		parseExample(input, example);
		auto result = main2(&input);
		printResult(result);
		assert(result == -1);
	}

	unittest // example3
	{
		string example =
`3 1
1 0`;
		if (example.empty) return;
		Input input = void;
		parseExample(input, example);
		auto result = main2(&input);
		printResult(result);
		assert(result == -1);
	}

	unittest { writeln("end unittest"); }

	void parseExample(out Input input, string example)
	{
		struct Adapter
		{
			string[] _lines;
			this(string input) { _lines = input.splitLines(); }
			string readln() { auto line = _lines[0]; _lines = _lines[1..$]; return line; }
		}
		parseInput(input, Adapter(example));
	}
}

void printResult(T)(T result)
{
	static if (isFloatingPoint!T) writefln("%f", result);
	else writeln(result);
}

void main()
{
	Input input = void;
	parseInput(input, stdin);
	alias retType = ReturnType!main2;
	static if (is(retType == void))
		main2(&input);
	else
	{
		auto result = main2(&input);
		printResult(result);
	}
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(clippy::many_single_char_names)]
#![allow(clippy::suspicious_arithmetic_impl)]

// using Rust(1.42.0)
// My Library Repo is at "https://github.com/Loptall/prcn_lib"
// check available crates on AtCoder at "https://atcoder.jp/contests/language-test-202001"

/*
    AtCoder Language Update 2020204 お疲れ様でした! 有難いです
*/


// Dep crates are...
use std::cmp::{max, min, Ordering};
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet, VecDeque};
use std::mem::swap;
use std::ops::*;
use std::{i32, i64, isize, u32, u64, usize};

use itertools::*;
use itertools_num::*;
use lazy_static::lazy_static;
use maplit::{btreemap, btreeset, hashmap, hashset};
use num_bigint::{BigInt, BigUint};
use num_integer::{binomial, gcd, lcm, Integer};
use permutohedron::Heap;
use proconio::{fastout, input, is_stdin_empty, marker::*};
use rand::random;



// code...
#[fastout]
fn main() {
    input! {
        n: usize,
        a: [Usize1; n-1]
    }

    let mut count = vec![0; n];
    for i in a {
        count[i] += 1;
    }

    for i in count {
        println!("{}", i);
    }
}


Measured memory_bytes: 5528
import java.util.Scanner;

/**
 * https://beta.atcoder.jp/contests/abc077/tasks/arc084_b
 */
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		sc.close();
		
		int a = Integer.parseInt(S.substring(0,2));
		int b = Integer.parseInt(S.substring(2,4));
		
		String ans = "NA";
		if(a>0 && a<=12 && b>0 && b<=12) {
			ans = "AMBIGUOUS";
		}else if(a>0 && a<=12){
			ans = "MMYY";
		}else if(b>0 && b<=12) {
			ans = "YYMM";
		}
		
		System.out.println(ans);
	}

}

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

int main() {
    int a, b, cnt[105]{};
    while(cin >> a >> b){
        if(a==0){
            bool ok = true;
            for(int i=3;i<105;i++){
                ok &= cnt[i]%2==0;
            }
            ok &= cnt[1]%2==1 && cnt[2]%2==1;
            cout << (ok?"OK":"NG") << endl;
            fill(cnt,cnt+105,0);
        }
        else{
            cnt[a]++;
            cnt[b]++;
        }
    }
    return 0;
}


Measured memory_bytes: 2964
n = int(input())
l = list(map(int,input().split()))+[0]
l.sort(reverse=True)
ans = 0

for i in range(n-2):
    for j in range(i+1,n-1):
        left = j
        right = n
        while right - left > 1:
            middle = (left + right)//2
            if l[i]-l[j] < l[middle]:
                left = middle
            else:
                right = middle
        ans += (left-j)
print(ans)

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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

int cnt[9];

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

  CIN(N);
  vector< int > a(N);
  REP(i, N) {
    cin >> a[i];
    int tmp = min(a[i] / 400, 8);
    cnt[tmp]++;
  }

  int mn = 0;
  REP(i, 8) {
    if (cnt[i] > 0) mn++;
  }

  int mx = mn;
  if (mn == 0) {
    mn = 1;
    mx = cnt[8];
  } else {
    mx = mn + cnt[8];
  }

  cout << mn << " " << mx << endl;

  

  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Here your code !
    long long int n,c; cin>>n>>c;
    vector<long long int> v(n);
    v[0]=c;
    for(long long int i=1;i<n;i++){
        cin >> c;
        v[i]=v[i-1]+c;
    }
    vector<long long int> w(n,v[n-1]);
    long long int min = abs(w[0]-2*v[0]);
    for(long long int i=1;i<n-1;i++){

        if(abs(w[i]-2*v[i])<min){
            min = abs(w[i]-2*v[i]);
        }
    }
    cout << min << "\n";
    return 0;
    
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
typedef vector<int>vint;
typedef pair<int,int>pint;
 
typedef unsigned long long ull;
const ull p=1000000007;
const int SIZE=1000000;
ull H[SIZE+1],power[SIZE+1];
char S[SIZE+1],T[SIZE+1];
 
signed main(){
    scanf("%s%s",S,T);
    int ls=strlen(S),lt=strlen(T);
    power[0]=1;
    for(int i=1;i<=ls;i++){
        power[i]=power[i-1]*p;
        H[i]=H[i-1]*p+S[i-1];
    }
 
    ull ht=0;
    rep(i,lt)ht=ht*p+T[i];
 
    for(int i=lt;i<=ls;i++){
        ull hs=H[i]-H[i-lt]*power[lt];
        if(hs==ht)printf("%d\n",i-lt);
    }
    return 0;
}

Measured memory_bytes: 19816
A, B, C, X, Y = list(map(int,input().split()))
ans = float('Inf')
for i in range(max(X,Y)*2+1):
    tmp = i * C
    if i / 2 < X:
        tmp += A*(X-i//2)
    if i / 2 < Y:
        tmp += B*(Y-i//2)
    ans = min(ans,tmp)
print(ans)

Measured memory_bytes: 3064
#include <iostream>

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

    int cnt = 0;
    for ( int i = a; i <= b; ++i )
    {
        if ( c % i == 0 ) { ++cnt; }
    }

    std::cout
        << cnt
        << std::endl;

    return 0;
}

Measured memory_bytes: 1160
struct Combination {
    m: usize,
    fact: Vec<usize>,
    inv_fact: Vec<usize>,
}

impl Combination {
    fn new(n: usize, m: usize) -> Combination {
        let mut fact = vec![0; n + 1];
        let mut inv_fact = vec![0; n + 1];
        fact[0] = 1;
        for i in 1..=n {
            fact[i] = fact[i - 1] * i % m;
        }
        inv_fact[n] = Self::pow(fact[n], m - 2, m);
        for i in (1..=n).rev() {
            inv_fact[i - 1] = inv_fact[i] * i % m;
        }

        Combination { m, fact, inv_fact }
    }

    fn pow(mut a: usize, mut n: usize, m: usize) -> usize {
        let mut res = 1;
        while n > 0 {
            if n & 1 > 0 {
                res = res * a % m;
            }
            a = a * a % m;
            n >>= 1;
        }
        res
    }
    
    fn c(&self, n: usize, r: usize) -> usize {
        if n < r { return 0; }
        let tmp = self.inv_fact[n - r] * self.inv_fact[r] % self.m;
        self.fact[n] * tmp % self.m
    }
}

fn main() {
    const MOD: usize = 1_000_000_007;

    let [n, k]: [usize; 2] = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let mut iter = buf.split_whitespace();
        [
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        ]
    };
    let mut a: Vec<isize> = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let iter = buf.split_whitespace();
        iter.map(|x| x.parse().unwrap()).collect()
    };
    a.sort();
    let a = a.iter().map(|x| (x + MOD as isize) as usize % MOD).collect::<Vec<_>>();

    let comb = Combination::new(n, MOD);
    let mut ans = 0;

    for i in 0..=(n - k) {
        let tmp = (MOD + a[n - 1 - i] - a[i]) % MOD;
        ans = (ans + tmp * comb.c(n - 1 - i, k - 1) % MOD) % MOD;
    }

    println!("{}", ans);
}

Measured memory_bytes: 5372
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long

using namespace std;



int main(){

    LL N,X;cin>>N>>X;
    LL ans=N;

    LL a = N-X;
    LL b = X;

    while(a%b){
        ans += (a/b)*b * 2;
        LL c = a%b;
        a = b,b=c;
    }
    ans += ((a/b)*2 -1)*b;
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//\\//\\//\\//\\//\\//\\//\\//
#define fio ios::sync_with_stdio(false); cin.tie(nullptr)
#define all(x) (x).begin(),(x).end()
#define dlog(x) cerr<<#x<<'='<<x<<'\n'
#define endl '\n'
#define eb emplace_back
#define f first
#define s second
//\\//\\//\\//\\//\\//\\//\\//
using namespace::std;
using ll=long long;
using pii=pair<int,int>;
const int inf=INT_MAX,mod=1e9+7;
//\\//\\//\\//\\//\\//\\//\\//


signed main(){
      fio;
      int a,b; cin>>a>>b;
      cout<<(a%b==0?a/b:a/b+1);
      return 0;
}

Measured memory_bytes: 256
/*Anup Ghosh*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi acos(-1)
#define ull unsigned long long
#define nl printf("\n")
#define MAXN 1000005
#define mod  1000000007
#define gcd(a,b) __gcd(a,b)
#define pb push_back
#define fio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sp(n)  fixed<<setprecision(n)
int main() 
{
	fio();
    int n,i;
    cin >> n;
    int a[n];
    ll sum = 0;
    for (i=0;i<n;i++)
    {
        cin>>a[i];
        sum +=a[i];
        sum %=mod;
    }
    ll ans = 0;
    for (i=0;i<n;i++)
    {
        sum -= a[i];
        if (sum<0) sum += mod;
        ans += a[i] * sum;
        ans %= mod;
    }
    cout << ans << endl;
return 0;
}

Measured memory_bytes: 4432
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;

#define rep(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, s, n) for(int i=(s);i<(int)n;i++)
int INF=1e9+7;

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M),b(M),d(M);
  vector<vector<int>> c(M);
  rep(i,M) {
    cin >> a[i] >> b[i];
    c[i]=vector<int>(b[i]);
    rep(j,b[i]) {
      cin >> c[i][j];
      d[i]+=1<<(c[i][j]-1);
    }
  }
  vector<vector<int>> dp(M+1,vector<int>(1<<N,INF));
  dp[0][0]=0;
  rep2(i,1,M+1) {
    rep(j,1<<N) dp[i][j]=min(dp[i-1][j&(~d[i-1])]+a[i-1],dp[i-1][j]);
  }
  int ans=dp[M][(1<<N)-1];
  if(ans<INF) cout << ans << endl;
  else cout << -1 << endl;
}

Measured memory_bytes: 16384
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
using namespace std;

typedef long long ll;

int main()
{
    int N;
    cin >> N;
    string s[N];
    for(int i=0; i<N; i++){
        cin >> s[i];
    }
    vector<ll> nums(26);
    fill(nums.begin(), nums.end(), 0);
    for(int i=0; i<N; i++){//A0,C2,H7,M12,R17
        nums[s[i][0]-'A']++;
    }
    vector<ll> fi(5);
    fi[0]=nums[0];
    fi[1]=nums[2];
    fi[2]=nums[7];
    fi[3]=nums[12];
    fi[4]=nums[17];
    sort(fi.begin(), fi.end());
    ll ans=fi[0]*fi[1]*fi[2]+fi[0]*fi[1]*fi[3]+fi[0]*fi[1]*fi[4]+fi[0]*fi[2]*fi[3]+fi[0]*fi[2]*fi[4]+
        fi[0]*fi[3]*fi[4]+fi[1]*fi[2]*fi[3]+fi[1]*fi[2]*fi[4]+fi[1]*fi[3]*fi[4]+fi[2]*fi[3]*fi[4];

    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 6144
#include <bits/stdc++.h>
#define INF 1000000000
#define MAX_V 202
using namespace std;
typedef pair<int, int> P;
struct edge {
	int to, cap, cost, rev;
	edge(int to_, int cap_, int cost_, int rev_)
		: to(to_), cap(cap_), cost(cost_), rev(rev_) {}
};

int V;
vector<edge> G[MAX_V];
int h[MAX_V];
int dist[MAX_V];
int prevv[MAX_V], preve[MAX_V];

void AddEdge(int from, int to, int cap, int cost) {
	G[from].push_back(edge(to, cap, cost, G[to].size()));
	G[to].push_back(edge(from, 0, -cost, G[from].size() - 1));
}

int MinimumCostFlow(int s, int t, int f) {
	int res = 0;
	fill(h, h + V, 0);
	while (f > 0) {
		priority_queue<P, vector<P>, greater<P>> que;
		fill(dist, dist + V, INF);
		dist[s] = 0;
		que.push(P(0, s));
		while (!que.empty()) {
			P p = que.top(); que.pop();
			int v = p.second;
			if (dist[v] < p.first) continue;
			for (size_t i = 0; i < G[v].size(); i++) {
				edge &e = G[v][i];
				if (e.cap > 0 && dist[e.to] > dist[v] + e.cost + h[v] - h[e.to]) {
					dist[e.to] = dist[v] + e.cost + h[v] - h[e.to];
					prevv[e.to] = v;
					preve[e.to] = i;
					que.push(P(dist[e.to], e.to));
				}
			}
		}
		if (dist[t] == INF) return -1;
		for (int v = 0; v < V; v++)
			h[v] += dist[v];
		int d = f;
		for (int v = t; v != s; v = prevv[v]) {
			d = min(d, G[prevv[v]][preve[v]].cap);
		}
		f -= d;
		res += d * h[t];
		for (int v = t; v != s; v = prevv[v]) {
			edge &e = G[prevv[v]][preve[v]];
			e.cap -= d;
			G[v][e.rev].cap += d;
		}
	}
	return res;
}

int main()
{
	int n;
	cin >> n;
	V = n * 2 + 2;
	vector<vector<int>> W(n, vector<int>(n)), E(n, vector<int>(n));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> W[i][j];
		}
		AddEdge(n * 2, i, 1, 0);
		AddEdge(n + i, n * 2 + 1, 1, 0);
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> E[i][j];
		}
	}
	vector<string> s(n);
	int def = 0;
	for (int i = 0; i < n; i++) {
		cin >> s[i];
		for (int j = 0; j < n; j++) {
			if (s[i][j] == '.') {
				AddEdge(i, n + j, 1, W[i][j]);
			}
			else {
				AddEdge(i, n + j, 1, -E[i][j]);
				def += E[i][j];
			}
		}
	}
	cout << MinimumCostFlow(n * 2, n * 2 + 1, n) + def << endl;
	int res = 0;
	for (int i = 0; i < n; i++) {
		for (auto & e : G[i]) {
			if (e.cap == 1 && e.to - n < n && s[i][e.to - n] != '.') {
				res++;
			}
			else if (e.cap == 0 && e.to - n < n && s[i][e.to - n] != 'o') {
				res++;
			}
		}
	}
	cout << res << endl;
	for (int i = 0; i < n; i++) {
		for (auto & e : G[i]) {
			if (e.cap == 1 && e.to - n < n && s[i][e.to - n] != '.') {
				cout << i + 1 << ' ' << e.to - n + 1 << " erase" << endl;
			}
			else if (e.cap == 0 && e.to - n < n && s[i][e.to - n] != 'o') {
				cout << i + 1 << ' ' << e.to - n + 1 << " write" << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3588