akhauriyash/Code-Regression huggingface dataset:
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        boolean isMatch = true;
        if (s.length() >= t.length()) {
            for (int i = 0; i <= s.length() - t.length(); i++) {
                String parts = s.substring(s.length() - t.length() - i, s.length() - i);
                isMatch = true;
                if (t.equals(parts)) {
                    System.out.println(s.replaceAll("\\?", "a"));
                    break;
                } else {
                    for (int j = 0; j < parts.length(); j++) {
                        if (t.charAt(j) != parts.charAt(j) && parts.charAt(j) != '?') {
                            // not match
                            isMatch = false;
                            break;
                        }
                    }
                }
                if(isMatch) {
                    String before = s.substring(0, s.length() - t.length() - i);
                    String after = s.substring(s.length() - i, s.length());
                    String result = (before + t + after).replaceAll("\\?", "a");
                    System.out.println(result);
                    break;
                }
            }
        } else {
            System.out.println("UNRESTORABLE");
        }

        if(!isMatch) {
            System.out.println("UNRESTORABLE");
        }
    }
}

Measured memory_bytes: 21844
package main

import "fmt"

func main() {
	var n, x int
	fmt.Scan(&n, &x)
	as := make([]int, n)
	for i := range as {
		fmt.Scan(&as[i])
	}

	ans := 0
	if v := as[0] - x; v > 0 {
		as[0] -= v
		ans += v
	}
	for i := 0; i < len(as)-1; i++ {
		if v := as[i] + as[i+1] - x; v > 0 {
			ans += v
			as[i+1] -= v
		}
	}
	fmt.Println(ans)
}


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

int main(){
    string s;
    cin >> s;
    bool flag = 0;
    if( s == "abc") flag = 1;
    else if( s == "acb") flag = 1;
    else if( s == "bac") flag = 1;
    else if( s == "bca") flag = 1;
    else if( s == "cab") flag = 1;
    else if( s == "cba") flag = 1;
    else flag = 0;

    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	
	long long banyakangka,i,angka[10005],j,k,sum;
	long long maximum, minimum;
	
	scanf ("%lld", &banyakangka);
	for (i=0;i<banyakangka;i++){
		scanf ("%lld", &angka[i]);
	}

//finding sum	
	sum=0;
	for (j=0;j<i;j++){
		sum = sum + angka[j]; 
	}
	
//finding max
	maximum = angka[0];
 
	for (k = 1; k < banyakangka; k++)
	{
    if (angka[k] > maximum)
    {
       maximum  = angka[k];
    }
	}

//finding min
	minimum = angka[0];
	
	for (k = 1; k < banyakangka; k++)
	{
    if (angka[k] < minimum)
    {
       minimum  = angka[k];
    }
	}

	printf ("%lld %lld %lld\n", minimum, maximum, sum);  
	
return 0;
}


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

string s;
int cnt[111111];

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

	int i, pt;

	cin >> s;

	for (i = 0; i < s.size(); i++)
		if (s[i] == 'L')
		{
			if ((i - pt) % 2)
				cnt[pt + 1]++;
			else
				cnt[pt]++;
		}
		else
			pt = i;

	for (i = s.size() - 1; i >= 0; i--)
		if (s[i] == 'L')
			pt = i;
		else
		{
			if ((pt - i) % 2)
				cnt[pt - 1]++;
			else
				cnt[pt]++;
		}

	for (i = 0; i < s.size(); i++)
		cout << cnt[i] << " ";
	return 0;
}

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

stack<int> bad;

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

	rep(i,n){
		int d;
		cin >> d;
		if(d>=a) 
			bad.push(d);
		else
			break;
	}

	if(n-bad.size()<m){
		while(1){
			if(bad.empty()|| bad.top()>b) break;
			bad.pop();
		}
	}

	cout << int(bad.size()) << endl;
	return 0;
}

Measured memory_bytes: 3096
#include <iostream>
#include <string>
#include <vector>
#include <set>

using namespace std;

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

	vector<int> accR(N + 1, 0);
	vector<int> accG(N + 1, 0);
	vector<int> accB(N + 1, 0);
	for (int i = 1; i <= N; ++i) {
		accR[i] = accR[i - 1] + (S[i - 1] == 'R');
		accG[i] = accG[i - 1] + (S[i - 1] == 'G');
		accB[i] = accB[i - 1] + (S[i - 1] == 'B');
	}

	long long ans = 0;

	for (int i = 0; i < N; ++i) {
		for (int j = i + 1; j + 1 < N; ++j) {
			set<char> rgb;
			rgb.insert('R');
			rgb.insert('G');
			rgb.insert('B');
			rgb.erase(S[i]);
			rgb.erase(S[j]);
			if (rgb.size() != 1) {
				continue;
			}
			int t = 0;
			char Sk = *rgb.begin();

			if (Sk == 'R') {
				t += accR[N] - accR[j + 1];
			}
			else if (Sk == 'G') {
				t += accG[N] - accG[j + 1];
			}
			else {
				t += accB[N] - accB[j + 1];
			}
			int x = j + (j - i);
			if (x < N && S[x] == Sk) {
				t -= 1;
			}
			ans += t;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 3660
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;


int main() {
    int n,k,s; cin>>n>>k>>s;
    if(n==k){
        rep(i,k-1) cout<<s<<" ";
        cout<<s<<endl;
    }
    else{
        rep(i,k) cout<<s<<" ";
        if(s>=3){
            rep(i,n-k-1) cout<<s-1<<" ";
            cout<<s-1<<endl;
        }
        else{
            rep(i,n-k-1) cout<<3<<" ";
            cout<<3<<endl;
        }
    }
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define DEBUG 1
using namespace std;

namespace output{
    void __(short x){cout<<x;}
    void __(unsigned x){cout<<x;}
    void __(int x){cout<<x;}
    void __(long long x){cout<<x;}
    void __(unsigned long long x){cout<<x;}
    void __(double x){cout<<x;}
    void __(long double x){cout<<x;}
    void __(char x){cout<<x;}
    void __(const char*x){cout<<x;}
    void __(const string&x){cout<<x;}
    void __(bool x){cout<<(x?"true":"false");}
    template<class S,class T>
    void __(const pair<S,T>&x){__(DEBUG?"(":""),__(x.first),__(DEBUG?", ":" "),__(x.second),__(DEBUG?")":"");}
    template<class T>
    void __(const vector<T>&x){__(DEBUG?"{":"");bool _=0;for(const auto&v:x)__(_?DEBUG?", ":" ":""),__(v),_=1;__(DEBUG?"}":"");}
    template<class T>
    void __(const set<T>&x){__(DEBUG?"{":"");bool _=0;for(const auto&v:x)__(_?DEBUG?", ":" ":""),__(v),_=1;__(DEBUG?"}":"");}
    template<class T>
    void __(const multiset<T>&x){__(DEBUG?"{":"");bool _=0;for(const auto&v:x)__(_?DEBUG?", ":" ":""),__(v),_=1;__(DEBUG?"}":"");}
    template<class S,class T>
    void __(const map<S,T>&x){__(DEBUG?"{":"");bool _=0;for(const auto&v:x)__(_?DEBUG?", ":" ":""),__(v),_=1;__(DEBUG?"}":"");}
    void pr(){cout<<"\n";}
    template<class S,class... T>
    void pr(const S&a,const T&...b){__(a);if(sizeof...(b))__(' ');pr(b...);}
}

using namespace output;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<int,char> pic;
typedef pair<double,double> pdd;
typedef pair<ld,ld> pld;
typedef vector<int> vi;
typedef vector<ll> vl;

#define pb push_back
#define fox(i,x,y) for(int i=(x);i<=(y);i++)
#define foxr(i,x,y) for(int i=(y);i>=(x);i--)

const int MN = 105;
int N, M, i, j, ans, dp[MN][MN];
string s[MN];

int solve(int x,int y){
    if(x==1&&y==1) return s[x][y]=='#';
    if(dp[x][y]!=-1) return dp[x][y];
    dp[x][y]=1<<30;
    if(s[x][y]=='#'){
        if(x>1) dp[x][y]=min(dp[x][y],solve(x-1,y)+(s[x-1][y]=='.'));
        if(y>1) dp[x][y]=min(dp[x][y],solve(x,y-1)+(s[x][y-1]=='.'));
    }
    else{
        if(x>1) dp[x][y]=min(dp[x][y],solve(x-1,y));
        if(y>1) dp[x][y]=min(dp[x][y],solve(x,y-1));
    }
    return dp[x][y];
}

int main(){
    scanf("%d%d",&N,&M);
    for(i=1;i<=N;i++){
        cin >> s[i];
        s[i].insert(s[i].begin(),' ');
    }
    memset(dp,-1,sizeof(dp));
    printf("%d\n",solve(N,M));
    return 0;
}


Measured memory_bytes: 384
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		ArrayList<String> slist = new ArrayList<>(0);

		for (int i = 0; i < n; i++) {
			String s = sc.next();
			int pi = 100 - sc.nextInt();
			String p = pi + "";
			if (p.length() == 2) {
				p = "0" + p;
			}
			if (p.length() == 1) {
				p = "00" + p;
			}


			slist.add(s + p);

		}

		Object[] result = slist.toArray();
		Arrays.sort(result);

		for (int i = 0; i < n; i++) {
			System.out.println(slist.indexOf(result[i]) + 1);
		}

	}

}


Measured memory_bytes: 22996
n = gets.chomp.split("")
ans=1
arr = gets.chomp.split(" ")

arr.each do |v|
  if v=="0"
    puts 0
    exit
  end
end
arr.each do |v|
  ans*=v.to_i
  if ans > 10**18
    puts -1
    exit
  end
end

if ans > 10**18
  puts -1
else
  puts ans
end

Measured memory_bytes: 25092
#include <iostream>

#define NMAX 100

int main() {
    int N, A[NMAX], i, j, key;
    std::cin >> N;
    
    for (i=0; i<N; i++) {
        std::cin >> A[i];
    }
    
    for (int k=0; k<N; k++) {
        std::cout << A[k];
        if (k<N-1) {
            std::cout << " ";
        } else {
            std::cout << std::endl;
        }
    }
    
    for (i=1; i<N; i++) {
        key = A[i];
        j = i - 1;
        while (j >= 0 && A[j] > key) {
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = key;
        
        for (int k=0; k<N; k++) {
            std::cout << A[k];
            if (k<N-1) {
                std::cout << " ";
            } else {
                std::cout << std::endl;
            }
        }
    }
}


Measured memory_bytes: 3108
n = int(input())
values = list(map(int, input().split()))

if n == 2:
    ans = (values[0] + values[1])/2
else:
    while len(values) > 1:
        values.sort()
        tmp = (values[0] + values[1])/2
        values.pop(0)
        values.pop(0)
        values.append(tmp)
    ans = values[0]

print(ans)

Measured memory_bytes: 9100
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;
int main(){
int n;
cin>>n;
int count=0;
int  ten =1;
int x,y;
x = n;
y = n;
for(int i=0;i<10;i++){
	n = n/10;
	if(n>=1){
	count++;
	ten *=10;
	}
	else{
	break;	
}


}
int sum = 0;

for(int i=count;0<=i;i--){
	
	sum+= x/ten;
	x = x%ten;
	ten = ten/10;
	
}

if(y%sum==0)
	cout<< "Yes" <<endl;
else
	cout<< "No" <<endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
vector<int> input(int N) {
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  return vec;
}

int main() {
  int a,b;
  cin >> a >> b;
  if(a<b){
    rep(i,b){
      cout << a;
    }
  }else{
    rep(i,a){
      cout << b;
    }
  }
  cout << endl;
}

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

using namespace std;

// we are looking for the max consecutive 1s
// if the [l, r] contains both 0s and 1s will make no sense
// since it won't be consecutive 1s after an operation
// Solution: two pointer!

int main()
{
    int n, k;
    scanf("%d %d", &n, &k);

    char inp[n + 3];
    scanf("%s", inp);
    int num[n];
    for (int i = 0; i < n; i++) {
        num[i] = inp[i] == '0' ? 0 : 1;
    }

    int l = 0;
    int ans = 0;
    int i = 0;
    // 111000111
    // 000111000
    // 000111
    // 111000
    while (i < n) {
        while (i < n && num[i] == 1)
            i++;
        ans = max(ans, i - l);
        while (i < n && num[i] == 0)
            i++;
        k--;
        if (k < 0) {
            while (l < n && num[l] == 1)
                l++;
            while (l < n && num[l] == 0)
                l++;
        }

        ans = max(ans, i - l);
    }

    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 768
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define PB push_back
#define MP make_pair

#define MOD 1000000007

string K;
int D;

LL dp[10001][100][2];
LL solve(int now, int sum, int giri){
	if(now == K.size()){
		if(sum == 0) return 1;
		else return 0;
	}
	if(dp[now][sum][giri] != -1) return dp[now][sum][giri];
	LL ret = 0;
	for(int i=0; i<10; i++){
		if(giri == 1 && K[now]-'0' < i) break;
		if(giri == 1 && K[now]-'0' == i) ret += solve(now+1, (sum+i)%D, 1);
		else ret += solve(now+1, (sum+i)%D, 0);
	}
	return dp[now][sum][giri] = ret % MOD;
}

int main(){
	cin >> K >> D;
	for(int i=0; i<K.size(); i++){
		for(int j=0; j<D; j++){
			for(int k=0; k<2; k++){
				dp[i][j][k] = -1;
			}
		}
	}
	cout << (solve(0, 0, 1) + MOD - 1) % MOD << endl;
}

Measured memory_bytes: 16640
#include <algorithm>
#include <iostream>
#include<cstdio>
#include<vector>
#include <functional>
#include<map>
using namespace std;
typedef long long ll;


int main() {

    int n;
    cin >> n;
    map<int, int> mp[2];
    for (int i = 0; i < n;i++){
        int x;
        cin >> x;
        mp[i & 1][x]++;
    }
    vector<pair<int, int>> cnt[2];
    for (int i = 0; i < 2;i++){
        for(auto &it :mp[i]){
            cnt[i].push_back({it.second, it.first});
        }
        if(cnt[i].size() == 1)
            cnt[i].push_back({0, -1});
        sort(cnt[i].rbegin(), cnt[i].rend());
    }
    int ans = 0;
    for (int i = 0; i < 2;i++)
        for (int j = 0; j < 2;j++)
            if(cnt[0][i].second != cnt[1][j].second)
                ans = max(ans, cnt[0][i].first + cnt[1][j].first);
    cout << n - ans;
    return 0;
}


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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repp(i, n, m) for(int (i) = (n); (i) < (m); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define ldou long double
#define fi first
#define se second
#define setpre(x) std::cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ std::cout << " [LOGGER] " << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , "; logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 100005;

/* ...o(^-^)o... */

int dp[1<<10][MAX];

int main(){
    int n; cin >> n;
    vector<int> v(n+1), w(n+1);
    rep(i, n) cin >> v[i+1] >> w[i+1];
    
    int q; cin >> q;
    vector<int> u(q), l(q);
    rep(i, q) cin >> u[i] >> l[i];

    int k = 0;
    while(n > 0){
        n /= 2; k++;
    }
    k /= 2;
    repn(i, 1<<k) dp[i][0] = 0;
    rep(x, MAX) dp[0][x] = 0;

    repn(i, 1<<k) repn(x, 100000){
        dp[i][x] = max(dp[i/2][x], dp[i][x-1]);
        if(x-w[i]>=0) dp[i][x] = max(dp[i][x], dp[i/2][x-w[i]]+v[i]);
    }

    rep(i, q){
        vector<int> s;
        while(u[i] >= (1<<k)){
            s.push_back(u[i]);
            u[i] /= 2;
        }
        int res = 0;
        rep(j, 1<<(s.size())){
            int sv = 0, sw = 0;
            rep(d, s.size()){
                if(j & (1<<d)){
                    sv += v[s[d]];
                    sw += w[s[d]];
                }
            }
            if(sw > l[i]) continue;
            res = max(res, sv + dp[u[i]][l[i]-sw]);
        }
        out(res);
    }
}

Measured memory_bytes: 206532
#include<bits/stdc++.h>
using namespace std;
char s[100100];
int a[100100],la;
int main(){
	scanf("%s",s+1);
	int n=strlen(s+1);
	for(int i=n;i>=1;i--){
		if(s[i]=='L')la=i;
		else a[la-((la-i)&1)]++;
	}
	for(int i=1;i<=n;i++){
		if(s[i]=='R')la=i;
		else a[la+((i-la)&1)]++;
	}
	for(int i=1;i<=n;i++) printf("%d ",a[i]);
	return 0;
}

Measured memory_bytes: 896
/** Still TBD
  *
  */
object Main extends App {
  final private val DELIMITER = "/"
  val input = io.StdIn.readLine.split(DELIMITER)
  val year = input(0).toInt
  val month = input(1).toInt
  val day = input(2).toInt

  if (year > 2019) println("TBD")
  else if (year == 2019 && month >= 5) println("TBD")
  else if (year == 2019 && month == 4 && day > 30) println("TBD")
  else println("Heisei")
}

Measured memory_bytes: 27296
#include <functional>
#include <iostream>
#include <vector>
using namespace std;

template <typename S>   //semi group
struct UnionFind
{
    using F = function<S(S, S)>;
    
    const F f;
    
    vector<int> par, rank;
    vector<S> dat;
    
    UnionFind(int n, const F f = [](S a, S b){return a + b;}, const S e = 1) : f(f){
        par.resize(n);
        rank.resize(n);
        dat.assign(n, e);
        for(int i = 0; i < n; i++){
            par[i] = i;
            rank[i] = 0;
        }
    }
    
    int find(int i){
        if(i == par[i]) return i;
        return par[i] = find(par[i]);
    }
    
    bool same(int i, int j){
        return find(i) == find(j);
    }
    
    void unite(int i, int j){
        if(same(i, j)) return;
        i = find(i), j = find(j);
        if(rank[i] < rank[j]){
            par[i] = j;
            dat[j] = f(dat[i], dat[j]);
        }
        else{
            par[j] = i;
            dat[i] = f(dat[i], dat[j]);
            if(rank[i] == rank[j]) rank[i]++;
        }
    }
    
    S query(int i){
        return dat[find(i)];
    }
};

int main()
{
    int n, m;
    cin >> n >> m;
    UnionFind<int> uf(n);
    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        uf.unite(a, b);
    }
    int ans = 0;
    for(int i = 0; i < n; i++) ans = max(ans, uf.query(i));
    cout << ans << endl;
}


Measured memory_bytes: 5620
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int N, K; cin >> N >> K;
    vector<int> X(N);
    for(int& x:X) cin >> x;
    
    int ans = 1<<30;
    for(int i=0; i<N-K+1; i++){
        int t;
//        if(X[i]*X[i+K-1]>0) t = max(abs(X[i]), abs(X[i+K-1]));
//        else t = 2*min(abs(X[i]), abs(X[i+K-1])) + max(abs(X[i]), abs(X[i+K-1]));
        t = min(abs(X[i])+abs(X[i]-X[i+K-1]), abs(X[i+K-1])+abs(X[i]-X[i+K-1]));
        ans = min(ans, t);
    }
    
    cout << ans << endl;
}


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

int w, h;
//3?????????0:???????????§???????????? 1:???????????§???????????? 2:???????????§??????????????? 3:???????????§???????????????
int dp[101][101][4];

signed main()
{
	while (true)
	{
		cin >> w >> h;
		if (w == 0 && h == 0) break;

		for (int i=2; i<=w; i++) {
			dp[1][i][0] = 1;
			dp[1][i][1] = 0;
			dp[1][i][2] = 0;
			dp[1][i][3] = 0;
		}

		for (int i=2; i<=h; i++) {
			dp[i][1][0] = 0;
			dp[i][1][1] = 1;
			dp[i][1][2] = 0;
			dp[i][1][3] = 0;
		}

		for (int i=2; i<=w; i++) {
			for (int j=2; j<=h; j++) {
				dp[j][i][0] = (dp[j][i-1][0] + dp[j][i-1][2]) % 100000;
				dp[j][i][1] = (dp[j-1][i][1] + dp[j-1][i][3]) % 100000;
				dp[j][i][2] = (dp[j][i-1][1]) % 100000;
				dp[j][i][3] = (dp[j-1][i][0]) % 100000;
			}
		}

		int ans = 0;
		rep(i,4) {
			ans += dp[h][w][i];
			ans %= 100000;
		}

		cout << ans << endl;
	}
}

Measured memory_bytes: 1320
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String []args) throws IOException {
    	FastScanner in  = new FastScanner(System.in);
    	PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);
    	solve(in, out);
    	in.close();
    	out.close();
    }
    static long gcd(long a, long b){ return (b==0) ? a : gcd(b, a%b); }
    static int gcd(int a, int b){ return (b==0) ? a : gcd(b, a%b); }
    
    public static int[] generatePrimes(int n) {
		boolean[] prime = new boolean[n + 1];
		Arrays.fill(prime, 2, n + 1, true);
		for (int i = 2; i * i <= n; i++)
			if (prime[i])
				for (int j = i * i; j <= n; j += i)
					prime[j] = false;
		int[] primes = new int[n + 1];
		int cnt = 0;
		for (int i = 0; i < prime.length; i++)
			if (prime[i])
				primes[cnt++] = i;
		return Arrays.copyOf(primes, cnt);
	}
    static class FastScanner{
	BufferedReader reader;
	StringTokenizer st;
	FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}
	String next(){while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}
	     st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
	String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}
	int    nextInt()   {return Integer.parseInt(next());}
	long   nextLong()  {return Long.parseLong(next());}
	double nextDouble(){return Double.parseDouble(next());}
	char   nextChar()  {return next().charAt(0);}
	int[]  nextIntArray(int n)         {int[] arr= new int[n];   int i=0;while(i<n){arr[i++]=nextInt();}  return arr;}
	long[] nextLongArray(int n)        {long[]arr= new long[n];  int i=0;while(i<n){arr[i++]=nextLong();} return arr;}
	int[]  nextIntArrayOneBased(int n) {int[] arr= new int[n+1]; int i=1;while(i<=n){arr[i++]=nextInt();} return arr;}
	long[] nextLongArrayOneBased(int n){long[]arr= new long[n+1];int i=1;while(i<=n){arr[i++]=nextLong();}return arr;}
	void   close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}
    }
    
    /********* SOLUTION STARTS HERE ************/
    
    private static void solve(FastScanner in, PrintWriter out){
        
        int n = in.nextInt();
        int a[] = new int[n];
        for(int i=0;i<n;i++) a[i] = in.nextInt();
        int cost[] = new int[n];
        cost[0] = 0;
        cost[1] = (int)Math.abs(a[1]-a[0]);
        for(int i=2;i<n;i++){
            cost[i] = (int) Math.min(Math.abs(a[i]-a[i-2]),Math.abs(a[i]-a[i-1]));
            cost[i] = Math.min( cost[i-1]+Math.abs(a[i]-a[i-1]), cost[i-2]+Math.abs(a[i]-a[i-2]) );
        }
        out.println(cost[n-1]);
    }
    
    /************* SOLUTION ENDS HERE **********/
}

Measured memory_bytes: 31840
//41
#include<iostream>
#include<algorithm>
#include<vector>

#define S(X) ((X)*(X))

using namespace std;

int main(){
  for(int a[2];cin>>a[0]>>a[1],a[0]|a[1];){
    vector<int> p[2];
    for(int i=0;i<2;i++){
      for(int j=1;j*j<=a[i];j++){
	if(a[i]%j==0){
	  p[i].push_back(j);
	}
      }
    }
    int m=1<<30;
    for(int i=0;i<p[0].size();i++){
      for(int j=0;j<p[1].size();j++){
	int n[4]={p[0][i],a[0]/p[0][i],p[1][j],a[1]/p[1][j]};
	sort(n,n+4);
	int c=0;
	for(int k=0;k<3;k++){
	  c+=S(n[k+1]-n[k]);
	}
	m=min(m,c);
      }
    }
    cout<<m<<endl;
  }
  return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
#define int long long
#define uint unsigned int
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repr(i, a, b) for (int i = a; i >= b; i--)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sz(a) (a).size()
#define pb(a) push_back(a)
#define eb(...) emplace_back(__VA_ARGS__)
#define mp(a, b) make_pair(a, b)
#define mt(...) make_tuple(__VA_ARGS__)
using namespace std;
using pii = pair<int, int>;
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
constexpr int MOD = 1000000007;
constexpr int INF = 1LL << 30;
constexpr double EPS = 1e-10;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int N, H, W;
  cin >> N >> H >> W;
  int ans = 0;
  rep(i, 0, N) {
    int A, B;
    cin >> A >> B;
    ans += (A >= H && B >= W);
  }
  cout << ans << endl;

  return 0;
}

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

using namespace std;

int main()
{
    int N;

    cin >> N ;

    double a;

    if(N % 2 == 0){
        a= 0.5000000;
    }else{
        int b = N/2 + 1;
        a = (double)b/N;
    }

    cout << a << endl;



    return 0;
}

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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

signed main(){

	lli n;
	cin>>n;

	vector<lli> a(n);

	lli num = 0;
	lli index=0;
	REP(i,0,n){
		cin>>a[i];
		if(abs(num)<abs(a[i])){
			num = a[i];
			index = i;
		}
	}

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

	cout<<2*n - 1<<endl;
	REP(i,0,n){
		cout<<index+1<<" "<<i+1<<endl;
	}
	if(num>0){

		REP(i,0,n-1){

			cout<<i+1<<" "<<i+2<<endl;
		}
	}
	else{
		for(lli i=n-1;i>=1;i--){
			cout<<i+1<<" "<<i<<endl;
		}
	}




	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b;
  cin >>a>>b;
  if(a>=13){
      cout << b <<endl;
  }
  else if(a>=6){
      cout << b/2 <<endl;
  }
  else{
      cout << 0 <<endl;
  }
}

Measured memory_bytes: 256
S=input()
a=int(S[0])
b=int(S[1])
c=int(S[2])
d=int(S[3])
def operation(a,b,t):    
    if t==0:return a+b
    else:return a-b
def converter(t):
    if t==0:return "+"
    else:return "-"
e=0
f=0
g=0
for x in range(2):
    for y in range(2):
        for z in range(2):
            e=operation(a,b,x)
            f=operation(e,c,y)
            g=operation(f,d,z)
            if g==7:
                print(str(a)+converter(x)+str(b)+converter(y)+str(c)+converter(z)+str(d)+"=7")
                exit()

Measured memory_bytes: 3064
fun main(args: Array<String>) {
  val (H1, M1, H2, M2, K) = readInts()
  val m1 = H1 * 60 + M1
  val m2 = H2 * 60 + M2
  val m = m2 - m1
  println(m - K)
}

fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readLong() = readString().toLong()
fun readInts() = readStrings().map { it.toInt() }
fun readLongs() = readStrings().map { it.toLong() }


Measured memory_bytes: 36456
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;

int N, M;

int bisearch(vector<long long int> &Arr, long long int c, int start, int end){
  int b = (start + end) /2;
  if(Arr[b] == c) return b;
  else{
    if(Arr[b] < c) return bisearch(Arr ,c ,b+1, end);
    else if (Arr[b] > c) return bisearch(Arr,c,start,b-1);
  }
}

int main(){
  cin >> N >> M;
  
  vector<int> P(M);
  vector<long long int> Y(M);
  
  for(int i = 0; i < M; i++){
    int a = 0;
    long long int b = 0;
    cin >> a >> b;
    P[i] = a;
    Y[i] = b;
  }
  map<int,vector<long long int>> cities;
  for(int i = 0; i < M; i++){
    cities[P[i]].push_back(Y[i]);
  }
  for(int i = 1; i < N+1; i++){
    if(cities.count(i) == 0) continue;
    sort(cities[i].begin() ,cities[i].end());
  }
  for(int i = 0; i < M; i++){
    long long int a;
    a = bisearch(cities[P[i]],Y[i],0,cities[P[i]].size() - 1);
    a++;
    printf("%012lld\n",(long long int)P[i]*1000000 + a);
    a = 0LL;
  }
}


Measured memory_bytes: 13568
(defun simple (d c s)
  (declare (ignore c))
  (loop :for i :from 1 :to d
        :do (let ((con 1))
              (loop :for j :from 2 :to 26
                    :if (> (aref s i j) (aref s i con))
                    :do (setf con j))
              (format t "~A~%" con)))) 

(defun main (d c s)
  (simple d c s))

(let* ((d (read))
       (c (make-array '(27)))
       (s (make-array (list (1+ d) 27))))
  ; read
  (loop :for i :from 1 :to 26
        :do (setf (aref c i) (read)))
  (loop :for i :from 1 :to d
        :do (loop :for j :from 1 :to 26
                  :do (setf (aref s i j) (read))))
  (main d c s))


Measured memory_bytes: 29804
<?php

fscanf(STDIN,"%d",$n);
$x=$n%100%10;
switch ($x) {
    case 2;
    case 4;
    case 5;
    case 7;
    case 9;
    echo "hon";
    break;
    case 0;
    case 1;
    case 6;
    case 8;
    echo "pon";
    break;
    case 3;
    echo "bon";
}

Measured memory_bytes: 16104
S = input()
T = input()


def f(begin, txt, query):
    for i in range(len(query)):
        if (txt[begin+i] == '?') or (txt[begin+i] == query[i]):
            pass
        else:
            return False
    return True


def g(begin, txt, query):
    tmp = list(txt)
    for i in range(len(tmp)):
        if tmp[i] == '?':
            tmp[i] = 'a'
    for i in range(len(query)):
        tmp[begin+i] = query[i]
    return ''.join(tmp)


flag = False

for i in range(len(S) - len(T) + 1):
    if f(len(S) - i - len(T), S, T):
        S = g(len(S) - i - len(T), S, T)
        flag = True
        break

if flag is False:
    print('UNRESTORABLE')
else:
    print(S)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>

#define rep(i,n) for (long long int i = 0; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define INF 100000000000
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using P = pair<int, int>;

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

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

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

int main()
{
    ll n, k;
    cin >> n >> k;
    vector<ll> h(n);
    rep(i,n) cin >> h[i];
    sort(h.begin(), h.end());
    ll ans = INF;
    rep(i,n-k+1) {
        ans = min(ans, h[i+k-1] - h[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] scoreList = new int[N];
		for (int i = 0; i < N; i++) {
			scoreList[i] = sc.nextInt();
		}

		int[] rate = new int[9];
		for (int score : scoreList) {
			if (1 <= score && score < 400) {
				rate[0] = 1;
			}
			if (400 <= score && score < 800) {
				rate[1] = 1;
			}
			if (800 <= score && score < 1200) {
				rate[2] = 1;
			}
			if (1200 <= score && score < 1600) {
				rate[3] = 1;
			}
			if (1600 <= score && score < 2000) {
				rate[4] = 1;
			}
			if (2000 <= score && score < 2400) {
				rate[5] = 1;
			}
			if (2400 <= score && score < 2800) {
				rate[6] = 1;
			}
			if (2800 <= score && score < 3200) {
				rate[7] = 1;
			}
			if (3200 <= score) {
				rate[8] += 1;
			}
		}
		int min = 0;
		for (int i = 0; i < 8; i++) {
			min += rate[i];
		}
		if (min == 0 && rate[8] > 0) {
			System.out.print(1 + " ");
		} else {
			System.out.print(min + " ");
		}
		int max = min + rate[8] ;
		System.out.print(max);
	}

}


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

using namespace std;

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

    bool flag = true;
    map<char, char> f, g;
    for (int i = 0; i < S.size(); ++i) {
        char s = S[i], t = T[i];
        if (f.count(s) and f[s] != t) flag = false;
        if (g.count(t) and g[t] != s) flag = false;
        f[s] = t;
        g[t] = s;
    }

    if (flag) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 776
#include<algorithm>
#include<climits>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<utility>
#include<vector>
 
#define lint long long
#define VI vector<int>
#define VL vector<lint>
#define VC vector<char>
#define VS vector<string>
#define VVI vector<VI>
#define rep(i, n) for(int i = 0 ; i < n ; i++)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX

using namespace std;

int main(){
    int n, l;
    cin >> n >> l;
    VS s(n);
    rep(i, n){
        cin >> s[i];
    }
    SORT(s);
    rep(i, n){
        cout << s[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
PROGRAM ATCODER

implicit none
integer :: n, k, i, j
integer, allocatable :: a(:,:), dp(:,:)

read(*,*) n
allocate(a(n,3), dp(n,3))
do i = 1, n
	read(*,*) (a(i,j), j=1,3)
end do

dp = 0
dp(1,1) = a(1,1)
dp(1,2) = a(1,2)
dp(1,3) = a(1,3)

do i = 2, n
	do j = 1, 3
    	do k = 1, 3
			if (j /= k)then
        		call chmax(dp(i,j), dp(i-1,k)+a(i,j))
        	end if
        end do
    end do
end do

write(*,'(i0)') maxval(dp)

END PROGRAM ATCODER

subroutine chmax(dp,x)
implicit none
integer :: dp, x

if (dp < x) then
	dp = x
	return
end if

end subroutine

Measured memory_bytes: 2560
import sys
input = sys.stdin.readline

A,B = map(int,input().split())

def xor(x,length):
    if x < 0: return 0
    x+=1
    ans = 0
    for i in range(length):
        loop = 2**(i+1)
        cnt = x//loop*loop//2
        cnt += max(0,x%loop - loop//2)
        if cnt%2==1:
            ans+=(1<<i)

    return ans
a=format(A,"b")
b=format(B,"b")
a=list(a)
b=list(b)
alength = len(a)
blength = len(b)
print(xor(B,blength)^xor(A-1,alength))

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define max 100005
using ll =long long;
using namespace std;

int k;
vector<ll> v;

void dfs(vector<int> &A){
    ll ele=0;
    rep(i,A.size()){
        ele+=A[i]*pow(10,A.size()-1-i);
    }
    v.push_back(ele);

    if(A.size()==10)return;
    int j,l;
    if(A.back()==0){
        j=0;l=1;
    }else if(A.back()==9){
        j=1;l=0;
    }else{
        j=1;l=1;
    }
    for(int i=(A.back()-j);i<=A.back()+l;i++){
        A.push_back(i);
        dfs(A);
        A.pop_back();
    }
}

int main(){
    cin>>k;
    for(int i=1;i<10;i++){
        vector<int> A(1,i);
        dfs(A);
    }
    sort(v.begin(),v.end());
    /*
    for(auto itr=v.begin();itr!=v.end();itr++){
        cout<<*itr<<endl;
    }
    //*/
    cout<<v[k-1]<<endl;
}

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

using namespace std;
using vi = vector<int>;

int bunsum(const vi &a, int ave)
{
    int sum = 0;
    for (size_t i = 0; i < a.size(); i++)
    {
        int d = ave - a[i];
        sum += d*d;
    }
    return sum;
}

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

    int ans = 99999999;
    for (int x = -100; x <= 100; x++)
    {
        int sum = 0;
        for (size_t i = 0; i < a.size(); i++)
        {
            int d = x - a[i];
            sum += d*d;
        }
        ans = min(ans, sum);
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
// D - .. (Double Dots)
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define rp(i,s,e) for(int i=(int)(s);i<(int)(e);++i)

int main(){
	int N,M; cin>>N>>M;
	vector<vi> V(N);
	rp(i, 0, M){
		int a,b; cin>>a>>b; --a,--b;
		V[a].push_back(b);
		V[b].push_back(a);
	}
	vi ans(N, -1);
	queue<int> q;
	q.push(0);
	while(q.size()){
		int p = q.front(); q.pop();
		for(int c:V[p])
			if(c>0 && ans[c]<0){ ans[c] = p; q.push(c); }
	}
	puts("Yes");
	rp(i, 1, N) cout<< ans[i]+1 <<endl;
}


Measured memory_bytes: 10160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    const ll inf = LONG_LONG_MAX / 2 - 1;
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    multiset<ll> clr;
    rep(i, n) {
        if (sz(clr) == 0) {
            clr.insert(a[i]);
            continue;
        }
        auto it = clr.lower_bound(a[i]);
        if (it == clr.begin()) {
            clr.insert(a[i]);
            continue;
        }
        it--;
        clr.erase(it);
        clr.insert(a[i]);
    }
    cout << sz(clr) << endl;
    return 0;
}


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

#define INF INT_MAX/2;
#define MOD 1000000007

using namespace std;

using ll = long long;
using ull = unsigned long long ;

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

   int A,B,C;
   cin>>A>>B>>C;
   if(A==B)cout<<C;
   else if(B==C)cout<<A;
   else if(C==A)cout<<B;
   return 0; 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
int main()
{
    int n, m, q;
    cin >> n >> m >> q;
    vector<vector<char>> s(n, vector<char>(m));
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < m; j++) cin >> s[i][j];
    }
    vector<vector<int>> v(n+1, vector<int>(m+1, 0));
    vector<vector<int>> ve(n+1, vector<int>(m+1, 0));
    vector<vector<int>> ho(n+1, vector<int>(m+1, 0));
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < m; j++)
        {
            v[i+1][j+1] = v[i+1][j] + v[i][j+1] + (s[i][j] - '0') - v[i][j];
            ho[i+1][j+1] = ho[i+1][j] + ho[i][j+1] - ho[i][j];
            ve[i+1][j+1] = ve[i+1][j] + ve[i][j+1] - ve[i][j];
            if(j > 0 && s[i][j-1] == '1' && s[i][j] == '1') ho[i+1][j+1]++;
            if(i > 0 && s[i-1][j] == '1' && s[i][j] == '1') ve[i+1][j+1]++;
        }
    }

    for(int i = 0; i < q; i++)
    {
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        int honum = ho[x2][y2] - ho[x2][y1] - ho[x1-1][y2] + ho[x1-1][y1];
        int venum = ve[x2][y2] - ve[x2][y1-1] - ve[x1][y2] + ve[x1][y1-1];
        x1--;y1--;
        int vnum = v[x2][y2] - v[x2][y1] - v[x1][y2] + v[x1][y1];
        //cout << vnum << " " << honum << " " << venum << endl;
        cout << vnum - honum - venum << endl;
    }
}


Measured memory_bytes: 54436
#include "bits/stdc++.h"
using namespace std;
#define repi(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)
#define rep(i,n) repi(i,0,n)
#define all(x) (x).begin(),(x).end()
#define tsort(v) sort((v).begin(), (v).end())
#define trev(v) reverse((v).begin(), (v).end())
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define pop(v) (v).back(); (v).pop_back()
#define el "\n"
#define co(x) cout<<(x)<<el
#define coc(c, a, b) if(c)co((a));else co((b))
#define YES(c) coc(c,"YES", "NO")
#define Yes(c) coc(c,"Yes", "No")
#define yes(c) coc(c,"yes", "no")
#ifdef tqktmp_1
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif
typedef long long lint;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

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

    lint n, a, b;
    cin>>n>>a>>b;
    co(min(a*n, b));
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
typedef long long ll;
typedef long double ld;
using namespace std;

ll root(ll x){
	ll ng=0, ok=(2e9)+100;
	while(ng+1<ok){
		ll mid=ng+(ok-ng)/2;
		if(mid%2==0){
			if((mid/2)*(mid/2)>x) ok=mid;
			else ng=mid;
		}else{
			if((mid/2)*(mid/2+1)>=x) ok=mid;
			else ng=mid;
		}
	}
	return ok;
}

int main() {
	ll a, b, c;
	cin >> a >> b >> c;
	cout << (a+b<=c-root(a*b) ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {

	int diceo[6];
	int dicet[6];
	int copy[4];
	int tatea[7] = { 0, 1, 5, 4, 0, 1, 5 };
	int tateb[7] = { 0, 4, 5, 1, 0, 4, 5 };
	int yokoa[7] = { 1, 2, 4, 3, 1, 2, 4 };
	int yokob[7] = { 1, 3, 4, 2, 1, 3, 4 };
	int hokaa[7] = { 0, 2, 5, 3, 0, 2, 5 };
	int hokab[7] = { 0, 3, 5, 2, 0, 3, 5 };
	int ue[6] = { 2, 3, 0, 5, 4, 1 };
	int sita[6] = { 3, 2, 5, 0, 1, 4 };
	int choice[7];
	int co = 0;
	int coo = 0;
	int cot = 0;
	int i, j, k;

	for (i = 0; i < 6; i++) {
		scanf("%d", &diceo[i]);
		coo += diceo[i];
	}

	for (i = 0; i < 6; i++) {
		scanf("%d", &dicet[i]);
		cot += dicet[i];
	}

	for (i = 0; i < 6; i++) {
		for (j = 0; j < 7; j++) {
			switch (i) {
			case 0:choice[j] = tatea[j];
				break;
			case 1:choice[j] = tateb[j];
				break;
			case 2:choice[j] = yokoa[j];
				break;
			case 3:choice[j] = yokob[j];
				break;
			case 4:choice[j] = hokaa[j];
				break;
			case 5:choice[j] = hokab[j];
				break;
			}
		}
		for (j = 0; j < 4; j++) {
			for (k = 0; k < 4; k++) {
				copy[k] = choice[k + j];
			}
			for (k = 0; k < 4; k++) {
				coo = diceo[yokoa[k]];
				cot = dicet[copy[k]];
				if (coo == cot) co++;
			}
			if (co == 4) {
				if (diceo[0] == dicet[ue[i]]) co++;
				if (diceo[5] == dicet[sita[i]]) co++;
			}
			if (co == 6) {
				printf("Yes\n");
				return 0;
			}
			co = 0;
		}
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    ll n, x;
    cin >> n >> x;
    ll b[n], l[n], u[n];
    ll y = 0;
    vector<P> v(n);
    rep(i,n){
        cin >> b[i] >> l[i] >> u[i];
        y += b[i] * l[i];
        v[i].first = l[i]*b[i] + u[i]*(x-b[i]);
        v[i].second = i;
    }
    sort(v.begin(), v.end(), greater<P>());
    if(y == 0){
        cout << 0 << endl;
        return 0;
    }
    ll sum[n] = {};
    int f[n] = {};
    rep(i,n){
        if(i > 0) sum[i] += sum[i-1];
        sum[i] += v[i].first;
        f[v[i].second] = i;
    }

    ll INF = 1001001001001001001;
    ll ans = INF;

    rep(i,n){
        ll z = l[i]*b[i] + u[i]*(x-b[i]);
        if(z >= y){
            ll yy = y;
            if(l[i]*b[i] >= yy){
                ans = min(ans, (yy-1)/l[i]+1);
            }else{
                yy -= l[i]*b[i];
                ans = min(ans, b[i]+(yy-1)/u[i]+1);
            }
            continue;
        }
        if(sum[f[i]] >= y){
            int le = 0, ri = f[i];
            while(le+1<ri){
                int m = (le+ri)/2;
                ll tmp = sum[m-1] + z;
                if(tmp >= y){
                    ri = m;
                }else{
                    le = m;
                }
            }
            ll yy = y - sum[ri-1];
            if(yy <= 0){
                ans = min(ans, ri*x);
            }else if(l[i]*b[i] >= yy){
                ans = min(ans, ri*x+(yy-1)/l[i]+1);
            }else{
                yy -= l[i]*b[i];
                ans = min(ans, ri*x+b[i]+(yy-1)/u[i]+1);
            }
        }else{
            int le = f[i], ri = n;
            while(le+1<ri){
                int m = (le+ri)/2;
                ll tmp = sum[m-1];
                if(tmp >= y){
                    ri = m;
                }else{
                    le = m;
                }
            }
            ll yy = y - (sum[ri-1]-z);
            if(yy <= 0){
                ans = min(ans, (ri-1)*x);
            }else if(l[i]*b[i] >= yy){
                ans = min(ans, (ri-1)*x+(yy-1)/l[i]+1);
            }else{
                yy -= l[i]*b[i];
                ans = min(ans, (ri-1)*x+b[i]+(yy-1)/u[i]+1);
            }
        }
    }

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




Measured memory_bytes: 8260
#include<bits/stdc++.h>
#define pb push_back
#define int long long int
using namespace std;
signed main()
{
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   
    string s,t; cin>>s>>t;
    t.pop_back();
    if(s==t)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3680
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int MAXN = 2e5 + 5;

int a[MAXN], b[MAXN];

int main(void)
{
	int n;
	scanf("%d",&n);
	for(int i=1; i<=n; ++i) scanf("%d",&a[i]);
	for(int i=1; i<=n; ++i) scanf("%d",&b[i]);
	
	static int freqa[MAXN], freqb[MAXN];
	for(int i=1; i<=n; ++i)
		++freqa[a[i]],
		++freqb[b[i]];
	for(int i=1; i<=n; ++i)
		if(freqa[i] + freqb[i] > n)
		{
			printf("No\n");
			return 0;
		}
	
	reverse(b+1,b+n+1);
	vector<int> same;
	int val = -1;
	for(int i=1; i<=n; ++i)
		if(a[i] == b[i])
			val = a[i],
			same.push_back(i);
	
	if(val != -1)
	{
		for(int i=1; i<=n && !same.empty(); ++i)
			if(a[i] != val && b[i] != val)
				swap(b[i], b[same.back()]),
				same.pop_back();
	}
	
	printf("Yes\n");
	for(int i=1; i<=n; ++i)
		printf("%d ",b[i]);
	return 0;
}

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

int main()
{
	ios::sync_with_stdio(false);
	
	int a,b,c;
	cin>>a>>b>>c;
	
	if(a+b>=c)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	 
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String W = scan.next();
        int count = 0;
        while(scan.hasNext()) {
            String str = scan.next();
            if(str.equals("END_OF_TEXT")){
            	break;
            }
            if(str.equalsIgnoreCase(W)){
            	count++;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 18036
import math

a, b, c = [int(x) for x in input().split()]


hf = (a*a*b)/2
ans = 0
if c <= hf :
	x = ( 2*c )/(a*b)
	ans = math.atan(b/x)
else:
	x = ( 2*(a*a*b - c) )/(a*a)
	ans = math.atan(x/a)

print(math.degrees(ans))

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		//n+1 C k - (l-1+n-r C k-1)
		int n = sc.nextInt();
		boolean[] isUsed = new boolean[(int) (n + 10)];
		long[] arr = new long[(int) (n + 1)];
		long key = 0;
		for (int i = 0; i <= n; i++) {
			arr[i] = sc.nextInt();
			if (!isUsed[(int) arr[i]]) {
				isUsed[(int) arr[i]] = true;
			} else {
				key = arr[i];
			}
		}
		int state = 0;
		int right = 0;
		int end = 0;
		for (long i : arr) {
			if (i == key) {
				state++;
				continue;
			}
			if (state == 0) {
				right++;
			} else if (state == 2) {
				end++;
			}
		}
		int mod = 1000000007;
		int[][] fif = enumFIF(1000000, mod);
		for (int i = 1; i <= n + 1; i++) {
			long ans = C(n+1, i, mod, fif) - C(right+end, i-1, mod, fif);
			System.out.println((ans+mod) % mod);
		}
	}

	public static long C(int n, int r, int mod, int[][] fif) {
		if (n < 0 || r < 0 || r > n)
			return 0;
		return (long) fif[0][n] * fif[1][r] % mod * fif[1][n - r] % mod;
	}

	public static int[][] enumFIF(int n, int mod) {
		int[] f = new int[n + 1];
		int[] invf = new int[n + 1];
		f[0] = 1;
		for (int i = 1; i <= n; i++) {
			f[i] = (int) ((long) f[i - 1] * i % mod);
		}
		long a = f[n];
		long b = mod;
		long p = 1, q = 0;
		while (b > 0) {
			long c = a / b;
			long d;
			d = a;
			a = b;
			b = d % b;
			d = p;
			p = q;
			q = d - c * q;
		}
		invf[n] = (int) (p < 0 ? p + mod : p);
		for (int i = n - 1; i >= 0; i--) {
			invf[i] = (int) ((long) invf[i + 1] * (i + 1) % mod);
		}
		return new int[][] { f, invf };
	}
}

Measured memory_bytes: 65676