akhauriyash/Code-Regression huggingface dataset:
using System.Linq;
using static System.Console;

namespace AtCorder
{
	public class Program
	{
		public static void Main()
		{
			var input = ReadLine().Split().Select(x => int.Parse(x)).OrderBy(x => x).ToList();

			int ans = 0;
			int prev = input[0];
			foreach(var item in input.Skip(1))
			{
				ans += item - prev;
				prev = item;
			}
			WriteLine(ans);
		}
	}
}


Measured memory_bytes: 13396
from fractions import gcd
A, B, C, D = map(int, input().split())

def lcm(x, y):
    return x * y // gcd(x, y)

def F(a, c, d):
    x = a - a//c - a//d + a//lcm(c, d)
    return x

ans = int(F(B, C, D) - F(A-1, C, D))
print(ans)

Measured memory_bytes: 5244
#include <iostream>
#include <iomanip>
#include <string>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    int a, b;
    cin >> a >> b;
    string s;
    cin >> s;
    repi(i, a+b+1, 0)
    {
        if (i != a && s.at(i) == '-')
        {
            cout << "No" << endl;
            return 0;
        }

        if (i == a && s.at(a) != '-')
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  long long N,T,A,n,x,y;
  cin >> N;
  long long T_sum = 1, A_sum = 1;
  for(int i = 0; i < N; i++){
    cin >> T >> A;
    x = T_sum / T;
    y = A_sum / A;
    if(T_sum % T != 0) x++;
    if(A_sum % A != 0) y++;
    n = max( x, y );
    T_sum = n * T;
    A_sum = n * A;
  }
  cout << T_sum + A_sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    VI L(N);
    REP(i,N) cin >> L[i];
    sort(L.begin(),L.end());
    int ans = 0;

    for(int i = N-1; i >= 0; i--){
        for(int j = i-1; j >= 0; j--){
            int pos = j - (lower_bound(L.begin(),L.begin()+j,L[i]-L[j]+1) - L.begin());
            ans += pos;
        }
    }
    cout << ans << endl;


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p){os<<"("<<p.first<<","<< p.second<<")";return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v){os<<"{";REP(i,(int)v.size()){if(i)os<<",";os<<v[i];}os<<"}";return os;}
template <typename T, size_t S> void printArray(const T (&array)[S]){for(auto val : array)std::cout << val << ", ";std::cout << "\n";}
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
const double PI=acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
//const int dx[4] = {1, 0, -1, 0};
//const int dy[4] = {0, 1, 0, -1};
//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve(){
    ll n, k; cin >> n >> k;
    vector<ll> a(n, 0);
    REP(i, k){
        ll d; cin >> d;
        //cout << d << endl;
        REP(j, d){
            ll ina; cin >> ina;
            a[ina-1]++;
        }
    }
    //cout << a<< endl;
    ll res = 0;
    REP(i, n){
        if(a[i] == 0) res++;
    }
    cout << res << endl;
}

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


Measured memory_bytes: 3644
def resolve():
    N = int(input())
    print(num2alpha(N).lower())

def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)
resolve()

Measured memory_bytes: 9036
#include <bits/stdc++.h>
#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mod 1000000007
// #define mod 998244353
using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b, c, d;
	cin>>a>>b>>c>>d;
	while(a > 0 && c > 0){
		c -= b;
		a -= d;
	}
	if(c <= 0){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<queue>
#include<map>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int> >;
using pii = pair<int, int>;
using ppi = pair<pii, int>;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  ll n;
  cin >> n;
  map<ll, ll> mp;
  while(n > 1){
    bool f = false;
    for(int i = 2; i <= sqrt(n); i++){
      if(!(n%i)){
        f = true;
        mp[i]++;
        n /= i;
        i--;
      }
    }
    if(!f && n != 1){
      mp[n]++;
      n /= n;
    }
  }
  ll ans = 0;
  for(auto i : mp){
    // cout << i.first << ' ' << i.second << endl;
    ans += (-1 + sqrt(1 + 8 * i.second)) / 2;
  }
  cout << ans << endl;

  // end-----------------------------------------------
  // cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}


Measured memory_bytes: 3680
import collections

N = int(input())
A = list(map(int, input().split()))
S = sum(A)
Q = int(input())
T = collections.Counter(A)
for i in range(Q):
    b, c = map(int, input().split())
    S += T[b]*(c-b)
    T[c] += T[b]
    T[b] = 0
    print(S)

Measured memory_bytes: 23924
#include <bits/stdc++.h>
using namespace std;
int main() {
    double w, h, x, y, ans;
    cin >> w >> h >> x >> y;
	int num = (x == w / 2 && y == h / 2) ? 1 : 0;
	ans = w * h / 2.0;
	printf("%.10f %d\n", ans, num);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep0(i,n) for (int i = 0; i < (n); ++i)  //0index
#define rep1(i,n) for (int i = 1; i < (n); ++i)  //1index
#define REP(i,a,b) for (int i = a; i < (b); ++i)  //aからb - 1まで
#define mREP(i,a,b) for (int i = a; i > (b); --i)  //逆
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;  //最大値兼MOD
typedef long long ll;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }  //GCD
int main(){
    int a;
    cin >> a;
    string s;
    cin >> s;
    int count = 0;
    int ans =0;
    rep0(i,a - 1){
       if(s[i] == s[i+1])count++;
       else{
           if(count >= 1)ans += count;
           count = 0;
       }
    }
     if(count >= 1)ans += count;
           count = 0;
    cout << a - ans <<endl;
    return 0;
}

Measured memory_bytes: 512
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    print(int(n/3))
if __name__ == '__main__':
    do()

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

public class Main {
	
	public static void main(String[] args) {
		FastScanner sc=new FastScanner();
		int T=sc.nextInt();
		System.out.println(T==0 ? "1":"0");
	}
	
	static final Random random = new Random();
	
	static void sort(int[] a) {
		int n = a.length;
		for(int i =0; i<n; i++) {
			int val = random.nextInt(n);
			int cur = a[i];
			a[i] = a[val];
			a[val] = cur;
		}
		Arrays.sort(a);
	}
	
	static void sortl(long[] a) {
		int n = a.length;
		for(int i =0; i<n; i++) {
			int val = random.nextInt(n);
			long cur = a[i];
			a[i] = a[val];
			a[val] = cur;
		}
		Arrays.sort(a);
	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (st == null  || !st.hasMoreTokens()) {
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		String nextLine() { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
		} 
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
		double nextDouble() { 
            return Double.parseDouble(next()); 
        } 
	}

}


Measured memory_bytes: 32680
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

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

    int ans = 1;
    int mcount = 0;
    FOR(i,1,n+1) {
        int count = 0;
        int x = i;
        while(x % 2 == 0) {
            count++;
            x /= 2;
        }
        if (count > mcount) {
            ans = i;
            mcount = count;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int d[200010],n;
int main()
{
	scanf("%d",&n);
	int cache;
	for(int i=1;i<=n;i++) 
	{
		scanf("%d",&cache);
		d[cache]++;
		if(cache-1>=0) d[cache-1]++;
		d[cache+1]++;
	}
	int maxn=0;
	for(int i=0;i<=200000;i++) if(d[i]>maxn) maxn=d[i];
	printf("%d",maxn);
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <utility>

#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; 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 (a > b) {a = b; return 1;} return 0; }

typedef long long ll;
using namespace std;

int main() {
    
    int n, w, h;
    cin >> n >> w >> h;
    cout << (n - w + 1) * (n - h + 1) << endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
#include <stack>
#include <iomanip>
#include <limits>
using namespace std;
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
using Graph=vector<vector<int>>;
using edge= struct{int to;ll cost;};
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
typedef priority_queue<ll> PQ_HIGH;
typedef priority_queue<ll,VL,greater<ll>> PQ_LOW;//昇順

int main(){
  ll r,d,x;cin>>r>>d>>x;
  for(int i=0;i<10;i++){
    x=r*x-d;
    cout<<x<<endl;
  }
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int A, B; cin >> A >> B;
    int w = 2 * B;
    if (w >= A) {
		cout << 0 << nl;
	} else {
		cout << A - w << nl;
	}
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;
#define all(x) (x).begin(), (x).end()

int main(){
    int n; cin>>n;
    map<int, int> m;
    for (int i = 0; i < n-1; i++){
        int x;
        cin>>x;
        m[x]++;
    }
    for(int i = 1; i<=n; i++){
        m[i]++;
        m[i]--;
    }
    for(auto&x: m)
        cout<<x.second<<endl;
    return 0;
}


Measured memory_bytes: 13008
#include <iostream>
#include <string>
#include <cassert>

using namespace std;

string S;
size_t cur = 0;

int digit(){
  assert(isdigit(S[cur]));
  int n = S[cur] - '0';
  cur += 1;
  return n;
}

int number(){
  int n = digit();
  while(cur<S.size()&&isdigit(S[cur])){
    n = n*10 + digit();
  }
  return n;
}

int factor();

int term(){
  int a = factor();
  while(cur<S.size()&&(S[cur] == '*' || S[cur] == '/')){
    char op = S[cur];
    cur += 1;
    int b = factor();
    if(op == '*') a *= b;
    else a /= b;
  }
  return a;
}

int expression(){
  int a = term();
  while(cur<S.size()&&(S[cur] == '+' || S[cur] == '-')){
    char op = S[cur];
    cur += 1;
    int b = term();
    if(op == '+') a += b;
    else a -= b;
  }
  return a;
}

int factor(){
  if(S[cur]!='(') return number();
  cur += 1;
  int n = expression();
  assert(S[cur]==')');
  cur += 1;
  return n;
}

int parse(){
  cur = 0;
  return expression();
}

int main(){
  int n;
  cin >> n;
  for(int i=0;i<n;++i){
    cin >> S;
    S.pop_back();

    int a = parse();

    cout << a << endl;
  }
}

Measured memory_bytes: 3048
// C - Switches

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const int MOD = 1e9 + 7;

class EnumerableBits {
	vector<int> bits;
	int N;
	long long b, max_b;
public:
	EnumerableBits(int N) {
		vector<int> bits(N, 0);
		this->bits = bits;
		this->N = N;
		this->max_b = (1 << N) - 1;
		this->b = 0;
	}

	bool next() {
		if (b == max_b) {
			return false;
		}

		b++;
		for (int i = 0; i < N; i++) {
			bits[i] = b >> i & 1;
		}

		return true;
	}

	vector<int> get_bits() {
		return bits;
	}
};

bool is_valid(int M, vector<vector<int>>& connect_to, vector<int>& p, vector<int>& bits) {
	for (int i=0; i<M; i++) {
		int sum = 0;
		for (int s : connect_to[i]) {
			sum += bits[s];
		}
		if (sum % 2 != p[i]) return false;
	}

	return true;
}

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

	vector<vector<int>> connect_to(M);
	vector<int> p(M);

	for (int i=0; i<M; i++) {
		int k;
		cin >> k;
		for (int j=0; j<k; j++) {
			int s;
			cin >> s;

			connect_to[i].push_back(s - 1); // 0始まりに変更
		}
	}

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

	EnumerableBits enum_bits(N);

	int ans = 0;
	do {
		vector<int> bits = enum_bits.get_bits();
		if (is_valid(M, connect_to, p, bits)) ans++;
	} while (enum_bits.next());

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
var
i,j,c,d,e,b,a,x,k:longint;
begin
readln(a);readln(b);readln(c);readln(x);
for i:=0 to a do
for j:=0 to b do
for k:=0 to c do
if i*500+j*100+k*50=x then inc(e);
write(e);
end.

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  double N,T,A;
  cin >> N >> T >> A;
  vector<double> H(N);
  rep(i,N)
  {
    cin >> H[i];
  }
  vector<double> warm(N);
  rep(i,N)
  {
    warm[i] = T - H[i] * 0.006;
  }
  double m = 1111;
  int n = 0;
  rep(i,N)
  {
    if(abs(warm[i]-A)<m)
    {
      m = abs(warm[i]-A);
      n = i+1;
    }
  }
  cout << n << endl;
  return 0;
}


Measured memory_bytes: 3824
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

long long gcd(long long a, long long b) {
    return b != 0 ? gcd(b, a % b) : a;
}

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

int main(void)
{
    long long a,b;
    cin >>a >>b;

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

    return 0;
}

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

using namespace std;

int main(){
    int n,m;
    cin>>n>>m;
    int s[5],c[5];
    for(int i=0;i<m;i++){
        cin>>s[i]>>c[i];
    }

    for(int i=0;i<1000;i++){
        string str=to_string(i);
        if(str.size()!=n)continue;
        bool ok=true;
        for(int j=0;j<m;j++){
            if(str[s[j]-1]!=c[j]+'0')ok=false;
        }
        if(ok){
            cout<<str<<endl;
            return 0;
        }
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
using LL = long long int;

int main() {
	LL A;
	double B;
	cin >> A >> B;
	LL mod_b = (double)(B * 100 + 0.1);
	LL ans = A * mod_b /100;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3748
#include <iostream>
using namespace std;
int main(){
int H,W;
cin>>H>>W;
while(1){
	if(H==0&&W==0)break;
for(int i=0;i<H;i++){
	for(int j=0;j<W;j++){
		if(i==0||i==H-1||j==0||j==W-1)
			cout<< "#";
	  else cout<< ".";
	}cout<<endl;
  }
cout<<endl;
cin>>H>>W;
}
return 0;
}


Measured memory_bytes: 3092
# https://beta.atcoder.jp/contests/abc101/tasks/arc099_a
# C - Minimization

# C_Minimization.py

N, K = map(int, input().strip().split(" "))
A = list(map(int, input().strip().split(" ")))

for i in range(N):
    if A[i] == 1:
        min_index = i

left = min_index + 1
count = 0
while left > 1:
    left -= K-1
    count += 1
if left == 1:
    left = 0
else:
    left -= 1

right_start = N - (min_index + 1) + left + 1
while right_start > 1:
    right_start -= K-1
    count += 1

print(count)


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

int main()
{
    vector<int> ans;
    while (1)
    {
        int n;
        cin >> n;
        if (n == 0)
            break;
        vector<string> w(n);
        for (int i = 0; i < n; i++)
        {
            cin >> w[i];
        }
        for (int i = 0; i < n; i++) //スタート位置
        {
            int turn = 0;
            for (int j = i; j < n; j++)
            {
                int num = 0;
                if (turn == 5)
                    break;
                else if (turn == 0 || turn == 2) //5のとき
                {
                    while (num < 5 && j < n)
                    {
                        num += w[j].size();
                        j++;
                    }
                    j--;
                    if (num != 5)
                        goto End;
                    turn++;
                }
                else if (turn == 1 || turn == 3 || turn == 4) //7のとき
                {
                    while (num < 7 && j < n)
                    {
                        num += w[j].size();
                        j++;
                    }
                    j--;
                    if (num != 7)
                        goto End;
                    turn++;
                }
            }
            ans.push_back(i + 1);
            break;
        End:;
        }
    }
    for (int i = 0; i < ans.size(); i++)
    {
        cout << ans[i] << endl;
    }
}


Measured memory_bytes: 3204
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
//解説写し
struct UnionFind{
  vector<int>d;//データ
  UnionFind(int n=0):d(n,-1){}//初期値は全部根(-1)とする
  int find(int x){
    if(d[x]<0)return x;
    return d[x]=find(d[x]);
  }
  bool unite(int x,int y){//2つ頂点をくっつける
    x=find(x);
    y=find(y);
    if(x==y)return false;//一致していればOK
    if(d[x]>d[y])swap(x,y);//サイズが大きいものをxとする（根は負なので大小関係に注意）
    d[x]+=d[y];//サイズの合算
    d[y]=x;//根をxとする
    return false;
  }
  bool same(int x,int y){//同じ集合に属しているかを判定する
    return find(x)==find(y);
  }
  int size(int x){//サイズを求める（根はマイナスなので、マイナスをとる）
    return -d[find(x)];
  }
};
int deg[100005];
vector<int>to[100005];
int main() {
  int n,m,k;
  cin>>n>>m>>k;
  UnionFind uf(n);
  rep(i,m){
    int a,b;
    cin>>a>>b;
    a--;b--;
    deg[a]++;
    deg[b]++;
    uf.unite(a,b);
  }rep(i,k){
    int a,b;
    cin>>a>>b;
    --a;--b;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  rep(i,n){
    int ans=uf.size(i)-1-deg[i];
    for(int u:to[i]){
      if(uf.same(i,u))--ans;
    }
    cout<<ans;
    if(i==n-1)cout<<endl;
    else cout<<" ";
  }
  return 0;
}

Measured memory_bytes: 6784
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>

using namespace std;


int main() {
	
	int N,M,X,Y;
	int x[110], y[110];
	cin >> N >> M >> X >> Y;
	int tmp;

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

	for (int i = 0; i < M; i++)
	{
		cin >> tmp;
		y[i] = tmp;
	}


	for (int i = X + 1; i < Y; i++)
	{
		bool ng = false;

		for (int j = 0; j < N; j++)
		{
			if (x[j] >= i)
			{
				ng = true;
			}
		}

		if (ng)
		{
			continue;
		}

		for (int j = 0; j < M; j++)
		{
			if (y[j] < i)
			{
				ng = true;
			}
		}

		if (ng)
		{
			continue;
		}

		cout << "No War" << endl;
		return 0;

	}

	cout << "War" << endl;

	return 0;

}


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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define LL  long long
#define NMAX 100010

int main(void)
{
    IOS
    int n;
    cin >> n;
    LL a[NMAX];
    for(int i=0;i <n;i++) cin >> a[i];

    LL dp[NMAX][2];

    dp[0][0] =a[0];
    dp[0][1] =-a[0];
    //cerr << dp[0][0] << " " << dp[0][1] << endl;
    for (int i = 1 ; i < n-1 ; i++){
        dp[i][0] = max(dp[i-1][0] + a[i], dp[i-1][1] - a[i]);
        dp[i][1] = max(dp[i-1][0] - a[i], dp[i-1][1] + a[i]);
        
        //cerr << dp[i][0] << " " << dp[i][1] << endl;
    }

    cout << max(dp[n-2][0] + a[n-1], dp[n-2][1] - a[n-1]) << endl;



    return 0;
}


Measured memory_bytes: 2560
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskATCG004A solver = new TaskATCG004A();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskATCG004A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int A = in.nextInt();
            int B = in.nextInt();
            int C = in.nextInt();

            if (A % 2 == 0 || B % 2 == 0 || C % 2 == 0) {
                out.println(0);
            } else {
                long diff = Math.min(1l * C * A, Math.min(1l * A * B, 1l * B * C));
                out.println(diff);
            }
        }

    }
}


Measured memory_bytes: 9556
//abc165_d.cpp
//Mon May 25 21:17:16 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	ll a,b,n;
	cin >> a >> b >> n;

	if (n>=b-1){
		ll x = a*(b-1)/b;
		cout << x << endl;
	}else {
		ll x = a*n/b;
		cout << x << endl;
	}
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 3588
//
//  main.cpp
//  atcodervacation
//
//  Created by r on 5/22/19.
//  Copyright © 2019 r. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <stack>
#include <queue>
#include <assert.h>
#include <limits>
#include <cstdio>
using namespace std;

//#define RDEBUG 1
#ifdef RDEBUG
#define D(x) x
#else
#define D(x)
#endif
#define inf 0x7fffffff
#define MOD 1000000007

int N;
int a[100010][3];
int dp[100010][3];

int main() {
    ios_base :: sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> N;
    for (int i = 0; i<N; i++) {
        for (int j = 0; j<3; j++) {
            cin >> a[i][j];
        }
    }
    for (int i = N-1; i>=0; i--) {
        for (int j = 0; j<3; j++) {
            for (int k = 0; k<3; k++) {
                if (j != k) {
                    dp[i][j] = max(dp[i][j], a[i][k]+dp[i+1][k]);
                }
            }
        }
    }
    cout << max(dp[0][0], max(dp[0][1], dp[0][2])) << endl;
    return 0;
}





Measured memory_bytes: 2560
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] a = new int[N];
		int[] count = new int[N];
		for(int i=0;i<N;i++) {
			 a[i] = sc.nextInt();
		}
		for(int odd : a) {
		if(odd%2 == 1) {
			System.out.println("0");
			System.exit(0);
		}

		}
			for(int b = 0;b<N;b++) {
				for(int c =0;c<100000000;c++) {
					if(a[b]%2==1) {
						break;
					}
					a[b]=a[b]/2;
					count[b]++;
				}
			}
			int min =1000000000;
		for(int d = 0;d<count.length;d++) {
			min = Math.min(min, count[d]);

		}
			System.out.println(min);
		}
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}

    mint &operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }

    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(mod - 2);
    }

    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }

    friend std::istream &operator>>(std::istream &in, mint &o) {
        ll a;
        in >> a;
        o = a;
        return in;
    }

    friend std::ostream &operator<<(std::ostream &out, const mint &o) {
        out << o.x;
        return out;
    }

};

int main() {
    int n;
    cin >> n;
    vector<ll> flogs(n);
    rep(i, n) cin >> flogs[i];

    stack<ll> st;
    mint ans = 1;
    rep(i, n) {
        st.push(flogs[i]);
        ll mi = 2 * st.size() - 1;
        if (mi > flogs[i]) {
            ans *= st.size();
            st.pop();
        }
    }

    while (!st.empty()) {
        ans *= st.size();
        st.pop();
    }
    cout << ans << endl;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int>data(N);
  for(int i=0;i<N;i++){
    cin >> data.at(i);
  }
  sort(data.begin(),data.end());
  reverse(data.begin(),data.end());
  int result=0;
  for(int i=0;i<K;i++){
    result+=data.at(i);
  }
  cout << result << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a,b,num;
  scanf("%d%d",&a,&b);
  if((b-1)%(a-1)==0)
    num=(b-1)/(a-1);
  else
    num=(b-1)/(a-1)+1;
  printf("%d\n",num);
  return 0;
}


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

using namespace std;
#define MOD 1000000007
#define pi 3.1415926535897932384626433832795028841971693993751058209749445923078164062
#define ll long long
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define popb pop_back()
#define popf pop_front()
#define ff first
#define ss second
#define vl vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vll vector< pair<ll,ll> >
#define vii vector< pair<int,int> >
#define viii vector< tuple <int,int,int> >
#define vlll vector< tuple <ll,ll,ll> >
#define vvl vector<vector<ll>>
#define vv vector<vector<int>>
#define all(v) v.begin(),v.end()
#define sqrt sqrtl
#define cbrt cbrtl
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mapcl map<char,ll>
#define mapci map<char,int>
#define mapll map<ll,ll>
#define mapii map<int,int>
#define seti set<int>
ifstream fin("input.txt");
ofstream fout("output.txt");

ll pows(int a , int b)
{
	ll res=1;
	for(int i=0; i<b; ++i)
	{
		res*=a;
	}
	return res;
}

int main()
{	
    std::ios::sync_with_stdio(false);
    //cin.tie(NULL);
    //cout.tie(NULL);
    int a,b;cin>>a>>b;
    cout<<max(a+b,max(a*b,a-b));

}

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

int distance(const int x, const int y, const int start, const int goal) {
  int ans = goal - start;
  int tmp;

  tmp = abs(x - start) + 1 + abs(goal - y);
  if (tmp < ans) {
    ans = tmp;
  }

  tmp = abs(y - start) + 1 + abs(goal - x);
  if (tmp < ans) {
    ans = tmp;
  }

  return ans;
}

int main() {
  int N, X, Y;

  cin >> N >> X >> Y;

  int i, j;
  int d;
  unordered_map<int, int> mp;

  FORE(i, 1, N) {
    FORE(j, i + 1, N) {
      d = distance(X, Y, i, j);

      if (mp.count(d) == 1) {
        mp[d]++;
      } else {
        mp[d] = 1;
      }
    }
  }

  int k;
  FORE(k, 1, N-1) {
    if (mp.count(k) == 1) {
      printf("%d\n", mp[k]);
    } else {
      printf("0\n");
    }
  }

  return 0;
}


Measured memory_bytes: 384
n = int(input())
counts = 0
ans = 0
for i in range(2, n + 1):
    for j in range(1, i + 1):
        if i % j == 0 and i % 2 != 0:
            counts += 1
    if counts == 8:
        ans += 1
    counts = 0
print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD (int)(1e9+7)
#define ceil(x, y) (x%y==0? (x/y) : (x/y+1))
#define FOR(i, N) for(int i = 0; i < N; ++i)
#define FOR1(i, N) for(int i = 1; i <= N; ++i)
#define vi vector <int>
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mset(a, v) memset(a, v, sizeof(a))
#define all(v) (v).begin(), (v).end()
#define INF 2e9
#define EPS 1e-9
#define MAX 200009
#define PI 3.141592653589793238
#define int long long
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef cc_hash_table<int, int, hash<int>> ht; // while using, comment #define int long long  */

void __print(int x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
using namespace std;
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    	freopen("in2.txt", "r", stdin);
    	freopen("out.txt", "w", stdout);
    #endif

	int T=1;
	//cin >> T;
	FOR1(tp, T)
	{
		//cout << "Case #" << tp << ": ";
		int k, a, b;
		cin >> k >> a >> b;
		bool f = true;
		for(int i = a; i <= b; i++){
			if(i % k == 0){
				cout << "OK";
				f = false;
				break;
			}
		}
		if(f == true) cout << "NG";
		cout << '\n';
	}
	return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define foreach(u,v) for(auto (u) : (v))
#define pb push_back
#define mp make_pair
#define mt make_tuple

#define int long long

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;

const int inf = 1e9;
const ll linf = 1LL<<60;
const ll mod = 1e9 + 7;
const double eps = 1e-9;

/*
*/

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

  string s[3];
  cin >> s[0] >> s[1] >> s[2];

  int ans = 0;
  rep(i, n){
    int cnt = 0;
    map<char, int> c;
    rep(j, 3) c[s[j][i]]++;
    foreach(cc, c){
      if(cc.second == 1){
        ans++;
        cnt++;
      }
    }
    if(cnt == 3) ans--;
  }
  
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#define N 16
#define ll long long
int n;
int a[N][N];
ll dp[1<<N];
ll t[1<<N];
int vis[1<<N];
ll DP(int msk){
	if(!msk)return 0;
	if(vis[msk])return dp[msk];
	vis[msk]=1;
	dp[msk]=-1e18;
	for(int nmsk=msk;nmsk;nmsk=(nmsk-1)&msk){
		ll cur=DP(msk^nmsk)+t[nmsk];
		if(cur>dp[msk])dp[msk]=cur;
	}
	return dp[msk];
}
int main(){
	scanf("%d",&n);
	for(int i=0;i<n;++i)for(int j=0;j<n;++j)scanf("%d",&a[i][j]);
	for(int nmsk=1;nmsk<(1<<n);++nmsk) {
		ll cur=0;
		for(int i=0;i<n;++i)if(nmsk>>i&1){
			for(int j=i+1;j<n;++j)if(nmsk>>j&1){
				cur+=a[i][j];
			}
		}
		t[nmsk]=cur;
	}
	printf("%lld\n",DP((1<<n)-1));
	return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define maxn 100005
#define LL long long
using namespace std;
char cb[1<<20],*cs,*ct;
#define getc() (cs==ct&&(ct=(cs=cb)+fread(cb,1,1<<20,stdin),cs==ct)?0:*cs++)
template<class T>inline void read(T &a){
	char c;bool f=0;while(!isdigit(c=getc())) c=='-'&&(f=1);
	for(a=c-'0';isdigit(c=getc());a=a*10+c-'0'); f&&(a=-a);
}
int n;
LL F[maxn],G[maxn],a[maxn];
int main()
{
	read(n);
	for(int i=1;i<=n;i++){
		read(a[i]);
		if(i>1&&a[i-1]>0&&a[i]>0) a[i-1]+=a[i],i--,n--;
	}
	for(int i=1;i<=n;i++) F[i]=F[i-1]+a[i],G[i]=G[i-1]+abs(a[i]);
	LL ans=F[n];
	for(int i=2;i<n;i++) if(a[i]<0) ans=max(ans,F[i]-a[i+1]+G[n]-G[i+1]);
	printf("%lld\n",ans);
}

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



int main(){
  int N;
  cin>>N;
  
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin>>vec.at(i);
  }
  vector<int> ret;
  vector<int> rett;
  for(int i=0;i<N;i++){
    int a=i;
    int b=vec.at(i);
    if(a%2==1){
      ret.push_back(b);
    }
    else{
      rett.push_back(b);
    }
  }
  int NNN=ret.size();
  int NN=rett.size();
  if(N==1){
    cout<<vec.at(0)<<endl;
    return 0;
  }
  if((N-1)%2==0){
  	for(int i=NN-1;i>=0;i--){
    	cout<<rett.at(i)<<" ";
  	}
 	 for(int i=0;i<NNN-1;i++){
    	cout<<ret.at(i)<<" ";
  	}
  	cout<<ret.at(NNN-1)<<endl;
  }
  else{
    for(int i=NNN-1;i>=0;i--){
    	cout<<ret.at(i)<<" ";
  	}
 	 for(int i=0;i<NN-1;i++){
    	cout<<rett.at(i)<<" ";
  	}
  	cout<<rett.at(NN-1)<<endl;
  }
}

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

int main(){
  ll n,dd,cnt=0;
  cin >> n >> dd;
  ll d = dd*dd;
  ll x,y;
  ll z;
  for(int i=0;i<n;i++){
    cin >> x >> y;
    z = x*x + y*y;
    
    if(z <= d) cnt++;
    
  }
  
  cout << cnt << endl;
  
  return 0;
}


Measured memory_bytes: 3628
import sys
import math
from  collections import defaultdict

# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')

def solve(test):
	s = list(input())
	for i in range(len(s)):
		if s[i] == '?':
			s[i] = 'D'

	print(''.join(s))

if __name__ == "__main__":
	test_cases = 1
	for t in range(1, test_cases + 1):
		solve(t)


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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

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

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

  int n; cin >> n;
  vll p(n);
  ll mi = INF;
  ll cnt = 0;
  for(int i=0;i<n;++i) {
    cin >> p[i];
    if(p[i] <= mi) cnt++;
    mi = min(mi, p[i]);
  }
  cout << cnt << endl;

}


Measured memory_bytes: 1792
#B

x1,y1,x2,y2 = (int(num) for num in input().split())
v = [x2-x1,y2-y1]
v = [-v[1],v[0]]
x3,y3 = x2+v[0],y2+v[1]
v = [-v[1],v[0]]
x4,y4 = x3+v[0],y3+v[1]
print(x3,y3,x4,y4)

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

vector<int> seat;

int q(int x){
    cout<<x<<endl;
    string s;cin>>s;
    if(s=="Vacant") return INF;
    if(s=="Female") return -1;
    if(s=="Male")   return 1;
    else            return -INF;
}

void solve(int l,int r){
    if(l>=r) return;
    int m=(l+r)/2;
    int x=q(m);
    if(x==INF) return;
    seat[m]=x;

    bool lf=false,rf=false;
    //left
    if((m-l)%2==0){
        if(seat[m]!=seat[l]) lf=true;
    }
    else{
        if(seat[m]==seat[l]) lf=true;
    }
    if((r-m)%2==0){
        if(seat[r]!=seat[m]) rf=true;
    }
    else{
        if(seat[r]==seat[m]) rf=true;
    }
    if(lf){
        solve(l,m);
    }
    else if(rf){
        solve(m,r);
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int n;cin>>n;
    //1->male -1->female
    seat=vector<int>(n,0);

    seat[0]=q(0);
    if(seat[0]==INF) return 0;
    seat[n-1]=q(n-1);
    if(seat[n-1]==INF) return 0;

    solve(0,n-1);
    return 0;
}


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

int main() {
  int n;
  cin>>n;
  pair<string,int> review[109];
  set<string> name;
  rep(i,n){
    string s;
    int p;
    cin>>s>>p;
    review[i]=make_pair(s,p);
    name.insert(s);
  }
  auto iter=name.begin();
  pair<int,int> book[109];
  while(iter!=name.end()){
    rep(i,109) book[i]=make_pair(0,0);
    int count=0;
    rep(i,n){
      if(review[i].first==*iter){
        book[count]=make_pair(review[i].second,i+1);
        count++;
      }
    }
    sort(book,book+count,greater<pair<int,int>>());
    rep(i,count) cout<<book[i].second<<endl;
    iter++;
  }
}

Measured memory_bytes: 256
num, money = map(int, input().split())
ex = False

#一万円の枚数
l = 0
count_list = [-1]*3
if num*1000 <= money and money <= num*10000:
    while ex == False and l <= num:
        for i in range((num-l) + 1):
            #iを5000円の枚数
            money_actual = l*10000 + i*5000 + (num-l-i)*1000
            # print(str(money_actual))
            if money_actual == money:
                ex = True
                count_list = [l, i, num-(l+i)]
                # print(count_list)
        l += 1
        

print(str(count_list[0]) + " " + str(count_list[1]) + " " + str(count_list[2]))

Measured memory_bytes: 9212
N, K = map(int, input().split())
mod = 10**9 + 7
ans = 0

for i in range(K, N + 2):
    a = N - i + 1
    n_max = i * (2 * a + i - 1) // 2
    n_min = i * (i - 1) // 2
    ans += n_max - n_min + 1
    ans %= mod

print(ans)


Measured memory_bytes: 9160
/*{{{*/
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#ifdef LOCAL
int c_ = 0;
#define cout (c_?cerr:cout)
#define debug(...) \
{if(!c_++)cerr<<"\033[96;1m"; \
__VA_ARGS__; \
if(!--c_)cerr<<"\033[0m";}
#else
#define debug(...) {}
#endif
#define st first
#define nd second
#define all(...) (__VA_ARGS__).begin(), (__VA_ARGS__).end()
using namespace std;
using ll = long long;
using ld = long double;
template < typename t > using V = vector< t >;
template< typename t > int size(const t& c) {return c.size();}
void print() {cout << '\n';}
template< typename t, typename... v >
void print(const t& a, const v&... b)
{cout << a << (sizeof...(b)?" ":""); print(b...);}
#define flag() __LINE__"| "__PRETTY_FUNCTION__
#define dump(...) debug(print(#__VA_ARGS__,'=',__VA_ARGS__))
/*}}}*/

constexpr int nax = 2e5;

int n, tab[nax + 1], bat[nax + 1], dp[nax + 1];

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

    cin >> n;

    for (int i = 1; i <= n; ++i)
        cin >> tab[i], bat[tab[i]] = i;

    dp[n] = 1;

    for (int i = n - 1; i >= 1; --i)
        dp[i] = (bat[i] < bat[i + 1]? dp[i + 1] + 1 : 1);

    int res = n;

    for (int i = 1; i <= n; ++i)
        res = min(res, n - dp[i]);

    print(res);
}

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

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  if (a > 0 && b > 0) {
    cout << "Positive\n";
  } else if (a <= 0 && b >= 0) {
    cout << "Zero\n";
  } else if (a <= b && b < 0) {
    if ((b - a + 1) % 2 == 0) {
      cout << "Positive\n";
    } else {
      cout << "Negative\n";
    }
  }

  return 0;
}

Measured memory_bytes: 256
use std::str::FromStr;
use std::fmt::Debug;

fn read_line<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()
}

fn main() {
    let first: Vec<u32> = read_line();
    let second: Vec<String> = read_line();
    let x: String = second[0].to_string();

    let mut cnt: u32 = 0;
    for i in x.as_str().chars() {
        if i == 'R' { cnt += 1 };
    };

    if cnt > first[0] / 2 {
        print!("Yes");
    } else {
        print!("No");
    };
}


Measured memory_bytes: 4352
// https://beta.atcoder.jp/contests/abc100/tasks/abc100_d
// https://beta.atcoder.jp/contests/abc100/submissions/3085254

#include<bits/stdc++.h>
#define ll long long

using namespace std;

ll n, m, x[1001], y[1001], z[1001], t[1001], c[4], ans = -(1e18);

int main(){
    cin >> n >> m;
    for (int i = 0; i < n; i++) cin >> x[i] >> y[i] >> z[i];
    for (int s = 0; s < 8; s++){
        for (int i = 0; i < 3; i++) c[i] = (((s>>i)&1) == 1)? 1 : -1;
        for (int i = 0; i < n; i++) t[i] = c[0]*x[i] + c[1]*y[i] + c[2]*z[i];
        sort(t, t + n, greater<ll>());
        ans = max(ans, accumulate(t, t + m, 0LL));
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    string s;
    cin >> s;
    int n = s.size();
    
    string ans = "";
    for(int i = 0;i < 1 << (n - 1);i++){
          int x = s[0] - '0';
          string t = s.substr(0,1);
          for(int j = 1;j < n;j++){
                if(i >> (j - 1) & 1){
                      x += (s[j] - '0');
                      t += "+" + s.substr(j,1);
                }else{
                      x -= (s[j] - '0');
                      t += "-" + s.substr(j,1);
                }
          }
          if(x == 7)ans = t + "=7";
    }
    cout << ans << endl;
}


Measured memory_bytes: 3628