akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<55)+1e9; // ~ 3.6 * 1e16
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
using T = tuple<Int,Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> &a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
template<class T>void prArr(T a,string s=" "){Int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}

class Combination{
public:
  typedef long long ll;
  ll N;
  ll mod;
  vector<ll> fac;
  vector<ll> finv;
  vector<ll> inv;
  
  
  Combination(ll N = 1e6,ll mod = 1e9 + 7): N(N), mod(mod), fac(N+1), finv(N+1), inv(N+1){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(Int i = 2; i <= N; i++){
      fac[i] = fac[i-1] * i % mod;
      inv[i] = mod - inv[mod%i] * (mod / i) % mod;
      finv[i] = finv[i-1] * inv[i] % mod;
    }
  }

  function<ll(ll,ll)> get = [&](ll n,ll r){
    if( n < r ) return 0LL;
    if( n < 0 || r < 0) return 0LL;
    return fac[n] * (finv[r] * finv[n-r] % mod) % mod;
  };
};
auto nCr = (new Combination())->get;

map<Int,Int> primeFactor(Int num){
  map<Int,Int> res;
  for(Int i=2;i<100000;i++){
    while(num % i == 0) res[i]++, num/=i;
  }
  if(num != 1) res[num]++;
  return res;
}

signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int N, M;
  cin>>N>>M;

  auto num = primeFactor(M);
  Int ans = 1;
  for(auto p:num){
    Int len = p.second;
    ans = ans * nCr(len + N-1, N-1) % mod;
  }

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


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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;
#define NODE 111111

int main(){
	int n,m;cin >> n >> m;
	ll now = 0;
	REP(i,n-1){
		//cout << now << endl;
		ll tmp = now / m;
		ll hoge = tmp;
		do{
			tmp = hoge;
			ll seica = now + (tmp+1);
			hoge = seica / m;
		}while(tmp != hoge);
		now += (tmp+1);
	}
	
	cout << now << endl;
			
	/*
	int n;cin >> n;
	vector<int> v(NODE);
	vector<int> ans;
	REP(i,NODE)v[i] = i;
	while(v.size() > 0){
		ans.PB(v[0]);
		vector<int> tmp;
		REP(i,v.size()){
			if(i % n == 0)continue;
			tmp.PB(v[i]);
		}
		v = tmp;
	}
	
	REP(i,ans.size()){
		cout << ans[i];
		if(i > 0)cout << ' ' << ans[i] - ans[i-1];
		if(i > 1)cout << ' ' << ans[i] - ans[i-2];
		cout << endl;
	}
	*/
	return 0;
}


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

int main() {
  int n;
  string s, t, a = "";
  cin >> n >> s >> t;
  for(int i = 0; i < n; ++i){
    a += s.at(i);
    a += t.at(i);
  }
  cout << a << endl;
}

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

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

    int start = -k+1+x;
    int stop  = k-1+x;

    for (int i=start; i<=stop; i++) {
        cout << i << " ";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int a[5], k = 0, min = 10, ans = 0;
  scanf("%d", a);
  scanf("%d", a+1);
  scanf("%d", a+2);
  scanf("%d", a+3);
  scanf("%d", a+4);
  for (int i = 0; i < 5; i++) {
    int f = (a[i]-1)%10 + 1;
    if (f < min) {
      min = f;
      k = i;
    }
  }
  for (int i = 0; i < 5; i++) {
    if (i == k) {
      ans += a[i];
    }else {
      ans += (((a[i] - 1) / 10) + 1) * 10;
    }
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
import numpy as np

a,b=map(int, input().split())  #複数数値入力
x = 0
if a >= b:
    x += a
    a = a - 1
else:
    x += b
    b = b - 1

if a >= b:
    x += a
    a = a - 1
else:
    x += b
    b = b - 1 
print(x)

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

int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    int x=1;
    int ans =0;
    for(int i=0;i<n;i++)
    {
        if( a[i] == x)
        {
            x++;
        }
        else ans++;
    }
    if( ans == n)
        cout<<-1;
    else cout <<ans;
}

Measured memory_bytes: 4416
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

// original: https://qiita.com/keymoon/items/11fac5627672a6d6a9f6
class RollingHash {
  private:
    using ulint                        = unsigned long long;
    static constexpr ulint mask30      = (1ULL << 30) - 1;
    static constexpr ulint mask31      = (1ULL << 31) - 1;
    static constexpr ulint mod         = (1ULL << 61) - 1;
    static constexpr ulint positivizer = mod * ((1ULL << 3) - 1);
    static constexpr unsigned int base = 1033;
    int len;
    std::vector<ulint> pow_b, hash;
    static ulint mul(ulint l, ulint r) {
        const ulint lu        = l >> 31;
        const ulint ld        = l & mask31;
        const ulint ru        = r >> 31;
        const ulint rd        = r & mask31;
        const ulint middleBit = ld * ru + lu * rd;
        return ((lu * ru) << 1) + ld * rd + ((middleBit & mask30) << 31) + (middleBit >> 30);
    }
    static ulint calcMod(ulint val) {
        val = (val & mod) + (val >> 61);
        if (val > mod)
            val -= mod;
        return val;
    }

  public:
    template <typename T>
    RollingHash(const T &s) : len(s.size()), pow_b(s.size() + 1), hash(s.size() + 1) {
        pow_b[0] = 1;
        hash[0]  = 1;
        for (int i = 0; i < len; ++i) {
            pow_b[i + 1] = calcMod(mul(pow_b[i], base));
            hash[i + 1]  = calcMod(mul(hash[i], base) + s[i]);
        }
    }
    // hash for [l, r)
    ulint get(int l, int r) const { return calcMod(hash[r] + positivizer - mul(hash[l], pow_b[r - l])); }
    // length of longest common prefix
    int lcp(const RollingHash &rhs, int l1, int r1, int l2, int r2) const {
        int lb = 0, ub = std::min(r1 - l1, r2 - l2) + 1;
        while (ub - lb > 1) {
            const int md                                         = (lb + ub) >> 1;
            (get(l1, l1 + md) == rhs.get(l2, l2 + md) ? lb : ub) = md;
        }
        return lb;
    }
};

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    RollingHash rh(s);
    int maxLen = 0;
    for (int i = 0; i < s.size(); ++i) {
        for (int j = i; j < s.size(); ++j) {
            while (maxLen < j - i && j + maxLen < n && rh.get(i, i + maxLen + 1) == rh.get(j, j + maxLen + 1))
                maxLen++;
        }
    }
    cout << maxLen << "\n";
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <numeric>
#include <limits>
#include <cmath>
#include <iomanip>
#include <sstream>
 
#define ALL(a)  (a).begin(),(a).end()
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
 
int main() {
    ll ans = 0;

    ll n;
    cin >> n;

    vector<P> w;
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        w.push_back(make_pair(b, a));
    }

    sort(ALL(w), greater<P>());

    ll t = w[0].first;

    for (int i = 0; i < n; i++) {
        t -= w[i].second;
        if (i < n-1 && t > w[i+1].first) t = w[i+1].first;
        if (t < 0) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 2548
n = int(input())
A = tuple(map(int, input().split()))
maxa = max(A)
cnt = [0] * (maxa + 1)
for a in A:
    cnt[a] += 1

from math import gcd
from functools import reduce
if reduce(gcd, A) != 1:
    print('not coprime')
else:
    for i in range(2, maxa+1):
        if sum(cnt[i::i]) > 1:
            print('setwise coprime')
            break
    else:
        print('pairwise coprime')


Measured memory_bytes: 224668
def main():
  import sys
  n=int(input())
  a=tuple(map(int,sys.stdin.readline().split()))
  b=[0]*n
  i=1
  for index in a:
    b[index-1]=str(i)
    i+=1
  print(" ".join(b))
if __name__=="__main__":
  main()

Measured memory_bytes: 15528
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
int a,b;
int main(){
    scanf("%d%d",&a,&b);
    if(a>0&&b>0)puts("Positive");
    else if(max(a,b)>=0&&min(a,b)<=0)puts("Zero");
    else if((abs(max(a,b))-abs(min(a,b)))%2==0)puts("Negative");
    else puts("Positive");
    return 0;
}

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


int main() {
    int n,m;
    cin>>n>>m;
    vector<int> a(n);
    float sum=0;
    rep(i,n){
        cin>>a[i];
        sum+=a[i];
    }
    sum = sum/(4*m);
    sort(a.begin(),a.end());
    int cnt=0;
    rep(i,m){
        if(a[n-1-i]>=sum){cnt++;};
    }
    if(cnt==m){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }


    return 0;
}



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

int main() {

    ll N, M, K;
    cin >> N >> M >> K;

    vl A(N+1), B(M+1);
    ll a, b;
    A[0] = 0;
    B[0] = 0;
    rep(i, N) {
        cin >> a;
        A[i+1] = A[i] + a;
    }
    rep(i, M) {
        cin >> b;
        B[i+1] = B[i] + b;
    }

    int max_num = 0;
    rep(i, N+1) {
        if (A[i] > K) continue;
        auto itr = lower_bound(B.begin(), B.end(), K-A[i]);
        int d = distance(B.begin(), itr);
        while (d > M) d--;
        while (A[i] + B[d] > K) {
            d--;
        }
        // cout << i << " " << d << endl;
        max_num = max(max_num, i+d);
    }

    cout << max_num << endl;

    return 0;
}


Measured memory_bytes: 6364
#include<stdio.h>
int main(){
  int suuretu[100],N,a,kaisuu;
  scanf("%d",&N);
  for(a=0;a<N;a++)scanf("%d",&suuretu[a]);

  kaisuu=selectionSort(suuretu,N);
  for(a=0;a<N;a++){
    if(a>0)printf(" ");
      printf("%d",suuretu[a]);
  }
  printf("\n");
  printf("%d\n",kaisuu);
  return 0;
}
int selectionSort(int suuretu[],int N){
  int a,b,c,kaisuu=0,minj;
  for(a=0;a<N-1;a++){
    minj=a;
    for(b=a;b<N;b++){
      if(suuretu[b]<suuretu[minj])minj=b;
    }
    c=suuretu[a];
    suuretu[a]=suuretu[minj];
    suuretu[minj]=c;
    if(a!=minj)kaisuu++;
  }
  return kaisuu;
  
}

Measured memory_bytes: 604
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

const int INF = 1e9+7;

main()
{
    fast;
    int n,i,j;
    cin>>n;
    ll h[n],ans[n];
    memset(ans,INF,sizeof(ans));
    ans[0]=0;
    for (i=0;i<n;i++)
    {
        cin>>h[i];
        for (j=i-1;j>=max(i-2,0);j--)
            ans[i]=min(ans[i],ans[j]+abs(h[i]-h[j]));
    }
    cout<<ans[n-1]<<endl;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner (System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		sc.close();
		
		String hikaku;
		if(a < b) {
			hikaku = "<";
		} else if(a > b) {
			hikaku = ">";
		} else {
			hikaku = "==";
		}
		
		System.out.println("a " + hikaku + " b");
		
	}

}

Measured memory_bytes: 26284
#include<bits/stdc++.h>
using namespace std;
#define ll long long
void solve(){
    int n, W; cin >> n >> W;
    vector<ll> dp(W+1, 0);

    for(int i = 0; i < n; i++){
        ll w, v; cin >> w >> v;

        for(int j = W; j >= 0; j--){
            if(j+w <= W){
                dp[j+w] = max(dp[j+w], dp[j]+v);
            }
        }
    }
    ll ans = 0;
    for(int i = 0; i <= W; i++){
        // cout << dp[i] << " ";
        ans = max(ans, dp[i]);
    }
    // cout << endl;

    cout << ans << endl;
}

int main(){
    int t;// cin >> t;
    t = 1;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 1024
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

bool f[100010];
ll c[100010];

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

	ll Q;
	
	cin >> Q;

	for (int i = 2; i <= 100000; i++)
	{
		if (!f[i])
		{
			for(int j = i+i; j <= 100000; j+=i)
			{
				f[j] = true;
			}
		}
		
	}

	for (int i = 3; i <= 100000; i+=2)
	{
		if (!f[i] && !f[(i+1) / 2])
		{
			c[i]++;
		}
	}

	for (int i = 3; i <= 100000; i++)
	{
		c[i] += c[i-1];
	}

	rep(i, Q)
	{
		ll l , r;
		cin >> l >> r;
		cout << c[r] - c[l-1] << endl;
	}


	
	return 0;
}


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

string S;

int main() {
	cin >> S;
	int SS = S.size(), SSS[26] = {};
	for (int i = 0; i < SS; ++i) {
		++SSS[S[i] - 97];
		if (SSS[S[i] - 97] > 1) {
			cout << "no";
			return 0;
		}
	}
	cout << "yes";
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		String line;
		int[] c = new int[] { 0, 0, 0, 0 };
		while ((line = bf.readLine()) != null) {
			String[] s = line.split(",");
			if (s.length != 2)
				break;
			if (s[1].equals("A")) {
				c[0]++;
			} else if (s[1].equals("B")) {
				c[1]++;
			} else if (s[1].equals("O")) {
				c[3]++;
			} else {
				c[2]++;
			}
		}
		for(int i=0;i<4;i++)System.out.println(c[i]);
	}
}

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

int main()
{
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  int i;
  for(i = 0; i < m; i++)
  {
    cin >> a.at(i);
  }
  int ans = 0;
  bool ch = false;
  for(i = 0; i < m-1; i++)
  {
    if(abs(a.at(i)-a.at(i+1)) == 1)
    {
      ch = true;
      break;
    }
  }
  if(ch)cout << ans << endl;
  else
  {
    vector<int> dp(n, 0);
    for(i = 0; i < m; i++)
    {
      dp.at(a.at(i)) = -1;
    }
    if(dp.at(n-1) != -1)
    {
      dp.at(n-1) = 1;
    }
    else dp.at(n-1) = 0;
    if(n != 1)
    {
      if(dp.at(n-2) != -1)
      {
        dp.at(n-2) = 2;
      }
      else dp.at(n-2) = 0;
    }
    if(dp.at(n-1) == 0 && dp.at(n-2) == 2) dp.at(n-2) = 1;
    for(i = n-3; i >= 0; i--)
    {
      if(dp.at(i) == -1) dp.at(i) = 0;
      else
      {
        dp.at(i) = (dp.at(i+1)+dp.at(i+2))%1000000007;
      }
    }
    cout << dp.at(0) << endl;
  }
}

Measured memory_bytes: 896
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int A = sc.nextInt();
		int B = sc.nextInt();
		System.out.println(Math.max(A + B, Math.max(A * B, A - B)));

	}

}

Measured memory_bytes: 21972
#include<stdio.h>
#include<iostream>
#include<math.h>
#include<string>
#include<vector>
#include<queue>
#include<cmath>
using namespace std;
using ll = long long int;

const int INF=40000;

int main(void){
    int N,x,y;
    //基本的にBFSは0～N-1で仕組む
    cin >> N >> x >> y;
    x--;y--;
    vector<int> ans(N,0);
    for(int sv=0;sv<N;sv++){
        vector<int> dist(N,INF);
        queue<int> q;
        //ノードvの位置はdの距離で行ける
        auto push = [&](int v,int d){
            //すでに距離が定義されているならそのまま
            if(dist[v] != INF) return;
            dist[v]=d;
            q.push(v);
        };
        push(sv,0);
        while(!q.empty()){
            //pop処理
            int v=q.front();q.pop();
            int d=dist[v];
            //現在の距離↑
            //popした数が及ぼす効果[前後が距離+1でいける:xならyに行ける]
            if(v-1>=0)push(v-1,d+1);
            if(v+1<N)push(v+1,d+1);
            if(v==x)push(y,d+1);
            if(v==y)push(x,d+1);
        }
        for(int i=0;i<N;i++){
            //距離iで行ける場所をカウント
            ans[dist[i]]++;
        }
    }
    for(int s=1;s<N;s++){
        ans[s]/=2;
        cout << ans[s] << std::endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

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

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

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

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

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

void solve() {
	int x; cin >> x;
	if (x >= 30) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}
}




signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init_f();
	//cout << grandy(2, 3, false, false) << "\n";
	//int t; cin >> t; rep(i, t)
		solve();
	return 0;
}


Measured memory_bytes: 7736
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntLn(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func (io *Io) PrintStringLn(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func main() {
	io := NewIo()
	defer io.Flush()

	N := io.NextInt()
	Q := io.NextInt()
	S := io.Next()

	mem := make([]int, N)
	mem[0] = 0
	for i := 1; i < N; i++ {
		if S[i-1] == 'A' && S[i] == 'C' {
			mem[i] = mem[i-1] + 1
		} else {
			mem[i] = mem[i-1]
		}
	}

	for i := 0; i < Q; i++ {
		s := io.NextInt() - 1
		e := io.NextInt() - 1

		io.PrintLn(mem[e] - mem[s])
	}
}


Measured memory_bytes: 6144
n = int(input())
a = list(map(int,input().split()))
b = []
flg = 'hi'
for i in range(n-1):
    if a[i] > a[i+1]:
        if flg != 'pl':
            flg = 'mi'
        else:
            b.append(i)
            flg = 'hi'
    elif a[i] < a[i+1]:
        if flg != 'mi':
            flg = 'pl'
        else:
            b.append(i)
            flg = 'hi'
print(len(b)+1)

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

ll fact(ll n)
{
    ll ans=1;
    for(ll i=2;i<=n;i++)
    {
        ans*=i;
    }
    return ans;
}

int main()
{
int n;cin>>n;
  vector<pair<int,int> > v(n);
  for(int i=0;i<n;i++)
  {
      cin>>v[i].first>>v[i].second;
  }
  int a[n]; for(int i=0;i<n;i++) a[i]=i;
  
  double sum=0;
  do 
  { 
        for(int i=1;i<n;i++)
        {
            sum+=sqrt(pow(v[a[i]].first-v[a[i-1]].first,2) + pow(v[a[i]].second-v[a[i-1]].second,2));
        }
    } while (next_permutation(a, a + n));
    cout<<fixed<<setprecision(10)<<(sum/(double)fact(n));
return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;


int main(){

    int n;
    cin >> n;
    int h[100];
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }
    int max = 0;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (h[i] >= max) {
            ans++;
            max = h[i];
        }
    }
    cout << ans << '\n';


}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <ctime>
#include <queue>
#include <stack>
#include <cmath>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cctype>
#include <string>
#include <numeric>
#include <cstring>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std ;
//#define int long long
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define loop(s, v, it) for (s::iterator it = v.begin(); it != v.end(); it++)
#define cont(i, x) for (int i = head[x]; i; i = e[i].nxt)
#define clr(a) memset(a, 0, sizeof(a))
#define ass(a, sum) memset(a, sum, sizeof(a))
#define lowbit(x) (x & -x)
#define all(x) x.begin(), x.end()
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define mp make_pair
#define pb push_back
#define pof pop_front
#define pob pop_back
#define fi first
#define se second
#define iv inline void
#define enter cout << endl
#define siz(x) ((int)x.size())
#define file(x) freopen(#x".in", "r", stdin),freopen(#x".out", "w", stdout)
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair <int, int> pii ;
typedef vector <int> vi ;
typedef vector <pii> vii ;
typedef queue <int> qi ;
typedef queue <pii> qii ;
typedef set <int> si ;
typedef map <int, int> mii ;
typedef map <string, int> msi ;
const int N = 200010 ;
const int INF = 0x3f3f3f3f ;
const int iinf = 1 << 30 ;
const ll linf = 2e18 ;
const int MOD = 1000000007 ;
const double eps = 1e-7 ;
void douout(double x){ printf("%lf\n", x + 0.0000000001) ; }
template <class T> void print(T a) { cout << a << endl ; exit(0) ; }
template <class T> void chmin(T &a, T b) { if (a > b) a = b ; }
template <class T> void chmax(T &a, T b) { if (a < b) a = b ; }
template <class T> void upd(T &a, T b) { (a += b) %= MOD ; }
template <class T> void mul(T &a, T b) { a = (ll) a * b % MOD ; }


int n,Q;
char s[N],t[N],d[N];
int Drop(int x)
{
    for(int i=1;i<=Q;i++)
    {
        if(s[x]==t[i]) x+=(d[i]=='R')?1:-1;
        if(x>n) return -1;
        if(x<1) return 1;
    }
    return 0;
}
int main()
{
    cin>>n>>Q;
    scanf("%s",s+1);
    for(int i=1;i<=Q;i++) cin>>t[i]>>d[i];
    int l=1,r=n,la=0,ra=n+1;
    while(l<=r)
    {
        int mid=(l+r)>>1;
        if(Drop(mid)==1) la=mid,l=mid+1;
        else r=mid-1;
    }
    l=1,r=n;
    while(l<=r)
    {
        int mid=(l+r)>>1;
        if(Drop(mid)==-1) ra=mid,r=mid-1;
        else l=mid+1;
    }
    cout<<ra-la-1<<endl;
}

/*
写代码时请注意：
	1.ll？数组大小，边界？数据范围？
	2.精度？
	3.特判？
	4.至少做一些
思考提醒：
	1.最大值最小->二分？
	2.可以贪心么？不行dp可以么
	3.可以优化么
	4.维护区间用什么数据结构？
	5.统计方案是用dp？模了么？
	6.逆向思维？
*/




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

#define rep(i,a,n)     for(int i=a;i<n;i++)
#define rep3(n)        for(int i=0;i<n;i++)
#define ll             long long
#define int            long long
#define pb             push_back
#define all(v)         v.begin(),v.end()
#define endl           "\n"
#define eb             emplace_back
#define x              first
#define y              second
#define gcd(a,b)       __gcd(a,b)
#define mem1(a)        memset(a,-1,sizeof(a))
#define mem0(a)        memset(a,0,sizeof(a))
#define pres(a,x)      a.find(x)!=a.end()
#define sz(a)          (int)a.size()
#define pii            pair<int,int>
#define hell           1000000007
#define elasped_time   1.0 * clock() / CLOCKS_PER_SEC
using namespace std;


template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.x>>a.y;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.x<<" "<<a.y;return out;}
template<typename T,typename T1>T maxs(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T mins(T &a,T1 b){if(b<a)a=b;return a;}


int solve(){
 int k;cin>>k;	
 int a,b;cin>>a>>b;
 if(b/k>(a-1)/k)cout<<"OK"<<endl;
 else cout<<"NG"<<endl;
 return 0;
}
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #ifdef SIEVE
    sieve();
    #endif
    #ifdef NCR
    init();
    #endif
    int t=1;//cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
 

Measured memory_bytes: 3648
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author cherrypi59
 */

#pragma GCC optimize ("O2")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FFOR(i, a, b) FOR(i, a, b+1)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cerr<<__LINE__<<' '<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

using namespace std;
using lint = long long;
using pii =  pair<int, int>;
using pll =  pair<lint, lint>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vector<T>>;
template <typename T> inline bool chmax(T &a, T b){if(a<b){a = b; return true;} return false;}
template <typename T> inline bool chmin(T &a, T b){if(a>b){a = b; return true;} return false;}

constexpr lint ten(int n) {return n==0 ? 1 : ten(n-1)*10;}

class BTapDance {
public:
    void solve(std::istream& in, std::ostream& out){
        ios_base::sync_with_stdio(false);
        in.tie(nullptr), out.tie(nullptr);
        string S;
        in>>S;
        int N = LEN(S);
        bool ok = true;
        for(int i=0;i<N;i+=2){
            if(S[i]=='L') ok = false;
        }
        for(int i=1;i<N;i+=2){
            if(S[i]=='R') ok = false;
        }
        if(ok) out<<"Yes\n";
        else out<<"No\n";
    }
};


int main() {
	BTapDance solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

int main()
{
    int n, in;
    vector<long long> v;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> in;
        v.push_back(in);
    }
    sort(v.begin(), v.end());
    long long max = v[v.size() - 1];
    long long ave = v[0];
    for(int i = 1; i < n - 1; i++)
        if(v[i] != max){
        if(abs(ave - (max / 2)) >= abs(v[i] - (max / 2))){
            ave = v[i];
        }}
        cout << max << " " << ave << endl;
    return 0;
}

Measured memory_bytes: 1400
use text_io::*;
use std::process::exit;

fn main(){
    let mut a:String = read!();
    let mut va:Vec<char> = a.chars().collect();
    let mut b:String = read!();
    let mut vb:Vec<char> = b.chars().collect();
    for i in 0..va.len() {
        if va[i] != vb[i] {
            println!("No");
            exit(0);
        }
    }
    println!("Yes");
}

Measured memory_bytes: 2152
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

import numpy as np

N,K = map(int,input().split())
A = [int(x) for x in input().split()]

L = 1 << N
right = np.zeros(L,dtype=np.int64)
total = np.zeros(L,dtype=np.int64)

for i, v in enumerate(A):
    bit = 1 << i
    # print(bit)
    right[bit:2*bit] = np.maximum(right[:bit]+1,v)
    np.maximum(right[:bit], v, out=right[:bit])
    total[bit:2*bit] = (right[bit:2*bit] - v) + total[:bit]
    # print(right)
    # print(total)

# print(total)

popcount = np.zeros(L,dtype=np.int32)
rng = np.arange(L)

for _ in range(15):
    popcount += rng&1
    rng >>= 1

# print(popcount)

answer = total[popcount >= K].min()
print(answer)

Measured memory_bytes: 13720
import math

a, b, h, m = map(int, input().split())

angle_h = h * 30 + m * 0.5
angle_m = m * 6
diff = min(abs(angle_h - angle_m), 360 - abs(angle_h - angle_m))
cos = math.cos(math.radians(diff))
ans = a * a + b * b - 2 * a * b * cos

print(math.sqrt(ans))


Measured memory_bytes: 9460
N=int(input())
S=input()
alp=list(S)

def func(mozi):
  ord_mozi=ord(mozi)
  new_ord_mozi=(ord_mozi-65+N)%26+65
  new_chr_mozi=chr(new_ord_mozi)
  return new_chr_mozi

new_alp=map(func,alp)
print("".join(new_alp))

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

ll H, W, N, ans[11];
int dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, dy[8] = {1, 1, 0, -1, -1, -1, 0, 1}, y, x, cnt;

int main()
{
    scanf("%d%d%d", &H, &W, &N);
    set<pair<int, int>> st, br;
    ans[0] = (H - 2) * (W - 2);
    for (int i = 0; i < N; i++)
    {
        scanf("%d%d", &y, &x);
        br.insert({--y, --x}), st.insert({y, x});
        for (int i = 0; i < 8; i++)
        {
            int ny = y + dy[i], nx = x + dx[i];
            if (ny < 1 || ny > H || nx < 1 || nx > W)
                continue;
            st.insert({ny, nx});
        }
    }
    for (auto &p : st)
    {
        y = p.first, x = p.second, cnt = 0;
        cnt += (br.find(p) != br.end());
        for (int i = 0; i < 8; i++)
        {
            int ny = y + dy[i], nx = x + dx[i];
            if (ny < 0 || ny >= H || nx < 0 || nx >= W)
            {
                cnt = -1;
                break;
            }
            cnt += (br.find({ny, nx}) != br.end());
        }
        if (cnt != -1)
            ans[cnt]++, ans[0]--;
    }
    for (int i = 0; i < 10; i++)
        printf("%lld\n", ans[i]);
}

Measured memory_bytes: 47104
N,K =map(int,input().split())
C =[]
D =[]

N1 = N +1
for o in range(1,N+1):
    D.append(o)
    
#print(D)


for i in range(K):
    A =int(input())
    C.append(A)
    B =list(map(int,input().split()))
    for z in B:
        for j in D:
            if j ==z:
                D.remove(j)

#print(D)
                
                
                
#print(E)
print(len(D))
            
    

Measured memory_bytes: 9188
#include<bits/stdc++.h>
using namespace std;
int happy[100005][3];
int dp[100005][3];
int main()
{
    int n;
    cin >> n;
    for(int i=1;i<=n;i++)
        for(int j=0;j<3;j++)
            cin >> happy[i][j];
    for(int i=1;i<=n;i++) {
        dp[i][0]=max(dp[i-1][1],dp[i-1][2])+happy[i][0];
        dp[i][1]=max(dp[i-1][2],dp[i-1][0])+happy[i][1];
        dp[i][2]=max(dp[i-1][0],dp[i-1][1])+happy[i][2];
    }
    cout << max(dp[n][0],max(dp[n][1],dp[n][2]));
}


Measured memory_bytes: 2560
#include <iostream>
using namespace std;
int main(void){
	int a,b,c;
	cin>>a>>b>>c;
	if(b>=c){
		cout<<"delicious"<<endl;
	}else if(a+b>=c&&b<c){
		cout<<"safe"<<endl;
	}else{
		cout<<"dangerous"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import re
import sys


def solve(N: int, S: str):
    max_length = 1
    found = False
    for i in range(N):
        is_break = False
        if i + max_length > N:
            break
        while not is_break:
            org = S[i:i + max_length]
            rest = S[i + max_length:N]
            # print(org, rest)
            if org in rest:
                max_length += 1
            else:
                is_break = True
    print(max_length - 1)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 40556
#include<iostream>
#include<vector>
#include<string.h>
#include<queue>
using namespace std;

vector<int> T;
vector<int> M;
vector<bool> check;
int N;
const int NOT=-2;

int calc(int idx){
	if(T[idx]==NOT) return NOT;
	if(T[idx]>=0) return T[idx];
	if(check[idx]){T[idx]=NOT; return NOT;}
	check[idx]=true;
	if(M[idx]==0){
		T[idx]=idx;
		return idx;
	}
	return T[idx]=calc(idx+M[idx]);
}

class Node{
public:
	int idx,cost;
	Node(int idx,int cost):idx(idx),cost(cost){}
	Node();
};

bool operator  < (Node a,Node b){
	return a.cost>b.cost;
}


int main()
{
	cin>>N;
	T.resize(N,-1);
	check.resize(N,false);
	M.resize(N);
	for(int i=0;i<N;i++)
		cin>>M[i];

	T[0]=0;
	T[N-1]=N-1;
	for(int i=N-1;i>=1;i--){
		if(!check[i])
			calc(i);
	}
	vector<int> ans(N,N+1);
	priority_queue<Node> que;
	que.push(Node(0,0));


//	cout<<endl;
	int res=N+1;
	while(!que.empty()){
		Node now=que.top();
		que.pop();
//		cout<<now.idx<<endl;
		if(T[now.idx]==NOT) continue;
		if(ans[now.idx]<=now.cost) continue;
		ans[now.idx]=now.cost;
		for(int i=1;i<=6;i++){
			if(now.idx+i<=N-1){
				if(T[now.idx+i]>=0)
					que.push(Node(T[now.idx+i],now.cost+1));
			}
		}
	}
	cout<<ans[N-1]<<endl;
	return 0;
}

Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
int main() {
	// your code goes here
	ll n;
	cin>>n;
	vector<ll>a(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	ll mn=a[0];
	ll cnt=1;
	for(int i=0;i<n;i++){
		mn=min(mn,a[i-1]);
		if(mn>=a[i]){
			cnt++;
		}
	}
	cout<<cnt-1<<endl;
	return 0;
}

Measured memory_bytes: 1792
package main

import "fmt"

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

	if a[len(a)-1] == b[0] && b[len(b)-1] == c[0] {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


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

int main(void) {
  int n;
  string str;
  
  cin >> n;
  cin.ignore();
  while(n--) {
    getline(cin, str);
    for(int i=0; i<str.size(); i++) {
      if(str.substr(i, 7) == "Hoshino") str[i+6] = 'a';
    }
    cout << str << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1220
from collections import deque

def main():
    S = deque(input())
    Q = int(input())
    rev_flag = False
    for _ in range(Q):
        query = input().split()
        if query[0] == "1":
            rev_flag = not(rev_flag)
            continue
        if query[1] == "1":
            if rev_flag:
                S.append(query[2])
            else:
                S.appendleft(query[2])
        else:
            if rev_flag:
                S.appendleft(query[2])
            else:
                S.append(query[2])
    
    if rev_flag:
        S.reverse()

    print("".join(list(S)))
        
if __name__ == "__main__":
    # print(timeit.timeit(lambda: main(), number=1))
    main()


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

// definitions
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define rep(i, l, r) for (long long i = (l); i < (long long)(r); i++)
#define repb(i, r, l) for (long long i = (r); i > (long long)(l); i--)
#define high(x) __builtin_popcountll(x)
#define pb push_back
#define pf push_front
#define mod1 998244353
#define mod 1000000007
#define MAX_CHAR 256
#define pi 3.1415926535897932384



using namespace std;
typedef vector<long long> vl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector< pair<long long, long long> > vp;
typedef vector<tuple<long long , long long , long long> > vtup;
typedef deque <long long> dql;
typedef deque <char> dqc;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;

ll INF=1e18;



// prevent collisions in unordered_map
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template <class T>
void read(T arr[],ll n) {rep(i,0,n) cin>> arr[i];}

typedef unordered_map <long long, long long, custom_hash> umap;


// standard functions
ll mystoi(string str)
{
    stringstream ss(str);
    ll ans=0;
    ss >> ans;

    return ans;
}

ll exp(ll x, ll ex, ll p) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x)%p;
        ex >>= 1ll;
        x = (x * x)%p;
    }
    return ans;
}

bool sort_cond(const pair<ll,ll> &a, const pair <ll,ll> &b)
{
    return ((a.f-a.s)>(b.f-b.s));
}
  

// code beigns in main
int main()
{

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll t=1;
    // cin >> t;
    while(t--)
    {
        ll h1,m1,h2,m2,k;
        cin >> h1 >> m1 >> h2 >> m2 >> k;
        ll diff;
        if(h2>=h1) diff=h2-h1;
        else diff=24+h2-h1;

        diff*=60;

        diff+=m2-m1;
    

        cout << max(0ll,diff-k) << endl;
    }
}

Measured memory_bytes: 3652
#pragma target("avx")
#pragma optimize("O3")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using V = std::vector<ll>;

#define REP(i,b,e) for(ll i=b; i<e; i++)
#define ALL(vec) vec.begin(),vec.end()
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
	int n, K;
	scanf("%d %d", &n, &K);
	std::vector<P> xy(n);
	REP(i, 0, n) scanf("%ld %ld", &xy[i].fi, &xy[i].se);
	std::sort(ALL(xy), [](P a, P b){return a.se<b.se;});
	V x(n), y(n);
	REP(i, 0, n) std::tie(x[i], y[i]) = xy[i];

	ll ans = LONG_MAX;
	REP(i, 0, n) REP(j, 0, n){
		if(x[i]>x[j]) continue;
		REP(k, 0, n){
			if(x[k]<x[i] or x[j]<x[k] or y[i]<y[k] or y[j]<y[k]) continue;
			ll cnt = 3 - (i==j or j==k or k==i) - (i==j and j==k);
			REP(l, 0, n){
				if(y[l]<y[k] or x[l]<x[i] or x[j]<x[l]) continue;
				cnt += (l!=i and l!=j and l!=k);
				if(cnt==K){
					ll tmp = (x[j]-x[i]) * (std::max({y[i],y[j],y[l]})-y[k]);
					if(tmp) ans = std::min(ans, tmp);
				}
			}
		}
	}
	printf("%ld\n", ans);
	return 0;
}



Measured memory_bytes: 3768
#include<stdio.h>
int main(void)
{
    int a,b,c,divise=0;
    scanf("%d %d %d",&a,&b,&c);
    for(;a<=b;a++){
        if(c%a==0){divise++;}
    }
    printf("%d\n",divise);
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
#define fdto(i, r, l) for(int i = (r); i >= (l); --i)
#define fto(i, l, r) for(int i = (l); i <= (r); ++i)
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define sz(a) (int)a.size()

const double PI = acos(-1.0);
const int oo = 1000000007;

double fRand(double fMin, double fMax)
{
    double f = (double)rand() / RAND_MAX;
    return fMin + f * (fMax - fMin);
}

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

const int MAXN = 100005;

int n, a[MAXN], b[MAXN], pos[MAXN];
vector<pii> p;

int main () {
    scanf("%d", &n);
    fto(i, 0, n-1) scanf("%d%d", &a[i], &b[i]);

    ll sum1 = accumulate(a, a+n, 0LL);
    ll sum2 = accumulate(b, b+n, 0LL);

    fto(i, 0, n-1) {
        p.pb(mp(a[i], i));
        p.pb(mp(b[i], i + n));
    }

    sort(p.begin(), p.end());

    fto(i, 0, n-1)
        pos[i] = -1;

    fto(i, 0, n-1) {
        int id = p[i].ss;
        pos[id%n] = i;
    }

    bool havePair = false;
    fto(i, 0, n-1)
        if (pos[i] == -1)
            havePair = true;

    ll sum3 = 0;
    fto(i, 0, n-1)
        sum3 += p[i].ff;

    if (!havePair) {
        int maxID[2] = {0, 0};

        for(int i = 0; i < n; ++i) {
            if (p[i].ff >= p[maxID[0]].ff) {
                maxID[1] = maxID[0];
                maxID[0] = i;
            } else if (p[i].ff >= p[maxID[1]].ff) {
                maxID[1] = i;
            }
        }

        int minD = oo;
        for(int i = n; i < 2*n; ++i) {
            if (p[i].ss%n == p[maxID[0]].ss%n)
                minD = min(minD, p[i].ff - p[maxID[1]].ff);
            else
                minD = min(minD, p[i].ff - p[maxID[0]].ff);
        }

        sum3 += minD;
    }

    ll ans = min(min(sum1, sum2), sum3);

    printf("%lld", ans);

    return 0;
}


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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;}
const long long MOD = 1000000007;
typedef long long ll;

int n,k;
string s,t;
int a[100005];

int main() {
  cin >> n;
  map<string,int> mp;
  rep(i,n) cin >> s, mp[s]++;
  int ma=0;
  for(auto m : mp) chmax(ma,m.second);
  for(auto m : mp)if(m.second==ma)
  cout << m.first << endl;
}

Measured memory_bytes: 25216
// A.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <numeric>

using namespace std;

typedef long long LL;

LL solve(LL n, LL a, LL b) {
	LL ans = b - 1;
	if (((b - a) % 2) == 0) {
		ans = min(ans, (b - a) / 2);
	} else {
		ans = min(ans, a + (b - a) / 2);
	}
	return ans;
}

int main(int argc, char* argv[]) {
	const LL INF = 1LL << 60;
#ifdef _MSC_VER
	while (true)
#endif
	{
		LL n = -1, a, b;
		cin >> n >> a >> b;
		if (n < 0) return 0;
		LL ans = min(solve(n, a, b), solve(n, n - b + 1, n - a + 1));
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

typedef long long ll;

void dfs(vector<vector<ll>> &graph, vector<bool> &visited, ll current, ll &count){
  visited[current] = true;

  bool all_passed = true;
  for (auto v : visited) {
    if (v == false) {
      all_passed = false;
      break;
    }
  }

  if (all_passed) {
    visited[current] = false;
    count++;
    return;
  }

  for (auto n : graph[current]) {
    if (visited[n]) continue;

    dfs(graph, visited, n, count);
  }
  visited[current] = false;
}

int main() {
  ll N, M;
  cin >> N >> M;
  vector<vector<ll>> graph(N);
  for (ll i = 0; i < M; i++) {
    ll a, b;
    cin >> a >> b;
    graph[a-1].push_back(b-1);
    graph[b-1].push_back(a-1);
  }

  vector<bool> visited(N, false);
  ll count = 0;
  dfs(graph, visited, 0, count);

  cout << count << endl;
  return 0;
}


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

int main(){
 int N;
 std::cin>>N;
 vec A(N+1);
 vec B(N);
 for(int i=0;i<N+1;i++){
  std::cin>>A[i];
 }
 for(int i=0;i<N;i++){
  std::cin>>B[i];
 }
 
 ll ans=0;
 for(int i=0;i<N;i++){
  if(A[i]<=B[i]){
   if(A[i]+A[i+1]<=B[i]){
    ans+=A[i]+A[i+1];
    A[i+1]=0;
   }else{
    ans+=B[i];
    A[i+1]=A[i+1]+A[i]-B[i];
   }
   A[i]=0;
  }else{
   ans+=B[i];
   A[i]=A[i]-B[i];
  }
 }
 std::cout<<ans<<std::endl;
}

Measured memory_bytes: 1024
#include <iostream>

int main(int argc, char const* argv[])
{
	int W, H, x, y, r;

	std::cin >> W >> H >> x >> y >> r;

	if (x >= r && x + r <= W && y >= r && y + r <= H)
		std::cout << "Yes" << std::endl;
	else
		std::cout << "No" << std::endl;
}

Measured memory_bytes: 1156