akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b)
{ return *(char*)a - *(char*)b;} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b)
{ return strcmp(*(const char **)a, *(const char **)b);} /* aaa,aab.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)
#define rep(i, n) for (int i = 0; i < n; i++)


int a[200001], b[200001], idx[200001];
int acs(const void *p, const void *q){return b[*(int*)p] - b[*(int*)q];} /* 1,2,3,4.. */
int main(void) {
  int n;
  scanf("%d", &n);

  int i, j;
  rep(i, n) {
    scanf("%d %d", &a[i], &b[i]);
  }
  rep(i, n) {
    idx[i] = i;
  }

  qsort(idx, n, sizeof(int), acs);

  int s[200001];
  bool able = true;
  s[0] = a[idx[0]];
  if (s[0] > b[idx[0]]){
    printf("No\n");
    return 0;
  }
  for (i = 1; i < n; i++) {
    s[i] = s[i - 1] + a[idx[i]];
    if (s[i] > b[idx[i]]) {
      able = false;
      break;
    }
  }
  printf(able ? "Yes\n" : "No\n");
  return 0;
}


Measured memory_bytes: 3324
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int N;
int A[310][310], dist[310][310];
 
signed main() {
    cin >> N;
    rep(i,0,N) rep(j,0,N) {
        cin >> A[i][j];
        dist[i][j] = A[i][j];
    }

    rep(k,0,N) rep(i,0,N) rep(j,0,N) {
        chmin(dist[i][j], dist[i][k] + dist[k][j]);
    }

    // No
    rep(i,0,N) rep(j,0,N) {
        if(dist[i][j] != A[i][j]) {
            cout << -1 << endl;
            return 0;
        }
    }

    // Yes
    int ans = 0;
    rep(i,0,N) rep(j,0,N) {
        bool ok = true;
        rep(k,0,N) {
            if(k == i || k == j) continue;
            int va = dist[i][j];
            int vb = dist[i][k] + dist[k][j];
            if(va == vb) ok = false;
        }
        if(ok) ans += dist[i][j];
    }
    cout << ans / 2 << endl;
    return 0;
}

Measured memory_bytes: 1664
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define break break
#define continue continue
#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define LLPair pair<ll, ll>
#define vint vector<int>
#define vll vector<ll>
typedef long long ll;

using namespace std;

int main(void){
	ll n, k; cin >> n >> k;
	ll R, S, P; cin >> R >> S >> P;
	string str; cin >> str;

	int r, s, p; r = s = p = 0;
	string prev;
	rep(i, n){
		if(i<k || str[i] != prev[i-k]){
			if(str[i] == 'r'){
				r++;
				prev.push_back('r');
			} else if(str[i] == 's'){
				s++;
				prev.push_back('s');
			} else if(str[i] == 'p'){
				p++;
				prev.push_back('p');
			}
		} else{
			prev.push_back(0);
		}
	}
	ll ans = r*P + s*R + p*S;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
long long k;
int main(){
	cin>>k;
	long long cnt=49-k;
	cout<<"50"<<endl;
	for(int i=0;i<50;i++){
		long long ans=cnt+51*(k/50);
		//cout<<"#"<<cnt<<" "<<(k/50)<<endl;
		if(i<k%50)ans+=50;
		if(i)cout<<" ";
		cout<<ans;
	}cout<<endl;
	return 0;
}


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

using namespace std;
#define rep(i, n) for (int64_t i = 0; i < n; i++)

const double PI = 3.14159265358979323846;

int main()
{
	int64_t x, count = 0;

	cin >> x;
	for (int64_t i  = 100; i < x;)
	{
		i =  i + floor(i * 0.01);
		count++;
	}
	
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 3676
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
long long inf = 1000000000000;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main() {
	int n;
	cin >> n;
	int a[1100];
	int i;
	for (i = 0; i < n; i++) {
		cin >> a[i];
	}
	stack<int> cave;
	bool cat[100] = {};
	for (i = 0; i < n; i++) {
		if (a[i] > 0) {
			if (!cat[a[i]]) {
				cave.push(a[i]);
				cat[a[i]]++;
			}
			else {
				cout << i + 1 << endl;
				return(0);
			}
		}
		else {
			a[i] *= -1;
			if (cat[a[i]] && a[i]==cave.top() && !cave.empty()) {
				cat[a[i]] = false;
				cave.pop();
			}
			else {
				cout << i + 1 << endl;
				return(0);
			}
		}
	}
	cout << "OK" << endl;
	return(0);
}


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

int main() {
    int n;
    cin >> n;
    int cnt = 0;
    for (int i = 1; i <= n; i++) {
        if (i & 1) {
            cnt++;
        }
    }
    printf("%.10f\n", (double) cnt / n);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define until(x) while(!(x))
#define unless(x) if(!(x))
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pc __builtin_popcount

int ar[105];

int32_t main(){
	int n,m;
	cin>>n>>m;
	long double total = 0;
	for(int i=1;i<=n;i++){
		cin>>ar[i];
		total += ar[i];
	}
	sort(ar+1,ar+n+1,greater<int>());
	for(int i=1;i<=m;i++){
		if(ar[i]<(total/(4.0*m))){
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
#define debug(var) cout << "[" << #var << "] " << var << endl
const ll mod = 1000000007;


int main(){
    int x, y;
    cin >> x >> y;

    int ans = x + y/2;
    
    
    
    cout << ans << endl;
    return 0;
}


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

int main() {
    int t=1;
    //cin >> t;
    while(t--){
        ll n,i,j;
        cin >> n;
        int prime[100005];
        memset(prime,true,sizeof(prime));
        prime[0]=false;
        prime[1]=false;
        for(i=2;i*i<=100005;i++){
            if(prime[i]){
                for(j=i*i;j<=100005;j+=i){
                    prime[j]=false;
                }
            }
        }
        for(i=0;i<=100005;i++){
            if(prime[i] && i>=n){
                cout << i ;
                break;
            }
        }
    }
}

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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }

void solve() {
    int a, b;
    cin >> a >> b;
    cout << (a - 1) * (b - 1) << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

Measured memory_bytes: 892
package main

import (
	"fmt"
)

func GCD(a, b int) int {
	if b == 0 {
		return a
	}
	return GCD(b, a%b)
}
func main() {
	var N int
	fmt.Scanf("%d\n", &N)

	sum := 0
	for i := 1; i <= N; i++ {
		for j := 1; j <= N; j++ {
			for k := 1; k <= N; k++ {
				sum += GCD(GCD(i, j), k)
			}
		}
	}
	fmt.Println(sum)

}


Measured memory_bytes: 1844
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;

int main(){
    int n, k;
    int d;
    int a;
    cin >> n >> k;
    vector<int> people(n, 1);

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

        for (int j = 0; j < d; j++){
            cin >> a;
            people[a-1] = 0;
        }
    }
    
    cout << accumulate(people.begin(), people.end(), 0) << endl;
}

Measured memory_bytes: 3640
[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

let rec solve yen rest = function
    | [] -> yen
    | (a, b) :: xs ->
        if rest = 0I then
            yen
        elif rest >= b then
            solve (yen + a * b) (rest - b) xs
        else
            solve (yen + a * rest) 0I xs

[<EntryPoint>]
let main _ =
    let [n;m] = reads Numerics.BigInteger.Parse
    let xs =
        List.map (fun _ -> reads Numerics.BigInteger.Parse |> fun [a;b] -> (a, b)) [1 .. int n]
        |> List.sortBy fst
    solve 0I m xs
    |> printfn "%A"
    0

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

int div(int A, int B, int mod_p) {
  stack<int> q_stack;
  int a = B, b = mod_p, r;
  while (b) {
    q_stack.push(a / b);
    r = a % b; a = b; b = r;
  }
  long u = 1, v = 0;
  while (!q_stack.empty()) {
    int q = q_stack.top(); q_stack.pop();
    long u1 = v, v1 = u-q*v; u = u1 % mod_p; v = v1 % mod_p;
  }
  return (long)A * (u + mod_p) % mod_p;
}
 
int num_com(int n, int k, int mod_p) {
  int k2 = min(k, n - k);
  long nmr = 1, dnm = 1;
  for (int i = 1; i <= k2; i++) {
    nmr *= n + 1 - i; nmr %= mod_p;
    dnm *= i; dnm %= mod_p;
  }
  return div(nmr, dnm, mod_p);
}

int main() {
  int DIV = 1e+9 + 7;
  int r1, c1, r2, c2, r3, c3;
  cin >> r1 >> c1 >> r2 >> c2;
  r3 = r2+1; c3 = c2+1;
  int a1 = num_com(r3+c3, c3, DIV),
      a2 = num_com(r3+c1, c1, DIV),
      a3 = num_com(r1+c3, c3, DIV),
      a4 = num_com(r1+c1, c1, DIV);
  int a5 = (a1+a4) % DIV, a6 = (a2+a3) % DIV;
  int res = (a5-a6+DIV) % DIV;
  cout << res << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
      int n;
      scanf("%d",&n);
      int a[n],i;
      for(i=0;i<n;i++){
            scanf("%d",&a[i]);
      }
      int j,k,x=0,ans=0,tm;
      for(i=0;i<n;i++){
            for(j=i+1;j<n;j++){
                  if(a[i]>a[j]){
                        tm=a[i];
                        a[i]=a[j];
                        a[j]=tm;
                  }
            }
      }
      for(i=0;i<n-2;i++){
            if(i>0 && a[i]==a[i-1]){
                  ans+=x;
                  continue;
            }
            x=0;
            for(j=i+1;j<n;j++){
                  if(a[i]==a[j]) continue;
                  for(k=j+1;k<n;k++){
                        if(a[k]==a[j]) continue;
                        if(a[i]+a[j]>a[k] && a[i]+a[k]>a[j] && a[j]+a[k]>a[i]) x++;
                  }
            }
            ans+=x;
      }
      printf("%d\n",ans);
}


Measured memory_bytes: 1728
#include <iostream>
#include <vector>
#define swap(type,x,y) do{type t=x;x=y;y=t;}while(0)
using namespace std;

int main(){
	int n;cin>>n;
  	vector<int> a(n);
  	for(int i=0;i<n;i++)cin>>a.at(i);
  	int mymin;
  	int k,count=0;
  	
  	for(int j=0;j<n-1;j++){
        k=j;
      	mymin=101;
  		for(int i=j;i<n;i++){
    		if(mymin>a.at(i)){
        		mymin=a.at(i);
          		k=i;
        	}
    	}
      if(j!=k){
        swap(int,a.at(j),a.at(k));
        count++;
      }
     }
  	for(int i=0;i<n;i++){
    	cout<<a.at(i);
      	if(i!=n-1) cout<<" ";
    }
  cout<<endl;
  cout<<count<<endl;
}


Measured memory_bytes: 3124
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define iter(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define riter(i, c) for (auto i = (c).rbegin(); i != (c).rend(); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    rep(i, 0, N) cin >> A[i];
    sort(all(A));
    vector<int> dp(K + 1, 0);
    rep(i, 1, K + 1) {
        vector<int> grundy;
        rep(j, 0, N) {
            if (i - A[j] < 0) break;
            grundy.push_back(dp[i - A[j]]);
        }
        if (grundy.size() == 0) {
            continue;
        }
        sort(all(grundy));
        grundy.erase(unique(all(grundy)), grundy.end());
        int now_grundy = (int)grundy.size();
        rep(j, 0, grundy.size()) {
            if (j != grundy[j]) {
                now_grundy = j;
                break;
            }
        }
        dp[i] = now_grundy;
    }
    if (dp[K]) cout << "First" << endl;
    else cout << "Second" << endl;
    return 0;
}

Measured memory_bytes: 640
#include<cstdio>
#include<vector>

using namespace std;

#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define pb push_back

struct edge{ int to; };
vector<edge> G[10000];

int v, e;
#define maxV 10000
vector<edge> sccrG[maxV];
bool sccused[maxV] = {false};
int sccr[maxV], sccrhd = 0;
int scctopo[maxV];

void sccdfs(int now){
  sccused[now] = true;
  for(int i = 0;i < G[now].size();++i)if(!sccused[G[now][i].to])sccdfs(G[now][i].to);
  sccr[sccrhd++] = now;
  return;
}
void sccrdfs(int now, int num){
  sccused[now] = true;
  scctopo[now] = num;
  for(int i = 0;i < sccrG[now].size();++i)if(!sccused[sccrG[now][i].to])sccrdfs(sccrG[now][i].to, num);
  return;
}
void scc(void){
  for(int i = 0;i < v;++i)for(int j = 0;j < G[i].size();++j)sccrG[G[i][j].to].push_back((edge){i});
  for(int i = 0;i < v;++i)if(!sccused[i])sccdfs(i);

  int num = 0;
  for(int i = 0;i < v;++i)sccused[i] = false;
  for(;sccrhd--;)if(!sccused[sccr[sccrhd]])sccrdfs(sccr[sccrhd], num++);
  return;
}

signed main(void){
  scanf("%d%d", &v, &e);
  for(;e--;){
    int2(a, b);
    G[a].pb((edge){b});
  }
  scc();

  int q; scanf("%d", &q);
  for(;q--;){
    int2(u, v);
    puts((scctopo[u] == scctopo[v]) ? "1" : "0");
  }

  return 0;
}

Measured memory_bytes: 4120
#include <bits/stdc++.h>
using namespace std;
long long int mod = 1000000007;
typedef long long int lli;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<lli> vlli;
typedef vector<bool> vb;
long long int max(long long int a,long long int b){
  if(a>b)
    return a;
  else
    return b;
}
long long int min(long long int a,long long int b){
  if(a<b)
    return a;
  else
    return b;
}
long long int binpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1)
      res = res * a % m;
      a = a * a % m;
      b >>= 1;
    }
  return res;
}
long long binpow(long long a, long long b) {
    if (b == 0)
        return 1;
    long long res = binpow(a, b / 2);
    if (b % 2)
        return res * res * a;
    else
        return res * res;
}
 
//############################ENDOFTEMPLATE############################


void solve(){
  int n,m;
  cin>>n>>m;
  vector<string> a(n);
  for(int i = 0;i<n;i++){
    cin>>a[i];
  }

  vector<string> b(m);
  for(int i = 0;i<m;i++){
    cin>>b[i];
  }

  bool ans = false;
  for(int i = 0;i<=n-m;i++){
    for(int j = 0;j<=n-m;j++){
      bool flag = true;
      for(int k = 0;k<m;k++){
        for(int l = 0;l<m;l++){
          if(a[i+k][j+l]!=b[k][l])
            flag = false;
        }
      }
      ans = ans|flag;
    }
  }

  if(ans)
    cout<<"Yes";
  else
    cout<<"No";
}
 
 
 
 
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  //freopen("moobuzz.in","r",stdin);
  //freopen("moobuzz.out","w",stdout);
  int t = 1;
  //cin>>t;
  while(t--){
    solve();
  }
}

Measured memory_bytes: 3600
#include<stdio.h>
int main()
{
	int r,D,x[11];
	int i;
	scanf("%d %d %d",&r,&D,&x[0]);
	for(i=0;i<10;i++){
		x[i+1]=r*x[i]-D;
		printf("%d\n",x[i+1]);
	}
}

Measured memory_bytes: 128
n = gets(chomp:true).to_i
s = gets.split.map(&:to_i)
@count = 0

def merge_s(a, left, mid, right)

  n1 = mid - left
  n2 = right - mid

  l = Array.new(n1)
  r = Array.new(n2)

  (0...n1).each do |i|
    l[i] = a[left + i]
  end

  (0...n2).each do |i|
    r[i] = a[mid + i]
  end
  
  l << Float::INFINITY
  r << Float::INFINITY

  i, j = 0, 0

  (left...right).each do |k|

    @count += 1

    if l[i] <= r[j]
      a[k] = l[i]
      i += 1
    else
      a[k] = r[j]
      j += 1
    end
  end
end

def merge_sort(a, left, right)
  if left + 1 < right
    mid = ( left + right ) / 2
    merge_sort(a, left, mid)
    merge_sort(a, mid, right)
    merge_s(a, left, mid, right)
  end
end

merge_sort(s, 0, n)
puts s.join(" ")
puts @count


Measured memory_bytes: 68336
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main()
{
    scanf("%d",&n);
    printf("%d",a[n-1]);
}


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

int main()
{
	auto f = [](int64_t x, vector<int64_t> &as) {
		int64_t r = 0;
		for (auto &a : as)
		{
			r += x ^ a;
		}
		return r;
	};
	int64_t n, k;
	cin >> n >> k;
	vector<int64_t> as(n);
	for (auto &a : as)
	{
		cin >> a;
	}
	sort(as.begin(), as.end());
	vector<int64_t> puni(61, 0);
	for (int i = 0; i <= 60; i++)
	{
		for (auto &a : as)
		{
			if ((a >> i) & 1)
			{
				puni[i]++;
			}
		}
	}
	int64_t x = 0;
	for (int i = 60; 0 <= i; i--)
	{
		if (puni[i] <= n / 2 && x + (1LL << i) <= k)
		{
			x += (1LL << i);
		}
	}
	cout << f(x, as) << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <set>
#include <vector>

using namespace std;

int main(int argc, char* argv[]) {
  long long N, K;
  cin >> N >> K;

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

  long long c1 = 0;
  long long c2 = 0;
  set<long long> s1;
  set<long long> s2;
  long long cursor = 0;
  vector<long long> o;
  bool first = true;
  while (true) {
    s1.insert(cursor);
    if (!first) {
      s2.insert(cursor);
      o.push_back(cursor);
      ++c2;
    } else {
      ++c1;
      if (c1 == K) {
        cout << a[cursor] << endl;
        return 0;
      }
    }
    cursor = a[cursor] - 1;
    if (!first && s2.find(cursor) != s2.end())
      break;
    if (first && s1.find(cursor) != s1.end()) {
      if (first) {
        first = false;
      }
    }
  }

  long long rest = (K - c1) % c2;

  cout << o[rest] + 1 << endl;

  return 0;
}

Measured memory_bytes: 18188
n = int(input())
f=[]
for i in range(n):
    tmp = list(map(int,input().split()))
    f.append(tmp)
p=[]
for i in range(n):
    tmp = list(map(int,input().split()))
    p.append(tmp)

from itertools import *
first=True
ans=-10**12
for tmp in list(product([0,1], repeat=10)):
    if first:
        first=False
        continue
    sm=0
    for i in range(n):
        cnt=0
        for j in range(10):
            cnt+= tmp[j] & f[i][j]
        sm+=p[i][cnt]
    if ans < sm:
        ans=sm
print(ans)

Measured memory_bytes: 41708
S = gets.chomp

('a'..'z').each do |c|
  cnt = S[0..2].count(c)

  if cnt >= 2
    puts "1 #{[3, S.size].min}"
    exit
  end

  next if S.size <= 3

  S[3..-1].each_char.with_index(4) do |s, i|
    if s == c
      cnt += 1
    end

    if S[i - 4] == c
      cnt -= 1
    end

    if cnt >= 2
      puts "#{i - 2} #{i}"
      exit
    end
  end
end

puts '-1 -1'


Measured memory_bytes: 1916
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int mod=1e9+7;
//const int mod=998244353;
const double eps = 1e-10;
const double pi=acos(-1.0);
const int maxn=1e5+10;
const ll inf=0x3f3f3f3f;
const int dir[4][2]={{0,1},{1,0},{0,-1},{-1,0}};



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    ll x;
    cin>>x;
    ll ans=0;
    ans+=x/500*1000;
    x%=500;
    ans+=x/5*5;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
// const int MOD = 1e9 + 7;

int dp[1005][5000];
int main() {
    int N, M;
    cin >> N >> M;
    vector<int> a(M), b(M), v(M);
    for (int i = 0; i < M; i++) {
        cin >> a.at(i) >> b.at(i);
        int C = 0;
        for (int j = 0; j < b[i]; j++) {
            int c;
            cin >> c;
            C += (1 << (c - 1));
        }
        v[i] = C;
    }

    for (int i = 0; i < 1005; i++) {
        dp[i][0] = 0;
        for (int j = 1; j < 5000; j++) {
            dp[i][j] = INF;
        }
    }

    for (int i = 0; i < M; i++) {
        for (int bit = 0; bit < (1 << N); bit++) {
            chmin(dp[i + 1][bit | v[i]], dp[i][bit] + a[i]);
            chmin(dp[i + 1][bit], dp[i][bit]);
        }
    }
    /*
    for (int bit = 0; bit < (1 << N); bit++) {
        cout << bit << " ";
    }
    cout << endl;
    for (int i = 1; i <= M; i++) {
        for (int bit = 0; bit < (1 << N); bit++) {
            cout << dp[i][bit] << " ";
        }
        cout << endl;
    }*/

    if (dp[M][(1 << N) - 1] == INF) {
        cout << -1 << endl;
    } else {
        cout << dp[M][(1 << N) - 1] << endl;
    }
}


Measured memory_bytes: 19968
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,N) for(int i = 0;i < (int)(N);i++)
int main(){
  int a,b;
  cin>>a>>b;
  int x=a+b;
  if(x%2==1){
    cout<<"IMPOSSIBLE"<<endl;
  }
  else cout<<x/2<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>

#include<cmath>
#include<iostream>
#include<fstream>

#include<string>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<set>
#include<sstream>
#include<stack>

using namespace std;


int main()
{

     int n,i,j,a,b,c,ck=0,dk=0;

     cin>>a>>b;
     cout<<a*b<<" "<<2*(a+b)<<endl;
}



Measured memory_bytes: 3048
import sys

def calc_hull(d,direction):
    maxcos0 = {"r":-1.0,"l":1.0}
    hull = [d[0]]
    p = d[0]
    while True:
        maxcos = maxcos0[direction]
        for i in xrange(1,len(d)):
            if d[i][1] < p[1]  or d[i] == p: continue
            v = [ d[i][0]-p[0] , d[i][1]-p[1] ]
            c = v[0]/(v[0]**2+v[1]**2)**0.5
            if c >= maxcos and direction == "r":
                maxcos = c
                q = d[i]
            if c <= maxcos and direction == "l":
                maxcos = c
                q = d[i]
        p = q
        hull.append(q)
        if q == d[-1]: break
    return hull

while True:
    n = int(raw_input())
    if n == 0: break
    d = []
    for t in xrange(n):
        d.append(map(float,raw_input().split(",")))
    d.sort(key = lambda x:x[1])
    print len(d) - ( len( calc_hull(d,"r") + calc_hull(d,"l") ) - 2)

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

// types
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<pll> vpl;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[9] = {-1, 0, 1, 0, -1,-1,1,1,0};
const int dy[9] = {0, -1, 0, 1, -1,1,-1,1,0};


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

  ll h,w,n;
  cin >> h >> w >> n;
  vll a(n), b(n);
  map<pll, ll> m;
  REP(i, n){
    cin >> a[i] >> b[i];
    m[pll(a[i],b[i])] += 1;
  }


  map<ll, ll> ans;
  map<pll, ll> visited;
  REP(i, n){
    REP(j, 9){
      pll c;
      c.FI = a[i]+dx[j];
      c.SE = b[i]+dy[j];
      if(c.FI<1 || h<c.FI || c.SE<1 || w<c.SE || visited[pll(c.FI, c.SE)] != 0)
        continue;

      visited[pll(c.FI, c.SE)] += 1;
      ll sum = 0;
      bool flag = true;
      REP(k, 9){
        pll cur;
        cur.FI = c.FI+dx[k];
        cur.SE = c.SE+dy[k];
        if(cur.FI<1 || h<cur.FI || cur.SE<1 || w<cur.SE)
          flag = false;

        if(m[pll(cur.FI, cur.SE)] != 0)
          sum++;
      }

      if(flag)
        ans[sum] += 1;
    }
  }

  ll s = 0;
  REP(i, 10)
    s += ans[i];

  ans[0] = max(0LL,(h-2))*max(0LL,(w-2))-s;
  REP(i, 10)
    cout << ans[i] << endl;


}


Measured memory_bytes: 214272
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;

int main() {


    int n, k;
    cin>>n>>k;
    vector<long long> a(n);
    //cin>>a[0];
    //for (int i = 1; i < n; ++i) a[i] = a[i - 1];
    for (int i = 0; i < n; ++i) cin>>a[i];

    vector<long long> sum;
    vector<bool> valid;
    for (int i = 0; i < n; ++i) {
        long long tot = 0;
        for (int j = i; j < n; ++j) {
            tot += a[j];
            sum.push_back(tot);
            valid.push_back(true);
        }
    }

    //int len = static_cast<int>(sum.size());
    //for (int i = 0; i < len; ++i) cout<<sum[i]<<' ';
    //cout<<endl;
    //cout<<sum[999]<<endl;
    //sort(a.begin(), a.end());
    long long ans = 0;
    for (int bit = 40; bit >= 0; --bit) {
        int len = static_cast<int>(sum.size());
        long long opt = 1;
        opt = opt << bit;

        int num = 0;
        for (int i = 0; i < len; ++i) {
            if (valid[i] && (sum[i] & opt) == opt) ++num;
        }

        if (num >= k) {
            for (int i = 0; i < len; ++i) {
                if ((sum[i] & opt) == 0) valid[i] = false;
            }
            //cout<<bit<<' '<<opt<<endl;
            ans += opt;
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 6520
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>

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

#define in(v) v; cin >> v;
void ins() {}
template<class T,class... Rest>void ins(T& v,Rest&... rest){cin>>v;ins(rest...);}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rrep(i,n) for(long long i=(n);i>=0;--i)
#define all(f,c,...) (([&](decltype((c)) cccc) { return (f)(begin(cccc), end(cccc), ## __VA_ARGS__); })(c))

// === debug ===
template<class T>ostream& operator<<(ostream& os,const vector<T>& vec){os<<"{";for(size_t i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
ostream& operator<<(ostream& os,const vector<char>&v){for(size_t i=0;i<v.size();++i)os<<v[i];return os;}
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>& rhs){os<<"("<<rhs.first<<", "<<rhs.second<<")";return os;}

#ifdef LOCAL
void debug() {cerr << "\n";}
template<class First> void debug(const First& first) {cerr<<first<<"\n";}
template<class First, class... Rest> void debug(const First& first, const Rest&... rest) {cerr<<first<<",";debug(rest...);}
void debug2() {cerr << "\n";}
template<class First> void debug2(const First& first) {cerr<<first<<" ";}
template<class First, class... Rest> void debug2(const First& first, const Rest&... rest) {cerr<<first<<" ";debug2(rest...);}
#else
#define debug(...) 42
#define debug2(...) 42
#endif
// === end ===

int main() {
  int N, K;
  ins(N, K);

  vi A(N);
  rep(i, N) {
    cin >> A[i];
  }
  all(sort, A);
  int ok = A.back(), ng = 0;
  auto f = [&](int mid) {
    int ans = 0;
    rep(i, N) {
      ans += (A[i] + mid - 1) / mid - 1;
    }
    return ans <= K;
  };
  while (abs(ok - ng) > 1) {
    int mid = (ok + ng) / 2;
    (f(mid) ? ok : ng) = mid;
  }
  cout << ok << endl;

  return 0;
}


Measured memory_bytes: 4008
# coding: utf-8


def main():
    a, b = map(str, input().split())
    # print(b)

    a = int(a)
    b = str(b)
    # print(b)
    if len(b) == 1:
        b = b[0] + "00"
    elif len(b) == 3:
        b = b[0] + b[2] + "0"
    else:
        b = b[0] + b[2] + b[3]
    # b = b[0] + b[2] + b[3]
    b = int(b)
    # print(b)
    # exit()
    
    return a*b // 100


print(main())


Measured memory_bytes: 9184
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
  string s;
  cin >> s;
  
  string sub_s = s;
  reverse(sub_s.begin(), sub_s.end());
  int l = s.size();
  string a = s.substr(0, (l-1)/2);
  string sub_a = a;
  reverse(sub_a.begin(), sub_a.end());
  string b = s.substr((l+1)/2, l);
  string sub_b = b;
  reverse(sub_b.begin(), sub_b.end());
  
  bool ok = true;
  if(s != sub_s) ok = false;
  if(a != sub_a) ok = false;
  if(b != sub_b) ok = false;
  
  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
    	Scanner sn = new Scanner(System.in);
      int x = sn.nextInt();
      int res = 1;
      int top = 1999;
      int interval = 199;
      while( true ) {
      	if(x <= top && x>= (top - interval)) {
        	System.out.println(res);	
          	break;
        } else {
        	top = top - interval - 1;
           res++;
        }
      }
    }
}

Measured memory_bytes: 35804
// -*- coding:utf-8-unix -*-

use proconio::input;
use ascii::AsciiString;

// ABC086C - Traveling
// https://atcoder.jp/contests/abs/fasks/arc089_a

fn main() {
    input! {
        s: AsciiString,
        t: AsciiString,
    }

    let mut count :usize = 0;
    for i in 0..s.len() {
        if s[i] != t[i] {count += 1;}
    }
    println!("{}", count);
}


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

const int MOD = 1000000007;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define copy(from, to) copy(from.begin(), from.end(), back_inserter(to))
#define _sort(a) sort(a.begin(), a.end())
#define _sortd(a) sort(a.rbegin(), a.rend())
#define reverse(s) reverse(s.begin(), s.end())
#define p(s) cout << (s) << endl

typedef long long ll;
using namespace std;

template<class T>
void load(vector<T> &v, int n) {
  for (int i = 0; i < n; ++i) {
    T t;
    cin >> t;
    v.push_back(t);
  }
}

template<class T>
T max(vector<T> &v) {
  return *max_element(v.begin(), v.end());
}

template<class T>
T min(vector<T> &v) {
  return *min_element(v.begin(), v.end());
}

void py(bool isUpper = false) {
  if (isUpper) {
    p("YES");
  } else {
    p("Yes");
  }
}

void pn(bool isUpper = false) {
  if (isUpper) {
    p("NO");
  } else {
    p("No");
  }
}

int main() {
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  vector<int> a, b;
  load(a, n);
  load(b, m);

  for (int z = x + 1; z <= y; ++z) {
    if (max(a) < z && min(b) >= z) {
      p("No War");
      return 0;
    }
  }
  p("War");
}

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

ld f(int N, int K, int i, vector<ld> & probs, vector<vector<ld> >&dp) {
  	if(K > N) {
      	dp[N][K] = 0.0;
      	return dp[N][K];
    }
  
  	if(N <= 0)
      	if(K==0)
          	return 1;
  		else
	      	return 0;
  
  	if(dp[N][K]!=-1)
      	return dp[N][K];
  
  	
  	
	dp[N][K] = (probs[i] * f(N-1, K-1, i+1, probs, dp))
  				+ ((1-probs[i]) * f(N-1, K, i+1, probs, dp));
  	return dp[N][K];
}

int main() {
  	int N;
  	cin >> N;
  	vector<ld> prob(N+1, 0);
  	vector<vector<ld> > dp(N+1, vector<ld> (N+1, -1));
  	ld res = 0;
  
  	for(int i = 1 ; i <= N ; i++) {
    	cin >> prob[i];
    }
  	
  	// first set up the answer for getting 0 heads using
  	// first i coins, it is the product (1-p1) * (1-p2)* ..*(1-pi)
  	dp[0][0] = 1.0;
    for(int i = 1; i <= N; ++i)
        dp[i][0] = dp[i - 1][0] * (1.0 - prob[i]); // coins are 1 based index
  	
  	// the prob of getting x heads using x coins
  	// is the product of all pis till here
  	for(int i = 1 ; i <= N ; i++)
      	dp[i][i] = dp[i-1][i-1] * prob[i];
  	
  	// probability of selecting head from this coin * probability of getting j - 1
    // heads from all the previous coins + probability of selecting a tail here
    // * probability of getting j heads from all the previous coins
  	for(int i = 1 ; i <= N ; i++) 	// no of coins
    	for(int j = 1 ; j < i ; j++)	// no. of heads
        	dp[i][j] = dp[i - 1][j] * (1 - prob[i])
          				+ dp[i-1][j-1] * (prob[i]);
  
  	for(int i = N/2+1 ; i <= N ; i++)
      	res += dp[N][i];
  	cout<<fixed<<setprecision(10) << res << endl;
  	
  	return 0;
}

Measured memory_bytes: 141056
#include<stdio.h>
int main(void){
  int a,b,c,d;
  scanf("%d %d %d %d",&a ,&b ,&c ,&d);
  if(a+b > c+d){
    puts("Left");
  }
  else if(a+b == c+d){
    puts("Balanced");
  }
  else{
    puts("Right");
  }
  return 0;
}

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

const int MAXN = 1e2 + 5;
const int MAXK = 1e5 + 5;
const ll MOD = 1e9 + 7;
ll dp[MAXN][MAXK], a[MAXN];

int main() {
    int n, k;
    cin >> n >> k;
    for(int i = 1; i <= n; i++)
        cin >> a[i];
    for(int i = 0; i <= n; i++) {
        if(i == 0) {
            for(int w = 0; w <= k; w++)
                dp[i][w] = 1;
            continue;
        }
        dp[i][0] = dp[i - 1][0];
        for(int w = 1; w <= k; w++) {
            dp[i][w] = dp[i][w - 1];
            dp[i][w] = (dp[i][w] + dp[i - 1][w]) % MOD;
            if(w - a[i] > 0)
                dp[i][w] = (dp[i][w] - dp[i - 1][w - a[i] - 1] + MOD)%MOD;
        }
    }
    if(k == 0)
        cout << dp[n][k] << endl;
    else
        cout << (dp[n][k] - dp[n][k - 1] + MOD)%MOD << endl;
}


Measured memory_bytes: 80128
/*
ID: Motyaspr
LANG: C++11
TASK: dualpa
*/

#define _CRT_SECURE_NO_WARNINGS

// comment(linker, "/STACK:256000000")
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <ctime>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <deque>
#include <cassert>
#include <cstdlib>
#include <bitset>
#include <algorithm>
#include <string>
#include <list>
#include <fstream>
#include <cstring>
#include <climits>
#include <stack>
#include <random>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define forn(i, n) for(int i = 0; i < n; i++)
#define pk push_back
#define mk make_pair
#define all(v) v.begin(), v.end()
#define X first
#define Y second
#define TASK "ufo"

const double EPS = 1e-9;
const double pi = acos(-1.0);

const int MAXN = (int)1e5 + 150;
const ll INF = (ll)1e9 + 7;
const ll LINF = (ll)1e18 + 7;
const ll MOD = (ll)1e9 + 7;;
const ll P = 31;
const ll SZ = 50000 + 228;
const int K = 10;

int cnt[3001];

void fac(int x)
{
	int cop = x;
	for (int i = 2; i * i <= x; i++)
	{
		while (x % i == 0)
		{
			x /= i;
			cnt[i]++;
		}
		if (x == 1)
			break;
	}
	if (x != 1)
		cnt[x]++;
}

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
#else
	//freopen(TASK".in", "r", stdin), freopen(TASK".out", "w", stdout);
#endif
	srand(time(0) + 'P'	);	
	int n;
	cin >> n;
	for (int i = 2; i <= n; i++)
		fac(i);
	ll ans = 1;
	for (int i = 2; i <= n; i++)
	{
		ans = (ans * (cnt[i] + 1)) % MOD;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
def resolve():
    n = int(input())
    h = list(map(int, input().split()))
    dp = [float("inf") for i in range(n)]
    dp[0] = 0

    for i in range(n-1):
        dp[i+1] = min(dp[i+1], dp[i] + abs(h[i+1] - h[i]))
        if i < n-2:
            dp[i+2] = min(dp[i+2], dp[i] + abs(h[i+2] - h[i]))

    print(dp[n-1])
    
resolve()

Measured memory_bytes: 52984
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#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 fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
// #define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;


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

    ll n,t;
    cin>>n>>t;
    vll v(n);
    rep(i,n)cin>>v[i];
    ll ans=0;
    ll first=0,second=0;
    if(n==1){
        ans+=t;
        fin(ans);
        return 0;
    }
    v.push_back(LLINF);
    for(int i=0;i<n;i++){
        // cout<<i<<endl;
        ll tmp=0;
        first=i;
        // cout<<v[first+tmp+1]<<" "<<v[first+tmp]+t<<endl;
        while(v[first+tmp+1]<=v[first+tmp]+t){
            tmp++;
        }
        ans+=v[first+tmp]+t-v[first];
        i+=tmp;
        // cout<<tmp<<" "<<ans<<endl;
    }
    fin(ans);


//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 4864
/*
 *  Lang    : C++
 *  Author  : little_angel
 */
#include <bits/stdc++.h>

#include <random>

using namespace std;
#define int long long


string sol(int n) {
    if (n <= 26)return string(1, 'a' + n - 1);
    int x = (n - 1) % 26;
    return sol((n - 1) / 26 ) + string(1, 'a' + x);
}

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

    int n;
    cin >> n;
    cout << sol(n) << endl;
}

Measured memory_bytes: 3652
'use strict';
(function(stdin) {
  var inputs  = stdin.toString().trim().split(' ');
  var a = parseInt(inputs[0]);
  var b = parseInt(inputs[1]);
  var c = parseInt(inputs[2]);
 
  console.log(a<b && b<c ? 'Yes' : 'No');
 
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

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

using namespace std;

int main()
{
	double k ;
	int a,b,n;
	cin>>k>>a>>b;
	if ((k*ceil(a/k))<=b && (k*ceil(a/k))>=a){
		cout<<"OK";
	}
	else{
		cout<<"NG";
	}
	
		
	return 0;
}

Measured memory_bytes: 3740
#include<bits/stdc++.h>
using namespace std;
int a[111],n;
int main()
{
	cin>>n;
	for(int i=0;i<n;++i)cin>>a[i];
	sort(a,a+n,greater<int>());
	int ans=0;
	int d=1;
	for(int i=0;i<n;++i)
	{
		ans+=a[i]*d;
		d*=-1;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(i, name)in(i)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(i,v) for(auto &i:(v))
#define all(v) (v).begin(),(v).end()
#define print(...) out(__VA_ARGS__);cout<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void out(){} template<class T,class... U> void out(T t,U ...u){cout<<t<<" ";out(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(int, A, B, C, D);
  int x = A + B;
  int y = C + D;
  print(x == y ? "Balanced" : x > y ? "Left" : "Right");
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner s=new Scanner(System.in);
        int a=s.nextInt();
        int b=s.nextInt();
        int c=s.nextInt();
        int d=s.nextInt();
        int[] x=new int[100000];
        int i,count=0;
        for(i=0;i<100000;i++)x[i]=0;
        for(i=a;i<b;i++)x[i]++;
        for(i=c;i<d;i++)x[i]++;
        for(i=0;i<100000;i++){
            if(x[i]==2)count++;
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 23892
// テ・ツ淞コテヲツ慊ャテ」ツδ?」ツδウテ」ツδ療」ツδャテ」ツδシテ」ツδ?

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

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

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

int N;
int imos[100010];

signed main() {
    cin >> N;
    rep(i,0,N) {
        int a, b; cin >> a >> b;
        imos[a]++; imos[b+1]--;
    }

    rep(i,1,100010) imos[i] += imos[i-1];
    int ans = 0;
    rep(i,0,100010) {
        // if(i < 10) printf("i = %lld, imos = %lld\n", i, imos[i]);
        if(imos[i] + 1 >= i) chmax(ans, i-1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3884
import java.util.Scanner;

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

        int a = scan.nextInt();

        int b = scan.nextInt();
        
        int c = scan.nextInt();
        
        if(a<b&&b<c){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } 
}


Measured memory_bytes: 26352
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,n) for(int i = (a); i < (n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define debug_v(v,N) for(int i=0;i<N;i++) { cout << v[i] << " "; } cout << endl;
#define debug_vv(v,H,W) for(int i=0;i<H;i++) { for(int j=0;j<W;j++) { cout << v[i][j] << " "; } cout << endl; }

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

void Main()
{
	int N; cin >> N;
	vi B(N - 1);
	rep(i, N - 1) {
		cin >> B[i];
	}
	ll res = 0;
	res += B[N - 2];
	res += B[0];
	for (int i = (N - 2); i >= 1; --i) {
		res += min(B[i], B[i - 1]);
	}
	cout << res << endl;
}

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


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int n,b,f,r,v;
    cin >> n;
    int a[4][3][10]={};
    for(int i=0;i<n;i++){
        cin >>b >>f >> r >>v;
        a[b-1][f-1][r-1]+=v;
    }
    for(int x=0;x<4;x++){
        for(int y=0;y<3;y++){
            for(int z=0;z<10;z++){
                cout <<" "<< a[x][y][z];
            }
            cout<<endl;
        }if(x!=3)cout <<"####################"<<endl; 
    }
    return 0;
}




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

int main(){
  int H,W,K,ans=0;
  cin >> H >> W >> K;
  vector<vector<char>> C(H,vector<char> (W));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> C.at(i).at(j);
    }
  }
  for(int bitH=0;bitH<(1<<H);bitH++){
    for(int bitW=0;bitW<(1<<W);bitW++){
      int count=0;
      for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
          if(bitH & (1<<i)){
            continue;
          }
          if(bitW & (1<<j)){
            continue;
          }
          if(C.at(i).at(j)=='#'){
            count++;
          }
        }
      }
      if(count==K){
        ans++;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1000000007;
ll INF = 1ll << 60;

int n, W;
const int max_n = 110;
const int max_v = 100010;
ll weight[max_n], value[max_n];
ll dp[max_n][max_v];  // i番目までで、価値がvになるときの重さの最小値

int main() {
  cin >> n >> W;
  for (int i = 0; i < n; i++) cin >> weight[i] >> value[i];

  for (int i = 0; i < max_n; ++i)
    for (int j = 0; j < max_v; ++j) dp[i][j] = INF;

  dp[0][0] = 0;
  dp[0][value[0]] = weight[0];

  // 貰うDP
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < max_v; j++) {
      if (j - value[i] >= 0)
        dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - value[i]] + weight[i]);
      else
        dp[i][j] = min(dp[i][j], dp[i - 1][j]);
    }
  }

  int ans = 0;
  for (int v = 0; v <= max_v; v++)
    if (dp[n][v] <= W) ans = max(ans, v);

  cout << ans << endl;
}


Measured memory_bytes: 86144
n, m = gets.split.map{|e| e.to_i}
 
str = "x" * n
 
m.times do
  s, c = gets.split.map{|e| e.to_i}
  if str[s-1] == "x" or str[s-1] == "#{c}"
    str[s-1] = "#{c}"
  else
    puts "-1"
    exit
  end
end


nums = []


if str.length == 3
  0.upto(1) do |x|
    0.upto(1) do |y|
      0.upto(1) do |z|
        tmp = str.dup
        if tmp[0] == "x"
          tmp[0] = "#{x}"
        end
        if tmp[1] == "x"
          tmp[1] = "#{y}"
        end
        if tmp[2] == "x"
          tmp[2] = "#{z}"
        end
        if tmp.to_i.to_s.length == 3
          nums << tmp.to_i
        end
      end
    end
  end
elsif str.length == 2
  0.upto(1) do |x|
    0.upto(1) do |y|
      tmp = str.dup
      if tmp[0] == "x"
        tmp[0] = "#{x}"
      end
      if tmp[1] == "x"
        tmp[1] = "#{y}"
      end
      if tmp.to_i.to_s.length == 2
        nums << tmp.to_i
      end
    end
  end
else str.length == 1
  0.upto(1) do |x|
    tmp = str.dup
    if tmp[0] == "x"
      tmp[0] = "#{x}"
    end
    if tmp.to_i.to_s.length == 1
      nums << tmp.to_i
    end
  end
end

if nums.length == 0
  puts -1
  exit
else
  puts nums.min
end


Measured memory_bytes: 3836
import scipy.misc as scm
N = int(input())

e = N //2
if N %2 == 0:
  print(scm.comb(e, 1, 1)*scm.comb(e, 1, 1))
else:
  print(scm.comb(e, 1, 1)*scm.comb(e+1, 1, 1))

Measured memory_bytes: 13624