akhauriyash/Code-Regression huggingface dataset:
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

def gcd_array(A):
    n = len(A)
    s = A[0]
    i = 1
    Down = [0]
    while(i < n):
        t = gcd(s,A[i])
        if t < s:
            Down.append(i)
        s = t
        i += 1
    return s,Down

if __name__ == "__main__":
    N = int(input())
    B = list(map(int,input().split()))
    max = 0
    d,Down = gcd_array(B)
    C = [i//d for i in B]
    c = C[0]
    K = 1
    for j in Down:
        A = [i for i in C]
        c = A.pop(j)
        l = gcd_array(A)[0]
        if K < l:
            K = l
    print(K * d)

Measured memory_bytes: 14400
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP((I),(N)) cin>>(V[I])
#define INS2(I,N,V1,V2) REP((I),(N)) cin>>(V1[I])>>(V2[I]);
#define INS3(I,N,V1,V2,V3) REP((I),(N)) cin>>(V1[I])>>(V2[I])>>(V3[I]);
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUTS(I,N,V) REP((I),(N)) cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

long N,i,MOD=(long)1e9+7,a=1;
inline void solve(){
  IN(N);
  UP(i,1,N){
    a*=i;
    a%=MOD;
  }
  OUT(a);
}

int main(int argc,char**argv){
  BEGIN
  solve();
  END
}


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

#define rep(i, n) for(int (i) = 0; i < (n); ++(i))

using ll = long long int;
const ll MOD = 998244353;

template<long long int P>
struct _mint {
  long long int x;
  _mint(long long int x = 0): x((x % P + P) % P) {}

  _mint operator-() const {
    return _mint(-x);
  }

  _mint& operator+=(const _mint a) {
    if((x += a.x) >= P) {
      x -= P;
    }
    return *this;
  }
  _mint& operator-=(const _mint a) {
    if((x += P - a.x) >= P) {
      x -= P;
    }
    return *this;
  }
  _mint& operator*=(const _mint a) {
    (x *= a.x) %= P;
    return *this;
  }
  _mint& operator/=(const _mint a) {
    return (*this) *= a.inv();
  }

  _mint operator+(const _mint a) const {
    _mint res(*this);
    return res += a;
  }
  _mint operator-(const _mint a) const {
    _mint res(*this);
    return res -= a;
  }
  _mint operator*(const _mint a) const {
    _mint res(*this);
    return res *= a;
  }
  _mint operator/(const _mint a) {
    _mint res(*this);
    return res /= a;
  }

  _mint pow(long long int t) const {
    if(! t) return 1;
    _mint a = pow(t >> 1);
    a *= a;
    if(t & 1) a *= *this;
    return a;
  }

  // for prime P
  _mint inv() const {
    return pow(P - 2);
  }
};
using mint = _mint<MOD>;

template<long long int P>
struct mintCOM {
  using mint = _mint<P>;
  int MAX;
  std::vector<mint> fac, finv, inv;
  mintCOM(int MAX=2000001): MAX(MAX) {
    fac.resize(MAX);
    finv.resize(MAX);
    inv.resize(MAX);
    COMinit();
  }

  void COMinit() {
      fac[0] = fac[1] = 1;
      finv[0] = finv[1] = 1;
      inv[1] = 1;
      for (int i = 2; i < MAX; i++){
          fac[i] = fac[i - 1] * i;
          inv[i] = mint(P) - inv[P%i] * (P / i);
          finv[i] = finv[i - 1] * inv[i];
      }
  }
  mint COM(int n, int k){
      if (n < k) return 0;
      if (n < 0 || k < 0) return 0;
      return fac[n] * finv[k] * finv[n - k];
  }
};

int main() {
  int N, M, K;
  std::cin >> N >> M >> K;

  mintCOM<MOD> com;
  mint ans = 0;
  rep(k, K + 1) {
    ans += com.COM(N - 1, k) * M * mint(M - 1).pow(N - 1 - k);
  }
  std::cout << ans.x << '\n';
}


Measured memory_bytes: 50260
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
 *
 * @author mikit
 */
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);
        CToInfinity solver = new CToInfinity();
        solver.solve(1, in, out);
        out.close();
    }

    static class CToInfinity {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            char[] s = in.next().toCharArray();
            long k = in.nextLong() - 1;
            int i = 0;
            for (; k > 0; i++) {
                if (s[i] == '1') {
                    k--;
                } else {
                    break;
                }
            }
            out.println(s[i]);
        }

    }
}



Measured memory_bytes: 23764
/*
 
*/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
#include <stack>
#include <deque>
 
#define ll long long
#define cint const int
#define ld long double
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
 
using namespace std;
 
typedef vector <long long> vll;
typedef vector <string> vs;
typedef vector <char> vc;
typedef set <int> si;
typedef set <string> ss;
typedef pair <int, int> pi;
typedef pair <long long, long long> pll;
typedef pair <int, long long> pil;
typedef pair <int, string> pis;
typedef pair <int, char> pic;
typedef pair <long long, int> pli;
typedef pair <long long, string> pls;
typedef pair <long long, char> plc;
typedef pair <string, int> psi;
typedef pair <string, long long> psl;
typedef pair <string, char> psc;
typedef pair <char, int> pci;
typedef pair <char, long long> pcl;
typedef pair <char, string> pcs;
 
int n, m;
 
int main () {
	cin >> n >> m;
	if (n == m) {
    	cout << "Yes";
      	return 0;
    }
  	cout << "No";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;

    int dx=x2-x1,dy=y2-y1;
    REP(i,2){
        swap(dx,dy);
        dx=-dx;
        x2+=dx;
        y2+=dy;
        cout<<x2<<' '<<y2<<endl;
    }

}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)

using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;

const int MAXN = 234567;
int A[MAXN];
int sum[MAXN];

int main() {
    int N, K;
    scanf("%d %d", &N, &K);
    for (int i = 0; i < N; i++)
        scanf("%d", &A[i]);
    while (K--) {
        for (int i = 0; i < N; i++) {
            int l = max(0, i - A[i]);
            int r = min(N, i + A[i]) + 1;
            sum[l]++;
            sum[r]--;
        }
        int cur = 0;
        for (int i = 0; i < N; i++) {
            cur += sum[i];
            A[i] = cur;
            sum[i] = 0;
        }
        bool OK = false;
        for (int i = 0; i < N; i++) {
            if (A[i] != N)
                OK = true;
        }
        if (!OK) break;
    }
    for (int i = 0; i < N; i++)
        printf("%d ", A[i]);

    return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
by Benq;
*/


Measured memory_bytes: 5360
#define DEB
#include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
#define dumpR(x) cerr<<"\x1b[31m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpY(x) cerr<<"\x1b[33m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpG(x) cerr<<"\x1b[32m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define dumpR(x) ;
#define dumpY(x) ;
#define dumpG(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

template<class T> void chmin(T& a,const T& b) { if(a>b) a=b; }
template<class T> void chmax(T& a,const T& b) { if(a<b) a=b; }

typedef long long int lint;
typedef pair<int,int> pi;

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fr<<','<<a.sc<<')';
    return out;
  }
}

//const int INF=5e8;
int main(){
  string s;cin>>s;
  int cnt[3]={0};
  for(char c:s) ++cnt[c-'a'];
  int mx=max({cnt[0],cnt[1],cnt[2]}),mn=min({cnt[0],cnt[1],cnt[2]});
  puts((mx-mn)<=1?"YES":"NO");
  return 0;
}





Measured memory_bytes: 764
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Map<String, Integer> map = new HashMap<>();
		for(int i = 0; i < N; i++) {
			StringBuilder S = new StringBuilder();
			char[] s = sc.next().toCharArray();
			Arrays.sort(s);
			map.merge(new String(s), 1, Integer::sum);
		}
		long ans = 0;
		for(String s : map.keySet())
			ans += (long)map.get(s)*(map.get(s)-1)/2;
		System.out.println(ans);

	}

}


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

public class Main {

    public int distToA(char c) {
      if (c == 'a') {
        return 0;
      }
      return 'z' - c + 1;
    }
    public void solve() throws IOException {
      String s = next();
      int k = nextInt();
      StringBuilder sb = new StringBuilder();
      for (int i = 0 ; i < s.length() ; i ++) {
        char c = s.charAt(i);
        int d = distToA(c);
        if (d <= k) {
          sb.append('a');
          k -= d;
        } else {
          sb.append(c);
        }
      }
      char [] ar = sb.toString().toCharArray();
      if (k > 0) {
        k %= 26;
        int n = s.length();
        ar[n-1] += k;
        if (ar[n-1] > 'z') {
          ar[n-1] -= 26;
        }
      }
      out.println(new String(ar));
    }

    

    
    
    BufferedReader bf;
    StringTokenizer st;
    PrintWriter out;
    
    public String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) 
            st = new StringTokenizer(bf.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public Main() throws IOException {
        bf = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(new OutputStreamWriter(System.out));      
        solve();
        bf.close();
        out.close();
    }
    
    public static void main(String args[]) throws IOException {
        new Main();
    }
}

Measured memory_bytes: 12372
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
ans=0
for i in range(N):
	if i>0 and B[i-1]>0:
		if A[i] >= B[i-1]:
			ans += B[i-1]
			A[i]-=B[i-1]
		else:
			ans += A[i]
			A[i]=0
	if A[i]>=B[i]:
		ans+=B[i]
		B[i]=0
	else:
		B[i]-=A[i]
		ans+=A[i]
if A[-1]>0:
	ans+=min(A[-1],B[-1])
print(ans)

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

using namespace std;

static const ll INF = 1e15;

template<typename T>
static inline void chmin(T& ref, const T  value) {
    if (ref > value) ref = value;
}

template<typename T>
static inline void chmax(T& ref, const T value) {
    if (ref < value) ref = value;
}

constexpr ll mod = 1000000007;

int main() {
    ll n;
    cin >> n;
    ll sum = 0;
    rep(i, n-1) {
        sum += i + 1;
    }
    cout << sum << endl;
    return 0;
}



Measured memory_bytes: 3624
import numpy as np

n, m = map(int, input().split())

coef = np.minimum(np.arange(n, 1, -1), np.arange(1, n))
dp = np.zeros(n, dtype=np.int64)
dp[0] = 1
for c in coef:
    ndp = np.zeros(n, dtype=np.int64)
    for i in range(0, n, c):
        ndp[i:] += dp[:n - i]
    dp = ndp % m

print((dp * np.arange(n, 0, -1) % m).sum() % m)


Measured memory_bytes: 14536
import sys

# sys.stdin = open('a1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


x, a, b = read_int_list()
if x >= b:
    print('delicious')
else:
    if x >= b - a:
        print('safe')
    if x < b - a:
        print('dangerous')


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

#define ll long long
#define ld long double

#define all(x) x.begin(),x.end()

using namespace std;

int n;
int a[100000];
int x;

ll r=0;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin>>n;
    cin>>x;
    for (int i=0; i<n; i++)
    	cin>>a[i];
    
    for (int i=0; i<n; i++)
    {
    	if (a[i]>x) r+=a[i]-x,a[i]=x;
    	if (i && a[i]+a[i-1]>x) r+=a[i]+a[i-1]-x,a[i]-=a[i]+a[i-1]-x;
    }	
    
    cout<<r;
    	
    return 0;
}


Measured memory_bytes: 640
n, m = map(int, input().split())
dp = [1] * (n + 1)

for i in range(m):
    blank = int(input())
    dp[blank] = 0

for i in range(2, n+1):
    if dp[i] != 0:
        dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007
    else:
        pass

print(dp[-1])

Measured memory_bytes: 12620
use proconio::fastout;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
use std::cmp::min;

#[fastout]
fn main() {
    input! {
        n: isize,
        x: isize,
        y: isize,
    }
    let mut ans = vec![0; (n - 1) as usize];
    for i in 1..=n - 1 {
        for j in i + 1..=n {
            let p = min(j - i, (x - i).abs() + 1 + (j - y).abs()) as usize;
            ans[p - 1] += 1;
        }
    }
    for a in ans {
        println!("{}", a);
    }
}


Measured memory_bytes: 2172
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

/* define */
#define Yes(X) puts ( X ? "Yes" : "No")
#define YES(X) puts ( X ? "YES" : "NO")
#define FOR(i, a, b) for ( int i = a; i < b ; i++)
#define REP(i, n) for ( int i = 0; i < n ; i++)
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max3(a, b, c) ((max((a), (b)) > (c)) ? max((a), (b)) : (c))
#define min3(a, b, c) ((min((a), (b)) < (c)) ? min((a), (b)) : (c))

/* const */
const int MOD = (int)1e9 + 7;

/* alias */
typedef long long ll;
typedef unsigned  u;

/* function */
int cmp(const void *a, const void *b) {
	return *(int*)a - *(int*)b;
}
int cmp2(const void *a, const void *b) {
	return *(int*)b - *(int*)a;
}

/* main */

int n, m, a, b, visited[8] = { 1 }, ver[8][8] = { 0 };

int visit(int x,int deep) {
	if (deep == n) return 1;
	int c = 0;
	REP(i, n) {
		if (visited[i] == 0 && ver[x][i] == 1) {
			visited[i] = 1;
			c += visit(i, deep + 1);
			visited[i] = 0;
		}
	}
	return c;
}

int main() {
	scanf("%d%d", &n, &m);
	REP(i, m) {
		scanf("%d%d", &a, &b);
		ver[a - 1][b - 1] = 1;
		ver[b - 1][a - 1] = 1;
	}
	printf("%d\n", visit(0,1));
	return 0;
}

Measured memory_bytes: 128
// warm heart, wagging tail,and a smile just for you!
//
//                            ▒█████▒▒
//                             ██████████▒
//                             ▒████████████▒
//                            ██████████████████
//                           ████████████████████▒
//                          ▒██████████████████████▒
//                          ▒███████████████████████
//                      ▒████▒▒▒▒▒▒█████████████████▒
//                    ███▒▒▒▒▒▒██████████████████████▒▒▒
//                  ▒██▒▒███████████████████████▒▒▒▒▒██████
//                 ▒█████████████████████████▒▒▒▒▒▒█████████▒
//                 ▒█████████████████████▒▒▒▒▒▒██████████████
//                  ▒████         ████▒▒▒▒▒████         ████▒
//              ▒█████▒    ████    ▒▒▒▒███████    ████    ██████▒
//            ▒██▒▒▒▒▒    ██████    █████████    ██████    ██▒▒▒██▒
//           █████████   ████████   █████████   ████████   ▒▒▒▒█████
//          ▒█████████    ██████    ████████▒    ██████    █████████
//          ▒██████████    ████    █████▒▒▒▒▒▒    ████    ██████████
//           ████████████        ▒▒▒▒▒▒▒████████        ███████████▒
//       ▒██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████████▒
//     ███▒▒▒▒▒▒▒▒▒▒▒▒█████████████████████████████████████████▒▒████████▒
//   ▒▒▒▒▒▒▒▒▒██████████████                         ███████▒▒▒▒███████████
//   █████████████████████████                     ███████▒▒▒██████████████▒
//   █████████████████████████████             ███████▒▒▒██████████████████▒
//   ██████████████████████████████████████████████████████████████████████
//    ██████████████████████████████████████████████████████████████████▒
//      ▒█████████████████▒▒▒▒▒▒▒██████████████████████████████████▒▒▒
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n;
  cin >> n;

  if(n == 0){
    cout << 0 << endl;
    return 0;
  }

  string ans; int id = 0;
  while(n){
    if(n%2){
      ans += '1';
      if(id%2) n++;
      else n--;
    }
    else ans += '0';
    id++;n /= 2;
  }

  reverse(ans.begin(),ans.end());

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int n,p[100001],st[100001],c;// 0 Ok 1 NG

int swap(int a,int b){
	int mp;
	mp=a;
	a=b;
	b=mp;
	return 0;
}

int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>p[i];
		if(i==p[i]) st[i]=1;
	}
	for(int i=1;i<=n;i++){
		if(st[i]==1){
			if(i==n) c++;
			else{
				if(st[i+1]==1){
					st[i]=0;
					st[i+1]=0;
					i=1;
					c++;
				}
				else{
					st[i]=0;
					i=1;
					c++;
				}
			}
		}
	}
	cout<<c<<endl;
	return 0;
}

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

int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  if (A+B > C+D) {
      cout << "Left" << endl;
  } else if (A+B == C+D) {
      cout << "Balanced" << endl;
  } else {
      cout << "Right" << endl;
  }
}


Measured memory_bytes: 256
from itertools import permutations

n, m = map(int, input().split())
ans = 0

path = [[False]*n for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    path[a][b] = True
    path[b][a] = True

for i in permutations(range(n), n):
    if i[0] == 0:
        for j in range(n):
            if j == n - 1:
                ans += 1
                break
            if not path[i[j]][i[j+1]]:
                break
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
long long k,a,b,ans,t;
int main(){
    cin>>k>>a>>b;
    if(a>=k){
        cout<<1<<endl;
        return 0;
    }
    if(a<=b){
        cout<<-1<<endl;
        return 0;
    }
    t=int(bool((k-a)%(a-b)));
    ans=((k-a)/(a-b)+t)*2+1;
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;
#define         MAX         1000000
#define         input       freopen("input.txt","r",stdin)
#define         output      freopen("output.txt","w",stdout)

int main() {

    int a,b,c;

    cin>>a>>b>>c;

    swap(a,b);
    swap(a,c);
    cout<<a<<" "<<b<<" "<<c;

    return 0;
}


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

typedef long long ll;
const int p = 998244353;
const int maxn = 2e5 + 5;

int n, k;
int l[maxn], r[maxn];
ll f[maxn], sum[maxn];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	cin >> n >> k;
	k = min(10, k);
	for(int i = 1; i <= k; ++i) cin >> l[i] >> r[i];
	
	f[1] = sum[1] = 1;
	for(int i = 2; i <= n; ++i){
		for(int j = 1; j <= k; ++j){
			int a = l[j], b = r[j];
			if(a >= i) continue;
			a = i - a;
			b = max(0, i - b - 1);
			f[i] = (f[i] + sum[a] - sum[b] + p) % p;
		}
		sum[i] = (sum[i-1] + f[i]) % p;
	}
	cout << f[n];
}

Measured memory_bytes: 6780
def get_c(p, k):
    c = 0
    while 1:
        if p * pow(2, c) >= k:
            return c
        c += 1


# input
N, K = map(int, input().split())

# check
prob = [1 / N] * N
for p, i in zip(range(1, N + 1), range(N)):
    c = get_c(p, K)
    prob[i] *= (1 / 2) ** c

print(sum(prob))


Measured memory_bytes: 6132
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
string s;
string divide[4] = { "dream", "dreamer", "erase", "eraser" };
int main() {
	cin >> s;
	reverse(s.begin(), s.end());
	for (int i = 0; i < 4; ++i) reverse(divide[i].begin(), divide[i].end());

	bool flag = true;
	for (int i = 0; i < s.size();) {
		bool flag2 = false;
		for (int j = 0; j < 4; ++j) {
			string str = divide[j];
			if (s.substr(i, str.size()) == str) {
				flag2 = true;
				i += str.size();
			}
		}
		if (!flag2) {
			flag = false;
			break;
		}
	}
	if (flag) cout << "YES" << endl;
	else cout << "NO" << endl;
	
	return 0;
}

Measured memory_bytes: 512
A,B,C,D = input()
for i in range(1<<3):
  S = []
  for j in range(3):
    if 1&(i>>j): 
      S.append("+")
    else: 
      S.append("-")
  if eval(A+S[0]+B+S[1]+C+S[2]+D)==7:
    print(A+S[0]+B+S[1]+C+S[2]+D+"=7")
    exit()

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

using namespace std;
using ll = long long;

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

  int n, m;
  cin >> n >> m;

  auto cmp = [](auto &p1, auto &p2) {
    if (p1.first > p2.first) {
      return true;
    } else if (p1.first < p2.first) {
      return false;
    } else {
      return p1.second < p2.second;
    }
  };
  priority_queue<pair<int, ll>, vector<pair<int, ll>>, decltype(cmp)> q1(cmp);
  priority_queue<ll, vector<ll>, less<ll>> q2;

  for (int i = 0; i < n; i++) {
    int a;
    ll b;
    cin >> a >> b;
    q1.push({a, b});
  }

  ll ans = 0;
  for (int i = 1; i <= m; i++) {
    while (!q1.empty() && q1.top().first <= i) {
      q2.push(q1.top().second);
      q1.pop();
    }
    if (!q2.empty()) {
      ans += q2.top();
      q2.pop();
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6636
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>

using namespace std;

int main() {
	long long int n, i, j, x;
	vector<long long int>a;

	cin >> n;

	cin >> i;
	a.push_back(i);
	for (i = 1; i < n; i++) {
		cin >> j;
		a.push_back(j + a[i - 1]);
	}

	x = -1;
	for (i = 0; i < n-1; i++) {
		j = abs(2 * a[i] - a[n - 1]);
		if (x > j || x == -1)
			x = j;
	}

	cout << x;

	return 0;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
 
using namespace std;
 
#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);
 
//int dxy[5] = {0, 1, 0, -1, 0};
// assign

int a, b, c, n;
int dp[501][50], g[501][501];

signed main()
{
    int m;
    cin >> n >> m;
    fill(g[0], g[501], INF);
    //memset(g, INF, sizeof(g));
    rep(i, m) {
        int s, t, u;
        cin >> s >> t >> u;
        g[s][t] = u;
        g[t][s] = u;
    }
    Int(v);
    cin >> a >> b >> c;
    queue< pair<int, i_i > > q;
    q.push(mp(0, mp(1, v)));
    fill(dp[0], dp[501], INF);
    //memset(dp, INF, sizeof(dp));
    dp[1][v] = 0;
    while (!q.empty()) {
        pair<int, i_i > tmp = q.front(); q.pop();
        int val = tmp.first, pos = tmp.second.first, 
            ver = tmp.second.second;
        if (val > dp[pos][ver]) {
            continue;
        }
        for (int i = 1; i <= n; i++) {
            if (g[pos][i] != INF) {
                int nval = val + ver * g[pos][i];
                int nver = (ver * a + b) % c;
                if (nval < dp[i][nver]) {
                    dp[i][nver] = nval;
                    q.push(mp(nval, mp(i, nver)));
                }
            }
        }
    }

    //Rep(i, n+1) { rep(j, c) { cout << dp[i][j] << " "; } cout << endl;}
    
    for (int i = 0; i < c; i++) {
        if (dp[n][i] != INF) {
            q.push(mp(dp[n][i], mp(n, i)));
        }
    }

    //memset(dp, INF, sizeof(dp));
    fill(dp[0], dp[501], INF);
    while (!q.empty()) {
        pair<int, i_i > tmp = q.front(); q.pop();
        int val = tmp.first, pos = tmp.second.first, 
            ver = tmp.second.second;
        if (val > dp[pos][ver]) {
            continue;
        } else {
            dp[pos][ver] = val;
        }
        for (int i = 1; i <= n; i++) {
            if (g[pos][i] != INF) {
                int nval = val + ver * g[pos][i];
                int nver = (ver * a + b) % c;
                if (nval < dp[i][nver]) {
                    dp[i][nver] = nval;
                    q.push(mp(nval, mp(i, nver)));
                }
            }
        }
    }
    int ans = INF;
    rep(i, c) {
        ans = min(ans, dp[1][i]);
    }
    cout << ans << endl;


    return 0;
}

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

// 💖 Hi, thanks for using ICIE! 💖
// 🔧 To use a custom code template, set it in Settings(Ctrl+,) in "Icie Template List" entry 🔧
// 📝 If you spot any bugs or miss any features, create an issue at https://github.com/pustaczek/icie 📝

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, x;
    cin>>n>>x;

    std::vector<int> v(n, 0);
    for(int i = 0; i < n; ++i)
        cin>>v[i];

    int sum = 0;
    int total = 1;
    
    for(int i = 0; i < n; ++i)
    {
        sum += v[i];
        if(sum <= x)
            total++;
        else
            break;
    }
    cout<<total<<endl;
}


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

int main() {
  int a,b;
  cin >> a >> b;
  if(a<b){
    for(int i=0;i<b;i++){
      cout << a;
    }
  }
  else{
    for(int i=0;i<a;i++){
      cout << b;
    }
  }
}


Measured memory_bytes: 256
#include <cstdio>

int N;
int s[100];

int main()
{
    scanf("%d", &N);
    for(int i = 0; i < N; i++){
        scanf("%d", &s[i]);
    }
    int min_score = 101;
    int sum = 0;
    for(int i = 0; i < N; i++){
        if(s[i] % 10 != 0 && s[i] < min_score){
            min_score = s[i];
        }
        sum += s[i];
    }
    int answer;
    if(sum % 10 == 0){
        if(min_score > 100){
            answer = 0;
        }else{
            answer = sum - min_score;
        }
    }else{
        answer = sum;
    }
    printf("%d\n", answer);
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;

int main(){
  ll k,a,b;
  cin>>k>>a>>b;
  if(k<=a){
  	cout<<1<<endl;
    return 0;
  }
  
  if(a<=b){
  	cout<<-1<<endl;
    return 0;
  }
  cout<<(k-b-1)/(a-b)*2+1<<endl;  
  return 0;
}


Measured memory_bytes: 256
a,b,h,m = map(int, input().split())
import math
c = 30*h+0.5*m
d = 6*m
e = min(360-abs(c-d),abs(c-d))
a2 = a*a
b2 = b*b
c2 = 2*a*b*math.cos(math.radians(e))
ans = math.sqrt(a2+b2-c2)
print(ans)

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


int main(){
    ll n;cin>>n;
    ll a[100010],sum[100010];
    rep(i,0,n)cin>>a[i];
    sum[0]=a[0];
    rep(i,1,n)sum[i]=sum[i-1]+a[i];
    bool st=sum[0]>0,ng=0;
    rep(i,1,n){
        if(st&&sum[i]<0)st=0;
        else if(!st&&sum[i]>0)st=1;
        else ng=1;
    }
    if(!ng){
        cout<<0<<endl;
        return 0;
    }
    ll an=0,pl=0;
    if(sum[0]==0){
        an++;pl++;
    }
    if(sum[0]<0){
        an+=abs(sum[0])+1;
        pl+=abs(sum[0])+1;
    }
    rep(i,1,n){
        if(i%2==0&&sum[i]+pl<=0){
            an+=abs(sum[i]+pl)+1;
            pl+=abs(sum[i]+pl)+1;
        }
        if(i%2==1&&sum[i]+pl>=0){
            an+=sum[i]+pl+1;
            pl-=sum[i]+pl+1;
        }
    }
    ll MN=an;

    an=0;pl=0;
    if(sum[0]==0){
        an++;pl--;
    }
    if(sum[0]>0){
        an+=abs(sum[0])+1;
        pl-=sum[0]+1;
    }
    rep(i,1,n){
        if(i%2==1&&sum[i]+pl<=0){
            an+=abs(sum[i]+pl)+1;
            pl+=abs(sum[i]+pl)+1;
        }
        if(i%2==0&&sum[i]+pl>=0){
            an+=sum[i]+pl+1;
            pl-=sum[i]+pl+1;
        }
    }
    MN=min(MN,an);
    cout<<MN<<endl;
}

    









Measured memory_bytes: 1792
n,y=map(int,input().split())
y//=1000
A=-1
B=-1
C=-1
for a in range(n+1):
  b=(y-n-9*a)/4
  if b==round(b) and b>=0:
    b=int(b)
    c=n-a-b
    if c>=0:
      A=a
      B=b
      C=c
      break
print(A,B,C)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  string a,b,c;
  int l,m;
  cin >> a >> b >> c;
  l = a.size();
  m = b.size();
  if(a.at(l-1)==b.at(0)&&b.at(m-1)==c.at(0)){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    char str[100];
    cin >> str;
    if(str[0]=='S')
    {
        cout<<"Cloudy";
    }
    if(str[0]=='C')
    {
        cout<<"Rainy";
    }
    if(str[0]=='R')
    {
        cout<<"Sunny";
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
	int a, b;
	scanf("%d %d", &a, &b);
	char result[3] = "==";
	if (a > b) strcpy(result, ">");
	else if (a < b) strcpy(result, "<");
	printf("a %s b\n", result);
	return 0;
}


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

#define int long long

signed main() {
    int N;
    cin >> N;
    vector<int> v(N);

    for (int i = 0 ;i < N; i++) cin >> v[i];
    sort(v.rbegin(), v.rend());
    int cnt = 0;
    int s = 1;
    for (int i = 0; i < N - 1; i++) {
        if (v[i] == v[i + 1]) {
            s *= v[i];
            cnt ++;
            if (cnt >= 2) {
                cout << s << endl;
                return 0;
            }
            i++;
        }
    }
    cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 1024
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FScanner sc = new FScanner();

		long N = sc.nextInt();
		long[] A = new long[(int) (N + 1)];
		long[] B = new long[(int) N];
		for (int i = 0; i < N + 1; i++) {
			A[i] = sc.nextLong();
		}
		for (int i = 0; i < N; i++) {
			B[i] = sc.nextLong();
		}
		long cnt = 0;
		for (int i = 0; i < N; i++) {
			if (A[i] < B[i]) {
				cnt += A[i];
				B[i] -= A[i];
				A[i] = 0;
			} else {
				cnt += B[i];
				A[i] -= B[i];
				B[i] = 0;
			}
			if (A[i + 1] < B[i]) {
				cnt += A[i + 1];
				B[i] -= A[i + 1];
				A[i + 1] = 0;
			} else {
				cnt += B[i];
				A[i + 1] -= B[i];
				B[i] = 0;
			}
		}
		System.out.println(cnt);
	}

}

class FScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

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

using namespace std;

int main(){
  int a[3];
  int k;

  cin >> a[0] >> a[1] >> a[2];

  cin >> k;

  sort(a,a+3);

  for(int i=0;i < k;i++)
    { 
      a[2] *= 2;
    }
  cout << a[0]+a[1]+a[2] << endl;
  return 0;
}
  

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

int main() {
    ll n;
    cin>>n;
    ll x = n;
    string s = "";
    while(x > 0)
    {
        ll rem = x % 26;  
        if (rem == 0) { 
            s += 'z'; 
            x = (x / 26) - 1; 
        } 
        else
        { 
            s += (rem - 1) + 'a'; 
            x = x / 26; 
        } 
    }
    reverse(s.begin(), s.end());
    cout<<s<<endl;
    return 0;
}

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

int main() {
  int n,m;
cin>>n>>m;
vector<int> a(n);
for(int i=0;i<n;i++) cin>>a.at(i);
double sum=0;
for(int i=0;i<n;i++) sum+=a.at(i);
sort(a.begin(),a.end());
int x=0;
for(int i=0;i<n;i++){
  if(a.at(n-i-1)>=sum/(4*m)){
    x++;
  }
}
if(x>=m) cout<<"Yes";
else cout<<"No";
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //cout << "Hello world"<<"\n";
    string s,t;
    cin >> s >> t;
    vector<int> ans;
    size_t rng = s.size() - t.size();
    for(size_t i = 0;i<=rng;i++)
    {
        int counter = 0;
        for(size_t j = 0;j<t.size();j++)
        {
            if( t[j]!=s[i+j] )
                counter++;
        }
        ans.push_back(counter);
    }
    sort(ans.begin(),ans.end());
    cout << ans[0] << endl;
}

Measured memory_bytes: 3588
import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class Main {
    public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String input = br.readLine();
      String[] split = input.split(" ");
        int n = Integer.parseInt(split[0]);
        int k = Integer.parseInt(split[1]);
      int[] n1 = new int[n];
      String a = br.readLine();
      String[] split1 = a.split(" ");
      BigInteger count =BigInteger.ZERO;
      
      for(int i=0;i<n;i++){
        n1[i]= Integer.parseInt(split1[i]);
      }
       if(n<=k){
    	   System.out.println(count);
      } else {
      Arrays.sort(n1);
     
     for(int x=0;x<n1.length-k;x++){
       count= count.add(BigInteger.valueOf(n1[x]));
     }
     System.out.println(count);
      }
     
         
    
     
    
}
}


Measured memory_bytes: 77432
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int32_t main()

{
    IOS;
  long long int n,j,k,m,x,i,sum=0;
  cin>>n>>m;
  priority_queue <int> pq;
  for(j=0;j<n;j++)
  {
    cin>>k;
      pq.push(k);
  }
  while(m--)
  { 
    x=pq.top();
    pq.pop();
    pq.push(x/2);
      
  }
  for(i=0;i<n;i++)
  {
    sum+=pq.top();
    pq.pop();
  }
  cout<<sum;

return 0;
}

Measured memory_bytes: 892
n = int(input())
arr = [1]*n
ans = 1
for i in range(2,n+1):
    if arr[i-1] == 1:
        x = 2*i
        while x <= n:
            r = x
            cou = 0
            while r%i==0:
                cou += 1
                r //= i
            arr[x-1]*=(cou+1)
            x += i
    ans += (arr[i-1]+(arr[i-1]==1))*i
print(ans)

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

int main(){
    int n, m, ans=0; cin >> n >> m;
    vector<int> fav(m, 0);
    for(int i = 0; i < n; i++){
         int k; cin >> k;
         for(int j = 0; j < k; j++){
            int spec; cin >> spec;
            fav[spec-1]++; 
         }
    }
    for(int i = 0; i < m; i++) if(fav[i]==n) ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int n, x;
  cin >> n >> x;
  int minm = 1000;
  int m;
  int sum;
  int c = 0;
  for (int i = 0; i < n; i++) {
    cin >> m;
    sum += m;
    c++;
    minm = min(minm, m);
  }
  int r = x - sum;
  int ans = c + r / minm;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3180
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N;
	cin >> N;
	++N;
	vector<int> T(N),X(N),Y(N);
	T[0] = 0;
	X[0] = 0;
	Y[0] = 0;
	for(int i=1;i<N;++i){
		cin >>T[i]>>X[i]>>Y[i];
	}
	for(int i=0;i<N-1;++i){
		int time = T[i+1]-T[i];
		int res = abs(X[i+1]-X[i])+abs(Y[i+1]-Y[i]);
		if( res > time ){
			cout << "No" << endl;
			return;
		}
		int ama = time-res;
		if( ama&1 ){
			cout << "No" << endl;
			return;
		}
	}
	cout << "Yes" << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define  lowbit(x) (x&(-x))
#define  ll long long
#define  ull unsigned long long
#define  max(a,b) (a>b?a:b)
#define  min(a,b) (a>b?b:a)
#define  PI acos(-1.0)
#define  fir first
#define  sec second
#define  SZ(x) (x.size())
#define  inf 0x3f3f3f3f
#define  PB push_back
#define  MP make_pair
#define  all(x) (x).begin(),(x).end()
#define  PII pair<int,int>
#define  E 2.7182818284590452353602874713527
using namespace std;

/**********************************************Head-----Template****************************************/
bool Finish_read;
template<class T>inline void read(T &x){Finish_read=0;x=0;int f=1;char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;if(ch==EOF)return;ch=getchar();}while(isdigit(ch))x=x*10+ch-'0',ch=getchar();x*=f;Finish_read=1;}
template<class T>inline void print(T x){if(x/10!=0)print(x/10);putchar(x%10+'0');}
template<class T>inline void writeln(T x){if(x<0)putchar('-');x=abs(x);print(x);putchar('\n');}
template<class T>inline void write(T x){if(x<0)putchar('-');x=abs(x);print(x);}
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
//const ll mod = 10000019;
//const ll phi_mod_prime=mod-1;
ll ksm(ll a,ll b,ll mod){ll ans=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1) ans=ans*a%mod;a=a*a%mod;}return ans;}
ll phi(ll n){ ll rea=n;for(ll i=2;i*i<=n;i++){if(n%i==0){ rea=rea-rea/i;while(n%i==0) n/=i;}}if(n>1) rea=rea-rea/n;return rea;}
//a^(b%modhi(mod)+phi(mod))%mod;
void exgcd(int a,int b,int &x,int &y,int &d){if(!b){x=1;y=0;d=a;}else exgcd(b,a%b,y,x,d),y-=a/b*x;}
inline int inv(int a,int mod){int x,y,d;exgcd(a,mod,x,y,d);x=(x%mod+mod)%mod;return x;}
/********************************Head----Template**********************************************/


int main(){
    int a,b;cin>>
    a>>b;
    if(a<b) cout<<0<<endl;
    else cout<<10;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto x:v)cerr<<x<<' ';cerr<<endl;
#define INF 1000000007
#define LINF 1000000000000000007
#define EPS 1e-9
typedef long long ll;

//データ数 < 2^(log2n)
constexpr ll log2n = 20;
constexpr ll sizeofn = 1 << log2n+1;
ll SegmentTree[sizeofn];
ll STconvert(ll i,ll j){
  return (1<<log2n)/(j-i+1) + i/(j-i+1);
}

ll STmerge(ll i,ll j){
  return min(i,j);
}

ll STquery(ll i,ll j){
  if(i > j)swap(i,j);
  REP(rep,0,log2n+1){
    ll p = 1 << rep;
    if(i%p == 0 && i+p-1 < j){
      return STmerge(STquery(i+p,j),SegmentTree[STconvert(i,i+p-1)]);
    }
    else if(i%p == 0 && i+p-1 <= j){
      return SegmentTree[STconvert(i,j)];
    }
  }
}

void STchange(ll i,ll j){
  SegmentTree[STconvert(i,i)] = j;
  FOR(rep,1,log2n+1){
    ll p = 1 << rep;
    SegmentTree[STconvert(i/p*p,i/p*p+p-1)] = STmerge(SegmentTree[STconvert(i/p*p,i/p*p+p/2-1)],SegmentTree[STconvert(i/p*p+p/2,i/p*p+p-1)]);
  }
}

signed main(){
  int n,m,s,t;
  cin >> n >> m >> s >> t;
  s--;
  t--;
  vector<vector<pair<ll,ll>>> sunuke(n),yen(n);
  int u,v,a,b;
  FOR(i,0,m){
    cin >> u >> v >> a >> b;
    u--;
    v--;
    yen[u].pb(make_pair(v,a));
    yen[v].pb(make_pair(u,a));
    sunuke[u].pb(make_pair(v,b));
    sunuke[v].pb(make_pair(u,b));
  }
  ll dminy[n],dmins[n];
  FOR(i,0,n){
    dminy[i] = -1;
    dmins[i] = -1;
  }
  int counter = 0;
  priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>> pque,pque2;
  pque.push(make_pair(0,s));
  while(pque.size() && counter < n){
    pair<ll,ll> p = pque.top();
    pque.pop();
    if(dminy[p.second] == -1){
      dminy[p.second] = p.first;
      counter++;
      for(auto x:yen[p.second]){
        if(dminy[x.first] == -1)pque.push(make_pair(dminy[p.second]+x.second,x.first));
      }
    }
  }
  counter = 0;
  pque2.push(make_pair(0,t));
  while(pque2.size() && counter < n){
    pair<ll,ll> p = pque2.top();
    pque2.pop();
    if(dmins[p.second] == -1){
      dmins[p.second] = p.first;
      counter++;
      for(auto x:sunuke[p.second]){
        if(dmins[x.first] == -1)pque2.push(make_pair(dmins[p.second]+x.second,x.first));
      }
    }
  }
  fill(SegmentTree,SegmentTree+sizeofn,LINF);
  FOR(i,0,n){
    STchange(i,dminy[i]+dmins[i]);
  }
  FOR(i,0,n){
    cout << (ll)1e15-STquery(i,n) << endl;
  }
}

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

int main(){
  int b[3][3];
  bool f[3][3];
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      cin >> b[i][j];
      f[i][j] = false;
    }
  }
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
    int a;
    cin >> a;
    for(int k = 0; k < 3; k++){
      for(int l = 0; l < 3; l++){
        if(a == b[k][l]){
          f[k][l] = true;
        }
      }
    }
  }
  if((f[0][0]&&f[0][1]&&f[0][2])||(f[1][0]&&f[1][1]&&f[1][2])||(f[2][0]&&f[2][1]&&f[2][2])
     ||(f[0][0]&&f[1][0]&&f[2][0])||(f[0][1]&&f[1][1]&&f[2][1])||(f[0][2]&&f[1][2]&&f[2][2])
    ||(f[0][0]&&f[1][1]&&f[2][2])||(f[2][0]&&f[1][1]&&f[0][2])){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3560
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <ctime>
using namespace std;

void solve()
{
    int N,K; cin >> N >> K;
    map<int,int> M;
    for (int i = 0; i < N; ++i){
        int a; cin >> a;
        M[a]++;
    }

    vector<int> Mvalue;
    for(auto m: M) Mvalue.emplace_back(m.second);
    sort(Mvalue.begin(),Mvalue.end());

    int ans = M.size() - K;
    if (ans <= 0) cout << 0 << endl;
    else {
        int sum = 0;
        for (int i = 0; i < ans; ++i) sum += Mvalue[i];
        cout << sum << endl;
    }
}

int main()
{
    cin.tie();
    ios::sync_with_stdio(false);
    // int ti = clock();
    // input();
    solve();
    // printf("Execution Time: %.4lf sec\n", 1.0 * (clock() - ti) / CLOCKS_PER_SEC);
    return 0;
}

Measured memory_bytes: 13588
#include"bits/stdc++.h"

#define rep(i, N) for(int i = 0;i < N;i++)

using namespace std;

class Node {
public:
	int id;
	vector<int> adj;
	int H;
	Node(int id, int H) {
		Node::id = id;
		Node::H = H;
	}
};

int main(void) {
	int N, M;
	int count = 0;
	vector<Node> nodes;
	vector<bool> will_search;

	cin >> N >> M;

	rep(i, N) {
		int H;
		cin >> H;
		nodes.push_back(Node(i, H));
		will_search.push_back(true);
	}
	rep(i, M) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		nodes[a].adj.push_back(b);
		nodes[b].adj.push_back(a);
	}

	rep(i, N) {
		if (!will_search[i]) continue;

		bool is_good = true;
		rep(j, nodes[i].adj.size()) {
			if (nodes[nodes[i].adj[j]].H >= nodes[i].H) {
				is_good = false;
				break;
			}
		}

		if (is_good) {
			count++;
			rep(j, nodes[i].adj.size())will_search[nodes[i].adj[j]] = false;
		}
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 9964
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int a, b;
	cin >> a>> b;
	if (a < b)
	{
		for (int i = 0; i < b; i++)
			cout << a;
	}
	else
	{
		for (int i = 0; i < a; i++)
			cout << b;
	}


	return 0;
}

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

int main() {
    int R[200000], n;

    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> R[i];
    }
    int maxv = -2000000000;
    int minv = R[0];
    for(int i = 1; i < n; i++) {
        maxv = max(maxv, R[i] - minv);
        minv = min(minv, R[i]);
    }
    cout << maxv << endl;

    return 0;
}



Measured memory_bytes: 3900