akhauriyash/Code-Regression huggingface dataset:
import bisect
import sys,io
import math
from collections import deque
from heapq import heappush, heappop
import functools
input = sys.stdin.buffer.readline

def sRaw():
    return input().decode("utf-8").rstrip("\n").rstrip("\r")


def iRaw():
    return int(input())

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


def isRaw():
    return list(map(int, ssRaw()))

INF = 1 << 29

DIV = (10**9) + 7
#DIV = 998244353

def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)


def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max, mod=DIV):
    fac, finv, inv = [0]*max, [0]*max, [0]*max
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod % i] * (mod//i) % mod
        finv[i] = finv[i-1]*inv[i] % mod

    class CONV:
        def __init__(self):
            self.fac = fac
            self.finv = finv
            pass

        def ncr(self, n, k):
            if(n < k):
                return 0
            if(n < 0 or k < 0):
                return 0
            return fac[n]*(finv[k]*finv[n-k] % DIV) % DIV

    return CONV()


def cumsum(As):
    s = 0
    for a in As:
        s += a
        yield s


sys.setrecursionlimit(200005)


def dijkstra(G,start=0):
    heap = []
    cost = [INF]*len(G)
    heappush(heap,(0,start))
    while len(heap)!=0:
        c,n = heappop(heap)
        if cost[n] !=INF:
            continue
        cost[n]=c
        for e in G[n]:
            ec,v = e
            if cost[v]!=INF:
                continue
            heappush(heap,(ec+c,v))
    return cost

def gcd_list(As):
    return functools.reduce(math.gcd, As)

def lcm_div(x, y):
    return ((x * y) // math.gcd(x, y))%DIV

def lcm_div_list(numbers):
    return functools.reduce(lcm_div, numbers, 1)%DIV

def primes_by_eratos(n):
    data = [i for i in range(2, n + 1)]
    for d in data:
        data = [x for x in data if (x == d or x % d != 0)]
    return data

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def main():
    N = iRaw()
    As = isRaw()
    gcds = gcd_list(As)
    if gcds!=1:
        print("not coprime")
        return
    lcms = lcm_div_list(As)
    mul_d = 1
    lcm_d = 1
    primes = primes_by_eratos(1000)
    lcm_yakus = {}

    for a in As:
        yakus = set(prime_factorize(a))
        for y in yakus:
            if y in lcm_yakus:
                print('setwise coprime')
                return
            else:
                lcm_yakus[y]=1
    print("pairwise coprime")
    return
    
main()


Measured memory_bytes: 174464
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
typedef long long ll;
using namespace std;
int main(){
    string s;cin>>s;
    vector<char> v;
    int ans=0;
    for(int i=0;i<s.size();i++){
        v.push_back(s[i]);
        while(v.size()>1){
            if(v.back()!=v[v.size()-2]){
                v.pop_back();
                v.pop_back();
                ans+=2;
            }else{
                break;
            }
        }

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

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>

using namespace std;
int a[200005], b[200005];

int main() {
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
        scanf("%d", &a[i]);
    }
    for (int i = n; i >= 1; --i) {
        scanf("%d", &b[i]);
    }
    bool flag = true;
    for (int i = 1; i <= n; ++i) {
        if (a[i] == b[i]) {
            flag = false;
            for (int j = 1; j <= n; ++j) {
                if (b[j] != a[i] && b[i] != a[j]) {
                    swap(b[j], b[i]);
                    flag = true;
                    break;
                }
            }
            if (!flag) {
                break;
            }
        }
    }
    if (flag) {
        printf("Yes\n");
        for (int i = 1; i <= n; ++i) {
            printf("%d ", b[i]);
        }
    } else {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 4700
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <map>

//#include <bits/stdc++.h>
using namespace std;
#define print(x) cout<<(x)<<endl
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  print(min(a, b) + min(c, d));

}


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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)

#define mod 1e9+7;
#define inf 1e18+7;

typedef long long ll;

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

    rep(i,n+1){
        rep(j,n+1-i){
            if(i*10000+j*5000+(n-i-j)*1000==m){
                cout<<i<<" "<<j<<" "<<n-i-j<<endl;
                return 0;
            }
        }
    }

    cout<<-1<<" "<<-1<<" "<<-1<<endl;

}


Measured memory_bytes: 256
#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 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(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll 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 sum(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));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
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

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>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
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;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    vd a(n);cin>>a;
    double ans=0;
    rep(i,n)ans+=1/a[i];
    fcout(10)<<1/ans<<endl;
    return 0;
}

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

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	double l;
	cin>>l;
	double side=l/3;
	long double ans=side*side*side;
	printf("%.12Lf\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
#define rep(i,n) for(int i=0;i<n;i++)

bool check(int a, int b) {
	return a > b;
}

int main() {
	int n;
	cin >> n;
	vector<llint>a(n);
	llint x;
	rep(i, n) {
		cin >> x;
		if (i % 2 == 1) {
			a[n / 2 - (i + 1) / 2] = x;
		}
		else {
			a[n / 2 + (i + 1) / 2] = x;
		}
	}
	if (n % 2 == 0) {
		rep(i, n - 1) {
			cout << a[i] << " ";
		}
		cout << a[n - 1] << endl;
	}
	else {
		rep(i, n - 1) {
			cout << a[n - 1 - i] << " ";
		}
		cout << a[0] << endl;
	}
	return 0;
}


Measured memory_bytes: 3712
//compiledef
#include <bits/stdc++.h>
#define rep(i, n) for(i=0;i<(n);i++)
#define per(i, n) for(i=(n);i>0;i--)
#define repx(i, n, x) for(i=(x);i<(n);i++)
#define xper(i, n, x) for(i=(n);i>(x);i--)
#define pback push_back

//c++def
using namespace std;
typedef long long int ll;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
void prt(int A[], int n){
	int i;
	rep(i, n){
		printf("%d", A[i]);
		if(i!=n-1){
			printf(" ");
		}
	}
	printf("\n");
}
int main(){
	int a[2000];
	int n;
	int tmp;
	int i, j;
	cin >> n;
	rep(i, n) cin >> a[i];
	prt(a,n);
	repx(i, n, 1){
		tmp = a[i];
		j = i -1;
		while(j>=0 && a[j] > tmp){
			a[j+1] = a[j];
			j--;
		}
		a[j+1] = tmp;
		prt(a, n);
	}
}





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

int main() {
  int s,s1,s2,s3;
  cin>>s;
  s1=s/100;
  s2=(s-100*s1)/10;
  s3=s-100*s1-10*s2;
  cout<<s1+s2+s3<<endl;
}

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

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n = in.nextInt();
		int m = in.nextInt();
		int[] p = new int[n];
		int[] x = new int[m];
		int[] y = new int[m];
		for (int i = 0; i < n; i++)
			p[i] = in.nextInt() - 1;
		for (int i = 0; i < m; i++) {
			x[i] = in.nextInt() - 1;
			y[i] = in.nextInt() - 1;
		}
		System.out.println(solve(p, x, y));
		in.close();
	}

	private static int solve(int[] a, int[] x, int[] y) {
		int[] r = new int[a.length];
		for (int i = 0; i < r.length; i++)
			r[i] = -1;
		for (int i = 0; i < x.length; i++) {
			joinR(x[i], y[i], r);
		}

		int c = 0;
		for (int i = 0; i < a.length; i++)
			if (getR(a[i], r) == getR(i, r))
				c++;
		return c;
	}

	private static void joinR(int i, int j, int[] r) {
		if (getR(i, r) == getR(j, r))
			return;
		r[getR(i, r)] = getR(j, r);
	}

	private static int getR(int i, int[] r) {
		if (r[i] == -1)
			return i;
		r[i] = getR(r[i], r);
		return r[i];
	}
}


Measured memory_bytes: 94596
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;

    int count=0;

    for(int i=min(a,b);i>=1;i--) {
        if(a%i==0&&b%i==0){
            count++;
        }
        if(count==c){
            cout<<i<<endl;
            break;
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b=0,p=1,w,g,y;
  cin>>a;
  string c;
  for(int i=0;i<a;i++){
    cin>>c;
    if(c=="Y") p=0;
  }
  if(p==0) cout<<"Four";
  else cout<<"Three";
  cout<<"\n";
}


Measured memory_bytes: 256
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const double pi=acos(-1.0);
double x[5],y[5],A,B,a,b,c,l,r,mid;
inline double sqr(R double x){return x*x;}
inline double calc(R int i,R int j){
	return sqrt(sqr(x[i]-x[j])+sqr(y[i]-y[j]));
}
inline bool ck(R double x){return x+x+x*A+x*B<=c;}
int main(){
	fp(i,1,3)scanf("%lf%lf",&x[i],&y[i]);
	a=calc(1,2),b=calc(1,3),c=calc(2,3);
	if(a>c)swap(a,c);if(b>c)swap(b,c);
	A=0.5*acos((a*a+c*c-b*b)/(2*a*c));
	B=0.5*acos((b*b+c*c-a*a)/(2*b*c));
	A=1.0/tan(A),B=1.0/tan(B);
	l=0,r=1000;
	while(r-l>1e-11){
		mid=(l+r)*0.5;
		ck(mid)?l=mid:r=mid;
	}
	printf("%.12lf\n",l);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>

using namespace std;

// void check(int n, int k, vector<vector<int>> a) {
// 	map<int, vector<vector<int>>> lol;
// 	set<int> hv;
// 	for (int i = 0; i < n; i++) {
// 		for (int j = 0; j < n; j++) {
// 			vector<int> c = {a[(i - 1 + n) % n][j], a[i][(j - 1 + n) % n], a[(i + 1) % n][j], a[i][(j + 1) % n]};
// 			sort(c.begin(), c.end());
// 			lol[a[i][j]].push_back(c);
// 			hv.insert(a[i][j]);
// 		}
// 	}
// 	cerr << hv.size() << endl;
// 	for (auto t : hv) {
// 		cerr << t << ' ';
// 	}
// 	cerr << endl;
// 	assert((int)lol.size() == k);
// 	for (auto [f, s] : lol) {
// 		sort(s.begin(), s.end());
// 		if (s.front() != s.back()) {
// 			cout << "wa " << f << endl;
// 			exit(0);
// 		}
// 	}
// }

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
   	
   	int k;
   	cin >> k;
   	if (k == 1) {
   		cout << 1 << '\n' << 1 << '\n';
   		exit(0);
   	}
   	int n = (k + 3) / 4;
   	n *= 2;
   	cout << n << endl;
   	for (int i = 0; i < n; i++) {
   		for (int j = 0; j < n; j++) {
   			int t = 1 + (i + j) % n + n * (i & 1);
   			if (t > k) t -= n;
   			cout << t << ' ';
   		}
   		cout << endl;
   	}
}


Measured memory_bytes: 1152
n = int(input())
s = str(input())
c = len(s)
t = ''
for i in range(0,c):
  if (ord(s[i])+n)>90:
    a = ord(s[i])+n-26
  else:
    a = ord(s[i])+n
  t += chr(a)
print(t)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int N;
    ll T;
    cin >> N >> T;
    vector<ll> A(N);
    REP(i, N) { cin >> A[i]; }
    map<ll, int> reward;
    ll mi = INF;
    //単調増大列を探して頑張る
    for(int i = 0; i < N; i++) {
        reward[A[i] - mi]++;
        mi = min(A[i], mi);
    }
    auto ans = max_element(reward.begin(), reward.end(), reward.value_comp());
    cout << ans->second << endl;
    return 0;
}

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

int main(){
    int n;
    cin>>n;
    int cnt[n]={};
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        cnt[a-1]++;
    }
    ll sum1[n+1]={};
    ll sum2[n+2]={};
    for(int i=0;i<n;i++){
        sum1[cnt[i]]++;
        sum2[cnt[i]]++;
    }
    for(int i=0;i<=n;i++){
        sum1[i]*=i;
    }
    for(int i=1;i<=n;i++){
        sum1[i]+=sum1[i-1];
    }
    for(int i=n-1;i>=0;i--){
        sum2[i]+=sum2[i+1];
    }
    ll ans=n;
    for(int k=1;k<=n;k++){
        while(ans>0){
            ll f=sum1[ans]/ans+sum2[ans+1];
            if(k<=f){
                cout<<ans<<endl;
                break;
            }
            else{
                --ans;
            }
        }
        if(ans==0){
            cout<<0<<endl;
        }
    }
}


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

using namespace std;

int main(int argc, const char *argv[]) {
  int h, w;
  cin >> h >> w;
  vector<string> ans;
  ans.push_back(string(w + 2, '#'));
  for (int i = 0; i < h; ++i) {
    string r, inner;
    cin >> inner;
    r = '#' + inner + '#';
    ans.push_back(r);
  }
  ans.push_back(string(w + 2, '#'));

  for (int i = 0; i < ans.size(); ++i) {
    cout << ans[i] << '\n';
  }
  return 0;
}

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

int main(){
  int n;
  scanf("%d",&n);
  int R[n];
  int i,j;
  int max;
  int pastMinimum;
  for(i=0; i<n; i++){
    scanf("%d",&R[i]);
  }
  
  pastMinimum = R[0];
  max = R[1]-R[0];
  
  for(i=1; i<n; i++){
    if(R[i-1]<pastMinimum){
      pastMinimum = R[i-1];
    }
    if(R[i]-pastMinimum>max){
      max = R[i]-pastMinimum;
    }

  }

//  for(i=0; i<n-1; i++){
//    for(j=i+1; j<n; j++){
//      if(R[j]-R[i]>max){
//        max = R[j] - R[i];
//      }
//    }
//  }

  printf("%d\n",max);

}

Measured memory_bytes: 3972
#include <cstdio>

int main()
{
  int n;
  scanf("%d", &n);
  int cur = 0;
  for (int i = 0; i < n; ++i)
  {
    int a;
    scanf("%d", &a);
    if (a == cur + 1)
    {
      cur++;
    }
  }
  printf("%d\n", cur == 0 ? -1 : n - cur);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
ll n,q,k,dx[100010];
vector<pair<ll,ll>>a[100010];
void dep(ll now){
	if(now!=k&&a[now].size()==1){
		return ;
	}
	for(ll i=0;i<a[now].size();i++){
		ll next=a[now][i].first;
		if(next==k){
			continue;
		}
		if(dx[next]!=0){
			continue;
		}
		dx[next]=dx[now]+a[now][i].second;
		dep(next);
	}
}
int main() {
	cin>>n;
	for(ll i=0;i<n-1;i++){
		ll x,y,c;
		cin>>x>>y>>c;
		x--;y--;
		a[x].push_back(make_pair(y,c));
		a[y].push_back(make_pair(x,c));
	}
	cin>>q>>k;
	k--;
	dep(k);
	for(ll i=0;i<q;i++){
		ll x,y;
		cin>>x>>y;
		x--;y--;
		cout << dx[x]+dx[y]<<endl;
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 14336
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <utility>

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

int main()
{
  int n;
  std::cin >> n;
  std::map<int, int> odd_index;
  std::map<int, int> even_index;
  for (int i = 0; i < n; i++) {
    int val;
    std::cin >> val;
    if (i % 2 == 0) {
      even_index[val]++;
    } else {
      odd_index[val]++;
    }
  }
  std::vector<std::pair<int, int>> odd_v;
  std::vector<std::pair<int, int>> even_v;
  for (const auto& p : odd_index) {
    odd_v.push_back(p);
  }
  for (const auto& p : even_index) {
    even_v.push_back(p);
  }
  std::sort(odd_v.begin(), odd_v.end(), has_larger_second);
  std::sort(even_v.begin(), even_v.end(), has_larger_second);
  int result = 0;
  if (odd_v.at(0).first != even_v.at(0).first) {
    result = odd_v.at(0).second + even_v.at(0).second;
  } else {
    if (odd_v.size() == 1 && even_v.size() == 1) {
      result = n / 2;
    } else {
      int candidate1 = odd_v.at(1).second + even_v.at(0).second;
      int candidate2 = odd_v.at(0).second + even_v.at(1).second;
      result = std::max(candidate1, candidate2);
    }
  }
  std::cout << n - result << '\n';
  return 0;
}


Measured memory_bytes: 6136
use std::io::*;

fn main() {
  let input = {
    let mut buf = vec![];
    stdin().read_to_end(&mut buf);
    unsafe { String::from_utf8_unchecked(buf) }
  };

  let mut tuples = input.split('\n').map(|l| {
    let mut iter = l.split(' ').map(|s| s.parse::<usize>().unwrap());

    (iter.next().unwrap(), iter.next().unwrap())
  });

  let (n, m) = tuples.next().unwrap();

  let (mut sum, mut max) = (0, 0);

  for (a, _) in tuples.take(m) {
    if a < n {
      let cost = n - a;
      sum += cost;
      if max < cost { max = cost; }
    }
  }

  println!("{}", sum - max);
}


Measured memory_bytes: 5024
import sys
c=[list(map(int,input().split())) for _ in range(3)]

for i in range(min(c[0])+1):
  b=[c[0][k]-i for k in range(3)]
  a=[c[i][0]-b[0] for i in range(3)]
  for i in range(1,3):
    if c[i][1]!=a[i]+b[1] or c[i][2]!=a[i]+b[2]:
        break
  else:
    print('Yes')
    sys.exit()
print('No')

Measured memory_bytes: 38384
Scanf.scanf "%d" (fun n ->
    let check i =
        let rec loop j acc =
            if j > i then acc = 8 else
                if i mod j = 0 then loop (j + 1) (acc + 1)
                               else loop (j + 1) acc
        in
        loop 1 0
    in
    let rec loop i acc =
        if i > n then acc else
            let acc = if check i then acc + 1 else acc in
            loop (i + 2) acc
    in
    loop 1 0 |> Printf.printf "%d\n"
)

Measured memory_bytes: 3824
#include <iostream>

using namespace std;

int main(){
  int N;
  string s;
  while (1) {
    cin >> s;
    if (s=="0") break;
    N=s[0] - '0';
    s.erase(s.begin());
    while (s!="") {
      N+=s[0] - '0';
      s.erase(s.begin());
    }
    cout << N << endl;
  }
  return 0;
}



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

int main() {
    int n;
    cin>>n;
    vector<int64_t>vec(87);
    vec.at(0)=2;
    vec.at(1)=1;
    for(int i=2;i<=86;i++){
        vec.at(i)=vec.at(i-1)+vec.at(i-2);
    }
    cout<<vec.at(n)<<endl;
}

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

public class Main {

	public static void main (String[] args) {
	   InputReader in = new InputReader(System.in);
	   int a = in.readInt();
	   int b = in.readInt();
	   if(a >= 13) System.out.println(b);
	   else if(a >= 6)System.out.println(b/2);
	   else System.out.println(0); 
	}
}

class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}

Measured memory_bytes: 21076
#include <bits/stdc++.h>
using namespace std;
#define int long long
int MOD = (int)1e9 + 7;
int INF = (int)2e18;
// Comment out below and program paste

// #include "UnionFind.hpp"
// #include "power.hpp"

signed main() {
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    S[K - 1] = S[K - 1] + 32;
    cout << S << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int Ac=0,Bc=0,Cc=0,i;
	char S[3];

	scanf("%s",S);

	for(i=0;i<3;i++){
		if(S[i] == 'a')	Ac++;
		if(S[i] == 'b')	Bc++;
		if(S[i] == 'c')	Cc++;
	}
	if(Ac==1 && Bc==1 && Cc==1){
		printf("Yes\n");
	}else{
		printf("No\n");
	}

}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<climits>
#include<vector>
#include<utility>//pair
#include<cmath>//abs,sqrt
#include<cstring>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) memset(arg,n,sizeof(arg))
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
const int INF=1e+9;
const ll INFLL=1e+17;
string a,b;
string solve(){
  int as=a.size(),bs=b.size();
  if(as>bs) return "GREATER";
  else if(bs>as) return "LESS";
  else{
    rep(i,as){
      if(a[i]!=b[i]){
	if(a[i]>b[i]) return "GREATER";
	else return "LESS";
      }
    }
  }
  return "EQUAL";
}
int main(){
  cin>>a>>b;  
  prin(solve());
  return 0;
}


Measured memory_bytes: 256
n = int(input())
s = input()

check_list = [ [ 0 for i in range(n) ] for i in range(n) ]


ans = 0
for i in range(n-1):
    for j in range(i+1,n):
        if check_list[i][j] == 0:
            p = 0
            for k in range(min(j-i,n-1-j+1)):
                if s[i+k] == s[j+k]:
                    p += 1
                else:
                    break
            for k in range(1,p):
                check_list[i+k][j+k] = p - k
        ans = max(ans,p)

print(ans)


Measured memory_bytes: 247560
H,W = map(int,input().split())
arr = []

for i in range(H):
  S = list(input())
  arr.append(S)
  
ck = 0
for i in range(H):
  for j in range(W):
    if arr[i][j] == "#":
      if i != 0:
        a = arr[i-1][j]
      else:
        a = "."
      if i != H-1:
        b = arr[i+1][j]
      else:
        b = "."
      if j != 0:
        c = arr[i][j-1]
      else:
        c = "."
      if j != W-1:
        d = arr[i][j+1]
      else:
        d = "."

      if a == "." and b == "." and c == "." and d == ".":
        ck = 1
      
if ck == 1:
  print("No")
else:
  print("Yes")


Measured memory_bytes: 39408
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include <cmath>
using namespace std;

#define mod 1000000007
#define ten5 100005
#define ten52 200005
#define ten53 300005
#define ten6 1000005
#define PI 3.1415926
#define pb(x) push_back(x)
#define all(x) x.begin(),x.end()
#define mkpr(x1,x2) make_pair(x1,x2)
typedef long long int ll;

//stack<char> stk;
//set<ll> sll;
//set<pair<ll,ll>> spll;
//map<string,ll> mp;
//map<ll,ll> mp;
//deque<ll> deq;
vector<ll> vll,v1,v2,v3;
ll num[ten52],num2[ten52];
//priority_queue<pair<ll,ll>> pq;          //decreasing

int main(void)
{
    ll m,n,i,j,k=1,k1=1,ans=0;
    string s="";
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>k>>k1;
        if(k==k1)
            ans++;
        else
            ans=0;
        if(ans==3)
        {
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
    return 0;
}





Measured memory_bytes: 3628
#[allow(unused_macros)]
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, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

#[allow(unused_imports)]
use std::cmp::{min,max};

fn main(){
    input!{
        a: usize,
        b: usize,
    }
    println!("{}", if a>8 || b>8{":("}else{"Yay!"});
}


Measured memory_bytes: 4352
import math

n, d = map(int, input().split())
x = [list(map(int, input().split())) for i in range(n)]
count = 0

for i in range(n-1):
  for j in range(i+1, n):
    in_root = 0.0
    for k in range(d):
      in_root += (x[i][k]-x[j][k])**2
      ans = math.sqrt(in_root)
    if ans.is_integer():
      count += 1
        
print(count)

Measured memory_bytes: 3064
n,*l=map(int,open(0).read().split())
c=l[::3]+[0];s=l[1::3]+[0];f=l[2::3]
for i in range(n):
	t=c[i]+s[i]
	for j in range(i+1,n-1):t=max(-(-t//f[j])*f[j],s[j])+c[j]
	print(t)

Measured memory_bytes: 3188
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <string>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>

using namespace std;

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

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

// ---------------------
#define INF 922337203685477580
typedef long long ll;

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;

  ll dm, d; // dm: minimum depth, d: depth at end
  d = 0;
  dm = 0;
  REP(i, N) {
    if (S[i] == '(') {
      d++;
    } else {
      d--;
    }
    dm = min(dm, d);
  }

  REP(_, -dm) {
    cout << "(";
  }
  cout << S;

  REP(_, -dm + d) {
    cout << ")";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define RI register int
typedef long long LL;

using namespace std;

int const MAXN = 1e5 + 5;
int a[MAXN], b[MAXN];

int main() {
  
  int n; cin >> n;
  for (RI i = 1; i <= n; ++i)
    cin >> a[i], b[a[i]] = i;
  for (RI i = 1; i <= n; ++i)
    cout << b[i] << " ";

  return 0;
}

// created by Daniel yuan


Measured memory_bytes: 1536
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define print(n) cout<<n<<endl
#define rep(i,a,n) for(int i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vector<ll>>
#define vvi vector<vector<int>>
const int M=200111;
const int inf=1000000007;
const int mod=1000000007;
const long long INF=1e18;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int ddx[8]={1,-1,0,0,1,-1,-1,1},ddy[8]={0,0,1,-1,1,-1,1,-1};


struct UnionFind {
	vector<int> par;
	UnionFind(int n) : par(n, -1) { }

	int root(int x) {
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool same(int x, int y) {
		return root(x) == root(y);
	}

	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y); // merge technique
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x) {
		return -par[root(x)];
	}
};

vvl comb(int n) {
	vvl v(n + 1,vl(n + 1, 0));
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int j = 1; j < v.size(); j++) {
		for (int k = 1; k < j; k++) {
			v[j][k] = (v[j - 1][k - 1] + v[j - 1][k])%mod;
		}
	}
	return v;
}

void sosu(ll x,bool f[]){
	ll y=x;
	for(ll i=2;i<=sqrt(y);i++){
		if(x%i==0){
			x/=i;
			f[i]=true;
			i--;
		}
	}
}

ll __gcd(ll x,ll y){
	if(x<y)swap(x,y);
	while(1){
		ll tmp=x%y;
		x=y;
		y=tmp;
		if(y==0)break;
	}
	return x;
}

int keta(ll a){
	int ke=1;
	while(a/=10)ke++;
	return ke;
}


int main() {
	int n;
	ll sum=0;
	cin>>n;
	rep(i,1,n+1){
		if(i%3==0||i%5==0)continue;
		sum+=i;
	}
	print(sum);

	return 0;
}


Measured memory_bytes: 3748
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    int i,a,b,k;
    scanf("%d%d%d",&a,&b,&k);
    if(b-a<2*k)
        for(i=a;i<=b;i++)
    {
        printf("%d\n",i);
    }
    else
    {

     for(i=a;i<a+k;i++)
    {
        printf("%d\n",i);
    }
    for(i=b-k+1;i<=b;i++)
    {
        printf("%d\n",i);
    }
    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;



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

	int s, n, i, j, k, ans, ct;
	cin >> s >> n;
	vector<int> a(n);
	for (i = 0; i < n; i++) cin >> a[i];
	sort(a.rbegin(), a.rend());

	vector<bool> v(s);
	ans = 0;
	ct = a[0];
	for (i = 0; i < s; i += 2) {
		if (ct > 0) {
			v[i] = true;
			ct--;
		}
	}

	for (i = s - 1; i >= 0; i--) {
		if (!v[i] && (ct > 0)) {
			v[i] = true;
			ct--;
		}
	}

	ans = 0;
	for (i = 1; i < s; i++) {
		if (v[i] && (v[i - 1])) ans++;
	}

	
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 384
H,W=map(int,input().split())
S=[input() for _ in range(H)]
ans=[[0]*W for _ in range(H)]
x=(-1,0,1,-1,0,1,-1,0,1)
y=(1,1,1,0,0,0,-1,-1,-1)
for i in range(H):
  for j in range(W):
    if S[i][j]==".":
      for k in range(9):
        a=i+y[k]
        b=j+x[k]
        if 0<=a<H and 0<=b<W:
          if S[a][b]=="#":
            ans[i][j]+=1
for i in range(H):
  for j in range(W):
    if S[i][j]=="#":
      print("#",end="")
    else:
      print(ans[i][j],end="")
  print()


Measured memory_bytes: 9320
#import<iostream>
#import<atcoder/all>
using namespace std;long N,Q,i,a;main(){cin>>N>>Q;atcoder::fenwick_tree<long>b(N);for(;i++<N;b.add(i-1,a))cin>>a;for(;cin>>i>>a>>N;Q--){if(i)cout<<b.sum(a,N)<<endl;else b.add(a,N);}}

Measured memory_bytes: 8216
package main

import (
	"fmt"
)

func judge(a int) bool {
	if a%2 != 0 {
		return true
	}

	if a%3 == 0 || a%5 == 0 {
		return true
	}

	return false

}

func main() {
	var n int

	fmt.Scanln(&n)

	count := 0
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		if !judge(a) {
			break
		}
		count++
	}

	if count == n {
		fmt.Println("APPROVED")
	} else {
		fmt.Println("DENIED")
	}
}


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

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

fn main() {
    let nums: Vec<i32> = read_vec();
    let (a, b) = (nums[0], nums[1]);
    println!("{}", std::cmp::max(a * b, std::cmp::max(a + b, a - b)));
}


Measured memory_bytes: 4352
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define RFOR(i, a, b) for(int i=(b-1);i>=(a);i--)
#define REP(i, n) for(int i=0; i<(n); i++)
#define RREP(i, n) for(int i=(n-1); i>=0; i--)
#define REP1(i, n) for(int i=1; i<=(n); i++)
#define RREP1(i, n) for(int i=(n); i>=1; i--)
#define ALL(a) (a).begin(),(a).end()
#define UNIQUE_SORT(l) sort(ALL(l)); l.erase(unique(ALL(l)), l.end());
#define CONTAIN(a, b) find(ALL(a), (b)) != (a).end()
#define out(...) printf(__VA_ARGS__)
#if DEBUG
#define debug(...) printf(__VA_ARGS__)
#else
#define debug(...) /* ... */
#endif
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}
void _OUT() {}; template<class H, class... T> void _OUT(H &h, T &... t) { cout<<' '<<h; _OUT(t...); };
template<class H, class... T> void _P(H &h, T &... t) { cout<<h; _OUT(t...); };
#define _PN(...) _P(__VA_ARGS__); cout << endl;
#define EXEC(...) void exec() { (__VA_ARGS__ - 1) ? multi() : solve(0); }

void exec();
void solve(int t);
void multi() { int TT; cin>>TT; REP1(t,TT) solve(t); }
signed main()
{
#if DEBUG
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    exec();
    return 0;
}

/*================================*/
#if DEBUG
#define SIZE 100
#else
#define SIZE 223450
#endif

int N,M;
vector<int> A(SIZE);

void solve(int _t) {
    int K,Q;
    cin>>N>>K>>Q;
    REP(i,N)cin>>A[i];
    int ans = INT_MAX;
    REP(i,N) {
        int v = A[i]; // min
        vector<int> V,X;
        REP(j,N) {
            if (A[j] < v) {
                sort(ALL(V));
                reverse(ALL(V));
                while(V.size()>=K) {
                    X.push_back(V.back());
                    V.pop_back();
                }
                V.clear();
            } else {
                V.push_back(A[j]);
            }
        }
        sort(ALL(V));
        reverse(ALL(V));
        while(V.size()>=K) {
            X.push_back(V.back());
            V.pop_back();
        }
        sort(ALL(X));
        if (X.size() < Q) continue;
        while(X.size() > Q) X.pop_back();
        if (chmin(ans, X.back()-X.front())) {
            debug("%lld - %lld -> %lld\n",X.back(),X.front(),ans);
        }
    }
    _PN(ans);
}
EXEC(1)



Measured memory_bytes: 4868
n,d=(int(x) for x in input().split())
x=[0]*n
y=[0]*n
l=[0]*n
for i in range(n):
    x[i],y[i]=(int(x) for x in input().split())
    l[i]=x[i]**2+y[i]**2

n = sum(x<=d**2 for x in l)
print(n)
                                                     
                                                     
    

Measured memory_bytes: 35552
n, k= map(int,input().split())
ps = list(map(int, input().split()))
    
s = [0]*(n+1)
 
for i in range(n):
    s[i+1] = s[i] + (ps[i] + 1)/2
 
    
tmp=0
for i in range(n-k+1):
    tmp=max(tmp, s[i+k] - s[i])

print("{:.10f}".format(tmp))

Measured memory_bytes: 32100
#include <stdio.h>

int main(){
    int h[10];
    int a,i,j,k,l;
    for (i=0; i<10; i++) {
        scanf("%d",&h[i]);
    }
    for (j=0; j<3; j++) {
        for (k=j+1; k<10; k++) {
            if (h[j]<h[k]) {
                a=h[k];
                h[k]=h[j];
                h[j]=a;
            }
        }
    }
    for(l=0; l<3; l++){
        printf("%d\n",h[l]);
    }
    
    return 0;
}

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

using namespace std;

const long long MAXN =5e3+5;
long long dp[MAXN][MAXN];
long long pos[MAXN];
long long p[MAXN];
long long mindp[MAXN];
int main(){
    long long n,a,b;
    cin>>n>>a>>b;
    for(long long i=1;i<=n;i++){
        cin>>p[i];
        pos[p[i]] = i;
    }
    for(long long i=1;i<=n;i++){
        for(long long j=0;j<=n;j++){
            dp[i][j] = 1e18;
        }
    }
    dp[0][0] = 0; 
    for(long long i=1;i<=n;i++){
        for(long long j=0;j<=n;j++){
           
            if(j==pos[i]){
                dp[i][j] = dp[i-1][j-1];
                continue;
            }
            long long cost;
            if(pos[i]<j){
                cost = a;
            }else{
                cost = b;
            }
            if(j){
                dp[i][j] = min(dp[i][j],dp[i][j-1]);
               
            }
             dp[i][j] = min(dp[i][j],dp[i-1][j]+(cost));
            // cout<<i<<" "<<j<<" "<<dp[i][j]<<endl;
        }
    }
    cout<<dp[n][n]<<endl;
}

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

int		main(void)
{
	vector<bool> flag(26, false);
	string s;

	cin >> s;
	for (int i = 0; i < s.size(); i++)
	{
		int c = s[i] - 97;
		if (flag[c] == true)
		{
			cout << "no" << endl;
			return (0);
		}
		flag[c] = true;
	}
	cout << "yes" << endl;
}


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

using namespace std;

int main(){
    int N,x,K;
    cin >> N;
    cin >> K;
    int cost = 0;
    int dp[N];
    vector<int> h;
    for(int i=0; i<N; ++i){
        cin >> x;
        h.push_back(x);
        dp[i] = INT_MAX;
    }
    dp[N-1] = 0;
    for(int i= N-2; i>=0; --i){
        for(int j=1 ; j<=K; ++j){
            if(i+j < N)
                dp[i] = min(dp[i], abs(h[i] - h[i+j])+dp[i+j]);
        }
    }
    cout << dp[0];
    return 0;
}


Measured memory_bytes: 4220
#include <bits/stdc++.h>
using namespace std;
#define INF 0x7fffffff
typedef long long ll;
typedef long double ld;

typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<ld> vld;

#define fastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define beg(x) x.begin()
#define en(x) x.end()

int main()
{
	fastIO;
	int d, t, s; cin >> d >> t >> s;
	if(d/s < t) cout << "Yes" << endl;
	else if(d/s == t && d % s == 0) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3644
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.AGC_046
{
    class B
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int[] abcd = ReadInts();
            int a = abcd[0];
            int b = abcd[1];
            int c = abcd[2];
            int d = abcd[3];

            long[,] dp = new long[c+1, d+1];
            dp[a, b] = 1;
            long mask = 998244353;
            for(int i = a; i <= c; i++)
            {
                for(int j = b; j <= d; j++)
                {
                    if (i == a && j == b)
                    {
                        continue;
                    }

                    dp[i, j] = dp[i - 1, j] * j;
                    dp[i, j] %= mask;
                    dp[i, j] += dp[i, j - 1] * i;
                    dp[i, j] %= mask;
                    dp[i, j] += mask - (dp[i - 1, j - 1] * (i - 1) * (j - 1)) % mask;
                    dp[i, j] %= mask;
                }
            }

            WriteLine(dp[c, d]);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 97496
#include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    int n, gar;
    scanf("%d%*d", &n);
    rep(i,n){
        string s;
        getline(cin, s);
        while(s.find("Hoshino") < 40000){
            s.replace( s.find("Hoshino"), 7, "Hoshina");
        }
        cout << s << endl;
    }
}

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

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

    vector<long long> sum(N + 1);
    for (int i = 1; i <= N; i++) sum[i] = sum[i - 1] + A[i - 1];

    for (int i = K + 1; i <= N; i++) {
        long long prev = sum[i - 1] - sum[i - 1 - K];
        long long current = sum[i] - sum[i - K];
        if (prev < current) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 5636
#include <iostream>
#include <algorithm>
#include <vector>
#include <tuple>
#include <set>
using namespace std;
typedef long long ll;


int main(void){
    int n, l;
    cin >> n >> l;
    
    int s = 0;
    for (int i = 0; i < n; i++) s += l + i;
    
    int sm[205] = {};
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i != j) sm[i] += l + j;
        }
    }
    
    int ans = 1e9, d = 1e9;
    for (int i = 0; i < n; i++) {
        if (d > abs(s - sm[i])) {
            d = abs(s - sm[i]);
            ans = sm[i];
        }
    }
    
    //for (int i = 0; i< n; i++) cout << sm[i] << endl;
    
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

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

struct edge
{
	int to,cost;
	edge(int _to,int _cost){
		to =_to;
		cost =_cost;
	}
};

int V;
vector<edge> cost[MAX_N];
int d[MAX_N];
bool visit[MAX_N];
void dijkstra(int s){
	d[s]=0;
	priority_queue<pii, vector<pii> ,greater<pii> > que;
	que.push(mp(0,s));
	while(!que.empty()){
		pii p =que.top();
		que.pop();
		int v =p.second;
		//if(d[v] != p.first)continue;
		for(int i =0;i <cost[v].size();i++){
			edge e =cost[v][i];
			if(d[e.to] >d[v]+e.cost){
				d[e.to] =d[v] +e.cost;
				que.push(mp(d[e.to],e.to));
			}
		}
	}
}

int main(){
	cin>>V;
	for(int i =0;i <V;i++){
		d[i]=INF;
		int u,k;
		cin>>u>>k;
		for(int j =0;j <k;j++){
			int to,c;
			cin>>to>>c;
			cost[u].push_back(edge(to,c));
		}
	}
	
	dijkstra(0);
	for(int i =0;i <V;i++){
		cout <<i<<" "<<d[i]<<endl;
	}
	return 0;
}

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

using namespace std;

#define ll long long
#define PI acos(-1.0)
#define mod 1000000007

ll dp[1005][1005];
int r, c;
char ch[1005][1005];
	
ll func(int i,int j)
{
	if(i == r && j == c) return 1;
	if(dp[i][j] != -1) return dp[i][j];
	int r1 = i+1, c1 = j;
	ll ans1 = 0, ans2 = 0;
	if(r1 >= 1 && r1 <= r && c1 >= 1 && c1 <= c && ch[r1][c1] == '.')
	{
		ans1 = func(r1,c1);
	}
	int r2 = i, c2 =  j+1;
	if(r2 >= 1 && r2 <= r && c2 >= 1 && c2 <= c && ch[r2][c2] == '.')
	{
		ans2 = func(r2,c2);
	}
    return dp[i][j] = ((ans1%mod) + (ans2%mod))%mod;
}

int main()
{	
	scanf("%d %d", &r, &c);
	getchar();
	for(int i =1 ;i <= r; i++)
	{
		for(int j = 1; j <= c; j++)
		{
			scanf("%c",&ch[i][j]);
		}
		getchar();
	}
	memset(dp,-1,sizeof(dp));
	ll ans = func(1,1);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 9216
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void push(int);
int pop();

int cnt;
int NUM[1000];

int main(){
  int x,y;
  char s[100];

  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      y = pop();
      x = pop();
      push(x+y);
    } else if ( s[0] == '-' ){
      y = pop();
      x = pop();
      push(x-y);
    } else if ( s[0] == '*' ){
      y = pop();
      x = pop();
      push(x*y);
    } else {
      push(atoi(s));

    }
  }

  printf("%d\n",pop());

  return 0;
}

void push(int x){
  NUM[cnt++] = x;
}

int pop(){
	return NUM[--cnt];
}



Measured memory_bytes: 2108