akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 1> { using type = vector<T>; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

int main() {
  ll n, m, d;
  while (cin >> n >> m >> d) {
    ll cnt = d > 0 ? 2 * (n - d) : n;
    double res = (double)cnt / n / n * (m - 1);
    printf("%.15f\n", res);
  }
  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);

        while(sc.hasNext()) {
            String box = sc.next();

            if (box.equals("0"))
                break;

            int sum = 0;
            for(int i=0; i<box.length(); i++){
                sum+=box.charAt(i)-'0';
            }
            System.out.printf("%d\n",sum);
        }
    }
}



Measured memory_bytes: 26712
#include<iostream>
#include<algorithm>

typedef long long ll;

using namespace std;

ll prime_count(ll num){

    ll n = num;
    ll ans = 1;

    for(ll i=2; i*i<=n; i++){
        if(n%i!=0) continue;
        ans++;
        while(n%i==0){
            n/=i;
        }
    }
    if(n!=1){
        ans++;
    }

    return ans;
}

int main(){
    
    ll A, B; cin >> A >> B;
    ll GCD = __gcd(A, B);
    ll ans = prime_count(GCD);

    cout << ans << endl;

    return 0;
}

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

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int m = in.nextInt();
        int d = in.nextInt();

        int ans = 0;
        for (int i = 1; i <= m; ++i) {
            for (int j = 1; j <= d; ++j) {
                if (j / 10 >= 2 && j % 10 >= 2  && (j / 10) * (j % 10) == i) {
                    //out.println(i + " " + j);
                    ans++;
                }
            }
        }
        out.println(ans);

        in.close();
        out.close();
    }
    static class Pair {
	  		public int first;
	  		public int second;

	  		public Pair() {
	  			this(0, 0);
	  		}

	  		public Pair(final int first, final int second) {
	  			this.first = first;
	  			this.second = second;
	  		}
	  	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define int long long
#define ll long long
#define maxN 1000005
#define rep(i,n) for(int i=0;i<n;i++)
#define refv(i,l,r) for(int i=l;i<r;i++)
#define rerv(i,l,r) for(int i=l;i>r;i--)
#define pi pair<ll,ll>
#define pii pair<ll,pair<ll,ll> >
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define inf 10000000000000
#define F first
#define S second
#define mod 1000000007
#define printvector(v) for(int i= 0;i<v.size();i++) {cout<<v[i]<<" ";} cout<<endl;
#define printset(s) for(auto it = s.begin();it!=S.end();it++){cout<<*it<<" ";} cout<<endl;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;

//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
string convertupper(string s)
{
    transform(s.begin(), s.end(), s.begin(), ::toupper);
    return s;
}
string convertlower(string s)
{
    transform(s.begin(), s.end(), s.begin(), ::tolower);
    return s;
}

int32_t main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fastio;
    string s;
    cin>>s;
    int n=s.size();
    int ans=1;
    int flag=1;
    string str="";
    str+=s[0];
    refv(i,1,n)
    {
        string temp="";
        temp+=s[i];
        while(str==temp)
        {
            if(i<n-1)
            {    i++;
            temp+=s[i];
            }
            else
            {
                ans--;
                break;
            }
            
        }
        str=temp;
        ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 8010
#define INF 1000000005
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 1000005;
const int MOD = 998244353;
int main(){
    int k;
    cin>>k;
    string s;
    cin>>s;
    if(SZ(s)<=k)OUT(s);
    else{
        REP(i,k)printf("%c",s[i]);
        OUT("...");
    }

    return 0;
}

Measured memory_bytes: 3592
import math
import itertools

n = int(input())
xy = [ list(map(int, input().split())) for _ in range(n) ]
p = itertools.permutations(xy, n)
c = 0
for i in p:
  for j in range(n-1):
    c += ( (i[j][0]-i[j+1][0])**2 + (i[j][1]-i[j+1][1])**2 )**0.5
    
l = math.factorial(n)
print(c/l)

Measured memory_bytes: 42220
A,B,C,X,Y = map(int, input().split())

ans = 0
if C*2 < A+B:
    ans += C * 2 * min(X, Y)
    if X > Y:
        if A < C*2:
            ans += (X-Y) * A
        else:
            ans += (X-Y) * C * 2
    else:
        if B < C*2:
           ans += (Y-X) * B
        else:
           ans += (Y-X) * C * 2
else:
    ans += X*A + B*Y
print(ans)

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

int main() {

  int a,b,c,k;
  cin>>a>>b>>c>>k;
  if(abs(a-c)<=k){
      cout<<"Yes";
      return 0;
  }
  
  if(abs(a-b)<=k&&abs(b-c)<=k){
      cout<<"Yes";
      return 0;
  }
  
  cout<<"No";
   
   
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
struct data{
	int t,m;
};
int n,a,b,c;
data d[100100];
bool cmp(data x,data y)
{
	if(x.t<y.t)
		return true;
	return false;	
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a;
		d[i].m=i;
		d[i].t=a;
	}
	sort(d+1,d+n+1,cmp);
	for(int i=1;i<=n;i++)
		cout<<d[i].m<<" ";
	cout<<endl;	
} 

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

int main() {
  int n;
  cin >> n;
  vector < int > a(n), b(n), c(n);
  for (int i = 0; i < n; ++i)
    cin >> a[i];
  for (int i = 0; i < n; ++i)
    cin >> b[i];
  for (int i = 0; i < n; ++i)
    cin >> c[i];
  sort(b.begin(), b.end());
  sort(c.begin(), c.end());
  vector < int > get_shredded_fat_fuck(n);
  for (int i = 0; i < n; ++i) 
    get_shredded_fat_fuck[i] = n - int(upper_bound(c.begin(), c.end(), b[i]) - c.begin());
  vector < int64_t > suff(n + 1, 0);
  for (int i = n - 1; i >= 0; --i)
    suff[i] = suff[i + 1] + get_shredded_fat_fuck[i];
  int64_t ans = 0;
  for (int i = 0; i < n; ++i) 
    ans += suff[int(upper_bound(b.begin(), b.end(), a[i]) - b.begin())];
  cout << ans << '\n';
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ri(x) scanf("%d",&(x))
#define ri2(x,y) scanf("%d %d",&(x),&(y))
#define ri3(x,y,z) scanf("%d %d %d",&(x),&(y),&(z))
#define rll(x) scanf("%lld",&(x))
#define rll2(x,y) scanf("%lld %lld",&(x),&(y))
#define rll3(x,y,z) scanf("%lld %lld %lld",&(x),&(y),&(z))
#define gc(x) ((x) = getchar())
using namespace::std;

const long double PI = acos(-1);
const long long MOD = 1000000000 +7;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> tll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<tll> vtll;
typedef vector<string> vs;
typedef set<int> si;
typedef set<ii> sii;
typedef set<iii> siii;

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

ll add(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a+b;
	if(res >= m or res <= -m) res %= m;
	if(res < 0) res += m;
	return res;
}

ll mul(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a*b;
	if(res >= m or res <= -m) res %= m;
	if(res < 0) res += m;
	return res;
}

ll pow_mod(ll a, ll b, ll m = MOD){
	ll res = 1LL;
	a = a%m;
	while(b){
		if(b&1) res = mul(res,a,m);
		b >>= 1;
		a = mul(a,a,m);
	}
	return res;
}

ll fastexp(ll a, ll b){
	ll res = 1LL;
	while(b){
		if(b&1) res = res*a;
		b >>= 1;
		a *= a;
	}
	return res;
}

int gcdExtendido(int a, int b, int *x, int *y){
	if(a == 0){
		*x = 0;
		*y = 1;
		return b;
	}
	int x1, y1;
	int gcd = gcdExtendido(b%a,a,&x1,&y1);
	
	*x = y1-(b/a)*x1;
	*y = x1;
	return gcd;
}

int modInverso(int a, int m){
	int x, y;
	int g = gcdExtendido(a,m,&x,&y);
	if(g!=1) return -1;
	else return (x%m + m)%m;
}

/****************************************
*************P*L*A*N*T*I*L*L*A************
*****************************************/

int H, W;
int x, y;

int main(){
	ri2(H,W);
	ri2(x,y);
	int ways = 0;
	if(2*x == H and 2*y == W){
		ways = 1;
	}
	double ans = 1.0 * H * W / 2.0;
	cout << setprecision(7) << fixed << ans << " " << ways << endl;
	return 0;
}


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

int main(){
    int a, b;
    cin >> a >> b;
    for (int i=1; i<=1009; i++){
        if(i*8/100 == a && i*10/100 == b){
            cout << i << endl;
            return 0;
        }
    }
    cout << "-1" << endl;
    return 0;
}

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

using ll = long long; 
const int MOD = 1e9+7;

ll add(ll a, ll b) {
    return (a + b) % MOD;    
}

ll divi(ll a, ll b) {
    return (a / b) % MOD;
}

ll mul(ll a, ll b) {
    return (a * b) % MOD;
}

// Return a ^ b 
int my_pow(int a, int b) {
    if (b == 0) {
        return 1;
    }
    else if (b % 2 == 1) {
        return mul(a, my_pow(a, b-1));
    }
    else {
        int temp = my_pow(a, b/2);
        return mul(temp, temp);
    }
}

int my_inv(int a) {
    return my_pow(a, MOD-2);
}

int main() {
    int n;
    
    scanf("%d", &n);
    
    vector<int> arr(n);
    
    map<int, int> answer;
    //cout << "test" << endl;
    for (int i = 0; i < n; i++) {
        map<int, int> cnt;        
        scanf("%d", &arr[i]);
        int x = arr[i];
        
        //cout << x << endl;
        
        for (int i = 2; i * i <= x; i++) {
            while (x % i == 0) {
                cnt[i] += 1;
                x /= i;
            }
        }
        
        if (x != 1) {
            cnt[x] += 1;
        }
        
        //cout << "test_x" << endl;
        
        for (pair<int, int> p : cnt) {
            answer[p.first] = max(answer[p.first], p.second);
        }
    }
    //cout << "test2" << endl;
    
    ll lcm = 1;
    for (pair<int, int> p : answer) {
        int prime = p.first;
        int k = p.second;
        for (int i = 0; i < k; i++) {
            lcm = mul(lcm, prime);
        }
    }
    
    ll ans = 0;
    
    //cout << "test1" << endl;
    
    for (int i = 0; i < n; i++) {
        ans = add(ans, mul(lcm, my_inv(arr[i])));
    }
    
    //cout << "test2" << endl;
    
    printf("%lld", ans);
	
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    int A, B;
    cin >> A >> B;

    int res = max(0, A-(B*2));
    cout << res << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // シミュレーション
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Map<Long, Long> m = new HashMap<>();
        for (int i = 0; i < n; i++) {
            long e = sc.nextLong();
            if (m.containsKey(e)) {
                m.put(e, m.get(e) + 1L);
            } else {
                m.put(e, 1L);
            }
        }

        int ans = 0;
        for (Entry<Long, Long> ent : m.entrySet()) {
            if (ent.getValue() % 2 == 1) {
                ans++;
            }
        }

        System.out.println(ans);
    }
}



Measured memory_bytes: 64500
import numpy as np
N, M = map(int,input().split(' '))

a = sorted([tuple(map(int,input().split(' '))) for i in range(N)])
def f(a, M):
    cost = 0 
    for i in a:
        if M > i[1]:
            cost += i[0]*i[1]
            M -= i[1]
            continue
        else :
            cost += i[0]*M
            return cost 

print(f(a, M))

Measured memory_bytes: 26864
#include <bits/stdc++.h>
using namespace std;
#define mp(a, b) make_pair(a, b)
typedef pair<int, int> pii; 
typedef long long ll;
const int maxn = 2e5 + 10;
int n, m;
int a[maxn];
vector<pii> b, p;
ll ans, tmp, cnt;
int main()
{
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; ++i) scanf("%d", &a[i]);
	for(int i = 2; i <= n; ++i) 
	{
		if(a[i - 1] < a[i])
			b.emplace_back(a[i - 1], a[i]), b.emplace_back(a[i - 1] + m, a[i] + m);
		else
			b.emplace_back(a[i - 1], a[i] + m);
	}
	for(int i = 0; i < b.size(); ++i)
	{
		p.emplace_back(b[i].first, i + 1);
		p.emplace_back(b[i].second, -(i + 1));
		if(b[i].first <= m && b[i].second > m) p.emplace_back(b[i].first + m, i + 1);
	}
	sort(p.begin(), p.end());
	for(auto v : p)
	{
		if(v.second > 0) 
		{
			++cnt;
			tmp += v.first;
		}
		else
		{
			ans = max(ans, (v.first - 1) * cnt - tmp);
			tmp -= b[-(v.second + 1)].first;
			--cnt;
		}
			 
	}
	ans = -ans;
	for(int i = 2; i <= n; ++i) 
		if(a[i - 1] < a[i])
			ans += a[i] - a[i - 1];
		else
			ans += a[i] + m - a[i - 1];
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 8576
#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;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
ll mod=1e9+7;
int main(){
    ll n,C[200001],dp[200001];
    cin>>n;
    rep(i,n) cin>>C[i];
    vec D;
    D.push_back(C[0]);
    rep(i,n-1) if(C[i]!=C[i+1]) D.push_back(C[i+1]);
    ll num[200001]={0};
    dp[0]=1;
    rep(i,D.size()){
        dp[i+1]=(dp[i]+num[D[i]])%mod;
        (num[D[i]]+=dp[i])%=mod;
    }
    cout<<dp[D.size()]%mod<<"\n";
}

Measured memory_bytes: 6640
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
	static PrintWriter out = new PrintWriter(System.out);
	static Scanner sc = new Scanner(System.in);
	static int INF = 2 << 20;
	static Node[] node;
	public static void main(String[] args) {
		while(true) {
			int n = sc.nextInt();
			if(n == 0)break;
			node = new Node[101];
			for(int i = 0; i < 101; i++) {
				node[i] = new Node(i);
			}
			for(int i = 0; i < n; i++) {
				int a = sc.nextInt();
				int b = sc.nextInt();
				node[a].to.add(node[b]);
				node[b].to.add(node[a]);
			}
			int ans = 0;
			for(int i = 1; i < 101; i++) {
				if(node[i].to.size() == 0) continue;
				boolean[] tmp = new boolean[101];
				tmp[i] = true;
				ans = Math.max(ans,dfs(i,tmp,1));
			}
			System.out.println(ans);
		}
	}
	static int dfs(int now, boolean[] use, int count) {
		int ret = count;
		for(int i = 0; i < node[now].to.size(); i++) {
			int tmp = node[now].to.get(i).id;
			if(use[tmp]) continue;
			use[tmp] = true;
			ret = Math.max(ret, dfs(tmp,use,count+1));
			use[tmp] = false;
		}
		return ret;
	}
	static class Node {
			int id;
			ArrayList<Node> to = new ArrayList<Node>();
			Node(int a) {
				id = a;
			}
	}

}

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

int main(void){
    int A[5];
    int ans=0;
    int tmp=6;
    int tmp2=10;
    for(int i=0;i<5;i++){
        cin>>A[i];
        if(A[i]%10!=0){
            if(A[i]%10<tmp2){
                tmp=i;
                tmp2=A[i]%10;
            }
        }
    }
    for(int i=0;i<5;i++){
        ans+=A[i];
        if(A[i]%10!=0&&i!=tmp){
            ans+=(10-A[i]%10);
        } 
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;

int main(){
		
		int n;
		int a, b, c;
		int x[101];
		int i;
		int cal;
		int val;
		int ans;
		
		cin>>n>>a>>b>>c;
		
		for(i=0; i<n; i++)
			cin>>x[i];
			
		sort(x, x+n, greater<int>());
		cal=c;
		val=cal/a;
		
		for(i=0; i<n; i++){
				cal+=x[i];
				ans=cal/(b*(i+1)+a);
				if(val>ans)
					break;
					
				val=ans;
		}
		
		cout<<val<<endl;
			
	return 0;
}

Measured memory_bytes: 1176
import itertools
from copy import deepcopy
import numpy as np

H,W,K=[int(i) for i in input().split(" ")]
c=[]
for _ in range(H):
    c.append([j=="#" for j in input()])

retval=0
for w in itertools.product([0,1],repeat=W):
    for h in itertools.product([0,1], repeat=H):
        _c=deepcopy(c)
        for i,_w in enumerate(w):
            if _w:
                for j in range(H):
                    _c[j][i]=False
        for i,_h in enumerate(h):
            if _h:
                for j in range(W):
                    _c[i][j]=False

        if np.sum(_c)==K:
            retval+=1

print(retval)


Measured memory_bytes: 27312
#include <stdio.h>
int main(){
	int n[500],x[500], a=0, b=0, c=0, d=0, f=0;
	int  e[500]={0};
	for(d=0;;d++){
		scanf("%d %d", &n[d], &x[d]);
		if(n[d] == 0 && x[d] == 0)break;
		for(a = 1; a <= n[d]; a++){
			for(b = 1; b <= n[d]; b++){if(b == a)break;
				for(c = 1; c <= n[d]; c++){if( c == a || c == b )break;
				if(a+b+c==x[d]){e[d]++;}
				}
			}
		}
	}
for(f = 0; f < d; f++){
	printf("%d\n", e[f]);
}

	
	

	return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
#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 INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int main()
{
  int R,G,B,N;
  cin >> R >> G >> B >> N;
  ll ans = 0;
  REP(i,N/R+2){
    REP(j,N/G+2){
      if((N-i*R-j*G)%B==0&&N-i*R-j*G>=0){
        ans++;
      }
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 3588
N = gets.to_i
w = readlines
w = w[0].split(" ").map(&:to_i);
dif = Array.new(N-1)
for t in 0..N-2
    u = w[0..t].inject(:+).to_i
    v = w[t+1..N-1].inject(:+).to_i
    dif[t] = (u - v).abs
end
puts dif.min { |a, b| a.to_i <=> b.to_i }

Measured memory_bytes: 1788
x = int(input())

for i in range(100):
    for j in range(100):
        if pow(i, 5)+pow(j, 5) == x:
            print(i, -j)
            exit()


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


a = 0
for i in make_divisors(x):
    a = i
    b = 0
    while pow(a, 5)-pow(b, 5) <= x:
        if pow(a, 5)-pow(b, 5) == x:
            print(a, b)
            exit()
        b += 1
        a += 1

Measured memory_bytes: 9428
def gcd(x, y):
    if x < y:
        x, y = y, x
    while y:
        x, y = y, x % y
    return x
def lcm(x, y):
    return x * y // gcd(x, y)

a, b, c, d = map(int, input().split())
m = lcm(c, d)
if a % c == 0:
    x = b // c - a // c + 1
else:
    x = b // c - a // c
if a % d == 0:
    y = b // d - a // d + 1
else:
    y = b // d - a // d
if a % m == 0:
    z = b // m - a // m + 1
else:
    z = b // m - a // m
print(b - a - x - y + z + 1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define pb push_back
#define sz(a) int(a.size())
#define re return
#define all(a) a.begin(),a.end()
#define int long long
using namespace std;
signed main()
{
	int x;
	cin>>x;
	int ans=x/500*1000;
	x=x%500;
	ans+=x-x%5;
	cout<<ans;
	re 0;
}

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

#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int f(int x) {
  if (x == 0) return 0;
  return f(x % __builtin_popcount(x)) + 1;
}

int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> x(n), ans(n);
  rep(i, n) x[i] = s[i] - '0';
  int pc = 0;
  rep(i, n) pc += x[i];

  rep(b, 2) {
    int npc = pc;
    if (b == 0)
      npc++;
    else
      npc--;

    if (npc <= 0) continue;
    int r0 = 0;
    rep(i, n) {
      r0 = (r0 * 2) % npc;
      r0 += x[i];
    }
    
    int k = 1;
    for (int i = n - 1; i >= 0; --i) {
      if (x[i] == b) {
        int r = r0;
        if (b == 0)
          r = (r + k) % npc;
        else
          r = (r - k + npc) % npc;
        ans[i] = f(r) + 1;
      }
      k = (k * 2) % npc;
    }
  }

  rep(i, n) cout << ans[i] << endl;
  return 0;
}

Measured memory_bytes: 5148
import java.util.Scanner;

public class Main {
	private Scanner sc;
	
	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);

		String[] nico = sc.nextLine().split(" ");
		int a = Integer.parseInt(nico[0]);
		int b = Integer.parseInt(nico[1]);
		
		System.out.println(a * b / 3.305785);
	}
}

Measured memory_bytes: 26392
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int N,C;
ll d[40][40];
int c[1010][1010];

vector<pair<ll,int>> f(map<int,ll> m){
    vector<pair<ll,int>> ret;

    for(int clr=1;clr<=C;clr++){
        ll tmp=0;
        for(auto x:m){
            tmp+=x.second*d[x.first][clr];
        }    
        ret.push_back(make_pair(tmp,clr));
    }
    sort(ALL(ret));
    return ret;
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    cin>>N>>C;

    rep(i,C){
        rep(j,C){
            cin>>d[i+1][j+1];
        }
    }
    rep(i,N){
        rep(j,N){
            cin>>c[i+1][j+1];
        }
    }
    map<int,ll> ma,mb,mc;
    
    for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++){
            int var=(i+j)%3;
            if(var==0) ma[c[i][j]]++;
            if(var==1) mb[c[i][j]]++;
            if(var==2) mc[c[i][j]]++;
        }
    }
    auto va=f(ma),vb=f(mb),vc=f(mc);


    ll ans=LINF;
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            for(int k=0;k<3;k++){
                if(va[i].second!=vb[j].second&&vb[j].second!=vc[k].second&&vc[k].second!=va[i].second){
                    ans=min(ans,va[i].first+vb[j].first+vc[k].first);
                }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

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

Measured memory_bytes: 1164
const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const lines = input.trim().split('\n');

while (line = lines.shift()) {
	const [n, max] = line.split(' ').map(Number);

	if (n === 0 && max === 0) {break;}

	const prices = lines.shift().split(' ').map(Number);

	const allSum = [];

	prices.map((priceA, indexA) => {
			prices.map((priceB, indexB) => {
				if (indexA !== indexB) {
					const sum = priceA + priceB;

					if(sum <= max) {
						allSum.push(sum);
					}
				}
			})
		}
	);

	if (allSum.sort((a,b) => b - a)[0]) {
		console.log(allSum.sort((a,b) => b - a)[0]);

		continue;
	}

	console.log('NONE');
}



Measured memory_bytes: 60312
c = int(input())

l = list(range(1, 10))

j = 0

if c < 10:
    print(l[c-1])

else:
    c -= 9

    while True:
        new_l = []
        for i in l:
            d = i % 10
            if d != 0:
                new_l.append(10*i+d-1)
            
            new_l.append(10*i+d)

            if d != 9:
                new_l.append(10*i+d+1)

        if c <= len(new_l):
            new_l.sort()
            print(new_l[c-1])
            break
        else:
            c -= len(new_l)
            l = new_l


Measured memory_bytes: 10752
#include<bits/stdc++.h>
using namespace std;
int main(){
int64_t A,B;
  cin>>A>>B;
  int64_t ans=A;
  for(int64_t i=1;i<=B;i++){
  if(A*i%B==0){
   ans=A*i; break;
  }
  
  }cout<<ans<<endl;
  
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C;
  cin >> A >> B >> C;
 
  if (!(A == B)&&(B == C) ){
    cout << "Yes" << endl;
  }
  else if (!(A == B)&&(A == C) ){
    cout << "Yes" << endl;
  }
  else if (!(A == C)&&(A == B) ){
    cout << "Yes" << endl;
  }
  else if (!(B == C)&&!(A == B)){
    cout << "No" << endl;
  }   
  else {
    cout << "No" << endl;
  }
}

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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 ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  char a; cin>>a;
  if(a>='a') cout<<"a"<<endl;
  else cout<<"A"<<endl;
  
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 2019;
int main()
{
    ll L, R;
    cin >> L >> R;
    ll ans = mod-1;
    if(R - L > mod) { 
        cout << 0 << endl;
        return 0;
    }
    else {
        for(ll i = L; i<=R-1; ++i) {
            for(ll j = i+1; j <= R; ++j) {
                ans = min(ans, (i%mod)*(j%mod)%mod);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from collections import Counter as cl 

def solve(N: int, S: "List[str]"):
    state = ["AC", "WA", "TLE", "RE"]
    d = cl(S)
    for s in state:
        print(s + " x " + str(d[s]))
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 80392
let abcd = readLine()!.split(separator: " ").map { Int($0)! }
let (a, b, c, d) = (abcd[0], abcd[1], abcd[2], abcd[3])

if (c + b - 1) / b <= (a + d - 1) / d {
  print("Yes")
} else {
  print("No")
}


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

int main(){
    int n,x,i,j,k,cnt;
    while(1){
        cin >> n >> x;
        if(n==0 && x==0) break;
        cnt=0;
        for(i=1;i<=n-2;i++){
            for(j=i;j<=n-1;j++){
                for(k=j;k<=n;k++){
                    if(i+j+k==x && i!=j && j!=k && k!=i){
                        cnt++;
                    }
                }
            }
        }
        cout<< cnt<< endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
void dbg_out(){
	cerr<<endl;
}
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T){
	cerr<<' '<< H; 
	dbg_out(T...);
}
int const MAXN=200100;
int n, v[MAXN];
int main(){
	cin.tie(0),cin.sync_with_stdio(0),cout.tie(0),cout.sync_with_stdio(0);
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>v[i];
	map<int,int> cnt;
	for(int i=0;i<n;i++)
		cnt[i-v[i]]++;
	long long ans=0LL;
	for(int i=0;i<n;i++){
		ans+=cnt[i+v[i]];
	}
	cout<<ans;
}


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

using namespace std;
#define PB push_back
#define REP(x,l,u) for(ll x=l;x<u;x++)
#define PII pair<int,int>
#define sz(v) (int)v.size()
#define MP(a,b) make_pair(a,b)
#define all(x) x.begin(),x.end()
#define dbg(x) cerr<<#x<<" is "<<x<<endl;
#define  fi first
#define se second
typedef long long ll;


int main(){
  int a[3];
  for(int i = 0;i<3;i++)cin>>a[i];
  int ans = 11111111;
  for(int i = 0;i<3;i++){
   	for(int j = 0;j<3;j++){
     	for(int k = 0;k<3;k++){
         	if(i!=j && j!=k && i!=k){
             	ans = min(ans,abs(a[j]-a[i])+abs(a[k]-a[j])); 
            }
        }
    }
  }
  cout<<ans<<endl;
  
  
  
  
  
  
  
  
 	return 0; 
}

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

int main(){
    string s;
    getline(cin,s);
    for(int i=0; i<s.size(); i++){
        if(s[i]>='a'&&s[i]<='z')s[i]+='A'-'a';
        else if(s[i]>='A'&&s[i]<='Z')s[i]+='a'-'A';
    }
    cout<<s<<endl;
    return 0;
}


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

int n,d,a[15][15];

int main(){
	cin>>n>>d;
	for (int i=1;i<=n;++i){
		for (int j=1;j<=d;++j){
			scanf("%d",&a[i][j]);
		}
	}
	int ans=0;
	for (int i=1;i<=n;++i){
		for (int j=i+1;j<=n;++j){
			int sum=0;
			for (int k=1;k<=d;++k){
				sum+=(a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
			}
			int tt=sqrt(sum);
			if (tt*tt==sum) ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
a = list(map(int,input().split()))

odd = 0
double = 0
quatro = 0

for i in a:
  if i % 2 == 1:
    odd += 1
  else:
    if i % 4 == 0:
      quatro += 1
    else:
      double += 1

if double == N:
  print("Yes")
  exit()
plus = 0
if double != 0:
  plus = 1
if plus + odd - 1 <= quatro:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 62576
#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    int n, a, b, c;
    cin >> n >> a >> b >> c;

    vector<int> d(n);
    for(int i=0; i<n; ++i)
        cin >> d[i];
    sort(d.rbegin(), d.rend());

    int ret = c / a;
    int sum = 0;
    for(int i=0; i<n; ++i){
        sum += d[i];
        ret = max(ret, (c + sum) / (a + b * (i+1)));
    }

    cout << ret << endl;
    return 0;
}

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

#define MAX 200000
#define SENTINEL 2000000000
typedef long long ll;

int L[MAX/2+2], R[MAX/2+2];

ll merge(int A[], int n, int left, int mid, int right){
  int i, j, k;
  ll cnt = 0;
  int n1 = mid - left;
  int n2 = right - mid;
  for ( i = 0; i < n1; i++ ) L[i] = A[left + i];
  for ( i = 0; i < n2; i++ ) R[i] = A[mid + i];
  L[n1] = R[n2] = SENTINEL;
  i = j = 0;
  for ( k = left; k < right; k++ ){

    if ( L[i] <= R[j] ){
      A[k] = L[i++];
    } else {
      A[k] = R[j++];
      cnt += mid + j - k -1;
    }
  }
  return cnt;
}

ll mergeSort(int A[], int n, int left, int right ){
  int mid;
  ll v1, v2, v3;
  if ( left+1 < right ){
    mid = (left + right)/2;
    v1 = mergeSort(A, n, left, mid);
    v2 = mergeSort(A, n, mid, right);
    v3 = merge(A, n, left, mid, right);
    return v1 + v2 + v3;
  } else return 0;
}

int main(){
  int A[MAX], n, i;

  cin >> n;
  for ( i = 0; i < n; i++ ) {
    cin >> A[i];
  }

  ll ans = mergeSort(A, n, 0, n);
  cout << ans << endl;

  return 0;
}

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

int main() {

  int N, X;
  cin >> N >> X;

  int sum = 0;
  vector<int> m(N);

  for (int i = 0; i < N; i++) {
    cin >> m[i];
    sum += m[i];
  }

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

  X -= sum;

  cout << X / m[0] + N << endl;

}

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

typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, m;
    cin >> n >> m;
    vector <vector<ll> > vv(n, vector<ll> (3));

    for(int i = 0; i < n; i++)
        for(int j = 0; j < 3; j++)
            cin >> vv[i][j];
    

    ll ans = 0;

    for(int bm = 0; bm < 8; bm++)
    {
        vector <ll> cvec(n);

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

            for(int b = 0; b < 3; b++)
            {
                if(bm & (1 << b))
                    cval -= vv[i][b];
                else
                    cval += vv[i][b];
            }

            cvec[i] = cval;
        }  

        sort(cvec.rbegin(), cvec.rend());
        ll cans = 0;

        for(int i = 0; i < m; i++)
            cans += cvec[i];

        ans = max(ans, cans);      
    }

    cout << ans <<"\n";
    return 0;
}


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

#define int long long
#define fast_io(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define loop(i,a,b) for(int i=a;i<b;i++)
#define all(x) x.begin(),x.end()
#define us unordered_set
#define um unordered_map
#define ms multiset
#define mm multimap
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define _max max_element
#define _min min_element
#define tc(T) int T; cin>>T; while(T--)
#define q(q) int q; cin>>q; while(q--)

const int pinf=((int)2e18);
const int ninf=((int)-2e18);
const int mod=1000000007;

using namespace std;

int power(int x,int n,int M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)
        return power((x*x)%M,n/2,M);
    else
        return (x*power((x*x)%M,(n-1)/2,M))%M;
}

bool check_prime(int n)
{
    if(n<2)
        return false;
    for(int i=2;i<=sqrt(n);i++)
    {
        if(n%i==0)
            return false;
    }
    return true;
}

int setbits(int n)
{
    int count=0;
    while(n)
    {
        if(n%2==1)
            count++;
        n>>=1;
    }
    return count;
}

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

bool vowel(char c)
{
    return(c=='a' or c=='e' or c=='i' or c=='o' or c=='u' or c=='A' or c=='E' or c=='I' or c=='U' or c=='O');
}

int32_t main()
{
    fast_io();

    //FILE *fptr1=freopen("in.txt","r",stdin);
    //FILE *fptr2=freopen("out.txt","w",stdout);

    int n;
    cin>>n;
    vector <int> a(n);
    vector <int> m(1000000+5);
    loop(i,0,n)
    {
        cin>>a[i];
        m[a[i]]++;
    }
    int c=0;
    if(m[1]==1)
    {
        cout<< "1";
        return 0;
    }
    if(m[1]>1)
    {
        cout<< "0";
        return 0;
    }


    loop(i,0,n)
    {
        int x=a[i];
        if(m[x]>1)
            continue;
        bool f=0;
        loop(y,1,(int)sqrt(x)+1)
        {
            if(y==1){
            if(x%y==0 and (m[y]>0))
            {
                f=1;
                break;
            }}
            else
            {
                if(x%y==0 and (m[y]>0 or m[x/y]>0))
                {
                    f=1;
                    break;
                }
            }

        }
        if(!f)
        {
            //cout<<x<< " ";
            c++;
        }
    }
    cout<<c;



    return 0;
}


Measured memory_bytes: 12704
from collections import deque

def main():
    import sys
    input = sys.stdin.readline

    MOD = 1000000007
    n = int(input())
    A = list(map(int, input().split()))
    tmp = sum(A)
    ans = 0
    for i in range(n-1):
        tmp -= A[i]
        ans += A[i]*tmp
    print(ans%MOD)

if __name__ == '__main__':
    main()


Measured memory_bytes: 32632
#include <stdio.h>
#include <vector>
using namespace std;

const long long mod = 1000000007;
const long long inv2 = (mod + 1) / 2;

int N, A[200200], C[200200];
long long E, Z, P[200200], S[200200], T[200200];
vector<int> I[200200];

vector<int> go(int l, int r)
{
	if (l == r){
		long long n = I[l].size();
		Z = (Z + E * (n * (n - 1) / 2 % mod) % mod * inv2) % mod;
		return I[l];
	}

	int m = (l + r) / 2;
	auto p = go(l, m);
	auto q = go(m + 1, r);
	vector<int> v;

	T[m] = 1;
	for (int i = m - 1; i >= l; i--) T[i] = T[i + 1] * (C[i + 1] - 1) % mod;
	for (int i = m + 1; i <= r; i++) T[i] = T[i - 1] * (C[i] - 1) % mod;
	for (int i = m; i >= l; i--) T[i] = T[i] * P[i] % mod;
	for (int i = m + 1; i <= r; i++) T[i] = T[i] * S[i + 1] % mod;

	long long ps = 0, qs = 0;
	int i = 0, j = 0;
	while (i < p.size() || j < q.size()){
		if (j == q.size() || (i < p.size() && p[i] < q[j])){
			long long t = T[A[p[i]]];
			Z = (Z + j * E - t * qs % mod * inv2) % mod;
			ps = (ps + t) % mod;
			v.push_back(p[i]);
			i++;
		}
		else{
			long long t = T[A[q[j]]];
			Z = (Z + ps * t % mod * inv2) % mod;
			qs = (qs + t) % mod;
			v.push_back(q[j]);
			j++;
		}
	}
	return v;
}

int main()
{
	scanf ("%d", &N);
	for (int i = 1; i <= N; i++){
		scanf ("%d", &A[i]);
		C[A[i]]++;
	}

	for (int i = N; i >= 1; i--) C[i] += C[i + 1];
	for (int i = N; i >= 1; i--) C[i] -= N - i;

	for (int i = 1; i <= N; i++) if (C[i] <= 0){
		puts("0");
		return 0;
	}

	P[0] = 1;
	for (int i = 1; i <= N; i++) P[i] = P[i - 1] * C[i] % mod;
	S[N + 1] = 1;
	for (int i = N; i >= 1; i--) S[i] = S[i + 1] * C[i] % mod;
	
	E = P[N];
	Z = 0;
	for (int i = 1; i <= N; i++) I[A[i]].push_back(i);
	go(1, N);
	Z = (Z + mod) % mod;

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

	return 0;
}

Measured memory_bytes: 19412
import math
a, b, c = map(int, input().split())
k = int(input())
ans = 0
if a >= b:
    ans += math.floor(math.log2(a / b)) + 1
    b *= pow(2, math.floor(math.log2(a / b)) + 1)
if b >= c:
    ans += math.floor(math.log2(b / c)) + 1
print("Yes" if ans <= k else "No")

Measured memory_bytes: 9196
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#define LL long long

using namespace std;

const int maxn = 100005;

int n, a, t;
int h[maxn];

int main(){
    int pos;
    double ans = 10000000.0;
    cin>>n>>t>>a;
    for(int i = 1; i <= n; i++){
        cin>>h[i];
        if(abs(t*1.0-h[i]*0.006-a*1.0) < ans){
            ans = abs(t*1.0-h[i]*0.006-a*1.0);
            pos = i;
        }
    }
    cout<< pos<< endl;
return 0;
}


Measured memory_bytes: 256
N,M=map(int,input().split())
import math
x = 10**9+7
m = math.factorial(M) %x
n = math.factorial(N) %x
if abs(N-M)>=2:
    print(0)
elif abs(N-M)==1:
    print((m*n)%x)
else:
    print((2*m*m)%x)

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

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.length(); ++i) {
    if (s[i] == '?') s[i] = 'D';
  }
  cout << s << endl;
}


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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int n, k;cin >> n >> k;
    vector<int> h(n);
    inc(i, 0, n) cin >> h[i];
    sort(h.begin(), h.end());
    int mmin = h[n-1] - h[0];
    inc(i, 0, n-k+1) mmin = min(mmin, h[i+k-1]-h[i]);
    cout << mmin << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cstring>
#include <map>
#include <set>
#include <cmath>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define INF 1145141919
typedef long long int ll;
using namespace std;

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

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

ll llpow(ll x, ll y)
{
    ll ans = 1;
    REP(i, y)
    ans *= x;
    return ans;
}

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

    int len=s.size();
    ll ans=0;
    int last0=0, last1=0;
    REP(i,len){
        if(s[i]=='0' and last0<i){
            last0 = i;
        }else if(s[i]=='1' and last1<i){
            last1 = i;
        }
    }
    int cnt0=0, cnt1=0;
    //cout << "last0 " << last0 << " " << "last1 " << last1 << endl;
    REP(i,max(last0,last1)+1){
        if(s[i]=='0'){
            cnt0++;
        }else{
            cnt1++;
        }
    }

    cout << min(cnt0,cnt1)*2 << endl;
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long 
#define M 1000000007
#define P pair<int,int>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define rep(i,n) FOR(i,0,n)
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265

int n;
int sum;

int main(){
  cin>>n;
  for(int i=0;;i++){
    sum+=i;
    if(sum>n){
      FOR(j,1,i+1){
        if(j==sum-n) continue;
        cout<<j<<endl;
      }
      break;
    }
  }

  return 0;
}



Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
ans = 0
mod = 10**9+7
for i in range(60):
	x = 0
	for j in a:
		if j >> i & 1:
			x += 1
	ans += x * (n-x)*(2**i)%mod
print(ans%mod)

Measured memory_bytes: 122936
#include <cstdio>
#include <cassert>
#include <vector>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;

typedef long long LL;
#define X first
#define Y second
typedef pair<LL, LL> pii;
const int N = 1e6 + 100;

char s[2000000];
int main() {
	int ans = 0;
	scanf("%s", s + 1);
	int len = strlen(s + 1);
	bool flag = false;
	s[0] = '0';
	for(int i = len; i >= 0; i --) {
		int t = s[i] - '0';
		if(t < 5) {
			ans += t;
		}
		else if(t > 5) {
			ans += 10 - t;
			s[i - 1] ++;
		}
		else {
			ans += 5;
			if(s[i - 1] >= '5') s[i - 1] ++;			
		}
	}
	printf("%d\n", ans);

}


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

int main(int argc, char const *argv[]) {
  int a;
  cin>>a;
  vector<int> v;
  v.push_back(a);
  int count=1;
  while(1){
    count++;
    if(a%2==0){
      a=a/2;
    }else{
      a=3*a+1;
    }
    auto result=find(v.begin(),v.end(),a);
    if(result!=v.end()){
      cout<<count<<endl;
      break;
    }else{
      v.push_back(a);
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using int_greater_PQ = priority_queue<int,vector<int>,greater<int>>;
using d_array=vector<int>;

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

    array<string,7>Y={ "SUN","MON","TUE","WED","THU","FRI","SAT"};
    auto it=find(Y.begin(),Y.end(),S);
    auto ans=(distance(Y.begin(),it));
    cout<<7-ans<<endl;
}

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

int main(){
    vector <int> time(3);
    cin >> time[0] >> time[1] >> time[2];

    sort(time.begin(), time.end());
    int ans = time[0] + time[1];

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

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

int main(){
    ll n;
    ll a =2;
    cin >> n;
    if(n==1){
        cout<<0<<endl;
    }
    else{
    vector<int> vec(1000005);
    while(n>=a*a){
        if(n % a == 0){
            vec.at(a)++ ;
            n /=a ;
        }
        else a++;
    }
    if(n<1000000){
        vec.at(n)++;
    }
    
int  ans = 0;
rep(i,1000001){
    if(vec.at(i)>0){
        if(vec.at(i)<3){
            ans ++;
        }
        else if(vec.at(i)<6){
            ans += 2;
        }
        else if(vec.at(i)<10){
            ans += 3;
        }
        else if(vec.at(i)<15){
            ans += 4;
        }
        else if(vec.at(i)<21){
            ans += 5;
        }
        else if(vec.at(i)<28){
            ans += 6;
        }
        else if(vec.at(i)<36){
            ans += 7;
        }
        else if(vec.at(i)<45){
            ans += 8;
        }
                
    }

}
if(n<1000000){
    cout << ans <<endl;
}
else{
    cout << ans+1 << endl;
}
    
}}

Measured memory_bytes: 7228
/*
 * main.c
 *
 *  Created on: 2019/07/21
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int H[100001] = {0};

int main()
{
	int N = 0, i = 0, ans = 0;
	scanf("%d", &N);
	for (i = 0; i < N; i++) {
		scanf("%d", &H[i]);
	}
	if(N == 1) {
		ans = 1;
	} else {
		for (i = 0; i < (N-1); i++) {
			if(H[i] <= H[i+1]) {
				if(H[i] <= (H[i+1]-1)) {
					H[i+1] -= 1;
				} else {
					//
				}
				ans = 1;
			} else {
				ans = 0;
				break;
			}
		}
	}

	if(ans == 0) {
		printf("No\n");
	} else {
		printf("Yes\n");
	}
    return 0;
}


Measured memory_bytes: 512