akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define F(i,s,e) for(int i=s;i<e;++i)

int counter(int bits,int n){
    int ans=0;
    F(i,0,n){
        if(bits & 1) ans++;
        bits/=2;
    }
    return ans;
}

int main()
{
    int n;
    cin >> n;
    const int N=20;
    int a[N];
    int x[N][N],y[N][N];
    F(i,0,n){
        cin >> a[i];
        F(j,0,a[i]){
            cin >> x[i][j] >> y[i][j];
        }
    }
    int ans=0;
    for(int bits=1;bits<(1<<n);++bits){
        bool b=true;
        F(i,0,n){
            if(bits & (1 << i)){
                F(j,0,a[i]){
                    if(((bits >> (x[i][j]-1)) & 1) ^ y[i][j])
                        b=false;
                }
            }
        }
        if(b) ans = max(ans,counter(bits,n));
    }
    cout << ans << endl;
    return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	ll n, m;
	cin >> n >> m;

	if(n > m) swap(n, m);

	if(n == 1){
		if(m == 1){
			cout << 1 << endl;
			return 0;
		}else{
			cout << (m - 2) << endl;
			return 0;
		}
	}

	if(n == 2){
		cout << 0 << endl;
		return 0;
	}

	cout << ((n - 2) * (m - 2)) << endl;
}

Measured memory_bytes: 256
S=str(input())
point = 0
N=len(S)
if N%2==0:
  A=[0,1]*(N//2)
else:
  A=[0,1]*(N//2)+[0]

T=[]
for i in range(N):
  if S[i]=='g':
    T +=[0]
  else:
    T +=[1]

count=0
for i in range(N):
  count +=A[i]-T[i]
print(count)


Measured memory_bytes: 4724
a = list(map(str,input().split()))
stack = []

for x in a:
    if x == '+':
        stack.append(int(stack.pop()) + int(stack.pop()))
    elif x == '-':
        stack.append(-int(stack.pop()) + int(stack.pop()))
    elif x == '*':
         stack.append(int(stack.pop()) * int(stack.pop()))
    else:
        stack.append(x)
print(int(stack.pop()))


Measured memory_bytes: 5596
#define ALL(obj) (obj).begin(), (obj).end()
 
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
 
using namespace std;
typedef long long ll;
const ll INF = 1e18;
 
string S,T,U;
ll A, B;
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> S;
    
    if (S[0] == 'A' && S[1] == 'A' && S[2] == 'A') {
        cout << "No" << endl;
    } else if (S[0] == 'B' && S[1] == 'B' && S[2] == 'B') {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
    
    return 0;
}


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

struct edge {
  int to, l;
  bool operator<(const edge &r) const { return l < r.l; }
};

int n, k;
vector<long long> s;
vector<int> p, h;
vector<vector<edge>> edges;

long long solve();
void dfs(const int &now, vector<long long> &res);
void knap(const int &now, const int &lim,
          vector<long long> &res);

int main() {
  while(1) {
    cin >> n >> k;
    if(n + k == 0) break;
    h.resize(n);
    s.resize(n);
    p.resize(n - 1);
    edges.clear();
    edges.resize(n);
    for(int i = 0; i < n; ++i) cin >> h[i];
    for(int i = 0; i < n; ++i) cin >> s[i];
    for(int i = 0; i < n - 1; ++i) cin >> p[i];
    for(int i = 0; i < n - 1; ++i) {
      int x;
      cin >> x;
      edges[--p[i]].push_back({i + 1, x});
    }
    cout << solve() << endl;
  }
  return 0;
}

long long solve() {
  for(int i = 0; i < n; ++i)
    sort(edges[i].begin(), edges[i].end());
  vector<long long> resd(k + 1, 0);
  dfs(0, resd);
  long long res = 0;
  for(int i = 0; i <= k; ++i) res = max(res, resd[i]);
  return res;
}

void dfs(const int &now, vector<long long> &res) {
  vector<long long> tmp;
  tmp = res;
  int bf = 0;
  for(auto e : edges[now]) {
    dfs(e.to, tmp);
    knap(now, e.l - bf, res);
    bf = e.l;
    for(int i = e.l; i <= k; ++i)
      res[i] = max(res[i], tmp[i - e.l] + e.l * s[now]);
  }
  knap(now, h[now] - bf, res);
}

void knap(const int &now, const int &lim,
          vector<long long> &res) {
  vector<long long> deqv(k + 1, 0);
  vector<int> deq(k + 1, 0);
  int x = 0, y = 0;
  for(int i = 0; i <= k; ++i) {
    if(res[i] >= 0) {
      long long val = res[i] - i * s[now];
      while(x < y && val > deqv[y - 1]) --y;
      deq[y] = i;
      deqv[y++] = val;
    }
    if(x < y) {
      res[i] = deqv[x] + i * s[now];
      if(deq[x] == i - lim) ++x;
    }
  }
}


Measured memory_bytes: 82812
def count(n, x):
    b1 = 1<<n
    b2 = b1<<1
    return 1 if n == 0 else \
           0 if x == 1 else \
           count(n-1, x-1) if x <b2-1 else \
           b1 if x == b2-1 else \
           count(n-1, x+1-b2)+b1 \

N, X = map(int, input().split())
print(count(N, X))


Measured memory_bytes: 3060
import sys
input = sys.stdin.readline
from itertools import permutations

def main():
    N = int(input())
    p = tuple(map(int,input().split()))
    q = tuple(map(int,input().split()))
    p_i = 0
    q_i = 0
    perm = list(permutations(list(range(1,N+1))))
    for i in range(len(perm)):
        if perm[i] == p:
            p_i = i
        if perm[i] == q:
            q_i = i
    print(abs(p_i-q_i))
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 8052
n,k=map(int,input().split())
A=list(map(int,input().split()))
A.sort()

mod=10**9+7

if A[-1]<0 and k%2==1:
    now=1
    for i in range(k):
        now= now*A[-i-1]%mod
        # now%=mod
    print(now) ;exit()

l=0 ; r=n-1
ans=1
if k%2==1:
    ans=A[-1]
    r-=1

for i in range(k//2):
    mi=A[l]*A[l+1]
    pl=A[r]*A[r-1]
    if mi>pl:
        ans= ans*mi%mod
        l+=2
    else:
        ans= ans*pl%mod
        r-=2
print(ans%mod)


Measured memory_bytes: 31760
#include <bits/stdc++.h>
	
using namespace std;
 
#define len(x) int(x.size())
#define all(x) x.begin(), x.end()

typedef long long ll;
typedef pair <int, int> pii;

const int N = 2e5 + 10;

int a[N];
bool was[N];

int main(){
	#ifdef HOME
	freopen("input.txt", "rt", stdin);
	#endif //HOME
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n; 		
	for (int i = 0; i < n; i++)
		cin >> a[i];
	if (n == 2){
		if (a[0] <= a[1])
			cout << "Yes";
		else
		if (a[0] - a[1] == 1)
			cout << "Yes";
		else
			cout << "No";
		return 0;
	}	
	int id = -1;
	for (int i = 0; i < n - 1; i++){
		if (a[i] > a[i + 1]){
			if (a[i] - a[i + 1] > 1){
				cout << "No";
				return 0;
			}			
			int l = i;
			while(l - 1 >= 0 && a[l - 1] == a[l]){				
				if (was[l - 1] == true) {
					cout << "No";
					return 0;
				}
				l--;
			}
			for (int j = l; j <= i; j++){
				a[j]--;
				was[j] = true;
			}
			id = -1;
		}
		else
			if (id == -1)
				id = i;
	}	

	for (int i = 0; i < n - 1; i++){
		if (a[i] > a[i + 1]){
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,d;
int main()
{ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
    cin>>n>>d;
    int ans=0;
    for(int i=1;i<=n;i++){
        ll x,y;cin>>x>>y;
        if(x*x+y*y<=d*d)ans++;
    }
    cout<<ans<<'\n';
    return 0;
}


Measured memory_bytes: 3652
/*input
6
AC
TLE
AC
AC
WA
TLE
*/
#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 2;

map<string, int> cnt;

string tt[] = {"AC", "WA", "TLE", "RE"};

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

  int n; cin >> n;
  while (n--) {
    string s; cin >> s;
    cnt[s]++;
  }

  for (auto t : tt) {
    cout << t << " x " << cnt[t] << '\n';
  }

  return 0;
}

Measured memory_bytes: 3648
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>

using namespace std;

const int nmax = 1e9 + 7;
const long long INF = 1e18;
const double PI = 2 * asin(1);
typedef long long ll;

int main(){

  int N; cin >> N;
  vector <ll> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];

  ll ans = A[0] - 1, now = 2;
  for (int i = 1; i < N; i++){
    if (A[i] == now){
      now++;
    }else{
      ans += (A[i] - 1) / now;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
def main():
    import sys
    N=int(sys.stdin.readline())
    count=0
    for i in range(N):
        D1,D2=list(map(int,sys.stdin.readline().split()))
        if D1==D2:
            count+=1
        else:
            count=0
        if count==3:
            print('Yes')
            break
    else:
        print('No')

main()

Measured memory_bytes: 9168
import math
N, A, B = [int(i) for i in input().split()]
if A == 0 and B == 0:
    print(0)
else:
    count = A + B
    setCount = math.floor(N / count)
    amari = N - setCount * count
    if amari > 0:
        if A > amari:
            result = setCount * A + amari
        else:
            result = setCount * A + A
    else:
        result = setCount * A
    print(result)


Measured memory_bytes: 3060
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const ll mod=1000000007;



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

   
    char c;
    cin>>c;
    if(c>='a' && c<='z')
    cout<<"a";
    else
    cout<<"A";
    
    


    

    return 0;
}


Measured memory_bytes: 3648
N = gets.to_i
nums = gets.split.map(&:to_i)
hash = Hash.new{|hash, key| hash[key] = 0}
nums.each do |i|
  hash[i] += 1
end
result = nums.sum

Q = gets.to_i
Q.times{
  b, c = gets.split.map(&:to_i)
  hash[c] += hash[b]
  b_num = hash[b]
  hash.delete(b)
  result -= b*b_num
  result += c*b_num
  puts result
}

Measured memory_bytes: 25656
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>

#define REP(i,x) for(int i=0 ; i<(int)(x) ; i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long

using namespace std;

int N;
vector<int> from;
vector<vector<int> > to;

int get_not_exist_min(const vector<int> &vec, const vector<int> &A, bool second=false){
    int n = vec.size();
    vector<int> children(n);
    REP(i, vec.size()){
        int v = vec[i];
        if(A[v]<0 || A[v]>=n)continue;
        children[A[v]] = 1;
    }
    int res = 0;
    while(res<n && children[res])res++;
    if(second){
        res++;
        while(res<n && children[res])res++;
    }
    return res;
}

void bfs(queue<int> que, vector<int> &visit, vector<int> &res){
    while(!que.empty()){
        int u = que.front();que.pop();
        res[u] = get_not_exist_min(to[u], res);
        int v = from[u];
        visit[v]++;
        if(visit[v]!=(int)to[v].size())continue;
        que.push(v);
    }
}

bool check(queue<int> que, vector<int> visit, vector<int> res){
    bfs(que, visit, res);
    bool ok = true;
    REP(u, N){
        vector<int> cnt(res[u]);
        REP(i, to[u].size()){
            int v = to[u][i];
            if(res[v]==res[u])ok = false;
            if(res[v]<res[u])cnt[res[v]]++;
        }
        REP(i, cnt.size()){
            if(cnt[i]==0)ok = false;
        }
    }
    return ok;
}

int main(){
    cin >> N;
    from.resize(N);
    to.assign(N, vector<int>());

    REP(i, N){
        int p;
        cin >> p;
        p--;
        from[i] = p;
        to[p].push_back(i);
    }
    vector<int> res(N, -1);
    queue<int> que;
    REP(i, N)if((int)to[i].size()==0)que.push(i);
    vector<int> visit(N);
    bfs(que, visit, res);

    bool ok = false;
    REP(i, N){
        if(res[i]==-1){
            queue<int> que;
            que.push(from[i]);
            int first = get_not_exist_min(to[i], res, false);
            int second = get_not_exist_min(to[i], res, true);
            res[i] = first;
            visit[i]++;
            if(check(que, visit, res))ok = true;
            res[i] = second;
            if(check(que, visit, res))ok = true;
            break;
        }
    }

    cout << (ok ? "POSSIBLE" : "IMPOSSIBLE") << endl;
    return 0;
}


Measured memory_bytes: 14208
import java.io.*;
import java.math.*;
import java.util.*;
public class Main { 
 
	public static void main(String[] args) { 
		Scanner input = new Scanner(System.in);
		long mod = (long)(1e9+7);
		int N = input.nextInt();
		long K = input.nextLong();
		long ans = 0;
		long choose2Right = K*(K+1)/2; //Sum of first N numbers is N*(N+1)/2;
		//For K concatenations, sum of 1 through K pairs exist
		K--;
		long choose2Left = K*(K+1)/2;
		choose2Right%=mod;
		choose2Left%=mod;
		int[] arr = new int[N];
		for (int i = 0; i < N; i++) {
			arr[i] = input.nextInt();
		}
		for (int cur = 0; cur < N; cur++) {
			int curNum = arr[cur];
			long left = 0;
			long right = 0;
			for (int L = 0; L < cur; L++) {
				if (curNum>arr[L]) left++;
			}
			for (int R = cur+1; R < N; R++) {
				if (curNum>arr[R]) right++;
			}
			long curAns = right*choose2Right;
			curAns%=mod;
			curAns+=left*choose2Left;
			curAns%=mod;
			ans+=curAns;
			ans%=mod;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 25092
#include<stdio.h>

int dp[50];
/*フィボナッチ関数*/
int fib(int n){
  if(n==0||n==1)
    return dp[n]=1;
  if(dp[n]!=-1)return dp[n];
  return dp[n]=fib(n-1)+fib(n-2);
}

int main(){
  int n,i;

  for(i=0;i<50;i++)
    dp[i]=-1;

  scanf("%d",&n);
  printf("%d\n",fib(n));

  return 0;
}



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

const int maxn = 1e5 + 10;

int x[maxn],y[maxn],vis[maxn],n;
map<pair<int,int>,int>mp;
vector<int>g[maxn];

int bfs()
{
	int ans = 0;
	queue<pair<int,int>>q;
	q.push({1,0});
	while(!q.empty()){
		int u = q.front().first, num = q.front().second;
		q.pop();
		if(vis[u]) continue;
		vis[u] = 1;
		int cnt = 1;
		for(int i = 0; i < (int)g[u].size(); ++i){
			int v = g[u][i];
			if(vis[v]) continue;
			if(cnt == num) cnt++;
			mp[{u,v}] = cnt;
			mp[{v,u}] = cnt;
			q.push({v,cnt++});
		}
		ans = max(ans,cnt - 1);
		//cout << ans << endl;
	}
	return ans;
}

int main()
{
	
	std::ios::sync_with_stdio(false);cin.tie(0);
	cin >> n;
	for(int i = 0; i < n - 1; ++i){
		cin >> x[i] >> y[i];
		g[x[i]].push_back(y[i]);
		g[y[i]].push_back(x[i]);
	}
	cout << bfs() << endl;
	for(int i = 0; i < n - 1; ++i) cout << mp[{x[i],y[i]}] << endl;
	return 0;
}

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

#define MAX_N 20
#define MAX_M 20

int main() {
  int n, m, c;
  int a[MAX_N][MAX_M], b[MAX_M];

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

  int ans = 0;
  for(int i = 0; i < n; ++i) {
    int v = c;
    for(int j = 0; j < m; ++j) {
      v += a[i][j] * b[j];
    }

    if(v > 0) ans++;
  }

  std::cout << ans << std::endl;
}

Measured memory_bytes: 256
def five_dishes(times)
  sum = 0
  min = 10
  times.each do |t|
    n = t % 10
    if n == 0
      sum += t
    else
      min = [min, n].min
      sum += t - n + 10
    end
  end

  if min != 0
    sum -= 10 - min
  end
  sum
end

times = []
5.times{ times << gets.to_i }
puts five_dishes(times)

Measured memory_bytes: 1788
//Written by Zhu Zeqi
//Come on,baby
//Hack,please
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define CLR(x) memset(x,0,sizeof x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define MAX 1000000000000000000
#define MOD 1000000007
#define PI 3.141592653589793238462
#define INF 1000000000
typedef long long ll;
//orz yht
using namespace std;
string i_s(int x){
	if(x==0)
	return "0";
	string ret="";
	while(x){
		ret=ret+(char)(x%10+'0');
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
string add(string a,string b){
	if(a=="")
	a="0";
	if(b=="")
	b="0";
	if(a.length()<b.length())
	swap(a,b);
	while(b.length()<a.length()){
		b='0'+b;
	}
	for(int i=0;i<a.length();i++){
		a[i]=a[i]+(b[i]-'0');
	}
	bool big=false;
	for(int i=a.length()-1;i>=0;i--){
		if(big){
			a[i]++;
		}
		big=false;
		if(a[i]>'9'){
			a[i]=a[i]-10;
			big=true;
		}
	}
	if(big)
	a='1'+a;
	return a;
}
string mul(string a,string b){
	vector<int> va,vb;
	if(a=="0" || b=="0")
	return "0";
	string ans;
	for(int i=0;i<a.length();i++){
		va.push_back(a[i]-'0');
	}
	for(int i=0;i<b.length();i++){
		vb.push_back(b[i]-'0');
	}
	reverse(va.begin(),va.end());
	reverse(vb.begin(),vb.end());
	vector<int> res;
	res.clear();
	res.resize(1005);
	for(int i=0;i<a.length();i++){
		for(int j=0;j<b.length();j++){
			res[i+j]+=(va[i]*vb[j]);
		}
	}
	for(int i=0;i<1005;i++){
		if(res[i]>9){
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	for(int i=0;i<1005;i++){
		ans+=(res[i]+'0');
	}
	reverse(ans.begin(),ans.end());
	int k=0;
	while(ans[k]=='0'){
		k++;
	}
	ans=ans.substr(k);
	return ans;
}
bool is_prime(int n){
	if(n<2)
    return false;
    for(int i=2;i*i<=n;i++)
    if(n%i==0)
    return false;
    return true;
}
int n,a[200005];
ll sum,cnt;
map<ll,int> m;
int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);
	m[0]++;
	cin>>n;
	for(int i=0;i<n;i++)
	cin>>a[i];
	for(int i=0;i<n;i++){
		cnt+=a[i];
		sum+=m[cnt];
		m[cnt]++;
	}
	cout<<sum;
	//system("pause");
	return 0;
} 

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

int main(){
  int n, m; cin >> n >> m;
  vector<pair<int, int> > a(m);
  for (int i = 0; i < m; i++) cin >> a[i].second >> a[i].first;
  sort(a.begin(), a.end());
  int prev = -1; int ans = 0;
  for (int i = 0; i < m; i++) {
    if (prev < a[i].second) {
      ans++; prev = a[i].first-1;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double pi = acos(-1);
const ll SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
ll fac[200005], finv[200005], inv[200005];
vector<ll>dij;
struct edge { ll to, cost; };
vector<vector<edge> >G;

ll mod_pow(ll a, ll b) {
	ll res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}

	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) {
	for (auto &e : t) fill_v(e, v);
}

//↑template↑



int main() {
	long double a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << setprecision(20) << (long double)(a*b / 2.0) << " ";
	if (a / 2 == c && b / 2 == d) { cout << 1 << endl; }
	else { cout << 0 << endl; }
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using namespace boost::multiprecision;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPI(i,a,b) for(int i=int(a);i<int(b);++i)
#define ALL(x) (x).begin(),(x).end()
inline cpp_int between(cpp_int n, cpp_int x) {
  if(n >= 0)
    return (n/x)+1;
  else
    return 0;
}

int main () {
  int d,n,result;
  cin >> d >> n;
  result = (n != 100) ? n : 101;

  REP(i,d) {
    result *= 100;
  }

  cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

void merge(int *, int, int, int);
void mergeSort(int *, int, int);

int count = 0;

int main()
{
  int n, s[500000];
  int i;

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

  mergeSort(s, 0, n);

  for(i = 0; i < n; i++){
    printf("%d", s[i]);
    if(i != n-1) printf(" ");
    else printf("\n");
  }
  printf("%d\n", count);
  return 0;
}


void merge(int *a, int left, int mid, int right){
  int n1, n2, *l, *r;
  int i, j, k;
  n1 = mid - left + 1;
  n2 = right - mid + 1;
  l = (int *)malloc(sizeof(int) * n1);
  r = (int *)malloc(sizeof(int) * n2);
  for(i = 0; i < n1; i++){
    l[i] = a[left + i];
  }
  for(i = 0; i < n2; i++){
    r[i] = a[mid + i];
  }
  l[n1 - 1] = INFINITY;
  r[n2 - 1] = INFINITY;
  i = 0;
  j = 0;
  for(k = left; k < right; k++){
    count++;
    if(l[i] <= r[j]){
      a[k] = l[i];
      i++;
    }
    else{
      a[k] = r[j];
      j++;
    }
  }
}


void mergeSort(int *a, int left, int right){
  int mid;
  if(left + 1 < right){
    mid = (left + right) / 2;
    mergeSort(a, left, mid);
    mergeSort(a, mid, right);
    merge(a, left, mid, right);
  }
}



Measured memory_bytes: 64440
using System;
using System.Linq;

namespace _2252
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string s = Console.ReadLine();
                if (s == "#") break;
                char[] c = new char[] { 'y', 'u', 'i', 'o', 'p', 'h', 'j', 'k', 'l', 'n', 'm' };
                bool left = c.Contains(s[0]);
                int ret = 0;
                for (int i = 1; i < s.Length; i++)
                {
                    if (c.Contains(s[i]) != left) ret++;
                    left = c.Contains(s[i]);
                }
                Console.WriteLine(ret);
            }
        }
    }
}

Measured memory_bytes: 9492
n = int(input())
C = list(input())

if "R" not in C:
    print(0)
    exit()

W = C.count("W")
R = C.count("R")
w = 0
r = R
ans = float('inf')

for c in C:
    if c == "W":
        w += 1
    else:
        r -= 1
    ans = min(ans, max(w, r))
print(ans)

Measured memory_bytes: 10596
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <numeric>
#include <limits>
#include <cmath>
#include <iomanip>
#include <sstream>
 
#define ALL(a)  (a).begin(),(a).end()
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

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

    ll ans = 0;

    ll n, k;
    cin >> n >> k;

    ans = floor(log(n) / log(k)) + 1;

    

    cout << ans << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <utility>
#include <random>
#include <chrono>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
//const int mod = 1e9+7;
string s;

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}



int main()
{
    quickread();
    cin >> s;
    for(auto c: s) {
        if(c == '?') cout << 'D';
        else cout << c;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3776
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

int main() {

	int a,b,c,d,e,k;

	cin>>a;
	cin>>b;
	cin>>c;
	cin>>d;
	cin>>e;
	cin>>k;
	if(b-a<=k&&c-a<=k&&d-a<=k&&e-a<=k&&c-b<=k&&d-b<=k&&e-b<=k&&d-c<=k&&e-c<=k&&e-d<=k){
		cout<<"Yay!"<<endl;
	}else{
		cout<<":("<<endl;
	}

	return 0;

}


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

 

#define pb push_back

#define mp make_pair

#define fs first

#define sc second

#define rep(i, from, to) for (int i = from; i < (to); ++i)

#define all(x) x.begin(), x.end()

#define sz(x) (int) (x).size()

#define FOR(i, to) for (int i = 0; i < (to); ++i)

 

using namespace std;

typedef long long ll;

typedef vector<int> vi;

typedef pair<int,int> pii;

typedef pair<double,double> pdd;

typedef vector<ll> vll;

typedef vector<pair<int,int>> vpi;

typedef pair<ll,ll> pll;

typedef vector<string> vs;

#define MOD 1000000007

#define INF 1000000000LL * 100000000LL

#define Nmax 2020201


ll inv[Nmax], fact[Nmax], ifact[Nmax];
void make_fact(int N) { // N ~ 10^6
  inv[1] = fact[0] = fact[1] = ifact[0] = ifact[1] = 1;
  for(int i=2;i<=N;++i) {
    inv[i] = (MOD - (MOD/i) * inv[MOD%i] % MOD) % MOD;
    fact[i] = (fact[i-1]*i) % MOD;
    ifact[i] = (ifact[i-1]*inv[i]) % MOD;
  }
}
ll comb(ll a, ll b) { // a,b ~ 10^6
  ll ret = (fact[a] * ifact[b]) % MOD;
  return (ret * ifact[a-b]) % MOD;
}

ll X,Y,Z;
int N;
vi v;


int main() {
  make_fact(1000100);
  cin >> X >> Y;
  if((X+Y) % 3 != 0) { cout << 0; return 0;}
  int diagNum = (X+Y) / 3;
  if(X < diagNum || X > 2*diagNum + 1) { cout << 0; return 0;}
  X -= diagNum;
  //cout << X << " " << endl;
  cout << comb(diagNum, X);

}

 

Measured memory_bytes: 28928
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
const ll mod=998244353;
int main(void){
    ll n,s;cin>>n>>s;
    vector<vector<ll>> dp(n+100,vector<ll>(4000,0));
    dp[0][0]=1;
    rep(i,n){
        ll a;cin>>a;
        rep(j,s+1){
            dp[i+1][j]+=dp[i][j]*2;
            dp[i+1][j]%=mod;
            if(j+a<=s) dp[i+1][j+a]+=dp[i][j];
            dp[i+1][j+a]%=mod;
        }
        //cout<<dp[i+1][s]<<endl;
    }
    ll res=dp[n][s];
    cout<<res<<endl;
}

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

int main() {
  long N;
  cin >> N;
  long ans = 0;
  vector<long> L(N);
  for (long i = 0; i < N; i++) cin >> L.at(i);
  for (long i = 0; i < N; i++) {
    for (long j = 0; j < i; j++) {
      for (long k = 0; k < j; k++) {
        if (L.at(i) == L.at(j)) continue;
        if (L.at(j) == L.at(k)) continue;
        if (L.at(k) == L.at(i)) continue;
        long sum = L.at(i) + L.at(j) + L.at(k);
        long mx = max({L.at(i), L.at(j), L.at(k)});
        long x = sum - mx;
        if (x > mx) ans++;
      }
    }
  }
  cout << ans << "\n";
}

Measured memory_bytes: 3628
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

const int N = 100005;
LL cost_x[N], cost_y[N];

int main() {
	int wh[2];
	REP(i, 2)scanf("%d", &wh[i]);
	vector<pair<LL, LL>> cost_xy(wh[0] + wh[1]);
	int idx = 0;
	REP(i, 2) {
		REP(j, wh[i]) {
			int x;
			scanf("%d", &x);
			cost_xy[idx++] = MP(x, i);
		}
	}
	SORT(cost_xy);
	int cnt[2] = { 0, };
	LL ret = 0;
	REP(i, wh[0] + wh[1]) {
		LL cost = cost_xy[i].first;
		int d = cost_xy[i].second;
		ret += (wh[1 - d] + 1 - cnt[1 - d])*cost;
		cnt[d]++;
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 3328
n=int(input())
A=[[0 for i in range(9)] for i in range(9)]
for i in range(1,n+1):
  q=int(str(i)[0])
  w=i%10 
  if w==0 : continue
  A[q-1][w-1]+=1
ans=0
for i in range(9):
  for j in range(9):
    ans+=A[i][j]*A[j][i]
print(ans)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;

int main()
{
	int n, k;
	cin >> n >> k;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int h;
		cin >> h;
		if (h >= k) {
			ans++;
		}
	}
	
	cout << ans << endl;
}


Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int[] dx = new int[] { 0, 0, 1, -1 };
    static int[] dy = new int[] { 1, -1, 0, 0 };

    static void Solve()
    {
        var s = new string[3];

        for (int i = 0; i < 3; i++)
            s[i] = sc.Str();
        
        for (int i = 0; i < 3; i++)
            pr.Write(s[i][i]);
        
        pr.WriteLine();
    }

    static int[,] Mul(int[,] a, int[,] b)
    {
        var ret = new int[a.GetLength(0), b.GetLength(1)];
        for (int i = 0; i < a.GetLength(0); i++)
            for (int j = 0; j < b.GetLength(1); j++)
                for (int k = 0; k < a.GetLength(1); k++)
                    ret[i, j] += a[i, k] * b[k, j];

        return ret;
    }

    static int[,] Pow(int[,] a, int n)
    {
        var b = new int[a.GetLength(1), a.GetLength(0)];

        var f = n % 2 == 1;

        for (int i = 0; i < a.GetLength(0); i++)
            b[i, i] = 1;

        while (n > 0)
        {
            if (n % 2 == 1)
                b = Mul(a, b);


            n >>= 1;
        }

        return b;
    }

    class Coord
    {
        public int x;
        public int y;
    }

    static void Main(string[] args)
    {
        // pr.AutoFlush = true;
        Solve();
        pr.Flush();
        // Console.ReadKey();
    }

    static Scanner sc = new Scanner();
    static Printer pr = new Printer();
}

#region IO
class Scanner
{
    private int _i = 0;
    private string[] line = new string[0];

    private T[] Enumerate<T>(int n, Func<T> f)
    {
        T[] ret = new T[n];
        for (int i = 0; i < n; i++)
            ret[i] = f();
        return ret;
    }

    public string Str()
    {
        if (line.Length <= _i)
        {
            line = Console.ReadLine().Split(' ');
            _i = 0;
        }

        return line[_i++];
    }

    public int Int() => int.Parse(Str());
    public long Long() => long.Parse(Str());
    public double Double() => double.Parse(Str());
    public int[] Int(int n) => Enumerate(n, Int);
    public long[] Long(int n) => Enumerate(n, Long);
    public double[] Double(int n) => Enumerate(n, Double);
    public string[] Str(int n) => Enumerate(n, Str);
}

class Printer : StreamWriter
{
    public Printer() : base(Console.OpenStandardOutput())
    {
        AutoFlush = false;
    }
}
#endregion

Measured memory_bytes: 11092
#include <iostream>
#include<bits/stdc++.h>
#define ll long long
#define   ull unsigned long long 
#define pb push_back
const int MAX=2e5+9;
const long long mod=1e9+7;
using namespace std;
vector<int>adj[MAX];
ll dp[MAX][10][13];
int main(){
	int n ;
	int k;
	cin>>n>>k;
	cout<<max(n*k , max(n-k , n+k));
}

Measured memory_bytes: 5376
#include <iostream>
#include <cstdio>
#include<string>
#include<cstring>
#include <algorithm>
#include <cmath>
#include <map>

#define N 100005

using namespace std;

int vis[N],a[N];
void sushu() {
	for(int i=2; i<=10005; i++) {
		if(!vis[i]) {
			for(int j=i*2; j<=N; j+=i)
				vis[j]=1;
		}
	}
}

int main() {
	memset(vis,0,sizeof(vis));
	sushu();
	vis[1]=1;
	int sum=0,n;
	for(int i=1; i<=N; i++) {
		if(i%2==1) {
			if(vis[i]==0&&vis[(i+1)/2]==0)
				sum++;
		}
		a[i]=sum;
	}
	scanf("%d",&n);

	while(n--) {
		int c,b;
		scanf("%d%d",&c,&b);
		printf("%d\n",a[b]-a[c-1]);
	}

}

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

// dump macro{{{
// http://www.creativ.xyz/dump-cpp-652
#define DUMPOUT cerr // 変数ダンプ先。coutかcerr

#ifdef PCM
// 引数はいくつでもどんな型でも可（ストリーム出力演算子があればOK）
#define dump(...) DUMPOUT<<"  "; \
  DUMPOUT<<#__VA_ARGS__; \
  DUMPOUT<<":=> "; \
  dump_func(__VA_ARGS__); DUMPOUT<<"in ["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl;
#define dump_1d(x,n) DUMPOUT <<"  " \
  <<#x<<"["<<#n<<"]"<<":=> {"; \
  rep(i,n){ DUMPOUT << x[i] << (((i)==(n-1))?"}":", "); } DUMPOUT <<" in [" << __LINE__ << "]" << endl;

#define dump_2d(x,n,m) DUMPOUT <<"  " \
    <<#x<<"["<<#n<<"]"<<"["<<#m<<"]"<<":=> \n"; \
    rep(i,n)rep(j,m){ DUMPOUT << ((j==0)?"     |":" ") << x[i][j] << (((j)==(m-1))?"|\n":" "); } \
    DUMPOUT <<"  in [" << __LINE__ << "]" << endl;
#else
#define dump(...) 42
#define dump_1d(...) 42
#define dump_2d(...) 42
#endif

// デバッグ用変数ダンプ関数
void dump_func() {
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&&... tail)
{
    DUMPOUT << head;
    if (sizeof...(Tail) == 0) {
        DUMPOUT << " ";
    }
    else {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}

// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
    os << "{";
    for (int i = 0; i<vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}/*}}}*/

#define rep(i, x) for(int i = 0; i < (int)(x); i++)/*{{{*/
#define reps(i,x) for(int i = 1; i <= (int)(x); i++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define RFOR(i, m, n) for(int i = m;i >= n;i--)
#define foreach(x,a) for(auto& (x) : (a) )
#define all(x) (x).begin(),(x).end()
#define sum(v) accumulate(all(v), 0)
#define sz(x) ((int)(x).size())
#define fill(x,y) memset(x,y,sizeof(x))
#define pb(a) push_back(a)
#define INF 2147483647
#define INFLL 1000000000000000000LL
#define MOD 1000000007/*}}}*/

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;/*{{{*/
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<vii> vvii;
typedef tuple<int,int,int> iii;
typedef set<int> si;
typedef complex<double> pnt;
typedef vector<pnt> vpnt;
typedef priority_queue<pii,vii,greater<pii> > spq;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

/*}}}*/

// global variables

map<int, int> cnt;

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

  rep(i,n){
    int t;cin>>t;
    cnt[t] += 1;
  }

  int res = 0;
  for (auto x:cnt){
    if (x.first == x.second){
      res += 0;
    }
    else if (x.first < x.second){
      res += x.second - x.first;
    }
    else if (x.first > x.second){
      res += x.second;
    }
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 4736
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
  int cnt=0;
  string w,s;cin>>w;
  while(cin>>s,s!="END_OF_TEXT"){
  	string s1,w1;
  	for(int i=0;i<s.size();++i) s1+=tolower(s[i]);
  	for(int i=0;i<w.size();++i) w1+=tolower(w[i]);
  	if(s1==w1)++cnt;
  }
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
#define  st first
#define  nd second
void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

#define MAXN  1<<17
#define MOD   1000000007
#define int long long
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef gp_hash_table<int, int, hash<int > > ht;
int32_t main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  int a,b;
  cin>>a>>b;
  int s=1;
  int c=0;
  while(s<b){
    s=s+a-1;
    c++;
  }
  cout<<c;



  return 0;
}


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

#define ff first
#define ss second
#define mp make_pair

using namespace std;

typedef long long ll;

int main() {
	int n;
	char s[100005];

	scanf("%d %s", &n, s);

	if(n&1) {
		printf("No\n");
		return 0;
	}

	int j = n/2;
	int i = 0;

	while(j < n) {
		if(s[i] != s[j]) {
			printf("No\n");
			return 0;
		}
		i++; j++;
	}

	printf("Yes\n");

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<string.h>
int main(void)
{
  double a,b,c,d,e,f;
  while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
    double x,y;
	x=(c*e-b*f)/(a*e-b*d);
	y=(a*f-c*d)/(a*e-b*d);
	if(x==0)
	  x=0;
	if(y==0)
	  y=0;
	printf("%.3f %.3f\n",x,y);
  }

  return 0;
}

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

int main() { /* ここに書く */
  
  int N,T,X,ans;
  cin >> N >> X >> T;
  
  ans = N/X ;
  
  if( N%X == 0){
    
  }
  else{
    ans++;
  }

  ans = ans*T;
  
  cout << ans << endl;
  
}

Measured memory_bytes: 3544
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int P = sc.nextInt();
		String S = sc.next();
		long ans = 0;
		if(P == 2 || P == 5) {
			for(int i = N-1; i >= 0; i--) {
				int x = Character.getNumericValue(S.charAt(i));
				if(x % P == 0)
					ans += i + 1;
			}
		}
		else{
			int[] c = new int[P];
			c[0] = 1;
			int a = 0, digit = 1;
			for(int i = N-1; i >= 0; i--) {
				int x = Character.getNumericValue(S.charAt(i));
				a = (a + x * digit) % P;
				ans += c[a];
				c[a]++;
				digit = digit * 10 % P;
			}
		}
		System.out.println(ans);

	}

}

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

using namespace std;

int n, k;
int d[10];

bool check(int s) {
  while (s) {
    int t = s % 10;
    for (int i = 0; i < k; i++) {
      if (t == d[i]) return false;
    }
    s /= 10;
  }
  return true;
}

int main(void) {
  cin >> n >> k;

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

  for (int i = n; ; i++) {
    if (!check(i)) continue;
    cout << i << endl;
    break;
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 2019;
int main()
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    string s;
    cin >> s;
    ll n = s.size();
    vector<ll> ab(n + 1,0);
    ll tmp = 0;
    ll mod = 1;
    for (int i = 0; i < n; i++)
    {
       tmp += (ll(s[n - 1 - i] - '0') * mod);
       ab[i + 1] = tmp % MOD;
       mod *= 10;
       mod %= MOD;
    }
    ll ans = 0;
    vector<ll> c(2019,0);
    for(int i = 0; i < n + 1; i++){
        c[ab[i]]++;
    }
    for (int i = 0; i < 2019; i++)
    {
        ans += c[i] * (c[i] - 1) / 2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 5108
#include<bits/stdc++.h>
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
std::mt19937 rnd(time(NULL));
#define rand rnd
#define pr std::pair<int,int>
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
template<class T>void cxk(T&a,T b){a=a>b?a:b;}
template<class T>void cnk(T&a,T b){a=a<b?a:b;}
#ifdef mod
int pow(int x,int y){
	int ret=1;
	while(y){
		if(y&1)ret=1ll*ret*x%mod;
		x=1ll*x*x%mod;y>>=1;
	}
	return ret;
}
template<class Ta,class Tb>void inc(Ta&a,Tb b){a=a+b>=mod?a+b-mod:a+b;}
template<class Ta,class Tb>void dec(Ta&a,Tb b){a=a>=b?a-b:a+mod-b;}
#endif
int h[100010],f[100010];
int main(){
#ifdef LOCAL
	freopen("in.in","r",stdin);
	//freopen("out.out","w",stdout);
#endif
	int n=gi();
	for(int i=1;i<=n;++i)h[i]=gi(),f[i]=1e9;
	f[1]=0;
	for(int i=1;i<=n;++i)cnk(f[i+1],f[i]+abs(h[i]-h[i+1])),cnk(f[i+2],f[i]+abs(h[i]-h[i+2]));
	printf("%d\n",f[n]);
	return 0;
}



Measured memory_bytes: 1024
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

A, B = getNM()
# bit1桁目のフラグの個数
# 周期は2 ** 1
# 0と1が交互に
# bit2桁目のフラグの個数
# 周期は2 ** 2
flags1 = [0] * 61
flags2 = [0] * 61
# 1 ~ nまでに各桁のフラグが何本立つか計算する関数
def bitflag(n, flaglist):
    if n > 0:
        for i in range(1, 61):
            split = 2 ** i
            flag1 = (n // split) * (split // 2)
            flag2 = max(n % split + 1 - (split // 2), 0)
            flaglist[i] += flag1 + flag2
# 1 ~ A - 1について（Aは範囲に入っているため）
bitflag(A - 1, flags1)
bitflag(B, flags2)
for i in range(61):
    flags2[i] -= flags1[i]
ans = 0
# 奇数ならフラグが立つ
for i in range(61):
    if flags2[i] % 2 != 0:
        ans += 2 ** (i - 1)
print(ans)

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


#define f(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define char_f(i,a) for(int i=(int)(a);(char)s[i]!='\0';i++)
#define rf(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define llf(i,a,b) for(long long int i=(long long int)(a);i<=(long long int)(b);i++)
#define llrf(i,a,b) for(long long int i=(long long int)(a);i>=(long long int)(b);i--)



#define ll long long
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define mem(ara) memset((ara),0,sizeof(ara))
#define memn(ara) memset((ara),-1,sizeof(ara))
#define bb begin()
#define ee end()
#define em emplace
#define eb emplace_back





#define si set<int>
#define sd set<double>
#define sll set<long long int>
#define ss set<string>
#define sc set<char>

#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pci pair<char,int>
#define pic pair<int,char>
#define pcl pair<char,long long int>
#define plc pair<long long int,char>

#define pss pair<string,string>
#define pcc pair<char,char>

#define pis pair<int,string>
#define psi pair<string,int>
#define pls pair<long long int,string>
#define psl pair<string,long long int>
#define pdd pair<double,double>
#define pcs pair<char,string>
#define psc pair<string,char>



#define vi  vector<int>
#define vll vector<long long int>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vii vector<pii>



#define mod 1000000007
#define mx (1<<30)-1
#define llmx (1ll<<62)
#define n_size 100005
#define g_size 10000005
double PI=acos(-1);
#define eps 1e-9



///unsigned int uMAX=4294967295;
///unsigned ll int ullMAX=18446744073709551615;





int arr[g_size];



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

	int n,m,T,res;

	int maxi=-mx,mini=mx,count=0;

	int i,j,k;

	bool flag;

	string s1,s2;

	char s[100000];

	int ara[n_size],ara2[n_size];

	cin>>n>>m>>k;

	f(i,0,m-1){
        int a;
        cin>>a;
        arr[a]=1;
	}

	int a=k;
	int b=k;

	int c1=0;
	int c2=0;

	while(1){
        if(arr[a]==1) {
            c1++;
            a--;
            if(a==-1) a=0;
        }
        else{
            a--;
            if(a==-1) a=0;
        }
        if(arr[b]==1){
            c2++;
            b++;
            if(b==n+1) b=n;
        }
        else{
            b++;
            if(b==n+1) b=n;
        }
        if(a==0 && b==n) break;
	}
	cout<<min(c1,c2)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

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

__attribute__((constructor)) void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

string S;
ll sum = 0;

int ctoi(char c) {
    if (c >= '0' && c <= '9') {
        return c - '0';
    }
    return 0;
}

void dfs(int i, vector<bool> plus) {
    if (i >= S.size() - 1) {
        // cout << "-----------------" << endl;
        // rep(i, plus.size()) DEBUG(plus[i]);
        ll lsum = 0;
        ll num = ctoi(S[0]);
        rep(j, S.size() - 1) {
            if (plus[j]) {
                lsum += num;
                num = ctoi(S[j+1]);
            } else {
                num *= 10;
                num += ctoi(S[j+1]);
            }
        }
        lsum += num;
        // DEBUG(lsum);
        sum += lsum;
        return;
    }

    vector<bool> hasPlus = plus;
    hasPlus.pb(true);
    dfs(i+1, hasPlus);

    vector<bool> noPlus = plus;
    noPlus.pb(false);
    dfs(i+1, noPlus);
}

int main() {
    cin >> S;
    vector<bool> plus;
    dfs(0, plus);
    cout << sum << endl;
}

Measured memory_bytes: 256