akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L
#define PI 3.141592653589793238462643383279502884L

#define long long long int

using std::vector;
using std::map;
using std::set;
using std::string;
using std::pair;
using std::cin;
using std::cout;
using std::cerr;

// @author: pashka

int main() {
    std::ios::sync_with_stdio(false);

    string s, t;
    cin >> s >> t;
    int n = s.size();
    int m = t.size();
    bool found = false;
    string res = "";

    for (int i = 0; i <= n - m; i++) {
        string ss = s;
        bool ok = true;
        for (int j = 0; j < m; j++) {
            if (ss[i + j] == '?') {
                ss[i + j] = t[j];
            } else if (ss[i + j] != t[j]) {
                ok = false;
                break;
            }
        }
        if (ok) {
            for (int j = 0; j < n; j++) {
                if (ss[j] == '?') ss[j] = 'a';
            }
            if (found) {
                if (ss < res) res = ss;
            } else {
                res = ss;
                found = true;
            }
        }
    }

    cout << (found ? res : string("UNRESTORABLE")) << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
//long long int countt[200003];
#include<ext/pb_ds/assoc_container.hpp> // include the associative containers or group of templates such as set, multimap, map etc.
#include<ext/pb_ds/tree_policy.hpp> // include the tree_order_statistics_node update
using namespace __gnu_pbds; //necessary for the GNU based Policy based data structures.
typedef tree<pair<int,int> ,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define int long long
#define endl "\n"



signed main()
{
    FAST;
    int t;
    t=1;
    
    while(t--)
    {
        int i=0,j=0,k=0,n=0,m=0,count=0,temp=0;
        int temp1=0,temp2=0,temp3=0,x=0,l=0,y=0,sum=0;
        int left=0,up=0,down=0,start=0,end=0,r=0,q=0,total=0;
        int maxx=0,minn=0,curr=0,ans=0,places=0,zeroes=0,low=0,high=0;
        int prev=0,mid=0,z=0,d=0,val=0,pos=0,shift=0,h=0,right=0,var=0;
        
        cin>>x>>y;
        temp = y- 2*x;
        
        if(temp%2 || temp/2<0 || temp/2>x)
        {
            cout<<"No"<<endl;
            return 0;
        }
        
        cout<<"Yes"<<endl;
        
        
        
        
    }
        
    
    
    
    
}

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

int main(){
  int i,j,cnt=0;
  int n;
  cin>>n;
  ll a[n],b[n];
  for(i=0;i<n;i++)cin>>a[i];
  for(i=0;i<n;i++)cin>>b[i];
  for(i=0;i<n;i++)a[i]=a[i]-b[i];
  ll sum=0;
  for(i=0;i<n;i++)sum+=a[i];
  if(sum<0){
    cout<<-1;
    return 0;
  }
  sort(a,a+n);
  ll minus=0;
  for(i=0;i<n;i++){
    if(a[i]<0)minus-=a[i];
    else{
      cnt=i;
      break;
    }
  }
  sum=0;
  for(i=0;i<n;i++){
    if(sum>=minus)break;
    sum+=a[n-1-i];
  }
  cout<<cnt+i;
}

Measured memory_bytes: 1792
#pragma region Template
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define rng(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define rbf(i, v) for (auto& (i) : (v))
#define All(x) (x).begin(),(x).end()
#define COL(x) cout << x << endl
#define CO(x) cout << x
//#define int long long

using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = INT64_MAX >> 1;
const int INF = INT_MAX >> 1;

inline int sqr(int x) { return (x * x); }
inline void printd(double x) { printf("%.10lf\n", x); }
inline void upsort(VI& x) { sort((x).begin(), (x).end()); }
inline void downsort(VI& x) { sort((x).begin(), (x).end(), greater<int>()); }
inline int absdiff(int a, int b) { return (a - b) * (static_cast<int>(a > b)*2 - 1); }
int gcd(int a, int b) { // 最大公約数
	if (a < b) return gcd(b, a);
	int r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
inline int lcm(int a, int b) { return a * b / gcd(a, b); } // 最小公倍数
#pragma endregion



signed main()
{	
	int N, M, Q;
	cin >> N >> M >> Q;
	VI a(Q), b(Q), c(Q), d(Q);
	VVI dabc(Q, VI(4));
	rep(i, Q) cin >> dabc[i][1] >> dabc[i][2] >> dabc[i][3] >> dabc[i][0];

	int summax = 0;
	rng(a10, 1, M + 1) {
		rng(a9, 1, a10+1) {
			rng(a8, 1, a9 + 1) {
				rng(a7, 1, a8 + 1) {
					rng(a6, 1, a7 + 1) {
						rng(a5, 1, a6 + 1) {
							rng(a4, 1, a5 + 1) {
								rng(a3, 1, a4 + 1) {
									rng(a2, 1, a3 + 1) {
										rng(a1, 1, a2 + 1) {
											VI A = { a1,a2,a3,a4,a5,a6,a7,a8,a9,a10 };
											int sum = 0;
											rep(i, Q) {
												if (dabc[i][3] == A[dabc[i][2] - 1] - A[dabc[i][1] - 1]) sum += dabc[i][0];
											}
											summax = max(sum, summax);
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
	COL(summax);

	return 0;
}

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

int main(){
  int  n,m;
  cin >> n >> m;
  vector<int> map(n+1);
  vector<long long> dp(n+1);
  for(int i=0; i<m; i++){
    int a;
    cin >> a;
    map.at(a) = 1;
  }
  
  dp.at(0) = 1;
  if(map.at(1) == 0) dp.at(1) = 1;
  
  for(int i=2; i<n+1;i++){
    if(map.at(i) == 0){
      long long tmp = dp.at(i-1) + dp.at(i-2);
      dp.at(i) = tmp%1000000007;
    }
  }
  cout << dp.at(n) << endl;
  
}

Measured memory_bytes: 1408
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define dump(o) { cerr << #o << " " << o << endl; }
#define dumpc(o) { cerr << #o; for (auto &e : (o)) cerr << " " << e; cerr << endl; }
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

#define MAX 10001

signed main() {
	string s; cin >> s;
	bool N = false, W = false, E = false, S = false;
	if (s.find("N") == string::npos)
		N = true;
	if (s.find("W") == string::npos)
		W = true;
	if (s.find("E") == string::npos)
		E = true;
	if (s.find("S") == string::npos)
		S = true;
	if ((N^S) == 0 && (E^W) == 0)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
char a[101];
int main()
{
	cin>>a;
	int b=strlen(a);
	bool t=0,tt=0;
	for(int i=0;i<=b-1;i++)
	{
		if(a[i]=='C')tt=1;
		if(a[i]=='F'&&tt==1)t=1;
	}
	if(tt&&t)cout<<"Yes\n";
	else cout<<"No\n";
}

Measured memory_bytes: 256
n,*abc=map(int,input().split())
ip=[0]*n
for i in range(n):
	tmp=input()
	if tmp=="AB":
		ip[i]=[0,1]
	elif tmp=="BC":
		ip[i]=[1,2]
	else:
		ip[i]=[0,2]
ans="Yes"
res=[0]*n
s=sum(abc)
if s==0:
	ans="No"
elif s==1:
	for i in range(n):
		i1=ip[i][0]
		i2=ip[i][1]
		if abc[i1]+abc[i2]==0:
			ans="No"
		elif abc[i1]+abc[i2]==1:
			if abc[i1]==0:
				abc[i1]+=1
				abc[i2]-=1
				res[i]=i1
			else:
				abc[i1]-=1
				abc[i2]+=1
				res[i]=i2
else:
	i1=ip[0][0]
	i2=ip[0][1]
	if abc[i1]+abc[i2]==0:
		ans="No"
	else:
		for i in range(n):
			i1=ip[i][0]
			i2=ip[i][1]
			if abc[i1]*abc[i2]==0:
				if abc[i1]==0:
					abc[i1]+=1
					abc[i2]-=1
					res[i]=i1
				else:
					abc[i1]-=1
					abc[i2]+=1
					res[i]=i2
			elif i+1<n and ip[i+1]!=ip[i]:
				c=list(set(ip[i])&set(ip[i+1]))[0]
				if i1==c:
					abc[i1]+=1
					abc[i2]-=1
					res[i]=i1
				else:
					abc[i1]-=1
					abc[i2]+=1
					res[i]=i2
			else:
				abc[i1]+=1
				abc[i2]-=1
				res[i]=i1
print(ans)
dic={0:"A",1:"B",2:"C"}
if ans=="Yes":
	for i in range(n):
		'''
		if res[i]==0:
			print("A")
		elif res[i]==1:
			print("B")
		else:
			print("C")
		'''
		print(dic[res[i]])

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

long long int c[51][51];

void make_C(int n){

    for(int i=0; i<=n; i++){
        for(int j=0; j<=i; j++){
            if(j == 0 || j==i) {
                c[i][j] = 1LL;
            }
            else {
                c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
            }
        }
    }
}

int main() {


    int n,a,b;

    cin >> n >> a >> b;

    long long int v[n];

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

    sort(v,v+n,greater<long long int>());

    double sum = 0;

    for(int i=0; i<a; i++){
        sum += v[i];
    }

    sum /= a;

    cout.precision(20);

    cout << fixed << sum << endl;

    long long int ans = 0;

    make_C(n);

    int counter = 0,pos = 0;

    for(int i=0; i<n; i++){
        if(v[i] == v[a-1]){
            counter++;
            if(i<a){
                pos++;
            }
        }
    }

    if(pos == a){

        for(int i=a; i<=b; i++){
            ans += c[counter][i];
        }

    }
    else{

        ans += c[counter][pos];

    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  #define int long long
  string S;
  cin>>S;
  int a=0;
  for(int i=0;i<(int)S.size();i++){
    a+=S.at(i)-'0';
  }
  if(a%9==0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;  
  }
}

Measured memory_bytes: 3720
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<algorithm> // sort
#include<map> // pair
#include<cmath>
using namespace std;
using ll = long long;
const ll mod = 1e9+7;





int main(){
  ll a,b,t;
  cin >> a >> b >> t;
  cout << t / a * b;
}


Measured memory_bytes: 256
import bisect

N = int(input())
a = list(map(int, input().split()))

big_list = []
num_list = []
biggest = 0
for i, a_i in enumerate(a):
    if a_i > biggest:
        big_list.append(a_i)
        num_list.append(i)
        biggest = a_i
big_list.append(10 ** 10)
big_list.append(0)
num_list.append(0)
num_list.append(0)

ans = [0] * N
a.sort()
j = 0
for i, a_i in enumerate(a):
    if a_i < big_list[j]:
        ans[num_list[j]] += a_i - big_list[j - 1]
    else:
        ans[num_list[j]] += (big_list[j] - big_list[j - 1]) * (N - i)
        j += 1
for i in range(N):
    print(ans[i])


Measured memory_bytes: 71148
#include <iostream>
using namespace std;
int main(void){
    int n,i,x;
    cin >> n;
    for (i=1;i<=n;i++){
        if (i % 3 ==0){
            cout << " " << i;
        }else{
            x=i;
            while(x){
                if(x % 10 ==3 ){
                    cout << " " << i;
                    break;
                }
                x /=10;
            }
            
        }
    }
    cout << endl;
}


Measured memory_bytes: 3084
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

bool isKValid(int k, vector<bool> &toFlip)  {
	int n = toFlip.size();
	vector<bool> firstK(toFlip.begin(), toFlip.begin() + k);
		bool isFlipped = false;
		for (int i = 0; i < k; ++i) {
			// if we can flip      and  if we have to flip
			if ((i + k - 1 < n) && (isFlipped != firstK[i])) {
				isFlipped = !isFlipped;
			}
			if (isFlipped) {
				firstK[i] = !firstK[i];
			}
		}
	bool isValid = true;
	for (int i = 0; i < k; ++i) {
		isValid = (isValid && !firstK[i]);
	}
	//cout << k << " validity: " << isValid << endl;
	return isValid;
}

int main() {
	ios_base::sync_with_stdio(false);
	string s; cin >> s;
	int n = s.size();
	vector<bool> toFlip(n, false);
	for (int i = 0; i < n; ++i) {
		toFlip[i] = (s[i] == '1');
	}
	int lo = n/2 - (n % 2 == 0 ? 1 : 0);
	int hi = n;
	while (lo < hi) {
		int testk = (lo + hi) / 2;
		// let's see if k is less than mid.
		if (!isKValid(testk, toFlip)) {
			hi = testk;
		} else {
			lo = testk + 1;
		}
	}
	if (!isKValid(lo, toFlip)) {
		cout << lo - 1;
	} else {
		cout << n;
	}
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;//×Ô¶¯È¡Ä£2^64 
const double pi=acos(-1.0);
const int mod = 1e9+7; // 998244353;
const int inf = 0x7fffffff;//2^31-1	
const ll INF = 0x7fffffffffffffff;
const int dx[]={-1,0,1,0},dy[]={0,1,0,-1};
//double begin_time=clock();    double end_time=clock();printf("time= %f ms\n",end_time-begin_time);
//bool operator < (const mmp &a) const{return x<a.x||x==a.x&&y<a.y;}       //map<int,map<int,int> >z;
//map<int,int>::iterator it;for(it=z.begin();it!=z.end();it++)printf("%d %d\n",it->first,it->second);
//ll pow(ll a,ll b){ll s=1;while(b){if(b&1){s=(s*a)%mod;b--;}b/=2;a=a*a%mod;}return s;}  //¿ìËÙÃÝÈ¡Ä£ 
//lower_bound(begin,end,num); µÚÒ»¸ö>=numµÄÊý×Ö upper_bound(begin,end,num); µÚÒ»¸ö>numµÄÊý×Ö,·µ»ØµØÖ·
//freopen("input.in","r",stdin);     freopen("output.out","w",stdout);      //ÎÄ¼þ¶ÁÐ´Ìá½» 
//reverse(s.begin(),s.end());   //·­×ª×Ö·û´® ||        floor(); ÏòÏÂÈ¡Õû  ceil(); ÏòÉÏÈ¡Õû
//x&(x-1)==0 //ÊÇ2µÄN´Î·½||         x%9 //x¸÷¸öÎ»µÄºÍ||           log10(x)+1   //xµÄÎ»Êý|| 
//ÊýÖáÉÏµÄn¸öµãÒÆ¶¯µ½Í¬Ò»Î»ÖÃ£¬ÒÆ¶¯µ½¸Ã×éÊý×ÖµÄÖÐÎ»ÊýµÄ×Ü¾àÀë×î¶Ì


int main()
{
	int a,b,c,d,e,f,T;
	//scanf("%d",&T);
	//while(T--)
	{
		scanf("%d",&a);
		a%=10;
		if(a==3)printf("bon\n");
		else if(a==0||a==1||a==6||a==8)printf("pon\n") ;
		else printf("hon\n")  
		;
		
	}
	
}





Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
char A[60][60];
char B[60][60];
int n,m;
bool match(int x,int y){
	for (int i=0; i <m; ++i)
	{
		for(int j=0;j<  m;++j)
		{
			if(A[y+i][x+j]!=B[i][j]) return false;
		}
	}
	return true;
}
int main(){
	// freopen("in.txt","r",stdin);
	// freopen("out.txt","w",stdout);
	scanf("%d %d",&n,&m);
	for (int i = 0; i < n; ++i)
	{
		scanf("%s",A[i]);
	}
	for (int i = 0; i < m; ++i)
	{
		scanf("%s",B[i]);
	}
	for (int y = 0; y <= n-m; ++y)
	{
		for (int x = 0; x <= n-m; ++x)
		{
			if(A[y][x] == B[0][0] && match(x,y)){
				printf("Yes\n");
				return 0;
			} 
		}
	}
	printf("No\n");
	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <functional>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long ll;

ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}
ll kai(ll x, ll y, ll m) {
	ll res = 1;
	for (ll i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
ll mod_pow(ll x, ll y, ll m) {
	ll res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

ll comb(ll x, ll y, ll m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

const int mod = 1000000007;

int x;
int d[2010][2010];
int cum[2010];

signed main() {
	std::random_device rnd;
	std::mt19937_64 mt(rnd());
	cin >> x;
	d[0][0] = 1;
	for (int i = 0; i < 2000; i++) {
		fill(cum, cum + 2010, 0);
		for (int j = 0; j <= 2000; j++)cum[j + 3] = d[i][j];
		for (int j = 1; j <= 2000; j++) {
			cum[j] = (cum[j] + cum[j - 1]) % mod;
			d[i + 1][j] = cum[j];
		}
	}
	ll ans = 0;
	for (int i = 0; i <= 2000; i++)ans = (ans + d[i][x]) % mod;
	cout << ans << endl;
}

Measured memory_bytes: 19348
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	string s,t;
	cin>>s>>t;
	ll a,b;
	cin>>a>>b;
	string u;
	cin>>u;
	if(s==u){
		a--;
	}
	else{
		b--;
	}
	cout << a<<" "<<b;
	// your code goes here
	return 0;
}

Measured memory_bytes: 3624
countList = []
while True:
    countTmp = 0
    n, x = list(map(int, input().split()))
    if n == 0 and x == 0:
        break
    for i in range(1, n-1):
        for j in  range(i+1, n):
            for k in range(j+1, n+1):
                if x == (i+j+k):
                    countTmp += 1
    countList.append(countTmp)
for z in range(len(countList)):
    print(countList[z])


Measured memory_bytes: 5600
#include <stdio.h>
#include <string.h>

int main(){
   int  k;
   char s[101];

   scanf("%d",&k);
   scanf("%s",s);
   if (strlen(s)>k) {
      s[k]='\0';
      printf("%s...\n",s);
   } else puts(s);
   return 0;
}


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

using namespace std;

int N;

vector<int> a, b;

vector<int> kmp(const vector<int> &vt, vector<int> &vp)

{

    int i, q, k;

    int n = vt.size();

    int m = vp.size();

    vector<int> nxt(m);

    vector<int> res;

    for (q = 1, k = 0; q < m; ++q) {

        while (k > 0 && vp[q] != vp[k]) k = nxt[k - 1];

        if (vp[q] == vp[k]) k++;

        nxt[q] = k;

    }

    for (i = 0, q = 0; i < n; ++i) {

        while (q > 0 && vp[q] != vt[i]) q = nxt[q - 1];

        if (vp[q] == vt[i]) q++;

        if (q == N) {

            res.push_back(i - m + 1);

            q = nxt[q - 1];

        }

    }

    return res;

}

void solve()

{

    vector<int> c(2*N-1);

    vector<int> d(N);

    for (int i = 0; i < N - 1; i++) {

        c[i] = a[i] ^ a[i + 1];

        d[i] = b[i] ^ b[i + 1];

    }

    c[N - 1] = a[N - 1] ^ a[0];

    d[N - 1] = b[N - 1] ^ b[0];

    for (int i = N; i < 2*N; i++) c[i] = c[i - N];

    auto pos = kmp(c, d);

    for (int k : pos) cout << k << " " << (b[0] ^ a[k]) << endl;

}

int main()

{
    ios::sync_with_stdio(false); cin.tie(0);
    cin >> N;

    a.resize(N);

    b.resize(N);

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

    for (int i = 0; i < N; i++) cin >> b[i];

    solve();

    return 0;

}

Measured memory_bytes: 8292
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int A, B, C;
    cin >> A >> B >> C;
    for (int i = 1; i <= B; i++)
    {
        if ((A * i) % B == C)
        {
            cout << "YES" << endl;
            return 0;
        }
        
    }

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

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	char input[51];
	int N, K;

	scanf("%d %d", &N, &K);
	scanf("%s", input);
	input[K - 1] = input[K - 1] - 'A' + 'a';

	printf("%s\n", input);

	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#define n 100000
int main()
{
	int N,M;
	int x[n],y[n],z[n];
	int a,b,i,k,sum=0;
	scanf("%d",&N);
	for(i=1;i<=N;i++)
	{
		scanf("%d",&x[i]);
	}
	for(i=1;i<=N;i++)
	{
		sum=sum+x[i];
	}
	scanf("%d",&M);
	for(i=1;i<=M;i++,k++)
	{
		scanf("%d%d",&a,&b);
		z[a]=b;
		y[i]=sum-x[a]+z[a];
	}
	for(i=1;i<=M;i++)
	{
		printf("%d\n",y[i]);
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std ;
int main() {
  int N;
  cin >> N;
  
  vector<int> vec(N);
  for (int i=0; i<N; i++) {
    cin >> vec.at(i);
  }
  
  sort(vec.begin(),vec.end());
  
  cout << vec.at(vec.size() - 1) - vec.at(0) << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  long a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << max(a*b, c*d) << endl;
}

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


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

int main() {
    int N, W; cin >> N >> W;
    vector<int> w(N), v(N);
    vector<int> w1, w2, w3, w4;
    rep(i, N){
        cin >> w[i] >> v[i];
    }
    ll w0 = w[0];
    rep(i, N){
        if(w[i] == w0){
            w1.push_back(v[i]);
        } else if(w[i] == w0 + 1){
            w2.push_back(v[i]);
        } else if(w[i] == w0 + 2){
            w3.push_back(v[i]);
        } else {
            w4.push_back(v[i]);
        }
    }
    sort(w1.begin(), w1.end());
    sort(w2.begin(), w2.end());
    sort(w3.begin(), w3.end());
    sort(w4.begin(), w4.end());

    int w1s = w1.size();
    int w2s = w2.size();
    int w3s = w3.size();
    int w4s = w4.size();

    ll ans = 0;

    for (int i = 0; i <= w1s; i++){
        for (int j = 0; j <= w2s; j++){
            for (int k = 0; k <= w3s; k++){
                for (int l = 0; l <= w4s; l++){
                    ll total = w0 * (i+j+k+l) + j + k*2 + l*3;
                    if(total > W)break;
                    ll kouho = 0;
                    for (int m = w1s-1; m >= w1s-1-i+1; m--){
                        kouho += w1[m];
                    }
                    for (int m = w2s-1; m >= w2s-1-j+1; m--){
                        kouho += w2[m];
                    }
                    for (int m = w3s-1; m >= w3s-1-k+1; m--){
                        kouho += w3[m];
                    }
                    for (int m = w4s-1; m >= w4s-1-l+1; m--){
                        kouho += w4[m];
                    }
                    ans = max(ans, kouho);
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int get_Max_size(int money, int base) {
  int count = 0;
  int tmp_money = money;
  for (;;) {
    if (tmp_money - base > 0) {
      tmp_money -= base;
      count += 1;
    } else {
      break;
    }
  }
  // std::cout << "count" << count << std::endl;
  return count;
}

int main() {
  int N = 0;
  int Y = 0;
  std::cin >> N;
  std::cin >> Y;
  if (Y / 1000 == N) {
    std::cout << "0"
              << " "
              << "0"
              << " " << N << std::endl;
    return 0;
  } else if (Y / 5000 == N) {
    std::cout << "0"
              << " " << N << " "
              << "0" << std::endl;
    return 0;
  } else if (Y / 10000 == N) {
    std::cout << N << " "
              << "0"
              << " "
              << "0" << std::endl;
    return 0;
  }

  int x = 0;
  int y = 0;
  int z = 0;

  int x_counter = 0;
  int y_counter = 0;
  int z_counter = 0;

  int max_10000 = get_Max_size(Y, 10000);

  for (int i = 0; i < max_10000 + 1; i++) {
    int tmp_Y = Y - 10000 * i;
    x_counter = i;
    int max_5000 = get_Max_size(tmp_Y, 5000);
    for (int j = 0; j < max_5000 + 1; j++) {
      y_counter = j;
      z_counter = (tmp_Y - 5000 * j) / 1000;

      if (x_counter + y_counter + z_counter == N) {
        std::cout << x_counter << " " << y_counter << " " << z_counter
                  << std::endl;
        return 0;
      }
    }
  }

  std::cout << "-1"
            << " "
            << "-1"
            << " "
            << "-1" << std::endl;

  // std::cout << x_counter << " " << y_counter << " " << z_counter <<
  // std::endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll            long long
#define nl            "\n"
#define PB            push_back
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
int main()
{
    _SAD()
    int n;
    cin>>n;
    if(n%4==0||n%11==0||n%7==0)
    {
        cout<<"Yes"<<nl;
        return 0;
    }
    else
    {
       for(int i=0;i<=100;i+=4)
       {
           for(int j=0;j<=100;j+=7)
           {
               if(i+j==n)
               {
                   cout<<"Yes"<<nl;
                   return 0;
               }
           }
       }

        cout<<"No"<<nl;
    }
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

//find_by_order gives kth-largest element
//order_of_key gives the number of items in the set that are strictly smaller!!

// OT.find_by_order(k-1)
// 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define db4(x, y, z, w) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << "," << #w << "=" << w << endl
#define ll long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define X first
#define Y second
#define sz(x) (int)((x).size())
#define pii pair<int,int>
#define MOD (ll)(998244353)
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
typedef vector<int> vi;
#define inf (ll)(1e18)
#define double long double
#define int long long

//////////////////////
const int N = 2005;


int32_t main() {

    ios::sync_with_stdio(false);
    cin.tie(0); 
    cout.tie(0);

    int N, M;
    cin >> N >> M;

    vector<pii> st(N);
    rep(i,N) {
        cin >> st[i].X >> st[i].Y;
    }

    sort(all(st));
    int cost = 0, go = 0;
    while(M > 0) {
        int tk = min(st[go].Y, M);
        cost += st[go].X * tk;
        M  -= tk;
        go++;
    }
    cout << cost << '\n';
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
#include <fstream>

using namespace std;

struct before_main{before_main(){cin.tie(0); ios::sync_with_stdio(false);}} before_main;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> ostream& operator << (ostream& ost, vector<T> const& v) { ost << "["; rep(i, v.size()) { if(i) ost << ", "; ost << v[i]; } ost << "]"; return ost; }

typedef long long ll;
int const inf = 1<<29;

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

int H, W; ll L;
int dir, y, x, cost;
string const ds = "WNES";

map<tuple<int, int, int>, int> vis;
vector<tuple<int, int, int>> data_;
char G[111][111];

bool in_range(int y, int x, int H, int W) {
  if(!(0<=y&&y<H&&0<=x&&x<W)) return false;
  if(G[y][x] == '#') return false;
  return true;
}

void adjust_dir() {
  while(!in_range(y + dy[dir], x + dx[dir], H, W)) {
    dir ++;
    dir %= 4;
  }
}

void debug() {
  cout << "cost = " << cost << endl;
  rep(i, H) {
    rep(j, W) {
      if(isalpha(G[i][j])) cout << ".";
      else if(i == y && j == x) cout << ds[dir];
      else cout << G[i][j];
    }
    cout << endl;
  }
  cout << get<0>(data_.back()) << ", ";
  cout << get<1>(data_.back()) << ", ";
  cout << get<2>(data_.back()) << endl;
  cout << endl;
}

void enter_loop() {
  const int loop_start_cost = vis[make_tuple(y,x,dir)];
  const int len = cost - loop_start_cost;
  /*
  cout << "loop_start_cost = " << loop_start_cost << endl;
  cout << "len = " << len << endl;
  */
  L -= loop_start_cost;
  /*
  cout << "L = " << L << endl;
  cout << "data_.size() = " << data_.size() << endl;
  cout << "soeji = " << loop_start_cost + L % len << endl;
  */
  int Y, X, d; tie(Y, X, d) = data_[loop_start_cost + L % len - 1];
  cout << Y+1 << " " << X+1 << " " << ds[d] << endl;
}

bool step() {
  adjust_dir();
  y += dy[dir], x += dx[dir];
  cost ++;
  if(vis.find(make_tuple(y, x, dir)) != vis.end()) {
    enter_loop();
    return false;
  }
  if(cost == L) {
    cout << y+1 << " " << x+1 << " " << ds[dir] << endl;
    return false;
  }
  vis[make_tuple(y, x, dir)] = cost;
  data_.emplace_back(y, x, dir);
//  debug();
  return true;
}

void simulate() {

  vis.clear();
  data_.clear();
  cost = 0;

  while(step());
}

int main() {

  for(; cin >> H >> W >> L && (H | W | L);) {
    rep(i, H) rep(j, W) {
      cin >> G[i][j];
      if(isalpha(G[i][j])) {
        y = i, x = j;
        dir = ds.find(G[i][j]);
      }
    }

    simulate();
  }
  
  return 0;
}

Measured memory_bytes: 3528
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc =new Scanner(System.in);
		
		
		int a=sc.nextInt();
		int b=sc.nextInt();
		int h=sc.nextInt();
		
		
		System.out.println((a+b)*h/2);

}
}


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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)

#define irrep(i,n) for(int i = (int)(n); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<v_char > v2_char;
typedef std::vector<double> v_double;
typedef std::vector<v_double > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<v_int > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<v_ll > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<v_string > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<v_bool > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std; 

int main(void)
{
    int a, b;
    cin >> a >> b;
    v_char group = {'d','c','a','c','b','c','b','c','c','b','c','b','c'};

    if(group[a] == group[b]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}   
/** atcoder **/


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

int main(){
	long long int A,B,C;
	cin>>A>>B>>C;
	if((A&1)&&(B&1)&&(C&1)){
		cout<<min(min(A*B,B*C),C*A)<<endl;
	}
	else
		cout<<0<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
using namespace std;
using ll = long long;
using pii = pair<int,int>;
template<typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> a){
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os, vector<T> v){
    for(auto x:v)os << x << ' ';
    return os;
}
void debug(){cerr << '\n';}
template<typename H, typename... T>
void debug(H a, T... b){
    cerr << a;
    if(sizeof...(b))cerr << ", ";
    debug(b...);
}
int main(){
    int n;
    string s;
    cin >> n >> s;
    vector<int>dp(n + 1, 0);
    vector<int>prev(n + 1);
    for(int i = 0; i < n; i++){
        if(s[i] == '0'){
            prev[i] = i;
        }else{
            if(i == 0){
                prev[i] = -1;
            }else{
                prev[i] = prev[i-1];
            }
        }
    }
    for(int i = 0; i < n; i++){
        dp[i+1] = max(dp[i+1], dp[i]);
        if(s[i] == '0'){
            continue;
        }
        if(i - 2 >= 0 and s[i-1] == '0' and s[i-2] == '1'){
            int k = prev[i-2];
            dp[i+1] = max(dp[i+1], dp[k + 1] + i - k - 2);
            dp[i+1] = max(dp[i+1], dp[k + 2] + i - k - 3);
        }
        if(i - 1 >= 0 and s[i-1] == '1'){
            int k = prev[i-1];
            if(k - 1 >= 0 and s[k-1] == '1'){
                dp[i+1] = max(dp[i+1], dp[k-1] + i - k);
            }
        }
    }
    cout << dp[n] << endl;
}


Measured memory_bytes: 4740
//****author RKN
//DATE 5/2/2020 5.15 AM
 
 
// ***************DREAM IS NOT THAT YOU SEE WHILE SLEEPING BUT IT IS WHAT DONT LET YOU SLEEP************//
 
 
///////////////////////    machayenge......sala hoga apne se bhi ek din    ///////////////////////////////////////////////////////////

#include<bits/stdc++.h>
using namespace std;
 
/////////////////////////////   %   variable  %   //////////////////////////////////////////////////////////////
 
#define ll long long
#define pb push_back 
#define f1 first
#define s2 second
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pr pair<ll,ll>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
int dir1[8]={1,0,0,-1,-1,1,-1,1};
int dir2[8]={0,-1,1,0,-1,1,1,-1};
#define en "\n"

ll MAX=1e9+7;

////////////////////////////////////////////////////////////////////////////////////////////
int n;
int ans[100001][3];
int arr[100001][3];
ll go(int j,int lev)
{
    if(lev>=n)
    return 0;
    if(lev==n-1){
    ans[lev][j]=arr[lev][j];
    return ans[lev][j];
    }
    if(ans[lev][j])
    {
    return ans[lev][j];
    }
    ll val=0;
    for(int i=0;i<3;i++)
    {
        if(i!=j)
        val=max(val,go(i,lev+1));
    }
    ans[lev][j]=(val+arr[lev][j]);
    return ans[lev][j];
}

int main()
{
 fast;
 int a,b,c;
 cin>>n;
 for(int i=0;i<n;i++)
 {
     cin>>a>>b>>c;
     arr[i][0]=a;
     arr[i][1]=b;
     arr[i][2]=c;
 }
 ll ans=max({go(0,0),go(1,0),go(2,0)});
 cout<<ans;
    return 0;
}


Measured memory_bytes: 8832
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (int)(n); i++)
#define int long long
#define ll long long
using namespace std;
int a[10];
signed main(){
    rep(i,5){
        cin>>a[i];
        if (a[i]==0)
        {
            cout<<i+1<<endl;
            return 0;
        }
        
    }
}

Measured memory_bytes: 3632
#include<cstdio>
int main(){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    for(int i=0;i<b;i++){
        if(i*a%b==c){
            printf("YES");
            return 0;
        }
    }
    printf("NO");
    return 0;
}

Measured memory_bytes: 128
import sys

sys.setrecursionlimit(10**6)

input = sys.stdin.readline

n = int(input())

es = [[] for _ in range(n + 1)]
for _ in range(n - 1):
    a, b, c = map(int, input().split())
    es[a].append((b, c))
    es[b].append((a, c))
ds = [0] * (n + 1)


def dfs(cur, prev, c):
    ds[cur] = ds[prev] + c
    for e, c in es[cur]:
        if e != prev:
            dfs(e, cur, c)


q, k = map(int, input().split())

dfs(k, k, 0)
for _ in range(q):
    x, y = map(int, input().split())
    print(ds[x] + ds[y])

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

int main(void){
  long long trans, min, n, group;
  cin >> n;
  cin >> min;
  for(int i = 1; i < 5; i++){
    cin >> trans;
    if(min > trans)
      min = trans;
  }
  if(n <= min)
    cout << 5 << endl;
  else{
    group = n/min;
  	if(n%min != 0)
    	group += 1;
  	cout << group+4 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)

n = int(input())
abc = [[int(item) for item in input().split()] for _ in range(n-1)]
q, k = [int(item) for item in input().split()]
xy = [[int(item) for item in input().split()] for _ in range(q)]

distance = [0] * n
e = [[] for _ in range(n)]
w = [[] for _ in range(n)]
for a, b, c in abc:
    e[a-1].append(b-1)
    e[b-1].append(a-1)
    w[a-1].append(c)
    w[b-1].append(c)

def dfs(v, par, dist):
    distance[v] = dist
    if len(e[v]) == 0:
        return True
    for i in range(len(e[v])):
        if e[v][i] == par:
            continue
        dfs(e[v][i], v, dist + w[v][i])

dfs(k-1, -1, 0)
for x, y in xy:
    print(distance[x-1] + distance[y-1])

Measured memory_bytes: 166292
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
    return os << "(" << P.first << "," << P.second << ")";}

// #define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
typedef long long ll;
typedef double ld;
#define pll pair<ll,ll>
#define pii pair<int, int>
#define pb push_back
#define mp(x, y) make_pair((x), (y))
#define F first
#define S second
#define I insert
#define vi vector<int>
#define vll vector<ll>
#define vpll vector<pll>
#define all(x) (x).begin(), (x).end()
#define sz(x) (ll)(x).size()
   
const ll Mod = 1e9 + 7;
const int N  = 1e5 + 7;
int Table[N];
void upt(int i , int val){
    while(i < N){
        Table[i] += val;
        i += i&-i;
    }
}
int query(int i){
    int sum = 0;
    while(i){
        sum += Table[i];
        i -= i&-i;
    }
    return sum;
}
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
    int n , d;
    cin >> n;
    for(int i = 0 ;i < n ; i++){
        cin >> d;
        upt(d , 1);
    }
    int cnt = 0;
    for(int i = 0 ;i < N ; i++){
        if(query(i) == n/2)
            cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i,a,b) for(int(i)=(a);(i)<(b);++(i))
#define RREP(i,a,b) for(int(i)=(a)-1;(i)>=(b);--(i))
#define ALL(x) (x).begin(),(x).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
using namespace std;
typedef long long ll;

int P,Q,R;

int main()
{
  cin >> P >> Q >> R;
  cout << min({P+Q,Q+R,R+P}) << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int igame;
    int ifri;
    cin >> ifri;
    cin >> igame;
    int itarg[igame];
    int iinp[igame][ifri];
    for(int i = 0;i < igame;i++){
        cin >> itarg[i];
    }
    for(int i = 0;i < igame;i++){
        for(int j = 0;j < ifri;j++){
            cin >> iinp[i][j];
        }
    }
    int ipoi[ifri] = {0};
    for(int i = 0;i < igame;i++){
        int itarp = 0;
        for(int j = 0;j < ifri;j++){
            if(iinp[i][j] == itarg[i]){
                ipoi[j]++;
            }
            else{
                itarp++;
            }
        }
        ipoi[itarg[i]-1]+=itarp;
    }
    for(int i = 0;i < ifri;i++){
        cout << ipoi[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3104
#include <iostream>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <math.h>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

#define big ((ll)(1e9) + 7)

ll max(ll a, ll b)
{
  if (a > b)
  {
    return a;
  }
  return b;
}

int main()
{
  ll a,b,c;
  cin >> a >> b >> c;
  ll pow = c-a-b;
  if(4*a*b < pow*pow && pow > 0 )
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	double a, b, c, d, e, f, tmp, s, t;
	
	while((cin >> a >> b >> c >> d >> e >> f)){
		tmp = (a*e-b*d);
		s = ((e*c-b*f)/tmp);
		t = ((a*f-d*c)/tmp);
		
		if(s == -0.0){
			s = 0.0;
		}
		if(t == -0.0){
			t = 0.0;
		}
		printf("%.3f %.3f\n", s, t);
	}
	
	return 0;
}

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

long long N, D;
long long X[1 << 18], Y[1 << 18];

int main(){
    cin >> N >> D;
    long long counter =0;
    long double distance[1<<18];
    for (int i = 1; i <= N; i++){
        cin >> X[i] >> Y[i];
        distance[i] = sqrt(X[i]*X[i] + Y[i]*Y[i]);
        if(distance[i] <=D){
            counter++;
        }

    }
    cout << counter << endl;
    
    return 0;
}

Measured memory_bytes: 6804
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx2,tune=native")
//#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("trapv")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vi>;
using pi = pair<ll, ll>;
const ll mod = 1e9 + 7;
int n;
ll l, x[200200], pref[200200], ans = 0;
void solve() {
	for(int i = 1; i <= n; i++) pref[i] = pref[i-1]+x[i];
	for(int i = 1; i <= n; i++) {
		ll k = min(i-1, n-i);
		ll t = x[i];
		t += (pref[i-1]-pref[i-1-k])<<1;
		if(i+k < n) k++;
		t += (l*k - pref[i+k]+pref[i])<<1;
		ans = max(ans, t);
	}
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> l >> n;
	for(int i = 1; i <= n; i++) cin >> x[i];
	solve();
	reverse(x+1, x+n+1);
	for(int i = 1; i <= n; i++) x[i] = l-x[i];
	solve();
	cout << ans;
}


Measured memory_bytes: 3456
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <math.h>
#include <list>
#include <stack>
#include <queue>
#include <utility>
#include<bitset>


using namespace std;

#define ll long long
#define ld long double
#define MOD 1000000007
#define rep(i, n) for(int i = 0;i < n;i++)
#define PI 3.14159265358979323846

int main()
{
    int n;
    cin >> n;
    vector<vector<int> > vc(n);

    ll num = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> num;
        bitset<63> temp(num);
        vector<int> array(63);
        for (int j = 0; j < 63; j++)
        {
            array[j] = int(temp[j]);
        }
        vc[i] = array;
    }

    ll ans = 0;
    for (int i = 0; i < 63; i++)
    {
        ll count = 0;
        for (ll j = 0; j < n; j++)
        {
            if (vc[j][i] == 1)
            {
                count++;
            }       
        }
        //cout << count << endl;
        //num = 1 << i;
        num = pow(2,i);
        num =num%MOD;
        ll num2;
        num2 = count*(n-count)%MOD;
        ans+=(num2*num)%MOD;
        ans = ans%MOD;
    }
    ans = ans%MOD;
    cout << ans << endl;
    
}

Measured memory_bytes: 86912
#include <iostream>

using namespace std;

int main()
{
    int a,b,n,d,r=0,c=0;
    cin>>a>>b;
    for(int i=a; i<=b; i++)
    {
        n=i;
        r=0;
        while(n!=0)
        {
            d=n%10;
            r=r*10+d;
            n/=10;
        }
        if(r==i)
            c++;
    }
    cout<<c;
    return 0;
}


Measured memory_bytes: 256
let input = require('fs').readFileSync('/dev/stdin', 'utf8');
let d = (input.trim()).split("\n");

while(1){
   let t = d.shift() - 0;
   if (t == 0) break;
   
   let n = d.shift() - 0;
   let sum = 0;
   for(i = 0;i < n;++i){
      var arr = (d.shift()).split(" ").map(Number);
      sum += arr[1] - arr[0];
   }
   ans = t <= sum ? "OK" : t - sum;
   console.log(ans);
}


Measured memory_bytes: 17148
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int H[] = new int[N];
		int H2[] = new int[N];
		int a = 0;
		int b = 0;
		int cnt = 0;

		for(int i=0; i<N; i++){
			H[i] = sc.nextInt();
		}

		for(int i=0; i<M; i++) {
			a = sc.nextInt() -1 ;
			b = sc.nextInt() -1 ;
			if (H[a] < H[b]) {
				H2[b] = H2[b]+1;
				H2[a] = -10000;
			}else if(H[a] > H[b]) {
				H2[a] = H2[a]+1;
				H2[b] = -10000;
			}else if(H[a] == H[b]) {
				H2[a] = -10000;
				H2[b] = -10000;
			}
		}

		for(int i=0; i<N; i++) {
			if(H2[i] >= 0 ) {
				cnt += 1;
			}
		}
		System.out.println(cnt);
		sc.close();
	}
}

//char S_array[] = new char[100];

//for(int i=0; i<N; i++) {
//	S_array[i]=S.charAt(i);
//}


//num.substring(0);


Measured memory_bytes: 59896
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>

using namespace std;

#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define P pair<int, int>

typedef vector<int> vec;
typedef vector<vec> mat;

int main(){
    string s;
    cin >> s;
    int ans = 0;
    int now = 0;
    rep(i, 3){
        if(s[i] == 'R'){
            now++;
        }else if(s[i] == 'S'){
            now = 0;
        }
        ans = max(now, ans);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3604
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum mod = 10L ^^ 9 + 7;

void main() {
    int n; long k;
    scan(n, k);
    auto a = iota(n).map!(i => readln.split.to!(long[])).array;
    auto e = iota(n).map!(i => iota(n).map!(j => i == j ? 1L : 0L).array).array;

    debug {
        writefln("%(%s\n%)", e);
    }

    long[][] mul(long[][] a, long[][] b) {
        auto c = new long[][](n, n);
        foreach (i ; 0 .. n) {
            foreach (j ; 0 .. n) {
                foreach (k ; 0 .. n) {
                    c[i][j] += a[i][k] * b[k][j] % mod;
                    c[i][j] %= mod;
                }
            }
        }
        return c;
    }

    long[][] sqm(long[][] a) {
        return mul(a, a);
    }

    long[][] powm(long k) {
        return k > 0 ? mul(sqm(powm(k>>1)), k & 1 ? a : e) : e;
    }

    auto t = powm(k);

    long ans;

    foreach (i ; 0 .. n) {
        foreach (j ; 0 .. n) {
            ans += t[i][j];
            ans %= mod;
        }
    }

    writeln(ans);
}







void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define req(i,n) for(int i = 1;i <=n;i++)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

//最大公約数
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 /gcd(a,b) * b;
}

//素数判定
bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}

// 素因数分解
vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

// 10進数から2進数
int binary(int bina){
    int ans = 0;
    for (int i = 0; bina>0 ; i++)
    {
        ans = ans+(bina%2)*pow(10,i);
        bina = bina/2;
    }
    return ans;
}









int main() {
  int a,b;
  cin >> a >> b;
  if (a == 1 && b == 2) cout << 3 << endl;
  if (a == 1 && b == 3) cout << 2 << endl;
  if (a == 2 && b == 1) cout << 3 << endl;
  if (a == 2 && b == 3) cout << 1 << endl;
  if (a == 3 && b == 1) cout << 2 << endl;
  if (a == 3 && b == 2) cout << 1 << endl;
}


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

int main() {
    string S,T;
    cin >> S>> T;
    int count =0;
    for (int i=0; i<3; i++){
        if(S.at(i) == T.at(i)) count++;   
    }
    cout << count <<endl;
}

Measured memory_bytes: 256