akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

//#define DEBUG

using namespace std;

template <class T>
void print_vect(std::vector<T> v){
    for(int i = 0 ; i < v .size(); i++) cout << v[i] << " ";
    cout << endl;
}


void solve(){
    std::string S;
    cin >> S;
    cout << S.substr(0, 3) << endl;
}

int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/

    #ifdef DEBUG
    int TEST_CASES = 2;
    while(TEST_CASES--){
    #endif // DEBBUG

    solve();

    #ifdef DEBUG
    }
    #endif // DEBUG
    
    return 0;
}


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

int main(){
  int N,Y;
  cin >> N >> Y;
  
  int P =0;//組み合わせの個数
  vector<int> pear(3);
  
  for( int i=0; i<=N; i++){
    for( int j=0; j<=N-i; j++){
      for( int k=0; k<=N-i-j; k++){
        if(10000*i + 5000*j + 1000*k ==Y && i+j+k ==N){
          P ++;
          pear = {i,j,k};
          break;
        }
      }
    }
  }
  
  if (P==0)
    cout << "-1 -1 -1" << endl;
  else
    cout << pear.at(0) << " "<< pear.at(1) << " "<< pear.at(2) << endl;
}

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

#define ll long long
#define ld long double
#define ar array
#define pb push_back
#define FOR(i, a, b) for (int i=(a); i<(b); i++)

const int d4i[4]={-1, 0, 1, 0}, d4j[4]={0, 1, 0, -1};
const int d8i[8]={-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8]={0, 1, 1, 1, 0, -1, -1, -1};

// void solve(){

// }


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

    int d,t,s;
    cin>>d>>t>>s;
    if((float)d/s <= (float)t)
        cout<<"Yes";
    else
    {
        cout<<"No";
    }
        
    return 0;
}

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

int main() {
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int d = 0;
  for (int a = 0;a <= A; ++a) {
    for (int b = 0;b <= B; ++b) {
      for(int c = 0;c <= C; ++c) {
        int sum = 500*a + 100*b + 50*c;
        if (X == sum) {
          ++d;
        }
      }
    }
  }
  cout << d << endl;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

pub fn gen_prime_table(n: u64) -> Vec<bool> {
    let mut is_prime = vec![true; n as usize + 1];
    is_prime[0] = false;
    is_prime[1] = false;
    let mut i = 2;
    while i * i <= n as usize {
        if is_prime[i] {
            let mut j = 2;
            while i * j <= n as usize {
                is_prime[i * j] = false;
                j += 1;
            }
        }
        i += 1;
    }
    is_prime
}

fn main() {
    input!{
      q: usize,
      lrs: [(usize, usize); q],
    }
    let m = 1e5 as usize + 1;
    let primes = gen_prime_table(m as _);
    let mut primes2 = vec![false; m];
    for i in 0..primes.len() {
        if i%2 == 0 || !primes[i] {
            continue;
        }
        if primes[ (i+1)/2 ] {
            primes2[i] = true;
        }
    }

    let mut s = vec![0; m+1];
    for i in 0..m {
        s[i+1] = s[i] + if primes2[i] { 1 } else { 0 };
    }

    for i in 0..q {
        let (l, r) = lrs[i];
        println!("{}", s[r+1] - s[l]);
    }
}


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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"
*/

int main()
{
    double x1, x2, y1, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    double dist_2 = pow(x1-x2, 2) + pow(y1-y2, 2);
    double dist = sqrt(dist_2);
    printf("%.6f\n", dist);
}


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

int main(){
    char str[101];
    scanf("%s",str);
    int i,count = 0;
    for(i = 0; i < strlen(str)/2; i++){
        if (str[i]!=str[strlen(str)-i-1]) count++;
    }
    printf("%d\n",count);
    return 0;
}

Measured memory_bytes: 1712
import fractions
n, fx = map(int, input().split())
x = list(map(int, input().split()))
x.append(fx)
x.sort()

ans = x[1]-x[0]
for i in range(2, len(x)):
  v = x[i]-x[i-1]
  ans = fractions.gcd(ans, v)

print(ans)

Measured memory_bytes: 16240
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;

double	dist(vector<int> x, vector<int> y, int i, int j)
{
	double dx = x[i] - x[j];
	double dy = y[i] - y[j];
	return (sqrt(dx * dx + dy * dy));
}

int		main(void)
{
	int N;

	cin >> N;
	vector<int> x(N), y(N);

	for (int i = 0; i < N; i++)
		cin >> x[i] >> y[i];
	vector<int> p(N);

	for (int i = 0; i < N; i++)
		p[i] = i;
	double len = 0;
	int cnt = 0;

	do
	{
		for (int i = 0; i < N - 1; i++)
			len += dist(x, y, p[i], p[i + 1]);
		cnt++;
	}
	while (next_permutation(p.begin(), p.end()));
	double ans = len / cnt;

	printf("%.10f\n", ans);
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using P =pair<ll,ll>;
ll A,B,C,D,E,F;
const ll INF =ll(1e18)+5;
set<ll> water;

void dfs(ll sum){
    if(sum>F){
        return;
    }
    if(water.find(sum) != water.end()){
        return;
    }
    water.insert(sum);
    dfs(sum+A*100);
    dfs(sum+B*100);

}

set<ll> sugar;
void sugarDfs(ll sum){
    if(sum>F){
        return;
    }
    if(sugar.find(sum) != sugar.end()){
        return;
    }
    sugar.insert(sum);
    sugarDfs(sum+C);
    sugarDfs(sum+D);

}

int main() {
    cin >> A >>B >>C >>D >>E >>F;
    dfs(0);
    water.erase(0);
    water.insert(INF);
    sugarDfs(0);
    long double maxN = 0;
    P ans = P(A*100,0);
    for(auto itr = sugar.begin();itr != sugar.end();++itr){
        // cerr <<"*itr=" << *itr << endl; 
        ll needWater = 100* ((*itr + E-1)/E);
        auto witr = water.lower_bound(needWater);
        //  cerr <<"*witr=" << *witr << endl; 
        if(*itr + *witr <= F){
            long double n = ((long double)*itr)/((long double)(*itr+*witr)+(1e-7));
            // cerr <<"n="<< n << endl;
            if(n>maxN){
                maxN = n;
                ans = P((*itr+*witr),*itr);
            }
        }
    }
    cout << ans.first <<" "<< ans.second << endl;
    return 0;
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    int k;
    cin >> k;
    vector<int> h(n);
    vector<int> dp(n);
    for(int i = 0; i < n; i++) {
        cin >> h[i];
    }
    dp[0] = 0;
    dp[1] = abs(h[0] - h[1]);
    for(int i = 2; i < n; i++) {
        int best = INT_MAX;
        for(int j = 1; j <= k && i - j >= 0; j++) {
            int x = dp[i-j] + abs(h[i-j] - h[i]);
            if(x < best) {
                best = x;
            }
        }
        dp[i] = best;
    }
    cout << dp[n-1];
    return 0;
}


Measured memory_bytes: 1024
def warshall_floyd():
    for k in range(n):
        for i in range(n):
            for j in range(n):
                A[i][j] = min(A[i][j],A[i][k]+A[k][j])
    return

V,E = map(int,input().split())
n = V
A = [[float('inf')]*V for _ in range(n)]
for i in range(E):
    s,t,d = map(int,input().split())
    A[s][t] = d
for i in range(n):
    A[i][i] = 0
    
warshall_floyd()

negative_flag = False
for i in range(n):
    if A[i][i]<0:
        negative_flag = True
        
for i in range(n):
    for j in range(n):
        if A[i][j] == float("inf"):
            A[i][j] = 'INF'
        
if negative_flag:
    print("NEGATIVE CYCLE")
else:
    for i in range(n):
        print(' '.join(map(str,A[i])))


Measured memory_bytes: 6012
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <stdio.h>
using namespace std;
vector<int>a;
int num[110000];
void change(int a,int b)
{
    int temp;
    temp=num[a];
    num[a]=num[b];
    num[b]=temp;
}
int main()
{
    int n,sum=0;
    cin>>n;
    for(int i=1; i<=n; i++)
        cin>>num[i];
    for(int i=1; i<=n; i++)
    {
        if(num[i]==i&&num[i+1]==i+1)
        {
            change(i,i+1);
            sum++;
        }
    }
    for(int i=1; i<=n; i++)
    {
        if(num[i]==i&&i<n)
        {
            change(i,i+1);
            sum++;
        }
        if(num[i]==i&&i==n)
        {
            change(i-1,i);
            sum++;
        }
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <utility>
#include <iostream>
#include <cmath>
#include <cstdio>

// ax + by = e1
// cx + dy = e2
auto solve (double a , double b , double e1 , double c , double d , double e2) -> std::pair <double , double>
{
    auto delta = a * d - b * c;
    return std::make_pair ((d * e1 - b * e2) / delta , (a * e2 - c * e1) / delta);
}

auto show (double v) -> std::string
{
    char s [100];
    if (-0.0005 < v && v < 0.0005)
    {
        return "0.000";
    }
    std::sprintf (s , "%.3f" , v);
    return s;
}

auto main () -> int
{
    double a , b , c , d , e , f;
    while (std::cin >> a >> b >> c >> d >> e >> f)
    {
        auto xy = solve (a , b , c , d , e , f);
        std::cout << show (xy.first) << ' ' << show (xy.second) << std::endl;
    }
}

Measured memory_bytes: 3184
#include <bits/stdc++.h>
using namespace std;
template<typename T = int> vector<T> create(size_t n){ return vector<T>(n); }
template<typename T, typename... Args> auto create(size_t n, Args... args){ return vector<decltype(create<T>(args...))>(n, create<T>(args...)); }
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, r, a = 0; cin >> n >> r;
	while(n){
		a++;
		n /= r;
	}
	cout << a << '\n';
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
int main(){
  int N;
  cin >> N;
  int A[N+2];
  A[0] = 0;
  for(int i=1;i<=N;i++) cin >> A[i];

  A[N+1] = 0;

  ll sum = 0;
  for(int i=1;i<=N+1;i++){
    sum += abs(A[i]-A[i-1]);
  }

  for(int i=1;i<=N;i++){
    cout << sum-abs(A[i+1]-A[i])-abs(A[i]-A[i-1])+abs(A[i+1]-A[i-1]) <<endl; 
  }

  return 0;
}

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

#define endl "\n"
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define REP(i, n) for(int i = 0; i < n; i++)

int main(){
    int h,w,n;
    cin>>h>>w>>n;
    int ans = 0,black = 0;
    for(int i=0;i<min(h,w);i++){
        black += max(h,w);
        ans++;
        if(black >= n) break;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pii pair<int,int>
#define vs vector<string>
#define all(v) (v).begin(),(v).end()
#define ll long long
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define ld long double
#define mod 1000000007
#define PI 3.141592653589793238
#define phi 1.638
#define eps 1e-7
//#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; 

int main() 
{
    fastio
    ll n, k;
    cin>>n>>k;
    ll ans = 0;
    for(int i = k; i<=n+1; ++i) {
        ans += i*(n-i+1)+1;
    }
    cout<<ans%mod<<endl;
}   

Measured memory_bytes: 3640
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
	int N,A[100001],B[100000];
	long long int res=0;
	cin>>N;
	for(int i=0;i<N+1;i++)cin>>A[i];
	for(int i=0;i<N;i++)cin>>B[i];
	for(int i=0;i<N;i++){
		if(A[i]>=B[i]){
			res+=B[i];
			A[i]-=B[i];
			B[i]=0;
		}else{
			res+=A[i];
			B[i]-=A[i];
			A[i]=0;
		}
		if(A[i+1]>=B[i]){
			res+=B[i];
			A[i+1]-=B[i];
			B[i]=0;
		}else{
			res+=A[i+1];
			B[i]-=A[i+1];
			A[i+1]=0;
		}
	}
	cout<<res;
	return 0;
}

Measured memory_bytes: 1024
n, k = map(int, input().split())

dp = [[0] * k for _ in range(n)]
for i in range(k):
  dp[0][i] = 1

for i in range(1, n):
  toAdd = sum(dp[i - 1])
  for j in range(k):
    dp[i][j] += toAdd - dp[i - 1][j]
    
print(sum(dp[-1]))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = long long;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 3e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

signed main() {
  INIT;
  VAR(int,n);
  vector<int> a(n),b(n),c(n);

  vector< PAIR > p(n);
  REP(i,n){
    cin>>a[i]>>b[i];
    c[i] = b[i]-a[i];

    p[i] = make_pair(c[i], a[i]);
  }
  
  sort(ALL(p));

  int now = 0, lastD=0;
  REP(i,n){
    int ci, ai;
    tie(ci, ai) = p[i];

    /*
    debug(now);
    debug(ci);
    debug(ai);
    */
    int d = ci - now;
    if (d<0) {
      if (lastD-ai>=0) {
        now += ai;
        lastD -= ai;
        continue;
      }
      
      OUT("No")BR;
      return 0;
    }
    lastD = max(d, lastD-ai);

    now += ai;
  }

  

  OUT("Yes")BR;
  
  return 0;
}


Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {  
  return b != 0 ? gcd(b, a % b) : a;
}//MAX
int lcm(int a, int b) { 
   return a * b / gcd(a, b);
   }
//MIN
 main() {
int a,b;
cin >> a >>b;
if(a>b*2){
  cout << a-b*2<<endl;
}
else{
  cout <<0 <<endl;
}
 }




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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;
#define MAX_N 100010

// 500, 60min

enum State {
    Unknown = 0,
    Male,
    Female
};

ll N;
ll Color[MAX_N] = {};

ll FillC(string s, ll ind) {
    if(s == "Vacant") { return 1; }
    else if(s == "Male") { Color[ind] = Male; }
    else { Color[ind] = Female; }
    return 0;
}

signed main()
{
    cin >> N;

    string res;
    ll ret;
    // まず端を聞く
    ll pos = 0;
    printf("%lld\n", pos); cin >> res;
    ret = FillC(res, pos);
    if(ret == 1) { return 0; }
    ret = FillC(res, N);
    if(ret == 1) { return 0; }

    // 次に真ん中を聞く
    pos = N / 2;
    ll left = 0, right = N;

    REP(i, 19) {
        ll left_dist = pos - left;
        ll right_dist = right - pos;
        printf("%lld\n", pos); cin >> res; ret = FillC(res, pos);
        if(ret == 1) { return 0; }
        if(Color[pos] == Color[left]) {
            if(left_dist % 2 != 0) {
                right = pos;
                pos = left + left_dist / 2;
            } else {
                left = pos;
                pos = pos + right_dist / 2;
            }
        }
        else {
            if(left_dist % 2 != 0) {
                left = pos;
                pos = pos + right_dist / 2;
            } else {
                right = pos;
                pos = left + left_dist / 2;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 852
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

  vector<string> a(n);
  for (auto &row : a)
    cin >> row;
  vector<string> b(m);
  for (auto &row : b)
    cin >> row;

  for (int i = 0; i + m - 1 < n; i++) {
    for (int j = 0; j + m - 1 < n; j++) {
      bool ok = true;
      for (int k = 0; k < m; k++) {
        for (int l = 0; l < m; l++) {
          if (a[i + k][j + l] != b[k][l]) {
            ok = false;
            goto _next;
          }
        }
      }
    _next:;

      if (ok) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }

  cout << "No" << endl;

  return 0;
}


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

        // 最大 200 個なので余裕を持って 210 に --- 200 以上ならなんでもよいです

int main() {
  int N ;
  int A[210];
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> A[i];

    int res = 0;

    // 操作が行える限り操作を繰り返す
    while (true) {
        bool exist_odd = false;  // A[i] がすべて偶数かどうかを判定するフラグ
        for (int i = 0; i < N; ++i) {
            if (A[i] % 2 != 0) exist_odd = true;  // 奇数があったらフラグを立てる
        }

        if (exist_odd) break;  // 奇数があったら break

        // 操作を行えるなら操作を実際に行う
        for (int i = 0; i < N; ++i) {
            A[i] /= 2;
        }
        ++res;  // 操作回数をインクリメント
    }

    cout << res << endl;
}



Measured memory_bytes: 256
def gcd(a, b):
  if a > b:
    a, b = b, a
  while a % b != 0:
    a, b = b, a % b
  return b

n, k = map(int, input().split())
A = list(map(int, input().split()))

g = A[0]
for i in range(1, n):
  g = gcd(g, A[i])

if k in A or max(A) > k and k % g == 0:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')

Measured memory_bytes: 14096
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b, c, d float64
	fmt.Scan(&a, &b, &c, &d)

	n := math.Ceil(a / d)
	m := math.Ceil(c / b)
	if n == m {
		fmt.Println("Yes")
	} else if n > m {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1820
#include <cstdio>
int main(){
	int a[5];
	int sum=0;
	for(int i = 0;i < 3;i++){
		scanf("%d",&a[i]);
	}
	if(a[0]!=a[1])sum++;
	if(a[0]!=a[2])sum++;
	if(a[1]!=a[2])sum++;
	if(sum==0)printf("1\n");
	else printf("%d\n",sum);
}

Measured memory_bytes: 128
//
// Created by Myabu on 2020/01/26.
//

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <math.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <numeric>
#include <iomanip>

using namespace std;


int main(void){
    int N;
    int K;

    cin>>N>>K;

    vector<int> x(N);

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

    int ans = 0;
    for (int i = 0; i < N; ++i) {
        ans += 2 * min(x[i], abs(x[i] - K));
    }

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

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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define what_is(x) cerr << #x << " is " << x << endl;

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	int n;
	cin >> n;
	if (n == 0) {
		puts("0");
		return 0;
	}

	vi v;
	for (int i = 0; n != 0; i = 1 - i) {
		v.push_back(n&1);
		if (n&1) {
			if (n > 0 && i == 1) n += 2;
			if (n < 0 && i == 0) n -= 2;
		}
		n /= 2;
	}
	for (int i = v.size() - 1; i >= 0; i--) cout << v[i];
	cout << endl;
}


Measured memory_bytes: 256
module UnionFind
implicit none
integer,allocatable,dimension(:)::par
!parentより

contains
subroutine UFinit(N)
  integer :: N,i
  allocate(par(N))
    do i = 1, N
      par(i) = i
    end do
  end subroutine
  recursive function root(x) result (res)
    integer :: x, res
    if (par(x) == x)then
       res = x
    else
      res = root(par(x))
      par(x) = res
    end if
  end function

subroutine unite(x,y)
integer,intent(in):: x,y
integer xr,yr
xr = root(x)
yr = root(y)
if(xr /= yr) par(xr) = yr
end subroutine

end module UnionFind

use UnionFind
integer N,M
integer,allocatable,dimension(:)::a,b
integer ans,cnt
integer i,j
read*,N,M
allocate(A(M),B(M))
do i=1,M
  read*,A(i),B(i)
end do

ans=0
do i=1,M
  call UFinit(N)
  do j=1,M
    if(i==j)cycle
    call unite(a(j),b(j))
  end do
  cnt=0
  do j=1,N
    if(root(j)==j)cnt=cnt+1
  end do
  if(cnt>=2)then
    ans=ans+1
  endif
  deallocate(par)
end do
print"(i0)",ans
end

Measured memory_bytes: 256
// Best practice

#include<bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <functional> // for less */

#define int         long long
#define pb          emplace_back
#define pf          emplace_front
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MOD         1000000007
using namespace std;
/*using namespace __gnu_pbds; 
 
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> pbds; 

#define fbo find_by_order
#define ook order_of_key*/

signed main() {
   tezz
   
   int n,a,b;
   cin >> n >> a >> b;
   if(a>b)swap(a,b);
   if(a%2==b%2){
       int x=(max(a,b)-(a+b)/2);
       cout << x;
   }
   else{
       int ans=0;
       if(a-1 <= n-b){
           ans=a-1;
           b-=ans;
           a=1;
           if(a!=b){
               b--;
               ans++;
           }
       }
       else{
           ans=n-b;
           a+=ans;
           b=n;
           if(a!=b){
               a++;
               ans++;
           }
       }
       ans+=((max(a,b)-(a+b)/2));
       cout << ans;
   }
  
   return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>

#define rep(i,n) for(int i=0;i<n;i++)
#define llint long long int
#define vvint vector<vector<int>>
#define vint vector<int>

using namespace std;

int main() {
	int W, H, N;
	cin >> W >> H >> N;
	vvint ve(H,vint(W,1));
	rep(i, N) {
		int x, y, a;
		cin >> x >> y >> a;
		if (a == 1) {
			rep(j, H) {
				rep(k, x) {
					ve[j][k] = 0;
				}
			}
		}
		if (a == 2) {
			rep(j, H) {
				for (int k = x; k < W; k++) {
					ve[j][k] = 0;
				}
			}
		}
		if (a == 3) {
			rep(j, y) {
				rep(k, W) {
					ve[j][k] = 0;
				}
			}
		}
		if (a == 4) {
			for (int j = y; j < H; j++) {
				rep(k, W) {
					ve[j][k] = 0;
				}
			}
		}
	}
	int ans = 0;
	rep(i, H) {
		rep(j, W) {
			if (ve[i][j] == 1)ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstring>
#include<vector>
 
using namespace std;
 
#define long long long
#define ft(i, a, b) for (int i = (long)a ; i <= (long)b ; i++)
#define fd(i, a, b) for (int i = (long)a ; i >= (long)b ; i--)
 
const int MAXN = 1e4 + 5;
const long oo = 1e15;
 
string s;
long n , ans;
long r[MAXN] , g[MAXN] , b[MAXN];
 
void Solve() {
    fd(i , n , 1) {
        if (s[i] == 'R') {
            r[i] = r[i + 1] + 1;
            g[i] = g[i + 1];
            b[i] = b[i + 1];
        }
        else if (s[i] == 'G') {
            r[i] = r[i + 1];
            g[i] = g[i + 1] + 1;
            b[i] = b[i + 1];
        }
        else {
            r[i] = r[i + 1];
            g[i] = g[i + 1];
            b[i] = b[i + 1] + 1;
        }
    }
    //cerr << r[1] << " " << g[1] << " " << b[1] << "\n";
    ft(i , 1 , n - 2) {
        ft(j , i + 1 , n - 1) {
            //cerr << "INDEX " <<  i << " " << j << "\n";
            if (s[i] == 'R' && s[j] == 'G') {
                ans += b[j + 1];
                if (s[2 * j - i] == 'B') ans--;
                //cerr << "THIS IS ANWSER IN 1 " << ans << "\n";
            }
            else if (s[i] == 'R' && s[j] == 'B') {
                ans += g[j + 1];
                if (s[2 * j - i] == 'G') ans--;
                //cerr << "THIS IS ANWSER IN 2 " << ans << "\n";
            }
            else if (s[i] == 'G' && s[j] == 'B') {
                ans += r[j + 1];
                if (s[2 * j - i] == 'R') ans--;
                //cerr << "THIS IS ANWSER IN 3 " << ans << "\n";
            }
            else if (s[i] == 'G' && s[j] == 'R') {
                ans += b[j + 1];
                if (s[2 * j - i] == 'B') ans--;
            }
            else if (s[i] == 'B' && s[j] == 'G') {
                ans += r[j + 1];
                if (s[2 * j - i] == 'R') ans--;
            }
            else if (s[i] == 'B' && s[j] == 'R') {
                ans += g[j + 1];
                if (s[2 * j - i] == 'G') ans--;
            }
        }
    }
    cout << ans;
}
 
void FastInput() {
    ios_base::sync_with_stdio(NULL);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen(".inp", "r", stdin);
    //freopen(".out", "w", stdout);
}
 
void Input() {
    cin >> n;
    cin >> s;
    s = '#' + s;
}
 
int main() {
    FastInput();
    Input();
    Solve();
}

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

#define int long long 
#define pb push_back
#define x first
#define y second
#define sz(a) ((int)a.size())
#define all(a) (a).begin(), (a).end()
typedef pair<int, int> pii;
typedef long double ld;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x, y;
    cin >> x >> y;
    int ans = 1;
    while(2 * x <= y) {
        ans++;
        x *= 2;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3700
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <queue>

using namespace std;

int checkTable[59049];

struct Data{
	int number,depth;
};

int getNum(char ch){
	switch(ch){
	case 'r':return 0;
	case 'g':return 1;
	case 'b':return 2;
	}
	return -1; //must not reach here
}

int getWeight(int w){
	switch(w){
	case 0:return 1;
	case 1:return 3;
	case 2:return 9;
	case 3:return 27;
	case 4:return 81;
	case 5:return 243;
	case 6:return 729;
	case 7:return 2187;
	case 8:return 6561;
	case 9:return 19683;
	}
	return -1;	//must not reach here
}

int translateData(char table[],int size){
	int ret = 0;

	for(int i = 0; i < size; i++){
		ret += getNum(table[i])*pow(3,(size-1)-i);
	}

	return ret;
}

void setData(char warm[],int code,int size){
	int tmp;
	for(int i = 0; i < size; i++){
		tmp = code/getWeight(size-1-i);
		if(tmp == 0){
			warm[i] = 'r';
		}else if(tmp == 1){
			warm[i] = 'g';
		}else{
			warm[i] = 'b';
		}
		code %= getWeight(size-1-i);
	}
}

int dfs(char warm[],int size){

	int ret = -1;
	Data data;
	data.number = translateData(warm,size);
	data.depth = 0;

	queue<Data> Q;
	Q.push(data);

	Data tmp;
	char tmp_warm[11], next_warm[11];
	int code;

	while(!Q.empty()){
		tmp = Q.front();
		Q.pop();

		setData(tmp_warm,tmp.number,size);

		bool FLG = true;
		for(int i = 0; i < size-1; i++){
			if(tmp_warm[i] != tmp_warm[i+1]){
				FLG = false;
				break;
			}
		}
		if(FLG){
			while(!Q.empty())Q.pop();
			ret = tmp.depth;
			break;
		}

		for(int i = 0; i < size-1; i++){
			if(tmp_warm[i] != tmp_warm[i+1]){
				Data new_data;
				for(int k = 0; k < size; k++)next_warm[k] = tmp_warm[k];

				if(tmp_warm[i] != 'r' && tmp_warm[i+1] != 'r'){
					next_warm[i] = 'r';
					next_warm[i+1] = 'r';
				}else if(tmp_warm[i] != 'g' && tmp_warm[i+1] != 'g'){
					next_warm[i] = 'g';
					next_warm[i+1] = 'g';
				}else{
					next_warm[i] = 'b';
					next_warm[i+1] = 'b';
				}

				code = translateData(next_warm,size);
				if(checkTable[code] == -1){
					checkTable[code] = 1;
					new_data.number = code;
					new_data.depth = tmp.depth+1;
					Q.push(new_data);
				}
			}
		}
	}
	return ret;
}

int main(){

	int size,minimum;
	char buf[11];

	while(true){
		scanf("%s",buf);
		if(buf[0] == '0')break;

		for(size = 0;buf[size] != '\0';size++);

		for(int i = 0; i < 59049; i++)checkTable[i] = -1;

		checkTable[translateData(buf,size)] = 1;

		minimum = dfs(buf,size);

		if(minimum == -1)printf("NA\n");
		else{
			printf("%d\n",minimum);
		}
	}

    return 0;
}

Measured memory_bytes: 3204
#include <bits/stdc++.h>
#define mem(a, b) memset(a, b, sizeof(a))
#define inf (1e9 + 7)
using namespace std;

int n, m, a, b, num[505][505];

int main()
{
    scanf("%d%d%d%d", &n, &m, &a, &b);
    for(int i = 1;i <= n;i++)
    {
        for(int j = 1;j <= m;j++)
        {
            if(i % a == 0&&j % b == 0)
                num[i][j] = -a * b;
            else
                num[i][j] = 1;
        }
    }
    int sum = 0;
    for(int i = 1;i <= n;i++)
        for(int j = 1;j <= m;j++)
            sum += num[i][j];
    if(sum > 0)
    {
        puts("Yes");
        for(int i = 1;i <= n;i++)
        {
            for(int j = 1;j <= m;j++)
            {
                if(j == 1)
                    printf("%d", num[i][j]);
                else
                    printf(" %d", num[i][j]);
            }
            puts("");
        }
    }
    else if(n % a == 0&&m % b == 0)
        puts("No");
    else
    {
        int tmpa = n / a * a;
        int tmpb = m / b * b;
        int tt = num[tmpa][tmpb] + 1e9;
        num[tmpa][tmpb] = -1e9;
        if(n % a == 0)
        {
            for(int i = m;i >= 1;i -= b)
                num[n][i] += tt;
            for(int i = tmpb;i >= 1;i -= b)
                num[tmpa][i] = -1e9;
        }
        else
        {
            for(int i = n;i >= 1;i -= a)
                num[i][m] += tt;
            for(int i = tmpa;i >= 1;i -= a)
                num[i][tmpb] = -1e9;
        }
        puts("Yes");
        for(int i = 1;i <= n;i++)
        {
            for(int j = 1;j <= m;j++)
            {
                if(j == 1)
                    printf("%d", num[i][j]);
                else
                    printf(" %d", num[i][j]);
            }
            puts("");
        }
    }
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>

using namespace std;

int main() {
	long long k;
	cin >> k;
	long long x, y;
	if (k >= 50) {
		cout << 50 << endl;
		x = k / 50;
		y = k % 50;
		if (1 <= y) {
			cout << 49 + x + 51 - y;
		}
		else { cout << 49 + x - y; }
		for (int i = 2; i <= 50; i++) {
			if (i <= y) {
				cout << ' ' << 49 + x + 51 - y ;
			}
			else {
				cout << ' ' << 49 + x - y ;
			}
		}
	}
	else if(k!=0){
		cout << 50 << endl;
		cout << 50 * k;
		for (int i = 2; i <= 50; i++) {
			cout << ' ' << 0;
		}
	}
	else { cout << 2 << endl << 0 << ' ' << 0; }
	cout << endl;
}

Measured memory_bytes: 256
W = input()
Wcount = 0

while True:
    tmp = input()
    T = tmp.lower().split()

    for i in T :
        if (i == W):
            Wcount += 1

        else :
            continue

    # print(letterarray)

    if(tmp == "END_OF_TEXT"):
        break

print(Wcount)



Measured memory_bytes: 5552
n, m, x, y = map(int,input().split())
xl = list(map(int, input().split()))
xl.append(x)
xl.sort()
yl = list(map(int, input().split()))
yl.append(y)
yl.sort()

if xl[n] < yl[0]:
    print("No War")
else:
    print("War")


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
using namespace std;

#define rep(i, n) for (long long i = 0; i < (long long)(n); ++i)
using P = pair<long long, long long>;

long long H, W, K;
long long cc[30][30];
long long c[30][30];
long long ans = 0;

int main() {
  cin >> H >> W >> K;
  rep(i, H) {
    string s;
    cin >> s;
    rep(j, W) {
      cc[i][j] = s[j] - '0';
    }
  }

  long long temp = 0;

  rep(iii, H) {
    rep(jjj, W) {
      // if(iii != 3 || jjj != 0) continue;
      long long count = 1;
      temp = 0;
      rep(ii, H) {
        rep(jj, W) {
          c[ii][jj] = cc[ii][jj];
        }
      }
      if(iii == 0) {
        c[iii][jjj] = 0;
      } else {
        for(long long k = 1; k <= iii; k++) {
          swap(c[0][jjj], c[k][jjj]);
        }
        c[0][jjj] = 0;
      }

      while(true) {
        vector<pair<pair<long long, long long>, long long>> mem;
        rep(i, H) {
          rep(j, W) {
            if(c[i][j] == 0) continue;
            bool ff = false;
            long long M = max(K, W - j);
            if(K > W - j) continue;
            for(long long k = M; k >= K; k--) {
              bool f = true;
              rep(l, k-1) {
                if(c[i][j+l] != c[i][j+l+1]) {
                  f = false;
                }
              }
              if(f) {
                mem.push_back({{i, j}, k});
                temp += k * c[i][j] * count;
                ff = true;
              }
              if(ff) {
                j = j + k - 1;
                // cout << j << endl;
                break;
              }
            }
            if(ff) continue;
          }
        }

        if(mem.size() == 0) break;

        rep(i, mem.size()) {
          // cout << mem[i].first.first << " " << mem[i].first.second << " " << mem[i].second << endl;
          long long sx, sy, k;
          sx = mem[i].first.first;
          sy = mem[i].first.second;
          k = mem[i].second;
          if(sx == 0) {
            rep(j, k) {
              c[sx][sy+j] = 0;
            }
          } else {
            for(long long h = 1; h <= sx; h++) {
              rep(j, k) {
                swap(c[0][sy+j], c[h][sy+j]);
              }
            }
            rep(j, k) {
              c[0][sy+j] = 0;
            }
          }

        }

        count *= 2;
      }
      // cout << temp << endl;
      ans = max(ans, temp);
    }
  }

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

Measured memory_bytes: 3640
import sys

n = int(sys.stdin.readline())

m = list(map(int, sys.stdin.readline().split()))
for _ in range(n-1):
    _, a = sys.stdin.readline().split()
    m.append(int(a))

c = [[-1 for _ in range(n)] for _ in range(n)]

def val(a, b):
    if a==b: return 0
    if c[a][b]>0: return c[a][b]
    c[a][b]=val(a+1,b)+m[a-1]*m[a]*m[b]
    for k in range(a+1, b):
        v=val(a,k)+val(k+1,b)+m[a-1]*m[k]*m[b]
        if c[a][b]>v: c[a][b]=v
    return c[a][b]

print(val(0, n-1))


Measured memory_bytes: 5724
#include <iostream>
#include <map>
#include <string.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX_N 100001
using namespace std;

int main(void) {
  int N;
  cin >> N;
  map<int, int> mp;
  rep(i, N) {
    int A;
    cin >> A;
    mp[A]++;
  }
  int64_t Ans = 0;
  for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
    auto t = *itr;
    if (t.first > t.second) {
      Ans += t.second;
    } else if (t.first < t.second) {
      Ans += t.second - t.first;
    }
  }
  cout << Ans << endl;
  return 0;
}

Measured memory_bytes: 4736
#include<cstdio>
#include<algorithm>
const long long p=1000000007;
long long powof2(int n) {
	long long a[32], ans = 1;
	a[0] = 2;
	for (int i = 1; i < 32; i++)a[i] = (a[i - 1] * a[i - 1]) % p;
	for (int i = 0; i < 32; i++) {
		if ((n&(1 << i)) != 0)ans = (ans*a[i]) % p;
	}
	return ans;
}
int a[100000];
int main(){
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%d",&a[i]);
    std::sort(a,a+n);
    if(a[0]==0){
        for(int i=1;i<n;i++){
            if(a[i]!=((i+1)/2)*2){
                printf("0");
                return 0;
            }
        }
    }else{
        for(int i=0;i<n;i++){
            if(a[i]!=(i/2)*2+1){
                printf("0");
                return 0;
            }
        }
    }
    printf("%lld",powof2((a[0]==0)?(n/2):((n+1)/2)));
    return 0;
}

Measured memory_bytes: 512
#pragma GCC optimize("Ofast")
#include<stdio.h>
#include<algorithm>
using namespace std;
int num[1005];
int main(){
	int i,n,k;
	scanf("%d%d",&n,&k);
	for(i=0;i<n;i++)
		scanf("%d",&num[i]);
	sort(num,num+n);
	int ans=0;
	for(i=0;i<k;i++)
		ans+=num[i];
	printf("%d\n",ans);
}


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

using namespace std;

using ll = long long;

#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define SP cout<<fixed<<setprecision(10)

typedef pair<int, int> P;

const int INF = (int) 1e9;
const int MOD = (int) 1e9 + 7;

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

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

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

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

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n, a, b;
	cin >> n >> a >> b;
	double v[n];
	REP(i, n) cin >> v[i];
	
	sort(v, v + n);
	reverse(v, v + n);
	
	double sum = 0.0;
	REP(i, a) {
		sum += v[i];
	}
	double ave = sum / a;
	
	
	ll C[55][55];
	REP(i, n + 1) {
		REP(j, i + 1) {
			if (j == 0 || j == i) {
				C[i][j] = 1LL;
			} else {
				C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
			}
		}
	}
	
	int sameNumInN = 0, sameNumInA = 0;
	REP(i, n) {
		if (v[i] == v[a - 1]) {
			sameNumInN++;
			if (i < a) {
				sameNumInA++;
			}
		}
	}
	
	ll cnt = 0LL;
	if (sameNumInA == a) {
		FOR(i, a, b + 1) {
			cnt += C[sameNumInN][i];
		}
	} else {
		cnt += C[sameNumInN][sameNumInA];
	}
	
	SP;
	cout << ave << endl;
	cout << cnt << endl;
	
	return 0;
}

Measured memory_bytes: 384
#define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<vector>
#include<string>
#include<iostream>
#include<algorithm>
#include<map>
#include<iterator>
#include<set>
#include<stack>
#include<queue>
#include<fstream>
#include<iomanip>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include<cmath>
#include<list>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
using namespace std;


#define FOR(i,a,b) for(LL i = (a); i < (b); i++)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); i--)
#define ITER(it,a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a, value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

using namespace std;

const LL MOD = 1000000007;



int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	VI arr(n);
	
	FOR(i,0,n) {
	    cin >> arr[i];
	}
	int gcdall = arr[0];
	FOR(i,0,n) {
	    gcdall = __gcd(gcdall, arr[i]);
	}
	
	set<int> divs;
	bool pairwise = true;
	FOR(i,0,n) {
	    int x = arr[i];
	    FOR(j,2,sqrt(x)+1) {
	        if (x % j == 0) {
	            if (divs.find(j) == divs.end()) {
	                divs.insert(j);
	                while (x%j==0) {
	                    x/=j;
	                }
	            } else {
	                pairwise = false;
	                break;
	            }
	        }
	       
	    }
	    if (x > 1) {
	        if (divs.find(x) == divs.end()) {
	            divs.insert(x);
	        } else {
	            pairwise = false;
	        }
	    }
	     if (!pairwise) break;
	}
	if (pairwise) {
	    cout << "pairwise coprime" << endl;
	    return 0;
	}
	if (gcdall == 1) {
	    cout << "setwise coprime" << endl;
	    return 0;
	}
	cout << "not coprime" << endl;
	return 0;
}









Measured memory_bytes: 7308
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptor/reversed.hpp>
#include<boost/operators.hpp>
#include<boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;

std::int64_t run(boost::dynamic_bitset<> bit)
{
	std::int64_t ret = 0;
	std::int64_t target = 0;
	for (int i : boost::irange<std::int64_t>(0, bit.size()))
	{
		if (bit[i])
		{
			ret += i - target;
			++target;
		}
	}
	return ret;
}

void Main()
{
	std::string str;
	std::cin >> str;
	std::vector<boost::dynamic_bitset<>> vec;
	std::vector<int> pre;
	for (int i = 0; i < str.size(); ++i)
	{
		if (str[i] == 'A')
		{
			pre.emplace_back(0);
		}
		else if (str[i] == 'B' && i + 1 != str.size() && str[i + 1] == 'C')
		{
			pre.emplace_back(1);
			++i;
		}
		else
		{
			pre.emplace_back(2);
		}
	}
	vec.emplace_back();
	for (auto i : pre)
	{
		if (i == 2)
		{
			vec.emplace_back();
		}
		else
		{
			vec.back().push_back(i == 1);
		}
	}
	std::int64_t sum = 0;
	for (auto&& bit : vec)
	{
		sum += run(bit);
	}
	std::cout << sum << std::endl;
}

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

Measured memory_bytes: 10884
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int cmp_str(const void* a,const void* b)
{
  return strcmp(a,b);
}

int main(){

  int N;

  scanf("%d",&N);
  
  char str[N+1][11];
  
  for(int i=0;i<N;i++)
    scanf("%s",str[i]);
  
  qsort(str,N,sizeof(str[0]),cmp_str);
  
  int cnt=1;
  
  for(int i=0;i<N-1;i++)
  {
    if(strcmp(str[i],str[i+1])!=0)
      cnt++;
  }
  printf("%d",cnt);
}

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

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d ;
  int L=a+b,R=c+d;
  if (L==R){
    cout << "Balanced" << endl;
  }else 
    cout << (L<R ? "Right" :"Left") << endl;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define all(arr) arr.begin(), arr.end() 
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define ff first
#define ss second
#define pb push_back
#define debug(val) cerr << "The value of " << #val << " is = " << val << '\n';
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 0x3f3f3f3f;
const ll mininf = -922337203685477;
const ll nax = 0;
int n;

struct Points{
		int isi, posisi;
	};
Points arr[100005];

bool cmp(Points s1, Points s2){
		return s1.isi<s2.isi;
	}

int main(){
	IOS
	cin >> n;
	for(int i=1;i<=n;i++){
		cin >> arr[i].isi;
		arr[i].posisi=i;
	}
	sort(arr+1, arr+n+1, cmp);
	for(int i=1;i<=n;i++){
		cout << arr[i].posisi;
		if(i+1!=n+1){
			cout << " ";
		}
	}
	cout << endl;
}


Measured memory_bytes: 4392
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
using namespace std;
typedef double  dbl;
typedef long long int lld;
#define PI 3.14159265358979323
#define foi(i,n) for(i = 0; i < n; i+=1)
#define fod(i,n) for(i=n-1; i >=0; i-=1)
#define MAX std::numeric_limits<lld>::max()
#define MIN std::numeric_limits<lld>::min()
#define FastIO  ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
lld gcd_ (lld a, lld b)
{
	lld max = a > b ? a : b;
	lld min = a < b ? a : b;
	while (min != 0)
	{
		lld rem = max%min;
		max = min;
		min = rem;
	}
	return max;
}
int main ()
{
	FastIO
	lld a, b;
	cin >> a;
	cin >> b;
	lld x = gcd_(a, b);
	set <lld> prime;
	while (x%2==0)
	{
		x/=2;
		prime.insert(2);
	}
	for(lld i = 3; i <= sqrt(x); i+=2)
	{
		while (x%i ==0)
		{
			x/=i;
			prime.insert(i);
		}
	}
	if (x > 2)
		prime.insert(x);
	cout <<  prime.size()+1;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase


def main():
    k=int(input())
    l,r=map(int,input().split())
    l=(l-1)//k+1
    print("OK" if l*k<=r else "NG")

# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
# endregion

if __name__ == "__main__":
    main()

Measured memory_bytes: 62576
n = int(input())
p = list(map(int,input().split()))

answer = 0
m = 0
for i in range(n):
    if i == 0:
        answer += 1
        m = p[i]
        continue
    if p[i] <= m:
        answer += 1
        m = p[i]

print(answer)

Measured memory_bytes: 24744