akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>

struct node{
  int key;
  struct node *parent,*left,*right;
};

struct node *root,*NIL;

struct node * minimum(struct node *x){
 while(x->left!=NIL) x=x->left;
  return x;
}

struct node * successor(struct node *x){
  if(x->right!=NIL) return minimum(x->right);
  struct node *y=x->parent;
  while(y!=NIL&&x==y->right){
    x=y;
    y=y->parent;
  }
  return y;
}

void delete(struct node *z){
  struct node *x;
  struct node *y;

  if(z->left==NIL||z->right==NIL) y=z;
  else y=successor(z);

  if(y->left!=NIL) x=y->left;
  else x=y->right;

  if(x!=NIL) x->parent=y->parent;

  if(y->parent==NIL) root=x;
  else{
    if(y==y->parent->left) y->parent->left=x;
    else y->parent->right=x;
  }

  if(y!=z) z->key=y->key;

  free(y);
}

struct node * find(struct node *u, int k){
  while(u!=NIL&&k!=u->key){
    if(k<u->key) u=u->left;
        else u=u->right;
  }
  return u;
}

void insert(int k){
  struct node *y=NIL;  //xの親
  struct node *x=root;
  struct node *z;

  z=(struct node*)malloc(sizeof(struct node));

  z->key=k;
  z->left=NIL;
  z->right=NIL;

  while(x!=NIL){
    y=x;
    if(z->key<x->key) x=x->left;
    else x=x->right;
  }

  z->parent=y;

  if(y==NIL) root=z;
  else if(z->key<y->key) y->left=z;
    else y->right=z;
  }

void inorder(struct node *u){
  if(u==NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(struct node *u){
  if(u==NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int num,i,k;
  char c[10];
  struct node *judge;

  scanf("%d",&num);

  for(i=0;i<num;i++){
    scanf("%s",c);
    
    if(c[0]=='i'){
      scanf("%d",&k);
      insert(k);
}
    else if(c[0]=='f'){
scanf("%d",&k);
judge=find(root,k);
if(judge!=NIL) printf("yes\n");
 else printf("no\n");
}

    else if(c[0]=='d'){
scanf("%d",&k);
delete(find(root,k));
}
    else{
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
      }

  return 0;
}


Measured memory_bytes: 20468
class dice:
    def __init__(self, f):
        assert(len(f) == 6)
        self.face = f
        self.N = [1, 5, 2, 3, 0, 4]
        self.S = [4, 0, 2, 3, 5, 1]
        self.E = [3, 1, 0, 5, 4, 2]
        self.W = [2, 1, 5, 0, 4, 3]
        self.R = [0, 2, 4, 1, 3, 5]

    def rotate(self, dir):
        rot = self.__getattribute__(dir)
        old = self.face
        new = [-1 for _ in range(6)]
        for i in range(6):
            new[i] = old[rot[i]]
        self.face = new

    def __eq__(self, E):
        D = self
        for _ in range(4):
            # print(f'a {D.face}')
            if D.face[0] == E.face[0]:
                for _ in range(4):
                    # print(f'b {D.face}')
                    if D.face == E.face:
                        return True
                    else:
                        D.rotate('R')
            D.rotate('N')
        for _ in range(4):
            # print(f'c {D.face}')
            if D.face[0] == E.face[0]:
                for _ in range(4):
                    # print(f'd {D.face}')
                    if D.face == E.face:
                        return True
                    else:
                        D.rotate('R')
            D.rotate('E')
        return False

n = int(input())
S = []
for _ in range(n):
    S.append(dice(list(map(int, input().split()))))
ans = True
for i in range(n):
    for j in range(i+1, n):
        ans &= S[i] != S[j]
print('Yes' if ans else 'No')


Measured memory_bytes: 5704
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let a: f64 = sc.read();
    let b: f64 = sc.read();
    let x: f64 = sc.read();
    let s = x / a;
    // b*z/2==s
    let z = s * 2.0 / b;
    if z > a {
        let s = a * b - s;
        let z = s * 2.0 / a;
        // tan(t) = z/a
        let t = z.atan2(a);
        let d = t / std::f64::consts::PI * 180.0;
        //        eprintln!("z={} t={}", z, t);
        println!("{}", d);
    } else {
        // tan(t) = b/z
        let t = b.atan2(z);
        let d = t / std::f64::consts::PI * 180.0;
        //        eprintln!("z={} t={}", z, t);
        println!("{}", d);
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int a[200100];
long long tot;
long long qzh;
int n;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		tot+=a[i];
	}
	long long res=1e18;
	for(int i=1;i<=n-1;i++){
		qzh+=a[i];
		res=min(res,llabs(tot-qzh-qzh));
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 1024
a, b, c, d = gets.split.map(&:to_i)
i = 0
loop do
  if i % 2 == 0
    c -= b
    if c <= 0
      puts 'Yes'
      exit
    end
  else
    a -= d
    if a <= 0
      puts 'No'
      exit
    end
  end
  i += 1
end


Measured memory_bytes: 14416
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    string s;
    cin>>s;
    bool ok=true;
    int n=s.size();
    for(int i=0; i<n; i+=2){
        if(s.substr(i,2)!="hi")ok=false;
    }
    if(n%2==1)ok=false;
    cout<<(ok?"Yes":"No")<<endl;
    return 0;
}

Measured memory_bytes: 256
#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 <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <cstdint>
#include <tuple>
#include <numeric>
#define M_PI       3.14159265358979323846


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FILL(a, x) memset(a, x, sizeof(a))

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)

#define MOD 1000000007
int cnt[256];

int main() {
	int n;
	string str;
	cin >> n >> str;
	REP(i, n)cnt[str[i]]++;
	LL ret = 1;
	FOR(i, 'a', 'z' + 1) {
		ret = (ret * (cnt[i] + 1)) % MOD;
	}
	ret = (ret + MOD - 1) % MOD;
	cout << ret << endl;
	return 0;
}                          

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

int main(){
  string x;
  cin >> x;
  
  int ans;
  rep(i,x.size()-2){
    string str = x.substr(i,3);
    int num = stoi(str);
    num = abs(753-num);
    if(i==0){
      ans = num;
    }else{
      if(ans>num) ans = num;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

const double pi = 3.14159265358979;

int main()
{
    double r;
    cin >> r;
    
    cout << fixed << setprecision(10) << pi * pow(r, 2) << ' ' << 2.0 * pi * r << endl;
}



Measured memory_bytes: 3276
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <typeinfo>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T>
using Tree =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i >= b; i--)
#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;  // check the limits, dummy

typedef long long ll;
const int inf = INT_MAX / 2;
const ll infl = 1LL << 60;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T>
void print(const vector<T> v) {
  cout << "[ ";
  F0R(i, v.size()) { cout << v[i] << ' '; }
  cout << "]" << '\n';
}

int mod(int i, int j) {
  return (i % j) < 0 ? (i % j) + 0 + (j < 0 ? -j : j) : (i % j + 0);
}

unsigned euclidean_gcd(unsigned a, unsigned b) {
  if (a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r = a % b)) {
    a = b;
    b = r;
  }
  return b;
}

int middleOfThree(int a, int b, int c) {
  // Checking for b
  if ((a < b && b < c) || (c < b && b < a)) return b;

  // Checking for a
  else if ((b < a && a < c) || (c < a && a < b))
    return a;

  else
    return c;
}

int vector_finder(std::vector<int> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance(vec.begin(), itr);
  if (index != vec.size()) {  // 発見できたとき
    return 1;
  } else {  // 発見できなかったとき
    return 0;
  }
}
// --------------------------------------------------------
// This is tool
// --------------------------------------------------------

// string S;
// ll cnt[2020];

void Main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int N, M;
  cin >> N >> M;

  if (N % 2 == 0) {
    int m1 = (M + 1) / 2;
    int m2 = (M) / 2;
    FOR(i, 0, m1) { cout << i + 1 << " " << N - i << endl; }
    FOR(i, m1, m1 + m2) { cout << i + 1 << " " << N - i - 1 << endl; }
    return;
  }
  FOR(i, 0, M) { cout << i + 1 << " " << N - i << endl; }
}

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

Measured memory_bytes: 3644
#include<iostream>
#include<numeric>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<climits>
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define mkp make_pair
#define pll pair<ll,ll>
#define rep(i,from,to) for(int i=from;i<to;i++)
#define repd(i,from,till) for(int i=from;i>=till;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define mod 1000000007
#define inf1 1e18+1
#define pie 3.14159265358979323846
#define N 100005
using namespace std;
/*
ll bin(ll i,ll j){
	ll mid=(i+j)/2;
	if(a[mid]==x)reutrn mid;
	else if(ans>x)return bin(i,mid-1);
	else return bin(mid+1,j);
}
ll power(ll base,ll power){
    ll res=1;
    base=base%mod;
    while(power>0){
    	if(power&1){
    		res=(res*base)%mod;
		}
		power=power>>1;
		base=(base*base)%mod;
	}
	return res;
}
*/
/*
int nCr(int x, int y){
	if(y>x)return 0;
	int num=fact[x];
	num*=invfact[y];
	num%=mod;
	num*=invfact[x-y];
	num%=mod;
	return num;
}
*/
/*bool prime[n+1];
void SieveOfEratosthenes(int n){
	rep(i,0,n+1)prime[i]=true
    for (int p=2;p*p<=n;p++)
        if (prime[p])
            for (int i=p*p;i<=n;i+=p)prime[i]=false;
}*/
/*
int gcd(int a,int b){
	if(b==0)return a;
	else return gcd(b,a%b);
}
*/
ll fact[200005];
ll invfact[200005];

ll power(ll base,ll power){
    ll res=1;
    base=base%mod;
    while(power>0){
    	if(power&1){
    		res=(res*base)%mod;
		}
		power=power>>1;
		base=(base*base)%mod;
	}
	return res;
}
ll pre(){
	fact[0]=fact[1]=1;
	rep(i,2,200005)fact[i]=(fact[i-1]*i)%mod;
	invfact[200004]=power(fact[200004],mod-2);
	repd(i,200003,0)invfact[i]=(invfact[i+1]*(i+1))%mod;
}
ll mul(int a,int b){
	ll m=1;
	while(a!=b){
		m=(m*a)%mod;
		a--;
	}
	return m;
}
int solve(){
    int n;
    cin>>n;
	int a,b;
	cin>>a>>b;
	ll ans=power(2,n);	
	ll p=(mul(n,n-a)*invfact[a])%mod;
	ll q=(mul(n,n-b)*invfact[b])%mod;
//	cout<<ans<<" "<<p<<" "<<q<<endl;
	cout<<(((ans-p+mod)%mod)-q-1+mod)%mod<<endl;
	return 0;
}
int main(){
    waste;
    int t;
    pre();
	//cin>>t;
    t=1;
    while(t--){
       	solve();
    }
}


Measured memory_bytes: 3328
#include <iostream>

using namespace std;

int n, ok;
int x[100005], y[100005], t[100005];

int main()
{
	cin >> n;

	for (int i = 1; i <= n; ++i)
		cin >> t[i] >> x[i] >> y[i];

	ok = 1;
	for (int i = 1; i <= n; ++i)
	{
		int dx = abs(x[i] - x[i-1]);
		int dy = abs(y[i] - y[i-1]);

		int a = dx + dy;
		int b = t[i] - t[i-1];
		if (a == b || (b > a && ((b - a) % 2 == 0)))
		{
			ok = 1;
		}
		else
		{
			ok = 0;
			break;
		}
	}

	if (ok)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 1408
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 105;
const int mod = 998244353;



int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  string s;
  cin>>s;
  if(s[0]>='A' && s[0]<='Z')cout<<'A'<<endl;
  else cout<<"a"<<endl;
  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main()
{
    int x;
    cin >> x;
    int count = 0;
    int a = x / 500;
    int b = (x % 500) / 5;
    cout << 1000 * a + 5 * b << endl;
}

Measured memory_bytes: 256
N,Y = gets.split.map(&:to_i)
a = 0
for x in 0..2000

    for y in 0..[((Y-10000 * x) / 5000)+1,N-x].min

        if a == 0 && 10000 * x + 5000 * y + 1000 * (N-x-y) == Y 

            puts "#{x} #{y} #{N-x-y}"
            a += 1

        end

    end

end

if a == 0
    puts "-1 -1 -1"
end

Measured memory_bytes: 1788
//In the name of 'ALLAH'//
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n, k, x, y ;
    cin>>n>>k>>x>>y;
    if(n<=k)
        cout<<n*x<<endl;
    else
        cout<< k*x + (n-k)*y <<endl;
    return 0;
}


Measured memory_bytes: 3580
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
  int a;
  cin >> a;
  int ans = 1;
  for (int i = 2; i < a; i++) {
    int tmp = i;
    while (tmp * i <= a) {
      tmp *= i;
      if (tmp >= ans) ans = tmp;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*
import java.lang.*

fun main(args: Array<String>) {

    val (H ,M) = readLine()!!.split(" ").map(String::toInt)

    //map作成
    //true = road,false = wall
    var map = LinkedHashMap<Int,LinkedHashMap<Int,Boolean>>()
    for(i in 0 until H){
        map[i] = LinkedHashMap()
        var yoko = readLine()!!.toCharArray().map(Char::toString)
        for(j in 0 until M){
            map[i]!![j] = yoko[j]=="."
        }
    }

    var answer = 0
    for(i in 0 until H){
        for(j in 0 until M){
            if(map[i]!![j]!!){
                var max = bnf(map,i,j)//探索
                answer = Math.max(max,answer)
            }
        }
    }

    println(answer)

}

fun bnf(map : LinkedHashMap<Int,LinkedHashMap<Int,Boolean>>,Y : Int,X : Int) : Int{

    var stack = ArrayDeque<Int>()//探索キュー
    var old = ArrayList<Int>()//探索済みList
    var yoko = map[0]!!.size//横幅
    var tate = map.size//縦幅
    var costs = LinkedHashMap<Int,Int>()//コスト

    //方角に動けるか
    var N = false
    var E = false
    var S = false
    var W = false

    //override
    var X = X
    var Y = Y

    var index = X + Y*yoko
    costs[index] = 0//初期化

    while (true){

        //座標
        index = X + Y*yoko

        //コスト
        var cost = costs[index]!!

        //初期化
        N = false
        E = false
        S = false
        W = false

        //方角チェック
        if(X!=0)W=map[Y]!![X-1]!!
        if(X!=yoko-1)E=map[Y]!![X+1]!!
        if(Y!=0)N=map[Y-1]!![X]!!
        if(Y!=tate-1)S=map[Y+1]!![X]!!

        //スタック追加
        var nIndex = index-yoko
        if(N && !stack.contains(nIndex)){
            if(!old.contains(nIndex)){
                stack.offer(nIndex)
                costs[nIndex] = cost+1
            }else{
                costs[nIndex] = Math.min(costs[nIndex]!!,cost+1)
            }
        }
        var eIndex = index+1
        if(E && !stack.contains(eIndex)){
            if(!old.contains(eIndex)){
                stack.offer(eIndex)
                costs[eIndex] = cost+1
            }else{
                costs[eIndex] = Math.min(costs[eIndex]!!,cost+1)
            }
        }
        var sIndex = index+yoko
        if(S && !stack.contains(sIndex)){
            if(!old.contains(sIndex)){
                stack.offer(sIndex)
                costs[sIndex] = cost+1
            }else{
                costs[sIndex] = Math.min(costs[sIndex]!!,cost+1)
            }
        }
        var wIndex = index-1
        if(W && !stack.contains(wIndex)){
            if(!old.contains(wIndex)){
                stack.offer(wIndex)
                costs[wIndex] = cost+1
            }else{
                costs[wIndex] = Math.min(costs[wIndex]!!,cost+1)
            }
        }

        //探索済みに
        old.add(index)

        //進めない&stackなし => break
        if(stack.size == 0){
            break
        }

        //xy更新
        index = stack.poll()
        X = index%yoko
        Y = index/yoko
    }

    return costs.values.max() ?: 0
}

Measured memory_bytes: 67840
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,x;cin >> n >> x;
	vector<int> a(n);
	rep(i,n) cin >> a.at(i);
	ll ans=0;
	rep(i,n-1){
		if(a.at(i)+a.at(i+1)>x){
			ans+=a.at(i)+a.at(i+1)-x;
			a.at(i+1)=max(x-a.at(i),0);
		}
	}
	cout << ans << endl;
}

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

int main()
{
    ll n, m;
    cin >> n >> m;
    ll ans = n * (n - 1) / 2 + m * (m - 1) / 2;
    cout << ans << endl;
    return 0;
}


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

#define int long long

#define pb push_back
#define mp make_pair
#define st first
#define nd second
typedef pair < int , int > pp;
const int mod = 1e9 + 7;
const int N   = 2e5 + 5;

int n,k,i,j,ans;

signed main(){
    cin >> n >> k;
    for(i=1;i<=n;i++){
        for(j=i;j<=n;j+=i){
            ans += max(0LL , min(n-j+1,i)-k);
        }

    }
    cout << ans + (n-k) * (n-k+1) / 2 - n*(k==0);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define pb push_back
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
signed main()
{
    SPEED;
  	int n;
    cin>>n;
    int sum=0;
    for(int i=1;i<=n;++i)
    {
        if(i%3==0 || i%5==0)
            continue;
        sum+=i;
    }
    cout<<sum;
}

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

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; }

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;


int main(){
    int n;
    cin >> n;
    vector<ll>a(n);
    rep(i, 0, n)cin >> a[i];
    reverse(a.begin(),a.end());
    ll mx = 3, mn = 2;
    if(a[0]!=2){
        cout << -1 << endl;
        return 0;
    }
    rep(i, 0, n){
        mn = (mn+a[i]-1)/a[i]*a[i];
        mx = (mx+a[i]-1)/a[i]*a[i];
        //cout << mn << " " << mx << endl;
    }
    if(mn==mx){
        cout << -1 << endl;
        return 0;
    }else cout << mn << " " << mx-1 << endl;
}

Measured memory_bytes: 4028
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int w, n, l[][], num[];
		int i;
		int tmp;
		String str;
		String str1[];

		Scanner sc = new Scanner(System.in);

		w = sc.nextInt();
		n = sc.nextInt();

		num = new int[w];
		str1 = new String[2];

		for (i = 0; i < w; ++i) {
			num[i] = i + 1;
		}

		l = new int[n][2];

		for (i = 0; i < n; ++i) {
			str = sc.next();
			str1 = str.split(",");
			l[i][0] = Integer.parseInt(str1[0]) - 1;
			l[i][1] = Integer.parseInt(str1[1]) - 1;
			// swap
			tmp = num[l[i][0]];
			num[l[i][0]] = num[l[i][1]];
			num[l[i][1]] = tmp;
		}
		// show answer
		for (i = 0; i < w; ++i) {
			System.out.println(num[i]);
		}
		sc.close();
	}

}


Measured memory_bytes: 26080
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const ll INF = 1e9 + 7;
const ll inf = 1LL << 50;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
///////////////////////////////////////


int main() {
	int N, T; cin >> N >> T;
	int A[100100];
	REP(i, N)cin >> A[i];
	vector<int>Max;
	Max.push_back(0);
	for (int i = N - 1; i >= 0;--i) {
		Max.push_back(max(Max[N-i-1], A[i]));
	}
	int diff = Max[N - 1] - A[0];
	for (int i = 1; i < N - 1; ++i) {
		diff = max(diff, Max[N - i - 1] - A[i]);
	}
	int ans = 0;
	bool key[100100];
	REP(i, 100100)key[i] = false;
	for (int i = 0; i < N - 1; ++i) {
		if (diff == Max[N - i - 1] - A[i]) {
			key[i] = true;
		}
	}
	REP(i, N) {
		if (key[i])ans++;
	}
	cout << ans << endl;
	return 0;
}

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

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define mp make_pair
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define MOD 1000000007

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if(a == b && b== c) cout << "Yes" <<endl;
  else cout <<"No" <<endl;
  return 0;
  
}


Measured memory_bytes: 256
/*
[arc098] E - Range Minimum Queries
*/

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

const int MAX_N = 2000;
const int INF = 1e9 + 1;

int N, K, Q;
int a[MAX_N + 1];

int solve() {
    int ans = INF;
    for (int yi = 0; yi < N; yi++) {
        int y = a[yi];
        int pre_i = -1;
        vector<int> cands;
        for (int i = 0; i <= N; i++) {
            if (a[i] >= y) {
                continue;
            }
            vector<int> cand(a + pre_i + 1, a + i);
            pre_i = i;
            if ((int)cand.size() >= K) {
                sort(cand.begin(), cand.end());
                cands.insert(cands.end(), cand.begin(), cand.end() - K + 1);
            }
        }
        if ((int)cands.size() >= Q) {
            sort(cands.begin(), cands.end());
            ans = min(ans, cands[Q - 1] - y);
        }
    }
    return ans;
}

int main() {
    cin >> N >> K >> Q;
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    a[N] = -1;

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 384
#include <cstdio>

#define ll long long
#define maxn 100000

int v[maxn + 2];

int main() {
    int n, x;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &x);
        if (x > 0)
            v[x - 1]++;
        v[x]++;
        v[x + 1]++;
    }
    int maxx = -1;
    for (int i = 0; i <= maxn + 1; i++) {
        if (v[i] > maxx)
            maxx = v[i];
    }
    printf("%d", maxx);
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

int main(){
  int n;
  i64 y;
  cin >> n >> y;
  for(int i = 0;i <= n && i * 1000 <= y;i++) {
    for(int j = 0;i + j <= n && i * 1000 + j * 5000 <= y;j++){
      i64 sum = i * 1000 + j * 5000;
      if((y - sum) / 10000 + i + j == n && (y - sum) % 10000 == 0){
        cout << (y - sum) / 10000 << " " << j << " " << i << endl;
        return 0;
      }
    }
  }
  cout << "-1 -1 -1" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

//keyence2019_b
int main(){
  string S;
  cin >> S;



  string ke = "keyence";
  //一度だけ取り除ける
  //適当にとった7文字がkeyenceであるか

  bool isOK = false;

  for(ll i = 0; i < S.size();++i)
  {
      for(ll j = i; j <= S.size(); ++j)
      {
          string tmp = S.substr(0,i) + S.substr(j);
          if (tmp == ke) isOK = true;
      }
  }


  if(isOK)
  {
      cout << "YES" << endl;
  }
  else
  {  
      cout << "NO" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int const nax = 3e5 + 10;


int main(){
    int h, n, x;
    cin >> h >> n;
    for(int i = 1 ;i <= n; i ++){
        scanf("%d", &x);
        h -= x;
    }
    printf(h <= 0 ? "Yes" : "No");
}
/*
    Good Luck
        -Lucina
*/


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

using namespace std;

#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define X first
#define Y second
#define mx1 10
#define mx2 110
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

typedef vector<LL> Vl;
typedef vector<DD> Vd;
typedef vector<bool> Vb;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef pair<DD, DD> Pdd;
typedef vector<Pll> Vpl;
typedef vector<Pdd> Vpd;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
typedef deque<LL> Dl;

LL _set(LL N, LL pos) {return N = N | (1 << pos);}
LL _reset(LL N, LL pos) {return N = N & ~(1 << pos);}
bool _check(LL N, LL pos) {return (bool)(N & (1 << pos));}
bool _upper(char a) {return a >= 'A' && a <= 'Z';}
bool _lower(char a) {return a >= 'a' && a <= 'z';}
bool _digit(char a) {return a >= '0' && a <= '9';}

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

///**************************DONE****************************///

int main()
{
    LL n, m, d;
    cin >> n >> m >> d;

    DD x = (DD)(n - d) / (DD)n, y = (DD)(m - 1) / (DD)n;
    DD ans = 2 * x * y;

    if(!d)
        ans = (DD)(m - 1) / (DD)n;

    cout << fixed << setprecision(12) << ans << '\n';
    return 0;
}


Measured memory_bytes: 3756
#include <stdio.h>
int n; bool prime[40000];
int main() {
	for(int i = 2; i < 40000; i++) prime[i] = true;
	for(int i = 2; i * i < 40000; i++) {
		if(!prime[i]) continue;
		for(int j = i * i; j < 40000; j += i) prime[j] = false;
	}
	while(scanf("%d", &n), n) {
		int ret = 0;
		for(int i = 2; i <= n / 2; i++) {
			if(prime[i] && prime[n - i]) ret++;
		}
		printf("%d\n", ret);
	}
}

Measured memory_bytes: 2616
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;
use proconio::*;
use std::collections::VecDeque;
use std::io::stdin;
use std::str::FromStr;
use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let mut sc = Scanner::new();
    let n = sc.next_usize();
    let mut v = vec![false; n];
    for i in 0..n {
        let a = sc.next_isize();
        let b = sc.next_isize();
        if a == b {
            v[i] = true;
        }
    }

    for i in 2..n {
        if v[i] && v[i - 1] && v[i - 2] {
            println!("Yes");
            return;
        }
    }

    println!("No");
}

pub struct Scanner {
    buf: VecDeque<String>,
}

impl Scanner {
    pub fn new() -> Self {
        Self {
            buf: VecDeque::new(),
        }
    }

    fn scan_line(&mut self) {
        let mut flag = 0;
        while self.buf.is_empty() {
            let mut s = String::new();
            stdin().read_line(&mut s).unwrap();
            let mut iter = s.split_whitespace().peekable();
            if iter.peek().is_none() {
                if flag >= 5 {
                    panic!("There is no input!");
                }
                flag += 1;
                continue;
            }

            for si in iter {
                self.buf.push_back(si.to_string());
            }
        }
    }

    pub fn next<T: FromStr>(&mut self) -> T {
        self.scan_line();
        self.buf
            .pop_front()
            .unwrap()
            .parse()
            .unwrap_or_else(|_| panic!("Couldn't parse!"))
    }

    pub fn next_usize(&mut self) -> usize {
        self.next()
    }

    pub fn next_isize(&mut self) -> isize {
        self.next()
    }

    pub fn next_chars(&mut self) -> Vec<char> {
        self.next::<String>().chars().collect_vec()
    }

    pub fn next_string(&mut self) -> String {
        self.next()
    }

    pub fn fill_vec_line<T: FromStr>(&mut self, v: &mut Vec<T>) {
        for vi in v {
            *vi = self.next();
        }
    }

    pub fn fill_vec<T: FromStr>(&mut self, v: &mut Vec<Vec<T>>) {
        for vi in v {
            for vii in vi {
                *vii = self.next();
            }
        }
    }

    pub fn make_vec_line<T: FromStr + Default + Clone>(&mut self, i: usize) -> Vec<T> {
        let mut v = vec![Default::default(); i];
        self.fill_vec_line(&mut v);
        v
    }

    pub fn make_vec<T: FromStr + Default + Clone>(&mut self, i: usize, j: usize) -> Vec<Vec<T>> {
        let mut v = vec![vec![Default::default(); j]; i];
        self.fill_vec(&mut v);
        v
    }
}


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

long long solve(long long N) {
    if (N % 2 == 1) return 0;

    long long res = 0;
    N /= 2;
    while (N) {
        res += N / 5;
        N /= 5;
    }
    return res;
}

int main() {
    long long N; cin >> N;
    cout << solve(N) << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

class Main {

	static long changecount = 0;
   public static void main(String args[]) throws IOException{

	   Scanner sc = new Scanner(System.in);
	   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	   int n = Integer.parseInt( br.readLine()  );

	   Tree tree = new Tree();

	   /*
	   tree.insert(30);
       tree.insert(88);
       tree.insert(12);
       tree.insert(1);
       tree.insert(20);
       tree.insert(17);
       tree.insert(25);
       tree.inorder(tree.root);
       System.out.println();
       tree.preorder(tree.root);
       */

       for(int i = 0; i < n ; i++){

    	   String[] string =  br.readLine().split(" ");
    	   if( string[0].equals("insert") ){
    		   tree.insert( Integer.parseInt(string[1]) );
    	   }
    	   else if(string[0].equals("print")) {
    		   tree.inorder(tree.root);
    	       System.out.println();
    	       tree.preorder(tree.root);
    	       System.out.println();
    	   }

       }



   }


}



class Node{

	int  key;
	Node left;
    Node right;
    Node parent;

    Node(int x) {
        key = x;
        left = null;
        right = null;
        parent = null;
    }

}




class Tree{

	Node root = null;


	void insert( int date ){

		Node z = new Node(date);
		Node y = null;
		Node x = root;

		while(x != null){
			 y = x ;// ???????¨????
			 if( z.key < x.key ){
				 x = x.left; // ?????????????§????
			 }
			 else{
				 x = x.right; // ?????????????§????
			 }

		}

		z.parent = y;

		if ( y == null ){
            root = z;
		}
		else if(z.key < y.key){
			y.left = z; // z ??? y ?????????????????????

		}
		else{
			y.right = z ;// z ??? y ?????????????????????
		}


	}



	 void preorder(Node tree) {

	        if (tree != null) {
	       	 System.out.print(" " + tree.key);
	        	preorder(tree.left);

	           preorder(tree.right);
	       }
	}

	    void inorder (Node tree) {

	    	         if (tree != null) {

	    	        	inorder(tree.left);
	    	            System.out.print(" " + tree.key);
	    	            inorder(tree.right);
	    	        }
	     }


	    void postorder (Node tree) {
	        if (tree != null) {

	        	postorder(tree.left);
	        	postorder(tree.right);
	            System.out.print(" " + tree.key);
	       }
	}




}

Measured memory_bytes: 151252
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long t=1;
    //cin>>t;
    for(long long q=0;q<t;q++){
        long long n;
        cin>>n;
        double a=((double)n)/3;
        a=a*a*a;
        cout<<fixed<<setprecision(12)<<a<<"\n";
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
const int MAXN = 1234;
vector<int> nG[MAXN * MAXN], oG[MAXN];
int dp[MAXN * MAXN], color[MAXN * MAXN];
bool dfs(int cur) {
     if (color[cur] == 2) return true;
     color[cur] = 1;
     for (int i : nG[cur]) {
         if (color[i]) {
            if (color[i] == 1) return false;
         }
         if (!dfs(i)) return false;
     }
     color[cur] = 2;
     return true;
}

int dfs2(int cur) {
    if (dp[cur]) return dp[cur];
    int cnt = 0;
    for (int i : nG[cur]) {
        cnt = max(cnt, dfs2(i));
    }
    return dp[cur] = cnt + 1;
}

int main() {
    int N;
    scanf("%d", &N);
    for (int i = 1; i <= N; i++) {
        for (int j = 0; j < N - 1; j++) {
            int tmp;
            scanf("%d", &tmp);
            oG[i].push_back(tmp);
        }
    }
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j < N - 1; j++) {
            int r1 = i, c1 = oG[i][j - 1], r2 = i, c2 = oG[i][j];
            if (r1 > c1) swap(r1, c1);
            if (r2 > c2) swap(r2, c2);
            int s = r1 * N + c1, t = r2 * N + c2;
            //printf("s = %d t = %d\n", s, t);
            nG[s].push_back(t);
        }
    }
    for (int i = 0; i < N * N; i++) {
        if (!color[i] && !dfs(i)) return !printf("-1\n");
    }
    int ans = 0;
    for (int i = 0; i < N * N; i++) {
        ans = max(dfs2(i), ans);
    }
    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 67584
s = input()
counts = []
count = 0
for i in range(len(s)):
    c = s[i:len(s)+1]
    for j in c:
        if "A" in j or "C" in j or "G" in j or "T" in j:
            count += 1
        else:
            break
    counts.append(count)
    count = 0
max_count = max(counts)
print(max_count)    

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#include<math.h>
#define ll long long int
#define ve vector<int>
#define vl vector<long long int>
#define all(a) a.begin(),a.end()
using namespace std;

int main(){
  int n;
  cin>>n;
  vl a(n),b(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  reverse(all(a));
  if(n%2==0){
    for(int i=0;i<n;i+=2){
      cout<<a[i]<<' ';
    }
    reverse(all(a));
    for(int i=0;i<n;i+=2){
      cout<<a[i]<<' ';
    }
  }
  else{
        for(int i=0;i<n;i+=2){
      cout<<a[i]<<' ';
    }
    reverse(all(a));
    for(int i=1;i<n;i+=2){
      cout<<a[i]<<' ';
    }
  }
  cout<<endl;
}

Measured memory_bytes: 5248
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		c = c - (a - b);
		if (c < 0) {
			c = 0;
		}

		System.out.println(c);

		sc.close();
	}
}


Measured memory_bytes: 23508
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream& operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream& operator<<(ostream &os, vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream& operator<<(ostream &os, set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream& operator<<(ostream &os, pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream& operator<<(ostream &os, map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;

int N, M;
constexpr int Nmax = 200000;
int A[Nmax];
int count_[Nmax + 1];
int dup[Nmax + 1];

int main()
{
    scanf("%d%d", &N, &M);
    memset(count_, 0, sizeof(count_));
    memset(dup, 0, sizeof(dup));
    REP(i, N)
    {
        scanf("%d", &A[i]);
        if (A[i] - count_[A[i]] > 0) dup[A[i] - count_[A[i]]]++;
        count_[A[i]]++;
    }

    int invans = 0;
    REP(i, N) if (dup[i + 1]) invans++;

    REP(_, M)
    {
        int X, Y;
        scanf("%d%d", &X, &Y);

        int del = A[X - 1];
        count_[del]--;
        if (del - count_[del] > 0)
        {
            dup[del - count_[del]]--;
            if (dup[del - count_[del]] == 0) invans--;
        }
 
        A[X - 1] = Y;
        if (Y - count_[Y] > 0)
        {
            dup[Y - count_[Y]]++;
            if (dup[Y - count_[Y]] == 1) invans++;
        }
        count_[Y]++;
        printf("%d\n", N - invans);
    }
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<c;++i)
#define PI 3.14159265358979323846264338327950L
typedef unsigned long long uint64;
using namespace std;
int main(){
  string s;
  string t;
  cin >> s>> t;
  int ans = 0;
  for(int i=0;i<s.length();i++){
    if(s[i]!=t[i]){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3920
n, m = gets.chomp.split(" ").map(&:to_i)

if m == 0 then
    puts "Yes"
    exit
end

h = {}
m.times do
    l, r, d = gets.chomp.split(" ").map(&:to_i)

    h[l] = [] if h[l] == nil
    h[l] << [r, d]
    h[r] = [] if h[r] == nil
    h[r] << [l, -d]
end

p = Array.new(n+1, nil)
checked = Array.new(n+1, false)

stack = []

1.upto(n) do |i|
    next if checked[i] == true
    stack.push(i)
    while(stack.size > 0) do
        i = stack.pop
        p[i] = 0 if p[i] == nil

        next if checked[i] == true

        checked[i] = true

        if h[i] == nil
            next
        end
        while h[i].size > 0 do
            r, d = h[i].pop
            if p[r] != nil && p[r] - p[i] != d
                puts "No"
                exit
            end
            p[r] = p[i] + d
            stack.push(r)
        end
    end
end

puts "Yes"


Measured memory_bytes: 61236
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}
int main(){
	int a;scanf("%d",&a);
	printf("%d\n",(a/2)*((a+1)/2));
}


Measured memory_bytes: 128
#include<iostream>
#include<string.h>
#include<queue>
#include<map>
#include<vector>
#include <cstdlib>
#include<algorithm>
#include <cstdio>
#include <cctype>
using namespace std;
const long long INF=10000000000000LL;
typedef long long ll;
typedef pair<ll,ll> P;
ll N,M,K=1,C;
ll A,B,W;
ll T,a,b;
ll ans=0;
bool h,o;
//bool D[100005];
char str1[55][55],str2[55][55];
map<string,int> m;
vector<int> v[10];
ll reg(int n,ll S ){
//	cout<<n<<" "<<S<<endl;
	if(S==K)return 1;
	int res=0;
	for(int i=0;i<v[n].size();++i){
		if(!(S>>(v[n][i]-1)&1)){
			res+=reg(v[n][i],S|1<<(v[n][i]-1));
		}
	}
	return res;
}
int main(){
	cin>>N>>M;
	for(int i=0;i<M;++i){
		cin>>a>>b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	for(int i=0;i<N;++i)K*=2;
	K--;
	cout<<reg(1,1)<<endl;
	return 0;
}


Measured memory_bytes: 256
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	return sc
}

func main() {
	sc = initScanner(os.Stdin)
	resolve()
}

func resolve() {
	n, k := scanInt(sc), scanInt(sc)
	as := nextIntSlice(sc, n)
	for i := k + 1; i <= n; i++ {
		if as[i-(k-1)-1-1] < as[i-1] {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	a, _ := strconv.Atoi(sc.Text())
	return int(a)
}

func nextString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nextIntSlice(sc *bufio.Scanner, n int) (a []int) {

	a = make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = nextInt(sc)
	}
	return a
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


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

int main() {
    long x, y, n, d;
    int count = 0;

    cin >> n >> d;
    d *= d;
    for (int i = 0; i < n; ++i) {
        cin >> x >> y;
        if (x * x + y * y <= d) {
            ++count;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 3620
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.TreeSet;

public class Main {
    Scanner sc = new Scanner(System.in);
  
    public static void main(String[] args) {
        new Main(); 
    }
  
    public Main() {
    	new B().doIt();
    }
    class B{
    	String set[] = new String[5];
    	boolean slits[] = new boolean[10];
    	String map[][] = new String[2][10];
    	TreeSet<String> ts = new TreeSet<String>();
    	int result = 0;
    	void doIt(){
    		while(true){
    			String str = sc.nextLine();
    			if(str.equals("END"))break;
    			String slit[] = str.split(" ");
    			for(int i = 0;i < 10;i++){
    				map[0][i] = slit[i];
    				map[1][i] = new StringBuilder(slit[i]).reverse().toString();
//    				System.out.println(i+" "+map[0][i]+" "+map[1][i]);
    			}
    			dfs(0,"");
    			System.out.println(result/8);
    			ts.clear();
    			result = 0;
    		}
        }
    	void dfs(int deep,String str){
//    		if(ts.add(str)){
    			if(deep < 5){
    				for(int i = 0;i < 10;i++){
    					if(slits[i])continue;
    					slits[i] = true;
    					set[deep] = map[0][i];
    					dfs(deep+1,str+map[0][i]);
    					set[deep] = map[1][i];
    					dfs(deep+1,str+map[1][i]);
    					slits[i] = false;
    				}
    			}else if(deep < 10){
    				for(int i = 0;i < 10;i++){
    					if(slits[i])continue;
    					slits[i] = true;
    					int num = deep % 5;
    					boolean ok = true;
    					for(int j = 0;j < 5;j++){
    						if(set[j].charAt(num) == map[0][i].charAt(j)){
    							ok = false;
    						}
    					}
    					if(ok){
							dfs(deep+1,str+map[0][i]);
						}
    					ok = true;
    					for(int j = 0;j < 5;j++){
    						if(set[j].charAt(num) == map[1][i].charAt(j)){
    							ok = false;
    						}
    					}
    					if(ok){
							slits[i] = true;
							dfs(deep+1,str+map[1][i]);
						}
    					slits[i] = false;
    				}
    			}else if(deep == 10){
    				if(ts.add(str))result++;
//    				System.out.println(result);
    			}
//    		}
//    		for(int i = 0;i < 5;i++){
//    			System.out.println(set[i]);
//    		}
//    		for(int i = 0;i < 10;i++){
//    			if(slits[i])System.out.print(i+" ");
//    		}
//    		System.out.println();
    	}
    }
}

Measured memory_bytes: 283872
from bisect import bisect
import sys


if __name__ == "__main__":
    n = int(input())
    a = [0] * n
    for i in range(n):
        a[i] = int(input())

    dp = [sys.maxsize] * (n + 1)
    dp[0] = -1

    for elem in a:
        idx = bisect(dp, elem - 1)
        dp[idx] = min(elem, dp[idx])

    ans = max(i for i in range(n + 1) if dp[i] < sys.maxsize)
    print(ans)



Measured memory_bytes: 10276