akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<queue>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<set>
#include<stack>
#include<sstream>
#include<fstream>
#include<string>
#include<assert.h>
//#include<Eigen/Dense>
//using namespace Eigen;
using namespace std;
typedef long long ll;


ll a[5005], b[5005];
int main()
{
	ll  n, k;
	while (cin >> n >> k) {
		for (int i = 0; i < n; i++) {
			cin >> a[i + 1];
		}
		for (int i = 0; i < n; i++) {
			cin >> b[i + 1];
		}
		vector<vector<ll>> r(n + 1);
		unordered_map<ll, ll> mp;
		ll ans = (-2147483647L - 1);
		for (int i = 1; i <= n; i++) {
			
			
			ll s = b[i];
			vector<ll> t; t.push_back(s);
			for (int j = a[i]; j != i; j = a[j]) s += b[j], t.push_back(s);
			//vector<ll> t;
			//ll temp = 0;
			//int j = i;
			//int ok = 1;
			//while (ok || (a[j] != a[i])) {
			//	ok = 0;
			//	temp += b[a[j]];
			//	t.push_back(temp);
			//	r[i].push_back(j);
			//	j = a[j];
			//}
			//mp[i] = temp;	
			int len = t.size();
			for (int j = 0; j < t.size(); j++) {
				ll res = (k - j - 1) ;
				if (res < 0)break;
				ans = max(ans, t[j] + (res/len)*max(0LL, s));
			}
		}
		/*ll ans = (-2147483647L - 1);
		for (int i = 1; i <= n; i++) {
			ll temp1 = k / r[i].size();
			ll temp2 = k % r[i].size();
			ll temp3 = 0;
			ll temp4 = (-2147483647L - 1);
			ll temp5 = (-2147483647L - 1);
			for (int j = 0; j < temp2; j++) {
				temp3 += b[a[r[i][j]]];
				temp4 = max(temp4, temp3);
			}
			temp3 = 0;
			for (int j = 0; j < r[i].size(); j++) {
				temp3 += b[a[r[i][j]]];
				temp5 = max(temp5, temp3);
			}
			if (temp1 > 0)
				ans = max(max(ans, max(max(temp1*mp[i] + temp4, temp1*mp[i]), *max_element(b + 1, b + 1 + n))), temp5);
			else
				ans = max(ans,max(temp4, *max_element(b + 1, b + 1 + n)));
		}*/
		cout << ans << endl;
	}
	return 0;
}


//ll n, k, vis[5005];
//ll p[5005], c[5005], sum[5005], ans = -1e18;
//int main() {
//	cin >> n >> k;
//	for (int i = 1; i <= n; i++) cin >> p[i];
//	for (int i = 1; i <= n; i++) cin >> c[i];
//	for (int i = 1; i <= n; i++) {
//		ll s = c[i];
//		vector<ll> t; t.push_back(s);
//		for (int j = p[i]; j != i; j = p[j]) s += c[j], t.push_back(s);
//		int len = t.size();
//		for (int j = 0; j < len; j++) {
//			ll rest = k - j - 1;
//			if (rest < 0) break;
//			ans = max(ans, t[j] + (rest / len)*max(s, 0LL));
//		}
//	}
//	cout << ans;
//}

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

using namespace std;

class UnionFindTree {
private:
    vector<int32_t> parent, rank;

    int32_t find(int32_t x) {
        if (parent[x] == x) {
            return x;
        } else {
            int32_t p = find(parent[x]);
            parent[x] = p;
            return p;
        }
    }

public:
    UnionFindTree(int32_t n) {
        parent.resize(n);
        rank.resize(n);

        for (int32_t i = 0; i < n; i++) {
            parent[i] = i;
            rank[i] = 0;
        }
    }

    void unite(int32_t x, int32_t y) {
        x = find(x);
        y = find(y);

        if (x == y) return;

        if (rank[x] < rank[y]) {
            parent[x] = y;
        } else {
            parent[y] = x;
            if (rank[x] == rank[y]) rank[x]++;
        }
    }

    bool same(int32_t x, int32_t y) {
        return find(x) == find(y);
    }
};

int main() {
    int32_t n, m;
    cin >> n >> m;

    UnionFindTree uf(n);

    for (int32_t i = 0; i < m; i++) {
        int32_t s, t;
        cin >> s >> t;

        uf.unite(s, t);
    }

    int32_t q;
    cin >> q;

    for (int32_t i = 0; i < q; i++) {
        int32_t s, t;
        cin >> s >> t;

        cout << (uf.same(s, t) ? "yes" : "no") << endl;
    }

    return 0;
}

Measured memory_bytes: 3576
using namespace std;
#include<string>
#include<cmath>
#include<list>
#include <map>
#include <unordered_map>
#include <set>
#define ll long long
#define ld long double
#define ull unsigned long long
#define ml map<ll,ll>
#define pb push_back
#define mp make_pair
#define ppl pair<ll,ll>
#define F first
#define S second
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)

#define fr(i,a,b) for(ll i=a;i<b;i++)
#define ffr(i,a,b) for(ll i=a;i>=b;i--)
#include<bits/stdc++.h>
#include<vector>
#define vl vector<ll>
#define PI 3.141592654
const ll N = 1e9 + 7;
#include<iterator>
#define EPSILON numeric_limits<double>::epsilon()





void solve() {
	string s, T;
	cin >> s >> T;
	ll n = s.size(), m = T.size(), i = 0, mi = N;
	while (i + m <= n) {
		ll c = 0, q = 0;
		fr(j, i, i + m ) {if (s[j] != T[q])c++; q++;}
		mi = min(mi, c);
		i++;
	}
	cout << mi;
}






int main() {
	fio;
#ifndef ONLINE_JUDGE
	// for getting input
	freopen("input.txt", "r", stdin);
	//for writing output
	freopen("jout.txt", "w", stdout);
#endif

	ll t;
	if (1)
		t = 1;
	else
		cin >> t;
	while (t--) {
		//cout << "Case #" << h << ": ";
		solve();
		//h++;
		cout << '\n';
	}
	return 0;
}






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

void solve() {
  string s;
  cin >> s;
  if (s.back() == 's') s += "es";
  else s += "s";
  cout << s << '\n';
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int t = 1;
  // cin >> t;
  while (t--) solve();
  
  return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);    
    long long N, A, B;
    cin >> N >> A >> B;
    long long ans = (B - A) & 1? min(A - 1, N - B) + 1 + (B - A) / 2: (B - A) / 2; 
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3600
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const ll INF = 1e18;


int main() {
	int n, a, b; cin >> n >> a >> b;
	vector<int> f(n), s(n), c(n);
	rep(i, 0, n) cin >> f[i] >> s[i] >> c[i];
	vector<vector<vector<ll>>> dp(n+1);
	rep(i, 0, n+1) {
		dp[i].resize(420);
		rep(j, 0, 420) {
			dp[i][j].resize(420, INF);
		}
	}
	dp[0][0][0] = 0;
	rep(i, 0, n)rep(j, 0, 401)rep(k, 0, 401) {
		dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k]);
		dp[i + 1][j + f[i]][k + s[i]] = min(dp[i + 1][j + f[i]][k + s[i]], dp[i][j][k] + c[i]);
	}
	ll ans = INF;
	rep(i,1, 410)rep(j,1, 410) {
		if (i * b == j * a) ans = min(ans, dp[n][i][j]);
	}
	if (ans == INF) cout << -1 << endl;
	else cout << ans << endl;
	return 0;
}

Measured memory_bytes: 57472
#include <cstdio>
#include <vector>
#include <cstring>
using namespace std;
using Graph = vector< vector<int> >;

const int S = 60;
int used[S], ord[S], low[S], ans = 0, it = 0;

void dfs(Graph &G, int cur=0, int par=-1) {
    used[cur] = true;
    ord[cur] = low[cur] = it++;

    for(auto to : G[cur]) {
        if(to == par) continue;
        if(!used[to]) dfs(G, to, cur);
        low[cur] = min(low[cur], low[to]);
        if(used[to]) low[cur] = min(low[cur], ord[to]);
    }
}

void get_ans(Graph &G, int cur=0, int par=-1) {
    used[cur] = true;
    for(auto to : G[cur]) {
        if(to == par || used[to]) continue;
        if(ord[cur] < low[to]) ans++;
        get_ans(G, to, cur);
    }
}

int main() {
    int N, M; scanf("%d%d", &N, &M);
    Graph G(N);
    for(int i=0; i<M; i++) {
        int a, b; scanf("%d%d", &a, &b);
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    dfs(G);
    memset(used, false, sizeof(used));
    get_ans(G);
    printf("%d\n", ans);
    return 0;
}

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

using namespace std;

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

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

    vector<int> d(n);
    for (size_t i = 0; i < n; i++)
    {
        cin >> d[i];
    }
    sort(d.begin(), d.end());
    cout << d[n/2] - d[n/2-1] << endl;
}

Measured memory_bytes: 640
"""
import numpy as np
N, M = map(int, input().split())
cities = {}
Y = {}
for i in range(M):
    p,y = map(int, input().split())
    cities[i] = p
    Y[i] = y

ans = {}
sorted_Y = sorted(Y.items(), key=lambda x:x[1])
P_i = np.zeros(N)
for i,y in sorted_Y:
    p = cities[i]
    P_i[p-1] += 1
    ans[i] = (p, int(P_i[p-1]))

for i in range(M):
    print('{0:06}{1:06}'.format(ans[i][0], ans[i][1]))
"""

n, m = map(int,input().split())
pys = []
for i in range(m):
    x = list(map(int, input().split()))
    x = [x[0],x[1],i]
    pys.append(x)

pys.sort()
pp = -1
lid = 0
ans = [0]*m
for i in range(m):
    if pp == pys[i][0]:
        lid += 1
    else:
        lid = 1
        pp = pys[i][0]
    ans[pys[i][2]] = pp*10**6+lid

for v in ans:
    print('{:012d}'.format(v))


Measured memory_bytes: 29376
import java.util.Scanner;

class Main{
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		StringBuffer S = new StringBuffer(sc.next());
		while(S.length() > 0) {
			if((S.lastIndexOf("dream") != -1 && S.lastIndexOf("dream") == S.length() - 5) || (S.lastIndexOf("erase") != -1  && S.lastIndexOf("erase") == S.length() - 5)) {
				S = S.delete(S.length() - 5, S.length());
			}else if(S.lastIndexOf("dreamer") != -1 && S.lastIndexOf("dreamer") == S.length() - 7) {
				S = S.delete(S.length() - 7, S.length());
			}else if(S.lastIndexOf("eraser") != -1 && S.lastIndexOf("eraser") == S.length() - 6) {
				S = S.delete(S.length() - 6, S.length());
			}else {
				break;
			}
		}
		System.out.println(S.length() == 0 ? "YES" : "NO");
	}
}

Measured memory_bytes: 28116
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,k;
  cin >>a>>b>>k;
  for(int i=a;i<=b;i++){
    if(i<=a+k-1||i>=b-k+1){
      cout<<i<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws IOException {

    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

    while (input.ready()) {
      String numStr[] = input.readLine().split(" ");
      int num[] = new int[2];
      num[0] = Integer.parseInt(numStr[0]);
      num[1] = Integer.parseInt(numStr[1]);

      System.out.println(getDigitNumber(num[0] + num[1]));

      ;
    }
  }

  public static int getDigitNumber(int num) {

    int digit = 1;
    int a = 10;
    while (num / a >= 1) {
      a *= 10;
      digit++;
    }
    return digit;
  }
}

Measured memory_bytes: 24056
#include <string>
#include <vector>
#include <map>
#include <deque>
#include <iostream>
#include <queue>
#include <math.h>
#include <algorithm>
#include <fstream>

using namespace std;
typedef long long ll;


int main(void) {
	ll n,sum=0;
	cin >> n;
	vector<int>a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n-1; i++) {
		for (int j = i+1; j < n; j++) {
			sum += a[i] * a[j];
		}
	}
	cout << sum;
	return 0;
}

Measured memory_bytes: 256
def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end  
def copy(a) Marshal.load(Marshal.dump(a)) end
def factorial(n)(n < 2)? 1 : (2..n).inject(:*) end
def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
def na(n,d=0) Array.new(n,d)end
def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end
def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end
def bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end
x1,y1,x2,y2 = inp
xt = x2-x1
yt = y2-y1
x3 = x2 - yt
y3 = y2 + xt
y4 = y1 + xt
x4 = x1 - yt 
puts "#{x3} #{y3} #{x4} #{y4}" 

Measured memory_bytes: 1788
#include<stdio.h>

int main(void){
    int i;
    int j;
    int k;
    int N;
    int max;
    int A[2][100];
    int sum[100] = {0};
    
    scanf("%d",&N);
    
    for(i=0;i<2;i++){
        for(j=0;j<N;j++){
            scanf("%d",&A[i][j]);
        }
    }
    
    for(i=0;i<N;i++){
        for(j=0;j<=i;j++){
            sum[i]=sum[i]+A[0][j];
            }
        for(k=i;k<N;k++){
            sum[i]=sum[i]+A[1][k];
        }
    }    
    
    max = sum[0];
    for(i=0;i<N;i++){
        if(sum[i]>max){
            max = sum[i];
        }
    }
    
    printf("%d",max);
    
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
				using namespace std;
				#define ll long long
				#define mod 1000000007
				#define pll pair<long,long>
				#define se second
				#define fi first
				#define pb push_back
				#include <ext/pb_ds/assoc_container.hpp>
				#include <ext/pb_ds/tree_policy.hpp>
				using namespace __gnu_pbds;

				typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
				typedef tree<pll,null_type,less<pll>,rb_tree_tag,tree_order_statistics_node_update>pllordered_set;
				
				const ll INF=(ll)1e18;
				ll fac[300050];
				
				ll binpow(ll a,ll b,ll m)
				{
					a%=m;
					ll ans=1;
					while(b)
					{
						if(b&1)
							ans=ans*a%m;
						a=a*a%m;
						b=b>>1;
					}
					return ans;
					
				}
				ll mod_inverse(ll n)
				{
					return binpow(n,mod-2,mod);
				}
				
				ll C(ll n,ll r)
				{
					return fac[n]*mod_inverse(fac[r])%mod * mod_inverse(fac[n-r])%mod;
				}
				
				int main()
				{
					ios_base::sync_with_stdio(false);
					cin.tie(NULL);
					fac[0]=1;
					
					for(ll i=1;i<=300005;i++)
						fac[i]=(i*fac[i-1])%mod;
					
					
					
					ll n,m;
					cin>>n>>m;
					ll ans=1;
					for(ll i=2;i*i<=m;i++)
					{
						ll cnt=0;
						while(m%i==0)
						{
								cnt++;
								m=m/i;
						}
						ans=ans*C(cnt+n-1,n-1);
						ans%=mod;
					}
					if(m>1)
					{
						ans*=C(1+n-1,n-1);
						ans%=mod;
					}
						cout<<ans;
				}
				


Measured memory_bytes: 2560
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    let v: Vec<usize> = buf.split_whitespace().map(|x| x.parse().unwrap()).collect();
    let (n, m) = (v[0], v[1]);

    let min = std::cmp::min(n * 2, m);
    println!("{}", min / 2 + (m - min) / 4);
}


Measured memory_bytes: 4352
package main

import (
	"fmt"
	"strings"
)

func main() {
	O := ""
	E := ""
	fmt.Scan(&O)
	fmt.Scan(&E)
	infoO := strings.Split(O, "")
	infoE := strings.Split(E, "")
	result := ""
	if len(infoO) > len(infoE) {
		for i := 0; i < len(infoE); i++ {
			result += infoO[i] + infoE[i]
		}
		result += infoO[len(infoO)-1]
	} else {
		for i := 0; i < len(infoE); i++ {
			result += infoO[i] + infoE[i]
		}
	}
	fmt.Println(result)
}

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

map<string,int>mp;

int main() {
  int n;
  cin >> n;
  vector<int>a(n+1);
  rep(i,n+1) cin >> a[i];
  vector<int>b(n);
  rep(i,n) cin >> b[i];
  ll ans = 0;
  rep(i,n) {
    int left = min(a[i], b[i]);
    a[i] = max(0, a[i]-left);
    b[i] = max(0, b[i]-left);
    int right = min(a[i+1], b[i]);
    a[i+1] = max(0, a[i+1]-right);
    b[i] = max(0, b[i]-right);
    ans += left + right;
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N; cin >> N;
    vector<ll> W(N), acc(N + 1);
    acc.at(0) = 0;
    rep(i, N){cin >> W.at(i); acc.at(i + 1) = acc.at(i) + W.at(i);}

    ll ans = INF;
    rep(i, N - 1){
        ll tmp = abs(2 * acc.at(i + 1) - acc.at(N));
        if (tmp < ans){ans = tmp;}
    }
    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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

int main()
{
    for(;;){
        int n, p, q;
        cin >> n >> p >> q;
        if(n == 0)
            return 0;

        p = p / 100 * 60 + p % 100;
        q = q / 100 * 60 + q % 100;

        vector<bool> x(24 * 60, false);

        for(int i=0; i<n; ++i){
            int m;
            cin >> m;
            vector<int> a(2*m+2);
            a[0] = p;
            a[2*m+1] = q;
            for(int j=1; j<=2*m; ++j){
                cin >> a[j];
                a[j] = a[j] / 100 * 60 + a[j] % 100;
            }

            for(int j=0; j<m+1; ++j){
                for(int k=a[2*j]; k<a[2*j+1]; ++k)
                    x[k] = true;
            }
        }

        int tmp = 0;
        int ret = 0;
        for(int i=p; i<q; ++i){
            if(x[i]){
                ++ tmp;
                ret = max(ret, tmp);
            }else{
                tmp = 0;
            }
        }

        cout << ret << endl;
    }
}

Measured memory_bytes: 0
#include <iostream>

const int N = 200000 + 7;

int n;
int a[N];

int check(int x) {
	static int pos[N], chr[N], top;

	auto split = [&](int p) {
		while (top && pos[top] >= p) --top;
		int c = chr[top + 1];
		if (pos[top] < p - 1) pos[++top] = p - 1, chr[top] = c;
		pos[++top] = p, chr[top] = c;
	};
	pos[top = 1] = a[1], chr[1] = 1;
	for (int i = 2; i <= n; ++i)
		if (a[i] > a[i - 1])
			pos[++top] = a[i], chr[top] = 1;
		else {
			split(a[i]);	
			while (top && chr[top] == x) --top;
			if (!top) return 0;
			split(pos[top]), ++chr[top];
			if (pos[top] < a[i]) pos[++top] = a[i], chr[top] = 1;
		}
	return 1;
}

int main() {
//	freopen("code.in", "r", stdin);
//	freopen("code.out", "w", stdout);

	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) scanf("%d", a + i);
	int l = 1, r = n, m;
	while (l < r)
		check(m = l + r >> 1) ? (r = m) : (l = m + 1);
	printf("%d", r);
	return 0;
}


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

int main() {
	int n, a;
	cin >> n >> a;
	int w, x, y, z;
	w = (a % 5000) / 1000;
	string flag = "false";
	for (x = 0; x <= n; x++) {
		for (y = 0; y <= n - x; y++) {
			z =	n - x - y;
			if (10000 * x + 5000 * y + 1000 * z == a) {
				flag = "true";
				break;
			}
		}
		if (flag == "true")break;
	}
	if (flag == "true") {
		cout << x << " " << y << " " << z << endl;
	}
	else cout << "-1 -1 -1" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <string.h>
#include <math.h>
using namespace std;
 
int main() {
    string a, b, c;
    cin >> a >> b;
    c=(a == b ? "EQUAL" : (a.length() < b.length() || (a.length() == b.length() && a < b)) ? "LESS" : "GREATER") ;
    cout << c<< endl;
 
    return 0;
}


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

int main(void){
    int x ,y, i, j = -1;
    
    cin >> y >> x;
    char array[y + 2][x + 2];
    
    while (++j < y + 2)
    {
        i = -1;
        while (++i < x + 2)
            array[j][i] = '.';
    }
    j = 0;
    while (++j < y + 1)
    {
        i = 0;
        while (++i < x + 1)
            cin >> array[j][i];
    }
    j = 0;
    while (++j < y + 1)
    {
        i = 0;
        while (++i < x + 1)
            if (array[j][i] == '#' && !(array[j - 1][i] == '#' || array[j + 1][i] == '#' || array[j][i - 1] == '#' || array[j][i + 1] == '#'))
            {
                cout << "No" << endl;
                return (0);
            }
    }
    cout << "Yes" << endl;
    return (0);
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstdint>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <vector>
#include <random>
#include <utility>
#include <limits>
#include <list>

/* template start */
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()

#ifdef LOCAL
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  if(sizeof...(t)>0)std::cout<<" :";
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}

template<typename Num>
constexpr Num mypow(Num a, unsigned long long b) {
  if(b==0)return 1;
  if (a==0)return 0;
  Num x = 1;
  while (b > 0) {
    if(b & 1)x*=a;
    a*=a;
    b >>= 1;
  }
  return x;
}

/* template end */

using ll = long long;

void solve(){
  ll n;
  std::cin>>n;

  std::vector<ll> a(n);
  for(auto&& e:a)std::cin>>e;

  std::string s;
  std::cin>>s;

  std::vector<ll> basis;

  for(ll i=n-1;i>=0;i--){
    if(s[i]=='0'){
      for(const auto& e:basis)chmin(a[i],a[i]^e);
      if(a[i]>0)basis.emplace_back(a[i]);
    }else{
      for(const auto& e:basis)chmin(a[i],a[i]^e);
      if(a[i]>0){
        std::cout<<1<<"\n";
        return;
      }
    }
  }
  std::cout<<0<<"\n";
  return;
}

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

  ll test;
  std::cin>>test;

  while(test--)solve();

  return 0;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b) {if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b) {if(a<b) a=b;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b; cin >> a >> b; 
    int ans = a-(2*b);
    cout << (ans<0 ? 0:ans) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)




int main() {
	int n;
	cin >> n;
	vector<int> d(n);
	rep(i, n) cin >> d[i];
	uint64_t ans = 0;
	rep(i, n) {
		rep(j, i) {
			ans += d[i] * d[j];
		}
	}
	cout << ans << endl;
}

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

int main(){
    int n;cin>>n;
    vector<long long> a(n);
    vector<long long> b(n);
    long long a_acc = 0;
    long long b_acc = 0;
    for (int i=0;i<n;i++){
        cin >> a[i];
        a_acc += a[i];
    }
    for (int i=0;i<n;i++){
        cin >> b[i];
        b_acc += b[i];
    }

    if (a_acc < b_acc){
        cout << -1 << endl;
        return 0;
    }

    vector<long long> over;
    int less_num = 0;
    long long less_acc = 0;
    for (int i=0;i<n;i++){
        if (a[i] >= b[i]){
            over.push_back(a[i] - b[i]);
        } else {
            less_num++;
            less_acc += b[i] - a[i];
        }
    }
    sort(over.begin(), over.end(), greater<long long>());
    int over_num = 0;
    for (int i=0;i<over.size();i++){
        if (less_acc <= 0){
            break;
        }
        less_acc -= over[i];
        over_num++;
    }
    cout << less_num + over_num << endl;
    return 0;

}

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

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int x, cnt = 1, flag = 0;
    cin >> x;
    set<int> s;
    while(s.find(x) == s.end()) {
        s.insert(x);
        if(x%2) { //odd
            x = 3*x + 1;
        } else { //even
            x /= 2;
        }
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm> 

int n, a, b;
int dp[410][410];
int A[100], B[100], C[100];
 
signed main() {
    std::cin >> n >> a >> b;
    
    for(int i = 0; i < n; ++i) {
        std::cin >> A[i] >> B[i] >> C[i];
    }
    
    int ans = 1e9;
 
    for(int i = 0; i < 410; ++i) {
        for(int j = 0; j < 410; ++j) {
            dp[i][j] = 1e9;
        }
    }
    dp[0][0] = 0;
    for(int i = 0; i < n; ++i) {
        for(int j = 405; j >= 0; --j) {
            for(int k = 405; k >= 0; --k) {
                if(dp[j][k] != 1e9) {
                    if(j + A[i] <= 400 && k + B[i] <= 400)
                        dp[j + A[i]][k + B[i]] = std::min(dp[j + A[i]][k + B[i]], dp[j][k] + C[i]);
                    if(j != 0 && k != 0 && j * b  == k * a) {
                        ans = std::min(ans, dp[j][k]);
                    }
                }
            }
        }
    }
    for(int j = 405; j >= 0; --j) {
        for(int k = 405; k >= 0; --k) {
            if(dp[j][k] != 1e9) {
                if(j != 0 && k != 0 && j * b  == k * a) {
                    ans = std::min(ans, dp[j][k]);
                }
            }                
        }
    }
    if(ans == 1e9) {
        std::cout << -1 << std::endl;
    }else {
        std::cout << ans << std::endl;    
    }
    
}

Measured memory_bytes: 896
#include<stdio.h>
int main(){
    int N;
    scanf("%d", &N);
    if(N/10==0){
        printf("Yes\n");
    } else{
        int D = N;
        int S = 0;
        while(D!=0){
            S+=D%10;
            D/=10;
        }
        if(N%S==0){
            printf("Yes\n");
        } else{
            printf("No\n");
        }
    }
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef double dd;
#define all(v) v.begin(),v.end()
#define endl "\n"
#define clr(n, r) memset(n,r,sizeof(n));

void fast() {
    cin.tie(0);
    cin.sync_with_stdio(0);
}

const int N = 1e5 + 9;
int n, h[N], dp[N];

int sol(int i){
    if(i == n - 1)  return 0;
    if(i == n)  return 1e9;

    int &ret = dp[i];
    if(~ret)    return ret;

    return ret = min(abs(h[i] - h[i + 1]) + sol(i + 1), abs(h[i] - h[i + 2]) + sol(i + 2));
}


int main() {

    cin >> n;

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

    memset(dp, -1, sizeof dp);

    cout << sol(0);
}

Measured memory_bytes: 2560
x = input().split()
ju = 0
for i in range(2):
  x[i] = int(x[i])
for i in range(x[0]+1):
  if 2*i+4*(x[0]-i) == x[1]:
    ju += 1
if ju == 1:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 9168
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> cld;
class disjoint_set {
  public:
    int cnt;
    vector<int> rank, prt, now, lg;
    disjoint_set(int size) {
      cnt = size;
      rank.resize(size);
      prt.resize(size);
      now.resize(size);
      lg.resize(2 * size - 1);
      lg.resize(2 * size - 1);
      for (int i = 0; i < size; i++) {
        prt[i] = i;
        rank[i] = 0;
        now[i] = i;
      }
    }
  int find (int x) {
    if (x == prt[x]) return x;
    return prt[x] = find(prt[x]);
  }
  bool is_equiv (int x, int y) {
    return find(x) == find(y);
  }
  int unite (int x, int y) {
    x = find(x);
    y = find(y);
    lg[now[x]] = lg[now[y]] = cnt;
    cld[cnt].push_back(now[x]);
    cld[cnt].push_back(now[y]);
    now[x] = now[y] = cnt;
    if (x == y) return false;
    if (rank[x] > rank[y]) swap(x, y);
    prt[x] = y;
    if (rank[x] == rank[y]) rank[y]++;
    return cnt++;
  }
};
vector<int> dpt;
void dfs (int crr, int d) {
  dpt[crr] = d;
  for (int nxt : cld[crr]) {
    dfs(nxt, d + 1);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<pair<int, pair<int, int>>> grh(m);
  for (int i = 0; i < m; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    grh[i] = {c, {--a, --b}};
  }
  sort(grh.begin(), grh.end());
  int N = 2 * n - 1;
  cld.resize(N);
  vector<int> cut(N);
  disjoint_set djs(n);
  long long sum = 0;
  int cnt = 0;
  for (auto e : grh) {
    int c = e.first;
    int a = e.second.first;
    int b = e.second.second;
    if (!djs.is_equiv(a, b)) {
      cut[djs.unite(a, b)] = c;
      sum += c;
      cnt++;
    }
  }
  const int PMAX = 20;
  vector<vector<int>> asc(PMAX, vector<int>(N));
  for (int i = 0; i < N; i++) {
    asc[0][i] = djs.lg[i];
  }
  asc[0][N - 1] = N - 1;
  for (int p = 1; p < PMAX; p++) {
    for (int i = 0; i < N; i++) {
      asc[p][i] = asc[p - 1][asc[p - 1][i]];
    }
  }
  dpt.resize(N);
  dfs(N - 1, 0);
  int q;
  cin >> q;
  while (q--) {
    int s, t;
    cin >> s >> t;
    if (dpt[--s] > dpt[--t]) swap(s, t);
    int d = dpt[t] - dpt[s];
    for (int p = 0; p < PMAX; p++){
      if (d & 1) {
        t = asc[p][t];
      }
      d >>= 1;
      if (d == 0) break;
    }
    long long ret = sum;
    for (int p = PMAX - 1; p >= 0; p--) {
      if (asc[p][s] != asc[p][t]) {
        s = asc[p][s];
        t = asc[p][t];
      }
    }
    if (s != t) {
      s = asc[0][s];
      t = asc[0][t];
    }
    ret -= cut[s];
    cout << ret << '\n';
  }
  return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

int main()
{
    char a;
    cin >> a;
    cout << (a - 'a' >= 0 ? "a" : "A") << endl; 

    return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B, C;
    cin >> A >> B >> C;
    REP(i, 1, 10000) {
        if(A * i % B == C) {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;

    return 0;
}


Measured memory_bytes: 3612
import sys
n, k, c = map(int, input().split())
s = input()


count = 0
i = 0
ansleft = set()
while i < n:
    if s[i] == "o":
        ansleft.add(i+1)
        i += c+1
        count += 1
    else:
        i += 1

if count >= k+1:
    sys.exit()


ansright = set()
s = s[::-1]
i = 0
while i < n:
    if s[i] == "o":
        ansright.add(n-i)
        i += c+1
    else:
        i += 1

ans = ansright&ansleft
ans = list(ans)
ans.sort()
for i in ans:
    print(i)


Measured memory_bytes: 82008
def gcd(a, b):
    x, y = [a, b] if a > b else [b, a]
    while y:
        x, y = y, x%y
    return x

n = int(input())
nums = sorted(list(map(int, input().split(' '))))
loops = gcd(nums[0], nums[1])
print(1)
for x in range(2, loops+1):
    flg = True
    for num in nums:
        if num%x != 0:
            flg = False
            break
    if flg:
        print(x)


Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 1e12

#define PB push_back
#define PF push_front
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vpi vector<pii>
#define vll vector<ll>
#define vpl vector<pll>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))
#define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pr_d(x) cout << fixed << setprecision(15) << x << endl
#define ud(c, x) distance(c.begin(), upper_bound(all(c), x))
#define ld(c, x) distance(c.begin(), lower_bound(all(c), x))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rep3(i, n) for (int i = (n - 1); i >= 0; --i)
#define rep4(i, a, b) for (int i = (a); i > (b); --i)
#define pb push_back
#define out(x) cout << x << "\n"
bool odd(int i) { return i % 2; }

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

int gcd(int a, int b) { return __gcd(a, b); }
int lcm(int a, int b) { return a * (b / gcd(a, b)); }
void Yes_No(bool f) {
  if (f)
    printf("Yes\n");
  else
    printf("No\n");
}

void deb_p(pii p) { printf("pair = %d %d\n", p.fi, p.se); }
void deb_i(int i) { printf("i = %d\n", i); }
void deb_v(vector<int> v) {
  printf("v = ");
  for (auto i : v) printf("%d ", i);
  printf("\n");
}
template <typename T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T& a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
//-------------------ここから回答する-----------------------

void solve(void) {
  int a, b;
  cin >> a >> b;
  if (a + b < 10)
    out(a + b);
  else
    out("error");
}
int main(void) { solve(); }


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
struct edge{int v,nxt;}e[maxn<<1];
int head[maxn],ecnt=0;
void add(int u,int v)
{
	e[++ecnt]=(edge){v,head[u]},head[u]=ecnt;
	e[++ecnt]=(edge){u,head[v]},head[v]=ecnt;
}
struct data
{
	long long D;
	int id;
	bool operator < (const data &b){return D<b.D;}
}c[maxn];
int fa[maxn],siz[maxn],n,rt;
int find(int lim,long long x)
{
	int l=1,r=lim,ans=0;
	while(l<=r)
	{
		int mid=l+r>>1;
		if(c[mid].D>=x)r=mid-1,ans=mid;
		else l=mid+1;
	}
//	cout<<c[ans].D<<endl;
//	if(c[ans].D!=x)printf("fuckyou\n");
	return ans;
}
int dep[maxn];
long long tot=0;
void dfs(int u,int pre)
{
	dep[u]=dep[pre]+1;
	tot+=dep[u]-1;
	for(int i=head[u];~i;i=e[i].nxt)
	{
		int v=e[i].v;
		if(v==pre)continue;
		dfs(v,u);
	}
}
int main()
{
	memset(head,-1,sizeof(head));
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%lld",&c[i].D),c[i].id=i;
	sort(c+1,c+1+n);
	for(int i=n;i>=2;i--)
	{
		siz[i]++;
		int p=find(i-1,c[i].D-(n-2*1LL*siz[i]));
		if(c[i].D-(n-2*1LL*siz[i])!=c[p].D)
		{
			printf("-1\n");
			return 0;
		}
		siz[p]+=siz[i];
		fa[c[i].id]=c[p].id;
	}
	for(int i=1;i<=n;i++)
	if(fa[i])add(fa[i],i);
	else rt=i;
	dfs(rt,0);
	if(tot!=c[1].D)
	{
		printf("-1\n");
		return 0;
	}
	for(int i=1;i<=n;i++)if(fa[i])printf("%d %d\n",fa[i],i);
}

Measured memory_bytes: 7680
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int main(){
    int n;
    cin >> n;
    vector<int>a(n);
    rep(i,n){
        cin >> a[i];

    }
    sort(a.begin(),a.end());
    if(a[n-1]-a[0]>1){
        cout << "No" << endl;
    }else if(a[n-1]-a[0]==0){
        if(a[0]==n-1){
            cout << "Yes" << endl;
        }else if(a[0]>n/2){
            cout << "No" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        int c = 0;
        rep(i,n){
            if(a[i]==a[0]){
                c++;
            }
        }
        if(a[0]>=c&&a[0]<c+(n-c)/2){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<numeric>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define BIL ((ll)1e9)
#define MOD ((ll)1e9+7)
#define INF (1LL<<60)           //1LL<<63でオーバーフロー
#define inf (1<<29)             //1<<29でオーバーフロー

struct UnionFind{
    vector<int> par;

    UnionFind(int n){
        for(int i=0;i<n;i++){
            par.push_back(i);    
        }
    }
    int root(int x){
        if(par[x] == x) return x;
        return par[x] = root(par[x]);
    }
    bool merge(int x, int y){
        int rx = root(x);
        int ry = root(y);
        if(rx == ry) return false;
        // if(par[rx] > par[ry]) swap(x, y);
        // par[rx] += par[ry];
        par[ry] = rx;
        return true;
    }
    bool isSame(int x, int y){
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
    // int size(int x){
    //     return -par[root(x)];
    // }
};

int main(int argc,char* argv[]){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);

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

    UnionFind city(n);
    for(int i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        city.merge(a,b);
    }

    set<int> check;
    for(int i=0;i<n;i++){
        int j=city.root(i);
        check.insert(j);
    }

    cout << check.size()-1 << endl;

    return 0;
}


Measured memory_bytes: 7632
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define mod 1000000007 //10^9+7
#define INF 1000000000000 //10^12
#define P pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
int a,b,c,d;
signed main(){
    cin>>a>>b>>c>>d;
    if(a+1==c)cout<<1<<endl;
    else cout<<0<<endl;
    return 0;
}


Measured memory_bytes: 256
//auto 関数名 = [(&:ラムダ外の引数をとる時))](引数の型1 引数名1, 引数の型2, 引数名2, ...) { 関数の処理 }; //inside main() define function. take care of };
// for (int tmp = 0; tmp < (1 << ビット数); tmp++) {
//   bitset<ビット数> s(tmp);
//   // (ビット列sに対する処理)
// }
// sort(配列変数.begin(), 配列変数.end());
// do {
//   // 順列に対する処理
// } while (next_permutation(配列変数.begin(), 配列変数.end()));
//const double PI = acos(-1); M_PI
// cout << fixed << setprecision(10);
#include <bits/stdc++.h>
#include <regex> //正規表現
using namespace std;
#define _GLIBCXX_DEBUG //GCC環境下で[]による配列要素参照のエラーを出す
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end() //sort(all(vec)); ,reverse(all(vec));etc
int main(){
  int64_t a;
  double b;
  cin>>a>>b;
  int64_t c;
  c=int64_t(b*100);
  c=a*c;
  cout<<c/100<<endl;
}

  

Measured memory_bytes: 3652
#include <cstdio>
#include <cmath>

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define inc( i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec( i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

template<typename T> void swap(T & x, T & y) { T t = x; x = y; y = t; return; }
template<typename T> T abs(T x) { return (0 <= x ? x : -x); }
template<typename T> T max(T a, T b) { return (b <= a ? a : b); }
template<typename T> T min(T a, T b) { return (a <= b ? a : b); }
template<typename T> bool setmin(T & a, T b) { if(a <= b) { return false; } else { a = b; return true; } }
template<typename T> bool setmax(T & a, T b) { if(b <= a) { return false; } else { a = b; return true; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, eor, a[100];
const int MOD = 1000000007;
int dp[2][256][101];

LL f(LL x) {
	if(x == 0) { return 1; }
	return (x * f(x - 1)) % MOD;
}

int main() {
	scanf("%d%d", &n, &eor);
	inc(i, n) { scanf("%d", &a[i]); }
	
	int from = 0, to = 1;
	dp[to][0][0] = 1;
	inc(i, n) {
		swap(from, to);
		inc(j, 256) {
		inc(k,   n) {
			dp[to][j][k] = dp[from][j][k];
		}
		}
		
		inc(j, 256) {
		inc(k,   n) {
			(dp[to][ j ^ a[i] ][k + 1] += dp[from][j][k]) %= MOD;
		}
		}
	}
	
	LL ans = 0;
	inc1(k, n) { (ans += f(k) * dp[to][eor][k]) %= MOD; }
	
	printf("%lld\n", ans);
	
	return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
 
int main(void)
{
    int node[128] = {0};
    int from, to;
    int flag = 0;
    int i;
     
    while (~scanf("%d %d", &from, &to)){
        if (from + to) {
            node[from] = !node[from];
            node[to] = !node[to];
             
            flag += node[from] ? 1 : -1;
            flag += node[to] ? 1 : -1;
        }
        else {
            puts((flag == 2 && node[1] + node[2] == 2) ? "OK" : "NG");
             
            //initialize
            memset(node, 0, sizeof(node));
            flag = 0;
        }
    }
     
    return (0);
}

Measured memory_bytes: 584
#include <stdio.h>

#include <math.h>

#define MAX 1000



int main(){

    int n;

    int i, j=0, sum;

    int score[MAX];

    double ave, tmp;

    double dev[MAX];



    while(1){

        scanf("%d", &n);

        if(n==0)break;

        sum=0;

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

            scanf("%d", &score[i]);

            sum+=score[i];

        }

        ave=(double)sum/(double)n;

        tmp=0.0;

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

            tmp+=pow(score[i]-ave, 2);

        }

        dev[j++]=sqrt(tmp/(double)n);

    }

    for(i=0;i<j;i++){

        printf("%f\n", dev[i]);

    }

    return 0;

}


Measured memory_bytes: 2748
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {
        string inpt = Reader.ReadLine();
        string ans = "no";
        if(inpt.Length == inpt.Distinct().Count()) {
            ans = "yes";
        }
        Console.WriteLine(ans);
    }



    public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"



3
3
1
2


";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}


Measured memory_bytes: 13268
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int A=sc.nextInt();
		int B=sc.nextInt();
		
		if((A*B)%2==0){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}
	}
}


Measured memory_bytes: 23764
import numpy as np
import math
import sys
sys.setrecursionlimit(10000000)

def main():
    N = int(input())
    S = input()

    num = 1
    for i in range(1, N):
        if S[i] != S[i - 1]:
            num += 1
    print(num)

if __name__ == '__main__':
    main()

Measured memory_bytes: 21756
program exchange
  implicit none
  integer :: a, b, k, i
  read(*,*) a, b, k
  do i = 1, k
     if (mod(i,2) .eq. 1) then
        a = a/2
        b = b+a
     else
        b = b/2
        a = a+b
     end if
  end do
  write(*,'(i0,x,i0)') a, b
  stop
end program exchange

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

#define int long long
#define rep(i, l, r) for (int i = (int)(l); i < (int)(r); i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)x.size())
template <class T> bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T> using V = vector<T>;
using P = pair<int, int>;

/*
 * a+2sqrt(ab)+b < c
 * 2sqrt(ab) < c-a-b
 * 4ab < (c-a-b)^2
 */

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

  if(c-a-b > 0 and 4*a*b < (c-a-b)*(c-a-b)) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}



Measured memory_bytes: 256
import math


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    A, B, H, M = read_ints()
    angle1 = 2*math.pi*(H+M/60)/12
    angle2 = 2*math.pi*M/60
    c = abs(angle1-angle2)
    return math.sqrt(A*A+B*B-2*A*B*math.cos(c))


if __name__ == '__main__':
    print(solve())


Measured memory_bytes: 9516
using System;
class Program
{
	static void Main(string[] args)
	{
		string[] input = Console.ReadLine().Split(' ');
		int n = int.Parse(input[0]);
		int Y = int.Parse(input[1]);
        int x = 0;
        int y = 0;
        int z = 0;
        for(int x2=0; x2<=n; x2++){
            for(int y2=0; y2<=n; y2++){
                int z2 = n-x2-y2;
                if((10000*x2 + 5000*y2 + 1000*z2) == Y && z2 >= 0) {
                    Console.WriteLine("{0} {1} {2}", x2, y2, z2);
                    return;
                }
            }
        }
        Console.WriteLine("-1 -1 -1");
	}
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin >> s;
	int sum = 1;
	for(int i = 0; i < s.length()-1; i++){
		if(s[i] != s[i+1]){
			sum++;
		}	
		else{
			if(i == s.length() -3){
				sum++;
				break;
			}
			if(i == s.length() -2){
				break;
			}
			i+=2;
			sum+=2;
		}
	}
	cout << sum << endl;
	return 0;
 } 

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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) for (long long i = 0; i < (n); ++i)

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

  VI v(n);
  REP(i,n){
    cin >> v[i];
  }

  SORT(v);

  int ans = 0;
  REP(i, k) {
    ans += v[i];
  }
  ANS(ans)
  return 0;
}


Measured memory_bytes: 3632
n = int(input())
R = [int(input()) for i in range(n)]

minv = R[0]
maxv = R[1] - R[0]

for j in xrange(1,n):
    if( maxv < R[j] - minv):
        maxv = R[j] - minv
    if( R[j] < minv ):
        minv = R[j]
print(maxv)


Measured memory_bytes: 17312