akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int n, x; cin >> n >> x;
	vi v(n); rep(i, n) cin >> v[i];
	sort(all(v));
	rep(i, n){
		if(x - v[i] < 0){
			cout << i << endl;
			return 0;
		}
		x -= v[i];
	}
	cout << n - (x != 0) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include<cstring>
#include<iostream>
#include<vector>
#include<map>
#define maxn 200000+100
using namespace std;
typedef long long ll;
int mapp[105][105];
int main() {
	int a,b;
	cin >> a >> b;
	for(int i=1; i<=100; i++) {
		for(int j=1; j<=100; j++) {
			if(j<=50) mapp[i][j]=1;
			else mapp[i][j]=0;
		}
	}
	a--;
	b--;
	for(int i=1; i<=100&&a; i+=2) {
		for(int j=1; j<=50&&a; j+=3) {
			mapp[i][j]^=1;
			a--;
		}
	}
	for(int i=1;i<=100&&b;i+=2) {
		for(int j=52;j<=100&&b;j+=3) {
			mapp[i][j]^=1;
			b--;
		}
	}
	printf("100 100\n");
	for(int i=1;i<=100;i++) {
		for(int j=1;j<=100;j++) {
			if(mapp[i][j])  printf("#");
			else printf(".");
		}
		printf("\n");
	}
}


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

namespace Tasks
{
    public class D
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var N = Scanner.Scan<int>();
            var answer = 0L;
            for (var x = 1; x <= N; x++)
            {
                var y = (long)N / x;
                answer += (y * (y + 1) / 2) * x;
            }

            Console.WriteLine(answer);
        }

        public static class Scanner
        {
            private static Queue<string> queue = new Queue<string>();
            public static T Next<T>()
            {
                if (!queue.Any()) foreach (var item in Console.ReadLine().Trim().Split(" ")) queue.Enqueue(item);
                return (T)Convert.ChangeType(queue.Dequeue(), typeof(T));
            }
            public static T Scan<T>() => Next<T>();
            public static (T1, T2) Scan<T1, T2>() => (Next<T1>(), Next<T2>());
            public static (T1, T2, T3) Scan<T1, T2, T3>() => (Next<T1>(), Next<T2>(), Next<T3>());
            public static (T1, T2, T3, T4) Scan<T1, T2, T3, T4>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>());
            public static (T1, T2, T3, T4, T5) Scan<T1, T2, T3, T4, T5>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>(), Next<T5>());
            public static IEnumerable<T> ScanEnumerable<T>() => Console.ReadLine().Trim().Split(" ").Select(x => (T)Convert.ChangeType(x, typeof(T)));
        }
    }
}


Measured memory_bytes: 28332
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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

  int a = S[K - 1];
  a = a - 'A' + 'a';
  S[K - 1] = a;

  cout << S << endl;
  
}

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

#define sc second
#define fr first
#define mk make_pair
#define pb push_back
#define int long long

using namespace std;

const int N = (1e6 + 5);
const int inf = (1e9 + 7);

int k,a,b;
int ans = 1;

main () {
    cin >> k >> a >> b;

    if (a + 1 < b) {
        k -= (a - 1);
        ans = a;
        ans += (k / 2) * (b - a);
        if (k % 2) ans ++;
    }
    else {
        ans += k;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
# ABC064
# C
# Colorful Leaderboard

n = int(input())
a_list = list(map(int, input().split()))

color_list = [0]*8
over = 0
for i in range(n):
    _ = a_list[i] // 400
    if _ < 8:
        color_list[_] = 1
    else:
        over += 1

_tmp = sum(color_list)
if _tmp == 0:
    print("1 %d"%over)
else:
    print("%d %d"%(_tmp, _tmp+over))

Measured memory_bytes: 3064
# coding: utf-8
# Your code here!
from fractions import gcd
from functools import reduce

N,K=map(int,input().split())
l=list(map(int,input().split()))

if max(l)<K:
    print("IMPOSSIBLE")
else:
    if K%reduce(gcd, l)==0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

Measured memory_bytes: 16208
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second

int n;
double x[55], y[55], X, Y, d, e;

double dist(double a, double b) {
	return a*a + b*b;
}

int main() {
	//freopen("in.txt", "r", stdin);
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
		X += x[i]; Y += y[i];
	}
	X /= n; Y /= n;
	double P = 0.1;
	for (int i = 0; i < 30000; i++) {
		int f = 0;
		d = dist(X - x[0], Y - y[0]);
		for (int j = 1; j < n; j++) {
			e = dist(X - x[j], Y - y[j]);
			if (d < e) { d = e; f = j; }
		}
		X += (x[f] - X)*P;
		Y += (y[f] - Y)*P;
		P *= 0.999;
	}
	cout << fixed << setprecision(12) << sqrt(d) << '\n';
}

Measured memory_bytes: 384
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7



def main():
    N = int(readline())
    P = list(map(int, readline().split()))
    for i in range(1,N+1):
        P[i-1] -= i
    P = P + [1,1]
    ans = 0
    i = 0
    while i<N:
        if P[i]==0 and P[i+1]==0:
            ans += 1
            i += 2
        elif P[i]==0 and P[i+1]!=0:
            ans += 1
            i += 2
        else:
            i += 1
    print(ans)



if __name__ == '__main__':
    main()

Measured memory_bytes: 12392
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <typeinfo>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T>
using Tree =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;  // check the limits, dummy

typedef long long ll;
const int inf = INT_MAX / 2;
const ll infl = 1LL << 60;
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;
}

template <class T>
void print(const vector<T> v) {
  cout << "[ ";
  F0R(i, v.size()) { cout << v[i] << ' '; }
  cout << "]" << '\n';
}

int mod(int i, int j) {
  return (i % j) < 0 ? (i % j) + 0 + (j < 0 ? -j : j) : (i % j + 0);
}

unsigned euclidean_gcd(unsigned a, unsigned b) {
  if (a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r = a % b)) {
    a = b;
    b = r;
  }
  return b;
}

template <typename T>
std::string printVector(const std::vector<T> &data) {
  std::stringstream ss;
  std::ostream_iterator<T> out_it(ss, ", ");
  ss << "[";
  std::copy(data.begin(), data.end() - 1, out_it);
  ss << data.back() << "]";
  return ss.str();
}

// --------------------------------------------------------
// This is tool
// --------------------------------------------------------
void Main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  // 標準入力
  int n, m, x;
  cin >> n >> m >> x;
  vi C(n);
  vector<vector<int>> A(n, vector<int>(m));
  FOR(i, 0, n) {
    cin >> C[i];
    FOR(j, 0, m) { cin >> A[i][j]; }
  }

  int ans = 100000009;

  // 全ての組みわせ
  FOR(i, 0, pow(2, n)) {
    // 各理解度を初期化
    vi X(m, 0);
    // ほんの合計値段を初期化
    int price = 0;

    // 全ての本について
    FOR(j, 0, n) {
      // その桁が１かどうか
      if ((i >> j) & 1) {
        // その本の値段を足す
        price += C[j];
        FOR(k, 0, m) { X[k] += A[j][k]; }
      }
    }
    // X.min>=xならば満たす
    if (*min_element(X.begin(), X.end()) >= x) {
      ans = min(ans, price);
    }
  }
  if (ans == 100000009) {
    cout << "-1" << endl;
  } else {
    cout << ans << endl;
  }
}

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

Measured memory_bytes: 4104
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#define MOD 1000000007LL
using namespace std;

long long int inv(long long int x){
	long long int xpow[30], c[30];
	for(int i=0; i<30; i++){
		if(i==0){
			xpow[i]=x;
			c[i]=1;
		}else{
			xpow[i]=xpow[i-1]*xpow[i-1]%MOD;
			c[i]=c[i-1]*2;
		}
	}
	long long int r=MOD-2, xinv=1;
	for(int i=29;i>=0; i--){
		if(r>=c[i]){
			xinv=xinv*xpow[i]%MOD;
		}
		r=r%c[i];
	}
	return xinv;
}

int main()
{
	long long int n;
	scanf("%lld", &n);
	long long int f[1000001], invf[1000001];
	f[0]=1, invf[0]=1;
	for(long long int i=1; i<=n; i++){
		f[i]=f[i-1]*i%MOD;
		invf[i]=inv(f[i]);
	}
	long long int x[500002];
	for(long long int i=1; i<=n/2; i++){
		x[i]=f[n-i]*f[n-i-1]%MOD*invf[n-2*i]%MOD*invf[i-1]%MOD*f[i-1]%MOD;
	}
	x[n/2+1]=0;
	long long int ans=0;
	for(long long int i=1; i<=n/2; i++){
		ans=(ans+(n-i)*(x[i]-x[i+1]+MOD)%MOD)%MOD;
	}
	printf("%lld\n", ans);

	return 0;
}

Measured memory_bytes: 19712
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: i64,
        d: i64,
    }

    let d = d * 2 + 1;

    let ans = (n + d - 1) / d;

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define EPS 1e-10
#define INF 1000000000
#define mp make_pair
#define pb push_back

typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int,int> pii;
typedef long long ll;

int main() {
  string r = "";
  for (int t = 0; t < 3; t++) {
    string s;
    cin >> s;
    r += s[0];
  }
  transform(r.cbegin(), r.cend(), r.begin(), ::toupper);
  cout << r << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <limits>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <vector>
#include <deque>
#include <cmath>

using namespace std;

int n;
long long min_sum;

int main() {
    scanf("%d", &n);
    int prev_max = 0, cur;
    for (int i = 0; i < n; ++i) {
        scanf("%d", &cur);
        prev_max = max(prev_max, cur);
        min_sum += (prev_max - cur);
//        if (prev > cur) {
//            min_sum += (prev - cur);
//        } else {
//            prev = cur;
//        }
    }
    printf("%lld\n", min_sum);

    return 0;
}


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

int card[1000], tmp[1000], n, r;
int main()
{
loop:
  cin >> n >> r;
  if(!(n || r))
    return 0;
  for(int i = n; i > 0; i--)
    card[n - i] = i;
  for(int i = 0; i < r; i++)
  {
    int c, p;
    cin >> p >> c;
    for(int j = 0; j < p - 1; j++)
      tmp[j] = card[j];
    for(int j = 0; j < c; j++)
      card[j] = card[j + p - 1];
    for(int j = 0; j < p - 1; j++)
      card[j + c] = tmp[j];
  }
  cout << card[0] << endl;
  goto loop;
}

Measured memory_bytes: 1164
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
 
using namespace std;
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define in(x, y) (0 <= (x) && (x) < w && 0 <= (y) && y < h)
#define f(x, y) (y*w+x)
 
typedef pair<int, int> P;
 
struct UnionFind{
    vector<int> par;
    UnionFind(int n){
        par.resize(n);
        rep(i, n) par[i] = i;
    }
    int find(int x){
        if (x == par[x]) return x;
        return par[x] = find(par[x]);
    }
    void unite(int x, int y){
        par[find(x)] = find(y);
    }
    bool same(int x, int y){
        return find(x) == find(y);
    }
};
 
const int MAXN = 110;
int e[MAXN], c[MAXN], h[MAXN], a[MAXN];
 
int dp1[MAXN][MAXN]; // トレーニングの種類、消費体力あたりの消費カロリー
int dp2[MAXN*MAXN]; // 摂取カロリーあたりの幸福度
int dp3[MAXN];      // 体力あたりの幸福度
int dp4[MAXN][MAXN]; // 日数、消費体力あたりの幸福度
 
int main(){
    int S, T, U, N, O, D;
    cin >> S >> T >> U >> N >> O >> D;
    rep(i, T) cin >> e[i] >> c[i];
    rep(i, N) cin >> h[i] >> a[i];
 
    const int INF = 1 << 29;
 
    rep(i, MAXN) rep(j, MAXN) dp1[i][j] = -INF;
    rep(i, MAXN*MAXN) dp2[i] = -INF;
    rep(i, MAXN) dp3[i] = -INF;
    rep(i, MAXN) rep(j, MAXN) dp4[i][j] = -INF;
 
    //{
    //  S = 100, T = 100, U = 100, N = 100, O = 100, D = 100;
    //  for (int i = 0; i < 100; ++i) e[i] = 1;
    //  for (int i = 0; i < 100; ++i) c[i] = 100;
    //  for (int i = 0; i < 100; ++i) h[i] = 100;
    //  for (int i = 0; i < 100; ++i) a[i] = 100;
    //}
 
 
    {
        auto &dp = dp1;
        dp[0][0] = 0;
        rep(i, T) for (int j = U - 1; j >= 0; --j) rep(k, S){
            if (k + e[i] > S) continue;
            dp[j + 1][k + e[i]] = max(dp[j + 1][k + e[i]], dp[j][k] + c[i]);
        }
    }
    {
        auto &dp = dp2;
        dp[0] = 0;
        rep(i, N){
            for (int j = 0; j <= 10000; ++j){
                dp[j + a[i]] = max(dp[j + a[i]], dp[j] + h[i]);
            }
        }
        FOR(i, 1, 10001){
            dp[i] = max(dp[i], dp[i - 1]);
        }
    }
    {
        auto &dp = dp3;
        for (int i = 0; i <= S; ++i){
            if (dp1[U][i] < 0) continue;
            dp[i] = dp2[dp1[U][i]];
        }
        //cout << S << endl;
        //rep(i, S + 1) cout << i << " " << dp[i] << endl;
    }
    {
        auto &dp = dp4;
        dp[0][0] = 0;
        rep(i, D) rep(j, S) rep(k, S+1) {   // i日目に消費体力がjのとき
            if (j + k > S) continue;
            dp[i + 1][max(0, j + k - O)] = max(dp[i + 1][max(0, j + k - O)], dp[i][j]+dp3[k]);
        }
        int ans = *max_element(dp[D], dp[D + 1]);
        if (ans < 0) ans = -1;
        cout << ans << endl;
    }
 
 
    return 0;
}

Measured memory_bytes: 1308
#include <stdio.h>
int main(void){
    long long int N,i,ans=0;
    scanf("%ld",&N);
    int A[N+1],B[N];
    for(i=0;i<N+1;i++)scanf("%ld",&A[i]);
    for(i=0;i<N;i++)scanf("%ld",&B[i]);
    for(i=0;i<N;i++){
        if(A[i]>=B[i]){
            A[i] -=B[i];
            ans +=B[i];
        }else{
            ans += A[i];
            if(A[i+1] >= (B[i]-A[i])){
                A[i+1] -=(B[i]-A[i]);
                ans += (B[i]-A[i]);
            }else{
                ans +=A[i+1];
                A[i+1] =0;
            }
        }
    }
    printf("%ld",ans);
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
 
const int mx=100010;
const ll mod=1e9+7;
#define bit(n,k) ((n>>k)&1) //*n no k bit me 1 or 0*/

vector<ll> sum(1<<16,0);
vector<ll> dp(1<<16,-longinf);


//https://atcoder.jp/contests/dp/submissions/3947991

ll rec(int mask){
  if(dp[mask]!=-longinf){ return dp[mask]; }
  if(mask==0){ return 0; }
  int x=17;
  while(((1<<x)&mask)==0){x--;}
  mask^=(1<<x); 								//?? for  for-bun keisan?
  ll ret=-longinf;
  for(int i=mask;i>=0;--i){
    i&=mask;
//    ret=max(ret,sum[i]+rec(mask-i));
    ret=max(ret,sum[(1<<x)+i]+rec(mask-i));      //??
  }
//  return dp[mask]=ret;						//??
  return dp[mask^(1<<x)]=ret;
}

int main(){
  int n;
  cin >> n ;
  vector<vector<ll>> a(20, vector<ll>(20,0));
  rep(i,n)rep(j,n){ cin>>a[i][j]; }
  int mask=1<<n;
  rep(i,mask)rep(j,n)rep(k,j){
    if((i&(1<<j))&&(i&(1<<k))){ sum[i]+=a[j][k]; }
  }
  
  ll ans = rec(mask-1);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (in i = 0; i < (in)(n); i++)
const double PI=3.14159265358979323846;
const int64_t waru = 1000000007;
const in INF=1<<30;
#define vecvec(a,y,x) vector<vector<int>> a(y,vector<int>(x))
#define vec(a,n) vector<int> a(n);rep(i,n)cin>>a[i]

int main(){
vec(a,2);
  cin>>a[0]>>a[1];
  int sum =0;
  rep(i,2){
    int x=a[i];
    if(x==3) sum+=100000;
    if(x==2) sum+=200000;
    if(x==1) sum+=300000;
  }
  if(sum==600000) sum+=400000;
  cout<<sum;
}

Measured memory_bytes: 256
from collections import Counter
a=int(input())
l=list(map(int,input().split()))
b=int(input())
s=Counter(l)
initial_sum=sum(l)

for _ in range(b):
  x,y=map(int,input().split())
  k=s[x]
  s[x]=0
  s[y]+=k
  initial_sum+=(y-x)*k
  print(initial_sum)


Measured memory_bytes: 23952
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
 
public class Main {
 
	public Main() {
		// TODO 自動生成されたコンストラクター・スタブ
	}
 
	public static void main(String[] args){
		Map <Integer,Integer> mapX = new HashMap<Integer,Integer> ();
		int x[][];
		Scanner sc = new Scanner(System.in);
			// 整数の入力
			long l,r,k;
			long n,d,index,index2,j;
			long sum,result,xd;
			double rd;;
			
			l = sc.nextLong();
			r = sc.nextLong();
			sc.close();
			if(r>l+2019*2) {
				k=(r-l)/2019;
				r=r-(k-1)*2019;
			}
			
			result=2019;

			for(index=l;index<r;index++) {
				for(index2=index+1;index2<=r;index2++) {
					k=index*index2%2019;
					//System.out.print(index+":"+index2+":"+k+":");
					//System.out.println(result);
					if(k<result) {
						result=k;
					}
				}
			}
			System.out.println(result);

			
 
			// 出力
 
	}
}

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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a,b,c;
  cin >> a >> b >> c;
  cout << max(0,c-(a-b)) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int maxn=5010;
ll n,m,a[maxn][220],stac[maxn],l[maxn][220],r[maxn][220];
ll dis[maxn],del[maxn][maxn];
int main()
{
	scanf("%lld%lld",&n,&m);
	for(int i=2;i<=n;++i)scanf("%lld",&dis[i]),dis[i]=dis[i]+dis[i-1];
	for(int i=1;i<=n;++i) for(int j=1;j<=m;++j) scanf("%lld",&a[i][j]);
	for(int j=1;j<=m;++j)
	{
		int top=0;
		for(int i=1;i<=n;++i){
			while(top&&a[stac[top]][j]<a[i][j])--top;
			l[i][j]=top?stac[top]+1:1;
			stac[++top]=i;
		}
		top=0;
		for(int i=n;i>=1;--i){
			while(top&&a[stac[top]][j]<a[i][j])--top;
			r[i][j]=top?stac[top]-1:n;
			stac[++top]=i;
		}
		for(int i=1;i<=n;++i){
			del[l[i][j]][i]+=a[i][j];
			del[i+1][i]-=a[i][j];
			del[l[i][j]][r[i][j]+1]-=a[i][j];
			del[i+1][r[i][j]+1]+=a[i][j];
		}
	}
	ll ans=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++)del[i][j]+=del[i][j-1];
		for(int j=1;j<=n;j++)del[i][j]+=del[i-1][j];
		for(int j=i;j<=n;j++)ans=max(ans,del[i][j]-dis[j]+dis[i]); 
	} 
	printf("%lld\n",ans); 
}


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

int main() {
int n,n1,n2,n3,n4;
cin >> n;
n1 = n/1000;
n2 = n /100 - n1*10;
n3 = n/10 - n1*100 - n2 *10;
n4 = n - n1*1000 - n2*100 - n3*10;
if(n1 ==  n2 && n2 == n3){
cout << "Yes" << endl;
}
else if(n2 == n3 && n3 == n4){
cout << "Yes" << endl;
}
if(n2 != n3){
cout << "No" << endl;
}
else if(n1 != n2 && n3 !=n4){
cout << "No" << endl;
}
}

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

int main(){
	string s1;
	cin >> s1;
	int len = s1.size();
	int js=0;
	int l = 0,r = len-1;
	while(l<r){
		if(s1[l] != s1[r]){
			js++;
		}
		l++;
		r--;
	}
	printf("%d",js);
	return 0;
} 

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
from collections import deque

n, m = map(int, input().split())
g = [[] for _ in range(3 * n)]
for i in range(m):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    # u0 -> v1
    g[3 * u].append(3 * v + 1)
    # u1 -> v2
    g[3 * u + 1].append(3 * v + 2)
    # u2 -> v0
    g[3 * u + 2].append(3 * v)

s, t = map(int, input().split())
s = 3 * (s - 1)
t = 3 * (t - 1)

depth = dict()
depth[s] = 0
q = deque([s])


while(len(q) != 0):
    v = q.popleft()
    for u in g[v]:
        if u not in depth:
            q.append(u)
            depth[u] = depth[v] + 1

print(depth[t] // 3 if t in depth else -1)

Measured memory_bytes: 105508
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
        self.group_count = 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

        self.group_count -= 1

        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 all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

n, q = map(int, input().split())
uf = UnionFind(n)
for _ in range(q):
    com, x, y = map(int, input().split())
    if com == 0:
        uf.union(x, y)
    else:
        print(int(uf.same(x, y)))



Measured memory_bytes: 5784
import math
import sys
import collections
import bisect
readline = sys.stdin.readline


def main():
    n, k = map(int, readline().rstrip().split())
    A = list(map(int, readline().rstrip().split()))
    for i in range(n - k):
        print('Yes' if A[k+i] > A[i] else 'No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 32380
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,N-1,0)
#define RREPS(i,n) RFOR(i,N,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const int INF=1e18;
const int MOD=1e9+7;
const int MAX=200001;

int COM(int n,int r){
    while(n!=0&&r!=0){
        if(!(n%2)&&(r%2))return 0;
        n/=2;r/=2;
    }
    return 1;
}

signed main(){
    int N;string S;cin>>N>>S;
    int A[N];
    bool oexist=false;
    REP(i,N){
        A[i]=S[i]-'1';
        if(A[i]==1)oexist=true;
    }
    int sum=0;
    if(oexist){
        REP(i,N){
            if(A[i]==1)sum+=COM(N-1,i);
        }
        cout<<(sum%2==0?0:1)<<endl;
    }
    else{
        REP(i,N){
            if(A[i]==2)sum+=COM(N-1,i);
        }
        cout<<(sum%2==0?0:2)<<endl;
    }
}

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

#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define FORV(a, A) for (auto &a : A)

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

void Main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> a(10, -1);
  rep(i, n) {
    if (a[s[i] - '0'] == -1) a[s[i] - '0'] = i;
  }

  vector<vector<int>> b(10, vector<int>(10, -1));
  rep(i, 10) {
    int v = a[i];
    if (v == -1) continue;
    REP(j, v + 1, n) {
      if (b[i][s[j] - '0'] == -1) b[i][s[j] - '0'] = j;
    }
  }

  int c[10][10][10];
  rep(i, 10) rep(j, 10) rep(k, 10) c[i][j][k] = -1;
  int ans = 0;
  rep(i, 10) {
    rep(j, 10) {
      int v = b[i][j];
      if (v == -1) continue;
      REP(k, v + 1, n) {
        if (c[i][j][s[k] - '0'] == -1) {
          c[i][j][s[k] - '0'] = k;
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 384
#include <iostream>

using namespace std;

int n, k, x, a[10];

bool f(int n) {
	while (n > 0) {
		if (a[n % 10]) return true;
		n /= 10;
	}
	return false;
}

int main() {
	cin >> n >> k;
	while (k--) {
		cin >> x;
		a[x] = true;
	}
	while (f(n)) n++;
	cout << n << endl;
}

Measured memory_bytes: 256
a = list(map(int, input().split()))
A = a[0]
B = a[1]
C = a[2]
D = a[3]

while A>0 and C>0:
    C = C - B
    if C <= 0:
        print("Yes")
        break
    A = A - D
    if A <= 0:
        print("No")

Measured memory_bytes: 9192
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		AtCoDeer deer = new AtCoDeer();
		deer.run();
	}
}

class AtCoDeer {
	
	int N;
	Rate[] rates;
	long numOfT;
	long numOfA;
	
	AtCoDeer() {
		Scanner cin = new Scanner(System.in);
		this.N = cin.nextInt();
		this.rates = new Rate[N];
		for (int i = 0; i < N; i++) {
			int t = cin.nextInt();
			int a = cin.nextInt();
			rates[i] = new Rate(t, a);
		}
		
		this.numOfT = 1;
		this.numOfA = 1;
	}
	
	void run() {
		for (int i = 0; i < N; i++) {
			
			long t = rates[i].T;
			long a = rates[i].A;
			
			long n = 1;
			n = Math.max(n, numOfT / t);
			n = Math.max(n, numOfA / a);
			
			while (t * n < numOfT || a * n < numOfA) {
				n++;
			}
			
			numOfT = n * t;
			numOfA = n * a;
		}
		System.out.println(numOfT + numOfA);
	}
	
	class Rate {
		int T;
		int A;
		
		Rate(int t, int a) {
			this.T = t;
			this.A = a;
		}
	}
}


Measured memory_bytes: 13048
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

long long int h[100000+7];
vector<long long int> dp(100000+7);
int main()
{
    int N;
    scanf("%d\n",&N);
    for(int i=0; i<N; i++) scanf("%lld ",&h[i]);

    dp[1]=abs(h[1]-h[0]);
    for(int i=2; i<N; i++)
    {
        dp[i]=min( abs(h[i]-h[i-1]) + dp[i-1],
                    abs(h[i]-h[i-2]) + dp[i-2] );
    }

    printf("%lld\n",dp[N-1]);
    return 0;
}

Measured memory_bytes: 1792
S = input()
N = len(S)

alpha = [0] * 27
for s in S:
  alpha[ord(s) - ord("a")] += 1
#print("alpha:", alpha)

answer = N * (N - 1) // 2 + 1
for a in alpha:
  answer -= (a - 1) * a // 2
print(answer)

Measured memory_bytes: 40944
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
         
        int a = sc.nextInt();
        int p = sc.nextInt();
        
        int n = (a*3+p)/2;
        
        
        System.out.println(n);

    }

}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}
	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)

#define irrep(i,n) for(int i = (int)(n); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<v_char > v2_char;
typedef std::vector<double> v_double;
typedef std::vector<v_double > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<v_int > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<v_ll > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<v_string > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<v_bool > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std; 

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

    v_int a(n);
    irep(i, n) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    cout << a[n-1] - a[0] << endl;
    return 0;
}   
/** atcoder **/


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

typedef long long ll;

int main(){
	int n;
	cin >> n;
	ll a[n];
	for(int i = 0; i < n; i++)cin >> a[i];
	sort(a, a+n);
	ll r = INF;
	for(int i = 0; i < n; i++){
		if(abs(double(r)-double(a[n-1])/2) > abs(double(a[i])-double(a[n-1])/2))r = a[i];
	}
	cout << a[n-1] << ' ' << r << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector <int> H(N + 1, 0);
  vector <int> M(N + 1, 0);
  for (int i = 1; i <= N; i++) {
	  cin >> H[i];
	  M[i] = max(M[i - 1], H[i]);
	}
  int ans = 0;
  for (int i = 1; i <= N; i++) {
	  if (M[i] <= H[i]) {
		  ans++;
		}
	}
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
H, W = map(int, input().split())
l = [input() for i in range(H)]
 
from collections import deque
d = [(1, 0), (-1, 0), (0, 1), (0, -1)]

ans = 0
for i in range(H):
    for j in range(W):
        if l[i][j] == '#':
            continue
        cells = [[None] * W for _ in range(H)]
        cells[i][j] = 0
        q = deque([(i, j)])
        while q:
            y, x = q.popleft()
            for dy, dx in d:
                if 0 <= y+dy < H and 0 <= x+dx < W and l[y+dy][x+dx] == '.' and (cells[y+dy][x+dx] is None or cells[y+dy][x+dx] > cells[y][x]+1):
                    n = cells[y][x] + 1
                    cells[y+dy][x+dx] = n
                    q.append((y+dy, x+dx))
                    if ans < n:
                        ans = n

print(ans)

Measured memory_bytes: 45788
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String N = sc.next();
        char last = N.charAt(N.length() - 1);
        switch (last) {
            case '3':
                System.out.println("bon");
                break;
            case '0':
            case '1':
            case '6':
            case '8':
                System.out.println("pon");
                break;
            default:
                System.out.println("hon");
        }
    }
}

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

// typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

// rep
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(x) cerr << #x << ": " << x << '\n'
#define DEBUGP(x) cerr << #x << ": " << x.first << " \t" << x.second << '\n'

int r;
signed main()
{
    cin >> r;

    cout << fixed << setprecision(10) << 3.141592653589793238 * 2 * r << endl;
    return 0;
}

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

int main() {
  for(;;){
  int x,y;
	cin>>x>>y;
	if(x==y && x==0){
	    
	    break;
	    
	}
	
	else if(x>y){
	
	cout<<y<<" "<<x<<endl;
	
	}
	
	else  {
	    
	cout<<x<<" "<<y<<endl;
	
	}

}

}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define all(x) begin((x)), end((x))
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) { a = b; return true;}
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) { a = b; return true;}
    return false;
}


int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;cin>>s;
    for(auto x:s) {
        if (x=='7') {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3604
// 2012/12/10 Tazoe

#include <iostream>
using namespace std;

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

	int P[101];
	for(int i=1; i<=N; i++){
		P[i] = 0;
	}

	for(int i=0; i<N*(N-1)/2; i++){
		int A, B, C, D;
		cin >> A >> B >> C >> D;

		if(C>D){
			P[A] += 3;
		}
		else if(C<D){
			P[B] += 3;
		}
		else{
			P[A] += 1;
			P[B] += 1;
		}
	}

	int R[101];
	for(int i=1; i<=N; i++){
		R[i] = 1;
	}

	for(int i=1; i<=N; i++){
		for(int j=1; j<=N; j++){
			if(P[i]<P[j]){
				R[i]++;
			}
		}
	}

	for(int i=1; i<=N; i++){
		cout << R[i] << '\n';
	}

	return 0;
}

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

signed main () {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n, m, q;
    cin >> n >> m >> q;
    vector < vector < int > > trains(n + 1, vector < int >(n + 1, 0));
    for (int i = 0; i < m; ++i) {
        int l, r;
        cin >> l >> r;
        ++trains[l][r];
    }
    vector < vector < int > > pref(n + 1, vector < int >(n + 1, 0));
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j)
            pref[i][j] = pref[i - 1][j] + pref[i][j - 1] - pref[i - 1][j - 1] + trains[i][j];
    }
    for (int i = 0; i < q; ++i) {
        int l, r;
        cin >> l >> r;
        cout << pref[n][r] - pref[l - 1][r] - pref[n][0] + pref[l - 1][0] << '\n';
    }
}


Measured memory_bytes: 2944
/*------------------------------------------------------------------------------------------------|
| %%%%%%%%%%%%%%%%%%%%%%%%%MD.ASANURJAMAL ANOWAR HOSSAIN ANU%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| %%%%%%%%%%%%%%%%%%%%%%%%%COMPUTER SCIENCE AND ENGINEERING%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| %%%%%%%%%%%%%%%%%%%%%%%%%ISLAMIC UNIVERSITY KUSHTIA%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| %%%%%%%%%%%%%%%%%%%%%%%%%BANGLADESH%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|-------------------------------------------------------------------------------------------------*/
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <list>
#include <map>
#include <fstream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <bitset>
#include <cctype>
#include <vector>
#include <complex>
#include <ctime>
#include <deque>
#include <memory>
#include <utility>

#define S(a) scanf("%d",&a)
#define SL(a) scanf("%ld",&a)
#define S2(a,b) scanf("%d%d",&a,&b)
#define SL2(a,b) scanf("%ld%ld",&a,&b)
#define S3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define SL3(a,b,c) scanf("%ld%ld%ld",&a,&b,&c)
#define SLL(a) scanf("%lld",&a)
#define SLL2(a,b) scanf("%lld%lld",&a,&b)
#define SLL3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define SS(a) scanf("%s",a)
#define SC(a) scanf("%c",&a)
#define SD(a) scanf("%lf",&a)
#define P(a) printf("%d",a)
#define PL(a) printf("%ld",a)
#define PLL(a) printf("%lld",a)
#define PD(a) printf("%lf",a)
#define PC(a) printf("%c",a)
#define PS(a) printf("%s",a)
#define CS(kk) printf("Case %ld: ",kk++)
#define NL(kk) printf("\n")
#define PI 3.14159265358979323846264338327950
#define eps 1e-9
#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)

using namespace std;
long a[100006]={0};
int main()
{
    long i,ii;
    //for(i=1;i<=9;i++)
    for(ii=0;ii<=9;ii++)
    {
        cin>>a[ii];
    }
    sort(a,a+10);
    cout<<a[9]<<"\n"<<a[8]<<"\n"<<a[7]<<"\n";
 return 0;
}

Measured memory_bytes: 1180
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力(スペース改行関係なし)
		int a = sc.nextInt();
      	int b = sc.nextInt();

			System.out.println(a*b);

		
	}
}

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


int main() {
    int a,b,c;
    int sum = 0;
    cin >> a >> b >> c;
    for (int i=a; i<=b; ++i) {
        if (c%i == 0) sum+=1;
    }
    cout << sum << endl;
    
    return 0;
}


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

int main() {
    string a,b,c;
    int ta,tb,tc,nowa,nowb,nowc;
    cin >> a >> b >> c;
    ta = 0;
    tb = 0;
    tc = 0;
    nowa = 0;
    nowb = 0;
    nowc = 0;
    if (a[nowa] == 'a'){
        nowa++;
        ta++;
    } else if (a[nowa] == 'b'){
        nowb++;
        tb++;
    } else if (a[nowa] == 'c'){
        nowc++;
        tc++;
    }
    for (int i = 0; i <a.size() + b.size() + c.size() ; ++i) {
        if (ta == 1){
            ta = 0;
            if (nowa == a.size()){
                ta = 1;
                break;
            }
            if (a[nowa] == 'a'){
                nowa++;
                ta++;
            } else if (a[nowa] == 'b'){
                nowb++;
                tb++;
            } else if (a[nowa] == 'c'){
                nowc++;
                tc++;
            }
        } else if (tb == 1){
            tb = 0;
            if (nowb == b.size()+1){
                tb = 1;
                break;
            }
            if (b[nowb -1] == 'a'){
                nowa++;
                ta++;
            } else if (b[nowb -1] == 'b'){
                nowb++;
                tb++;
            } else if (b[nowb -1] == 'c'){
                nowc++;
                tc++;
            }
        } else if (tc == 1){
            tc = 0;
            if (nowc == c.size()+1){
                tc = 1;
                break;
            }
            if (c[nowc -1] == 'a'){
                nowa++;
                ta++;
            } else if (c[nowc -1] == 'b'){
                nowb++;
                tb++;
            } else if (c[nowc -1] == 'c'){
                nowc++;
                tc++;
            }
        }
    }

    if (ta == 1){
        cout << "A";
    } else if (tb == 1){
        cout << "B";
    } else if (tc == 1){
        cout << "C";
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 185;
int p[4][maxn][maxn][maxn];
int g[maxn][maxn];
int main(){
	int n, m; cin >> n >> m;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			char c; cin >> c;
			g[i][j] = c == '.';
			if(i) g[i][j] += g[i - 1][j];
			if(j) g[i][j] += g[i][j - 1];
			if(i && j) g[i][j] -= g[i - 1][j - 1];
		}
	}
	auto sum = [&](int a, int b, int c, int d){
		int ans = g[c][d];
		if(a) ans -= g[a - 1][d];
		if(b) ans -= g[c][b - 1];
		if(a && b) ans += g[a - 1][b - 1];
		return ans;
	};
	auto mono = [&](int a, int b, int c, int d){
		int q = sum(a, b, c, d);
		return q == 0 || q == (c - a + 1) * (d - b + 1);
	};
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			for(int k = i; k < n; k++){
				int lo = j, hi = m - 1, ans = j - 1;
				while(lo <= hi){
					int mid = (lo + hi)>>1;
					if(mono(i, j, k, mid)) ans = mid, lo = mid + 1;
					else hi = mid - 1;
				}
				p[0][i][j][k] = ans;
			}
			for(int k = j; k < m; k++){
				int lo = i, hi = n - 1, ans = i - 1;
				while(lo <= hi){
					int mid = (lo+hi)>>1;
					if(mono(i, j, mid, k)) ans = mid, lo = mid + 1;
					else hi = mid - 1;
				}
				p[1][i][j][k] = ans;
			}
		}
	}
	for(int mvs = 0; ; mvs++){
		if(p[0][0][0][n - 1] >= m - 1){
			cout << mvs << endl;
			return 0;
		}
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				for(int k = i; k < n; k++){
					int now = p[0][i][j][k];
					if(now < m - 1) now = p[0][i][now + 1][k];
					p[2][i][j][k] = now;
				}
				for(int k = j; k < m; k++){
					int now = p[1][i][j][k];
					if(now < n - 1) now = p[1][now + 1][j][k];
					p[3][i][j][k] = now;
				}
			}
		}
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				for(int k = i; k < n; k++){
					int now = p[2][i][j][k];
					while(now + 1 < m && p[3][i][j][now + 1] >= k) now++;
					p[0][i][j][k] = now;
				}
				for(int k = j; k < m; k++){
					int now = p[3][i][j][k];
					while(now + 1 < n && p[2][i][j][now + 1] >= k) now++;
					p[1][i][j][k] = now;	
				}
			}
		}
	}
	return 0;
}


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

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

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

  int p[201];
  for(int i = 0; i < 201; i++){
    p[i] = i - 50;
  }

  int temp;
  for(int i = 0; i < n; i++){
    cin >> temp;
    if(temp >= -50 && temp <= 150){
      p[temp + 50] = 200;
    }
  }

  for(int i = 0; i <= 50; i++){
    if(p[x - i + 50] != 200){
      cout << p[x - i + 50];
      return 0;
    }

    if(p[x + i + 50] != 200){
      cout << p[x + i + 50];
      return 0;
    }
  }

  return 0; 
}

Measured memory_bytes: 3620
def check(r, g, b):
    return g > r and b > g


def main():
    r, g, b = map(int, input().split())
    k = int(input())
    for i in range(k + 1):
        if check(r, g * pow(2, i), b * pow(2, k - i)):
            print("Yes")
            break
    else:
        print("No")

if __name__ == '__main__':
    main()



Measured memory_bytes: 9172
#include<bits/stdc++.h>
#define EM 1000000
using namespace std;
using LL = long long;
using P = pair<LL, LL>;
LL LINF = 1e18;
int INF = 1e9;
LL mod = 1e9+7;
using vint = vector<int>;
using vLL = vector<LL>;
using vvint = vector<vector<int>>;
using vvLL = vector<vector<LL>>;
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; }


int main(){
    int a, b;
    cin >> a >> b;
    int ans = 0;
    b--;
    ans = b/(a-1);
    if(b%(a-1) != 0)    ans++;
    if(b == 1)  cout << 0 << endl;
    else    cout << ans << endl;
}

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

int main() {
    ll x;
    cin >> x;

    ll ans = x / 11 * 2;
    x %= 11;

    if (x > 6) ans += 2;
    else if (x > 0) ans += 1;

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256