akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define REP(i,n) for(int i = 0; i < int(n); i++)
#define REREP(i,n) for(int i = int(n - 1); i >= 0; i--)
#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define REFOR(i, m, n) for(int i = int(n - 1);i >= int(m);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define fi first 
#define se second

#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VVD vector<vector<double>>
#define VVVD vector<vector<vector<double>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VVVL vector<vector<vector<ll>>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define VVVB vector<vector<vector<bool>>>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVVS vector<vector<vector<string>>>

#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<ll,ll>
#define VPII vector<pair<int,int>>
#define VVPII vector<vector<pair<int,int>>>
#define VVVPII vector<vector<vector<pair<int,int>>>>
#define VPLL vector<pair<ll,ll>>
#define VVPLL vector<vector<pair<ll,ll>>>
#define VVVPLL vector<vector<vector<pair<ll,ll>>>>

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;


void YN(bool flag) {
	cout << ((flag) ? "YES" : "NO") << endl;
}

void Yn(bool flag) {
	cout << ((flag) ? "Yes" : "No") << endl;
}

void yn(bool flag) {
	cout << ((flag) ? "yes" : "no") << endl;
}

template<class T> class Union_Find {
public:
	vector<int> prnt;
	vector<int> rank;
	vector<T> dist;

	Union_Find(int N = 1):prnt(vector<int>(N)),rank(vector<int>(N,0)),dist(vector<int>(N, 0)) {
		for (int i = 0; i < N; ++i) prnt[i] = i;
	}

	int root(int x) {
		if (prnt[x] == x) return x;
		else {
			int r = root(prnt[x]);
			dist[x] += dist[prnt[x]];
			return prnt[x] = r;
		}
	}

	T updated_dist(int x) {
		root(x);
		return dist[x];
	}

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

	bool merge(int x, int y, T d) {
		d += updated_dist(x); 
		d -= updated_dist(y);
		x = root(x); y = root(y);
		if (x == y) return false;
		if (rank[x] < rank[y]) {
			swap(x, y);
			d = -d;
		}
		if (rank[x] == rank[y]) ++rank[x];
		prnt[y] = x;
		dist[y] = d;
		return true;
	}

	T diff(int x, int y) {
		return updated_dist(y) - updated_dist(x);
	}
};

int main() {
	int N, M;
	cin >> N >> M;
	Union_Find<int> uf(N);
	for (int i = 0; i < M; ++i) {
		int l, r, d;
		cin >> l >> r >> d;
		--l, --r;
		if (uf.same(l, r)) {
			if (d != uf.diff(l, r)) {
				cout << "No" << endl;
				return 0;
			}
		}
		else {
			uf.merge(l, r, d);
		}
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 1408
#include<cstdio>
#include<iostream>
#include<fstream>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
#define Set(a) memset(a,0,sizeof(a))
#define F(i,a,b) for(register int i=a,i##end=b;i<=i##end;++i)
#define UF(i,a,b) for(register int i=a,i##end=b;i>=i##end;--i)
#define openf(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
#define re register
#define ri re int
#define il inline
typedef long long ll;
typedef unsigned long long ull;
template<typename T> inline T rd(T& x)
{
	T f=1;x=0;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(; isdigit(c);c=getchar()) x=(x<<3)+(x<<1)+(T)(c-'0');
	x*=f;
	return x;
}
ll rd(){ll x;rd(x);return x;}
//inline int max(int a,int b){return a>b?a:b;}
inline int min(int a,int b){return a<b?a:b;}
const int inf=1<<30;

const int N=200020;
ll a[N],_ls[N],rs[N];ll*ls=_ls+5;
int main()
{
	int n=rd();
	F(i,1,n) rd(a[i]);
	F(i,1,n) ls[i]=ls[i-2]+a[i];
	//F(i,1,n) cout<<ls[i]<<' ';cout<<endl;
	UF(i,n,1) rs[i]=rs[i+2]+a[i];
	//F(i,1,n) cout<<rs[i]<<' ';cout<<endl;
	ll ans=-300000000000000ll;
	F(i,0,n/2) ans=max(ans,ls[2*(n/2-i)-1]+rs[n-2*(i-1)]);
	//cout<<ans<<endl;
	if(n&1)
	{
		ll tmp=300000000000000ll;
		ll f=300000000000000ll;
		//F(i,0,n) cout<<ls[i]-ls[i-1]<<' ';cout<<endl;
		F(i,1,n)
		{
			if(i&1) {f=min(f,tmp+ls[i]-ls[i-1]);tmp=min(tmp,ls[i-1]-ls[i-2]);}
			//cout<<tmp<<' '<<f<<endl;
		}
		ans=max(ans,ls[n]-f);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 8280
#include <stdio.h>

int main(int argc, char const *argv[])
{
    int a = 0, b = 0, c = 0, k = 0, i = 0;
    scanf("%d %d %d", &a, &b, &c);
    scanf("%d", &k);

    if (a >= b && a >= c) {
        for (i = 0; i < k; i++) {
            a *= 2;
        }
        printf("%d\n", a+b+c);
    } else if (b >= c && b >= a) {
        for (i = 0; i < k; i++) {
            b *= 2;
        }
        printf("%d\n", a+b+c);
    } else if (c >= b && c >= a) {
        for (i = 0; i < k; i++) {
            c *= 2;
        }
        printf("%d\n", a+b+c);
    }

    return 0;
}


Measured memory_bytes: 128
/*  -*- coding: utf-8 -*-
 *
 * 2878.cc: Graph
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100000;
const int MAX_M = 100000;
const long long LINF = 1LL << 60;

/* typedef */

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef pair<ll,int> pli;

/* global variables */

vpii nbrs[MAX_N];
ll dists[MAX_N];

/* subroutines */

/* main */

int main() {
  int n, m, st, gl;
  scanf("%d%d%d%d", &n, &m, &st, &gl);
  st--, gl--;

  for (int i = 0; i < m; i++) {
    int a, b, c, d;
    scanf("%d%d%d%d", &a, &b, &c, &d);
    a--, b--, c--;
    nbrs[a].push_back(pii(b, d));
    nbrs[b].push_back(pii(a, d));
    nbrs[a].push_back(pii(c, d));
    nbrs[c].push_back(pii(a, d));
    nbrs[b].push_back(pii(c, d));
    nbrs[c].push_back(pii(b, d));
  }

  fill(dists, dists + n, LINF);
  dists[st] = 0;

  priority_queue<pli> q;
  q.push(pli(0, st));

  ll mind = -1;
  while (! q.empty()) {
    pli u = q.top(); q.pop();
    ll ud = -u.first;
    int &ui = u.second;

    if (ud != dists[ui]) continue;
    if (ui == gl) {
      mind = ud;
      break;
    }

    vpii &nbru = nbrs[ui];
    for (vpii::iterator vit = nbru.begin(); vit != nbru.end(); vit++) {
      int &vi = vit->first;
      ll vd = ud + vit->second;
      if (dists[vi] > vd) {
	dists[vi] = vd;
	q.push(pli(-vd, vi));
      }
    }
  }

  printf("%lld\n", mind);
  return 0;
}



Measured memory_bytes: 16720
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define fori(i, m, n) for(int i = m; i < (int)n; i++)
#define forl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define all(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string btos(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  ll n,k;cin>>n>>k;
  vector<ll> p(n);
  rep(i,n){
    cin>>p[i];
  }
  auto it=p.begin();
  ll sum=accumulate(it,it+k,0);
  ll ans=sum;
  fori(i,1,n-k+1){
    sum=sum-p[i-1]+p[i+k-1];
    ans=max(ans,sum);
  }
  double an=(double)(ans+k)/2.0;
  cout<< fixed << an << endl;
  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
 
struct UnionFind{
    //自身が親であれば、その集合に属する頂点数に-1を掛けたもの
    //そうでなければ親のid
    vector<int> r;

    UnionFind(int N){
        r = vector<int>(N, -1);
    }

    //根までたどる
    int root(int x){
        if(r[x] < 0){
            return x;
        }
        //根を書き換えつつ，返す
        return r[x]=root(r[x]);
    }

    void unite(int x, int y){
        x = root(x);
        y = root(y);
        if(x == y){
            return;
        }
        if(r[x] > r[y]){
            swap(x, y);
        }
        //小さいほうがx
        r[x] += r[y];
        r[y] = x;
        return;
    }

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

int main(){
    int N, M;
    cin >> N >> M;

    UnionFind UF(N);
    for(int i=0; i<M; i++){
        int a, b;
        cin >> a >> b;
        a -= 1;
        b -= 1;

        UF.unite(a, b);
    }

    int ans = 0;
    for(int i=0; i<N; i++){
        ans = max(ans, UF.size(i));
    }

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

Measured memory_bytes: 4048
/*
  AUTHOR:SOURABH
  CREATED:31:05:20
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ordered_set tree<pii , null_type, less< pii >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define W while
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(it,s) for(it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 998244353
#define MAX 100005
#define M 32

using namespace std;
using namespace __gnu_pbds;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    ll t,a,b;
    t=1;
    //cin>>t;
    W(t--)
    {
        cin>>a>>b;
        cout<<a*b;
    }
    return 0;
}







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

int main(){
	string s;
	getline(cin,s);
	for(int i=0;i<s.size();i++){
		if(s[i]=='A'&&s[i+1]=='C'){
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
	return 0;
} 

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

int main(void) {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
    }
    vector<int> sa(n);
    copy(a.begin(), a.end(), sa.begin());
    sort(sa.begin(), sa.end(), greater<int>());
    for (int i = 0; i < n; i++) {
        if (a.at(i) == sa.at(0)) {
            cout << sa.at(1) << endl;
        }
        else {
            cout << sa.at(0) << endl;
        }
    }
    return 0;
}

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

struct combination {
    combination(ll Nmax, ll mod){
        (this -> MOD) = mod;
        (this -> Nmax) = Nmax;
        factorial.resize(Nmax+1, 1);
        inverse_factorial.resize(Nmax+1, 1);
        init_factorial();
    }

    ll calc(ll n, ll r){
        ll ret = (factorial[n]*inverse_factorial[r])%MOD;
        ret = (ret*inverse_factorial[n-r])%MOD;
        return ret;
    }

    private:
        ll MOD, Nmax;
        vector<ll> factorial;
        vector<ll> inverse_factorial;
        ll mod_pow(ll n, ll p, ll mod){
            n %= mod;
            if(p==0) return 1;
            ll res = mod_pow(n*n%mod, p/2, mod);
            if(p%2==1) res = res * n % mod;
            return res;
        }

        void init_factorial(){
            for(ll i=1; i<=Nmax; i++){
                factorial[i] = (factorial[i-1] * i)%MOD;
            }
            inverse_factorial[Nmax] = mod_pow(factorial[Nmax], MOD-2, MOD);
            for(ll i=Nmax-1; i>=1; i--){
                inverse_factorial[i] = (inverse_factorial[i+1]*(i+1))%MOD;
            }
        }
};

int main(){  
    int N, K;  cin >> N >> K;
    vector<ll> A(N);
    for(int i=0; i<N; i++)
        cin >> A[i];
    sort(A.begin(), A.end());
    
    ll mod = 1e9 + 7;
    combination comb(N, mod);

    ll ans = 0;
    for(int i=K-1; i<N; i++){
        ans += (A[i]*comb.calc(i, K-1))%mod;
        ans%=mod;
    }
    for(int i=N-K; i>=0; i--){
        ans -= (A[i]*comb.calc(N-1-i, K-1))%mod;
        while(ans < 0){
            ans += mod;
        }
        ans%=mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		String[] S = new String[N];
		int[] P = new int[N];
		String[] sp = new String[N];
		for(int i=0;i<N;i++){
			S[i]=sc.next();
			P[i]=sc.nextInt();
			sp[i]=S[i]+"_"+(10100-P[i])+"_"+(i+1);
		}
		sc.close();

		Arrays.sort(sp);

		for(String s2:sp){
			String ans=s2.split("_")[2];
			System.out.println(ans);
		}

	}

}

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

int main() {
	int X;
	cin >>X;
	if(400 <= X && X<=599){
			cout<<8<<endl;
	}
	
	if(600 <= X && X<=799){

			cout<<7<<endl;
	}
	if(800 <= X && X<=999){
			cout<<6<<endl;
	}
	if(1000 <= X && X<=1199){
			cout<<5<<endl;
	}
	if(1200 <= X && X<=1399){
			cout<<4<<endl;
	}
	if(1400 <= X && X<=1599){
			cout<<3<<endl;
	}
	if(1600 <= X && X<=1799){
			cout<<2<<endl;
	}

	if(1800 <= X && X<=1999){
			cout<<1<<endl;
	}
} 

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

using namespace std;

int n, a, b, c, d;
string s;

bool valid (int x) { return x >= 0 && x < n && s[x] == '.'; }

int main () {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    cin >> n >> a >> b >> c >> d >> s; --a; --b; --c; --d;

    for (int i = a; i < max(c, d); ++i) if (s[i] == s[i + 1] && s[i] == '#') return cout << "No", 0;

    if (c > d) {
        for (int i = b; i <= d; ++i) if (valid(i - 1) && valid(i + 1) && valid(i) ) return cout << "Yes", 0;
        cout << "No";
    }
    else cout << "Yes";

    return 0;
}


Measured memory_bytes: 592
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

N = int(input())
prime = primes(55555)
prime_five = []
for i in prime:
    if i % 5 == 1:
        prime_five.append(i)

for i in range(N):
    print(prime_five[i],sep=" ",end=" ")


Measured memory_bytes: 3572
#include <stdio.h>
int main(){
    int n,now,last,a[1000000];
    while(1){
        scanf("%d%d",&n,&a[0]);
        if(n==0)return 0;
        now=1;
        last=a[0];
        for(int i=1;i<n;i++){
            scanf("%d",&a[i]);
            if(now==0){
                last=a[i];
                now++;
            }
            else if(last!=a[i]){
                now--;
            }
            else now++;
        }
        now=0;
        for(int i=0;i<n;i++){
            if(a[i]==last)now++;
        }
        if(now>n/2)printf("%d\n",last);
        else printf("NO COLOR\n");
    }
}

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

int main() {
    ll N;
    cin >> N;
    vector<string> W(N);
    for (ll i = 0; i < N; i++) {
        cin >> W[i];
    }

    map<string, ll> mp;
    for (ll i = 0; i < N; i++) {
        if (++mp[W[i]] == 2) {
            cout << "No" << endl;
            return 0;
        }
        if (i > 0 && W[i - 1].back() != W[i].front()) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
}


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

int main(){
	int n;
	scanf("%d",&n);
	char str[n][105]; int t[n];
	for(int i=0;i<n;i++)scanf("%s%d",str[i],&t[i]);
	char x[105]; scanf("%s",x);
	for(int i=0;i<n;i++){
		if(strcmp(str[i],x)==0){
			int ans=0;
			for(int j=i+1;j<n;j++){
				ans+=t[j];
			}
			printf("%d",ans);
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long
int main(){
    int n;
    while(cin>>n){
        int a[n];
        for(int i=0; i<n; i++) cin>>a[i];
        ll c=0; int k=a[0];
        for(int i=1; i<n; i++) if(k> a[i]) {c+=k-a[i];} else  k=a[i];
        cout<<c<<endl;
    }

}


Measured memory_bytes: 4316
c = []
for i in range(3):
    b = list(map(int,input().split()))
    c.append(b)
#[j][i]でcijが出てくる

#差分が一致するはず
if abs(c[0][1]-c[0][0]) == abs(c[1][0]-c[1][1]) == abs(c[2][0]-c[2][1]) and abs(c[0][1]-c[0][2]) == abs(c[1][1]-c[1][2]) == abs(c[2][1]-c[2][2]) and abs(c[0][0]-c[1][0]) == abs(c[0][1]-c[1][1]) == abs(c[0][2]-c[1][2]) and abs(c[1][0]-c[2][0]) == abs(c[2][1]-c[1][1]) == abs(c[1][2]-c[2][2]):
    print("Yes")

else:
    print("No")

Measured memory_bytes: 3064
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		
		int n = sc.nextInt();
		char []c = sc.next().toCharArray();
		
		int cntr = 0;
		int cntl = 0;
		
		for(int i = 0; i < n ; i++) {
			sb.append(c[i]);
			if(cntr == 0 && c[i] == ')') {
				cntl++;
				
			}
			if(c[i] =='(') {
				cntr++;
			}
			if(cntr > 0 && c[i] == ')') {
				cntr--;
			}
		}
		while(cntr > 0) {
			sb.append(')');
			cntr--;
		}
		while(cntl > 0) {
			sb.insert(0,'(');
			cntl--;
		}
		System.out.println(sb.toString());
	}

}


Measured memory_bytes: 21716
n, y = gets.split.map(&:to_i)
0.upto(n) do |bill_1|
  0.upto(n) do |bill_2|
    next if (bill_1 + bill_2) > n
    bill_3 = n - (bill_1 + bill_2)
    if 10000 * bill_1 + 5000 * bill_2 + 1000 * bill_3 == y
      puts "#{bill_1} #{bill_2} #{bill_3}"
      exit
    end
  end
end
puts "-1 -1 -1"


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

using namespace std;
#define sz(a) int(a.size())
#define ll  long long
#define ull unsigned long long
//#define mod int(1e9+7)
#define endl '\n'
#define Engz ios::sync_with_stdio(0);ios_base::sync_with_stdio(0);cin.tie(0) , cout.tie(0) ;
#define pi double(acos(-1))
#define S second
#define F first

//  freopen("input.txt","r",stdin);

//------------------- BESH ----------------------//
long long mod ;
long long p(long long a ,long long b)
{
    if(b==0)
        return 1;

    long long z=p(a,b/2);


    if(b%2==0)return ((z%mod)*(z%mod))%mod; else return (((z*z)%mod)*a)%mod;
}

long long g(long long a, long long b)
{
    if(a==0)
        return b;
    else return g(b%a , a);
}

//-----------sieve --------------------//

bool prime[1000001];

void sieve()
{
memset(prime , true , sizeof prime);
prime[0]=prime[1]=0;

for(int i=2 ; i*i<=1000000; i++)
{
    if(prime[i]==true)
    for(int j=i*i ; j<=100000 ; j+=i)
    prime[j]=false;
}
}

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


//int a[1002][1002]={{}};
   char a[1005][1005];
    ll ans[1005][1005]={{}};
int main()
{
    int r , l;
    cin>>r>>l;

    ans[0][0]=1;
    for(int i=0; i<r ; i++)
    {
        for(int j=0; j<l ; j++)

            {
                cin>>a[i][j];

                if(a[i][j]=='#')
                    continue;

            if(i) ans[i][j] =(ans[i-1][j]+ans[i][j])%(1000000000+7);
            if(j) ans[i][j]=(ans[i][j-1]+ans[i][j])%(1000000000+7);

            }
    }


    cout<<ans[r-1][l-1];
	return 0;
}


Measured memory_bytes: 9088
#include <bits/stdc++.h> /ABC 164B/
using namespace std; 

int main(){

    int a,b,c,d;
    cin >> a >> b >> c >> d;

    while(a > 0 && c > 0 ){
        c -= b;
        a -= d;
    }
    if ( c <= 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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


int main(){
	int n;
	cin >> n;
	string s;
	cin >> s;
	int count = 1;
	for (int i = 0; i < n-1; ++i)
	{
		if(s[i] != s[i+1])
			count++;
	}
	cout << count << endl;
    return 0;
}

Measured memory_bytes: 512
n = int(input())
a = [int(x) for x in input().split()]
ans = 0
for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            m = max(a[i], a[j], a[k])
            if len(set([a[i], a[j], a[k]])) == 3 and m < (a[i] + a[j] + a[k] - m):
                ans+= 1
print(ans)

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

int main()
{
  const long long int MOD = 1000000007;
  int N;
  cin >> N;
  string S;
  cin >> S;
  map<char, long long int> mp;
  for (int i = 0; i < N; i++)
  {
    mp[S[i]]++;
  }
  long long int cnt = 1;
  for (auto itr = mp.begin(); itr != mp.end(); itr++)
  {
    long long int tmp = itr->second + 1;
    cnt *= tmp;
    cnt %= MOD;
  }
  cout << (cnt - 1) % MOD << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#define ll long long
using namespace std;

const int N=100005;

struct node{
	int w,id;
	node(){}
	node(int w,int id):w(w),id(id){}
}a[N];
int n,h,t;
ll ans[N];

bool cmp(node a,node b){
	return a.w>b.w||(a.w==b.w&&a.id<b.id);
}

int main(){
	int i,j;
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%d",&a[i].w),a[i].id=i;
	sort(a+1,a+1+n,cmp);
	h=1; t=2;
	while (t<=n){
		while (a[t].w==a[t-1].w) t++;
		ans[a[h].id]+=1ll*(a[h].w-a[t].w)*(t-1);
		if (a[t].id>a[h].id) a[h].w=a[t].w;
		else h=t;
		t++;
	}
	ans[a[h].id]+=1ll*a[h].w*n;
	for (i=1;i<=n;i++) printf("%lld\n",ans[i]);
	return 0;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

// 約数の全列挙
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main()
{
    cout << fixed << setprecision(15);
    ll X;
    cin >> X;

    for(ll a=-120; a<=120; a++){
        for(ll b=-120; b<=120; b++){
            if(a*a*a*a*a - b*b*b*b*b == X){
                cout << a << " " << b << endl;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3624
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;

public class Main {

  public static void main(String[] args) {
    new Main().run();
  }

  public void run() {

    try (BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {

      String[] lines = in.readLine().split(" ");
      int H = Integer.parseInt(lines[0]);
      int W = Integer.parseInt(lines[1]);
      int N = H * W;

      int[][] arr = new int[H][W];
      for (int i = 0; i < H; i++) {
        Arrays.fill(arr[i], N);
        String line = in.readLine();
        for (int j = 0; j < W; j++) {
          if (line.charAt(j) == '#') {
            arr[i][j] = 0;
          }
        }
      }

      int ans = bfs(arr, H, W, N);
      System.out.println(ans);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }

  private boolean inside(int H, int W, int y, int x) {
    return 0 <= y && y < H && 0 <= x && x < W;
  }

  private int bfs(int[][] grid, int H, int W, int N) {
    int distMax = 0;
    int[] dy = { 1, 0,-1, 0};
    int[] dx = { 0, 1, 0,-1};

    Deque<Point> que = new ArrayDeque<Point>();
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        if(grid[i][j] == 0) que.offer(new Point(i, j));
      }
    }

    while(!que.isEmpty()) {
      Point cur = que.poll();

      for (int i = 0; i < 4; i++) {
        int ny = cur.y + dy[i];
        int nx = cur.x + dx[i];
        if(inside(H, W, ny, nx) && grid[ny][nx] == N) {
          int d = grid[cur.y][cur.x] + 1;
          grid[ny][nx] = d;
          que.offer(new Point(ny, nx));
          if(distMax < d) distMax = d;
        }
      }
    }

    return distMax;
  }

  class Point {
    public int y, x;

    public Point(int y, int x) {
      this.y = y;
      this.x = x;
    }
  }
}

Measured memory_bytes: 68180
def shuffle(s: str, h: int) -> str:
    return s[h:] + s[:h]


def main() -> None:
    ans = []

    while True:
        s = input()
        if s == "-":
            break
        m = int(input())
        for i in range(m):
            h = int(input())
            s = shuffle(s, h)
        ans += [s]

    print("\n".join(ans))


if __name__ == "__main__":
    main()



Measured memory_bytes: 5604
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#define ll long long
using namespace std;
int n,h,w;
int main()
{
    cin>>n>>h>>w;
    cout<<(n-h+1)*(n-w+1)<<endl;
    return 0;
}


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

struct UnionFind {
    vector<int> data;

    UnionFind(int n) : data(n, -1) {}

    inline int root(int x) {
        return (data[x] < 0) ? x : data[x] = root(data[x]);
    }
    inline int size(int x) { return -data[root(x)]; }
    inline bool same(int x, int y) { return root(x) == root(y); }
    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (data[x] > data[y]) swap(x, y);
        data[x] += data[y];
        data[y] = x;
        return true;
    }
};

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    vector<vector<int>> g(n);
    UnionFind uf(n);
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b, a--, b--;
        g[a].push_back(b);
        g[b].push_back(a);
        uf.unite(a, b);
    }
    for (int i = 0; i < k; i++) {
        int c, d;
        cin >> c >> d, c--, d--;
        if (!uf.same(c, d)) continue;
        g[c].push_back(d);
        g[d].push_back(c);
    }
    for (int i = 0; i < n; i++) {
        cout << uf.size(i) - g[i].size() - 1 << ((i == n - 1) ? "\n" : " ");
    }
}

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

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

  string ans = "";
  rep(i, 0, N) {
    ans.push_back(S[i]);
    ans.push_back(T[i]);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3612
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()
a = LIST()
b = list(accumulate(a))
ans = inf
for i in range(n-1):
    ans = min(ans, abs(b[i]-(b[n-1]-b[i])))
print(ans)

Measured memory_bytes: 32600
#include <bits/stdc++.h>
#include <math.h>
typedef long long int ll;
#define pb         push_back
#define mp         make_pair
#define F          first
#define S          second
#define fl(i,a,b)  for(ll i=a;i<b;i++)
#define pll        pair<ll,ll>
#define pii        pair<int,int>
#define all(v)     v.begin(),v.end()
#define M          1000000007

using namespace std;
bool isPrime(ll n)
{
    if(n<=1)
        return false;
    if(n<=3)
        return true;
    if(n%2==0 || n%3==0)
        return false;

    for(ll i=5;i*i<=n;i=i+6)
        if(n%i==0|| n%(i+2)==0)
            return false;

    return true;
}

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b,a%b);

}

bool sortbydesc(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
    if(a.S < b.S)
        return true;
    else
        return false;
}


int main()
{
 ios::sync_with_stdio(0);
 cin.tie(0);
 cout.tie(0);
 ll h,w;
 cin>>h>>w;
 vector<string> v;
 string s;
 fl(i,0,h)
 {
    cin>>s;
    v.pb(s);
 }
 ll dp[h+1][w+1];
 memset(dp,0,sizeof(dp));
 dp[1][1]=1;
 fl(i,1,h+1)
 {
    fl(j,1,w+1)
    {
        if(v[i-1][j-1]=='.')
        {
            if(i==1 && j!=1)
                dp[i][j]=dp[i][j-1]%M;
            else if(i!=1 && j==1)
                dp[i][j]=dp[i-1][j]%M;
            else if(i!=1 && j!=1)
            {
                dp[i][j]=(dp[i][j]%M + dp[i][j-1]%M) %M;
                dp[i][j]=(dp[i][j]%M + dp[i-1][j]%M) %M;
            }
        }
    }
 }
 cout << dp[h][w]%M;
}

Measured memory_bytes: 9088
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef vector<vector<ll> > mat;

int main()
{ios_base::sync_with_stdio(false);
int n,x;
cin>>n>>x;
if(x==1||x==2*n-1)
{
	ol("No");
	return 0;
}

if(x>=n)
{
	ol("Yes\n");
	rep(i,1,n-1)
	{
		ol(i);on;
	}
	ol(x);on;
	rep(i,x+1,2*n-1)
	{
		ol(i);on;
	}
	rep(i,n,x-1)
	{
		ol(i);on;
	}
}
else
{
	ol("Yes\n");
	rep(i,n+x,2*n-1)
	{
		ol(i);on;
	}
	rep(i,1,n+x-1)
	{
		ol(i);on;
	}
}

return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <stdio.h>
#include <math.h> 
#include <algorithm>
#include <numeric>
#include <functional>
#include <vector>
#include <string>
#include <numeric>
#include <bitset>
#include <queue>

using namespace std;
vector<long long> vec;

int main() {
	//input
	long long n,x;
	cin >> n >> x;

	for (int i = 0; i < n; ++i) {
		int tmp = 0;
		cin >> tmp;
		vec.push_back(tmp);
	}

	sort(vec.begin(), vec.end());

	int ans = 0;

	for (int i = 0; i < n; ++i) {
		x = x - vec[i];
		if (x >= 0) { //手持ちをすべての渡すことができたとき
			ans++;
			if (i == n - 1 && x > 0) { //最後の人まで配ったが、あまりがでたときは最後の人がぴったりではないので-1
				ans--;
			}
		}

	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            
            int intTaro = 0;
            int intHanako = 0;
            
            //入力読取。
            string strNum = Console.ReadLine();
            int intNum = int.Parse(strNum);
            for(int turn = 0; turn < intNum; turn++){
                string strWord =Console.ReadLine();
                CardGame insC = new CardGame(strWord);
                intTaro += insC.GetTaro();
                intHanako += insC.GetHanako();
            }
           
            //出力
            Console.WriteLine("{0} {1}", intTaro, intHanako); 
            
        }
        
    }
    
    class CardGame{
        
        private string strWord;
        private int intTaro;
        private int intHanako;
        
        public CardGame(string strWord){
            this.strWord = strWord;
            Judge();
        }
        
        private void Judge(){
        
            string[] wordArray = strWord.Split(' ');
            string strTaro = wordArray[0];
            string strHanako = wordArray[1];
            int intJudge = strTaro.CompareTo(strHanako);
            if(intJudge == 0){
                intTaro = 1;
                intHanako = 1;
            }else if(0 < intJudge){
                intTaro = 3;
            }else{
                intHanako = 3;
            }
            
        }
        
        public int GetTaro(){
            
            return intTaro;
            
        }
        
        public int GetHanako(){
            
            return intHanako;
            
        }
        
        
    }

}



Measured memory_bytes: 16732
#include<bits/stdc++.h>
using namespace std;
namespace io{
    const int l=1<<20;
    char buf[l],*s,*t,c;
    inline void gc(){
        if(s==t){
            t=(s=buf)+fread(buf,1,l,stdin);
            c=s==t?EOF:*s++;
        }else c=*s++;
    }
    template<class IT>inline void gi(IT &x){
        x=0;gc();while(c<'0'||c>'9')gc();
        while('0'<=c&&c<='9'){x=(x<<1)+(x<<3)+(c^48);gc();}
    }
    char buf0[20];int a;
    template<class IT>inline void pi(IT x){
        if(x<0){putchar('-');x=-x;}
        do buf0[++a]=x%10+48;while(x/=10);
        while(a)putchar(buf0[a--]);
        putchar('\n');
    }
};
using io::gi;
using io::pi;
typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,ll > pil;
typedef pair<ll ,int> pli;
typedef pair<ll ,ll > pll;
typedef vector<int> vi;
typedef vector<ll > vl;
#define pque priority_queue
#define rep(i,l,r) for(i=(l);i<=(r);++i)
#define per(i,l,r) for(i=(l);i>=(r);--i)
#define REP(i,l,r) for(i=(l);i< (r);++i)
#define PER(i,l,r) for(i=(l);i> (r);--i)
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define fi first
#define se second
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
const int N=200005;

int main(){
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    int n,i,x,a=0,b=0,s=1000000000;
    scanf("%d",&n);
    rep(i,1,n){scanf("%d",&x);a+=x;b+=x*x;}
	a=-(a<<1);
	//printf("%d %d %d\n",n,a,b);
	rep(x,1,100)cmin(s,(n*x+a)*x);
	printf("%d",s+b);
    return 0;
}

Measured memory_bytes: 256
prime = [False] * 1001

for i in range(2,1001):
	if prime[i] == False:
		for j in range(i*i,1001,i):
			prime[j]=True

n = int(input())

cnt = [0] * 1001
for i in range(2,n+1):
	for j in range(2,n+1):
		if prime[j] == False:
			val = i
			while val%j==0:
				cnt[j]+=1
				val/=j

ans=1

for x in cnt:
	ans*=(x+1)
	ans%=1000000007

print(ans)

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

#define endl '\n'
#define int long long

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	int n, x, t; cin >> n >> x >> t;
	cout << ((n + (x - 1)) / x) * t << endl;

	return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#define MOD 1e9+7

char v[1004][1004];
int dp[1004][1004];

int main(){
    int n, m;
    std:: cin >> n >> m;
    for(int i = 0; i < n; i++){
        std::cin >> v[i];
    }

    dp[0][0] = 1;
    bool foundObs = 0;
    for(int i = 1; i < m; i++){
        if(v[0][i] == '#'){
            foundObs = 1;
        }
        if(foundObs){
            dp[0][i] = 0;
        }
        else{
            dp[0][i] = dp[0][i-1];
        }
    }

    foundObs = 0;
    for(int i = 1; i < n; i++){
        if(v[i][0] == '#'){
            foundObs = 1;
        }
        if(foundObs){
            dp[i][0] = 0;
        }
        else{
            dp[i][0] = dp[i-1][0];
        }
    }

    for(int i = 1; i < n; i++){
        for(int j = 1; j < m; j++){
            if(v[i][j] == '.')
            {
                dp[i][j] = (dp[i-1][j]%1000000007 + dp[i][j-1]%1000000007)%1000000007;
            }
        }
    }

    std::cout << dp[n-1][m-1];
    return 0;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
#include <chrono>
 
using namespace std;
using namespace __gnu_pbds;
 
#define endl '\n'
 
typedef long long ll;
typedef pair<ll, ll> pii;
typedef tree<int, null_type,less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template<typename T>
static T randint(T lo, T hi){
	return uniform_int_distribution<T>(lo, hi)(rng);
}



int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
 
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	const ll oo = 1e18;

	int n;
	cin >> n;

	vector<ll> a(n);

	for(int i = 0; i < n; i++)
		cin >> a[i];

	sort(a.begin(), a.end());

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

		if((long double)ans * a[i] > oo){
			cout << -1 << endl;
			return 0;
		}

		ans *= a[i];
	}

	cout << ans << endl;

	return 0;
}

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

int n, a[100010], xx[100010];
vector<int> qv[100010];
ll ans[100010];

int main(){
	scanf("%d", &n);
	for(int i = 1; i <= n; i++){
        scanf("%d", a + i);
        xx[i] = a[i];
	}
	sort(xx + 1, xx + n + 1);
	for(int i = 1; i <= n; i++) a[i] = (int)(lower_bound(xx + 1, xx + n + 1, a[i]) - xx);
    for(int i = 1; i <= n; i++) qv[a[i]].push_back(i);
    int mn = n + 1, cnt = 0;
    for(int i = n; i >= 1; i--){
		for(auto &j : qv[i]){
			mn = min(mn, j);
			cnt++;
		}
        ans[mn] += 1LL * cnt * (xx[i] - xx[i - 1]);
    }
    for(int i = 1; i <= n; i++) printf("%lld\n", ans[i]);
	return 0;
}


Measured memory_bytes: 8064
<?php
  $n = trim(fgets(STDIN));
  $array = explode(" ",trim(fgets(STDIN)));
  $ans = 0;
  for($i=0;$i<$n;$i++) {
      for($j=$i+1;$j<$n;$j++) {
          $ans += $array[$i]*$array[$j];
      }
  }
  echo $ans;

Measured memory_bytes: 4604
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}

func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}

func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	a, b, k := iScan(), iScan(), iScan()
	for i := a; i < smaller(b+1, a+k); i++ {
		fmt.Println(i)
	}
	for i := larger(b-k+1, a+k); i <= b; i++ {
		fmt.Println(i)
	}
}


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

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

  return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <math.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <limits>

const long double PI = (acos(-1));

using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    long long numOfPlayers, trainingSet;

    cin >> numOfPlayers >> trainingSet;

    vector<long long> coefficient(numOfPlayers);
    vector<long long> difficulty(numOfPlayers);

    for(int i = 0; i < numOfPlayers; ++i)
        cin >> coefficient[i];
    for(int i = 0; i < numOfPlayers; ++i)
        cin >> difficulty[i];

    // sort fastest eaters first
    sort(coefficient.begin(), coefficient.end(), [&](auto& i, auto& j) { return i > j; });
    // sort toughest food first
    sort(difficulty.begin(), difficulty.end());


    long long lo = -1, hi = coefficient[0] * difficulty.back();

    while (hi - lo > 1) {
        long long mid = (hi + lo)/2;
        long long required = 0;
        for (int i = 0; i < numOfPlayers; ++i) {
            required += max(0LL, coefficient[i] - (mid/difficulty[i]));
        }
        if (required <= trainingSet) {
            hi = mid;
        } else {
            lo = mid;
        }
    }
    cout << hi << endl;
    return 0;


}


Measured memory_bytes: 3456
// In god we trust
 
#include <bits/stdc++.h>
#include <chrono>
#include <algorithm>
#include <signal.h>
#include <thread>
 
#define pb push_back
#define fi first
#define se second
#define Vi vector<int>
#define Vb vector<bool>
#define Pi pair<int, int>
#define MP make_pair
#define MT make_tuple
#define Q queue
#define Qi Q<int>
#define INF 1000000000 
#define LINF 1000000000000000000
#define int long long
using namespace std;
using namespace std::chrono;



signed main(){
  ios_base::sync_with_stdio(false); 
  cin.tie(NULL);

  int n, m, x;
  cin >> n >> m >> x;

  int c[n];
  int a[n][m];
  for (int i = 0; i < n; i++){
    cin >> c[i];
    for (int j = 0; j < m; j++)
      cin >> a[i][j];
  }


  
  int min_cost = INF;
  for (int i = 0; i < pow(2, n); i++){
    Vi d;
    int cop = i;
    for (int j = 0; j < n; j++)
      d.pb(cop % 2), cop /= 2;
    int am[m];
    for (int j = 0; j < m; j++)
      am[j] = 0;

    int cost = 0;
    for (int r = 0; r < n; r++)
      if (d[r]){
	for (int j = 0; j < m; j++)
	  am[j] += a[r][j];
	cost += c[r];
      }

    
    bool could = true;
    for (int r = 0; r < m; r++)
      if (am[r] < x){
	could = false;
	break;
      }
    
    if (could and cost < min_cost)
      min_cost = cost;

  }
  if (min_cost == INF)
    cout << -1 << endl;
  else
    cout << min_cost << endl;
}


Measured memory_bytes: 4024
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fi first
#define se second
using namespace std;
const ll INF = 1LL<<60;
const int inf = 1<<30;
inline void fastio() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
const int maxn = 2e5+5;
char a[maxn];
int s[maxn],cnt[2020];
int main()
{
    fastio();
    cin>>a+1;
    int n=strlen(a+1);
    int p = 1;
    cnt[0] = 1;
    for(int i=n;i;i--)
    {
        s[i] = (s[i+1]+(a[i]-'0')*p)%2019;
        p = (p*10)%2019;
        cnt[s[i]]++;
    }
    ll ans = 0;
    for(int i=0;i<2019;i++) ans += (ll)(cnt[i]-1)*cnt[i]/2;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4580
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
const int MOD = 1e9+7,MAX = 1e5;

int main()
{
	ll n;
	cin >> n;
	ll pow = 1;
	rep(i,n)
	{
		pow *= i+1;
		pow %= MOD;
	}
	cout<<pow<<endl;
	return 0;
}

Measured memory_bytes: 256
/*
 * ALDS1_5_B.cpp
 *
 *  Created on: Apr 27, 2018
 *      Author: 13743
 */

#include<cstdio>

using namespace std;

int cnt = 0;

void merge(int* A, int l, int mid, int r) {
	int n1 = mid - l;
	int n2 = r - mid;
	int L[n1+1];
	int R[n2+1];
	for(int i=0; i<n1; i++) {
		L[i] = A[l + i];
	}
	for(int i=0; i<n2; i++) {
		R[i] = A[mid + i];
	}
	L[n1] = 1000000001;
	R[n2] = 1000000001;
	int lj = 0;
	int rj = 0;
	for(int i=0; l+i<r; i++) {
		cnt++;
		if(L[lj] <= R[rj]) {
			A[l+i] = L[lj];
			lj++;
		}
		else {
			A[l+i] = R[rj];
			rj++;
		}
	}
}

void mergeSort(int* A, int l, int r) {
	if(l+1 < r) {
		int mid = (l + r) / 2;
		mergeSort(A, l, mid);
		mergeSort(A, mid, r);
		merge(A, l, mid, r);
	}
}

int main() {
	int n;
	int S[500000];
	scanf("%d", &n);
	for(int i=0; i<n; i++) {
		scanf("%d", &S[i]);
	}

	mergeSort(S, 0, n);

	printf("%d", S[0]);
	for(int i=1; i<n; i++) {
		printf(" %d", S[i]);
	}
	printf("\n%d\n", cnt);
}



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

int main( void )
{
    const int base = 4280;
    int w, t;

    while ( cin >> w && w >= 0 )
    {
        int pay = 1150;
        w = max( w - 10, 0 );

        if ( w > 0 )
        {
            t = w > 9 ? 10 : w;
            pay += t * 125;
            w = max( w - t, 0 );
        }

        if ( w > 0 )
        {
            t = w > 9 ? 10 : w;
            pay += t * 140;
            w = max( w - t, 0 );
        }

        if ( w > 0 )
        {
            pay += w * 160;
            w = 0;
        }
        
        cout << base - pay << endl;
    }

    return 0;
}

Measured memory_bytes: 0
N, A, B = [int(i) for i in input().split()]
# m = 10**19
if (B-A) % 2 == 0:
    print((B-A) // 2)
    quit()


l = A - 1
r = N - B

c = min(l, r)

res = c+1
d = abs(B-A)-1
# print(res, l, r)
res += d // 2

print(res)


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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  vector<int> vec(3);
  vec = { A, B, C };
  sort(vec.begin(),vec.end());
  
  int ans;
  ans = ( vec.at(1) - vec.at(0) ) + ( vec.at(2) - vec.at(1) );
  cout << ans << endl;
  
}

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

int main() {
	int N, T; cin >> N >> T;
	
	int isTLE = 1;
	int mi=1001;
	for(int i=0; i<N; i++){
		int c, t; cin >> c >>t;
		if(t <= T) {
			if(c < mi) mi = c;
			isTLE = 0;
		}
	}
	
	if(isTLE) cout << "TLE";
	else cout << mi;
	cout << endl;
	
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int cnt[30]={};
  for(int i=0;i<s.size();i++)
    cnt[s[i]-'a']++;
  int f=0;
  for(int i=0;i<30;i++)
    if(cnt[i]%2)f=1;
  cout<<(f?"No":"Yes")<<endl;
  return 0;
}


Measured memory_bytes: 256
from bisect import bisect_left, bisect_right

N,Q = map(int, input().split())
STX = [[int(i) for i in input().split()] for _ in range(N)]
D = [int(input()) for _ in range(Q)]

STX.sort(key=lambda x:x[2])

ans = [-1] * Q
skip = [-1] * Q

for S, T, X in STX:
    # [S - X, T - X)
    left = bisect_left(D, S - X)
    right = bisect_right(D, T - X - 1)

    while left < right:
        if skip[left] < 0:
            skip[left] = right
            ans[left] = X
            left += 1
        else:
            left = skip[left]

print(*ans, sep="\n")

Measured memory_bytes: 64836
#include <stdio.h>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
#define ll long long

int main() {
    int z;
    z=1;
    while (z--) {
        int n;
        ll a, b;
        scanf("%d%lld%lld", &n, &a, &b);
        if (a + b - 1 <= n && n <= a*b) {

            // construct
            int ex = n - a - b + 1;
            vector<ll> arr;
            for (int i = 0; i < b; i++) {
                for (int j = 0; j < a; j++) {
                    if (!i || !j || ex) {
                        arr.push_back((b-i) + b*j);
                        ex -= i && j;
                    } else break;
                }
            }

            // adjust
            vector<ll> vals = arr;
            sort(vals.begin(), vals.end());
            map<ll,int> index;
            for (int i = 0; i < vals.size(); i++) index[vals[i]] = i;

            // print
            for (int i = 0; i < arr.size(); i++) {
                if (i) printf(" ");
                printf("%d", index[arr[i]] + 1);
            }
            printf("\n");
        } else {
            puts("-1");
        }
    }
}


Measured memory_bytes: 27116