akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<queue>
using namespace std;
const int MAXN = 200010;
typedef long long ll;
ll n, c, h[MAXN], q[MAXN], f[MAXN], g[MAXN], head, tail;
inline double K(int x, int y){return double(1.0*((g[x]-g[y])/(h[x]-h[y])));}
int main()
{
	scanf("%lld%lld",&n,&c);
	for(int i=1;i<=n;i++)
		scanf("%lld",&h[i]);
	f[1] = 0; g[1] = f[1]+1ll*h[1]*h[1];
	head = 1, tail = 0;
	q[++tail] = 1;
	for(int i=2;i<=n;i++)
	{
		//在转移过程中，队列中必须有一个元素进行转移 
		while(head<tail&&K(q[head],q[head+1])<(h[i]<<1))//如果从下标比当前队首大的元素转移会更优  
			head++;//则选用下一个比当前队首大的元素，即队列中排第二的元素 
		int j = q[head];
		f[i] = f[j]+1ll*(h[i]-h[j])*(h[i]-h[j])+c;
		g[i] = f[i]+1ll*h[i]*h[i];
		while(head<tail&&K(q[tail], i)<K(q[tail-1], q[tail]))//维护下凸壳的单调性
			tail--; 
		q[++tail] = i; 
	}
	printf("%lld\n",f[n]);
	return 0;
}

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

const long long MOD=1e9+7;

int n;
int a[100100];

int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    if(n%2==1){
        if(a[0]!=0){
            cout<<"0"<<endl;
            return 0;
        }
        for(int i=1;i<=n-2;i=i+2){
            if(a[i]!=i+1||a[i+1]!=i+1){
                cout<<"0"<<endl;
                return 0;
            }
        }
        
    }else{
        for(int i=0;i<=n-2;i=i+2){
            if(a[i]!=i+1||a[i+1]!=i+1){
                cout<<"0"<<endl;
                return 0;
            }
        }
    }
    long long ans=1;
    for(int i=0;i<(n/2);i++){
        ans*=(long long)2;
        ans%=MOD;
    }
    cout<<ans<<endl;
    return 0;
    
}





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

int main(){
    
    int N;
    cin >> N;
    
    vector<int> A;
    int a;
    long long S = 0;
    A.push_back(0);
    for(int i = 1; i <= N ; i++){
        cin >> a;
        A.push_back(a);
    }
    
    for(int i = 0; i <= A.size()-1 ; i++){
        S += abs(A[i+1]-A[i]);
    }
    A.push_back(0);
    long long sum = 0;
    
    // for(int i = 0; i < A.size();i++)cout << A[i];
    // cout << endl;
    for(int i = 0; i < N;i++){
        sum = 0;
        if(A[i]<=A[i+1]&&A[i+1]<=A[i+2]){
            cout << S << endl;
            continue;
        }
        if(A[i]>=A[i+1]&&A[i+1]>=A[i+2]){
            cout << S << endl;
            continue;
        }
        sum += abs(A[i] - A[i+1]) + abs(A[i+1] - A[i+2]) - abs(A[i] - A[i+2]);
        cout << S - sum << endl;
    }
    
   
}

    
    



Measured memory_bytes: 1784
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
typedef pair<int,int> P;

const int MOD=1000000007;
int INF=100100100100100;
map<int,int> ma;
int a[200010];
signed main(){
  int n;cin>>n;
  int ans=0;
  rep(i,n)cin>>a[i];
  sort(a,a+n);
  rep(i,n){
    if(ma[a[i]]==0){
      if(i==n-1 || (i<n-1 && a[i+1]!=a[i])){
        ans++;
        //cout<<a[i]<<endl;
      }
      for(int j=a[i];j<=1000010;j+=a[i])ma[j]=1;
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

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

  int x, y, z;
  cin >> x >> y >> z;
  cout << z << " " << x << " " << y << endl;
  return 0;
}

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

struct Query{ UL l,r,x,i; };
bool cmp_r(const Query& l,const Query& r){ return l.r>r.r; }

UL N,K,Q;
UL S[100000];
UL T[100000];
UL rT[100000];
UL A[100000][2];
vector<Query> Que[2][300];
UL L,R;
UL ans[100000];

void exe(UL l, UL r){
 for(int p=R; p<r; p++) swap(S[A[p][0]],S[A[p][1]]);
 for(int p=R; p>r; p--) swap(S[A[p-1][0]],S[A[p-1][1]]);
 for(int p=L; p<l; p++){
  swap(rT[T[A[p][0]]],rT[T[A[p][1]]]);
  swap(T[A[p][0]],T[A[p][1]]);
 }
 for(int p=L; p>l; p--){
  swap(rT[T[A[p-1][0]]],rT[T[A[p-1][1]]]);
  swap(T[A[p-1][0]],T[A[p-1][1]]);
 }
 L=l; R=r;
}

int main(){
 scanf("%u%u%u",&N,&K,&Q);
 L=R=0;
 rep(i,K) rep(j,2){ scanf("%u",&A[i][j]); A[i][j]--; }
 rep(q,Q){
  UL c,l,r,x; scanf("%u%u%u%u",&c,&l,&r,&x); c--; l--; x--;
  Que[c][l*300/K].push_back(Query{l,r,x,q});
 }
 rep(c,2) rep(i,300) sort(Que[c][i].begin(),Que[c][i].end(),cmp_r);
 rep(c,2){
  rep(i,N)S[i]=i;
  rep(i,N)T[i]=i;
  rep(i,N)rT[i]=i;
  L=R=0;
  rep(i,300){
   for(Query& q:Que[c][i]){
    if(c==0){
     exe(q.l,q.r);
     ans[q.i]=rT[S[q.x]]+1;
    }
    else {
     exe(q.r,q.l);
     ans[q.i]=rT[S[q.x]]+1;
    }
   }
  }
 }
 rep(i,Q) printf("%u\n",ans[i]);
 return 0;
}



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

int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
    default : return -1;
  }
}

int main(){
  string A,B;
  cin >> A >> B;
  int a=A.size();
  int b=B.size();
  if(a>b){
    cout << "GREATER" << endl;
    return 0;
  }
  if(a<b){
    cout << "LESS" << endl;
    return 0;
  }
  for(int i=0;i<a;i++){
    if(A.at(i)!=B.at(i)){
      if(ctoi(A.at(i))>ctoi(B.at(i))){
        cout << "GREATER" << endl;
        return 0;
      }
      if(ctoi(A.at(i))<ctoi(B.at(i))){
        cout << "LESS" << endl;
        return 0;
      }
    }
  }
  cout << "EQUAL" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define P pair<int,int>
#define PI 3.141592653589793
const int INF = 1001001001;
const ll MX = 1e18;
const int mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}



int main() {
	int n, x, t;
	cin >> n >> x >> t;
	if (n % x == 0)cout << (n / x) * t;
	else cout << (n / x + 1) * t;
}

Measured memory_bytes: 3632
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <climits> 
#include <assert.h>
#include <random>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1'000'000'007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
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; }
// ---------------------------------------------------------------------------



int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  int cnt = 0;
  for(int i=1; i<=N; i++){
    int a;
    cin >> a;
    if(i%2 && a%2) cnt++;
  }
  cout << cnt << "\n";
  return 0;
}

Measured memory_bytes: 3604
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
const ll mod=998244353;
const int MAXN=3e6+6;
ll ans,inv[MAXN],fac[MAXN],rfac[MAXN];
ll n,m,lim;
ll C(ll n,ll m){
	if (n<m) return 0;
	return fac[n]*rfac[m]%mod*rfac[n-m]%mod;
}
ll calc(ll n,ll M,ll m){
	ll ret=0;
	for (ll i=0;i<=m;i++){
		if ((M-i)%2==0){
			ret=(ret+C(n,i)*C((M-i)/2+n-1,n-1)%mod)%mod;
		}
	}
	return ret;
}
int main(){
	scanf("%lld%lld",&n,&m);
	lim=n+3*m; inv[1]=1;
	for (int i=2;i<=lim;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i])%mod;
	}
	fac[0]=rfac[0]=1;
	for (int i=1;i<=lim;i++){
		fac[i]=fac[i-1]*i%mod;
		rfac[i]=rfac[i-1]*inv[i]%mod;
	}
	ans=(calc(n,3*m,m)-n*(calc(n,m,m)-calc(n-1,m,m))%mod)%mod;
	printf("%lld\n",(ans+mod)%mod);
	return 0;
}


Measured memory_bytes: 63744
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define lli long long int
#define pii pair<int,int>
#define vii vector<pii>
#define pb push_back
#define eb emplace_back
#define em emplace
#define all(v)  v.begin(),v.end()
#define mod 1000000007
#define vi vector<int>
#define vl vector<lli>
#define vll vector<pair<lli,lli>>
#define pll pair<lli,lli>
#define vvi vector<vector<int>>
#define vvl vector<vector<lli>>
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define tk(args...) take(args);
#define posLSB(X) __builtin_ctz(X)
#define num1bit(X) __builtin_popcount(X)
#define numlead0(X) __builtin_clz(X)
#define umreserve(X) X.reserve(32768); X.max_load_factor(0.25);
void err(istream_iterator<string> it) {} template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cout << *it << " = " << a << "\n"; err(++it, args...);}
void take() {} template<typename T, typename... Args> void take( T & a, Args & ... args ) { cin>>a; take(args...); }
template<class T>
void printvec(vector<T> &a){
	for(T &x:a){
		cout<<x<<" ";
	}
	cout<<endl;
}
template<class T>
void printarr(T a[],lli n){
	for(lli i=0;i<n;i++){
		cout<<a[i]<<" ";
	}
	cout<<endl;
}
struct HASH{
  size_t operator()(const pair<int,int>&x)const{
    return (size_t) x.first * 37U + (size_t) x.second;
  }
};

#define endl "\n"

lli add(lli a, lli b) {
	a += b;
	if (a >= mod) a -= mod;
	return a;
}

lli mul(lli a, lli b) {
	return a * 1ll * b % mod;
}

inline bool setmin(lli &x, lli y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(lli &x, lli y) { return (y > x) ? x = y, 1 : 0; }

lli power_mod(lli a,lli x){if(x==0) return 1;lli y=power_mod(a,x/2);lli ans=(y*y)%mod; if(x%2) ans=(ans*a)%mod;return ans;}
lli inv(lli a){return power_mod(a,mod-2);}
lli power(lli a, lli x){ if(x==0) return 1; lli y= power(a,x/2); lli ans=(y*y); if(x%2) ans*=a; return ans;}
vector<lli> fact;
lli ncr(lli n, lli r){
	return mul(fact[n],inv(mul(fact[r],fact[n-r])));
}
lli sub(lli a, lli b){
	return (a-b+mod)%mod;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	lli h,w,n;
	cin>>h>>w>>n;
	fact.assign(h+w+1,1);
	for(int i=1;i<=h+w;i++){
		fact[i]=mul(i,fact[i-1]);
	}
	vector<pair<lli,lli>> a(n+1);
	for(lli i=0;i<n;i++){
		cin>>a[i].first>>a[i].second;
	}
	a[n]=mp(h,w);

	sort(all(a),[&](pair<lli,lli> x, pair<lli,lli> y){
		return x.first+x.second<y.first+y.second;
	});
	vector<lli> dp(n+1);
	for(lli i=0;i<=n;i++){
		dp[i] = ncr(a[i].first+a[i].second-2,a[i].first-1);
		for(lli j=0;j<i;j++){
			if(a[i].first>=a[j].first&&a[i].second>=a[j].second){
				dp[i]=sub(dp[i],mul(dp[j],ncr(a[i].first+a[i].second-(a[j].first+a[j].second),a[i].first-a[j].first)));
			}
		}
	}
	
	cout<<dp[n]<<endl;
}


Measured memory_bytes: 1920
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;

int main() {
    string s;
    cin >> s;

    char v = 'a';
    for(int i=0; i<26; i++){
        if(s.find(v) == -1) {
            cout << v << endl;
            return 0;
        }
        v++;
    }
    cout << "None" << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int n,flag=0;
   long long cnt=0;
   scanf("%d",&n);
   int a[n+1];
   for(int i=0;i<n;i++)scanf("%d",&a[i]);
   for(int i=n-1;i>=0;i--)
   {
       for(int j=i;j>=0;j--)
       {
           if(a[i]>=a[j])flag=1;
           else
           {
               flag=0;
               break;
           }
       }
       if(flag==1)++cnt;
   }
   printf("%lld\n",cnt);
}


Measured memory_bytes: 256
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

// reference: http://ir5.hatenablog.com/entry/20171209/1512821837

struct Scanner<'a> {
    cin: StdinLock<'a>,
}
 
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }
 
    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }
 
    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

use std::mem;

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let s: String = sc.read();
    println!("{}", "x".repeat(s.len()));
}

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

int isPrime (int x){
    if (x < 2) return 0;
    else if (x == 2) return 1;
    if (x % 2 == 0) return 0;
    for (int i = 3; i*i <= x; i+=2){
        if(x % i == 0)  return 0;
    }
    return 1;
}

int main() {
    int N, x, y = 0;
    cin >> N;
    for (int i = 0; i < N; i++){
        cin >> x;
        if(isPrime(x) == true) y++;
    }
    cout << y << endl;
    
    return 0;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif
    int n,k;
    cin >> n >> k;
    int x;
    for (int i=1; i<=n; i++) {
        int cur;
        cin >> cur;
        if (cur==1) x=cur;
    }
    int ans=0;
    if ((x-1)%(k-1)==0) ans+=(x-1)/(k-1);
    else ans+=(x-1)/(k-1) + 1;
    if ((n-x)%(k-1)==0) ans+=(n-x)/(k-1);
    else ans+=(n-x)/(k-1) + 1;
    cout << ans;
}


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

int main() {
  long N,D;
  cin>>N>>D;
  vector<long> x(N);
  vector<long> y(N);
  for(int i=0;i<N;i++) cin>>x[i]>>y[i];
  long ans=0;
  for(int i=0;i<N;i++){
    if(x[i]*x[i]+y[i]*y[i]<=D*D) ans++;
  }
cout<<ans<<endl;

}


Measured memory_bytes: 6360
IDENTIFICATION DIVISION.
       PROGRAM-ID. ABC045-A.
       DATA DIVISION.
       FILE SECTION.
       WORKING-STORAGE SECTION.
       77 A PIC 9(3).
       77 B PIC 9(3).
       77 H PIC 9(3).
       77 ANS PIC 9(5).
       77 ANSS PIC Z(5).

       PROCEDURE DIVISION.
       MAIN-PROCEDURE.
               ACCEPT A FROM SYSIN.
               ACCEPT B FROM SYSIN.
               ACCEPT H FROM SYSIN.
               COMPUTE ANS = (A + B) * H / 2.
               MOVE ANS TO ANSS.
               DISPLAY ANSS.
               STOP RUN.
       END PROGRAM ABC045-A.


Measured memory_bytes: 636
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);
        Minimization solver = new Minimization();
        solver.solve(1, in, out);
        out.close();
    }

    static class Minimization {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();

            if (n <= k) {
                out.println(1);
                return;
            }

            long result = 1;
            result += (n - k) / (k - 1);
            if ((n - k) % (k - 1) > 0) {
                result++;
            }
            out.println(result);

        }

    }
}



Measured memory_bytes: 35804
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
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; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,-1,1,1,-1};
int dy[]={0,1,0,-1,-1,-1,1,1};

vector<LL> pdivi(LL K){
    vector<LL> v;
    for(LL i=2;i*i<=K;i++){
        if(K%i) continue;
        v.pb(i);
        while(K%i==0){
            K/=i;
        }
    }
    if(K!=1) v.pb(K);
    return v;
}



int main(){
    LL n;cin >> n;
    auto p = pdivi(n);
    LL ans = 0;
    for (int i = 0; i < p.size(); i++) {
        LL pp = p[i];
        while(true){
            if(n % pp == 0){
                n /= pp;
                pp *= p[i];
                ans++;
            }
            else{
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
  int n,i,sp0,sp1;
  string s;
  cin >> n >> s;
  for (sp0=0;sp0<2;sp0++) for (sp1=0;sp1<2;sp1++){
    int sp[100010];
    sp[0]=sp0;
    sp[1]=sp1;
    for (i=1;i<=n;i++){
      if (sp[i]==1){
        if (s[i%n]=='o') sp[i+1]=sp[i-1];
        else sp[i+1]=1-sp[i-1];
      }else{
        if (s[i%n]=='o') sp[i+1]=1-sp[i-1];
        else sp[i+1]=sp[i-1];
      }
    }
    if (sp[0]==sp[n] && sp[1]==sp[n+1]){
      for (i=0;i<n;i++){
        if (sp[i]==1) cout << 'S';
        else cout << 'W';
      }
      cout << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 896
n=int(input())
a=list(map(int,input().split()))
b=list(map(abs,a))
n_m=0
for i in a:
    if i<0:
        n_m+=1
# print(n_m,b,sum(b),min(b))
if n_m%2==0:
    print(sum(b))
else:
    print(sum(b)-min(b)*2)

Measured memory_bytes: 14332
N = int(input())
loc = [[0,0,0]]
while True:
    try:
        loc.append(list(map(int, input().split(" "))))
    except:
        break

def can_travel(p1, p2):
    t = p2[0] - p1[0]
    x = abs(p1[1]-p2[1])
    y = abs(p1[2]-p2[2])
    if (t-x-y)>=0 and (t-x-y)%2 == 0:
        return True
    else:
        return False


for i in range(N):
    ans = can_travel(loc[i], loc[i+1])
    if ans==False:
        print("No")
        exit()

print("Yes")


Measured memory_bytes: 27332
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
using namespace std;

int main(){
    int n; cin >> n;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    int ans=1;
    int m=h[0];
    for(int i=1; i<n; i++){
        if(m<=h[i]) ans++;
        m=max(m,h[i]);
    }
    cout << ans << endl;
return 0;
}

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

int		main(void)
{
	int a, b;

	cin >> a >> b;
	if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0)
		cout << "Possible";
	else
		cout << "Impossible";
	cout << endl;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;

void koch(int N,double x1,double y1,double x5,double y5){//
	if(N==0){
		cout<<x1<<" "<<y1<<endl;
	}else{
		double x2=(x1*2+x5)/3;
		double y2=(y1*2+y5)/3;
		double x3=x2+cos(-M_PI/3)*(x2-x1)+sin(-M_PI/3)*(y2-y1);
		double y3=y2-sin(-M_PI/3)*(x2-x1)+cos(-M_PI/3)*(y2-y1);
		double x4=(x1+x5*2)/3;
		double y4=(y1+y5*2)/3;
		koch(N-1,x1,y1,x2,y2);
		koch(N-1,x2,y2,x3,y3);
		koch(N-1,x3,y3,x4,y4);
		koch(N-1,x4,y4,x5,y5);
	}
}

int main(void){
	int n;
	cin>>n;
	koch(n,0,0,100,0);
	cout<<100<<" "<<0<<endl;
	return 0;
}

Measured memory_bytes: 3196
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
using ll = long long;
int main(){
	string str;
	ll n;
	cin >> str;
	cin >> n;
	for(int i=0;i<str.size();i+=n){
		cout << str[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
n,k = map(int,input().split())
A = list(map(int,input().split()))
ex = [0]*n
now = 1
for i in range(k) :
    if i == k-1 :
        now = A[now-1]
        print(now)
        exit()
    elif ex[now-1] == 0 :
        ex[now-1] = i+1
        now = A[now-1]
    else :
        J = (k-i)%(i-ex[now-1]+1)
        for j in range(J) :
            now = A[now-1]
        print(now)
        exit()

Measured memory_bytes: 32212
/*{{{*/
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1<<20;
int main(){
    int h1,m1,h2,m2,k;
    R(h1,m1,h2,m2,k);
    W(max(0,(h2-h1)*60+m2-m1-k));
    return 0;
}


Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
#define INFL 0x3f3f3f3f3f3f3f3fLL
const ll mod = 1e9 + 7;
const int M = 2e6 + 5;
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll expo(ll base,ll pow){ll ans = 1LL;
   if(pow < 0) return 0;
   base %= mod;
   while(pow!=0){if(pow&1LL==1LL){ans = ans*base;ans = ans%mod;}
   base *= base;base%=mod;pow/=2LL;}return ans;}
ll inv(ll x){return expo(x,mod-2);}
ll mult_mod(ll a , ll b){a = a%mod; b = b%mod;ll c = (a * b)%mod;return c;}
ll add_mod(ll a , ll b){a = (a + mod)%mod;b = (b + mod)%mod;ll c = (a + b)%mod;return c;}
ll fac[(int)(2e6 + 7)] , inv_fac[(int)(2e6 + 7)];
void precomp_factorial(){fac[0] = 1;for(ll i = 1 ; i <= M ; i++) fac[i] = mult_mod(i , fac[i - 1]);
    inv_fac[M] = inv(fac[M]);for(ll i = M - 1 ; i >= 0 ; i--) inv_fac[i] = mult_mod(i + 1 , inv_fac[i + 1]);}
ll nCk(ll n , ll k){ll ans = fac[n];ans = mult_mod(ans , inv_fac[n - k]);ans = mult_mod(ans , inv_fac[k]);return ans;}
int dx[8] = {1 , 0 , -1 , 0 , 1 , -1 , -1 , 1};    // last 4 diagonal
int dy[8] = {0 , 1 , 0 , -1 , 1 , 1 , -1 , -1};

int main() {
   int n, m;
   cin >> n >> m;
   if(n < 10 && m < 10){
       cout << n*m;
   } else cout << -1;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define sz(x)             (int)((x).size())
#define int               long long
#define M                 1000000007
#define MM                998244353
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount

template<typename T1,typename T2>
std::istream& operator>>(std::istream& in,pair<T1,T2> &a)
{
	in>>a.fr>>a.sc;
	return in;
}
template<typename T1,typename T2>
std::ostream& operator<<(std::ostream& out,pair<T1,T2> &a)
{
	out<<a.fr<<" "<<a.sc;
	return out;
}
#ifdef demoralizer
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
int a[25][25];
int n;
int dp[21][1<<21];

int calc(int p,int m){
	// if(p==n) return 1;
	int &ans=dp[p][m];
	if(ans!=-1)return ans;
	ans=0;
	rep(i,0,n){
			// trace(p,m,i,(m&(1<<i) == 0),a[p][i]);
		if(a[p][i] && ((m&(1<<i)) == 0)){
			if(p==n-1){
				ans=1;
				break;
			}
			ans=(ans+calc(p+1,m^(1<<i)))%M;
		}
	}
	return ans;
}
void solve(){
	mem1(dp);
	cin>>n;
	rep(i,0,n){
		rep(j,0,n){
			cin>>a[i][j];
		}
	}
	cout<<calc(0,0);
}
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	#ifdef SEIVE
		seive();
	#endif
	#ifdef NCR
		init();
	#endif
	#ifdef DSU
		cleardsu(MAXDSUSIZE);
	#endif
	int t=1;
	//cin>>t;
	while(t--) solve();
	return 0;
}


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

int main()
{
  ll n;cin >> n;
  vector<ll> a;
  rep(i,n) {
    int tmp; cin >> tmp;
    a.push_back(tmp);
  }

  int ans = 0;
  bool can = true;
  while (can) {
    rep(i, a.size()) {
      if (a[i]%2 != 0) can = false;
    }
    if (can) ans++;
    else break;

    rep(i, a.size()) {
      a[i] /= 2;
    }
  }

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define Endl "\n"
#define endl "\n"
#define in(x) int x;cin>>x;
#define all(x) x.begin(),x.end()
#define fo(i,n) for(int i=0;i<n;i++)
#define take(a,n) vector<int> a(n);fo(i,n)cin>>a[i];
#define print(a) for(auto x:a)cout<<x<<" ";cout<<endl;
#define eb emplace_back
#define pii pair<int,int>


void fastio()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);cout.tie(0);
  #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
  #endif
}

void solve()
{
	int n,d;cin>>n>>d;
	int cnt=0;
	int x,y;
	for(int i=0;i<n;i++){cin>>x>>y;if(ceil(sqrt(x*x + y*y))<=d)cnt++;}
	cout<<cnt<<endl;
}

int32_t main()
{
    // fastio();
    
        solve();
    return 0;
}

Measured memory_bytes: 3672
import itertools
import sys
input = sys.stdin.readline

s = list(input().rstrip('\n'))
s.sort()
gr = itertools.groupby(s)
ks = []
gs = []

for k, g in gr:
    ks.append(k)
    gs.append(len(list(g)))

if len(ks) == 2 and gs.count(2) == 2:
    print('Yes')
else:
    print('No')


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

int main(){
    int x,y,z;
    cin>>x>>y>>z;
    x=x-2*z;
    if(x<=0)cout<<0;
    else{
        int count=0;
        while(x>0){
            x=x-y;
            if(x>=0)count++;
            else break;
            x-=z;
        }
        cout<<count;
    }
}


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

const int mod = 1e9+7;
const int N = 10000003;
int prime[N];
unordered_map <ll, ll> max_map;

ll power(ll x, ll y){
	x %= mod;
	if(y == 0) return 1;
	if(y == 1) return x;
	ll num = power(x,y/2) % mod;
	if(y%2 ==  0) return (num*num)%mod;
	else return (((num*num)%mod)*x)%mod;
}

void solve(){
 	
 	int n;
 	cin >> n;
 	string s,t;
 	cin >> s >> t;
 	string ans = "";
 	rep0(i,n){
 		ans += s[i];
 		ans += t[i];
 	}
 	cout << ans;

	return;
}


int main(){

	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	int TC = 1,t = 0;
	// cin >> TC;
	while(t++ < TC){
		solve();
		// cout << "\n";
	}

	// cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";

	return 0; 
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner scn=new Scanner(System.in);
        int n=scn.nextInt();
        int d=scn.nextInt();
        int x=scn.nextInt();
        int sum=0;
        for (int i = 0; i < n; i++) {
            sum+=(d-1)/scn.nextInt()+1;
        }
        System.out.println(sum+x);
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
using namespace std;
using ll = long long;
 
int main() {
    ll X, K, D;
    cin >> X >> K >> D;
    X = abs(X);
 
    ll straight = min(K, X / D);
    K -= straight;
    X -= straight * D;
 
    if (K % 2 == 0) {
        cout << X << endl;
    } else {
        cout << D - X << endl;
    }
 
    return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
#define INF 1000000007
using namespace std;
int a,b,c;
string s;
signed main()
{
	cin>>a>>b>>c;
	if(b+c-a<0){
		cout<<0;
	}else{
		cout<<b+c-a;
	}
}

Measured memory_bytes: 256
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];
		for(int i=0;i<N;i++){
			A[i] = sc.nextInt();
		}
		selectionSort(A,N);
	}
	public static void selectionSort(int[] A,int N){
		int count=0;
		for(int i=0;i<N;i++){
			int minj=i;
			for(int j=i;j<N;j++){
				if(A[j]<A[minj])minj=j;
			}
			if(i!=minj){
				int c = A[i];
				A[i] = A[minj];
				A[minj] = c;
				count++;
			}
		}

		for(int i=0;i<N;i++){
			System.out.print(A[i]);
			if(i!=N-1)System.out.print(" ");
		}
		System.out.printf("\n%d\n",count);
	}
}


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

using namespace std;

const int maxn = 1e6 + 10;

struct Node {
    int day, money;
}p[maxn];

bool cmp(Node a, Node b) {
    return a.day < b.day;
}


int main() {
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < n; ++i) {
        cin >> p[i].day >> p[i].money;
    }
    sort(p, p + n, cmp);
    priority_queue<int> que;
    int ans = 0;
    int pos = 0;
    for (int i = 1; i <= m; ++i) {
        while (p[pos].day <= i && pos < n) {
            que.push(p[pos++].money);
        }
        if (!que.empty()) {
            ans += que.top();
            que.pop();
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1660
#include<bits/stdc++.h>
typedef long long int LL;
typedef unsigned long long int ULL; 
typedef long double dd; 
#define endl "\n"
int dx[4]={1,-1,0,0};
int dy[4]={0,0,-1,1};
LL dp[2000001];
LL mod=1e9+7;
bool vis[100000];
using namespace std;
bool isPrime(LL n) {
  LL j; 
  for( j=2;j<=sqrt(n);j++){
    if(n%j==0){
      break;  
    } 
  }
  if(j>sqrt(n)){
    return 1; 
  }
  else{
    return 0; }
}
LL modexpo(LL a, LL b) {
  LL ans=1;
  a=a%mod;
  while(b>0){
    if((b&1)==1){
      ans=((ans%mod)*(a%mod))%mod;
    }
    b=b>>1;
    a=((a%mod)*(a%mod))%mod;
  }
  return ans; 
}
LL invmod(LL n){
  return modexpo(n,mod-2);
}
LL comb(LL n,LL r){
  if(r==0){
    return 1;
  }
  LL fact[n+1];
  fact[0] = 1; 
    for (LL i = 1; i <= n; i++){
       fact[i] = (fact[i - 1] * i) %mod;}
    return (fact[n] * invmod(fact[r]) % mod * invmod(fact[n - r]) % mod) %mod; 
}
LL facto(LL n) {
   LL fact[n+1];
  fact[0] = 1; 
    for (LL i = 1; i <= n; i++){
       fact[i] = (fact[i - 1] * i) %mod;}
       return fact[n];
}
LL gcd(LL a, LL b) {
  if (a == 0){
       return b;
       }  
    return gcd(b % a, a);  

}
LL lcm(LL a, LL b) {
  return (a*b)/gcd(a,b);
}
void solve(LL k){
LL a,b,c,d;
cin>>a>>b>>c>>d; 
LL f=max(a,b);
LL g=min(a,b);
LL h=max(c,d);
LL i=min(c,d);
LL ans=-1000000000000000000;
ans=max(ans,f*h);
ans=max(ans,g*i);
ans=max(ans,f*i);
ans=max(ans,g*h);
cout<<ans<<endl; 
}
int main(){
  ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 LL t=1;
//cin>>t;
 LL k=1;
while(k<=t){
   solve(k);
  k++;
  }
   return 0;
   }

Measured memory_bytes: 3656
import java.util.Scanner;
class Main{
  public static void main(String args[]){
    Scanner scan=new Scanner(System.in);
    int n=scan.nextInt();
    int m=scan.nextInt();
    int like[]=new int[m];
    int k;
    
    //reset
    for(int j=0;j<m;j++){
      like[j]=0;
    }
    for(int i=0;i<n;i++){
      k=scan.nextInt();
      for(int j=0;j<k;j++){
        like[scan.nextInt()-1]+=1;
      }
    }
    
    int count=0;
    for(int j=0;j<m;j++){
      if(like[j]==n) count+=1;
    }
    System.out.println(count);
  }
}


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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using Graph = vector<vector<int>>;

int main(){
    double pi = 3.141592653589793;
    int A,B,H,M; cin>>A>>B>>H>>M;
    double a = H*30+30.0*M/60.0;
    double b = 6*M;
    double c = min(fabs(a-b),360-fabs(a-b));
    
    c = 2.0*pi*c/360;
    
    double res = A*A + B*B - 2*A*B*cos(c);
    cout<<setprecision(30)<<sqrt(res)<<endl;
}


Measured memory_bytes: 4192
while True:
    a,b,c = input().split()
    a = int(a)
    c = int(c)
    if b == "+":
        print(a+c)
    if b == "-":
        print(a-c)
    if b == "*":
        print(a*c)
    if b == "/":
        print(a//c)
    if b == "?":
        break
    


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

int main(){
  while(1){
    string str;
    getline(cin, str);
    if (str == "-") break;
    int m, h;
    cin >> m; 
    for (int i=0;i<m;i++){
      cin >> h;
      str = str.substr(h) + str.substr(0,h);
//      cout << str << endl;
    }
    cout << str << endl;
    cin.ignore(); // cin の後にgetlineを使う時は、改行文字後にカーソルをあわせる
  }
  return 0;
}




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

using namespace std;

int main()
{
    int n;

    cin>>n;
    int cnt=0;
    int a[n];
    for(int i=0; i<n; i++)cin>>a[i];
    sort(a,a+n);

    for(int i=0; i<n; i++)
        for(int j=i+1; j<n; j++)
        {
            if(a[i]!=a[j])
            {
                int be=(upper_bound(a+j,a+n,a[j])-a);
                int ed=(upper_bound(a+j,a+n,a[i]+a[j]))-a;
                if(ed==n)ed--;
                while(a[ed]>=a[i]+a[j])ed--;
                if(ed>=n||be>=n) break;

                //cout<<i<<" "<<j<<" a[i] "<<a[i]<<" a[j]:"<<a[j]<<" be: "<<be<<" ed: "<<ed<<" a[be]: "<< a[be]<<"a[ed]: "<< a[ed]<<endl;
                cnt+=ed-be+1;

            }
        }
    cout<<cnt;
    return 0;
}


Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string str = Console.ReadLine();
		if(str.Substring(str.Length-1,1)=="s"){
			str += "es";
		} else {
			str += "s";
		}
		Console.WriteLine(str);
	}
}

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

bool is_prime(ll n) {
	if (n <= 1) return false;
	else {
		ll m = ll(sqrt(n));
		for(ll i=2;i<=m;i++) {
			if (n % i == 0) return false;
		}
		return true;
	}
}

int main() {
	ll x;
	cin >> x;
	ll ans = x;
	while(1) {
		bool is_p = is_prime(ans);
		if (is_p) break;
		ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int s[105];
int main()
{
	int a,n,i,j,c=0,m;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&s[i]);
		a=s[i]-1;
		c=c+a*a;
		
	}
	for(j=2;j<=100;j++)
	{
		m=0;
		for(i=0;i<n;i++)
		{
		a=s[i]-j;
		m=m+a*a;	
		}
		if(m<c)
		c=m;	
	}
	printf("%d",c);	
	return 0;
}

Measured memory_bytes: 128
n,m = map(int,input().split())
a = [input() for i in range(n)]
b = [input() for i in range(m)]
x = y = 0

def check(x,y):
  for i in range(m):
    if b[i] != a[y+i][x:x+m]:
      return(False)
  return(True)

for x in range(n-m+1):
  for y in range(n-m+1):
    if check(x,y):
      print("Yes")
      exit()
print("No") 

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }
ll mod = 1000000007;
ll modsize;

ll modinv(ll a) {
	ll b = mod, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= mod;
	if (u < 0) u += mod;
	return u;
}

ll modpow(ll a, ll b) {
	ll ans = 1;
	a %= mod;
	while (b) {
		if (b & 1) ans = ans * a%mod;
		a = a * a%mod;
		b >>= 1;
	}
	return ans;
}

vector<ll> fac(modsize + 5);
vector<ll> inv(modsize + 5);
vector<ll> facinv(modsize + 5);

void modcalc() {
	fac[0] = fac[1] = 1; inv[1] = 1;
	facinv[0] = facinv[1] = 1;
	for (int i = 2; i < modsize; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod%i] * (mod / i) % mod;
		facinv[i] = facinv[i - 1] * inv[i] % mod;
	}
}

ll modcomb(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[k] % mod * facinv[n - k] % mod;
}

ll modperm(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[n - k] % mod;
}

ll modhom(ll n, ll k) {
	if (n < 0 || k < 0) return 0;
	if (n == 0 && k == 0) return 1;
	return modcomb(n + k - 1, k);
}

template<class T>
class segtree {
	int n;
	vector<T> data;
	T def;
	function<T(T, T)> operation;
	function<T(T, T)> update;
	T _query(int a, int b, int k, int l, int r) {
		if (r <= a || b <= l) return def;
		if (a <= l && r <= b) return data[k];
		T c1 = _query(a, b, 2 * k + 1, l, (l + r) / 2);
		T c2 = _query(a, b, 2 * k + 2, (l + r) / 2, r);
		return operation(c1, c2);
	}
public:
	segtree(size_t _n, T _def, function<T(T, T)> _operation, function<T(T, T)> _update)
		:def(_def), operation(_operation), update(_update) {
		n = 1;
		while (n < _n) {
			n *= 2;
		}
		data = vector<T>(2 * n - 1, def);
	}
	void change(int i, T x) {
		i += n - 1;
		data[i] = update(data[i], x);
		while (i > 0) {
			i = (i - 1) / 2;
			data[i] = operation(data[i * 2 + 1], data[i * 2 + 2]);
		}
	}
	T query(int a, int b) {
		return _query(a, b, 0, 0, n);
	}
	T operator[](int i) {
		return data[i + n - 1];
	}
};

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

	int n, r;
	cin >> n >> r;
	if (n >= 10) cout << r << endl;
	else cout << r + 100 * (10 - n) << endl;
}

Measured memory_bytes: 256
#
# abc054 a
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """8 6"""
        output = """Alice"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """1 1"""
        output = """Draw"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """13 1"""
        output = """Bob"""
        self.assertIO(input, output)


def resolve():
    A, B = map(int, input().split())
    if A == 1:
        A = 14
    if B == 1:
        B = 14

    if A > B:
        print("Alice")
    elif A < B:
        print("Bob")
    else:
        print("Draw")


if __name__ == "__main__":
    # unittest.main()
    resolve()


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

int main() {
    string S;
    cin >> S;
    if(S=="zyxwvutsrqponmlkjihgfedcba"){
        cout <<-1<<endl;
        return 0;
    }
    vector<bool> used(26,false);
    for(int i=0;i<S.size();i++){
        used[S[i]-'a'] = true;
    }
    for(int i=0;i<26;i++){
        if(!used[i]){
            char s = 'a' +i;
            cout << S+s << endl;
            return 0;
        }
    }
    
    for(int i=S.size()-2;i>=0;--i){
        if(S[i] < S[i+1]){
            int lastNum =26;
            for(int j=S.size()-1;j>i;--j){
                if(S[i] < S[j]){
                    lastNum = min(lastNum,S[j]-'a');
                }
            }
            string ans="";
            for(int j=0;j<i;j++){
                ans += S[j];
            }
            char s = 'a'+lastNum;
            ans += s;
            cout << ans << endl;
            return 0;
        }
    }
    return 0;
}

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

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

    if (D == 0)
    {
        if (X == 0)
        {
            cout << 1 << endl;
        }
        else
        {
            cout << N + 1 << endl;
        }
        return 0;
    }
    if (D < 0)
    {
        D *= -1;
        X *= -1;
    }

    map<long long, set<pair<long long, long long>>> count;
    for (long long i = 0; i <= N; i++)
    {
        long long idx = ((X % D) * (i % D)) % D;
        while (idx < 0)
        {
            idx += D;
        }
        long long offset = X * i / D;
        long long maximum = (N * (N - 1) / 2) - (N - i) * (N - i - 1) / 2;
        long long minimum = i * (i - 1) / 2;
        count[idx].insert(make_pair(minimum + offset, maximum + offset));
    }
    long long ans = 0;
    for (auto c : count)
    {
        long long minimum = LONG_LONG_MIN;
        for (auto p : c.second)
        {
            long long maximum = max(minimum, p.second);
            minimum = max(minimum + 1, p.first);
            ans += max(0ll, maximum - minimum + 1);
            minimum = maximum;
        }
    }
    cout << ans << endl;
}


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

#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(),(x).end()
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;

signed main(){
    string s;
    cin >> s;
    int n = s.size();
    n--;
    bool flg = true;
    for(int i=n-1;i>=0;i--){
        if(i % 2 == 0) continue;
        flg = true;
        for(int j=0;j<(i+2-1)/2;j++){
            if(s[j] != s[(i+2-1)/2+j]){
                flg = false;
                break;
            }
        }
        if(flg){
            cout << i+1 << '\n';
            break;
        }
    }   

    return 0;
}


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

using namespace std;

const int mod = 1e9+7, nax = 1e5+7;
int steps[nax], a[nax];
int main(){
 int N, M;
 cin >> N >> M;
 for(int i=0; i<M; ++i){
    int x; cin >> x;
    a[x] = 1;
 }
 steps[0] = 1;
 for(int i=1; i<=N; ++i){
    steps[i] = (steps[i-1]%mod + steps[i-2]%mod)%mod;
    if(a[i])
      steps[i] = 0;
 }
 //for(int i=1; i<=N; ++i)
   //cout << "i: " << i << " steps[i]: " << steps[i] << "\n";
 cout << steps[N] << "\n";
 return 0; 
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <math.h>

int main()
{
	double height, width, depth, tmp;
	double r, r1, r2, r3;
	int  n;
	while ( scanf( "%lf %lf %lf", &depth, &width, &height ) == 3 ){
		if ( depth == 0 && width == 0 && height == 0 ) { break; }	

		scanf( "%d", &n );
		for ( int i = 0 ; i < n ; i++ ) {
			scanf( "%lf", &r );
			r1 = sqrt( (depth/2)*(depth/2) + (height/2)*(height/2) );
			r2 = sqrt( (width/2)*(width/2) + (height/2)*(height/2) );
			r3 = sqrt( (width/2)*(width/2) + (depth/2)*(depth/2) );

			if ( r1 < r || r2 < r || r3 < r ) {
				printf( "OK\n" );
			} else {
				printf( "NA\n" );
			}
		}
	}

	return 0;
}



Measured memory_bytes: 1984
N = int(input())
reds = [list(map(int, input().split())) for i in range(N)]
blues = [list(map(int, input().split())) for i in range(N)]
reds.sort(key=lambda x: x[0], reverse=True)
blues.sort(key=lambda x: x[1])
red_used = []
blue_used = []

for red in reds:
    for blue in blues:
        if red in red_used or blue in blue_used:
            continue
        if red[0] < blue[0] and red[1] < blue[1]:
            red_used.append(red)
            blue_used.append(blue)

print(len(blue_used))


Measured memory_bytes: 3064