akhauriyash/Code-Regression huggingface dataset:
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


l, r, d = LI()
ans = 0
for i in range(l, r + 1):
    if i % d == 0:
        ans += 1
print(ans)


Measured memory_bytes: 9128
def main() -> None:
    n = int(input())

    count = 0
    for _ in range(n):
        d1, d2 = map(int, input().split())
        if d1 == d2:
            count += 1
        else:
            count = 0
        if count == 3:
            print('Yes')
            return
    print('No')
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 8984
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    token.parse().ok().unwrap()
}

fn main() {
    let n = input::<i64>();
    let xyh = (0..n)
        .map(|_| {
            let x = input();
            let y = input();
            let h = input();
            (x, y, h)
        })
        .collect::<Vec<(i64, i64, i64)>>();
    let g = {
        let mut g = (0, 0, 0);
        for &(x, y, h) in &xyh {
            if h > 0 {
                g = (x, y, h);
                break;
            }
        }
        g
    };

    let mut ans = (0, 0, 0);
    for cx in 0..101 {
        for cy in 0..101 {
            let hh = g.2 + i64::abs(g.0 - cx) + i64::abs(g.1 - cy);
            let mut ok = true;

            for &(x, y, h) in &xyh {
                let h_temp = std::cmp::max(hh - i64::abs(x - cx) - i64::abs(y - cy), 0);
                if h_temp != h {
                    ok = false;
                }
            }

            if ok {
                ans = (cx, cy, hh);
            }
        }
    }

    println!("{} {} {}", ans.0, ans.1, ans.2);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(int i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[4]={0,1,0,-1},mdy[4]={-1,0,1,0};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int n,m;
int u[1010],v[1010];
vector<int> road[1010];
int r_b[1010];

int main(){
	while(1){
		cin>>n>>m;
		if(n==0&&m==0)break;
		REP(i,1010)road[i].clear();
		REP(i,m){
			cin>>u[i]>>v[i];
			road[u[i]].push_back(v[i]);
			road[v[i]].push_back(u[i]);
		}
		REP(i,1010)r_b[i]=0;
		r_b[1]=1;
		int flag=1;
		queue<int> qq;
		qq.push(1);
		while(qq.size()){
			int t=qq.front();qq.pop();
			for(int i=0;i<road[t].size();i++){
				int next=road[t][i];
				if(r_b[next]==0){
					qq.push(next);
					r_b[next]=r_b[t]*-1;
				}
			}
		}
		for(int i=1;i<=n;i++){
			for(int j=0;j<road[i].size();j++){
				if(r_b[i]*r_b[road[i][j]]==1){
					flag=0;
				}
			}
		}
		int red1=0,blackm1=0;
		for(int i=1;i<=n;i++){
			if(r_b[i]==1)red1++;
			if(r_b[i]==-1)blackm1++;
		}
		int ans=0;
		if(red1%2==0)ans++;
		if(blackm1%2==0)ans++;
		if(red1%2==0&&blackm1%2==0&&red1==blackm1)ans--;
		if(flag){
			if(ans==2){
				cout<<2<<endl;
				if(red1>blackm1)swap(red1,blackm1);
				cout<<red1/2<<endl;
				cout<<blackm1/2<<endl;
			}else if(ans==1){
				cout<<1<<endl;
				if(red1%2==0){
				cout<<red1/2<<endl;
				}else{
					cout<<blackm1/2<<endl;
				}
			}else{
				cout<<0<<endl;
			}
		}else cout<<0<<endl;
	}
	return 0;
}


Measured memory_bytes: 3292
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <regex>

#define rep(i, n) for(int i=0;i<(int)(n);i++)

using namespace std;

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

string S;

int main() {
    cin >> S;
    if (S[2] == S[3] && S[4] == S[5]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


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

using namespace std;

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

  int len = S.size();
  for (int i = 0; i < len; ++i) {
    if (i % 2 == 0) {
      if (S[i] == 'L') {
        cout << "No" << endl;
        return 0;
      }
    } else {
      if (S[i] == 'R') {
        cout << "No" << endl;
        return 0;
      }
    }
  }

  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
import queue

H,W = map(int, input().split())
S = [[0 for i in range(W)] for j in range(H)]
for i in range(H):
    tmp = input()
    S[i] = list(tmp)
dismax = 0
for i in range(H):
    for j in range(W):
        if S[i][j] == '#':continue
        gone = [[-1 for i in range(W)] for j in range(H)]
        gone[i][j] = 0
        dis = 0
        q = queue.Queue()
        q.put(i)
        q.put(j)
        while not q.empty():
            tmpi = q.get()
            tmpj = q.get()
            if tmpi - 1 >= 0 and gone[tmpi - 1][tmpj] == -1 and S[tmpi - 1][tmpj] == ".": 
                gone[tmpi - 1][tmpj] = gone[tmpi][tmpj] + 1
                if dis < gone[tmpi - 1][tmpj]: dis = gone[tmpi - 1][tmpj]
                q.put(tmpi - 1)
                q.put(tmpj)
            if tmpj - 1 >= 0 and gone[tmpi][tmpj - 1] == -1 and S[tmpi][tmpj - 1] == ".":
                gone[tmpi][tmpj - 1] = gone[tmpi][tmpj] + 1
                if dis < gone[tmpi][tmpj - 1]: dis = gone[tmpi][tmpj - 1]
                q.put(tmpi)
                q.put(tmpj - 1)
            if tmpi + 1 < H and gone[tmpi + 1][tmpj] == -1 and S[tmpi + 1][tmpj] == ".":
                gone[tmpi + 1][tmpj] = gone[tmpi][tmpj] + 1
                if dis < gone[tmpi + 1][tmpj]: dis = gone[tmpi + 1][tmpj]
                q.put(tmpi + 1)
                q.put(tmpj)
            if tmpj + 1 < W  and gone[tmpi][tmpj + 1] == -1 and S[tmpi][tmpj + 1] == ".":
                gone[tmpi][tmpj + 1] = gone[tmpi][tmpj] + 1
                if dis < gone[tmpi][tmpj + 1]: dis = gone[tmpi][tmpj + 1]
                q.put(tmpi)
                q.put(tmpj + 1)
        if dismax < dis: dismax = dis
print(dismax)
        


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

int main(){
    int n;
    cin>>n;
    vector<ll>a(n);
    rep(i,n)cin>>a[i];
    if(count(a.begin(),a.end(),0)!=0){
        cout<<0<<endl;
        return 0;
    }
    ll ans=1;
    ll mx=round(1e18);
    rep(i,n){
        if(a[i]<=mx/ans){
            ans*=a[i];
        }
        else{cout<<-1<<endl; return 0;}
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3996
#include <bits/stdc++.h>
using namespace std;;
#define ll long long
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int count = 0;
  REP(i, s.size()){
      if(s[i] == 'g') count++;
      else count--;
  }
  cout << count /2 << endl;

}

Measured memory_bytes: 512
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<limits.h>
#include<stdbool.h>

typedef  long long ll;

ll int_cmp(const void *a, const void *b) 
{ 
    const int *ia = (const int *)a;
    const int *ib = (const int *)b;
    return *ia  - *ib; 

} 



int max(int a,int b){
	if(a<b)
		a=b;
	return a;	
}

int min(int a,int b){
	if(a>b)
		a=b;
	return a;	
}

int absolu(int n){
	if(n<0)
		n*=-1;
	
	return n;	
}

void solve(){
	int i,j,k,n,a[100000]={0},res;
	scanf("%d",&n);
	
	for(i=1 ; i<=110 ; i++){
		for(j=1 ; j<=110 ; j++){
			for(k=1 ; k<=110 ; k++){
				res=i*i+j*j+k*k+i*j+j*k+k*i;
				if(res>10000)
					continue;
					
					a[res]++;	
			}
		}
	}
	
	for(i=1 ; i<=n ; i++)
		printf("%d\n",a[i]);

	
}



int main(){
/*int t;
	scanf("%d",&t);
	while(t--)*/
		solve();
	
	return 0;
}	
					


Measured memory_bytes: 2032
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <queue>
#include <set>
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef long long ll;
ll MOD = 1000000007;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

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

	ll n,sum=0;
	cin >> n;
	vector<ll>a(n);
	rep(i, n)cin >> a[i];
	map<ll, ll>stack;
	for (ll i = 0; i < n; i++) {
		stack[a[i]]++;
	}
	for (auto p:stack) {
		ll x, y;
		x = p.first;
		y = p.second;
		if (y < x)sum += y;
		else sum += y - x;
	}
	cout << sum << endl;
}


Measured memory_bytes: 7040
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    struct P
    {
        public string name;
        public int time;
        public P(string name,int time)
        {
            this.name = name;
            this.time = time;
        }
    }
    static void Main(string[] args)
    {
        var nq = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        var pro = new string[nq[0]][];
        for (var i = 0; i < nq[0]; i++)
            pro[i] = ReadLine().Split(' ');
        var queue = new Queue<P>();
        for (var i = 0; i < nq[0]; i++)
            queue.Enqueue(new P(pro[i][0], int.Parse(pro[i][1])));
        var time = 0;
        while (queue.Count != 0)
        {
            var p = queue.Dequeue();
            if (p.time <= nq[1])
            {
                time += p.time;
                WriteLine($"{p.name} {time}");
            }
            else
            {
                time += nq[1];
                queue.Enqueue(new P(p.name, p.time - nq[1]));
            }
        }
    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<int> x(3), y(3);
    rep(i, 3) cin >> x[i] >> y[i];
    double d1 = pow((x[1] - x[0]) * (x[1] - x[0]) + (y[1] - y[0]) * (y[1] - y[0]), 0.5);
    double d2 = pow((x[2] - x[1]) * (x[2] - x[1]) + (y[2] - y[1]) * (y[2] - y[1]), 0.5);
    double d3 = pow((x[2] - x[0]) * (x[2] - x[0]) + (y[2] - y[0]) * (y[2] - y[0]), 0.5);
    double s = (d1 + d2 + d3) / 2.0;
    double S = pow(s*(s-d1)*(s-d2)*(s-d3), 0.5);
    double r = 2 * S / (d1 + d2 + d3);
    double max_d = max({d1, d2, d3});
    double ans = max_d * r / (max_d + 2 * r);
    printf("%.12lf\n", ans);
    return 0;
}

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

int main()
{
	ll n;
	cin >> n ;
	ll sum = 1;
	ll i = 1;
	ll mod = pow(10, 9) + 7;
	while (i <= n)
	{
		sum = i * sum % mod;
		i++;
	}
	cout << sum<< endl;
	return (0);
}


Measured memory_bytes: 256
const main = stdin => {
  const input = stdin.trim().split('\n')
  const N = parseInt(input[0])

  const cards = input[1].split(' ').map(x => parseInt(x))
  const sortedCards = cards.sort((a, b) => b - a)
  const alices = sortedCards.filter((a, i) => i % 2 === 0).reduce((a, b) => a + b)
  const bobs = sortedCards.filter((a, i) => i % 2 !== 0).reduce((a, b) => a + b)

  console.log(alices - bobs)
}


// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))


Measured memory_bytes: 29616
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

int main() {
  int n;
  scanf("%d", &n);
  vi a(n);
  rep (i, n) {
    scanf("%d", &a[i]);
  }
  rep (i, n) {
    if (a[i] > i) {
      printf("-1\n");
      return 0;
    }
  }
  ll ans = 0;
  ans += a[n-1];
  for (int i = n-2; i >= 0; --i) {
    if (a[i] == a[i+1] - 1) {
      continue;
    } else if (a[i] < a[i+1] - 1) {
      printf("-1\n");
      return 0;
    } else {
      ans += a[i];
    }
  }

  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 1656
#include<bits/stdc++.h>
using namespace std;
int main(){
  while(1){
  int n,m,st=0,sh=0,min=200;
  cin >> n >> m;
  if(n==0&&m==0) break;
  vector<int> t(n),h(m);
  for(int i=0;i<n;i++){
     cin >> t[i];
     st += t[i];
   }
  for(int i=0;i<m;i++){
    cin >> h[i];
    sh += h[i];
  }

  int ans_t=0;
  int ans_h=0;
  sort(t.begin(),t.end());
  sort(h.begin(),h.end());
  bool flag =false;

  for(int i=0;i<n;i++){
    //tarou
    for(int j=0;j<m;j++){
      //hanako
      if((t[i]<=h[j]) && (st+(h[j]-t[i])) == (sh-(h[j]-t[i]))){
        if(min > (t[i]+h[j]) ){
          ans_t=t[i];
          ans_h=h[j];
          min = t[i]+h[j];
          flag = true;
        }
      }

      if(t[i]>h[j] && (st-(t[i]-h[j])) == (sh+(t[i]-h[j])) ){
        if(min > (t[i]+h[j])){
          ans_t=t[i];
          ans_h=h[j];
          min = t[i]+h[j];
          flag = true;
        }
      }
    }
  }
  if(flag)
  cout << ans_t << " " << ans_h <<endl;

  else cout << -1 << endl;
}
return 0;
}



Measured memory_bytes: 2996
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template <typename T, typename cmp=less<T>> using oset =tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define inf 100000000000000000
#define ll long long 
#define pb push_back
#define f first
#define s second
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define test ll t ; cin>>t; while(t--)
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
vector<ll> adj[100005];
vector<bool> visited(100005);
vector<ll> dist(100005);
vector<ll> ans(100005);
void bfs(ll x){
	queue<ll> q ;
	q.push(x);
	visited[x]=1;
	dist[x]=0;
	while(!q.empty()){
		ll u = q.front();
		q.pop();
		for(auto v:adj[u]){
			if(visited[v])continue;
			visited[v]=1;
			dist[v]=dist[u]+1;
			q.push(v);
		}
	}
}
int main(){
	//mahakal(),fast;

	ll n , x , y ;
	cin>> n >> x >> y ;
	adj[x].pb(y);
	adj[y].pb(x);
	for(ll i=1 ;i<n ; i++){
		adj[i].pb(i+1);
		adj[i+1].pb(i);
	}
	for(ll i=1;i<=n ; i++){
		bfs(i);
		for(ll j=1 ;j<=n ; j++ )visited[j]=0;
		for(ll j=i+1;j<=n ; j++)visited[j]=0,ans[dist[j]]++,dist[j]=0;
		for(ll j=0;j<=i; j++)dist[j]=0;
	}
	// bfs();
	// for(ll i=1 ;i<=n ;i++)cerr<<dist[i]<<" ";
	// for(ll i=1 ;i<= n ; i++ ){
	// 	for(ll j=i ;j<= n ; j++){
	// 		if(dist[j]-dist[i]>0){
	// 			cerr<<i<<" "<<j<<" "<<dist[j]-dist[i]<<endl;
	// 			ans[dist[j]-dist[i]]++;
	// 		}
	// 	}
	// }
	for(ll i=1;i<n ;i++)cout<<ans[i]<<endl;;

	return 0;
}

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

int main(void)
{
    int N, K, i, j, k, count;
    count = 0;
    int d[100] = {0};
    int A[100] = {0};

    cin >> N;
    cin >> K;
    for (j = 0; j < K; j++)
    {
        cin >> d[j];
        for (i = 0; i < d[j]; i++)
        {
            cin >> k;
            A[k - 1]++;
        }
    }

    for (j = 0; j < N; j++)
    {
        if (A[j] == 0)
        {
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3572
#include <iostream>
using namespace std;
int n,m,a[200];
int main(){
    cin>>n;
    int i;
    int sum=0;
    for(i=1;i<=n;i++){
        cin>>a[i];sum+=a[i];
    }
    cin>>m;
    while(m--){
        int p,x;
        cin>>p>>x;
        cout<<sum-a[p]+x<<endl;
    }
    return 0;
}


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

#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define ll long long
#define ldb long double 
#define db double
#define str string

#define fr first
#define se second
#define lb lower_bound 
#define ub upper_bound 
#define pb push_back
#define mpr make_pair

#define pi pair<int,int>
#define pll pair<ll,ll>
#define pdb pair<db,db>
#define pldb pair<ldb,ldb>

#define vi vector<int>
#define vll vector<ll>
#define vdb vector<db>
#define vldb vector<ldb>
#define vpi vector< pi >
#define vpll vector< pll >

#define mi map<int,int>
#define mll map<ll,ll>
#define mdb map<db,db>
#define mldb map<ldb,ldb>


#define forr(a,b) for (int i = (a); i < (b); ++i)
#define rrof(a,b) for (int i = (b)-1; i >= (a); --i)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)

const int md = 1e9+7;
const int MX = 2e5+5;
const ll INF = 1e18; 
const ldb PI = 4*atan((ldb)1);

ll power(ll a,ll n)
{
 ll res=1;
 while(n)
{
 if(n%2)
  res*=a;
  a*=a;
  n/=2;
}
return res;
}

ll abst(ll a)
{
 return ((a<0)?(-1*a):(a));
}

int main()
{
    ll n,k;
    cin>>n>>k;
    ll arr[n];
    for(int i=0;i<n;i++)
     cin>>arr[i];
     if(k>=n)
      cout<<0;
      else
      {
          sort(arr,arr+n);
          ll sum=0;
          for(int i=0;i<(n-k);i++)
           sum+=arr[i];
           cout<<sum;
      }
      return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; ++i)
#define all(a) (a).begin(), (a).end()
template <typename T = int>
class Convolution {
  using C = complex<double>;
  const C ZERO = C(0.0, 0.0);
  vector<T> conv;

  vector<C> dft(const vector<C>& x) {
    int n = x.size();

    if (n == 1) return x;

    assert(n % 2 == 0);

    vector<C> even(n / 2), odd(n / 2);
    for (int i = 0; i < n / 2; ++i) {
      even[i] = x[2 * i];
      odd[i] = x[2 * i + 1];
    }

    vector<C> q = dft(even), r = dft(odd);
    vector<C> y(n);
    for (int i = 0; i < n / 2; ++i) {
      double ith = -2.0 * i * M_PI / n;
      C wi(cos(ith), sin(ith));
      y[i] = q[i] + wi * r[i];
      y[i + n / 2] = q[i] - wi * r[i];
    }

    return y;
  }

  vector<C> inverseDft(const vector<C>& x) {
    int n = x.size();
    vector<C> y(n);
    for (int i = 0; i < n; ++i) {
      y[i] = conj(x[i]);
    }

    y = dft(y);

    for (int i = 0; i < n; ++i) {
      y[i] = conj(y[i]);
      y[i] /= n;
    }

    return y;
  }

 public:
  Convolution(const vector<T>& a, const vector<T>& b) {
    int n = a.size(), m = b.size();
    int l = 1;
    while (n + m >= l) l *= 2;

    vector<C> ca(l, ZERO), cb(l, ZERO);
    for (int i = 0; i < n; ++i) ca[i] = C(a[i], 0.0);
    for (int i = 0; i < m; ++i) cb[i] = C(b[i], 0.0);

    vector<C> fa = dft(ca), fb = dft(cb);
    vector<C> fc(l);
    for (int i = 0; i < l; ++i) {
      fc[i] = fa[i] * fb[i];
    }

    vector<C> c = inverseDft(fc);
    conv.resize(l);
    for (int i = 0; i < l; ++i) {
      conv[i] = round(c[i].real());
    }
  }

  T operator[](int i) { return conv[i]; }

  vector<T> toVector() { return conv; }
};

int N;
ll M;
vector<int> A;

int main() {
  cin >> N >> M;
  A.resize(N);

  rep(i, N) cin >> A[i];
  const int A_MAX = *max_element(all(A));

  vector<ll> freq(A_MAX + 1, 0);
  rep(i, N) freq[A[i]] += 1;

  Convolution<ll> conv(freq, freq);
  ll ans = 0;
  for (int i = 2 * A_MAX; i >= 0; --i) {
    ll c = min(M, conv[i]);
    ans += c * i;
    M -= c;
    if (M == 0) break;
  }
  cout << ans << endl;

  return 0;
}


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

int main() {
    int N, M; cin >> N >> M;
    vector<int> s(M), c(M);
    for(int i = 0; i < M; ++i) cin >> s[i] >> c[i], s[i]--;
    auto ok = [&](int n) -> bool {
        string S = to_string(n);
        if(S.size() != N) return false;
        for(int i = 0; i < M; ++i) {
            if(S[s[i]] != ('0' + c[i])) return false;
        }
        return true;
    };
    for(int i = 0; i < 1010; ++i) {
        if(ok(i)) {
            cout << i << '\n';
            return 0;
        }
    }
    cout << -1 << '\n';
    return 0;
}


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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> t(m);
  rep(i,n){
    int k;
    cin >> k;
    rep(j,k){
      int a;
      cin >> a;
      t[a-1]++;
    }
  }
  int ans=0;
  rep(i,m){
    if(t[i]==n)ans++;
    //cout << t[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR0(i,n) for(ll i=0;i<n;i++)
#define FOR1(i,n) for(ll i=1;i<=n;i++)
#define FORl(i,l,n) for(ll i=l;i<n;i++)
using namespace std;
#define pi pair<ll,ll>
#define pb push_back
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define mst0(x) memset(x,0,sizeof(x));
#define vi vector<ll>
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define sp <<" "<<
#define intmax 1e14
ll power(ll num,ll g,ll mod){
  if(g==0)return 1;
  if(g%2==1)return (num*power((num*num)%mod,g/2,mod))%mod;
  return power((num*num)%mod,g/2,mod);
}

int main(){
	int k, n;
	cin >> k >> n;
	int a[n];
	int tmp = 0;
	FOR0(i, n) {
		cin >> a[i];
	}
	sort(a, a+n);
	int ans = 0;
	if (n==1){
		cout << 0;
		return 0;
	}
	for (int i = 1; i < n; i++){
		tmp = max(tmp, a[i]-a[i-1]);
	}
	tmp = max(tmp, k - a[n-1] + a[0]);
	cout << k - tmp;


}

Measured memory_bytes: 1024
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <iostream>
#include <list>
#include <functional>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	string s;
	cin >> s;
	int n = 0;
	for (int i = 0; i < s.length(); i++)
	{
		if (s[i] == '+')n++;
		else n--;
	}
	printf("%d\n", n);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
int ret[1000000];

int main(){
  int n;
  cin>>n;
  int a[1000000],num=0;
  lp(i,n){
    cin>>a[i];
    num=max(a[i],num);
  }
  int ans=0,memo,count;
  lp(i,n){
    count=0;
    memo=a[i];
    while(1){
      if(num%a[i]==0){
	ret[memo]=count;
	break;
      }
      if(ret[memo]!=0){
	ans+=ret[memo];
	break;
      }
      a[i]++;
      ans++;
      count++;
    }
  }
  cout<<ans<<endl;
  return 0;
}




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

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

using namespace __gnu_pbds; 
using namespace std;

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
typedef long long  ll;
typedef vector<ll> VL;
typedef vector<int> VI;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;
#define pb push_back

#define F first
#define S second
#define SZ(a) int((a).size())
#define ALL(a) a.begin(),a.end()
#define fr(i,x,y) for(int i=x;i<y;i++)
#define frr(i,x,y) for(int i=x-1;i>=y;i--)
#define inf 1e18+1
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll power(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;}a=a*a;b>>=1;}return ans;}
ll powerm(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;ans%=mod;}a=a*a;a%=mod;b>>=1;}return ans%mod;}
VL dx={1,0,-1,0};
VL dy={0,1,0,-1};
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

const int MAX = 1000005;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


void solve()
{
    ll n;
    cin>>n;
    if(n<2){
        cout<<"0\n";
        return;
    }
    //ll ans=n*(n-1)%mod;
    ll ans=(powerm(10,n))%mod;
    fr(i,1,n+1)
    {
        ans-=((2*COM(n,i))%mod)*powerm(8,n-i)%mod;
        ans+=mod;
        ans%=mod;
    }
    ans-=(powerm(8,n));
    ans+=mod;
    //ans*=powerm(2,mod-2);
    //ans*=fact(n);
    ans%=mod;
    cout<<ans<<endl;
    return;
}
int main()
{
    IOS;
    COMinit();
    ll t=1,pp;
    //cin>>t;
    pp=t;
    while(t--)
    {
        //cout<<"Case #"<<pp-t<<": ";
        solve();
    }
    return 0;
}
/* stuff you should look for
        * int overflow, array bounds
        * special cases (n=1?)
        * do smth instead of nothing and stay organized
        * WRITE STUFF DOWN
*/
/*
recursion - matrix exponential

*/
// BITMASK:
// 1)When some constrall is of the order of 15-20, think of bitmask DP.
// 2)When some constrall is around 40, try out meet in the middle
// 3) See Strings,palindromes,prefix,suffix etc -> KMP,Z algorithm

Measured memory_bytes: 27088
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
BC = [list(map(int, input().split())) for _ in range(M)]
BC.sort(key=lambda x:x[1], reverse=True)
ia = 0
ib = -1
b = 0
c = 0
for a in A:
    if b == 0:
        ib += 1
        if ib == M:
            break
        b = BC[ib][0]
        c = BC[ib][1]
    if c > a:
        A[ia] = c
        ia += 1
        if ia == N:
            break
        b -= 1
    else:
        b = 0
print(sum(A))


Measured memory_bytes: 32964
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <iostream>
#define ll long long
using namespace std;
ll S;
ll x[4],y[4];




int main()
{
	cin>>S;
	ll l=1,r=1000000000,mid,ans;
	while(l<=r)
	{
		mid=(l+r)>>1;
		if(mid*mid<S)
		{
			ans=mid;l=mid+1;
		}else{
			r=mid-1;
		}
	}
	x[2]=0;
	y[3]=0;
	x[1]=ans;
	y[1]=ans;
	
//	while((ll)x[1]*y[1]<S) x[1]++;
	while((ll)x[1]*y[1]<S)
	{
		x[1]++;
		if((ll)x[1]*y[1]<S)
			y[1]++;
	}
	ll res=x[1]*y[1]-S;
	y[2]=y[1]-1;
	x[3]=x[1]-res;
	printf("%lld %lld %lld %lld %lld %lld",x[1],y[1],x[2],y[2],x[3],y[3]);
//	int a=x[1]-x[2];
//	int b=y[1]-y[3];
//	int c=y[1]-y[2];
//	int d=x[1]-x[3];
//	cout<<endl<<(ll)a*b-c*d<<endl;
//	cout<<fenjie<<" "<<res<<" "<<ans;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int a[]=new int[n];
		for(int i=0;i<n;i++){
			a[i]=sc.nextInt();
		}
		int ans=0;
	    for(int i=0;i<n;i++){
	    	while(a[i]%2==0){
	    		a[i]/=2;
	    		ans++;
	    	}
	    }
	    System.out.println(ans);
	}
}



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

#define debug(x) cout << #x << " = " << x << endl

const int INF = 1<<29;
typedef long long ll;
typedef pair<int,int> P;


int main(){
   string s;
   cin >> s;
   cout << s.substr(0,4) << " " << s.substr(4) << endl;
   return 0;
}


Measured memory_bytes: 764
#include <climits>
#include <cmath>
#include <algorithm>
#include <array>
#include <iostream>
#include <functional>
#include <vector>
using namespace std;

struct BC {
	int B, C;
};

int main(int, char**)
{
	int N, M;
	cin >> N >> M;
	vector<int> A(N);
	vector<BC> bc(M);
	for (int i = 0; i < N; ++i)
	{
		cin >> A[i];
	}
	for (int i = 0; i < M; ++i)
	{
		cin >> bc[i].B >> bc[i].C;
	}
	sort(A.begin(), A.end());
	sort(bc.begin(), bc.end(), [](const BC& l, const BC& r)
		{
			return l.C > r.C;
		});
	long sum = 0;
	int i = 0, j = 0;
	for (i = 0; i < N; ++i)
	{
		if (A[i] > bc[j].C)
		{
			sum += A[i];
		}
		else
		{
			if (bc[j].B > 0)
			{
				sum += bc[j].C;
				--bc[j].B;
			}
			else
			{
				while (j < M && bc[j].B <= 0)	++j;
				if (A[i] <= bc[j].C)
				{
					sum += bc[j].C;
					--bc[j].B;
				}
				else
				{
					sum += A[i];
				}
			}
			if (j >= M)
			{
				for (++i; i < N; ++i)
				{
					sum += A[i];
				}
				break;
			}
		}
	}
	cout << sum << endl;
	return 0;
}


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

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


Measured memory_bytes: 256
class Heap
  attr_reader :size

  def initialize
    @heap = []
    @size = 0
  end

  def push(n)
    i = @size
    while i > 0 do
      parent_index = (i - 1) / 2
      break if n >= @heap[parent_index]

      @heap[i] = @heap[parent_index]
      i = parent_index
    end

    @heap[i] = n
    @size += 1
  end

  def pop
    return if @size <= 0
    min_n = @heap[0]
    @size -= 1
    n = @heap[@size]
    i = 0
    while i * 2 + 1 < @size do
      child_index1 = i * 2 + 1
      child_index2 = i * 2 + 2
      if child_index2 < @size && @heap[child_index2] < @heap[child_index1]
        child_index1 = child_index2
      end
      break if @heap[child_index1] >= n

      @heap[i] = @heap[child_index1]
      i = child_index1
    end
    @heap[i] = n
    min_n
  end
end

n, m = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
b = Heap.new()
a.map{|x| b.push(-x)}
m.times do
  c = b.pop
  b.push(-(-c / 2))
end
ans = 0
while b.size > 0
  ans -= b.pop
end
puts ans


Measured memory_bytes: 10252
def String2List(s):
    L = []
    flag = True
    l = len(s)
    for i in range(l):
        if s[i].isdigit() and flag:
            t = ""
            j = 0
            while s[i+j].isdigit():
                t += s[i+j]
                if i+j == l-1:
                    break
                j += 1
            L.append(t)
            flag = False

        elif not s[i].isdigit():
            L.append(s[i])
            flag = True

    return L


def RPN_list(L):
    S, L2 = [], []
    table = {"*": 1, "/": 1, "+": 0, "-": 0, "(": -1, ")": -1}
    for i in L:
        if i.isdigit():
            L2.append(i)
        elif i == "(":
            S.append(i)
        elif i == ")":
            while S[-1] != "(":
                L2.append(S.pop())
            S.pop()
        else:
            while len(S) != 0 and (table[S[-1]] >= table[i]):
                L2.append(S.pop())
            S.append(i)

    while len(S) != 0:
        L2.append(S.pop())

    return L2


def RPN_cul(L):
    St = []

    for i in L:
        if i == '+':
            St.append(int(St.pop()) + int(St.pop()))
        elif i == '-':
            St.append(-int(St.pop()) + int(St.pop()))
        elif i == '*':
            St.append(int(St.pop()) * int(St.pop()))
        elif i == '/':
            a = int(St.pop())
            b = float(St.pop())
            St.append(b/a)
        else:
            St.append(i)

    return St[0]


N = int(raw_input())

for i in range(N):
    s = raw_input()
    L = String2List(s[:-1])
    L = RPN_list(L)
    print int(RPN_cul(L))

Measured memory_bytes: 6368
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
        n: usize,
        m: usize,
        es: [(usize1, usize1); m],
    }
    let mut g = Vec::with_capacity(n);
    for _ in 0..n {
        g.push(Vec::new());
    }
    for e in es {
        g[e.0].push(e.1);
        g[e.1].push(e.0);
    }
    for v in g {
        println!("{}", v.len());
    }
}


Measured memory_bytes: 4352
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <queue>
#include <typeinfo>
using namespace std;
typedef long long ll;

int N, T;
vector<int> t(202020);

int main()
{
  cin >> N >> T;
  for(int i = 0; i < N; i++) cin >> t[i];

  ll ans = 0;
  ll tail = 0;
  ll head = 0;
  for (int i = 0; i < N; i++) {
    if (tail < t[i]){
      ans += tail - head;
      head = t[i];
    }
    tail = t[i] + T;
  }
  ans += tail - head;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define int long long
using namespace std;

int dp[105][10005];
int N,W;
int v[105],w[105];

signed main(){
    memset(dp,0,sizeof(dp));
    cin>>N>>W;
    for(int i=1;i<=N;++i)cin>>v[i]>>w[i];
    for(int i=1;i<=N;++i){
        for(int j=0;j<=W;++j){
            if(j<w[i])dp[i][j]=dp[i-1][j];
            else dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i]]+v[i]);
        }
    }
    int ans=0;
    for(int i=0;i<=W;++i){
        ans=max(dp[N][i],ans);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 9376
#include<iostream>
#include<deque>
#include<queue>
#include<math.h>
#include<string>
#include<string.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<iomanip>
#include<map>
#include<unordered_map>
 
#include<unordered_map>
#include<algorithm>
#define inf 0x3f3f3f3f
#define sup_inf 2e18
#define pb push_back
 
#define ii pair<int,int>
#define f first
#define s second
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define iii pair<int, ii >
#define in freopen("entrada","r",stdin);
#define out freopen("myfile.txt", "w", stdout);
#define eps 1e-9
#define id pair<int ,double > 
#define di pair<double, int>
 
#define pi 3.14159265359
#define nl (no<<1)
#define nr ( (no<<1)|1)
//~ #define mid l + ( (r-l)>>1)
 
using namespace std;
 
const int maxn = 1e5 + 10;
const int MAX = 5e3 + 10;
typedef long long ll;
typedef vector< int> vi;		
 
//~ https://codeforces.com/contest/645/problem/D


 

int main (){
	int n ; cin >> n;
	if ( n== 1)
		cout << "1\n";
	else
		if ( (n&1))
			cout << fixed << setprecision(10) << double ( (n+1) / 2) / n <<'\n';
		else
			cout << "0.5\n";
}
 
		


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

void solve(){

    string s,t;
    cin >> s >> t;
    int a,b;
    cin >> a >> b;
    string u;
    cin >> u;
    s==u? a--: b--;
    cout << a << " " << b << endl;
 
}

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


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

using namespace std;

#define pb push_back

typedef long long ll;

const int N = 200200;
const ll inf = 1e18;
#define fo(i, n) for(int i = 1; i <= n;++i)

ll n, a[N], ans;
map<ll, ll> cnt;
int main() {
    ios::sync_with_stdio(0); cin.tie(0);

    cin >> n;
    cnt[0] = 1;
    fo(i, n) cin >> a[i];
    ll s = 0;
    fo(i, n) {
        s += a[i];
        ans += cnt[s];
        cnt[s]++;
    }
    cout << ans;

    return 0;
}


















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

#define TYPE(c)   remove_reference_t<decltype(c)>
#define REP(i, n) for(TYPE(n) i = 0; i < n; i++)
#define FOR(v, c) for(TYPE(c.begin()) v = c.begin(); v != c.end(); v++)
#define ALL(c)    c.begin(), c.end()
#define SORT(c)   sort(ALL(c))
#define RSORT(c)  sort(ALL(c), greater<TYPE(c)::value_type>())
#define UNIQUE(c) c.erase(unique(ALL(c)), c.end())

using namespace std;
using ll = long long;

constexpr int MOD  = (int)1e9 + 7;
constexpr int INF  = (int)1e9 + 1;
constexpr ll  LINF = (ll)1e18 + 1;
template<typename T> constexpr bool chmax(T& a, const T& b)
{ if(a < b) { a = b; return true; } else { return false; } }
template<typename T> constexpr bool chmin(T& a, const T& b)
{ if(b < a) { a = b; return true; } else { return false; } }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T>& p)
{ return os << "(" << p.first << "," << p.second << ")"; }
ostream& operator<<(ostream &os, const string& s)
{ FOR(v, s) os << *v; return os; }
template<typename T> auto operator<<(ostream& os, const T& t)
    -> typename conditional<true, ostream&, decltype(*t.begin())>::type
{ os << "["; FOR(v, t) { if(v != t.begin()) os << ","; os << *v; } os << "]"; return os; }

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

    int N;
    std::cin >> N;
    set<int> set;
    REP(i, N) {
        int A;
        std::cin >> A;
        set.insert(A);
    }
    if(set.size() == N) std::cout << "YES" << std::endl;
    else std::cout << "NO" << std::endl;

    return 0;
}


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ll gcd(ll a, ll b)
{
    return b?gcd(b, a%b):a;
}

ll lcm(ll a, ll b)
{
    return a/gcd(a, b)*b;
}

int main(){
    int a, b;
    cin >> a >> b;
    ll ans = lcm(a, b);
    cout << ans << endl;
    return 0;
}


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


using namespace std;

int main(){
    int N,M;
    vector<int> ans;
    cin >> N >> M;

    int L[M],R[M];
    for(int i = 0; i < M; i++){
        cin >> L[i] >> R[i];
    }

    
    int min = *max_element(L,L+M);
    int max = *min_element(R,R+M);

    for(int i = L[0]; i <= R[0]; i++){
        ans.push_back(i);
        
    }
        

    for(auto itr = ans.begin(); itr !=ans.end(); ){
        if(min <= *itr && *itr <=max){
            ++itr;
        }else{
            ans.erase(itr);
        }
            
    }
        
    cout << ans.size() << endl;
    
        
    return 0;
}

    

Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
#define show(x) cout << #x << " : " << x << endl
typedef long long ll;


int main ()
{
    ll n, r, c, ans, root;
    int i;
    cin >> n;
    root = sqrt(n);
    for(i = root; i > 0; i--)
    {
        if(n % i == 0)
        {
            r = i;
            c = n / i;
            break;
        }
    }
    ans = r + c - 2 ;
    cout << ans << endl;
}


Measured memory_bytes: 256
N = int(input())
a_list = list(map(int, input().split()))
a_list.sort()
check = 0
for i in range(N-1):
    if a_list[i] == a_list[i+1]:
        check = 1
        break
        
if check == 0:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 26680
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
// MAX int 2,147,483,647
// MAX O(n) 10^18

int main() {
    ll N, K;
    cin >> N >> K;

    ll divided = N / K;
    ll left = N % K;
    ll i = 0;
    string digits = "";
    while (divided > 0) {
        digits.push_back('0' + left);
        left = divided % K;
        divided = divided / K;
    }
    digits.push_back('0' + left);
    reverse(digits.begin(), digits.end());

    int ans = digits.size();

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3616
#include <stdio.h>

int main()
{
int H,W;
int i,j;

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++){
printf("#");
}
printf("\n");

}
printf("\n");
}
return 0;
}

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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int main(){
	int N,K; cin >> N >> K;
	vector<int> h(N),ans(N,1e9+7);
	repp(i,0,N) cin >> h[i];
	ans[0] = 0;
	repp(i,1,N) repp(j,max(0,i-K),i){
		ans[i] = min(ans[i],ans[j]+abs(h[i]-h[j]));
	}
	cout << ans[N-1] << endl;
	return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N, K; cin >> N >> K;
    vec x(N); cin >> x;

    int ans = INF;
    REP(i, N - K + 1){
        int x0 = x[i], x1 = x[i + K - 1];
        if(x0 >= 0) Min(ans, x1);
        else if(x1 <= 0) Min(ans, -x0);
        else Min(ans, x1 - x0 + min(-x0, x1));
    }
    Out(ans);

    return 0;
}


Measured memory_bytes: 1024
def main(N, A, B ,S):
    status = [None for _ in range(N)]
    c_all, c_for = 0, 0
    for i, s in enumerate(S):
        if s == 'a' and c_all < A + B:
            c_all += 1
            status[i] = 'Yes'
        elif s == 'b' and c_all < A + B and c_for < B:
            c_all += 1
            c_for += 1
            status[i] = 'Yes'
        else:
            status[i] = 'No'
    return status


if __name__ == "__main__":
    N, A, B = map(int, input().split())
    S = input()
    ans = main(N, A, B, S)
    for i in ans:
        print(i)


Measured memory_bytes: 4912