akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
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; }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	string S, T; cin >> S >> T;
	int res = 0;
	REP(i,S.size()) {
		if (S[i] != T[i]) {
			++res;
		}
	}
	cout << res << endl;
}

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


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

using namespace std;
typedef long long ll;
#define all(v) ((v).begin()),((v).end())
#define clr(a, b)memset(a,b,sizeof(a))
#define sz(a) (int)(a).size()
#define el '\n';
#define loop(i, n) for(int i = 0;i < int(n);i++)
#define PI acos(-1)
#define pb push_back
#define F first
#define S second

void LOL() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
}

bool comp(double a, double b) {
    return abs(a - b) < 1e-9;
}

int LCM(int a, int b) {
    return a * b / (__gcd(a, b));
}

bool sortbysec(const pair<int, int> &a,
               const pair<int, int> &b) {
    return (a.second < b.second);
}

const int N = 1e6 + 7, E = 1e5 + 5, OO = 0x3f3f3f3f;
ll arr[N];

int main() {
    LOL();
    int t = 1;
    //cin >> t;
    while (t--) {
        ll a,b,c,k,ans=0;
        cin>>a>>b>>c>>k;
        if(a<k)ans+=a,k-=a;
        else return cout<<k,0;
        k-=b;
        if(k<=0)cout<<ans;
        else{
            cout<<ans-k;
        }

    }
    return 0;
}


// CHECK THE FOLLOWING ONE MORE TIME BEFORE SUBMIT :
// the vector,arr,etc is redefined in multi cases
// the constraint N M OO etc ,,, The size of the array,vector etc
// the data type of variables ,,, int is enough ?
// the complexity of the code ? O(n)? O(n*n)? will fit ?
// Out of bond ? access an element out of size ? i-1>0 ? i+1 <n?
// CHECK ONE MORE TIME, IT'S OK TO GET WA,BUT NOT OK TO GET TLE OR RTE

Measured memory_bytes: 3688
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <deque>
#include <list>
#include <sys/timeb.h>
#include <fstream>
#include <set>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;


bool pairCompare(const Pi& firstElof, const Pi& secondElof)
{
	return firstElof.second > secondElof.second;
}

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

	int n, m;
	cin >> n >> m;
	vector<pair<ll, ll>> t;
	rep(i, n) {
		ll a, b;
		cin >> a >> b;
		t.push_back(mp(a, b));
	}
	sort(all(t));
	ll ans = 0;
	ll cnt = 0;
	int idx = 0;
	while (cnt != m) {
		if (t[idx].second > m - cnt) {
			ans += t[idx].first * (m - cnt);
			cnt = m;
		}
		else {
			ans += t[idx].first * t[idx].second;
			cnt += t[idx].second;
		}
		idx++;
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

struct ST {
  int dst;
  int i;
};

int N;
vector<ST> G[100005];
int mx;
int color[100005];

void dfs(int v, int pv, int c){
  int cc = 1;
  if(cc == c) cc++;
  rep(i,G[v].size()){
    if(G[v][i].dst == pv) continue;
    int nv = G[v][i].dst;
    int ni = G[v][i].i;
    color[ni] = cc;
    cc++;
    if(cc == c) cc++;
    dfs(nv, v, color[ni]);
  }
}

int main(){
  cin >> N;
  rep(i,N-1){
    int a, b;
    cin >> a >> b;
    G[a].push_back((ST){b,i});
    G[b].push_back((ST){a,i});
  }

  rep(i,100005) color[i] = -1;
  
  mx = 0;
  REP(i,1,N+1){
    mx = max(mx, (int)(G[i].size()));
  }

  dfs(1, -1, -1);

  cout << mx << endl;
  rep(i,N-1){
    cout << color[i] << endl;
  }
  
  return 0;
}


Measured memory_bytes: 9472
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;
ll const N_MAX = 100005;
ll M[N_MAX];

int main() {
  ll N;
  cin >> N;
  vector<ll> A(N);
  map<ll, ll> m;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    m[A[i]]++;
  }
  ll sum = 0;
  ll cnt = 0;
  for (const auto& [k, v] : m) {
    sum += v - 1;
    cnt++;
  }
  ll ans;
  if (N == 3) {
    ans = cnt;
  } else {
    if (sum % 2 == 0) {
      ans = cnt;
    } else {
      ans = cnt - 1;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 10180
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if (a < b) {
            if (b < c) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 26088
#include <string>
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <iomanip>


using namespace std;

typedef unsigned long long ull;
int main(void) {
	ull d = 100000;
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		d = d * 105 / 100;
		if(d % 1000 != 0)
			d += 1000 - d % 1000;
	}
	cout << d << endl;
}

Measured memory_bytes: 0
#include  <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 1000000007
//vector<vector<int>> vec(縦, vector<int>(横));
#define REP(i,N) for(int i=0;i<N;i++)
int gcd(int a, int b) {
    if(a>b){
        swap(a,b);
        }
    while(b%a!=0){
        b%=a;
        swap(a,b);
    }
    return a;
}

//cout << setprecision(123)<<ans;
//a=atoi(S.c_str());
//S=to_string(a);
int main(){
  int n,ans;
  cin>>n;
  if(n%2==0)ans=n/2-1;
  else ans=n/2;
  
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>

#define MAX 100000
int parent(int i) {return i / 2;}
int left(int i) {return 2 * i;}
int right(int i) {return 2 * i +1;}

int main() {
    int H, i, A[MAX+1];
    std::cin >> H;
    for (int i = 1; i <= H; i++)  {
        std::cin >> A[i];
    }
    for (int i = 1; i <=H; i++) {
        std::cout << "node " << i << ": key = " << A[i] << ", ";
        if (parent(i) >= 1) {std::cout << "parent key = " << A[parent(i)] << ", ";}
        if (left(i) <= H) {std::cout << "left key = " << A[left(i)] << ", ";}
        if (right(i) <= H) {std::cout << "right key = " << A[right(i)] << ", ";}
        std::cout << std::endl;
    }
    return 0;
}


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

typedef long long ll;

int main() {
    string S, T;
    cin >> S >> T;
    bool check = true;
    for (int i = 0; i < S.size(); i++) {
        if (S[i] != T[i]) {
            check = false;
            break;
        }
    }
    if (check) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 10e7+9
#define MOD 1000000007
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int n, k;
int w[100100];

bool C(int mid){
	int sum = 0, cnt = 1;
	for (int i = 0; i < n; i++){
		if (w[i] > mid)return false;
		if (sum + w[i] > mid){
			sum = w[i];
			cnt++;
		}
		else{
			sum += w[i];
		}
	}
	if (cnt > k)return false;
	return true;
}

int main(){
	int r = 0, l = 1000100000;
	cin >> n >> k;
	REP(i, n){
		cin >> w[i];
	}
	while (l - r >= 1){
		int mid = (r + l) / 2;
		if (C(mid)){
			l = mid;
		}
		else{
			r = mid + 1;
		}
		//cout << r << " " << l << endl;
	}
	cout << r << endl;
}

Measured memory_bytes: 3472
L, R = map(int, input().split())
M = 2019


def solve():
    if (R - L) > M:
        return 0

    ans = M
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            ans = min((i * j) % M, ans)
    return ans


print(solve())


Measured memory_bytes: 2940
H, W = gets.split.map(&:to_i)
board = H.times.map { gets.chomp.chars }
H.times do |i|
  W.times do |j|
    next unless board[i][j] == '#'
    is_ok = (i == 0 || board[i - 1][j] == '#') ||
      (i == H - 1 || board[i + 1][j] == '#') ||
      (j == 0 || board[i][j - 1] == '#') ||
      (j == W - 1 || board[i][j + 1] == '#')
    unless is_ok
      puts 'No'
      exit 0
    end
  end
end
puts 'Yes'


Measured memory_bytes: 1916
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------
 
#![allow(unused_imports)]
#![allow(non_snake_case)]
 
use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
 
/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}
 
/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}
 
/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
 
    #[allow(deprecated)]
    buf.trim_right().to_owned()
}
 
// -----------------------------------------------
// Solution
// -----------------------------------------------
 
use std::ascii::AsciiExt;
 
fn main() {
    //let (_, K) = read!(usize, usize);
    let mut S = rl().chars().collect::<Vec<_>>();
    let mut count = 0i32;
    for item in S {
        if item == 'x' {
            //println!("{}", item);
            count += 1;
        }
    }
    
    if count > 7 {
        println!("{}", "NO");
    }
    else{
        println!("{}","YES");
    }
    //S[K - 1].make_ascii_lowercase();
    //println!("{}", S.into_iter().collect::<String>())
}

Measured memory_bytes: 4352
#include <iostream>
#include <string>

using namespace std;
typedef long long ll;

int main(){
    ll x = 0, ans = 0;
    ll n;
    cin >> n;
    string s;
    cin >> s;
    for(char c : s){
        if(c == 'I'){
            x++;
        }else{
            x--;
        }
        ans = max(ans, x);
    }
    ans = max(ans, x);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cctype>
#define INF 1000000000
using namespace std;
bool debug=false;

int main(){
  int a,b,h;
  cin>>a>>b>>h;
  cout<<(a+b)*h/2<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String[] ABC = { scanner.next(), scanner.next(), scanner.next() };
		Arrays.sort(ABC, Comparator.reverseOrder());
		System.out.println(Integer.valueOf(ABC[0] + ABC[1]) + Integer.valueOf(ABC[2]));
		scanner.close();
	}
}

Measured memory_bytes: 22740
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

namespace templates{
  ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
      if(b&1)res = res * x % MOD;
      x = x * x % MOD;
      b>>=1;
    }
    return res;
  }

  ll modinv(ll x){
    return modpow(x, MOD-2);
  }

  bool was_output = false;
  template<class t>
  void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
  }
  void outendl(){
    was_output = false;
    cout << endl;
  }
  ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
  }

  template<class t>
  istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
  }

  template<class t, class u>
  istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
  }

  template<class t>
  void in(t&x){
    cin >> x;
  }

  template<class t>
  t in(){
    t res; cin >> res; return res;
  }

  template<class t>
  void out(t x){
    cout << x;
  }

  template<class t>
  vector<t> sorted(vector<t> line,function<bool(t,t)> comp=[](t a,t b){return a<b;}){
    sort(line.begin(),line.end(),comp);
    return line;
  }

  template<class t>
  vector<t> reversed(vector<t> line){
    reverse(line.begin(),line.end());
    return line;
  }
}

using namespace templates;

vector<int> chars2nums(){
  string str  = in<string>();
  vector<int> res;
  foreach(i,str){
    res.emplace_back(i%3);
  }
  return res;
}

int main(){
  int n = in();
  vector<int> nums = chars2nums();
  ll ans = 1;
  auto count =
    [&](int num){
      int res = 0;
      foreach(i,nums)if(i==num)++res;
      return res;
    };
  rep(i,3)ans *= count(i);
  rep(i,n){
    rep(j,1,min(i,n-i-1)+1){
      if(nums[i]!=nums[i-j] and nums[i]!=nums[i+j] and nums[i-j] != nums[i+j])--ans;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end())
#define vecmin(A) *min_element(A.begin(),A.end())
#define vecmax(A) *max_element(A.begin(),A.end())
typedef long long ll;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int ans = 1000000000;
  for(int i = -100;i<=100;i++){
    int sub_ans = 0;
    rep(j,n){
      sub_ans += (i - a[j])*(i - a[j]);
    }//j
    ans = min(sub_ans,ans);
  }//i
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using std::cout;
using std::cin;
using std::endl;

int main()
{
	int x, y;
	while (true)
	{
		cin >> x >> y;
		if (x == 0 && y== 0) break;
		else
		{
			if (x > y) cout << y << " " << x << endl;
			else cout << x << " " << y << endl;
		}
	}
	return 0;
}

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

#define int long long
#define endl "\n"
#define Endl "\n"
#define in(n) int n;cin>>n;
#define take(v,n) vector<int> v(n);for(int i=0;i<n;i++)cin>>v[i];
#define print(v,n) for(int i=0;i<n;i++)cout<<v[i]<<" ";cout<<endl;
#define all(v) v.begin(), v.end()


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

void solve()
{
	string s;
	cin >> s;
	int sum = 0;
	int n = s.size();
	for (int i = 0; i < n; i++)
	{
		sum += (s[i] - '0');
	}
	if (sum % 9 == 0)cout << "Yes\n";
	else cout << "No\n";
}

int32_t main()
{
	// fastio();
	// int t;cin>>t;
	// while(t--)
	solve();
	return 0;
}

Measured memory_bytes: 3724
/**
SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAjRXBpYiMraXh4bWl6bWJwI2J3I1BxYSNrem1pYmN6bWEjSWEsI0ptbnd6bSN3eiNJbmJteiN3eiNKbXBxdmwjYnBtdTEjVnd6I2FwaXR0I2JwbXwja3d1eGlhYSNJY29wYiN3biNwcWEjc3Z3ZXRtbG9tI017a214YiNpYSNQbSNlcXR0bWJwMSNQcWEjYnB6d3ZtI2x3YnAjbXtibXZsI1dkbXojYnBtI3BtaWRtdmEjSXZsI3d2I21pemJwLyNpdmwjUG0jbm1tdG1icCNWdyNuaWJxb2NtI3F2I29jaXpscXZvI0l2bCN4em1hbXpkcXZvI2JwbXUvI053eiNQbSNxYSNicG0jVXdhYiNQcW9wMSNCcG0jQWN4em11bSMrcXYjb3R3enwsMQ==
*/
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>

#define F first
#define S second
#define endl '\n'
#define deb(x) cout<<#x<<' '<<x<<endl;
#define pb push_back

/*
#ifdef IZI_KATKA
#define int __int64_t
#else
#define int __int64
#endif
*/

const long long MOD = 1e9 + 7;
const long long MAXN = 1e6 + 1;
using namespace std;

typedef long long ll;

long long readInt() {
    bool minus1 = false;
    long long result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus1 = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus1)
        return -result;
    else
        return result;
}

int a[MAXN];
int pos[MAXN];

int main() {
	#ifdef IZI_KATKA
	assert(freopen("input", "r", stdin));
    assert(freopen("output", "w", stdout));
    #endif
    int n = readInt();
    for (int i = 1; i <= n; i++) {
		a[i] = readInt();    
    	pos[a[i]] = i;
    }
    int ans = 1;
    int kek = 1;
    for (int i = 2; i <= n; i++) {
    	if (pos[i] > pos[i - 1]) {
        	kek ++; 	
        } else {
        	kek = 1;
        }
        ans = max(ans, kek);
    }
    cout << n - ans;
    return 0;
}

Measured memory_bytes: 5120
N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
s = set()
U = []
ans = 0
for a in A:
    if a in s:
        U.append(a)
        if len(U) >= 2:
            ans = U[0]*U[1]
            break
        s.remove(a)
    else:
        s.add(a)
print(ans)


Measured memory_bytes: 62704
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
#define itn int
#define all(c) c.begin(),c.end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#define ll long long
#define ull unsigned long long
#define pll pair<ll, ll>
#define pii pair<int, int>
#define mp(x, y) make_pair(x, y)
using namespace std;
 
const ll MAX_N = 2e5 + 5, inf = 1e18, mod = 1000000007;
const double PI = 3.1415926536;
int days[13] = {0, 31, 28, 31, 30, 31,30, 31, 31, 30, 31, 30, 31};
 
template<typename T>
ostream& operator <<(ostream& out, const vector<T>& mas) {
    for (const auto& x : mas) {
        out << x << ' ';
    }
    return out;
}
 
void ok() {
    cout << "Yes" << '\n';
}
 
void no() {
    cout << "No" << '\n';
}
 
inline ll nxt() {
    ll x;
    cin >> x;
    return x;
} 
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    ll n = nxt(), a = nxt(), b = nxt();
    ll sum = a + b;
    ll x = n / sum;
    ll ans = x * a + min(n % sum, a);
    cout << ans;
    return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int A, B, C, D, E, K;
	cin >> A >> B >> C >> D >> E >> K;

	if (E - A <= K) co("Yay!");
	else co(":(");

	Would you please return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  
  int min=100;
  for(int s:A){
    int count=0;
    while(s%2==0){
      s /= 2;
      count++;
    }
    if(min>count) min=count;
  }
  cout << min << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
using ll = long long;
using ii = pair<int, int>;
constexpr ll MOD = 1e9+7;

ll x[100001], y[100001];

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

	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; ++i) cin >> x[i];
	for (int i = 0; i < m; ++i) cin >> y[i];
	sort(x, x + n), sort(y, y + m);
	ll s = 0, a = 0;
	for (int i = 0; i < n; ++i) {
		s = (i * x[i] - a + s) % MOD, a = (x[i] + a) % MOD;
	}
	ll t = 0, b = 0;
	for (int i = 0; i < m; ++i) {
		t = (i * y[i] - b + t) % MOD, b = (y[i] + b) % MOD;
	}
	cout << s * t % MOD;
}

Measured memory_bytes: 5168
n = int( input() )
s = []
for i in range( n ):
    s.append( input() )

#print( s )

kind = {}

for i in range( n ):
    try:
        kind[ s[i] ] += 1
    except KeyError:
        kind[ s[i] ] = 0

print( len( kind.keys() ) )

Measured memory_bytes: 38376
#include <cstdio>
#include <string.h>
#include <algorithm>
#include<iostream>
#include<math.h>
#include<sstream>
#include<vector>
#include<stack>
using namespace std;
#define maxn 300010

typedef long long ll;
ll mod = 998244353LL;

ll qpow(ll a,ll x){
    ll ret=1;
    while (x){
        if (x&1)
            ret = ret*a%mod;
        a=a*a%mod;
        x>>=1;
    }
    return ret;
}
ll fac[maxn],inv[maxn];
 
ll init(){
    fac[0]=1;
    for (int i=1;i<maxn;i++)
        fac[i]=fac[i-1]*i%mod;
    inv[maxn-1]=qpow(fac[maxn-1],mod-2);
    for (int i=maxn-2;i>=0;i--)
        inv[i]=inv[i+1]*(i+1)%mod;
    return 0;
}
 
ll c(ll n,ll m){
    if (n<m) return 0;
    return fac[n]*inv[m]%mod*inv[n-m]%mod;
}
int main()
{
    init();
    ll N,A,B,K;
    cin>>N>>A>>B>>K;
    ll ans=0;
    for(int i=0;i<=N;i++){
        if(K-A*i<0) continue;
        if((K-A*i)%B!=0) continue;
        ll y=(K-A*i)/B;
        if(y>N)continue;
        ans=(ans+c(N,i)*c(N,y)+mod)%mod;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4992
#define _USE_MATH_DEFINES
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <string.h>
#include <math.h>
#include <map>

using namespace std;

int main(){
	int x1, y1, x2, y2, x3, y3, x4, y4;

	cin >> x1 >> y1 >> x2 >> y2;

	x3 = x2 + y1 - y2;
	y3 = y2 - (x1 - x2);
	x4 = x1 + y1 - y2;
	y4 = y1 - (x1 - x2);

	cout << x3 << " " << y3 << " " << x4 << " " << y4 << " " << endl;

	return 0;
}

Measured memory_bytes: 256
n,m,q = map(int,input().split())
from itertools import combinations_with_replacement

a,b,c,d = [],[],[],[]
for i in range(q):
    e,f,g,h = map(int,input().split())
    a.append(e-1)
    b.append(f-1)
    c.append(g)
    d.append(h)

ans = 0
N = [i+1 for i in range(m)]

for v in combinations_with_replacement(N,n):
    num = 0
    #print(v)
    for i in range(q):
        if v[b[i]] - v[a[i]] == c[i]:
            num += d[i]
    ans = max(ans,num)
print(ans)

Measured memory_bytes: 9148
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;

char s1[100],s2[100];
bool flag;
int main()
{
    scanf("%s%s",s1,s2);
    int len1=strlen(s1),len2=strlen(s2);
    int j=0;
    for(int i=len1-1;i>=0;i--)
    {
    	if(flag) break;
    	int pos=i;
        while(s1[pos]=='?'||s1[pos]==s2[len2-1-j])
        {
        	pos--; 
            j++;
            if(j==len2)
            {
                for(int k=pos+1,l=0;l<len2;k++,l++)
                {
                    s1[k]=s2[l];
                }
                flag=1;
                break;
            }
        }
        j=0;
    }
    if(!flag)
    {
        printf("UNRESTORABLE\n");
    }
    else
    {
        for(int i=0;i<len1;i++)
        {
            if(s1[i]=='?') s1[i]='a';
        }
        printf("%s\n",s1);
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int H, W, D; cin >> H >> W >> D;
    map<int, pair<int,int>> M;
    int x = 1, y = 1;
    rep(i, H*W) {
        int j; cin >> j;
        M[j] = make_pair(x,y);
        if (++x > W) ++y, x = 1;
    }
    vector MW(H*W+1, 0);
    for (int i = 1; i <= D; i++) {
        pair p = M[i];
        MW[i] = 0;
        for (int j = i+D; j <= H*W; j+=D) {
            pair q = M[j];
            int ma = abs(p.first - q.first) + abs(p.second - q.second);
            MW[j] = MW[j-D] + ma;
            p = q;
        }
    }
    int Q; cin >> Q;
    rep(i, Q) {
        ll ma = 0;
        int L,R; cin >> L >> R;
        ma += MW[R] - MW[L];
        cout << ma << endl;
    }
}


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

int main() {
  long  k, a, b;
  cin >> k >> a >> b;
  long ans = 1;
  if (a + 3 > b) {
    ans += k;
  }
  else {
    if (k - 2 < a - 1) {
      ans += k;
    }
    else {
      k -= a + 1;
      ans = b;
      while (k > 1) {
        k -= 2;
        ans += b - a;
      }
      ans += k;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a) for(int i=0;i<(int)a;i++)
#define zero(x) memset(x, 0, sizeof x)
typedef long long ll;
int const MOD = 1e9+7;
int const inf = 1<<29;

int main() {
 
  int N; cin >> N;
  int A[N], B[N];
  rep(i, N) cin >> A[i];
  rep(i, N) cin >> B[i];
 
  int L = -inf;
  int pat[N]; zero(pat);
  rep(i, N) if(L < A[i]) pat[i] = 1, L = A[i];
 
  int R = -inf;
  for(int i=N-1; i>=0; i--) {
    if(R < B[i]) {
      if(pat[i] && A[i] != B[i]) { cout << 0 << endl; exit(0); }
      pat[i] = 1, R = B[i];
    } else {
      if(pat[i] && A[i] > B[i]) { cout << 0 << endl; exit(0); }      
    }
  }
 
  ll ans = 1;
  rep(i, N) {
    if(!pat[i]) pat[i] = min(A[i], B[i]);
    (ans *= pat[i]) %= MOD;
  }
 
  cout << ans << endl;
  
  return 0;
}

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

typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    vector<int>v;
    for(int i=0; i<n; i++)
    {
        int a;
        cin>>a;
        v.push_back(a);
    }
    sort(v.begin(),v.end());
    ll sum_a=0,sum_b=0;
    for(int i=n-1,j=n-2;; i-=2,j-=2)
    {
        if(i>=0)
        {
            sum_a+=(v[i]);
        }
        if(j>=0)
        {
            sum_b+=(v[j]);
        }
        if((i<=0)&&(j<=0))
        {
            break;
        }
    }
    cout<<(sum_a)-(sum_b)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 100
#define INFTY (1<<21)
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, M[MAX][MAX];

void dijkstra() {
	int minv, i, u, v;
	int d[MAX], color[MAX];

	for (i = 0; i < n; i++) {
		d[i] = INFTY;
		color[i] = WHITE;
	}

	d[0] = 0;
	color[0] = GRAY;

	while (1) {
		minv = INFTY;
		u = -1;

		for (i = 0; i < n; i++) {
			if (minv > d[i] && color[i] != BLACK) {
				u = i;
				minv = d[i];
			}
		}

		if (u == -1) {
			break;
		}

		color[u] = BLACK;

		for (v = 0; v < n; v++) {
			if (color[v] != BLACK && M[u][v] != INFTY) {
				if (d[v] > d[u] + M[u][v]) {
					d[v] = d[u] + M[u][v];
					color[v] = GRAY;
				}
			}
		}
	}
	for (i = 0; i < n; i++) {
		printf("%d %d\n", i, (d[i] == INFTY ? -1 : d[i]));
	}
}

int main() {
	int i, j, k, c, u, v;

	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			M[i][j] = INFTY;
		}
	}

	for (i = 0; i < n; i++) {
		scanf("%d%d", &u, &k);

		for (j = 0; j < k; j++) {
			scanf("%d%d", &v, &c);
			M[u][v] = c;
		}
	}
	dijkstra();

	return 0;
}


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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//==================================


template <class T>
class SegmentTree {
    using Op = std::function<T(T, T)>;

private:
    const Op op;
    const T ID;
    std::vector<T> vec;
    int sz;

public:
    explicit SegmentTree(int _n, Op _op, T _identity) noexcept : op(_op), ID(_identity) {
        sz = 1;
        while (sz < _n) sz <<= 1;
        vec.resize(sz * 2, ID);
    }
    void set_value(int _idx, T _val) {
        vec[_idx + sz] = _val;
    }
    template <class RandomIt>
    void set_array(RandomIt _begin, RandomIt _end) {
        std::copy(_begin, _end, vec.begin() + sz);
    }
    void set_array(const std::vector<T>& _newvec) {
        set_array(_newvec.begin(), _newvec.end());
    }
    void build() noexcept {
        for (int i = sz - 1; i > 0; i--) {
            vec[i] = op(vec[i * 2], vec[i * 2 + 1]);
        }
    }
    void update(int _idx, T _val) {
        _idx += sz;
        vec[_idx] = _val;
        for (_idx >>= 1; _idx > 0; _idx >>= 1) {
            vec[_idx] = op(vec[_idx * 2], vec[_idx * 2 + 1]);
        }
    }
    T query(int _l, int _r) const {
        T l_val = ID, r_val = ID;
        _l += sz, _r += sz - 1;
        for (; _l <= _r; _l >>= 1, _r >>= 1) {
            if (_l & 1) l_val = op(l_val, vec[_l++]);
            if (!(_r & 1)) r_val = op(r_val, vec[_r--]);
        }
        return op(l_val, r_val);
    }
};

using bita = bitset<26>;

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

    ll N;
    cin >> N;
    string S;
    cin >> S;

    SegmentTree<bita> seg(N, [](bita a, bita b) { return a | b; }, 0);

    for (int i = 0; i < N; i++) {
        int d = S[i] - 'a';
        bita u;
        u[d] = true;
        seg.set_value(i, u);
    }

    seg.build();

    ll Q;
    cin >> Q;
    for (int q = 0; q < Q; q++) {
        ll a;
        cin >> a;
        if (a == 1) {
            ll b;
            char c;
            cin >> b >> c;
            --b;
            bita u;
            u[c - 'a'] = true;
            seg.update(b, u);
        }
        else {
            ll b, c;
            cin >> b >> c;
            --b;
            --c;
            bita u = seg.query(b, c + 1);
            ll ans = u.count();
            cout << ans << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 9116
#include <algorithm>
#include <cmath>
#include <iostream>
#include <deque>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <unordered_map>
#include <unordered_set>

using namespace std;

long long GetGCD(long long a, long long b)
{
	if (a < b)
	{
		swap(a, b);
	}

	while (true)
	{
		long long r = a % b;
		if (r == 0)
		{
			return b;
		}

		a = b;
		b = r;
	}
}

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

	long long gcd = GetGCD(a, b);

	long long sum = 1;

	long long rootGcd = ceil(sqrt(static_cast<double>(gcd)));

	for (long long i = 2; i <= rootGcd; ++i)
	{
		if (gcd % i == 0)
		{
			++sum;
			while (gcd % i == 0)
			{
				gcd /= i;
			}
		}
	}

	if (gcd != 1)
	{
		++sum;
	}

	cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int d=0;d<n;d++){
	int a[10]={},b[10]={},c[10]={};
	for(int i=0;i<10;i++){
		cin>>a[i];
	}
	int j=0,k=0;
	for(int i=0;i<10;i++){
		if(b[j]<a[i]){
			b[j+1]=a[i];
			j++;
		}
		else if(c[k]<a[i]){
			c[k+1]=a[i];
			k++;
		}
		else{
			cout<<"NO"<<endl;
			goto age;;
		}
	}
	cout<<"YES"<<endl;
	age:;
}
	return 0;
}



Measured memory_bytes: 3004
import * as fs from "fs";
const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split(/\n/);
const hinaArare = input[1].split(/\s/);
const ret = hinaArare.filter((val, index) => hinaArare.indexOf(val) == index);
console.log(ret.length == 3 ? "Three" : "Four");

Measured memory_bytes: 29560
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main()
{
 string s,t;
 cin>>s>>t;
 int n = t.size(),m = s.size();  //3 6
 int res = 1e9;
 for(int i = 0;i<m-n+1;i++){  //0 1 2 3
        int rem = 0;  //1
        for(int j = 0;j<n;j++){//0 1 2
            if(t[j]!= s[i+j]) rem++;

        }
        res = min(res,rem);
 }
 cout<<res<<endl;
return 0;
   
}

Measured memory_bytes: 3624
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let s = read::<String>().chars().collect::<HashSet<_>>();
    for i in 0..26 {
        let ch = std::char::from_digit(i + 10, 36).unwrap();
        if !s.contains(&ch) {
            println!("{}", ch);
            return;
        }
    }
    println!("None");
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int n,i,j,ans;
string s;
int main()
{
	cin>>n>>s;
	i=0,j=n-1;
	while(i<j)
	{
		if(s[i]=='R') ++i;
		else if(s[j]=='W') --j;
		else ++ans,++i,--j;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int x[20][20];
int y[20][20];

int main(){
  int n;
  cin >> n;
  vi a(n);
  rep(i, n){
    cin >> a[i];
    rep(j,a[i]){
      cin >> x[i][j] >> y[i][j];
    }
  }
  ll ans = 0;
  for (ll tmp = 0; tmp < (1 << n);tmp++){
    bool z = true;
    bitset<15> s(tmp);
    rep(i,n){
      if(s[i]==1){
        rep(j,a[i]){
          if(s[x[i][j]-1]!=y[i][j]){
            z = false;
            goto END;
          }
        }
      }
    }
    END:
    if(z){
      ll num = s.count();
      chmax(ans, num);
    }
  }
  print(ans);
}


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

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <map>
#include <queue>
#define mp make_pair
#define pb push_back
#define p push
#define FOR(a,c) for(int a = 0;a<c;a++)
#define ll long long
#define abs(x) (x<0 ? (-x) : x)
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d %d",&a,&b)
#define getIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define getL(a) scanf("%lld",&a)
#define getLL(a,b) scanf("%lld %lld",&a,&b)
#define getLLL(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define BEND(c) (c).begin(),(c).end()
#define fi first
#define se second
#define PI 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfi(a) printf("%d",a);
#define pfii(a,b) printf("%d%d",a,b);
#define pfl(a) printf("%lld",a);
#define pfll(a,b) printf("%lld%lld",a,b);
#define SIZE 1000000007

using namespace std;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vl;
typedef vector<pair<int,int>> vpi;
typedef vector<pair<long long,long long>> vpl;
typedef pair<int,int> pii;
typedef pair <ll,ll> pll;
const  double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MX = 200005;
/*ios_base::sync_with_stdio(false);cin.tie(0);*/






long long gcd(long long n,long long m){
    if (n==0)return m;
    return gcd(m%n,n) ;
}
int main(){
    ll a ,k;
    cin >> a>>k;
    a =gcd(a,k);

    vl vec;

    for (ll i =1;i*i <= a;i++){
        if(a%i == 0){
            vec.pb(i);
            if(i*i != a)
            vec.pb(a/i);

        }
    }
    sort(BEND(vec));
    int len = vec.size();
    vi arr_prime(len,0);
    int ans = 0;


    for(int i=0; i <len; i++){
        if(arr_prime[i])continue;
        if(vec[i]== 1)ans++;
        else {
            ans++;
            for (int j = i +1; j < len; j ++)
                if(vec[j]%vec[i]==0)
                    arr_prime[j] = 1;
        }
    }






    cout << ans;

    return 0;
}

Measured memory_bytes: 384
N,K=map(int,input().split())
l=list()
for i in range(N):
  l.append(int(input()))
l.sort()
ans=int(l[K-1])-int(l[0])
for i in range(1,N-K+1):
  key=int(l[i+K-1])-int(l[i])
  if ans>key:
    ans=key
print(ans)

Measured memory_bytes: 7384
from heapq import heappush, heappop

X, Y, Z, K = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)

cake_heap = []
for i in range(len(A)):
    if i + 1 > K:
        break
    for j in range(len(B)):
        if (i + 1) * (j + 1) > K:
            break
        for k in range(len(C)):
            if (i + 1) * (j + 1) * (k + 1) > K:
                break
            heappush(cake_heap, -(A[i] + B[j] + C[k]))
for i in range(K):
    print(-heappop(cake_heap))


Measured memory_bytes: 7828
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
int union_find[200000];
int union_search(int a) {
	if (union_find[a] == a) return a;
	return union_find[a] = union_search(union_find[a]);
}
int union_merge(int a, int b) {
	a = union_search(a);
	b = union_search(b);
	union_find[a] = b;
	return 0;
}
int main() {
	int n, k;
	cin >> n >> k;
	vector<int> a;
	REP(i, n) {
		int b;
		cin >> b;
		a.push_back(b);
	}
	for (int i = 1; i <= n; ++i) {
		union_find[i] = i;
	}
	REP(i, k) {
		int a, b;
		cin >> a >> b;
		union_merge(a, b);
	}
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		if (union_search(i + 1) == union_search(a[i]))ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1144
import java.util.Scanner;

/**
 * Main
 */
public class Main {
  public static void main(String[] args) {
    (new Main()).run();
  }

  public void run() {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    System.out.println(n * 2 * Math.PI);
  }
}

Measured memory_bytes: 35956
N = int(input())
S = [input() for i in range(N)]
ac = 0
wa = 0
tle = 0
re = 0
for i in S:
    if i=='AC':
        ac += 1
    elif i=='WA':
        wa += 1
    elif i=='TLE':
        tle += 1
    else:
        re += 1
print('AC x ' + str(ac))
print('WA x ' + str(wa))
print('TLE x ' + str(tle))
print('RE x ' + str(re))

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

int main()
{
    unsigned long a, b;
    int k;
    cin >> a >> b >> k;
    if (b-a>=2*k) {
        for (int i=0; i<k; i++) cout << a+i << endl;
        for (int i=0; i<k; i++) cout << b-k+(i+1) << endl;
    }
    else if (b-a<2*k) for (int i=a; i<=b; i++) cout << i << endl;
    return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define fo(i,n) for(int i=0;i<(n);i++)
#define inp(a) int a;cin>>a;
#define inpa(a,n)vector<int> a(n);fo(i,n)cin>>a[i];
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
using namespace std;
#define int ll
// #define MAX 20
#define INF (int)1e18

template<class T> ostream& operator<<(ostream& cout,vector<T> V)
{cout<<"[ ";for(auto v:V)cout<<v<<' ';return cout<<']';}
template<class L,class R> ostream& operator<<(ostream& cout,pair<L, R> P)
{return cout<<'('<<P.F<<','<< P.S<<')';}


signed main()
{
	fio
	inp(n)
	inpa(a,n)
	fo(i,n)
	{
		if(a[i]==0)
		{
			cout<<0<<'\n';
			return 0;
		}
	}
	int ans=1;
	fo(i,n)
	{
		// cerr<<ans<<','<<1e18/a[i]<<'\n';
		if(ans>1e18/(ld)a[i])
		{
			cout<<-1<<'\n';
			return 0;
		}
		ans*=a[i];
	}
	cout<<ans<<'\n';
	printclock;
}

Measured memory_bytes: 3972
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>


using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int N, R;
    cin >> N >> R;

    cout << R + max(0, 100 * (10 - N)) << endl;
    
}


Measured memory_bytes: 256
#include<vector>
#include<iostream>
#include<algorithm>
#include<functional>
#include<string>
#include<limits.h>
#include<cmath>
#include<queue>
#include<map>
#define rep(i,n) for (int i=0; i<n; i++)
using namespace std;
typedef long long ll;

ll gcd(ll a,ll b){
  ll r;
  while ((r=a%b)){a=b;b=r;}
  return b;
}

int main(){

 int n; cin >> n;
 vector<int> d(n); rep(i,n){cin >> d[i];}
 
  int ans=0;
  
  rep(i,n){
  	for (int j=i+1; j<n; j++){
      ans += d[i]*d[j];
    }
  }
  
  cout << ans;

  return 0;
}


Measured memory_bytes: 256
($N,$x)=glob<>;
if($x==1||$x==2*$N-1){
	print+No,$/;
	exit;
}
print+Yes,$/;
$a[$N-1]=$x;
$a[$N-2]=$x-1;
$a[$N]=$x+1;
$_[$x-1]=$_[$x+1]=$_[$x]=1;
$id=0;
$ret=1;
for(1..2*$N-4){
	$ret++while$_[$ret]>0;
	$id++while$a[$id]>0;
	$_[$ret]=1;
	$a[$id]=$ret;
}
print$_,$/for@a


Measured memory_bytes: 14976
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e16+7;
int INF2 = 1e15;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int cnt[100005];
signed main() {
    int N;
    cin >> N;
    for(int i = 1; i <= 100; i++) {
        for(int j = 1; j <= 100; j++) {
            for(int k = 1; k <= 100; k++) {
                cnt[i*i+j*j+k*k+i*j+i*k+j*k]++;
                //最大60000
            }
        }
    }
    for(int i = 1; i <= N; i++) {
        cout << cnt[i] << endl;
    }
}


Measured memory_bytes: 4064
#pragma GCC optimize("Ofast","inline","-ffast-math")
#pragma GCC target("avx,sse2,sse3,sse4,mmx")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
//#define int long long
using namespace __gnu_pbds;
using namespace std;

signed main()
{
	//ios::sync_with_stdio(false);
	int n;
	cin>>n;
	cout<<n/2+(n%2!=0)<<endl;	
	return 0;
}

Measured memory_bytes: 256