akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

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

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

ll mod_pow(ll a, ll n, ll m = mod) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

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

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }
const int max_n = 10000;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}

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


void solve() {
	ll n, k; cin >> n >> k;
	if (n > k)n %= k;
	ll ans = k;
	rep(aa, 100) {
		ans = min(ans, n);
		n = abs(n - k);
		
	}
	cout << ans << "\n";
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(7);
	//init_f();
	//init();
	//int t; cin >> t; rep(i, t)solve();
	solve();
	stop
		return 0;
}


Measured memory_bytes: 384
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        int[] a = sc.nextIntArray(n);
        int ans = 0;
        for(int i = 0; i < n; i+=2){
            if(a[i] % 2 != 0){
                ans++;
            }
        }
        System.out.println(ans);
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }
    
    public String[] nextArray(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = next();
        return a;
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


Measured memory_bytes: 25276
package main

import (
	"fmt"
	"os"
)

const (
	a = 10000
	b = 5000
	c = 1000
)

func main() {
	var n, y int
	fmt.Scan(&n)
	fmt.Scan(&y)

	for i := 0; i <= n; i++ {
		if a*i > y {
			break
		}
		for j := 0; j <= n-i; j++ {
			if a*i+b*j > y {
				break
			}
			// for k := 0; k <= n-i-j; k++ {
			// 	if a*i+b*j+c*k > y {
			// 		break
			// 	}
			// 	if i+j+k == n && i*a+j*b+k*c == y {
			// 		fmt.Printf("%d %d %d\n", i, j, k)
			// 		os.Exit(0)
			// 	}
			// }
			k := n - i - j
			if i*a+j*b+k*c == y {
				fmt.Printf("%d %d %d\n", i, j, k)
				os.Exit(0)
			}
		}
	}
	fmt.Println("-1 -1 -1")
}


Measured memory_bytes: 512
#include<stdio.h>

int main(){
	
    int h,m,s,n;
     scanf("%d",&n);
     
     h=n/3600;
     m=(n%3600)/60;
     s=(n%3600)%60;
	
	printf("%d:%d:%d\n",h,m,s);
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	return 0;
}


Measured memory_bytes: 1988
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<lint,lint> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int sum[300100],s2[300100];
int main()
{
	int n;string s;cin>>n;cin>>s;
	sum[0]=s2[n]=0;
	rep(i,n){
		sum[i+1]=sum[i];if(s[i]=='W') sum[i+1]++;
	}
	for(int i=n-1;i>=0;i--){
		s2[i]=s2[i+1];if(s[i]=='E') s2[i]++;
	}
	int out=n;
	rep(i,n) out=min(out,sum[i]+s2[i+1]);
	cout<<out<<endl;
}


Measured memory_bytes: 3076
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i = a:i<b;i++)
#define SSTR( x ) static_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str()
#define ALL(s) (s).begin(), (s).end()
using namespace std;
typedef long long unsigned int llu;
typedef long long ll;

int main (){
  int a,b;
  while (cin >> a >> b){
    if(a % 2 == 0 || b % 2 == 0)cout << "Even" << endl;
    else cout << "Odd" << endl;
  
  }
  return 0;
}


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

using namespace std;



#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define sp ' '

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<string> vstr;

vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.pb(buffer);
    }
    return v;
}

bool graph[8][8];
int dfs(int v, int n, bool visited[8]){
    bool all_visited = true;

    rep(i, n)
        if(!visited[i]) all_visited = false;
    if(all_visited) return 1;

    int ret = 0;
    rep(i, n){
        if(!graph[v][i]) continue;
        if(visited[i]) continue;

        visited[i] = true;
        ret += dfs(i, n, visited);
        visited[i] = false;
    }

    return ret;
}




int main(){

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

    int n, m;
    cin >> n >> m;
    rep(i, m){
        int a,b;
        cin >> a >> b;
        graph[a-1][b-1]=graph[b-1][a-1]=true;
    }

    bool visited[8] = {false};
    visited[0] = true;
    cout << dfs(0, n, visited) << endl;

    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 SZ(x) ((int)(x).size())
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

int dp[100][2];

signed main()
{
    int N,P; cin>>N>>P;
    vint a(N);
    REP(i,N) cin>>a[i],a[i]%=2;

    dp[0][0]=1;
    REP(i,N){
        REP(j,2){
            dp[i+1][j]+=dp[i][j];
            dp[i+1][j^a[i]]+=dp[i][j];
        }
    }
    cout<<dp[N][P]<<endl;
}


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

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

bool isEven(int i)
{
    return  !(static_cast<bool>(i % 2));
}

int main(int argc, const char * argv[]) {
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    
    vector<int> a(n);
    vector<ll> cumulative_sum(n);
    ll sum = 0;
    rep (i, n)
    {
        cin >> a[i];
        int sign = isEven(i) ? 1 : -1;
        sum += sign * a[i];
        cumulative_sum[i] = sum;
    }
    
    auto sum_left = [&](int i) {return (i ? cumulative_sum[i - 1] : 0);};
    
    rep (i, n)
    {
        int sign = isEven(i) ? 1 : -1;
        ll sum_r = cumulative_sum[n-1];
        ll sum_l = sum_left(i);
        ll rain = sign * (sum_r - sum_l) - sign * sum_l;
        printf("%d%c", (int)rain, (i == n-1 ? '\n' : ' '));
    }
    
    return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> w(n);
    for ( int i = 0; i < n; i++) {
        cin >> w.at(i);
    }
    int sum1, sum2;
    int mini = 1000000;
    for ( int i = 0; i < n; i++) {
        sum1 = 0;
        sum2 = 0;
        for (int j = 0; j <= i; j++) {
            sum1 += w.at(j);
        }
        for (int k = i + 1; k < n; k++) {
            sum2 += w.at(k);
        }
        mini = min(mini, abs(sum1 - sum2));
        if (mini == 0) goto last;
    }
    last:
    cout << mini << endl;
}

Measured memory_bytes: 256
/**
 * author:    Ziel(Maksat Sakenuly)
 * created:   28.03.2020 17:52:45
 * judge:     Atcoder
 
 * Solution for problem D
**/

// ~succesfully skatal~

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define fi first
#define se second
#define sz(x) int(x.size())
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin, x.rend()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define count1 __builtin_popcountl
#define debug(x) cerr << (#x) << " = " << (x) << "\n"
#define ACCELERATE ios_base::sync_with_stdio(false),cin.tie(nullptr)
#define fre(f) if(fopen(f".in", "r")) freopen(f".in", "r", stdin),freopen(f".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

using ll = long long;
using ull = unsigned long long;
// using big = __int128_t; // -10^38...10^38
using db = double;
using ld = long double;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;

template <class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class T>
using p_queue = priority_queue<T, vector<T>, greater<T>>;
template <class T>
inline void cmin(T &a, T b) { a = min(a, b); }
template <class T>
inline void cmax(T &a, T b) { a = max(a, b); }

const int oo = 0x3f3f3f3f;
const ll N = 2e3 + 123;
const ll MOD = 1e9 + 7;
const ll INF = 1e15 + 9;
const db EPS = 1e-9;
const db PI = acos(-1); // 3.14159265358979323846
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};

vector<vector<int>> g(N);

main() {
#ifdef ZVER
	cerr << "Ready\n";
#endif
	fre("");
	ACCELERATE;
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	
	int n, x, y;
	cin >> n >> x >> y;
	
	map<int, int> m;
	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			int dis = min({j - i, abs(x - i) + abs(y - j) + 1, abs(x - j) + abs(y - i) + 1});
			
			m[dis]++;
		}
	}
	
	for (int i = 1; i < n; i++) cout << m[i] << '\n';
	return 0;
}

// uniform_int_distribution<int>(l, r)(rng) -> random in range [l, r]
// assert(condition) -> if (condition == false) Runtime Error
// order_of_key(x) -> number of elements smaller than x
// *find_by_order(k) -> k-th element in 0-based indexation

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;

namespace easy_Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            Console.WriteLine("{0}{1}{2}",s[0],s[1],s[2]);
        }   
            // float[] ABN = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // long[] NK = Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            // long N = NK[0];
            // long K = NK[1];
            // long K = long.Parse(Console.ReadLine());
            // int[] abc = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            // string S = Console.ReadLine();
            // int x = int.Parse(Console.ReadLine());
            // int b = int.Parse(Console.ReadLine());
            // int N = int.Parse(Console.ReadLine());
            // float N = float.Parse(Console.ReadLine());
            // string c = Console.ReadLine();
            // string B = Console.ReadLine();
            // string[] s = Console.ReadLine().Split();
            // var s = (new string[] { Console.ReadLine(), Console.ReadLine(), Console.ReadLine() }).Select(float.Parse);
            // float[] a = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // var X = Console.ReadLine();
            // int[,] abcd = new int[NMQ[2],4];
            // int[] A = new int[NMQ[0]];
            // int[] A_num = new int[NMQ[0]];
            // long[] s=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            // var hs=new Dictionary<long,long>();
            // for(int i=0;i<s[0];i++){
            //     long[] q=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            //     if(hs.ContainsKey(q[0])){hs[q[0]]+=q[1];}
            //     else{hs.Add(q[0],q[1]);}
            // }
        
        // //最小公倍数
        // static long Lcm(long a, long b)
        // {
        //     return a/Gcd(a,b)*b;
        // }

        // //最大公約数
        // static long Gcd(long m, long n)
        // {
        //     if(n==0)return m;
        //     return Gcd(n,m%n);
        // }
    }
}


Measured memory_bytes: 25860
// We only fail when we stop trying
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;

const int N = 2e5 + 5;
const int Mod = 1e9 + 7;

int n, k;
vector<ll> pos, neg;

void take(ll& ans, vector<ll>& v) {
  k--;
  ans = (ans * v.back()) % Mod;
  v.pop_back();
}

ll solvePositive() {
  reverse(all(neg));
  ll ans = 1;
  while(k > 0) {
    if(k == 1) {
      take(ans, pos);
    } else {
      if(sz(neg) < 2) {
        take(ans, pos);
      } else if(sz(pos) < 2) {
        take(ans, neg);
        take(ans, neg);
      } else {
        ll ch1 = pos[sz(pos) - 1] * pos[sz(pos) - 2];
        ll ch2 = neg[sz(neg) - 1] * neg[sz(neg) - 2];
        if(ch1 >= ch2) {
          take(ans, pos);
        } else {
          take(ans, neg);
          take(ans, neg);
        }
      }
    }
  }
  ans = (ans % Mod + Mod) % Mod;
  return ans;
}

ll solveNegative() {
  reverse(all(pos));
  ll ans = 1;
  take(ans, neg);
  while(k > 0) {
    if(k == 1) {
      take(ans, pos);
    } else {
      if(sz(neg) < 2) {
        take(ans, pos);
      } else if(sz(pos) < 2) {
        take(ans, neg);
        take(ans, neg);
      } else {
        ll ch1 = pos[sz(pos) - 1] * pos[sz(pos) - 2];
        ll ch2 = neg[sz(neg) - 1] * neg[sz(neg) - 2];
        if(ch1 <= ch2) {
          take(ans, pos);
        } else {
          take(ans, neg);
          take(ans, neg);
        }
      }
    }
  }
  ans = (ans % Mod + Mod) % Mod;
  return ans;
}

int main()
{
  ios::sync_with_stdio(false);
  cin >> n >> k;
  for(int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if(a >= 0) pos.push_back(a);
    else neg.push_back(a);
  }
  sort(all(pos));
  sort(all(neg));
  bool canPositive = false;
  for(int i = 0; i <= min(sz(neg), k); i += 2)
    if(k - i <= sz(pos))
      canPositive = true;
  if(canPositive) cout << solvePositive() << endl;
  else cout << solveNegative() << endl;
  return 0;
}


Measured memory_bytes: 5516
import sys

import bisect

# from collections import Counter, deque

# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math


# import numpy as np

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(input())
    a = [-int(readline()) for _ in range(n)]

    c = [1] * n

    for number in a:
        idx = bisect.bisect_right(c, number)
        c[idx] = number

    ans = bisect.bisect_left(c, 1)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 45276
N = gets.to_i
data = Array.new(N-1){ Array.new(3) }
(N-1).times do |i|
  tmp = gets.split("\s").map {|s|s.to_i}
  data[i][0] = tmp[0]
  data[i][1] = tmp[1]
  data[i][2] = tmp[2]
end

(N-1).times do |i|
  result = 0
  (i..(N-2)).each do |j|
    #puts "#{i}-#{j}"
    c = data[j][0]
    s = data[j][1]
    f = data[j][2]
    if result==0 then
      result += s + c
    else
      # resultの値を元に、次の列車発車時刻を計算する
      # S + Fx
      if result <= s then
        result = s + c
      else
        x = (result-s)/f + 1
        if (result-s)%f==0 then
          result += c
        else
          result = s + f*x + c
        end
      end
    end
    #p result
  end
  puts "#{result}"
end
puts "0"


Measured memory_bytes: 1788
#include <iostream>
#include <cstring>

using namespace std;

#define rep1(i,x) for(int i=1;i<=(x);++i)

int I[1001], J[1001], K[1001];
bool ok[301];
int res[301];

int main()
{
	int a, b, c;
	while (cin >> a >> b >> c, a || b || c) {
		memset(res, -1, sizeof(res));
		memset(ok, false, sizeof(ok));

		int n; cin >> n;

		rep1(i, n) {
			bool f;
			cin >> I[i] >> J[i] >> K[i] >> f;
			if (f) {
				ok[I[i]] = ok[J[i]] = ok[K[i]] = true;
				res[I[i]] = res[J[i]] = res[K[i]] = 1;
			}
		}

		rep1(_, n) {
			int i = I[_], j = J[_], k = K[_];
			if (!ok[i] && res[i] == -1) {
				if (ok[j] && ok[k]) res[i] = 0;
			} else if (!ok[j] && res[j] == -1) {
				if (ok[i] && ok[k]) res[j] = 0;
			} else if (!ok[k] && res[k] == -1) {
				if (ok[i] && ok[j]) res[k] = 0;
			}
		}

		rep1(i, a + b + c) {
			cout << (res[i] == -1 ? 2 : res[i]) << endl;
		}
	}
}

Measured memory_bytes: 1172
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()

int main() {
ll N;
  cin>>N;
 vector<ll> A(N);
  for(ll i=0;i<N;i++) {
cin>>A[i];
  }
  sort(all(A));
 
 if(A[0]==1) {
   if(A[1]==1) {
cout<<0<<endl;
     return 0;
   }
   else {
cout<<1<<endl;
     return 0;
   }
 }
  ll ans=0;
  for(ll i=0;i<N;i++) {
if(i!=0&&A[i-1]==A[i]) {
  continue;
}
    if(i!=N-1&&A[i+1]==A[i]) {
continue;
    }
    
    bool a=true;
    for(ll j=2;j<=sqrt(A[i]);j++) {
if(A[i]%j==0) {
ll x=lower_bound(all(A),j)-A.begin();
  if(A[x]==j) {
    a=false;
    break;
  }
 ll y=lower_bound(all(A),A[i]/j)-A.begin();
  if(A[y]==A[i]/j) {
a=false;
    break;
  }
}
    }
    
    if(a) {
ans++;
    }
  }

  
  cout<<ans<<endl;
}


  
  
  
  

Measured memory_bytes: 4848
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	string s, t;
	cin >> s >> t;
	string ss = string(s.rbegin(), s.rend());
	int k = 0;
	for (int i = 1; i <= n; i++) {
		string sss = ss.substr(0, i);
		reverse(sss.begin(), sss.end());
		if (sss == t.substr(0, i)) {
			k = i;
		}
	}
	cout << n - k + n << endl;
	return 0;		
}

Measured memory_bytes: 256
import math
n,k = map(int,input().split())
a_list = list(map(int,input().split()))

min_num = 1
max_num = 10**9+1
while True:
    #print(min_num)
    x = int((min_num+max_num)/2)
    if sum([math.ceil(a/x)-1 for a in a_list])>k:
        min_num = x
    else:
        max_num = x
    if max_num-min_num<=1:
        break
    #print(x)
if sum([math.ceil(a/min_num)-1 for a in a_list])>k:
    print(min_num+1)
else:
    print(min_num)

Measured memory_bytes: 30940
#include <bits/stdc++.h>
using namespace std;
const int N=100005; 

int tab[N];

 int main()
 {
	int n,i;
	scanf("%d",&n);

	for(i=1;i<=n;i++)
	{
		scanf("%d",&tab[i]);
	}

	int wn=0;

	for(i=1;i<=n;i++)
	{
		if(tab[i]==i)
		{
			if(i==1)
			{
				swap(tab[i],tab[i+1]);
				wn++;
			}

			else if(i==n)
			{
				swap(tab[i],tab[i-1]);
				wn++;
			}

			else
			{
				swap(tab[i],tab[i+1]);
				wn++;
			}
		}
	}

	printf("%d\n",wn);
 }


Measured memory_bytes: 640
N=gets.to_i
path=Array.new(N+1){Array.new}
distance=Hash.new
(N-1).times do
    a,b,c=gets.split.map(&:to_i)
    path[a] << b
    path[b] << a
    distance[[a,b]]=c
    distance[[b,a]]=c
end

Q,K=gets.split.map(&:to_i)

len=Array.new(N+1,-1)
stack=[[nil,K]]

until stack.empty?
    cur=stack.pop
    next if len[cur[1]]!=-1
    if cur[1]==K
        len[K]=0
    else
        len[cur[1]]=len[cur[0]]+distance[[cur[0],cur[1]]]
    end
    path[cur[1]].each do |n|
        stack << [cur[1],n]
    end
end

Q.times do |i|
    x,y=gets.split.map(&:to_i)
    puts len[x]+len[y]
end


Measured memory_bytes: 41212
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iostream>

using namespace std;
int main(){
    int n;
    string s;
    cin >> n >> s;
    int i = 0, j = 0, len =n;
    while(j<n){
        if(s[i] == s[j]){
        if(i!=j)len--;
            j++;
        }
        else{
            i=j;
        }
    }
    
    cout << len;
    
}




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

#define tam(s) s.length()

using namespace std ;

int main(){
	string s , rev ;
	int t ;

	do{
		cin>>s ;
	}while(tam(s) %2 == 0) ;	
	
	t=tam(s) ;
	
	
	
	rev=s ;
 	reverse(rev.begin(), rev.end()); 
 	
 	
 	int s1 = ((t-1)/2) , s2=((t+3)/2) ;

	string sub1 = s.substr(0 , s1) ;		
	string sub2 = s.substr(s2-1 , s1 ) ;	
	string v1=sub1 ; 
	string v2=sub2 ;
	
	
	
	if(s.compare(rev) == 0){
		reverse(v1.begin(), v1.end()) ;
		reverse(v2.begin(), v2.end()) ;
		
		if ( (sub1.compare(v1) == 0) && (sub2.compare(v2) == 0)  ) cout<<"Yes" ;
		else cout<<"No" ;	
	}
	else cout<<"No" ;
	
	return 0 ;
}

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

using namespace std;

using int64 = long long;

int64 f(int64 X) {
  if(X % 2) return X % 4 == 1;
  return X + (X % 4 == 2);
}

int main() {
  int64 A, B;
  cin >> A >> B;
  cout << (f(A - 1) ^ f(B)) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std ;
long long n,temp;
int main(){
	
	cin>>n;
	temp=n;
	for(long long i=1;i<=sqrt(n);i++){
		
		if(n%i==0){
			if(temp+2>n/i+i){
				temp=n/i+i-2;
			}
		}
	}
	cout<<temp<<endl;
}

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

struct Union_Find
{
    vector <int> parent;
    Union_Find(int N) : parent(N)
    {
        for(int i = 0; i < N; i++) parent[i] = i;
    }
    int root(int n)
{
    if (parent[n]==n) return n;
    else
    {
        return root(parent[n]);
    }
}

void unite(int i,int j)
{
    int rx,ry;
    rx=root(i);
    ry=root(j);
    if (rx==ry) return;
    else
    {
        int k;
        if (rx<ry)
        {
            parent[ry]=rx;
            return;
        }
        else
        {
            parent[rx]=ry;
            return;
        }
    }
}
bool same(int i, int j)
{
    if (root(i)==root(j)) return true;
    else return false;
}
};

int main()
{
    int N;
    cin >> N;
    vector<pair<pair<long long,long long>,int>> xy(N);
    vector<pair<pair<long long,long long>,int>> yx(N);
    long long x,y;
    for (int i=0;i<N;i++)
    {
        cin >> x >>y;
        xy[i]=make_pair(make_pair(x,y),i);
        yx[i]=make_pair(make_pair(y,x),i);
    }
    sort(xy.begin(),xy.end());
    sort(yx.begin(),yx.end());
    long long l,ll;
    priority_queue <pair<long long,pair<int,int>>,vector<pair<long long,pair<int,int>>>,greater<pair<long long,pair<int,int>>>> length;
    for (int i=0;i<(N-1);i++)
    {
        l=min(abs(xy[i+1].first.first-xy[i].first.first),abs(xy[i+1].first.second-xy[i].first.second));
        ll=min(abs(yx[i+1].first.first-yx[i].first.first),abs(yx[i+1].first.second-yx[i].first.second));
        length.push(make_pair(l,make_pair(xy[i+1].second,xy[i].second)));
        length.push(make_pair(ll,make_pair(yx[i+1].second,yx[i].second)));
    }
    vector <pair<int,int>> edge;
    pair<long long, pair<int,int>> pa;
    Union_Find tree(N);
    long long s=0;
    while (edge.size()!=N-1)
    {
        pa=length.top();
        length.pop();
        x=pa.second.first;
        y=pa.second.second;
        if (!tree.same(x,y))
        {
            tree.unite(x,y);
            s+=pa.first;
            edge.push_back(make_pair(x,y));
        }
    }
    cout << s << endl;
return 0;
}


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

static const int MAX = 3e3;
ll dp[MAX][MAX][4];
int item[MAX][MAX];

int main(){
    int R, C, K;
    cin >> R >> C >> K;
    for(int i = 0; i < K; i++){
        int r, c, v;
        cin >> r >> c >> v;
        item[r-1][c-1] = v;
    }
    dp[0][0][0] = 0;
    if(item[0][0]) dp[0][0][1] = item[0][0];
    for(int i = 0; i < R; i++){
        for(int j = 0; j < C; j++){
            for(int k = 0; k <= 3; k++){
                if(i+1 < R){
                    dp[i+1][j][0] = max(dp[i+1][j][0], dp[i][j][k]);
                    if(item[i+1][j]){
                        dp[i+1][j][1] = max(dp[i+1][j][1], dp[i][j][k]+item[i+1][j]);
                    }
                }
                if(j+1 < C){
                    dp[i][j+1][k] = max(dp[i][j+1][k], dp[i][j][k]);
                    if(k < 3 && item[i][j+1]){
                        dp[i][j+1][k+1] = max(dp[i][j+1][k+1], dp[i][j][k]+item[i][j+1]);
                    }
                }
            }
        }
    }
    ll ans = 0;
    for(int i = 0; i <= 3; i++){
        ans = max(ans, dp[R-1][C-1][i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 319920
#include <stdio.h>
int main(void)
{
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  if(0<=a&&a<=100&&0<=b&&b<=100&&0<=c&&c<=100)
  {
    if(a<b&&b<c)
    {
      printf("Yes\n" );
    }
    else
    {
      printf("No\n" );
    }
  }
  else
  {
    printf("条件を満たす入力をしてください。\n");
  }
	return 0;
}



Measured memory_bytes: 2044
import itertools
n = int(input())
l = list(map(int, input().split()))
c = itertools.combinations(l, 3)
result = 0

for i in c:
  if abs(i[0] - i[1]) < i[2] and i[2] < i[0] + i[1]:
    if i[0] != i[1] and i[0] != i[2] and i[1] != i[2]:
      result += 1
    else:
      continue
  else:
    continue
    
print(result)

Measured memory_bytes: 9060
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>
#include <bitset>

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

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

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

struct mint {
    static const long long mod = 1000000007;
    long long x;
    mint(long long x = 0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint& a) {if ((x += a.x) >= mod) x -= mod; return *this;}
    mint& operator-=(const mint& a) {if ((x += mod - a.x) >= mod) x -= mod; return *this;}
    mint& operator*=(const mint& a) {(x *= a.x) %= mod; return *this;}

    friend const mint operator+(const mint& a, const mint& b) { mint ret = a; return ret += b; }
    friend const mint operator-(const mint& a, const mint& b) { mint ret = a; return ret -= b; }
    friend const mint operator*(const mint& a, const mint& b) { mint ret = a; return ret *= b; }
    friend ostream& operator<<(ostream& s, const mint& a) { return s << a.x; }

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

    // for prime mod
    mint inv() const { return pow(mod - 2);}
    mint& operator/=(const mint a) { return (*this) *= a.inv();}
    friend const mint operator/(const mint& a, const mint& b) { mint ret = a; return ret /= b; }
};

void solve() {
    ll n;
    cin >> n;
    mint ans = mint(10).pow(n) - 2 * mint(9).pow(n) + mint(8).pow(n);
    cout << ans << endl;
    return;
}

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

Measured memory_bytes: 3664
#include<iostream>
#include<string>
using namespace std;
int main() {
	string s;
	cin >> s;
	int n = s.size();
	string ans;
	for (int i = 0; i < n; i+=2) {
		ans += s[i];
	}
	cout << ans << endl;
	return 0;

}

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

#if defined(DEBUG)

#include <unistd.h>
#include <sys/fcntl.h>
#define DLOG(...)        cerr << dbgFormat(__VA_ARGS__) << endl
#define DCALL(func, ...) func(__VA_ARGS__)

template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

#else  // defined(DEBUG)

#define DLOG(...)
#define DCALL(func, ...)

#endif // defined(DEBUG)

constexpr ll prime = 1e9 + 7;

// g = eGCD(a, b, s, t)  --->  sa + tb = g
constexpr ll eGCD(ll a, ll b, ll& s, ll& t) {
  if (a == 0) {
    s = 0;
    t = 1;
    return b;
  }
  ll u = 0;
  ll g = eGCD(b % a, a, t, u);
  s = u - (b / a) * t;
  return g;
}

constexpr ll gcd(ll a, ll b) {
  ll dummy1 = 0;
  ll dummy2 = 0;
  return eGCD(a, b, dummy1, dummy2);
}

template<ll MOD>
struct Fp {
  ll val;

  Fp(ll t = 0) :
    val(t < 0 ? MOD + t % MOD : t >= MOD ? t % MOD : t) {}

  Fp& operator +=(const Fp& t) {
    val += t.val;
    if (val >= MOD) val -= MOD;
    return *this;
  }

  Fp& operator -=(const Fp& t) {
    val -= t.val;
    if (val < 0) val += MOD;
    return *this;
  }

  Fp& operator *=(const Fp& t) {
    val = (val * t.val) % MOD;
    return *this;
  }

  Fp inv() const {
    if (val == 0) {
      cerr << "inv() is called for zero." << endl;
      exit(1);
    }
    ll u = 0;
    ll v = 0;
    eGCD(val, MOD, u, v);
    return Fp(u);
  }

  Fp& operator /=(const Fp& t) {
    return (*this) *= t.inv();
  }

  Fp operator +(const Fp& t) const { return Fp(val) += t; }
  Fp operator -(const Fp& t) const { return Fp(val) -= t; }
  Fp operator *(const Fp& t) const { return Fp(val) *= t; }
  Fp operator /(const Fp& t) const { return Fp(val) /= t; }
  Fp operator -() const { return Fp(-val); }

  bool operator ==(const Fp& t) const { return val == t.val; }
  bool operator !=(const Fp& t) const { return val != t.val; }
  
  operator ll() const { return val; }

};





template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> init2(int n1, int n2) {
  return vector2<T>(n1, vector<T>(n2));
}



int main(int argc, char *argv[]) {
#if defined(DEBUG)
  // GDB on Cygwin ignores redirection at run command.
  if (argc == 2) dup2(open(argv[1], 0), 0);
#else
  // For performance.  We should not use C-style stdio functions
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
#endif
  cout << setprecision(20);

  string S;
  cin >> S;
  int len = S.size();
  vector2<Fp<prime>> dp = init2<Fp<prime>>(len + 1, 13);
  dp.at(0).at(0) = 1;
  Fp<13> power = 1;
  for (int i = 0; i < len; i++) {
    char c = S.at(len-1-i);
    for (int j = 0; j < 13; j++) {
      if (c == '?') {
	for (Fp<13> x = 0; x != Fp<13>(10); x += 1) {
	  Fp<13> jj = Fp<13>(j) + (power * x);
	  dp.at(i+1).at(jj) += dp.at(i).at(j);
	}
      }else {
	Fp<13> x = power * Fp<13>(c - '0');
	dp.at(i+1).at(Fp<13>(j) + x) = dp.at(i).at(j);
      }
    }
    power *= 10;
  }
  cout << dp.at(len).at(5) << endl;


  return 0;
}



Measured memory_bytes: 13648
#include<bits/stdc++.h>
#define F first
#define S second
#define endl '\n'
#define lcm( a, b ) ((a)/__gcd(a,b)*(b))
#define MP make_pair
#define pb push_back
#define all(x) (x).begin(),(x).end()

using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<int, P> i_P;
typedef pair< LL, LL > L_P;

const int INF = INT_MAX;
const int MIN = INT_MIN;
const LL LINF = LLONG_MAX;
const int MOD = 1000000000 + 7;
const int SIZE = 100005;

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i ) {
            ret.pb( i );
            if( i * i != n ) ret.pb( n / i );

        }
    }
    sort( all( ret ) );
    return ret;
}

typedef struct {
    LL a, b, c;

} Data;

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

    int n;
    cin >> n;

    Data dp[SIZE];
    for( int i = 0; i < SIZE; ++i ) {
        dp[i].a = dp[i].b = dp[i].c = 0;

    }

    cin >> dp[0].a >> dp[0].b >> dp[0].c;
    for( int i = 1; i < n; ++i ) {
        LL a, b, c;
        cin >> a >> b >> c;
        dp[i].a = max( dp[i - 1].b, dp[i - 1].c ) + a;
        dp[i].b = max( dp[i - 1].a, dp[i - 1].c ) + b;
        dp[i].c = max( dp[i - 1].a, dp[i - 1].b ) + c;

    }

    cout << max( dp[n - 1].a, max( dp[n - 1].b, dp[n - 1].c ) ) << endl;
    return 0;
}



Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>

using namespace std;
typedef long long ll;

ll r, D, x = {};

int main() {
	cin >> r >> D >> x;
	for (int i = 1; i <= 10; i++) {
		x = r*x - D;
		cout << x << endl;
	}
	return 0;
}

Measured memory_bytes: 256
//                          VIVEK UPADHYAY
//                         MANIT, BHOPAL(M.P)
/**********************************************************************************************/
/**********************************************************************************************/
//                        $$ JAB-TAK TODEGA NHI,
//                           TAB -TAK CHODEGA NHI :D
#include<iostream>
#include<algorithm>
#include<vector>
#include<list>
#include<cstdlib>
#include<unistd.h>
#include<string>
#include<cstring>
#include<stack>
#include<queue>
#include<utility>
#include<cmath>
#include<set>
#include<unordered_map>
#include<cstdio>
#include<map>
#include<numeric>
using namespace std;
#define F first
#define S second
#define mk(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define LINE cout<<"\n" ;
#define ok cout<<"ok\n" ;
#define dbg(x) cout<<#x<<" = "<<(x)<<"\n";
typedef long long ll;
const int MAXN = 2*1e3 + 10 ;
const int MAX = 1e7 + 1 ;
double pi = 3.1415926535897932384626433832795;
const ll inf=1e18 ;
ll mod = 1e9 + 7;
ll powr(ll a , ll b){ if(b==0) return 1LL ; ll x = powr(a,b/2) ; x = (x*x)%mod ; if(b%2) return ((a%mod)*x)%mod ; return x ;}
ll gcd(ll a , ll b){if(a==0) return b ; return gcd(b%a,a);}
int main () {
    int N;
    cin >> N ;
    int a[N][3] ;
    for(int i =0 ; i < N ; i ++)
        cin >> a[i][0] >> a[i][1] >> a[i][2] ;
    int dp[N][3] ;
    dp[0][0] = a[0][0] ; dp[0][1] = a[0][1] ; dp[0][2] = a[0][2] ;
    for(int i = 1 ;i < N; i++)
    {
        dp[i][0] = a[i][0] + max(dp[i-1][1],dp[i-1][2]) ;
        dp[i][1] = a[i][1] + max(dp[i-1][0] , dp[i-1][2]) ;
        dp[i][2] = a[i][2] + max(dp[i-1][0] , dp[i-1][1]) ;
    }
    cout<<max(dp[N-1][0],max(dp[N-1][1],dp[N-1][2]))<<endl;
    return 0 ;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll a[5];
    for(int i=0;i<5;i++){
    	cin>>a[i];
    	if(i){
    		a[i]=min(a[i],a[i-1]);
    	}
    }
    cout << 4+(n+a[4]-1)/a[4] <<endl;
    return 0;
}


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

int main(void)
{
    int N, M, C;
    cin >> N >> M >> C;
    int B[M];
    int ans = 0;
    for (int i = 0; i < M; i++)
    {
        cin >> B[i];
    }
    for (int i = 0; i < N; i++)
    {
        int A[M];
        int sum = C;
        for (int j = 0; j < M; j++)
        {
            cin >> A[j];
            sum += A[j] * B[j];
        }
        if (sum > 0)
            ans += 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long t,n;
    cin>>t;
    int x[t],y[t];
    for(int i=0;i<t;i++)
        cin>>x[i]>>y[i];
    double ans=0,ans1=1,z=1;
    for(int i=1;i<t;i++)
        z*=i;
    for(int i=0;i<t;i++)
    {
        for(int j=0;j<t;j++)
        {
            ans+=z*(sqrt((x[j]-x[i])*(x[j]-x[i]) + (y[j]-y[i])*(y[j]-y[i])));
            //cout<<(sqrt((x[j]-x[i])*(x[j]-x[i]) + (y[j]-y[i])*(y[j]-y[i])))<<" ";

        }
        //cout<<endl;
        ans1*=(i+1);
    }
    cout<<fixed<<setprecision(10)<<ans/ans1;
}


Measured memory_bytes: 256
import heapq
n=int(input())
l=list(map(int,input().split()))
q=[]
for i in range(n):
    heapq.heappush(q,l[i])
a1=[0]*(n+1)
a1[0]=sum(l[:n])
for i in range(n):
    p=heapq.heappop(q)
    a1[i+1]=a1[i]-p+max(p,l[i+n])
    heapq.heappush(q,max(p,l[i+n]))
#print(a1)
q=[]
l.reverse()
for i in range(n):
    heapq.heappush(q,-l[i])
a1.reverse()
a1[0]-=sum(l[:n])
z=sum(l[:n])
for i in range(n):
    p=heapq.heappop(q)
    z=z+p+min(-p,l[i+n])
    a1[i+1]-=z
    heapq.heappush(q,max(p,-l[i+n]))
print(max(a1))


Measured memory_bytes: 39260
S = list(input())
a = 10 * int(S[0]) + int(S[1])
b = 10 * int(S[2]) + int(S[3])

if 1 <= a <= 12:
  if 1 <= b <= 12:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if 1 <= b <= 12:
    print('YYMM')
  else:
    print('NA')


Measured memory_bytes: 2940
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sys/time.h>
#include <cmath>
#include <tuple>
#include <queue>

using namespace std;

void solve(long long N, long long A, long long B){
    if ((A-B) % 2 == 0) {
        std::cout << "Alice" << std::endl;
    } else {
        std::cout << "Borys" << std::endl;
    }
}

int main(){	
    struct timeval start,end;
    long long span;
    gettimeofday(&start,NULL);

    long long A;
    long long B;
    long long N;
    scanf("%lld",&N);
    scanf("%lld",&A);
    scanf("%lld",&B);
    solve(N, A, B);

    gettimeofday(&end,NULL);
    span = (end.tv_sec -start.tv_sec)*1000000LL + (end.tv_usec - start.tv_usec);
    std::cerr << "--Total Time: " << span/1000 << "ms" << endl;
    return 0;
}


Measured memory_bytes: 888
n = int(input())
a = []
b = []
c = []
d = []
for i in range(n):
  x, y = map(int, input().split(' '))
  a.append(x + y)
  b.append(x - y)
  c.append(-x + y)
  d.append(-x - y)
  
l = [a, b, c, d]

ans = 0
for i in range(4):
  mi = l[i][0]
  for j in range(n):
    mi = min(mi, l[i][j])
    ans = max(ans, l[i][j] - mi)

print(ans)

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

int main(){
    int N;
    cin >> N;
    double A = 0.0,ans;

    for(int i = 0;i < N;i++){
        cin >> A;
        ans += 1.0 / A;
    }

    ans = 1.0 / ans;

    cout << setprecision(16) << ans << endl;

}

Measured memory_bytes: 256
#include <stdio.h>

int x[200010];
int main()
{
	int a;
	scanf("%d",&a);
	for(int i=1;i<=a;i++) scanf("%d",&x[i]);
	
	long long int s = 0;
	for(int i=2;i<=a;i++)
	{
		if(x[i]<x[i-1])
		{
			s += (x[i-1]-x[i]);
			x[i] = x[i-1];
		}
	}
	printf("%lld",s);
}

Measured memory_bytes: 2512
// Why am I so dumb? :c
// chrono::system_clock::now().time_since_epoch().count()

//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#define pb push_back
#define mp make_pair

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

#define fi first
#define se second

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;   
template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int MAXN = (int)1e2 + 5;

int arr[MAXN], cnt[MAXN];

int n;

void bye(bool x = 0) {
    printf(x ? "Possible\n" : "Impossible\n");
    exit(0);
}

void solve() {
    scanf("%d", &n);

    for (int i = 1; i <= n; ++i) {
        scanf("%d", &arr[i]);
        ++cnt[arr[i]];
    }

    int D = *max_element(arr + 1, arr + n + 1);
    int R = (D + 1) / 2;

    if (*min_element(arr + 1, arr + n + 1) < R) {
        bye();
    }

    if (D % 2 == 0) {
        if (cnt[R] != 1) {
            bye();
        }
    }
    else {
        if (cnt[R] != 2) {
            bye();
        }
    }

    for (int i = R; i <= D; ++i) {
        if (cnt[i] == 0) {
            bye();
        }       
    }                                                                

    bye(1);
}

int main() {
    int tt = 1;

    while (tt--) {
        solve();
    }

    return 0;
}


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

using namespace std;
using ll = long long;

#define rep(i, a) for (int i = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int i = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int i = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int i = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x
#define TRUE__  "YES"
#define FALSE__ "NO"
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define RS resize
#define CINV(v, N) do {\
	v.RS(N);\
	rep(i, N) cin >> v[i];\
} while (0);
#define RCINV(v, N) do {\
	v.RS(N);\
	rrep(i, N) cin >> v[i];\
} while (0);

#define MOD 1000000007

void init();
void solve();

signed main()
{
	init();
	solve();
}

vector<pair<int, int> > vr;
//            r  num
vector<pair<int, int> > vc;
//            c  num
priority_queue<pair<int, pair<int, int> > > q;
//                  cost      num, num
int N;

void init()
{
	cin >> N;
	rep(i, N) {
		int r, c;
		cin >> c >> r;
		vr.PB(MP(r, i));
		vc.PB(MP(c, i));
	}
	sort(all(vr));
	sort(all(vc));
	rep(i, N-1) {
		int r1 = vr[i].first;
		int r2 = vr[i+1].first;
		q.push(MP(-abs(r1-r2), MP(vr[i].second, vr[i+1].second)));
		int c1 = vc[i].first;
		int c2 = vc[i+1].first;
		q.push(MP(-abs(c1-c2), MP(vc[i].second, vc[i+1].second)));
	}
}

struct uf {
	vector<int> par;
	vector<int> h;
	int n;
	uf(int sz) {
		n = sz;
		par.RS(n);
		h.RS(n, 0);
		rep(i, n) par[i] = i;
	}
	int root(int x) {
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}
	bool merge(int x, int y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;
		if (h[x] > h[y]) {
			par[y] = x;
		} else {
			par[x] = y;
			if (x == y) h[y]++;
		}
		return true;
	}
};


void solve()
{
	int res = 0;
	uf u(N);
	while (!q.empty()) {
		auto x = q.top();
		int c = x.first;
		int n1 = x.second.first;
		int n2 = x.second.second;
		if (u.merge(n1, n2)) {
			res += c;
		}
		q.pop();
	}
	cout << -res << endl;
}




Measured memory_bytes: 7144
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <sstream>
using namespace std;

#define endl "\n"
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//STANDARD DATA TYPES
#define ll long long
#define llu unsigned long long
#define ld long double
//ADV DATA TYPES
#define pii pair < int , int >
#define pll pair < ll, ll >
#define mp make_pair
#define ff first
#define ss second
//C 9/++ DS
#define vi vector < int >
#define vll vector < ll >
#define pb push_back
#define pf push_front
#define iter :: iterator
#define all(x) x.begin(),x.end()
 
//priority_queue < pii, vector < pii >, greater < pii > > pq;
//lower_bound(v.begin(),v.end(),20);//for any sorted container
//CONSTANTS
#define MOD 998244353
#define INF 0x3f3f3f3f
#define MAXN (int)(2e4+20)

#define fori(i,n) for(int i=0; i<n; i++)
#define forl(i,n) for(ll i=0; i<n; i++)
//MOD OPERATIONS
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
inline ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
inline ll addmod(ll a, ll val, ll p = MOD) {{if ((a = (a + val)) >= p) a -= p;} return a;}
inline ll submod(ll a, ll val, ll p = MOD) {{if ((a = (a - val)) < 0) a += p;}return a;}
inline ll mult(ll a, ll b, ll p = MOD) {return (ll) a * b % p;}
const  llu int_max = pow(2,32) - 1 ;

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.ff < j.ff;
}

int main(){
	fastio
	int r;
	cin>>r;
	cout<< 3*r*r;


	
}



Measured memory_bytes: 256
import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    auto t = readln.split.to!(long[]);
    if (t == [1,1]) {
        writeln(1);
        return;
    }
    if (t[0] == 1) {
        writeln(t[1]-2);
        return;
    }
    if (t[1] == 1) {
        writeln(t[0]-2);
        return;
    }
    writeln((t[0]-2)*(t[1]-2));
}



Measured memory_bytes: 256