akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const int INF = 1e9;


int main(){
  int n;
  cin>>n;
  string u;
  map<string,int> a;
  for(int i=0;i<n;i++){
    cin>>u;
    a[u]=1;
  }
  int m,count=0;
  cin>>m;
  for(int i=0;i<m;i++){
    cin>>u;
    if(a[u]==1){
      count++;
      if(count%2==1){
	cout<<"Opened by ";
      }else{
	cout<<"Closed by ";
      }
      cout<<u<<endl;
    }else{
      cout<<"Unknown "<<u<<endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3240
#include <iostream>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int num_arr[21];

int solve(int n, int i, int m)
{
    int res;
    
    if (m == 0)
    {
        return 1;
    }
    
    if (i >= n)
    {
        return 0;
    }
    
    res = solve(n, i + 1, m) || solve(n, i + 1, m - num_arr[i]);    //选择要与不要
    return res;
}

int main(int argc, const char * argv[]) {
    int n;
    int q;
    int m;
    
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> num_arr[i];
    }
    
    cin >> q;
    for (int i = 0; i < q; i++)
    {
        cin >> m;
        if (solve(n, 0, m))
            cout << "yes" << endl;
        else
            cout << "no" << endl;
    }
    
    return 0;
}



Measured memory_bytes: 3100
#include<stdio.h>

#include<stdlib.h>

#include<string.h>

int main(void)

{

char num_str[1002];

int num;

long sum = 0;

int i;

	
int stdim = 0;
char tmp;


while (1)

{

fgets(num_str,sizeof(num_str),stdin);


if (num_str[0] == '0') break;


for (i = 0; i < strlen(num_str)-1; i++)

{

tmp = num_str[i];

num   = atoi(&tmp);

sum = sum + num;

}


printf("%d\n", sum);


sum = 0;

memset(num_str, 1001,0);


}

return 0;

}

Measured memory_bytes: 528
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
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;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;



void Main(){

  int N;
  cin>>N;
  int c[N],s[N],f[N];
  rep(i,N-1){
    cin>>c[i]>>s[i]>>f[i];
  }


  rep(k,N){
    ll now=0;
    reps(i,k,N-1){
      if(now<=s[i]) now=s[i];
      else{
        while(true){
          if(now%f[i]==0) break;
          ++now;
        }
      }
      now+=c[i];
    }
    cout<< now<<"\n";
  }

}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string



INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7



s = S()
t = S()
s_dict = defaultdict(int)
t_dict = defaultdict(int)
for i in range(len(s)):
    if s_dict[s[i]] and s_dict[s[i]] != t[i]:
        print('No')
        break
    else:
        s_dict[s[i]] = t[i]
    if t_dict[t[i]] and t_dict[t[i]] != s[i]:
        print('No')
        break
    else:
        t_dict[t[i]] = s[i]
else:
    print('Yes')






Measured memory_bytes: 42828
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int n, m; readV(n, m);

  auto g = GraphW!int(n);
  foreach (_; 0..m) {
    int u, v, s; readV(u, v, s); --u; --v;
    g.addEdgeB(u, v, s);
  }

  auto assume(long b, long c)
  {
    if (b-c <= 0 || (b-c)%2 != 0) return false;
    auto a = (b-c)/2;
    auto d = new long[](n); d[0] = a;
    auto q = DList!int(0);
    while (!q.empty) {
      auto u = q.front; q.removeFront();
      foreach (e; g[u]) {
        auto v = e.dst;
        if (d[v]) {
          if (d[v] != e.wt-d[u]) return false;
        } else {
          d[v] = e.wt-d[u];
          if (d[v] <= 0) return false;
          q.insertBack(v);
        }
      }
    }
  
    return true;
  }

  auto vt = new bool[](n);
  auto b = new long[](n), bv = new bool[](n);
  auto c = new long[](n), cv = new bool[](n);

  cv[0] = true;
  auto q = DList!int(0);
  while (!q.empty) {
    auto u = q.front; q.removeFront();
    if (vt[u]) continue;
    vt[u] = true;

    foreach (e; g[u]) {
      auto v = e.dst;
      if (vt[v]) continue;
      if (bv[u]) {
        if (cv[v] && c[v] != e.wt-b[u]) {
          writeln(0);
          return;
        }
        c[v] = e.wt-b[u];
        cv[v] = true;
        if (bv[v]) {
          writeln(assume(b[v], c[v]) ? 1 : 0);
          return;
        }
        q.insertBack(v);
      } else {
        if (bv[v] && b[v] != e.wt-c[u]) {
          writeln(0);
          return;
        }
        b[v] = e.wt-c[u];
        bv[v] = true;
        if (cv[v]) {
          writeln(assume(b[v], c[v]) ? 1 : 0);
          return;
        }
        q.insertBack(v);
      }
    }
  }

  auto bm = 10L^^18, cm = 10L^^18;
  foreach (i; 0..n) {
    if (bv[i]) bm = min(bm, b[i]);
    if (cv[i]) cm = min(cm, c[i]);
  }

  auto r = (bm-1);
  if (cm < 0) r += cm;
  writeln(max(0, r));
}

struct GraphW(N = int, W = int, W i = 10^^9)
{
  alias Node = N, Wt = W, inf = i;
  struct Edge { Node src, dst; Wt wt; alias cap = wt; }
  Node n;
  Edge[][] g;
  alias g this;
  this(Node n) { this.n = n; g = new Edge[][](n); }
  void addEdge(Node u, Node v, Wt w) { g[u] ~= Edge(u, v, w); }
  void addEdgeB(Node u, Node v, Wt w) { g[u] ~= Edge(u, v, w); g[v] ~= Edge(v, u, w); }
}


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

int main(){
  long long N; cin >> N;
  vector<long long> A(5);
  for(int i=0; i<5; i++) cin >> A.at(i);
  
  //ボトルネックを探す
  vector<long long>::iterator itr = min_element(A.begin(), A.end());
  size_t index = distance(A.begin(), itr);
  
  cout << (N-1)/A.at(index)+5 << endl;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
# if n % 2 == 0
#     mae = ((1 + han) * han) / 2
#     (han+1..n).each do |i|
#         aikata = n + 1 - i
#         iko = i % aikata
#         ans += iko
#     end
# elsif n % 2 != 0
#     mae = ((1 + han) * han) / 2
#     (han+2..n).each do |i|
#         aikata = n + 1 - i
#         iko = i % aikata
#         ans += iko
#     end
# end
# p mae
# puts ans + mae
saigo = n- 1
puts (1 + saigo) * saigo / 2

Measured memory_bytes: 14340
n = int(input())

work = [0]*n
for i in range(n):
  a, b = map(int, input().split())
  work[i] = [b, a]
work.sort()

key = 0
ans = True
for i in range(n):
  if key + work[i][1]> work[i][0]:
    ans = False
    break
  key += work[i][1]

if ans:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 35608
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#define ll long long
using namespace std;
int main()
{
  ll int n,m;
  cin>>n>>m;
  ll int sum=0;
  sum+=n*(n-1)/2;
  sum+=m*(m-1)/2;
  cout<<sum<<endl;
		
}



	
  
  

		
		
		
		
		
		
	
	
	 
		
		
	
	
	

	


	
	
	
   



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<utility>
#include<queue>
#include<tuple>
#include<stdio.h>
#define rep(i, n) for(int i=0;i<n;i++)
using namespace std;

int main(){
	int long long x, a=100;
	int b=0;
	cin>>x;
	while(a<x){
		a=a*1.01;
		b++;
	}
	cout<<b<<endl;
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll a,b;
  cin >> a >> b;
  ll left = 0;
  left = (b - a) * (b - a - 1) / 2;
  cout << left - a << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;
using ll = long long;

#define REP(i, a) for (int i = 0; i < (a); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a)-1; i >= (b); --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond, yes, no) \
    { cout << ((cond) ? (yes) : (no)) << endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(), (list).rend())
#define ASSERT(cond, mes) assert(cond&& mes)

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template <typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())
    is >> v[i];
    return is;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a) n = a;
    if (n > b) n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

std::vector<int> enum_div(int n) {
    std::vector<int> ret;
    for (int i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i != 1 && i * i != n) { ret.push_back(n / i); }
        }
    }
    return ret;
}

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

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

struct ToUpper {
    char operator()(char c) {
        return toupper(c);
    }
};

struct ToLower {
    char operator()(char c) {
        return tolower(c);
    }
};

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

    int N;
    cin >> N;
    vector<int> D(N);
    cin >> D;

    SORT(D);
    int left = D[N / 2 - 1];
    int right = D[N / 2];
    cout << right - left << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    ll INF = 1e9+7;
    ll MOD = 998244353;
    typedef pair<ll,ll> ii;
    #define f(i,a,b) for(long long i = a;i < b;i++)
    #define rf(i,a,b) for(long long i=a;i>=b;i--)
    #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    #define w(t) while(t--)
    #define c(n); cin>>n;
    #define p(n) cout<<n;
    #define pl(n) cout<<n<<endl;
    #define ps(n); cout<<n<<" ";
    #define F first
    #define S second
    #define pb(a) push_back(a)
    ///I hope I will get uprating and don't make mistakes
    ///I will never stop programming
    ///sqrt(-1) Love C++
    /// @TheofanisOrfanou Theo830
    ///AtCoder Beginner Contest 148
    int main(void){
        fastio;
        ll n;
        c(n);
        if(n % 2 == 0){
            ll ans=0;
            ll power = 10;
            while(n >= power){
                ans += n / power;
                power *= 5;
            }
            pl(ans);
        }
        else{
            pl(0);
        }
    }


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

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

    long double ans = 0;
    for(int i = 1; i <= n; i++) {
        if (i < k) {
            int t = ceil(log2((long double)(k) / (long double)(i)));
            ans += powl((long double)0.5, (long double)t) / (long double)(n);
        } else {
            ans += 1.0 / (long double)(n);
        }
    }

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

Measured memory_bytes: 512
def main():
    N, L = map(int, input().split())

    total = 0
    min_taste = 10 ** 12

    for i in range(1, N + 1):
        taste = L + i - 1
        if abs(taste) < min_taste:
            min_taste = abs(taste)
            min_taste_index = i

    total = N * L + N * (N + 1) // 2 - N
    ans = total - (L + min_taste_index - 1)

    print(ans)


if __name__ == "__main__":
    main()


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

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

  int cnt = 1;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int a = 0;
    cin >> a;
    if (a == cnt) {
      cnt++;
      continue;
    } else {
      ans++;
      continue;
    }
  }

  if (ans != N) {
    printf("%d", ans);
  } else {
    printf("-1");
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <queue>
#include <map>
#include <cstdlib>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <functional>
#define rep(i, a, b) for(int i=a;i<b;++i)
#define MOD 1000000007
#define RAND 1000
using namespace std;



int main(void)
{
	int a, b, c;
	cin >> a >> b >> c;
	if (c >= a && c <= b)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	system("pause");
	return 0;
}

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

int main() {
    int n;
    cin>>n;
    string m="MARCH";
    map<char,int> c;
    for (int i=0;i<n;i++) {
        string s;cin>>s;
        c[s[0]]++;
    }
    ll ans=0;
    for (int i=0;i<5;i++)
        for (int j=i+1;j<5;j++)
            for (int k=j+1;k<5;k++)
                ans+=(ll)c[m[i]]*c[m[j]]*c[m[k]];
    cout<<ans<<endl;
    return 0;
}

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


int main(){
    int N;
    cin >> N;
    vector<string> s(N);
    for (int i = 0; i < N; i++) cin >> s[i];
    bool check = false;
    int AB=0, BS=0, AL=0;
    for (int i = 0; i < N; i++) {
        int K = s[i].size();
        if (s[i][0] == 'B') BS++;
        if (s[i][K-1] == 'A') AL++;
        if ((s[i][0] == 'B') ^ (s[i][K-1] == 'A')) check = true;
        for (int j = 1; j < K; j++) {
            if (s[i][j-1] == 'A' && s[i][j] == 'B') AB++;
        }
    }
    if (check) cout << AB+min(BS, AL) << endl;
    else cout << AB + max(1, min(BS, AL))-1 << endl;
    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
    
 
int main (){
  	string S;
    cin>>S;
    vector<long long> VecP(0), VecM(0);
    long long PCount=0;
    long long MCount=1;
    
    bool X=true;

    for(long long i=S.size()-1; i>=0; i--){
        if(X){
            if(S.at(i)=='>'){
                X=false;
                VecP.push_back(PCount);
              	//cout<<"A";
                PCount=1;
            }
            else{
                PCount ++;
              	//cout<<"B";
            }
        }
        else{
            if(S.at(i)=='<'){
                X=true;
                VecM.push_back(MCount);
                MCount=1;
              	//cout<<"C";
            }
            else{
                MCount ++;
              	//cout<<"D";
            }
        }
    }
  	if(X){
      	VecP.push_back(PCount);
    }
  	else{
      	VecM.push_back(MCount);
    }
    long long Sum=0;
    for(long long i=0; i<VecP.size()-1; i++){
        if(VecP.at(i+1)<=VecM.at(i)){
            Sum += VecM.at(i)-VecP.at(i+1);
          	//cout<<'%'<<VecM.at(i)-VecP.at(i+1)<<endl;
        }
    }
  	//cout<<VecP.size()<<" "<<VecM.size()<<endl;
    if(VecP.size()>VecM.size()){
        for(long long i=0; i<VecP.size(); i++){
            Sum += VecP.at(i)*(VecP.at(i)+1)/2;
          //cout<<VecP.at(i)<<'P'<<VecP.at(i)*(VecP.at(i)+1)/2<<endl;
            }
        for(long long i=0; i<VecM.size(); i++){
                Sum += VecM.at(i)*(VecM.at(i)-1)/2;
          		//cout<<VecM.at(i)<<'M'<<VecM.at(i)*(VecM.at(i)-1)/2<<endl;
            }
    }
    else{
        
        for(int i=0; i<VecP.size(); i++){
            Sum += VecP.at(i)*(VecP.at(i)+1)/2;
          	//cout<<VecP.at(i)<<'P'<<VecP.at(i)*(VecP.at(i)+1)/2<<endl;
        }
        for(int i=0; i<VecM.size(); i++){
            Sum += VecM.at(i)*(VecM.at(i)-1)/2;
          	//cout<<VecM.at(i)<<'M'<<VecM.at(i)*(VecM.at(i)-1)/2<<endl;
        }
      	Sum += VecM.at(VecM.size()-1);
    }
    cout<<Sum<<endl;
    
    
}
 

Measured memory_bytes: 3064
#include<iostream> 
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b+c||b==a+c||c==a+b){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
s = input()
t = input()


def cumsum_list(inlist):
    l = len(inlist)
    out_cumsum_list = [ None for i in range(l+1) ]
    out_cumsum_list[0] = (0,0)

    for i in range(l):
        if inlist[i] == "A":
            out_cumsum_list[i+1] = ( out_cumsum_list[i][0] + 1, out_cumsum_list[i][1] )
        else:
            out_cumsum_list[i+1] = ( out_cumsum_list[i][0], out_cumsum_list[i][1] + 1 )
    return out_cumsum_list

cumsum_list_s = cumsum_list(s)
cumsum_list_t = cumsum_list(t)

n = int(input())

for i in range(n):
    a, b, c, d = [ int(v) for v in input().split() ]
    sa = cumsum_list_s[b][0] - cumsum_list_s[a-1][0]
    sb = cumsum_list_s[b][1] - cumsum_list_s[a-1][1]
    ta = cumsum_list_t[d][0] - cumsum_list_t[c-1][0]
    tb = cumsum_list_t[d][1] - cumsum_list_t[c-1][1]

    total_s, total_t = sa + 2 * sb, ta + 2 * tb

    if total_s % 3 == total_t % 3:
        print("YES")
    else:
        print("NO")

Measured memory_bytes: 58892
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>

using ll = long long;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, x) for(int i=1;i<=(int)(x);i++)
#define rrep(i, x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i, x) for(int i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007
#define put2darr(arr, row, col) rep(i, row) { rep(j, col) { printf("%18d", arr[i][j]); } cout << endl; }

using namespace std;

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;
}

/* 1..10
 * rep:   0 1 2 3 4 5 6 7 8 9
 * reps:  1 2 3 4 5 6 7 8 9 10
 * rrep:  9 8 7 6 5 4 3 2 1 0
 * rreps: 10 9 8 7 6 5 4 3 2 1
 */

ll n, m, k;
ll p[10010];

int main() {
    int H, W, h,w;
    cin >> H >> W>>h>>w;
    cout << (H-h)*(W-w)<< endl;
}



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

using namespace std;

#define int int64_t

signed main()
{
    //freopen("input.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int a[n];
    for(auto &it: a)
        cin >> it;
    int sum = accumulate(a, a + n, 0LL);
    int s = 0;
    int ans = 1e18;
    for(int i = 0; i < n - 1; i++)
    {
        s += a[i];
        ans = min(ans, abs(s - (sum - s)));
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			int count = 0;
			for(int i = a; i <= b; i++) {
				if(c % i == 0) {
					count++;
				}
			}
			System.out.println(count);
	}
}

Measured memory_bytes: 26332
#include<stdio.h>
#include<malloc.h>
int main(){
  int n;
  scanf("%d",&n);
  int i,max=0,sum=0;
  int *a = (int*)malloc(n*sizeof(int));
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    if(a[i]>max){
    max=a[i];
    }
    sum=sum+a[i];
  }
  sum=sum-max;
  sum=sum+(max/2);
  printf("%d",sum);
  return 0;
}

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

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

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
// #define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int n; cin >> n;
    vector<ll> x(n), y(n), a(n), b(n);
    rep(i, n){
        cin >> x[i] >> y[i];
        a[i] = x[i]-y[i];
        b[i] = x[i]+y[i];
    }
    sort(all(a));
    sort(all(b));
    cout << max(a.back()-*a.begin(), b.back()-*b.begin()) << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


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

int main()
{
    int i,n,l;
    scanf("%d %d", &n, &l);
    
    char s[101][101];
    
    for (i=0; i<n; i++) {
        scanf("%s", &s[i]);
    }
    
    qsort(s, n, 101, strcmp);
    
    for (i=0; i<n; i++) {
        printf("%s", s[i]);
    }
    
    return 0;
}

Measured memory_bytes: 1716
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
#include<functional>
#include<climits>
#include<cassert>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>

using namespace std;

#define MAX 1002

int n;
int k;
vector<long long int> vv;
vector<long long int> v;
int las[30];

int main() {
	cin >> n>>k;
	v.push_back(0);
	for (int i = 0; i < n; i++) {
		int a;
		scanf("%d", &a);
		vv.push_back(a);
	}
	long long int ans = 0;
	for (int i = 0; i < vv.size(); i++) {
		long long int cur = 0LL;// (1LL << 60LL) - 1LL;
		for (int j = i; j >= 0; j--) {
			cur += vv[j];
			v.push_back(cur);
		}
	}
	for (long long int i = 60; i >= 0; i--) {
		sort(v.begin(), v.end());
		reverse(v.begin(), v.end());
		int cnt = 0;
		for (int j = 0; j < v.size(); j++) {
			if ((v[j] >> i) & 1LL) {
				cnt++;
			}
		}
		if (cnt >= k) {
			ans |= (1LL << i);
			while (v.size() && (!((v.back() >> i) & 1LL))) {
				v.pop_back();
			}
		}
		for (int j = 0; j < v.size(); j++) {
			if ((v[j] >> i) & 1LL) {
				v[j] ^= (1LL << i);
			}
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 6524
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

const ll INF=(1LL<<50);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


void solve(long long N, long long K, std::vector<long long> H){
  sort(H.begin(),H.end());
  ll ans=0;
  if(N>K){
    ans=accumulate(H.begin(),H.end()-K,0LL);
  }
  cout<<ans<<endl;
}

int main(){
  cout<<setprecision(1000);
  cin.tie(0);
  ios::sync_with_stdio(false);
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> H(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&H[i]);
    }
    solve(N, K, std::move(H));
    return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (b == 1) {
            System.out.println(0);
            return;
        }
        int res = 1;
        int total = a;
        while (total < b) {
            total += (a - 1);
            res += 1;
        }
        System.out.println(res);
    }

}


Measured memory_bytes: 23252
#include<bits/stdc++.h>
#include<string>
#include<cmath>

using namespace std;

#define ll long long int
#define loop(i, n) for (int i = 0; i < n; i++)
#define loops(i, s, n) for (int i = s; i < n; i++)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define MOD 1000000007

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

    string s;
    string ans;
    cin>>s;
    vector<char> v[2];
    int r = 0;

    int q;
    cin>>q;
    while(q--){
        int t;
        cin>>t;
        
        if(t == 1){
            r = !r;
        
        }else{
            int f;
            char c;
            cin>>f>>c;
            f--;
            v[f^r].pb(c);
        }
    }
    for(int i = (int)v[0].size()-1; i>=0; i--){
            ans+= v[0][i];
        }
        ans+=s;
        for(char e: v[1]){
            ans+=e;
        }
        if(r){
            reverse(all(ans));
        }
    cout<<ans<<"\n";
   
    
}

Measured memory_bytes: 1448
#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>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int n, x;
int a[100];

bool is_prime[1001000];

bool dp[1001000];

int main(){
	REP(i, 1001000)is_prime[i] = 1;
	is_prime[0] = 0;
	for (int i = 2; i <= 1000000; i++){
		if (is_prime[i]){
			for (int j = 2 * i; j <= 1000000; j += i){
				is_prime[j] = 0;
			}
		}
	}
	while (cin >> n >> x&&n + x){
		REP(i, 1001000)dp[i] = 0;
		REP(i, n)cin >> a[i];
		dp[0] = 1;
		sort(a, a + n);
		REP(i, n){
			REP(j, x){
				if (dp[j] == 1 && j + a[i] <= x)	dp[j + a[i]] = 1;
			}
		}
		bool f = 1;
		for (int i = x; i > 0; i--){
			if (dp[i] && is_prime[i]){
				cout << i << endl;
				f = 0;
				break;
			}
		}
		if (f)cout << "NA" << endl;
	}
}

Measured memory_bytes: 3132
#include <iostream>
using namespace std;
int main(){
	int b1,b2,b3;
	cin>>b1>>b2>>b3;
	if(b1==1&&b2==0&&b3==0){
		cout<<"Close"<<endl;
	}else if(b1==0&b2==1&&b3==0){
		cout<<"Close"<<endl;
	}else if(b1==1&&b2==1&&b3==0){
		cout<<"Open"<<endl;
	}else if(b1==0&&b2==0&&b3==0){
		cout<<"Close"<<endl;
	}else if(b1==0&&b2==0&&b3==1){
		cout<<"Open"<<endl;
	}
	
}

Measured memory_bytes: 1156
#include <stdio.h>
#include <stdlib.h>


int main(){
	char ta[4], tb[4], tc[4];
	int a, b, c;
	int penki[100];
	int i, n=0;
	scanf("%s %s %s", ta, tb, tc);
	a = atoi(ta);
	b = atoi(tb);
	c = atoi(tc);
	
	for(i=0;i<100;i++){
		penki[i] = 0;
	}
	penki[a-1] = 1;
	penki[b-1] = 1;
	penki[c-1] = 1;
	for(i=0;i<100;i++){
		if(penki[i]==1){
			n++;
		}
	}
	printf("%d", n);
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <stack>
#include <deque>
#include <ctime>
#include <random>
#include <cassert>
#include <cmath>
#include <climits>
#include <queue>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <chrono>

/*
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("popcnt")
#pragma GCC target("avx2")
*/


#ifdef LOCAL
	#define dbg(x) cout << #x << " : " << x << endl;
#else 
	#define dbg(x)
#endif

#define int long long
#define pb push_back
#define ppb pop_back()
#define mp make_pair
#define fi(a,b) for (int i=a;i<b;i++)
#define fj(a,b) for (int j=a;j<b;j++)
#define fk(a,b) for (int k=a;k<b;k++)
#define fi1(a,b) for (int i=a-1;i>=b;i--)
#define fj1(a,b) for (int j=a-1;j>=b;j--)
#define fk1(a,b) for (int k=a-1;k>=b;k--)
#define fx(x,a) for (auto& x : a)
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define rep1(i, a, b) for (int i = a - 1; i >= b; --i)
#define siz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;

template<typename T1, typename T2>inline void mine(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void maxe(T1 &x, T2 y) { if (x < y) x = y; }

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << ' ';
    return a;
}


typedef long long ll;
typedef unsigned long long ull;
typedef char ch;
typedef string str;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<ch> vch;
typedef vector<vch> vvch;
typedef vector<str> vs;



const int MOD = 1000000007;
const int INF = 1000000050;
const long long BIG = (long long)2e18 + 50;
const int MX = 200010;
const double EPS = 1e-9;


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   	
   	int n, k;
   	cin >> n >> k;
   	vi a(n);
   	fi(0, n) {
   		cin >> a[i];
   	}
   	sort(all(a));
   	int res = 0;
   	fi(0, k)
   		res += a[i];
   	cout << res << '\n';
}

Measured memory_bytes: 3656
#include <iostream>
#include <cmath>
#include <tuple>
#include <vector>
#include <algorithm>
using namespace std;
typedef tuple<double,double,double> T;

T operator-(const T Ta, const T Tb){
    double Xa,Ya,Za,Xb,Yb,Zb;
    tie(Xa,Ya,Za)=Ta;
    tie(Xb,Yb,Zb)=Tb;
    return T(Xa-Xb,Ya-Yb,Za-Zb);
}

double inner_cross(T Ta, T Tb){
    double Xa,Ya,Za,Xb,Yb,Zb;
    tie(Xa,Ya,Za)=Ta;
    tie(Xb,Yb,Zb)=Tb;
    return Xa*Xb+Ya*Yb+Za*Zb;
}

typedef tuple<T,T,double,double> Star;
typedef tuple<double,int,int> Event;


int main(){
    int N;
    cout<<fixed;
    cout.precision(10); 
    while(cin>>N,N){
        vector<Star> V;
        vector<Event> E;
        vector<double> lifetime(N);
        for(int i=0;i<N;i++){
            double px,py,pz,vx,vy,vz,r,vr;
            cin>>px>>py>>pz>>vx>>vy>>vz>>r>>vr;
            E.emplace_back(r/vr,i,i);
            V.emplace_back(T(px,py,pz),T(vx,vy,vz),r,vr);
        }
        for(int i=0;i<N;i++){
            for(int j=i+1;j<N;j++){
                T Pa,Pb,Va,Vb;
                double ra,rb,vra,vrb;
                tie(Pa,Va,ra,vra)=V[i];
                tie(Pb,Vb,rb,vrb)=V[j];
                double A=inner_cross(Va-Vb,Va-Vb)-pow(vra+vrb,2);
                if(A==0) continue;
                double B=2.0*inner_cross(Pa-Pb,Va-Vb)+2.0*(ra+rb)*(vra+vrb);
                double C=inner_cross(Pa-Pb,Pa-Pb)-pow(ra+rb,2);
                if(B*B-4*A*C<0) continue;
                double t=(-B-sqrt(B*B-4*A*C))/(2*A);
                // cout<<A<<' '<<B<<' '<<C<<' '<<t<<endl;
                if(t<0) continue;
                E.emplace_back(t,i,j);
            }
        }
        sort(E.begin(), E.end());
        bool alive[N];
        fill(alive,alive+N,true);
        for(auto e:E){
            double t;
            int a,b;
            tie(t,a,b)=e;
            if(alive[a]&&alive[b]){
                lifetime[a]=lifetime[b]=t;
                alive[a]=alive[b]=false;
            }
        }
        for(auto l:lifetime){
            cout<<l<<endl;
        }
    }
}

Measured memory_bytes: 3744
/*
  Fuad Ashraful Islam
  University of Asia Pacific,Bangladesh
  Date:12th April 2020
  TODO:
 */
#include<bits/stdc++.h>
#define dbg(x) cerr << #x << " = " << x << endl
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define pb push_back

using namespace std;
template <class T>
inline void read(T &res)
{
  res = 0; bool bo = 0; char c;
  while (((c = getchar()) < '0' || c > '9') && c != '-');
  if (c == '-') bo = 1; else res = c - 48;
  while ((c = getchar()) >= '0' && c <= '9')
    res = (res << 3) + (res << 1) + (c - 48);
  if (bo) res = ~res + 1;
}
typedef long long ll;
const int N=1e5+1;
int _,n,k,m,l,c,cs=1;
 

bool Solve()
{
  string s;
  cin>>s;
  if(s[0]=='7'|| s[1]=='7'|| s[2]=='7')return true;
  return false;
}
int main()
{
  Solve()?cout<<"Yes\n":cout<<"No\n";
  return 0;
}

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


int main(){
    double n,k;
    cin>>n>>k;
    vector<int>a(n);
    rep(i,n)cin>>a[i];
    long double before=(n-1)/(k-1);
    int ans=ceil(before);
    cout<<ans<<endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <numeric>
#include <queue>
#include <numeric>

#define rep(i,n) for((i)=0;i<(int)(n);i++)
#define max(a,b) (a < b ? b : a)
#define min(a,b) (a > b ? b : a)

using namespace std;


int main() {
	int i, j, k;
	int N, H;
	int a[100000] = { 0 };
	int b[100000] = { 0 };
	cin >> N >> H;
	rep(i, N) {
		cin >> a[i] >> b[i];
	}
	sort(a, a + N);
	sort(b, b + N);
	int ans = 0;
	i = N - 1; j = N - 1;
	while (H > 0) {
		if (a[i] >= b[j] || j<0) {
			ans += H / a[i];
			ans += (H % a[i] == 0 ? 0 : 1);
			cout << ans;
			return 0;
		}
		else {
			H -= b[j];
			j--;
			ans++;
		}

	}
	cout << ans;
	return 0;

}


Measured memory_bytes: 1024
def main():
    X = int(input())

    def Eratosthenes(x: int) -> set:
        """x以下の素数の集合を返す"""
        import math
        sup = int(x)
        primes = {i for i in range(2, sup+1)}
        for i in range(2, int(math.sqrt(sup+1))+1):
            if i in primes:
                mul = 2
                while i*mul <= sup:
                    primes.discard(i*mul)
                    mul += 1
        return primes
    p = Eratosthenes(100003)
    m = 1 << 60
    for i in p:
        if X <= i and i < m:
            m = i
    print(m)


if __name__ == '__main__':
    main()


Measured memory_bytes: 46192
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long int
#define oo 1000000000000000000
#define forr(i,n) for(ll i=0;i<n;i++)
#define fastio ios_base::sync_with_stdio(false); cin.tie(0) ; cout.tie(0);
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define pb push_back
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
using namespace __gnu_pbds; 
using namespace std;

const ll MOD = 1e9 + 7;

ll valueOfIndex(ordered_set&s , ll i){ return *(s.find_by_order(i)); }
ll indexOfValue(ordered_set&s , ll x){ return s.order_of_key(x); }

ll add(ll a, ll b,ll p=MOD) { a%=p; b%=p; return (a+b + p)%p;}
ll mul(ll a, ll b,ll p=MOD) { a%=p; b%=p; return (a*b + p)%p;} // __int128

ll power(ll x,ll n,ll p=MOD){ if(x==0) return 0; if(n==0 || x==1) return 1LL;
    ll r = (power(x,n/2,p))%p; if(n&1) return mul(mul(r,r,p) , x,p); else return mul(r,r,p);
}



void __sol(){
    ll n; cin >> n;
    ll a[n];
    ll x = 0;
    forr(i,n) cin >> a[i] , x ^= a[i];
    forr(i,n){
        cout << (x^a[i]) << " ";
    }

}


int main(){
    fastio
    ll tc=1;// cin >> tc;
    while(tc--) __sol();
    return 0;
}


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

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll; 
typedef std::pair<ll, ll> PLL;

signed main() {
    ll N,K;
    cin>>N>>K;
    if (K <= (N+1)/2){                                                                                   
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }   
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

ll modpow(ll x, ll b){
  ll res = 1;
  while(b){
    if(b&1)res = res * x % MOD;
    x = x * x % MOD;
    b>>=1;
  }
  return res;
}

ll modinv(ll x){
  return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
  if(was_output)cout << " ";
  cout << a;
  was_output = true;
}
void outendl(){
  was_output = false;
  cout << endl;
}
ll in(){
  ll res;
  scanf("%lld", &res);
  return res;
}

template<class t>
istream& operator>>(istream&is, vector<t>&x){
  for(auto &i:x)is >> i;
  return is;
}

template<class t, class u>
istream& operator>>(istream&is, pair<t, u>&x){
  is >> x.first >> x.second;
  return is;
}

int main(){
  ll n = in();
  int k = in();
  int q = in();
  vector<ll> line(n);
  cin >> line;
  auto func = [&](int mins){
                multiset<ll> s;
                vector<ll> del;
                foreach(i,line){
                  if(i>=mins){
                    s.insert(i);
                    if((int)s.size()>=k){
                      del.push_back(*s.begin());
                      s.erase(s.begin());
                    }
                  }else{
                    s.clear();
                  }
                }
                sort(all(del));
                return (int)del.size() >= q ? del[q-1]-del[0] : -1;
              };
  int ans = INF;
  foreach(i,line){
    int d = func(i);
    if(d>=0){
      chmin(ans,d);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define M 100001
using namespace std;

int n, x[M], y[M], w[M];

int main(){
    cin >> n;
    bool check = true;
    for (int i = 1; i <= n; i++){
        cin >> w[i] >> x[i] >> y[i];
        if ((w[i] - w[i-1]) %(abs(x[i]-x[i-1]) + abs(y[i]-y[i-1])) != 0){
            check = false;
            break;
        }
    }
    if (check) cout << "Yes";
    else cout << "No";
}

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

int main(){
    int N;
    std::cin>>N;
    std::vector<long long int>a(N);
    long long int ans=0;
    for(int i=0;i<N;i++){
        std::cin>>a[i];
    }
    for(int i=0;i<N;i++){
        ans=a[i]^ans;
    }
    for(int i=0;i<N;i++){
        if(i==N-1)std::cout<<(a[i]^ans)<<std::endl;
        else std::cout<<(a[i]^ans)<<" ";
        
    }
    return 0;
}


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

int main(void){
  int i,j,k; 
  int n,r;
  cin>>n>>r;
  if(n<10){
  cout<<r+100*(10-n)<<endl;
  }
  else cout<<r<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool can_reach(char s[],int n,int l,int r){
	bool f=true;
	while(l<r){
		if(s[l+1]=='.'&&l<n)
			l++;
		else{
			if(s[l+2]=='.'&&l<n-1)
				l+=2;
			else{
				f=false;
				break;
			}
		}
	}
	if(l==r)
		f=true;
	return f;
}
int main(){
	int n,a,b,c,d;
	cin>>n>>a>>b>>c>>d;
	char s[n+1];
	for(int i=1;i<=n;i++){
		char ch;
		cin>>ch;
		s[i]=ch;
	}
	if(c==d)
		cout<<"No";
	else if(c<d){
		if(can_reach(s,n,b,d)&&can_reach(s,n,a,c))
			cout<<"Yes";
		else
			cout<<"No";
	}
	else{
		int f=0;
		for(int i=1;i<=n-3;i++){
			if(s[i]=='.'&&s[i+1]=='.'&&s[i+2]=='.'&&b<i+2&&d>i){
				f=1;
				break;
			}
		}
		if(f==0)
			cout<<"No";
		else{
			if(can_reach(s,n,a,c)&&can_reach(s,n,b,d))
				cout<<"Yes";
			else
				cout<<"No";
		}
	}
	return 0;
}

Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
 
using namespace std;
 
#define PB push_back
#define MP make_pairA
#define REP(i,n) for(int i=0;i<(n);i++)
int main()
{
    char c;
    cin>>c;
    cout<<(char)(c+1)<<endl;
}

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

#define endl "\n"
#define ll long long
#define ar array

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

	int t=1;
	//cin >> t;
	while(t--) {
		ll n, a, b;
		cin >> n >> a >> b;
		cout << n/(a+b)*a+min(n%(a+b),a);
	}

	return 0 ;
}



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

bool include_3(int);

int main(){
  int n,i;

  cin>>n;

  for(i=1;i<=n;i++){
    if(i%3==0||include_3(i)){
      cout<<" "<<i;
    }
  }

  cout<<endl;

  return 0;
}

bool include_3(int n){
  while(n){
    if(n%10==3){
      return 1;
    }
    n=n/10;
  }
  return 0;
}

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

int main(){
    int w,h,n;
    int cnt = 0;

    cin >> w >> h >> n;
    vector<vector<int>> rect(w,vector<int>(h,1));

    for(int i = 0; i < n; i++){
        int x,y,a;
        cin >> x >> y >> a;
        if(a == 1){
            for(int j = 0; j < x; j++){
                for(int k = 0; k < h; k++){
                    rect[j][k] = 0;
                }
            }
        }
        else if(a == 2){
            for(int j = x; j < w; j++){
                for(int k = 0; k < h; k++){
                    rect[j][k] = 0;
                }
            }
        }
        else if(a == 3){
            for(int j = 0; j < w; j++){
                for(int k = 0; k < y; k++){
                    rect[j][k] = 0;
                }
            }
        }
        else{
            for(int j = 0; j < w; j++){
                for(int k = y; k < h; k++){
                    rect[j][k] = 0;
                }
            }
        }
    }

    for(int i = 0; i < w; i++){
        for(int j = 0; j < h; j++){
            cnt += rect[i][j];
        }
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
def resolve():
    N = int(input())
    H = list(map(int, input().split()))
    cnt = 0
    maxh = 0
    for i in range(N):
        if maxh <= H[i]:
            cnt += 1
            maxh = H[i]
    print(cnt)

if '__main__' == __name__:
    resolve()

Measured memory_bytes: 38256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>

using namespace std;

int main(){

    int N;
    cin >> N;
    vector<int> a(N);

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

    int cnt = 1;
    for(int i = 0; i < N; i++){
        if(a[i] == cnt){
            cnt++;
        }
    }

    if(cnt == 1){
        cout << -1 << endl;
    }
    else{
        cout << N - (cnt - 1) << endl;
    }

    return 0;
}

Measured memory_bytes: 1024
#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,m;
    cin>>n>>m;
    vector<pair<int,int>> p(n);
    rep(i,n){
        int a,b;
        cin>>a>>b;
        p[i]=make_pair(a,b);
    }
    sort(p.begin(),p.end());
    
    ll ans =0;
    rep(i,n){
        ll buy = min(m,p[i].second);
        ans += buy * p[i].first;
        m -= buy;
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 1024