akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string.h>
#include <algorithm>
using namespace std;
int main(void){
    int A,B,C;
    cin>>A>>B>>C;
    if(A<=C&&C<=B){cout<<"Yes";}
    else if(B<=C&&C<=A){cout<<"Yes";}
    else cout<<"No";
    return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main(){

    input!{
        n: usize,
        a: [u128;n],
    }

    let max = (10 as i64).pow(18);
    let mut ans: u128 = 1;

    for &i in &a {
        if i==0 {
            println!("0");
            return;
        }
    }
    for &i in &a {
        ans *= i;
        if ans > max as u128 {
            println!("-1");
            return;
        }
    }

    println!("{}", ans);
}

Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
	int a, b, d, r;
	double f;
	cin >> a >> b;
	d = a/b;
	r = a%b;
	f = double(a)/double(b);
	printf("%d %d %.5f\n",d,r,f);
	return 0;
}

Measured memory_bytes: 3204
class Node:

    def __init__(self):
        self.distime = 0
        self.fintime = 0

    def input_data(self, nodes):
        data = input().split()
        self.number = int(data[0])
        self.v = [nodes[int(x) - 1] for x in data[2:]]

    @property
    def status(self):
        return bool(self.distime) + bool(self.fintime)

class Stack:
    def __init__(self, size):
        self.size = size
        self.N = [None for _ in range(size)]
        self.top = 0

    def is_emtpy(self):
        return self.top == 0

    def is_full(self):
        return self.top == self.size

    def front(self):
        return self.N[self.top - 1]

    def push(self, x):
        if self.is_full():
            raise OverflowError
        self.N[self.top] = x
        self.top += 1

    def pop(self):
        if self.is_emtpy():
            raise IndexError
        self.top -= 1
        return self.N[self.top]


def visit(node: Node):
    global t
    stack.push(node)
    t += 1
    node.distime = t
    while not stack.is_emtpy():
        u: Node = stack.front()
        try:
            v = next(i for i in u.v if i.status == 0)
        except StopIteration:
            stack.pop()
            t += 1
            u.fintime = t
        else:
            if v.status == 0:
                stack.push(v)
                t += 1
                v.distime = t


n = int(input())
stack = Stack(n)
nodes = [Node() for _ in range(n)]
[node.input_data(nodes) for node in nodes]
t = 0
for node in nodes:
    if node.status == 0:
        visit(node)

nodes.sort(key=lambda i: i.number)
for node in nodes:
    print(f"{node.number} {node.distime} {node.fintime}")


Measured memory_bytes: 5672
import bisect
import heapq
import itertools
import math
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18

N, K = list(map(int, sys.stdin.readline().split()))
A = list(map(int, sys.stdin.readline().split()))
A = np.array(A)

S = A.sum()
ddp = np.full(((10 ** 12).bit_length() + 1, 2), -IINF, dtype=np.int64)
ddp[-1][0] = 0
for d in reversed(range(len(ddp) - 1)):
    mask = 1 << d
    xxor = ((A ^ mask) & mask).sum()
    nxor = (A & mask).sum()

    if K & mask > 0:
        ddp[d, 0] = max(ddp[d, 0], ddp[d + 1, 0] + xxor)
        ddp[d, 1] = max(ddp[d, 1], ddp[d + 1, 0] + nxor)
    else:
        ddp[d, 0] = max(ddp[d, 0], ddp[d + 1, 0] + nxor)
    ddp[d, 1] = max(ddp[d, 1], ddp[d + 1, 1] + xxor)
    ddp[d, 1] = max(ddp[d, 1], ddp[d + 1, 1] + nxor)
print(int(ddp[0, :].max()))


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

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


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

int main() {
  string n;
  cin >> n;
  int c=0;
  for(int i=0;i<n.length();i++){
     c+=n[i] - '0';
  }
  if(c%9==0){
      cout << "Yes" << endl;
  }
  else{
      cout << "No" << endl;
  }
}

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

int main(){


  int a = 0 , b = 0 , kekka = 0 ;
  char op ;


 



  while(1){

  cin >> a >> op >> b ;



    if( op == '+' ){
     
      kekka = a + b;


    } else if( op == '-' ){

      kekka = a - b;


    } else if( op == '*' ){

      kekka = a * b;
	

    } else if( op == '/' ){

      kekka = a / b;

	
    } else { break;

    

}
    cout << kekka << "\n";

}
    return 0;

  }

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1000000007;
const int INF = 1001001001;

int main() {
  int n, x, t;
  cin >> n >> x >> t;
  int ans = ((n + x - 1) / x ) * t;
  cout << ans << endl;
}

Measured memory_bytes: 3592
#include<stdio.h>
char s[20];
int f(int p,int n){
	if(n==4)return !s[p];
	int ans=0;
	int atai=0;
	for(int i=0;i<3;i++){
		if(!s[p+i])break;
		if(i==0&&s[p+i]=='0'){
			ans=f(p+1,n+1);
			break;
		}
		atai=atai*10+s[p+i]-48;
		if(atai>255)break;
		ans+=f(p+i+1,n+1);
	}
	return ans;
}

int main(){
	scanf("%s",s);
	printf("%d\n",f(0,0));
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

void bubble_sort(int a[], int n) {
  bool flag = true;
  int c = 0;
  while (flag) {
    flag = false;
    repr(j, 1, n) {
      if (a[j] < a[j - 1]) {
        swap(a[j], a[j - 1]);
        c++;
        flag = true;
      }
    }
  }
  rep(i, 0, n) {
    if (i > 0)
      cout << " ";
    cout << a[i];
  }
  cout << endl;
  cout << c << endl;
}

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

  int n;
  cin >> n;
  int a[n];
  rep(i, 0, n) cin >> a[i];
  bubble_sort(a, n);
}



Measured memory_bytes: 3164
#include <bits/stdc++.h>
#define rep(i, a) for (ll i = 0; i < (a); ++i)
#define pb push_back
#define all(v) v.begin(),v.end()
#define sort_1(v) sort(v.begin(),v.end())
#define sort_2(v) sort(v.begin(),v.end(),greater<ll>())
typedef long long ll;
typedef long double la;
using namespace std;

ll digsum(ll n){
  ll res = 0;
  while(n > 0){
    res += n%10;
    n /= 10;
  }
  return res;
}

int main(){
  ll n;
  cin >> n;
  ll num = digsum(n);
  if(n % num == 0){
    cout << "Yes" << endl;
    return 0;
  }else{
    cout << "No" << endl;
    return 0;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
const int N=100005;
int n,a[N];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	long long l=2ll,r=2ll;
	for(int i=n;i>=1;i--)
	{
		l=(l+a[i]-1)/a[i]*a[i];
		r=(r/a[i])*a[i]+a[i]-1;
	}
	if(l>r)
		puts("-1");
	else
		printf("%lld %lld\n",l,r);
	return 0;
}

Measured memory_bytes: 640
import java.io.*;

public class Main{
    public static void main(String[] args)throws IOException{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	int  kingau = 0;
	double heikin = 0;
	int i =0;
	String buf;
	while((buf = br.readLine())!=null){
	    String[] data = buf.split(",");
	    int tanka =Integer.parseInt(data[0]);
	    int suu =Integer.parseInt(data[1]);
	    kingau += tanka * suu;
	    heikin += suu;
	    i++;
	}
	heikin /=(double)i;
	System.out.println(kingau);
	System.out.println((int)Math.floor(heikin+0.5));
    }
}
			   

Measured memory_bytes: 9352
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
 
long long int INF = 3e18;
double Pi = 3.1415926535897932384626;
 
vector<ll> G1[500005];
vector<ll> G2[500005];
//vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←
 
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
 
 
ll mod = 1000000007;
ll rui(ll number1,ll number2){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
 
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
 
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
 
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}

 
//ll fact[800005],rfact[800005];
/*
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=800000; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[800000] = rui(fact[800000],mod - 2);
    for(ll i=800000; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod) * rfact[n-r]) % mod;}
*/
 
ll n,m,num,sum,ans,a,b,c,e,g,h,w,i,j,k,q;
vector <ll> table[5000];
ll x[500005],y[500005];
char s[500005][15];
ll push_num;

int main(){
    cin >> a >> b;
    x[0] = a + b;
    x[1] = a - b;
    x[2] = a * b;
    sort(x,x+3);
    p(x[2]);
    
    return 0;
}












Measured memory_bytes: 26624
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

int main() {
    vector<ll> x(5);
    ll k;
    for (ll i = 0; i < 5; i++) {
        cin >> x[i];
    }
    cin >> k;
    bool ok = x[4] - x[0] <= k;

    cout << (ok ? "Yay!" : ":(") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  int n; cin >> n;
  printf("AB%c\n",'C'+n/1000);
  return 0;
}

Measured memory_bytes: 256
n, m, k = map(int, input().split())
mod =998244353
 
def cmb1(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
 
mod = 998244353 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
 
for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
 
def power(a, n, mod):
  bi=str(format(n,"b")) #2進数
  res=1
  for i in range(len(bi)):
    res=(res*res) %mod
    if bi[i]=="1":
      res=(res*a) %mod
  return res
 
ans = 0
for x in range(k+1):
    temp = cmb1(n-1, x, mod)
    temp *= m*power(m-1, n-1-x, mod)
    ans += temp
print(ans%mod)

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

long long inf = 1e18, t, a, T, A;
int n;

int main()
{
    cin >> n;
    while(n--)
    {
        cin >> T >> A;
        long long s = 1, f = min(inf/T, inf/A);
        while(s < f)
        {
            long long mid = s + (f-s)/2;
            if(mid*T >= t && mid*A >= a) f = mid;
            else s = mid+1;
        }
        t = T*f;
        a = A*f;
    }
    cout << t+a << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
int main(){
  int i, a, b, N, s[100], f[100], Flag=0;
  cin>>a>>b;
  cin>>N;
  for(i=0; i<N; i++){cin>>s[i]; cin>>f[i];}
  for(i=0; i<N; i++){
    if(s[i]<a && a<f[i]){
       Flag=1;
    }else if(s[i]<b && b<f[i]){
      Flag=1;
    }else if(a<=s[i] && f[i]<=b){
      Flag=1;
    }
  }
  cout<<Flag<<endl;
  return 0;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=15;
int a[N+5],n,vis[N+5][N+5][1<<N];
ll dp[N+5][N+5][1<<N];
ll dfs(int L,int R,int lt,int rt,int id){
	if(L>R)return 0;
	if(L==R)return (ll)(lt+rt)*a[L];
	if(vis[L][R][id])return dp[L][R][id];
	ll ret=LLONG_MAX;
	for(int i=L;i<=R;++i)
		ret=min(ret,dfs(L,i-1,lt,lt+rt,id*2)+dfs(i+1,R,lt+rt,rt,id*2+1)+(ll)(lt+rt)*a[i]);
	vis[L][R][id]=1;dp[L][R][id]=ret;
	return ret;
}
int main(){
	cin>>n;
	for(int i=1;i<=n;++i)cin>>a[i];
	cout<<dfs(2,n-1,1,1,1)+a[1]+a[n]<<endl;
	return 0;
}

Measured memory_bytes: 98688
n = int(input())
count = 0
def divCount(n):
    cnt = 0
    for i in range(1, n+1):
        if n % i == 0:
            cnt += 1
    return cnt
for i in range(1,n + 1):
    if i%2 != 0:
        if divCount(i) == 8:
            count += 1
print(count)

Measured memory_bytes: 3060
#include <stdio.h>

int main(){
  int h;
  int w;
  int i;
  int j;
  int k;
  while(1)
    {
  scanf("%d %d",&h  ,&w);
  if( h==0 && w==0)break;
  for(i = 0; i < h; i++)
    {
    for(j = 0; j < w; j++)
      {
	if( i ==0 || (i+1)==h || j==0 || (j+1)==w   ){
	printf("#");
      }else{
	printf(".");
      }
    }
    printf("\n");
    }
  printf("\n");
  }

  

  return 0;
    
}

Measured memory_bytes: 572
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//V,P(大文字)使用不可

const ll INF=1e18;

const int max_E=200005;

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

struct edge{int u,v;ll cost;};

bool comp(const edge& e1,const edge& e2){
    return e1.cost<e2.cost;
}

edge es[max_E];
int N,M;

ll kruskal(){
    sort(es,es+M,comp);
    UnionFind tree(N);
    ll res=0;
    for(int i=0;i<M;i++){
        edge e=es[i];
        if(!tree.same(e.u,e.v)){
            tree.unite(e.u,e.v);
            res+=e.cost;
        }
    }
    return res;
}

signed main(){
    cin>>N;
    M=2*N-2;
    V<pair<ll,pair<ll,int>>> p(N),q(N);
    rep(i,N){
        ll x,y;
        cin>>x>>y;
        p[i]=make_pair(x,make_pair(y,i));
        q[i]=make_pair(y,make_pair(x,i));
    }
    sort(all(p));
    sort(all(q));
    V<pair<ll,pair<int,int>>> pq;
    rep(i,N-1){
        pq.push_back(make_pair(p[i+1].ft-p[i].ft,make_pair(p[i+1].sc.sc,p[i].sc.sc)));
        pq.push_back(make_pair(q[i+1].ft-q[i].ft,make_pair(q[i+1].sc.sc,q[i].sc.sc)));
    }
    sort(all(pq));
    int s=0;
    for(auto pp:pq){
        es[s].u=pp.sc.ft;
        es[s].v=pp.sc.sc;
        es[s].cost=pp.ft;
        s++;
    }
    cout<<kruskal()<<endl;
}

Measured memory_bytes: 12524
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N;
		N = sc.nextInt();
		Set<Integer> set = new HashSet<Integer>();
		for(int i=0; i < N; ++i) {
			int s = sc.nextInt();
			set.add(s);
		}
		System.out.println(set.size());
	}
}


Measured memory_bytes: 21972
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"
#define lp(n) for (int i = 0; i < n; i++)
#define lop(n,i) for (int i = 0; i < n; i++)
#define mod 1000000007
#define ll long long int
#define sp ' '
#define intmax 2147483647
#define intmin -2147483647
#define llmax 9223372036854775807
using namespace std;

int n, m;



int main(){
	cin >> n >> m;
	cout << ((n * 100 + m * 1800) << m) << endl;
	return 0;
}

Measured memory_bytes: 256
// Charan Sriramula
 
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long int ll;
 
const ll lg=22;
const ll N=2e5+5;
const ll M=5e8;
const ll INF=1e18;
const ll mod=1e9+7;
const double PI = 3.14159265358979323846;
 
#define is(n) scanf("%d",&n)
#define io(n) printf("%d\n",n)
#define ls(n) scanf("%lld",&n)
#define lo(n) printf("%lld\n",n)
 
#define f first
#define s second
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define mp(x,y) make_pair(x,y)
#define GCD(a,b) __gcd((a),(b))
#define all(v) v.begin(),v.end()
#define bits(x) __builtin_popcount(x)
#define LCM(a,b) ((a)*(b))/GCD((a),(b))
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
template<typename T> T power(T x,T y,ll m){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}
 
inline ll mul(ll a, ll b, ll p){ return (a * 1ll * b) % p; }
inline ll sub(ll a, ll b, ll p){ ll c = a - b; if(c < 0) c += p; return c; }
inline ll add(ll a, ll b, ll p){ ll c = a + b; if(c > p) c -= p; return c; }
 
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl


int main()
{
    ll n;
    cin>>n;
    ll ans=0;
    multiset<ll> s;
    while(n--)
    {
        ll x;
        cin>>x;
        if(s.size()==0||*s.begin()>=x)
        {
            ans++;
            s.insert(x);
        }
        else
        {
            auto lb=s.lower_bound(x);
            lb--;
            s.erase(lb);
            s.insert(x);
        }
    }
    cout<<ans<<endl;
}


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

int main() {
  
  // 大きい値を用意する
  long long INF = 1LL<<60;

  // V は頂点数
  long long V, E;
  cin >> V >> E;

  // 要素数はN + 1
  // あらかじめ INF を入れておく
  long long g[101][101];
  for (int i = 0; i < V; i++) {
    for (int j = 0; j < V; j++) {
      if (i != j) {
        g[i][j] = INF;
      } else {
        g[i][j] = 0;
      }
    }
  }

  // 頂点 s から頂点 t までの重みが d
  int s, t;
  long long d;
  for (int i = 0; i < E; i++) {
    cin >> s >> t >> d;
    g[s][t] = d;
  }

  // ワーシャルフロイドで全点間の距離を計算する
  for (int k = 0; k < V; k++) {
    for (int i = 0; i < V; i++) {
      if (g[i][k] == INF) {
        continue;
      }
      for (int j = 0; j < V; j++) {
        if (g[k][j] == INF) {
          continue;
        }
        g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
      }
    }
  }

  // 出力
  bool flg = false;
  for (int i = 0; i < V; i++) {
    if (g[i][i] < 0) {
      flg = true;
    }
  }

  if (flg) {
    cout << "NEGATIVE CYCLE" << endl;
  } else {
    for (int i = 0; i < V; i++) {
      for (int j = 0; j < V; j++) {
        if (g[i][j] == INF) {
          cout << "INF";
        } else {
          cout << g[i][j];
        }
        if (j != V - 1) {
          cout << " ";
        }
      }
      cout << endl;
    }
  }

  return 0;
}


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

int main() 
{
    int n;cin>>n;
    long m[n+1],d[n+1];
    long o=0,e=0;
    for(int i=1;i<=n;i++)
    {
    cin>>d[i];
    i%2==0?e+=d[i]:o+=d[i];
    }
  //  cout<<o<<" "<<e;
    m[1]=o-e;
    for(int i=2;i<=n;i++)
    {
        m[i]=2*(d[i-1]-(m[i-1])/2);
    }
    for(int i=1;i<=n;i++)
    cout<<m[i]<<" ";
}

Measured memory_bytes: 2816
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<math.h>

#define REPS(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

int main() {
	int n = 0;
	cin >> n;
	cout << n / 3;
	system("pause");
	return 0;
}

Measured memory_bytes: 1012
#include <iostream>

using namespace std;

int main(void) {
    int A = 0;
    int B = 0;
    int T = 0;

    cin >> A >> B >> T;

    int biscuit = 0;

    for (int i=A; i<T+0.5; i+=A) {
        biscuit += B;
    }

    cout << biscuit;

    return 0;
}

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

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("5 3");
            WillReturn.Add("10 30 40 50 20");
            //30
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("3 1");
            WillReturn.Add("10 20 10");
            //20
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("2 100");
            WillReturn.Add("10 10");
            //0
        }
        else if (InputPattern == "Input4") {
            WillReturn.Add("10 4");
            WillReturn.Add("40 10 20 70 80 10 20 70 80 60");
            //40
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();

        int[] wkArr = InputList[0].Split(' ').Select(X => int.Parse(X)).ToArray();
        int K = wkArr[1];

        int[] HArr = InputList[1].Split(' ').Select(X => int.Parse(X)).ToArray();
        int UB = HArr.GetUpperBound(0);

        // 最小コスト[現在位置] なDP表
        var DPDict = new Dictionary<int, int>();
        DPDict[0] = 0;

        for (int I = 0; I <= UB; I++) {
            if (DPDict.ContainsKey(I) == false) continue;

            Action<int> wkAct = (pNewInd) =>
            {
                if (pNewInd > UB) return;
                int NewVal = DPDict[I] + Math.Abs(HArr[I] - HArr[pNewInd]);

                if (DPDict.ContainsKey(pNewInd)) {
                    if (DPDict[pNewInd] <= NewVal) {
                        return;
                    }
                }
                DPDict[pNewInd] = NewVal;
            };
            for (int J = 1; J <= K; J++) {
                wkAct(I + J);
            }
        }
        Console.WriteLine(DPDict[UB]);
    }
}


Measured memory_bytes: 39888
N , M ,X = map(int,input().split())

L = []
for i in range(N):
  temp = list(map(int,input().split()))
  L.append(temp)

INF = float('inf')
ans = INF

for i in range(1,2**N):
  skill = [0 for i in range(M)]
  b = 0
  for j in range(N):
    if(i>>j)&1==1:
      b += L[j][0]
      for t in range(M):
        skill[t] += L[j][t+1]
  if all([skill[y] >= X for y in range(M)]):
    #print(skill)
    ans = min(ans,b)

if ans == INF:
  print(-1)
else:
  print(ans)

Measured memory_bytes: 9204
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) (v).begin(),(v).end()
#define out(a) cout << (a) << endl
using namespace std;
using ll = long long;
int main(){
    int n, k;
    cin >> n >> k;
    if(n % k == 0) out(0);
    else out(1);
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	// your code goes here
	int a, b;
	
	scanf("%d %d", &a, &b);
	
	if(a < b) { printf("a < b\n"); }
	if(a > b) { printf("a > b\n"); }
    if(a == b) { printf("a == b\n"); }
	
	return 0;
}

Measured memory_bytes: 580
# coding: utf-8
# submission # - User: herp_sy
# https://atcoder.jp/contests/
#
# lang: Python3 (3.4.3)

import math
import statistics
import numpy as np

n = int(input())
h = list(int(i) for i in input().split())

i = 0
ans = 0
cnt = 0
while i + 1 < n:
  if h[i] >= h[i + 1]:
    cnt += 1
  else:
    if ans < cnt:
      ans = cnt
    cnt = 0
  i += 1

if ans < cnt:
  ans = cnt
print(ans)


Measured memory_bytes: 24424
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,pas;
string s;
int main(){
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>>a>>s;
    s.insert(0,"0");
    pas=1;
    for(b=2; b<=a; b++){
        if(s[b]!=s[b-1]) pas++;
    }
    cout<<pas;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
using namespace std;
typedef long long LL;
LL n,k,ans;
int main() {
    cin>>n>>k;
    ans = (n/k)*(n/k)*(n/k);
    if (k%2==0 && n>=k/2) {
        LL t = (n-k/2) / k;
        LL c = t + 1;
        if (c >= 0) ans += c*c*c;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B
# CreatedDate:  2020-02-22 21:06:15 +0900
# LastModified: 2020-02-22 21:11:34 +0900
#


import os
import sys
import numpy as np


def main():
    N, K = map(int,input().split())
    tmp = N
    i = 0
    while tmp>=K:
        tmp = tmp//K
        i+=1
    print(i+1)



if __name__ == "__main__":
    main()


Measured memory_bytes: 21752
#include <bits/stdc++.h>
using namespace std;
#define fo(i, t, n) for (i = t; i < n; i++)
#define ll long long
#define si(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)
#define ss(s) scanf("%s", s)
#define pi(x) printf("%d\n", x)
#define pl(x) printf("%lld\n", x)
#define ps(s) printf("%s\n", s)
#define pb push_back
#define print(v)     \
	for (auto i : v) \
		cout << i << " ";
#define mp make_pair
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define sortv sort(all(v))
#define fi(it, v) for (auto it = v.begin(); it != v.end(); it++)
#define PI 3.1415926535897932384626
#define FAST                     \
	ios::sync_with_stdio(false); \
	cin.tie(NULL);               \
	cout.tie(NULL);
typedef pair<int,
			 int>
	pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef unordered_map<int, int> ump;
typedef map<int, int> mi;
const int mod = 1000000007;
#define MAXN 1000001
ll i, j, t;
bool flag = false;
/* ================================================================== */

int main()
{
	FAST;
	ll t = 1;
	// cin >> t;
	while (t--)
	{
		int n, num, total = 0;
		cin >> n;
		map<int, int> mp;
		fo(i, 0, n)
		{
			cin >> num;
			mp[num]++;
		}
		for (auto i : mp)
		{
			if (i.S > i.F)
				total += i.S - i.F;
			else if (i.S < i.F)
				total += i.S;
		}
		cout<<total<<endl;
	}
}

Measured memory_bytes: 8108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const int MAX = 1000000000;
int main(){
    double k;
    cin >> k;
    ll c = 0;
    for (ll i = 100; i < k;i*=1.01)
    {
        c++;
    }
    cout << c;
}

Measured memory_bytes: 3724
{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE TupleSections #-}
module Main where

import           Data.List
import           Control.Monad
import           Debug.Trace
import qualified Data.ByteString.Char8         as BC
import           Data.Maybe                     ( fromJust, fromMaybe )
import qualified Data.Set                      as S
import qualified Data.IntMap.Strict            as IM
import qualified Data.IntMap.Lazy            as IML
import qualified Data.Map.Strict               as M
import           Data.Char
import qualified Data.Array.IArray as A
import qualified Data.Array.Unboxed as UA
import Data.Bits
import Control.Monad.State.Strict
import qualified Data.Array.ST as STA
import qualified Data.Array.IO as IOA
import qualified Data.Array.MArray as MA
import Control.Monad.ST
import System.IO (stdin)
import Control.Arrow
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as UV
import qualified Data.Vector.Generic as GV
import qualified Data.Vector.Mutable as MV
import Data.Ix
import Data.Ord (Down(Down))
import qualified Data.Sequence as Seq
import Data.Foldable (toList)
-- import Control.Lens

debug = False

ts :: Show a => a -> a
ts a = if debug then traceShowId a else a


readTuple2 :: IO (Int, Int)
readTuple2 = do
    [a, b] <- readInts
    return (a, b)

readTuple3 :: IO (Int, Int, Int)
readTuple3 = do
    [a, b, c] <- readInts
    return (a, b, c)


readInt :: IO Int
readInt = fst . fromJust . BC.readInt <$> BC.getLine

readInts :: IO [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

split :: (a -> Bool) -> [a] -> [[a]]
split f [] = []
split f as =
    let (fo, la) = span f as
        las      = case la of
            [] -> []
            xs -> split f $ tail xs
    in  case fo of
            [] -> las
            xs -> xs : las

solve :: Int -> Int -> [Int] -> Int
solve n m xs
  | n >= m = 0
  | otherwise = distsT - canSubtract where
    canSkip = n - 1
    dists =  zipWith (-) (tail xs) xs
    distsT = sum dists
    canSubtract = sum $ take canSkip $  sortOn Down dists


main :: IO ()
main = do
  (n, m) <- readTuple2
  xs <- sort <$> readInts
  print $ solve n m xs





Measured memory_bytes: 18812
import java.util.Scanner;

class Main
{
  public static void main(String[] args) {
    int a, b;
    Scanner sc = new Scanner(System.in);
    a = sc.nextInt();
    b = sc.nextInt();
    System.out.println((a/b)+" "+(a%b)+" "+String.format("%1$4f",((double)a/b)));
  }
}

Measured memory_bytes: 26352
#include <iostream>

using namespace std;

string a;
int main()
{
    cin >> a;
    if (a == "SUN") {
        cout << "7";
    } else if(a == "MON") {
        cout << "6";
    } else if(a == "TUE") {
        cout << "5";
    } else if(a == "WED") {
        cout << "4";
    } else if(a == "THU") {
        cout << "3";
    } else if(a == "FRI") {
        cout << "2";
    } else if(a == "SAT") {
        cout << "1";
    }
    return 0;
}

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

public class Main{
  public static void main(String[] args)throws Exception{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    try{
      String S = br.readLine();
      String hi = "";
      boolean f = false;
      for(int i = 0; i < S.length()/2; i++){
        hi += "hi";
        f = f || hi.equals(S);
      }
      System.out.println(f ? "Yes" : "No");
    }catch(Exception e){
    }
  }
}

Measured memory_bytes: 21204
n = gets.chomp.to_i
h = gets.chomp.split(" ").map(&:to_i)
 
if n == 1
    puts "Yes"
    exit
end

for i in 0..(n-1) do
    if i == 0
        h[i] -= 1
    else
        if h[i-1] <= h[i]-1
            h[i] -= 1
        end
    end
end

hcop = h.sort

for i in 0..(n-1) do 
    if h[i] != hcop[i]
        puts "No"
        exit
    end
end
puts "Yes"



Measured memory_bytes: 11256
s = input()
t = input()

sl = len(s)
tl = len(t)

ans = tl
def check(t, s):
    temp = 0
    for i in range(len(t)):
        if t[i] != s[i]:
            temp += 1
        else:
            pass
    return temp
for i in range(sl-tl+1):
    if ans > check(t,s[i:i+tl]):
        ans = check(t,s[i:i+tl])
    else:
        pass
print(ans)


Measured memory_bytes: 8936
#include <bits/stdc++.h>
using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
//const int mod=998244353;
using P = pair<int,int>;
using Pll = pair<ll,ll>;
using ld=long double;
using V=vector<int>;
using Vl=vector<ll>;
using VV=vector<vector<int>>;
using VVl=vector<vector<ll>>;

// modint: mod 計算を int を扱うように扱える構造体
template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};
using mint = Fp<mod>;

int main(){
   ll n;cin >>n;
   mint ans=1;
    for (int i = 0; i < n; ++i) {
        ans*=10;
    }
    mint sub=1;
    mint sub2=1;
    for (int i = 0; i < n; ++i) {
        sub*=9;
        sub2*=8;
    }
    ans=ans-sub*2+sub2;
    cout <<ans <<endl;
}


Measured memory_bytes: 3596
m = input()
n = int(input())
for i in range(n):
    ord = input().split()
    a,b =map(int,ord[1:3])
    if ord[0]=='print':
        print(m[a:b+1])
    elif ord[0]=='reverse':
        rev = m[a:b+1]
        m = m[:a]+rev[::-1]+m[b+1:]
    else:
        rep = ord[3]
        m=m[:a]+rep+m[b+1:]
        
        


Measured memory_bytes: 5612
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

ll N, A, B;
const int MAX_N = 1000000;

int main() {
    cin >> N >> A >> B;

    ll ret;
    if(A > B){
        ret = 0;
    }
    else if(N == 1 && A != B)
    {
        ret = 0;
    }
    else if(N == 1 && A == B){
        ret = 1;
    }
    else{
        ret = (N-2) * (B-A) + 1;
    }

	cout << ret << endl;
}

Measured memory_bytes: 256
a,b=map(int,input().split())
print(100,100)
for i in range(50):
    for j in range(100):
        if a-1and i%2and j%2:
            print('.',end='')
            a-=1
        else:
            print('#',end='')
    print()
for i in range(50):
    for j in range(100):
        if b-1and i%2and j%2:
            print('#',end='')
            b-=1
        else:
            print('.',end='')
    print()

Measured memory_bytes: 51516
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)){
			int n = sc.nextInt();
			int m = sc.nextInt();
			int space = sc.nextInt();

			String[][] room = new String[n][m];

			for (int i=0; i<n; i++) {
				String s = sc.next();
				for (int j=0; j<m; j++) {
					room[i][j] = s.substring(j,j+1);
				}
			}

			int count=0;
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					if (room[i][j].equals(".")) {
						if (j<m-space+1) {  //横比較
							boolean flag = true;
							for (int k=0; k<space; k++) {
								if (!room[i][j].equals(room[i][j+k])) flag = false;
							}
							if (flag) count++;
						}
						if (i<n-space+1) {  //縦
							boolean flag = true;
							for (int k=0; k<space; k++) {
								if (!room[i][j].equals(room[i+k][j])) flag = false;
							}
							if (flag) count++;
						}
					}
				}
			}
			System.out.println(count);
		}
	}
}


Measured memory_bytes: 30612
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 15 22:01:38 2019

@author: aozora
"""
class BIT:
  def __init__(self,n):
    self.N = n
    self.data = [0]*(N+1)
  def bit_add(self,i,a):
    j = i+1
    while j<=N:
      self.data[j] += a
      j += j&-j
  def bit_sum(self,i):
    m = 0
    j = i+1
    while j>0:
      m += self.data[j]
      j -= j&-j
    return m
N = int(input())
S = list(input())
Q = int(input())
dic = [0]*26
s = ord('a')
for i in range(26):
  dic[i] = BIT(N)
for i, c in enumerate(S):
  c = ord(c)-s
  dic[c].bit_add(i,1)
for i in range(Q):
  t, a, b = input().split()
  t = int(t)
  if t==1:
    a = int(a)-1
    c = S[a]
    S[a] = b
    b = ord(b)-s
    c = ord(c)-s
    dic[b].bit_add(a,1)
    dic[c].bit_add(a,-1)
  else:
    a = int(a)
    b = int(b)
    ans = 0
    a -= 1
    b -= 1
    for i in range(26):
      if a>0:
        z = dic[i].bit_sum(b)-dic[i].bit_sum(a-1)
      else:
        z = dic[i].bit_sum(b)
      if z>0:
        ans += 1
    print(ans)

Measured memory_bytes: 167836
#include <iostream>
#include <cstdio>

int main(){
	int a, b, n;
	while(~scanf("%d%d%d", &a, &b, &n)){
		a %= b;//ツ渉ャツ青板閉板づ個づ敖づ可つキツづゥ
		int res = 0;
		for(;n;n--){
			a *= 10;
			res += a / b;
			a %= b;	
		}
		printf("%d\n", res);
	}
	return 0;
}

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

void chmin(int &a, int b) {
    if (a > b) a = b;
}

const int INF = 1000000001;


signed main() {
    int N, M, R;
    cin >> N >> M >> R;
    int r[R];
    for (int i = 0; i < R; i++) cin >> r[i];
    int A[M], B[M], C[M];
    for (int i = 0; i < M; i++) cin >> A[i] >> B[i] >> C[i];

    for (int i = 0; i < R; i++) r[i]--;
    for (int i = 0; i < M; i++) A[i]--, B[i]--;
    vector<vector<int>> dist(N, vector<int>(N, INF));
    for (int i = 0; i < M; i++) dist[A[i]][B[i]] = dist[B[i]][A[i]] = C[i];

    for (int k = 0; k < N; k++) {
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                chmin(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }
    
    int ans = INF;
    int ara[R]; for (int i = 0; i < R; i++) ara[i] = i;
    do {
        int sum = 0;
        for (int i = 1; i < R; i++) sum += dist[r[ara[i - 1]]][r[ara[i]]];
        chmin(ans, sum);
    } while (next_permutation(ara, ara + R));

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

Measured memory_bytes: 3924
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
const int MAX = 2e5+4;
const ll INF = 1e18;
const int MOD = 1e9+7;
ll dp[1001][1001];
char a[1001][1001];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int h,w;
	cin >> h >> w;
	for(int i=1;i<=h;i++)
	{
		for(int j=1;j<=w;j++)
		{
			cin >> a[i][j];
		}
	}
	dp[1][1]=1;
	for(int i=1;i<=h;i++)
	{
		for(int j=1;j<=w;j++)
		{
			if(a[i][j]=='.')
			{
				dp[i][j]+=dp[i-1][j]+dp[i][j-1];
				dp[i][j]%=MOD;
			}
		}
	}
	cout << dp[h][w];
	return 0;
}

Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
#define fi first
#define se second
#define endl '\n'
#define y1 holyshit
#define all(x) x.begin(),x.end()
const int inf=0x3f3f3f3f;

int N,M;

int p[200010],sz[200010];
int find(int x){
	while(x!=p[x]) x=p[x];
	return x;
}

void merge(int x,int y){
	x=find(x); y=find(y);
	if(x==y) return;
	if(sz[x]>sz[y]) swap(x,y);
	p[x]=y;
	sz[y]+=sz[x];
}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	for(int i=1;i<200010;i++) p[i]=i, sz[i]=1;
	cin>>N>>M;
	while(M--){
		int x,y; cin>>x>>y;
		merge(x,y);
	}
	int ans=-inf;
	for(int i=1;i<200010;i++) ans=max(ans,sz[i]);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 5208
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  ans=0
  for a in range(1,n):
    if n%a==0:
      _n=n-1
    else:
      _n=n

    ans+=_n//a

  return ans

# main()
print(main())


Measured memory_bytes: 10776
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}
constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,k;
	cin>>n>>k;
	vl v(n);
	rep(i,n)cin>>v[i];
	ll lm=1;
	rep(i,n){
		lm=lcm(lm,v[i]);
		if(lm>k*2)break;
	}
	//puta(lm);
	bool ok=lm<=k*2;
	rep(i,n){
		ok&=(lm/2-v[i]/2)%v[i]==0;
	}
	if(lm>k*2||!ok)puta(0);
	else puta((k+(lm/2))/lm);

}


Measured memory_bytes: 1024
public class Main {
    public static void main(String args[]) {
        for(int i = 1; i <= 9; i++) {
            for(int j = 1; j <= 9; j++) {
                // ?¨?????????????????????????
                System.out.println(""+i+'x'+j+'='+(i*j));
            }
        }
    }
}

Measured memory_bytes: 24152
m = 998244353
def myPow(a,b):
    a %= m
    if b == 1:
        return a%m
    elif b == 0:
        return 1
    if b%2 == 0:
        return myPow(a**2,b//2)%m
    else:
        return (a%m)*myPow(a**2,(b-1)//2)%m

n = int(input())
ngo = [0]*n
d = list(map(int,input().split()))
for i in range(n):
    ngo[d[i]]+=1
if ngo[0] != 1:
    print(0)
    exit(0)
if d[0] != 0:
    print(0)
    exit(0)
ans = 1
for i in range(n-1):
    ans = (ans*myPow(ngo[i],ngo[i+1])%m)%m
print(ans%m)

Measured memory_bytes: 15164