akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
ll inf = 1e10;
ll w[105], v[105];
ll dp[300005];
ll h[200005];
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	int count = 0;
	
	int ans =0;
	for (int i = 0; i < n - 1; i++) {
		if (h[i + 1] <= h[i]) {
			count++;
		}
		else {
			ans = max(ans, count);
			count = 0;
		}
	}
	ans = max(ans, count);
	cout << ans << endl;
	return 0;
}

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

typedef long long ll;
using namespace std;

ll H;

ll count(ll h) {
    if (h == 1) {
        return 1;
    }
    return 2 * count(h/2) + 1;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> H;
    cout << count(H) << endl;
    return 0;
}


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

int main() {
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    set<char> x, y;
    for (int j = 0; j <= i; ++j) {
      x.insert(s[j]);
    }
    for (int j = i+1; j < n; ++j) {
      y.insert(s[j]);
    }
    vector<char> v(n);
    auto it = set_intersection(x.begin(), x.end(), y.begin(), y.end(), v.begin());
    v.resize(it-v.begin());
    // cout << v.size() << endl;
    // for (auto it : v) {
    //   cout << it <<  ' ';
    // } cout << endl;
    ans = max(ans, (int)v.size());
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n,m;
  cin >> n >> m;
  if (n % 2 == 1) {
    rep(i,m) {
      cout << i+1 << " " << n-i-1 << "\n";
    }
  }
  else {
    int ind_e = 1, ind_o = n;
    for (int i = (n-2)/2; i > (n-2)/2-m; --i) {
      if (i % 2 == 0) {
        cout << ind_e << " " << ind_e+i << "\n";
        ind_e++;
      }
      else {
        cout << ind_o << " " << ind_o-i << "\n";
        ind_o--;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3604
#include<iostream>
#include<vector>
 
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
 
using namespace std;
 
typedef long long int lli;
 
const int mod = 1000000007;
 
int main(){
  lli N, A, B;
  cin >> N >> A >> B;
  vector<int> X(N);
  REP (i, 0, N) cin >> X[i];
  lli ans = 0;
  REP (i, 0, N - 1) {
    ans += min((X[i + 1] - X[i]) * A, B);
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>
#include <string.h>

using namespace std;
typedef long long ll;

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

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

  ll sum = 0, cnt1 = 0, cnt2 = 0;
  for (int i = 0; i < n; i++) {
    sum += vec[i];
    if (i % 2 == 0 && sum <= 0) {
      cnt1 += abs(1 - sum);
      sum = 1;
    }
    if (i % 2 == 1 && sum >= 0) {
      cnt1 += abs(-1 - sum);
      sum = -1;
    }
  }

  sum = 0;
  for (int i = 0; i < n; i++) {
    sum += vec[i];
    if (i % 2 == 0 && sum >= 0) {
      cnt2 += abs(-1 - sum);
      sum = -1;
    }
    if (i % 2 == 1 && sum <= 0) {
      cnt2 += abs(1 - sum);
      sum = 1;
    }
  }
  cout << min(cnt1,cnt2) << endl;
  return 0;
}


Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int arr[200000];
int main(){
  int N,allxor = 0;
  cin >> N;
  for(int i = 0;i < N;i++){
    cin >> arr[i];
    allxor ^= arr[i];
  }
  for(int i = 0;i < N;i++){
    cout << (allxor^arr[i]);
    if(i < N-1){cout << " ";}
    else{cout << endl;}
  }
  return 0;
}

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


int main() {
    int a,b,c;
    cin >> a >> b >> c;
    int ans=0;
    
    rep(i,c){
        b -= a;
        if(b<0){
            break;
        }
      	else{
          ans++;
        }
    }
    
    cout << ans <<endl;
    
    
    return 0;
}





Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;

int main(){
    ll a,b,x;
    cin>>a>>b>>x;
    if(a<=x and a+b>=x){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
}

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

long long int L(int n){
  vector<long long int> Lucas(n+1);
  Lucas.at(0) = 2;
  Lucas.at(1) = 1;
  for(int i=2;i<=n;i++){
  Lucas.at(i) = Lucas.at(i-1) + Lucas.at(i-2);
  }
  
  return Lucas.at(n);
}


int main() {
  int N;
  cin >> N;
  
  cout << L(N) << endl;
  
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner scanner = new Scanner(System.in);
		
		int a = scanner.nextInt();
		
		int b = scanner.nextInt();
		
		int c = scanner.nextInt();
		
		if(a < b && b < c) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		
		
		
		scanner.close();
		
	}

}



Measured memory_bytes: 26184
from itertools import combinations
from collections import Counter
class Osa_k:
    def __init__(self, n_max):
        self.n_max = n_max
        self.min_factor = min_factor = list(range(n_max + 1))
        min_factor[2::2] = [2] * (n_max // 2)
        min_factor[3::6] = [3] * ((n_max + 3) // 6)
        for i in range(5, int(n_max ** .5) + 1, 2):
            if min_factor[i] == i:
                for j in range(i*i, n_max + 1, i):
                    if min_factor[j] == j:
                        min_factor[j] = i

    def __call__(self, n):
        min_factor = self.min_factor
        n_twoes = (n & -n).bit_length() - 1
        res = [2] * n_twoes
        n >>= n_twoes
        resappend = res.append
        while n > 1:
            p = min_factor[n]
            resappend(p)
            n //= p
        return res
    
    def div(self, n):
        factors = self.__call__(n)
        res = {1, n}
        for i in range(1, len(factors)):
            for j in combinations(factors, i):
                r = 1
                for p in j:r *= p
                res |= {r}
        return res

if __name__ == "__main__":
    n, *a = map(int, open(0).read().split())
    b, c = set(a), Counter(a)
    P = Osa_k(10**6)
    cnt = 0
    for i in b:
        if c[i] > 1:continue
        for d in P.div(i):
            if d != i and d in b:break
        else:cnt += 1
    print(1 if n == 1 else cnt)

Measured memory_bytes: 176100
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
 	public static void main(String[] args) {  
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		String S = I.next();
		String T = I.next();
		int N = S.length();
		int small = T.length();
		int ans = 1830982;
		for (int i = 0; i+small<=N; i++) {
			String cur = S.substring(i,i+small);
			int curans = 0;
			for (int j = 0; j < cur.length(); j++) {
				if (cur.charAt(j)!=T.charAt(j)) curans++;
			}
			ans=min(ans,curans);
		}
		O.pln(ans);
	}
	public static double max(double a, double b) {return Math.max(a, b);}
	public static double min(double a, double b) {return Math.min(a, b);}
	public static long min(long a, long b) {return Math.min(a,b);}
	public static long max(long a, long b) {return Math.max(a,b);}
	public static int min(int a, int b) {return Math.min(a,b);}
	public static int max(int a, int b) {return Math.max(a,b);}
	public static long abs(long x, long y) {return Math.abs(x-y);}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return max(a,b);
		return GCD(min(a,b),max(a,b)%min(a,b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	public static int pop(long x) { //Returns number of bits within a number
		int cnt = 0;
		while (x>0) {
			if (x%2==1) cnt++;
			x/=2;
		}
		return cnt;
	}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
		double nextDouble() {return Double.parseDouble(next());}
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(double x) {w.println(x);w.flush();}
		void pln(boolean x) {w.println(x);w.flush();}
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void pln(BigInteger x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
		void p(BigInteger x) {w.print(x);w.flush();}
		void p(double x) {w.print(x);w.flush();}
		void p(boolean x) {w.print(x);w.flush();}
	}
}

Measured memory_bytes: 26768
s = require("fs").readFileSync("/dev/stdin","utf8").split('\n')
n = s[0].split(' ')[0] | 0
k = s[0].split(' ')[1] | 0
s.shift()
s = s.map(n => n | 0).sort((a, b) => b - a)
console.log(Math.min(...[...Array(n - k + 1)].map((_, i) => s[i] - s[i + k - 1])))

Measured memory_bytes: 30320
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define int long long
using namespace std;
const int MOD=1e9+7;
const int INF=1e10;

int mx[9]={-1,0,1,-1,0,1,-1,0,1};
int my[9]={-1,-1,-1,0,0,0,1,1,1};

signed main(){
  int h,w,n;
  cin>>h>>w>>n;
  set<pair<int,int>> s;
  vector<pair<int,int>> p(n);
  rep(i,n){
    int y,x;
    cin>>y>>x;
    y--;x--;
    p[i]={y,x};
    s.insert({y,x});
  }
  vector<int> ans(10,0);
  set<pair<int,int>> used;
  rep(i,n){
    rep(j,9){
      int tmp=0;
      int ny=p[i].first+my[j];
      int nx=p[i].second+mx[j];
      if(1<=nx&&nx<=w-2&&1<=ny&&ny<=h-2&&!used.count({ny,nx})){
        used.insert({ny,nx});
        rep(k,9){
          int nny=ny+my[k];
          int nnx=nx+mx[k];
          if(s.count({nny,nnx}))tmp++;
        }
        ans[tmp]++;
      }

    }
  }
  int sum=accumulate(all(ans),0);

  rep(i,10){
    if(i==0)cout<<(h-2)*(w-2)-sum<<endl;
    else cout<<ans[i]<<endl;
  }
  return 0;
}


Measured memory_bytes: 65408
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	int a,b;
	cin>>a>>b;
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(i==a)
		{
			if(s[i]!='-')
			{
				cout<<"No";
				return 0;
			}
		}
		else
		{
			if(!isdigit(s[i]))
			{
				cout<<"No";
				return 0;
			}
		}
	}
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("Ofast")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
#define int long long 
typedef pair<int,int>pi;
typedef vector<int>vi;

const int MAXN=100005;
const int MOD=1000000007;

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define DEC(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define mp make_pair
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define db(x) cerr<<#x<<" = "<<x<<"\n"
#define LOW(v,x) (lower_bound(all(v),(x))-(v).begin())
#define UP(v,x) (upper_bound(all(v),(x))-(v).begin())
int N,A[MAXN];
main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin>>N;
	FOR(i,1,N) cin>>A[i];
	int cash = 1000;
	int stocks = 0;
	if (A[1] < A[2]){
		stocks = cash/A[1];
		cash -= stocks * A[1];
	}
	FOR(i,2,N){
		cash += stocks * A[i];
		stocks = 0;
		if (i<N && A[i] < A[i+1]){
			stocks = cash/A[i];
			cash -= stocks * A[i];
		}
	}
	cout<<cash;
}


Measured memory_bytes: 3656
#include <stdio.h>
#include <string.h>
int main(void){
    
    int i,j;
    char s[27];
    
    scanf("%s",s);
    
    for(i=0;i<strlen(s)-1;i++){
        for(j=i+1;j<strlen(s);j++)
        if(s[i]==s[j]){
            printf("no\n");
            return 0;
        }
    }
    printf("yes");
    return 0;
}


Measured memory_bytes: 1688
n,m=map(int,input().split(' '))
h=list(map(int,input().split(' ')))

path=h[:]
for i in range(m):
    a,b=map(int,input().split(' '))
    if path[a-1]<=h[b-1]:
        path[a-1]=0
    if path[b-1]<=h[a-1]:
        path[b-1]=0
x=[0 for x in path if x!=0]
print(len(x))

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


#include <assert.h>    // LON
#include <math.h>    // sqrt()


using namespace std;
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX;
const ll MINF = -10e10;
//const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//typedef priority_queue<P, vector<P>, greater<P>> PQ_ASK;
const int mod = 1000000007;


ll gcd(ll x, ll y) {
    if (x < y) swap(x, y);
    if (y == 0) {
        return x;
    }
    return gcd(y, x % y);
}

ll lcm(ll x, ll y) {
    ll g = gcd(x, y);

    if (x % g == 0) {
        return x / g * y;
    } else {
        return y / g * x;
    }
}


int main() {
    int n;
    cin >> n;
    vector<ll> nums(n);

    ll ans = 1;
    rep(i, n) {
        ll a;
        cin >> a;
        ans = lcm(ans, a);
    }

    cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
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; }
const ll MOD = 998244353;

ll DP[3100][3100];

int main(){
    ll N, S;
    cin >> N >> S;
    vector<ll> A(N);
    REP(i,N){
        ll a;
        cin >> a;
        A[i] = a;
    }

    DP[0][0] = 1;
    REP(i,N){
        ll a = A[i];
        REP(s,S+1){
            DP[i+1][s] += 2*DP[i][s];
            DP[i+1][s] %= MOD;
            if(s+a <= S){
                DP[i+1][s+a] += DP[i][s];
                DP[i+1][s+a] %= MOD;
            }
        }
    }

    ll ans = DP[N][S];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 76292
N = int(input())

dp = [[0 for _ in range(3)] for _ in range(N)]

a,b,c = [int(i) for i in input().split()]
dp[0][0] = a
dp[0][1] = b
dp[0][2] = c

for i in range(1,N):
    li = [int(i) for i in input().split()]
    for j in range(3):
        tmp = []
        for k in range(3):
            if j != k:
                tmp.append(dp[i-1][k] + li[j])
        dp[i][j] = max(tmp)

print(max(dp[-1]))


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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

ll n;

ll g1(ll n, ll p) {
  if (n == 0LL) return 0LL;
  return n / p + g1(n / p, p);
}

ll g2(ll n, ll p) {
  if (n % 2LL == 0LL) {
    ll ret = g1(n / 2, p);
    if (p == 2LL) ret += n / 2LL;
    return ret;
  } else {
    return g1(n, p) - g2(n - 1LL, p);
  }
}

int main(void) {
  // Here your code !
  scanf("%lld", &n);

  ll ans = min(g2(n, 2LL), g2(n, 5LL));

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

  return 0;
}


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

int main() {
  int N;
  cin>>N;
  vector<string> V(N);
  vector<string> ans;
  for(int i=0;i<N;i++){
    cin>>V.at(i);
  }
  sort(V.begin(),V.end());
  int cheak=0,a=1;
  for(int i=0;i<N;i++){
     if(i==N-1||(V.at(i)!=V.at(i+1))){
       if(cheak<a){
         ans={};
         cheak=a;
         ans.push_back(V.at(i));
       }
       else if(cheak==a){
         ans.push_back(V.at(i));
       }
       a=1;
     }
    else {
      a++;
    }
  }
  for(int i=0;i<ans.size();i++){
    cout<<ans.at(i)<<endl;
  }
  

}


Measured memory_bytes: 15988
n = int(input())
t = str(input())

if (n != len(t)):
	print("No")
else:
	nHalf = int(n / 2)

	if (nHalf == 1 and n != 2):
		print("No")
	elif (n == 0):
		print("No")
	else:
		if (t[:nHalf] == t[nHalf:]):
			print("Yes")
		else:
			print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,k;
	cin>>n>>k;
	vl a(n),f(n);
	cin>>a>>f;
	sort(all(a));
	sort(rall(f));
	ll ok=LINF, ng=-1;
	while(abs(ok-ng)>1){
		ll mid=(ok+ng)/2;
		ll need=0;
		rep(i,n){
			if(a[i]*f[i]>mid){
				need+=(a[i]*f[i]-mid + f[i]-1)/f[i];
			}
		}
		if(need<=k){
			ok=mid;
		}else ng=mid;
	}
	puta(ok);
	return 0;
}

Measured memory_bytes: 3328
#include <stdio.h>
int main(void){
    // 変数宣言
    int inner_rating;
    int n, r;

    // 入力
    scanf("%d %d", &n, &r );

    // 演算
    if( n >= 10 ){
        inner_rating = r;
    }else{
        inner_rating = 100 * ( 10 - n ) + r ;
    }

    // 出力
    printf("%d", inner_rating );


    return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(){
int a,b,c;
  cin >> a >> b >> c;
  if(a==b && b==c && a==c){
  cout << "No" << endl;
  }else if(a!=b && b!=c  && a!=c){
  cout << "No" << endl;
  }else{
  cout << "Yes" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int l = sc.nextInt();
    int taist = 0;
    int sum =0;
    if(l+n-1 < 0){
      taist = l+n-1;
    } else if(l > 0){
      taist = l; //n=1のりんご
    } else {
      taist = 0; //l+n-1=0のりんご
    }
    for(int i=1;i<=n;i++){
      sum +=l+i-1;
    }
    System.out.println(sum-taist);
  }
}

Measured memory_bytes: 23124
/**
*
* Author: Mouhanad
* Lang: GNU C++14
*
**/
#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define ii pair < int , int >
#define LS pair < ll , string >
typedef long long ll;
const int inf = 1<<30;
const int N =100100;
int n , a[N] , q ;

int main ( ){
  scanf("%d",&n);
  int cnt =0 ;
  for ( int i = 0; i < n; i++ ){
    int x ;
    scanf("%d",&x);
    if ( x &1 ) continue  ;
    for ( int j = 0 ; j <= 30 ; j++ ){
        if ( x&(1<<j) ) break ;
        cnt++;
    }
  }
  printf("%d",cnt);
return 0 ;
}


Measured memory_bytes: 256
#define rep(i, n) for (int i = 0; i < n; i++)
#define repd(i, n) for (int i = n; i > 0; i--)
#define mod 1000000007
#define MOD 998244353
#define inf 1e20
#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> pr;
typedef complex<double> com;


int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << (a - c)*(b - d) << endl;
	return 0;
}
//Ctrl+Aを使わない

Measured memory_bytes: 256
import java.util.Scanner;

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

    void solve(Scanner sc) {
        int n = sc.nextInt();
        char[] s = sc.next().toCharArray();
        int b = 0;
        int r = 0;
        for (char c : s) {
            if (c == 'R') {
                r++;
            } else {
                b++;
            }
        }

        if (r > b) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 23124
#include <stdio.h>
#include<iostream>

using namespace std;

long long int n,i;
int a[1000001] = {0};
int ans;

int main()
{
    for(int i = 2; i < 1000000; i++)
    {
        if(a[i] == 0)
        {
            for(int j = 2; i * j <= 1000000; j++)
            {
                a[i * j] = 1;
            }
        }
    }
    while(cin >> n)
    {
        for(int i = 2; i <= n; i++)
        {
            if(a[i] == 0)ans++;
        }

        /*for(int i = 2; i <= n; i++)
        {
            if(i == 2 || i == 3 ||  i == 5 || i == 7)ans++;

        }*/
        cout << ans << endl;
        ans = 0;
    }
    return 0;
}

Measured memory_bytes: 5064
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<set>
#include<tuple>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<ll,ll>P;

const ll mod = 1e9+7;
const ll INF = ll(1e18)+1;
const ll MAXN = 1e6;

const int MAX=510000;

int main()
{
    vector<P> work;
    ll n;
    cin>>n;
    rep(i,n)
    {
        ll a,b;
        cin>>a>>b;
        work.push_back(P(a,b));
    }
    sort(work.begin(),work.end(),[](const P& x,const P& y){return x.second<y.second;});
    ll now=0;
    bool flag=true;
    rep(i,n)
    {
        now+=work[i].first;
        if(now>work[i].second)
        {
            flag=false;
        }
    }
    if(flag)
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
    

}

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

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

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

  int s; cin >> s;
  int a = s/100;
  int b = s%100;

  bool am = (1 <= a && a <= 12);
  bool bm = (1 <= b && b <= 12);

  if (am && bm) {
    cout << "AMBIGUOUS" << endl;
  } else if (am) {
    cout << "MMYY" << endl;
  } else if (bm) {
    cout << "YYMM" << endl;
  } else {
    cout << "NA" << endl;
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <stack>
#include <vector>
using namespace std;

inline int msb(int x) {
	if(!x) return 0;
	return (1 << (31 - __builtin_clz(x)));
}

struct state {
	vector<int> cup, prev;
	int cnt;

	state(const vector<int>& c, const vector<int>& p, const int& cnt_):cup(c), prev(p), cnt(cnt_) {}
};

int main() {
	const vector<int> init(3, -1);

	for(int n, m; scanf("%d %d", &n, &m), n | m;) {
		vector<int> cup(3, 0);

		for(int i = 0; i < 3; ++i) {
			int num;
			scanf("%d", &num);

			for(int j = 0; j < num; ++j) {
				int size;
				scanf("%d", &size);

				cup[i] |= (1 << (size - 1));
			}
		}

		int ans = INT_MAX;
		stack<state> sta;
		sta.push(state(cup, init, 0));
		while(!sta.empty()) {
			state s = sta.top();
			sta.pop();

			if(s.cnt > min(m, ans))
				continue;;

			if(s.cup[0] == (1 << n) - 1 || s.cup[2] == (1 << n) - 1) {
				ans = s.cnt;
				continue;
			}

			for(int i = 0; i < 2; ++i) {
				int move = max(msb(s.cup[i]), msb(s.cup[i + 1]));
				vector<int> next(s.cup);
				next[i] ^= move;
				next[i + 1] ^= move;
				if(next != s.prev)
					sta.push(state(next, s.cup, s.cnt + 1));
			}	
		}

		printf("%d\n", (ans == INT_MAX ? -1 : ans));
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1076
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE InstanceSigs #-}

import Control.Monad
import Data.List

main :: IO ()
main = do
    s <- getLine
    let unique = nub s
    putStrLn (
        if all (\u -> even . length . filter (== u) $ s) unique
        then "Yes" else "No")

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

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

bool mycompare(pair<ll, ll> x, pair<ll, ll> y) {
  return x.first < y.first;
}

ll N = 0;
ll M = 0;
ll tmp;
ll ret = 0;
vector<pair<ll, ll>> shop;

void input() {
  IN(N);
  IN(M);
  ll a, b;
  REP(i, N) {
    IN(a);
    IN(b);
    shop.pb(mp(a,b));
  }
}

void solve() {
  sort(ALL(shop), mycompare);
  ll num = 0;
  ll money = 0;
  ll next_shop = 0;
  while(num < M) {
    ll buy = min(shop[next_shop].second, M-num);
    num += buy;
    money += buy*shop[next_shop].first;
    next_shop++;
  }
  PRINT(money);
}

int main(void){
  input();
  solve();
}


Measured memory_bytes: 2420
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

def main():
    N = I()
    points = []
    G = [[] for _ in range(N)]
    Point = collections.namedtuple('Point', ['n', 'x', 'y'])
    Edge = collections.namedtuple('Edge', ['fr', 'to', 'cost'])
    for i in range(N):
        x, y = LI()
        points.append(Point(i, x, y))
    x_sorted = sorted(points, key=lambda p: p.x)
    y_sorted = sorted(points, key=lambda p: p.y)
    edges = []
    for i in range(N-1):
        p1, p2 = x_sorted[i], x_sorted[i+1]
        cost = p2.x - p1.x
        assert cost >= 0
        edges.append(Edge(p1.n, p2.n, cost))
        edges.append(Edge(p2.n, p1.n, cost))

        p3, p4 = y_sorted[i], y_sorted[i+1]
        cost = p4.y - p3.y
        assert cost >= 0
        edges.append(Edge(p3.n, p4.n, cost))
        edges.append(Edge(p4.n, p3.n, cost))

    # E = 2V, let's prim
    sorted_edge = sorted(edges, key=lambda x: x.cost)
    uf = UnionFind(N)
    res = 0
    for i in range(len(sorted_edge)):
        edge = sorted_edge[i]
        if not uf.same(edge.fr, edge.to):
            uf.union(edge.fr, edge.to)
            res += edge.cost
    print(res)

main()



Measured memory_bytes: 133588
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,n,m,i,p=0;
    cin>>n>>m;
    for(i=1;i<=n;i++){

        cin>>a>>b;

    if(((a*a)+(b*b))<=m*m){
            p++;
    }
    }
    cout<<p<<endl;
}


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

struct Target {
        int count;
        int val;

        Target(int count, int val)
                {
                        this->count = count;
                        this->val = val;
                }
};

bool same(std::vector<int> &vec)
{
        int head = vec.at(0);

        for(int elem : vec){
                if(head != elem){
                        return false;
                }
        }

        return true;
}

std::pair<Target, Target> get_top_element(std::vector<int> &vec)
{
        std::sort(std::begin(vec), std::end(vec));
        int current = vec.at(0);
        int count = 0;
        std::vector<Target> t_vec;

        for(int elem : vec){
                if(current != elem){
                        t_vec.emplace_back(vec.size() - count, current);
                        //std::cout << current << ": " << count << std::endl;
                        count = 0;
                        current = elem;
                }
                count++;
        }
        t_vec.emplace_back(vec.size() - count, current);

        std::sort(std::begin(t_vec), std::end(t_vec), [](const Target t1, const Target t2)
                                                              {
                                                                      return t1.count < t2.count;
                                                              });
        if(t_vec.size() == 1){
                return std::make_pair(t_vec.at(0), Target(vec.size(), -1));
        }else{
                return std::make_pair(t_vec.at(0), t_vec.at(1));
        }
}

int main()
{
        int n, ans;
        std::vector<int> v1, v2;

        std::cin >> n;

        n >>= 1;
        while(n--){
                int tmp;
                std::cin >> tmp;
                v1.push_back(tmp);
                std::cin >> tmp;
                v2.push_back(tmp);
        }
        
        std::pair<Target, Target> tv1 = get_top_element(v1);
        std::pair<Target, Target> tv2 = get_top_element(v2);

        if(tv1.first.val != tv2.first.val){
                ans = tv1.first.count + tv2.first.count;
        }else{
                if((tv1.first.count + tv2.second.count) < (tv1.second.count + tv2.first.count)){
                        ans = tv1.first.count + tv2.second.count;
                }else{
                        ans = tv1.second.count + tv2.first.count;
                }
        }

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

        return 0;
}


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

int main()
{
    int N, sum = 0;
    cin >> N;

    vector<int> L(N);

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

    sort(L.begin(), L.end(), greater<int>());

    for (int i = 0; i < N - 2; i++)
    {
        for (int j = i + 1; j < N - 1; j++)
        {
            if (L[i] > 2 * L[j])
            {
                break;
            }

            else
            {
                for (int k = j + 1; k < N; k++)
                {
                    if (L[i] >= L[j] + L[k])
                    {
                        break;
                    }

                    else if (L[j] < L[i] + L[k] && L[k] < L[i] + L[j])
                    {
                        sum++;
                    }
                }
            }
        }
    }

    cout << sum << endl;
}


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

using namespace std;

#define all(a) a.begin(),a.end()
#define fori(i,n) for(int i=0;i<n;i++)
#define forb(i,s,t) for(int i=s;i<t;i++)
#define fore(e,v) for(auto &e : v)
#define maxv(v) *max_element(all(v))
#define uniques(v) si s(all(ais));v.assign(all(s))
#define inp(i) scanf("%i",&i)
#define debug(x) cout<<#x<<" "<<x<<endl;
#define start_clock clock_t begin = clock();
#define end_clock cout<<double(clock()-begin)/CLOCKS_PER_SEC<<endl;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<int> vi;
typedef vector<ll> llv;
typedef set<int> si;

int main () {
	int n;
	cin>>n;
	vi pis(n);
	fori(i,n) cin>>pis[i];
	int wrong = 0;
	fori(i,n) {
		if(pis[i] != i+1) {
			wrong++;
		}
	}
	
	cout<<((wrong == 2 || wrong == 0) ? "YES" : "NO")<< endl;
	return 0;
}

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

int main() {
	
	int h,w;
	cin >> h >> w;
	
	vector<vector<char>> fld(h,vector<char>(w));
	int cnt{};
	for(int i=0; i<h; i++) for(int j=0; j<w; j++) {
		cin >> fld.at(i).at(j);
		if(fld.at(i).at(j)=='.') cnt++;
	}
	const vector<int> dy{-1,0,1,0};
	const vector<int> dx{0,-1,0,1};
	vector<vector<int>> dist(h,vector<int>(w,-1));
	queue<pair<int,int>> que;
	que.push({0,0});
	dist.at(0).at(0) = 0;
	while(!que.empty()){
		auto p = que.front();
		int a = p.first, b = p.second;
		que.pop();
		for(int i=0; i<4; i++){
			if(a+dy.at(i)<0||h-1<a+dy.at(i)||b+dx.at(i)<0||w-1<b+dx.at(i))continue;
			if(fld.at(a+dy.at(i)).at(b+dx.at(i))!='#'){
				if(dist.at(a+dy.at(i)).at(b+dx.at(i))==-1) {
					que.push({a+dy.at(i),b+dx.at(i)});
					dist.at(a+dy.at(i)).at(b+dx.at(i)) = dist.at(a).at(b)+1;
				}
			}
		}
	}
	if(dist.at(h-1).at(w-1)==-1) cout << -1 << endl;
	else cout << cnt - dist.at(h-1).at(w-1)-1 << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    int a, b, c, x, ans = 0;
    cin >> a >> b >> c >> x;
    for(int i = 0; i < a + 1; ++i){
        for(int j = 0; j < b + 1; ++j){
            for(int k = 0; k < c + 1; ++k){
                if(i * 500 + j * 100 + k * 50 == x) ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	ll a,b,c,d,n; cin>>a>>b>>c>>d>>n;
	n*=4;
	b=min(a*2,b);
	c=min(b*2,c);
	d=min(c*2,d);
	ll ret=n/8 * d; n%=8;
	ret+=n/4 * c; n%=4;
	ret+=n/2 * b; n%=2;
	ret+=n * a;
	cout << ret << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

ll f(string s, int n) {
  string t;
  rep(i,n) t += s;
  ll res = 0;
  char pre = '-';
  rep(i,sz(t)) {
    if (t[i] == pre) {
      res++;
      pre = '-';
    } else {
      pre = t[i];
    }
  }
  return res;
}

int main() {
  string s;
  int n;
  cin>>s>>n;
  int c = 0;
  if (n > 100) {
    c = n-100;
    if (c&1) c++;
    n -= c;
  }
  ll x = f(s,n+2);
  ll ans = f(s,n);
  ll d = x-ans;
  ans += d*(c/2);
  cout<<ans<<endl;
  return 0;
}






















Measured memory_bytes: 256
n = int(input())
b = list(map(int, input().split()))

impossible = False
for i in range(n):
    if b[i] > i+1:
        impossible = True
        break

if impossible:
    print("-1")
else:
    pass
    ans = []
    while b:
        # print(b)
        for i in reversed(range(len(b))):
            if b[i] == i+1:
                ans.append(b.pop(i))
                break
    for i in reversed(range(n)):
        print(ans[i])


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

/*
struct Edge
{
    int to;
    ll weight;
    Edge(int t, ll w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
*/
using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

vector<vector<ll>> d(310, vector<ll>(310, INF));

void warshallFloyd(int n)
{
    for (int k = 0; k < n; k++) // 経由する頂点
    {
        for (int i = 0; i < n; i++) // 始点
        {
            for (int j = 0; j < n; j++) // 終点
            {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]); // 距離
            }
        }
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int H, W;
    cin >> H >> W;
    for (int i = 0; i < 10; i++)
    {
        for (int j = 0; j < 10; j++)
        {
            int c;
            cin >> c;
            d[i][j] = c;
        }
    }

    vector<vector<int>> A(H, vector<int>(W));
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            cin >> A[i][j];
        }
    }

    for (int i = 0; i < 20; i++)
    {
        d[i][i] = 0;
    }
    warshallFloyd(20);
    ll ans = 0;
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            if (A[i][j] != -1)
            {
                ans += d[A[i][j]][1];
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4572
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b= scanner.nextInt();
		
		if(a%2!=0&&b%2!=0){
			System.out.println("Yes");
		}
		else{

		System.out.println("No");
		}
	}
}


Measured memory_bytes: 22612
#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<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

vector<int> G[MAX_N];

int main() {
    int h, w, n;
    cin >> h >> w >> n;

    rep(i,n){
        int x, y;
        cin >> x >> y;
        G[y].push_back(x);
    }
    rep(i,MAX_N){
        G[i].push_back(h+1);
        sort(G[i].begin(), G[i].end());
    }
    rep(j,MAX_N){
        G[w+1].push_back(j);
    }

    int ans = h;

    int x = 1, y = 1;

    while(x < ans){
        // cout << x << ' ' << y << endl;
        auto ite = lower_bound(G[y].begin(), G[y].end(), x+1);
        ans = min(ans, *ite-1);
        if(ans == x)break;
        int flag = 0;
        while(x < ans){
            x++;
            ite = lower_bound(G[y+1].begin(), G[y+1].end(), x);
            if(*ite == x){
                ;
            }else{
                y++;
                flag = 1;
                break;
            }
        }
        if(flag == 0)break;
    }

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




Measured memory_bytes: 12792
#include <iostream>

using namespace std;

typedef long long ll;
#define x first
#define y second
#define mp make_pair

int n;
string s;

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
cin >> s;
int sol = 1;
for(int i = 1 ; i < n ; ++i){
	if(s[i] != s[i - 1]){
		sol++;
	}
}
cout << sol << endl;

return 0;
}



Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef vector<ll>VI;
typedef pair<ll,ll>P;
typedef pair<double,double>P_D;
#define VV(T) vector<vector<T>>
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define ALL(a)  (a).begin(),(a).end()
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=max(x,a)
#define chmin(x,a) x=min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX_6 1001001//6
#define MAX_7 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
const int MOD = 1000000007;
#define INF 1<<30
#define INFTY 1LL<<61
#define MAX_INT INT_MAX
#define Endl '\n'
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
using Edge=pair<int,ll>;
using Graph=vector<vector<int> >;//ll or Edge
using Edge=pair<int,ll>;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
// sort_reverse...greater<ll>()
// vector型から重複を削除 list.erase(unique(ALL(list)),list.end());
// g++ -o a a.cpp -Wall -lm -std=c++17

int main(){
    int n;cin>>n;
    VI x(n),y(n),h(n);
    int si=-1;
    rep(i,n){
        cin>>x[i]>>y[i]>>h[i];
        if(h[i]>0)si=i;
        }
    ll resx=-1,resy=-1,resH=-1;
    rep(X,100+1)rep(Y,100+1){
        ll H=h[si]+abs(X-x[si])+abs(Y-y[si]);
        ll limit=INFTY;
        bool ok=true;
        rep(i,n){
            int tH=h[i]+abs(X-x[i])+abs(Y-y[i]);
            if(h[i]>0 && H!=tH)ok=false;
            if(h[i]==0 && H>tH)ok=false;
        }
        if(ok){
            resx=X,resy=Y,resH=H;
        }
    }
     cout<<resx<<" "<<resy<<" "<<resH<<endl;
            return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
const int mx=500000;
#define ll long long
#define p push_back
#define ff first
#define ss second
ll a,b;
int main(){
    cin>>a>>b;
    if(a*b==15){
        cout<<'*';
        return 0;
    }
    if(a+b==15){
        cout<<'+';
        return 0;
    }
    cout<<'x';
    return 0;
}


Measured memory_bytes: 256
def solve(A,N):
    xor_sum = 0
    for i in range(N):
        xor_sum ^= A[i]

    B = [xor_sum ^ A[i] for i in range(N)]

    return B

def main():
    N = int(input())
    A = list(map(int,input().split()))

    ans = solve(A,N)

    print(" ".join(map(str,ans)))

if __name__ == "__main__":
    main()


Measured memory_bytes: 41648
using System;

namespace AizuOnline
{
    class Program
    {
        static void Main(string[] args)
        {
            string x;
            int idx = 1;
            x = Console.ReadLine();
            while (x != "0") 
            {
                Console.WriteLine("Case {0}: {1}", idx, x);
                x = Console.ReadLine();
                idx++;
            }
        }
    }
}


Measured memory_bytes: 9204
INF = 10 ** 12

N = int(input())
xls = [tuple(map(int, input().split())) for _ in range(N)]

sections = list(map(lambda t: (t[0]-t[1], t[0]+t[1]), xls))
sections.sort(key = lambda s: s[1])

#greedy
pos = -INF
counter = 0
for section in sections:
    if pos <= section[0]:
        counter += 1
        pos = section[1]

print(counter)

Measured memory_bytes: 67416
<?php
define('MOD', 10**9+7);

//error_reporting(0);
$N = trim(fgets(STDIN));
//list($n,$k) = explode(" ",trim(fgets(STDIN)));
//$X = array_map('intval',explode(" ",trim(fgets(STDIN))));
//function chmax(&$a,$b) {if ($a<$b){$a=$b;return true;}return false;}
//function chmix(&$a,$b) {if ($a>$b){$a=$b;return true;}return false;}
//

printf("%d\n",intdiv($N+1,2));


Measured memory_bytes: 4856