akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <list>
#include <stack>
#include <climits>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <stdio.h>
#include <cstring>
#include <cmath>
#define m7 1000000007
#define m9 1000000009
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define F first
#define S second

using namespace std;
int main() {
	
	ll a, n;
	cin >> n;
	a = n-1;
	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			a = min(a, n / i + i - 2);
		}
	}
	cout << a;
	return 0;
}

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

int main(){
	int N;
	cin >> N;
	vector<double> x(N);
	vector<string> u(N);
	for(int i = 0; i < N; ++i) cin >> x[i] >> u[i];

	double cnt = 0;
	for(int i = 0; i < N; ++i) {
		if(u[i] == "BTC") {
			cnt += x[i] * 380000.0;
		} else {
			cnt += x[i];
		}
	}

	cout << cnt << endl;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
l=list()
r=list()
for n in range(M):
  L,R=map(int,input().split())
  l.append(L)
  r.append(R)
if min(r)>=max(l):
  print(min(r)-max(l)+1)
else:
  print('0')

Measured memory_bytes: 10980
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        for(int i = 0; i<s.length(); i++) {
            char c = s.charAt(i);
            int num = (c-'A'+n) %26;
            System.out.print((char)(num+'A'));
        }
    }    
}


Measured memory_bytes: 31872
#include <iostream>
#include <sstream>
#include <cstdlib>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <numeric>
#include <bitset>
#include <stack>
#include <cstring>
using namespace std;

const int INF = 1 << 30;
const double EPS = 1e-10;

int main()
{
  int m;
  while (cin >> m) {
    map<string, pair<int, int> > var;
    for (int i = 0; i < m; ++i) {
      string name;
      int lb, ub;
      cin >> name >> lb >> ub;
      var[name] = make_pair(lb, ub);
    }

    int n;
    cin >> n;

    vector<string> e(n);
    for (int i = 0; i < n; ++i)
      cin >> e[i];

    bool correct = true;
    stack<vector<int> > stk;
    for (int k = 0; k < n; ++k) {
      if (isdigit(e[k][0])) {
        stk.push(vector<int>(1, atoi(e[k].c_str())));
      } else if (isalpha(e[k][0])) {
        vector<int> tmp;
        for (int i = var[e[k]].first; i <= var[e[k]].second; ++i)
          tmp.push_back(i);
        stk.push(tmp);
      } else {
        vector<int> b = stk.top();
        stk.pop();
        vector<int> a = stk.top();
        stk.pop();

        set<int> s;
        if (e[k] == "+") {
          for (unsigned int i = 0; i < a.size(); ++i) {
            for (unsigned int j = 0; j < b.size(); ++j)
              s.insert((a[i] + b[j]) % 256);
          }
        } else if (e[k] == "-") {
          for (unsigned int i = 0; i < a.size(); ++i) {
            for (unsigned int j = 0; j < b.size(); ++j)
              s.insert((a[i] - b[j] + 256) % 256);
          }        
        } else if (e[k] == "*") {
          for (unsigned int i = 0; i < a.size(); ++i) {
            for (unsigned int j = 0; j < b.size(); ++j)
              s.insert((a[i] * b[j]) % 256);
          }
        } else {
          for (unsigned int i = 0; i < a.size(); ++i) {
            for (unsigned int j = 0; j < b.size(); ++j) {
              if (b[j] == 0) {
                correct = false;
                goto END;
              }
              s.insert((a[i] / b[j]) % 256);
            }
          }
        }

        vector<int> r;
        for (set<int>::iterator it = s.begin(); it != s.end(); ++it)
          r.push_back(*it);
        stk.push(r);
      }
    }

  END:
    if (correct)
      cout << "correct" << endl;
    else
      cout << "error" << endl;
  }

  return 0;
}

Measured memory_bytes: 1276
N = int(input())
ans = N
for i in range(N + 1):
	count = 0
	temp = i
	while temp > 0:
		count += int(temp % 9)
		temp = int(temp / 9)
	temp = N - i
	while temp > 0:
		count += int(temp % 6)
		temp = int(temp / 6)
	if count < ans:
		ans = count
print(ans)

Measured memory_bytes: 3064
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	static void solve(){//Here is the main function
		int N = nextInt();
		String output = "";
		for(int i = 0; i < N; i++){
			output += "ACL";
		}
		myout(output);
	}
	//Method addition frame start



	//Method addition frame end

	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	@SuppressWarnings("unchecked")
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
}


Measured memory_bytes: 36460
var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
  const x = Number.parseInt(lines[0]);
  console.log(x * x * x);
});


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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

// 最大公約数
LL gcd(LL x, LL y) {
    return y ? gcd(y, x%y) : x;
}

bool solve(LL a, LL b, LL c, LL d) {
    if(a < b){
        return false;
    }else{
        if(d < b){
            return false;
        }else{
            if(c < b){ // C < B <= A, B <= D
                return c >= b-gcd(b, d)+a%gcd(b, d);
            }else{ // B <= C, B <= D
                return true;
            }
        }
    }
}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int t;cin >> t;
    inc(i, 0, t){
        LL a, b, c, d;
        cin >> a >> b >> c >> d;
        cout << (solve(a, b, c, d) ? "Yes" : "No") << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
char a;
char ch[120];
char c[120];
char b[120];
int i,j,k,l,m,n,o;
m = 0;
n = 0;
i=0;
l=0;

while(1) {
scanf("%c",&a);

if(a == '\n') {
 break;
}

ch[i] = a;
i=i+1;

}

j=0;
while(1) {
scanf("%c",&a);
if(a == '\n') {
break;
}
c[j] = a;
j +=1;
}
/*??????????????§??\??????*/

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

if(c[0] == ch[k] ) {       /*???????????????????????¨?????????????????? */
 l = k;
n = 0;                         /* ??????????????´???????????????*/
for(m=0;m<i-k;m++) {         /* c[k]????????????????§????????????? */
n = n +1;
l  +=1;
b[m] = ch[l-1];
}
l=0;
for(m=n;m<n+1+k;m++) {
l +=1;
b[m] = ch[l-1];            
}
o=0;
for(n=0;n<j;n++) {
/*printf("b[%d] = %c\n c[%d] = %c\n",n,b[n],n,c[n]); */
if(b[n] == c[n]){
o +=1;
}
}
}

/* printf("i = %d\nj = %d\n",i,j); */


if(o == j) {
printf("Yes\n");
break;
} else if(k==i-1) {
printf("No\n");
}
}
 
return 0;

}

Measured memory_bytes: 524
#include <iostream>
#include <string>

using namespace std;

int main(void){
    string s;
    cin >> s;
    if(s[0] == s[1]||s[1] == s[2] || s[2] == s[3]){
        cout << "Bad" << endl;
    }else{
        cout << "Good" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


int main() {
    long long a, b, n; std::cin >> a >> b >> n;
    long long x = std::min(n, b - 1);
    std::cout << a*x / b - a*(x / b) << std::endl;
    return 0;
}


Measured memory_bytes: 3588
//
#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000
#define MOD 1000000007
#define PI 3.14159265
#define EPS 1e-9
#define Pi acos(-1.0)
typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
#define forr(i,a,b) for(int i=(a); i<(b); i++)
#define clean(arr,val) memset(arr,val,sizeof(arr))
#define forn(i,n) forr(i,0,n)
#define PB push_back
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<pll> vpll;

/*CODE START HERE*/

string s;

int main(){
    ios::sync_with_stdio(0);
    cin >> s;
    cout << s[0] << s.length()-2 << s.back() << "\n";
    return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(int, input().split()))
dict = {}
for Ai in A:
    if Ai in dict:
        dict[Ai] += 1
    else:
        dict[Ai] = 1
count = 0
if len(dict) > K:
    count = sum(sorted(dict.values())[:len(dict) - K])
print(count)

Measured memory_bytes: 32184
using System;
using CompLib.Util;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int l = sc.NextInt();
        int r = sc.NextInt();
        int d = sc.NextInt();
        int ans = 0;
        for (int i = 0; i <= r; i += d)
        {
            if (l <= i) ans++;
        }

        Console.WriteLine(ans);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

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

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

typedef long long ll;

ll INF = 100000000000000;
ll MOD = 1e9+7;

int main(){
    ll N,S;cin >> N >> S;
    vector<ll> W(N),V(N);
    for(int i = 0;i < N;i++){
        cin >> W[i] >> V[i];
    }
    vector<vector<ll>> dp(110,vector<ll>(100010));
    for(int i = 0;i < 110;i++){
        for(int j = 0;j < 100010;j++){
            dp[i][j] = INF;
        }
    }
    dp[0][0] = 0;
    for(int i = 0;i < N;i++){
        for(int j = 0;j <= 100010;j++){
            if(V[i] <= j){
                dp[i+1][j] = min(dp[i][j],dp[i][j-V[i]] + W[i]);
            }else{
                dp[i+1][j] = dp[i][j];
            }
        }
    }
    ll ans = 0;
    for(ll i = 0;i < 100010;i++){
        if(dp[N][i] <= S){
            ans = max(ans,i);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 87296
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0
prev = -2 
for a in A:
  ans += B[a - 1]
  if prev == a - 1:
    ans += C[prev - 1]
  prev = a

print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,ans;
signed main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;i++)
		ans+=i*(n-i+1);
	for(int i=1;i<n;i++)
	{
		int u,v;
		cin>>u>>v;
		if(u>v)
			swap(u,v);
		ans-=u*(n-v+1);
	}
	cout<<ans<<endl;
	return 0;
}

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

int main()
{
    ll h, w, ans;
    cin >> h >> w;

    if (h == 1 || w == 1)
    {
        ans = 1;
    }
    else if ((h * w) % 2 == 0)
    {
        ans = (ll)h * w / 2;
    }
    else
    {
        ans = (ll)((h - 1) * w / 2 + (w + 1) / 2);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
const int INF = 1e9;


signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int H, W; cin >> H >> W;
    vs A(H); REP(i, H) cin >> A[i];
    queue<pair<int, int>> q;
    int c = 0, ans = 0;
    int dy[] = {-1, 0, 1, 0};
    int dx[] = {0, -1, 0, 1};
    REP(i, H) REP(j, W) if(A[i][j] == '#') {q.push(make_pair(i, j)); c++;}
    while(!q.empty())
    {
        ans++;
        int d = 0;
        REP(i, c)
        {
           pair<int, int> p = q.front(); q.pop(); 
           REP(j, 4)
           {
               int ny = p.first + dy[j];
               int nx = p.second + dx[j];
               if(0 <= ny && ny < H && 0 <= nx && nx < W && A[ny][nx] == '.')
               {
                   d++;
                   A[ny][nx] = '#';
                   q.push(make_pair(ny, nx));
               }
           }
        }
        c = d;
    }
    cout << ans-1 << endl;
}

Measured memory_bytes: 9488
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <cstdint>
#include <tuple>
#include <numeric>
#define M_PI       3.14159265358979323846


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FILL(a, x) memset(a, x, sizeof(a))

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

int main() {
	string s;
	cin >> s;
	int cnt = 0;
	int k = s.length();
	REP(i, k) {
		if (s[i] == 'o')cnt++;
	}
	if (cnt + (15 - k) < 8)cout << "NO" << endl;
	else cout << "YES" << endl;
	return 0;
}

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

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  
  long long n;
  cin>>n;
  
  long long happiness = 0;
  while(n>=500){
    happiness += 1000;
    n -= 500;
  }
  while(n>=5){
    happiness += 5;
    n -= 5;
  }
  
  cout<<happiness;
  
  
  return 0;


}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>

using namespace std;

int n;
const int MAX_N = 100;
int z[MAX_N];

void print_array(const int a[]){
  for(int i = 0; i < n; i++){
    printf("%d",a[i]);
    if(i != n - 1) printf(" ");
  }
  printf("\n");
}

void insertionsort(const int a[], int n){
  for(int i = 1; i < n; i++){
    int tmp = z[i];
    int j = i - 1;
    while (j >= 0 && z[j] > tmp){
      z[j + 1] = z[j];
      j--;
    }
    z[j + 1] = tmp;
    print_array(z);
  }
  
  return;
}

int main(){
  cin >> n;
  for(int i = 0; i < n; i++) cin >> z[i];
  print_array(z);
  insertionsort(z , n);
  
  return 0;
}

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

int len = 0;
string n;
void solve();

int main() {
  solve();
  cout << "! " << n << endl;
  return 0;
}

void solve() {
  auto send = [](string s) {
    cout << "? " << s << endl;
    string res;
    cin >> res;
    return res == "Y";
  };
  while (++len < 10)
    if (!send("1" + string(len, '0'))) break;
  if (len == 10) {
    len = 0;
    while (++len)
      if (send(string(len, '9'))) {
        n = "1" + string(len - 1, '0');
        return;
      }
  }
  for (int i = 1; i <= len; ++i) {
    int l = -(i != 1), r = 9;
    while (r - l > 1) {
      int mid = (l + r) / 2;
      if (send(n + (char)('0' + mid) + string(18 - i, '9')))
        r = mid;
      else
        l = mid;
    }
    n += '0' + r;
  }
}

Measured memory_bytes: 3712
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var a = int.Parse(line[1]);
        var b = int.Parse(line[2]);
        var s = Console.ReadLine().Trim();
        var ab = a + b;
        var bj = 0;
        var ok = 0;
        for (int i = 0; i < s.Length; i++)
        {
            if (s[i] == 'a')
                if (ok < ab) { Console.WriteLine("Yes"); ok++; }
                else { Console.WriteLine("No"); }
            else if (s[i] == 'b')
            {
                if (ok < ab && bj < b) { Console.WriteLine("Yes"); ok++; }
                else Console.WriteLine("No");
                bj++;
            }
            else Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 15548
#include<bits/stdc++.h>
#define rep(i,s,t) for(int i=s;i<=t;i++)
#define SI(i) scanf("%d",&i)
#define PI(i) printf("%d\n",i)
using namespace std;
typedef long long ll;
const int mod=1e9+7;
const int MAX=2e5+5;
const int INF=0x3f3f3f3f;
const double eps=1e-8;
 
int main()
{
    ll n,m;
    cin>>n>>m;
 
    printf("%lld\n",(1900*m+100*(n-m))*(1<<m));
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
    int in;
    std::cin >> in;

    int sec = in % 60;
    int min = ((in - sec) % 3600) / 60;
    int hour = (in - sec - min * 60) / 3600;
    std::cout << hour << ":" << min << ":" << sec << std::endl;

    return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int MOD = 1000000007;
const int INF = 1e9;

const int mod = 1000000007;
const int inf = 1e9;
#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    int a, b;
    cin >> a >> b;
    cout << b*2-a << endl;
}

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

int n, m;
int s[15], d[100], dp[1<<15];

int calc(int now, int nxt){
    int sum = 0;
    int nowSum = 0;
    int nxtSum = 0;
    for(int i=0, b=1;i<n;i++,b+=b){
        if(b&now)nowSum += s[i];
        if(b&nxt)nxtSum += s[i];
    }
    for(int i=0;i<m;i++){
        if(nowSum < d[i] && d[i] < nxtSum){
            sum += min(abs(nowSum-d[i]), abs(nxtSum-d[i]));
        }
    }
    return sum;
}

int over(){
    int sum = 0;
    int allSum = 0;
    for(int i=0;i<n;i++)allSum += s[i];
    for(int i=0;i<m;i++){
        if(d[i]>allSum)sum += d[i] - allSum;
    }
    return sum;
}

int main(){

    while(cin>>n>>m,n){
        for(int i=0;i<(1<<15);i++)dp[i]=1145141919;
        for(int i=0;i<n;i++)cin>>s[i];
        for(int i=0;i<m;i++)cin>>d[i];
        dp[0]=0;
        for(int i=0;i<(1<<n);i++){
            for(int j=0,b=1;j<n;j++,b+=b){
                if(i&b)continue;
                dp[i+b] = min(dp[i+b], dp[i]+calc(i, i+b));
            }
        }
        cout<<dp[(1<<n)-1]+over()<<endl;
    }

    return 0;
}


Measured memory_bytes: 3224
#スペース区切りの整数の入力
A, B,C,D = map(int, input().split())

ans_a = A
ans_c = C
count_a = 0
count_c = 0

while(ans_a>0):
  ans_a = ans_a - D
  count_a = count_a +1
  #print(count_a,":",ans_a)

while(ans_c>0):
  ans_c = ans_c - B
  count_c = count_c +1
  #print(count_c,":",ans_c)
  
if(count_a>=count_c):
  print("Yes")
else:
  print("No")



Measured memory_bytes: 9180
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int[] A = new int[N];
            for (int i = 0; i < N; i++) {
                A[i] = in.nextInt();
            }
            int max = 0;
            for (int i = 0; i < N; i++) {
                for (int j = i + 1; j < N; j++) {
                    max = Math.max(max, Math.abs(A[i] - A[j]));
                }
            }
            System.out.println(max);
        }
    }
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "\033[32;1m " << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
    print(v[i],i==(int)(v.size())-1?suc:2);
}
const int maxn=2e5+7;
const int mod=1e9+7;
const int inv2=(mod+1)/2;
ll two[maxn];
int main()
{
    two[0]=1;
    for(int i=1;i<maxn;i++) two[i]=two[i-1]*2%mod;
    int n;
    cin>>n;
    vi c(n+1);
    for(int i=1;i<=n;i++) cin>>c[i];
    sort(c.begin()+1,c.end(),greater<int>());
    ll ans=0;
    for(int i=1;i<=n;i++)
        ans=(ans+1LL*c[i]*(i+1)%mod*two[i-1]%mod*inv2%mod*two[n-i]%mod)%mod;
    cout<<ans*two[n]%mod<<'\n';
}

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

int main(){
	int field[10][10000],copy[10][10000];
	int r,c;
	while(1){
		cin >> r >> c;
		if(!r) break;
		for(int i = 0;i < r;i++){
			for(int j = 0;j < c;j++){
				cin >> field[i][j];
			}
		}
		int ma = 0;
		for(int i = 0;i < 1 << r;i++){
			for(int j = 0;j < r;j++){
				for(int k = 0;k < c;k++){
					copy[j][k] = (field[j][k] + ((i >> j) & 1)) % 2;
				}
			}
			int res = 0;
			for(int j = 0;j < c;j++){
				int cnt = 0;
				for(int k = 0;k < r;k++){
					if(copy[k][j]) cnt++;
				}
				res += max(cnt,r - cnt);
			}
			ma = max(ma,res);
		}
		cout << ma << endl;
	}
	return 0;
}

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

int main() {
	int N;
	cin >> N;
	int u, v;
	cin >> u >> v;
	u--, v--;
	vector<vector<int>> edge(N);
	for(int i=0;i<N-1;i++) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		edge[a].push_back(b);
		edge[b].push_back(a);
	}

	// uからvまでの最短距離を求める
	// uとvの真ん中
	vector<int> before(N, 0);
	queue<pair<int,int>> q;
	q.push({-1, u});
	while(!q.empty()) {
		auto tmp = q.front(); q.pop();
		int bef = tmp.first;
		int now = tmp.second;
		if(bef != -1) {
			before[now] = bef;
		}
		for(int i=0;i<edge[now].size();i++) {
			int next = edge[now][i];
			if(next == bef) continue;
			q.push({now, next});
		}
	}
	vector<int> route;
	int now = v;
	route.push_back(now);
	while(now != u) {
		int bef = before[now];
		route.push_back(bef);
		now = bef;
	}

	int cnt = 0;
	int plus = 0;
	int start, forbidden;
	if(route.size() % 2 == 0) {
		start = route[route.size() / 2];
		forbidden = route[route.size() / 2 - 1];
		cnt += route.size() / 2 - 1;
	} else {
		start = route[(route.size()+1)/2];
		forbidden = route[(route.size() - 1) / 2];
		cnt += (route.size() - 1) / 2 - 1;
		// 最後の
		cnt++;
	}
	// startからの距離
	vector<int> dist(N,0);
	queue<pair<int,int>> qq;
	qq.push({forbidden,start});
	while(!qq.empty()) {
		auto tmp = qq.front(); qq.pop();
		int bef = tmp.first;
		int now = tmp.second;
		if(bef != forbidden) dist[now] = dist[bef] + 1;
		plus = max(plus, dist[now]);
		for(int i=0;i<edge[now].size();i++) {
			int next = edge[now][i];
			if(bef == next) continue;
			qq.push({now,next});
		}
	}
	cnt += plus;
	cout << cnt << endl;
}

Measured memory_bytes: 6784
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int[] data = new int[10];
		for (int i = 0; i < 10; i++) {
			data[i] = scan.nextInt();
		}

		for (int i = 0; i < 10; i++) {
			int a = data[i];
			int indexMin = i;
			for (int k = i + 1; k < 10; k++) {
				if (data[k] < a) {
					a = data[k];
					indexMin = k;
				}
			}
			int temp = data[i];
			data[i] = data[indexMin];
			data[indexMin] = temp;
		}
		for (int i = 9; i >= 7; i--) {
			System.out.println(data[i]);
		}

	}

}

Measured memory_bytes: 26040
//-------All power is within you,you can do Anything and Everything.---------//
 
    #include <bits/stdc++.h>
    using namespace std;
  
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ M $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//

    #define pb push_back
    #define MP make_pair
    #define F first
    #define S second
    #define int long long
    #define fo(i,a,b) for(int i=a;i<b;i++)
    #define rfo(i,b,a) for(int i=b;i>=a;i--)
    #define deb(x) cout<<#x<<" "<<x<<endl;
    #define mem( a, val ) memset(a, val, sizeof( a ) )
    #define deci( x ) cout<<fixed<<setprecision( x );
    #define bitcount( x ) __builtin_popcountll( x )
 
    
    typedef vector<int> vi;
    typedef pair<int,int> pi; 
    
    const int MOD =  1000000007 ;
    const int MAX = 2e6 + 7;
    const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
    const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};

//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ V $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//  
    
    int i,j,k,t,n,q,l,r,mid;
    
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ F $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
    int sum,x;
    void solve()
    {
        cin>>n>>k;
        fo(i,0,k)
        {
            cin>>x;
            sum+=x;
        }
        if(sum>=n)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;

    }
    
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
//                          GAME STARTS FROM HERE                            //

    int32_t main() 
      {
        
        // int start,stop=clock();
        // cout<<"time:"<<(stop-start)/double(CLOCKS_PER_SEC)*1000<<endl;
        ios_base::sync_with_stdio(0);
        cin.tie(NULL);
        
        // cin>>t;while(t--)
        solve();
        
      return 0;
      }

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<utility>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) std::cout<<arg<<"\n"
#define prin2(arg1,arg2) std::cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) std::memset(arg,n,sizeof(arg))
#define mp(a,b) std::make_pair(a,b)
#define pb push_back
using std::cin;
typedef long long ll;
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
typedef std::set<int> si;
typedef std::string str;
const int INF=1e+9;
const ll INFLL=1e+17;
const ll MOD=1e+9+7;
int N,C,K;
int T[100010];
int main(){
  cin>>N>>C>>K;
  rep(i,N) cin>>T[i];
  std::sort(T,T+N);
  int num=0,res=0,tim=0;
  if(C==1){
    res=N;
  }
  else{
    rep(i,N){
      if(tim==0){
	tim=T[i];
	num++;
      }
      else if(T[i]-tim>K){
	tim=T[i];
	num=1;
	res++;
      }
      else if(num==C-1){//deaprture
	tim=0;
	num=0;
	res++;
      }
      else num++;
    }
  }
  if(num!=0) res++;
  prin(res);
  return 0;
}


Measured memory_bytes: 640
from collections import defaultdict
N = int(input())
S = [0]*N
P = [[0]*2 for _ in range(N)]
d = defaultdict(lambda :[])
for i in range(N):
    tmp = input().split()
    d[tmp[0]].append([int(tmp[1]),i+1])

key = sorted(dict(d))
for k in key:
    tmp = sorted(d[k],reverse = True)
    for t in tmp:
        print(t[1])


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define first f
#define second s
#define pb push_back
#define mp make_pair
#define eb emplace_back // is faster than push_back
#define all(cont) cont.begin(), cont.end()
#define INF (int)1e9
#define MEM(a, b) memset(a, (b), sizeof(a))
#define clr(x) x.clear()
#define gcd(x, y) __gcd(x, y) // atentie la cazul x = 0 y = 0
#define lsb(x) __builtin_ffs(x)
#define no_bits(x) __builtin_popcount(x)
#define trace(x) cout << '>' << #x << ':' << x << "\n"
#define trace2(x,y) cout<< '>' << #x << ':' << x << " | " << #y << ':' << y << "\n"
#define trace3(a,b,c) cout<<'>'<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define trace4(a,b,c,d) cout<<'>'<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"

using namespace std;

//shortcuts data types
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
//DS
typedef set<int> seti;
typedef multiset<int> mseti;
typedef map<int, int> mpii;
//and <=> &&, or <=> ||)

int main() {
	//fast i/o
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//sol
	int n, l;
	int total_flavour = 0;
	int flavour[205] = {0};
	int min = 1e9, res = 0;
	cin >> n >> l;
	for (int i = 1; i <= n; ++i){
		flavour[i] = (l + i - 1);
		total_flavour += (l + i - 1);
	//	cout << flavour[i] << ' ';
	}
	for (int i = 1; i <= n; ++i){
		if (abs((total_flavour - flavour[i]) - total_flavour) <= min){
			min = abs(total_flavour - (total_flavour - flavour[i]));
			res = total_flavour - flavour[i];
		}
	}
	cout << res;
	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include<iostream>
#include<cmath>

using namespace std;

int main()
{
    int A, B;
    cin >> A >> B;

    int sum = 0;

    if (A >= B)
    {
        sum += A;
        A -= 1;
    }
    else
    {
        sum += B;
        B -= 1;
    }

    sum += max(A, B);

    cout << sum << endl;
}

Measured memory_bytes: 256
N, A, B, C, D = map(int, input().split())

left_max = [A] * N
left_min = [A] * N
right_max = [B] * N
right_min = [B] * N

for i in range(1, N):
  left_max[i] = left_max[i - 1] + D
  left_min[i] = left_min[i - 1] + C

for i in range(N - 2, -1, -1):
  right_max[i] = right_max[i + 1] + D
  right_min[i] = right_min[i + 1] + C

able = False

for i in range(N):
  if left_max[i] >= right_min[i] and left_min[i] <= right_max[i]:
    able = True
    break

print("YES" if able else "NO")

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

// 各桁の合計を求める
int findSumOfDigits(int n) {
  int sum = 0;
  while(n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

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

  for (int i = 1; i < n; i++) {
    int a = i;
    int b = n - a;

    int sum_a = findSumOfDigits(a);
    int sum_b = findSumOfDigits(b);
    int sum = sum_a + sum_b;

    ans = min(ans, sum);
  }
  cout << ans << endl;


  return 0;
}

Measured memory_bytes: 3532
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
#define For(i,x) for (int i=h[x],k; i; i=nxt[i])
typedef long long ll;
using namespace std;

const int N=20010;
int n,u,v,tot,ans,cnt,c[N],s[N],h[N],to[N<<1],nxt[N<<1];
struct E{ int u,v; }e[N];
void add(int u,int v){ to[++cnt]=v; nxt[cnt]=h[u]; h[u]=cnt; }
bool cmp(int a,int b){ return a>b; }

void dfs(int x,int fa){
	s[x]=c[++tot];
	For(i,x) if ((k=to[i])!=fa) dfs(k,x);
}

int main(){
	scanf("%d",&n);
	rep(i,2,n) scanf("%d%d",&u,&v),e[i]=(E){u,v},add(u,v),add(v,u);
	rep(i,1,n) scanf("%d",&c[i]);
	sort(c+1,c+n+1,cmp); dfs(1,0);
	rep(i,2,n) ans+=min(s[e[i].u],s[e[i].v]);
	printf("%d\n",ans);
	rep(i,1,n) printf("%d ",s[i]);
	return 0;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
#define _USE_MATH_DEFINES
#include <math.h>
 
using namespace std;
 
using LL = long long;
using VLL = std::vector<LL>;
using VVLL = std::vector<VLL>;
using VVVLL = std::vector<VVLL>;
using LD = long double;
using VLD = std::vector<LD>;
using VVLD = std::vector<VLD>;
using VVVLD = std::vector<VVLD>;
 
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; }return false; }

#define REP(i,n) for(LL (i)=0;(i)<(n);(i)++)
#define ALL(v) v.begin(), v.end()
#define PRINTLN(v) {LL i=0; for(auto (a): v ){   cerr <<i << " : "<<  a << endl; i++;}}
#define PRINTSP(v) for(auto (a): v ) {cerr << a << " ";} cerr << endl
#define cmax(a,b) {if(a<b){a=b;}}
#define cmin(a,b) {if(a>b){a=b;}}
//#define cmax(a,b) a = (a>b ? a:b)
//#define cmin(a,b) a = (a<b ? a:b) 

 
LL modpow(LL a, LL n, LL mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

LL modinv(LL a, LL m) {
  LL b = m, u = 1, v = 0;
  while (b) {
    LL t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0){
     u += m;
  }
  return u;
}

bool isPrime(LL N)
{
  if (N < 2) {
    return false;
  }
  else if (N == 2) {
    return true;
  }
  else if (N % 2 == 0) {
    return false;
  }

  LD sqrtNum = sqrt(N);
  for (LL i = 3; i <= sqrtNum; i += 2)
  {
    if (N % i == 0)
    {
      return false;
    }
  }
  return true;
}

void func() {
  LL N;
  cin >> N;
  VLL A(N);  
  REP(i,N){
    cin >> A[i];
  }

  LL total1 = 0;
  LL total2 = 0;
  LL s =0;
  LL e =N-1;
  while(s<=e){
    if(total1<=total2){
      total1 += A[s];
      s++;
    }
    else{
      total2 += A[e];
      e--;
    }

    if(total1<=total2){
      total2 -= total1; 
      total1 = 0; 
    }
    else{
      total1 -= total2; 
      total2 = 0; 
    }
  }
  cout << abs(total1-total2);


  return;
}

void func1() {
  LL N;
  cin >> N;
  VLL A(N);
  LL total = 0;
  REP(i,N){
    cin >> A[i];
    total += A[i];
  }

  //PRINTSP(A);
  LL total1 = 0;
  REP(i,N){
    total1+=A[i];
    if(total1>=total/2){
      break;
    }
  }
  LL total2 = total-total1;
  //cerr << total << endl;
  //cerr << total1 << endl;
  //cerr << total2 << endl;
  
  cout << abs(total1-total2);
  return;
}

int main()
{
  func();
  return 0;
}
 

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long int              //cout<<fixed<<setprecision(9)<<double value; 
#define INF 1000000000000000007
#define pb emplace_back 
#define md 1000000007
#define all(s) s.begin(),s.end()
typedef vector<int> vi;
ll ans=0;
int gh[101];
int d;
ll dp[101][4][2];
ll getsum(int idx,int n,int k,bool flag){
	if(idx>n)return (k==0);
	if(k==0){
		return 1;
	}
	if(dp[idx][k][flag]!=-1)return dp[idx][k][flag];
	int limit=9;
	if(!flag)limit=gh[idx];
	ll res=0;
	for(int i=0;i<=limit;i++){
		if(i<limit||flag){
			if(i>0)
			res+=getsum(idx+1,n,k-1,true);
			else
			res+=getsum(idx+1,n,k,true);
		}
		else{
			if(i>0)
			res+=getsum(idx+1,n,k-1,false);
			else
			res+=getsum(idx+1,n,k,false);
		}
	}
	return dp[idx][k][flag]=res;
}
void solve(){
	string b;
	cin>>b;
	cin>>d;
	for(int i=0;i<b.size();i++){
		gh[i+1]=b[i]-'0';
	}
	memset(dp,-1,sizeof dp);
    ll r=getsum(1,b.size(),d,0);
   cout<<r<<"\n";
}
int main(){
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
ios::sync_with_stdio(false);
cin.tie(0);
   int t=1;
  // cin>>t;
     while(t--){
     	solve();
	 }
     return 0;
}

Measured memory_bytes: 3672
"use strict";
function main(input) {
  const inputs = input.split("\n").filter(x => x !== "");

  const T = inputs[0].split(" ").map(Number)[0];
  const X = inputs[0].split(" ").map(Number)[1];
  console.log(T/X);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main()
{
    int N;
    cin >> N;
    string out = "Three";
    rep(i, N)
    {
        string s;
        cin >> s;
        if (s == "Y")
        {
            out = "Four";
            break;
        }
    }

    cout << out << endl;
}


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

#define foreach(i, v) for(__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++ i)
#define BETWEEN(a, x, b) (a<=x&&x<b)

using namespace std;
typedef long long ll;

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  double n,m;cin>>n>>m;

  double t = (n-m)*100+1900*m;

  double ans = 0;

  double wp = 1.0;
  double cp = 1.0 / pow(2, m);

  ans += t * cp;
  wp = (1-cp);

  for(int i=2;i<=1000*1000;i++){
    ans += t * i * wp * cp;
    wp *= (1-cp);
  }

  cout<<ans<<endl;

  return 0;
}


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

int main(){
    int N;
    cin >> N;
    vector<long long> A(N,0);
    rep(i,N)cin>>A[i];

    vector<long long> counts(N,0);

    rep(i,N){
        counts[A[i]-1] += 1;
    }

    long long sum = 0;
    rep(i,N){
        if(counts[i]==0)continue;
        sum += counts[i]*(counts[i]-1)/2;
    }

    rep(i,N){
        if(counts[A[i]-1] >= 2){
            long long delta = (counts[A[i]-1]-1)*(counts[A[i]-1]-2)/2 - counts[A[i]-1]*(counts[A[i]-1]-1)/2;
            cout << sum + delta << endl;
        }else{
            cout << sum << endl;
        }

    }

    return 0;

}

Measured memory_bytes: 6384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=4e5+5;
int main()
{
	ll n,ans=0;
	scanf("%lld",&n);
	if(n&1)
	{
		puts("0");return 0;
	}
	n/=10;
	ans=ans+n;
	while(n)
	{
		ans=ans+n/5;
		n/=5;
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <unordered_map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;

int main() {
    int n, k;
		cin >> n >> k;
		vector<int> dp(100005); int a[105];
		for (int i = 0; i < n; i++) {
			scanf("%d", &a[i]);
		}
		dp[0] = 2;
		for (int i = 1; i < k + 1; i++) {
			bool OK = false;
			for (int j = 0; j < n; j++) {
				if (i - a[j] >= 0) {
					if (dp[i - a[j]] == 2 || i - a[j] == 0) {
						dp[i] = 1;
						OK = true;
						break;
					}
				}
			}
			if (!OK) dp[i] = 2;
		}
        if (dp[k] == 1) printf("First\n"); 
		else printf("Second\n");
		return 0;
}

Measured memory_bytes: 640
n = int(input())
a = list(map(int, input().split()))
cnt = 0
i = 0
j = 0
f_flg = 0
while i < len(a) and j < len(a):
    while a[j] != i + 1:
        cnt += 1
        j += 1
#         print(j)
        if j > len(a) - 1:
            if f_flg == 0:
                print(-1)
                exit()
            break
    f_flg = 1
    i += 1
    j += 1

print(cnt)

Measured memory_bytes: 25716
import java.util.Scanner;

class Main {

	public static void main(String[] args) {

		int a,b;
		char op;

		Scanner stdIn = new Scanner(System.in);


		while(true) {
			a = stdIn.nextInt();
			op = stdIn.next().charAt(0);
			b = stdIn.nextInt();

			switch(op) {
			case '+':
				System.out.println(a+b);
				break;
			case '-':
				System.out.println(a-b);
				break;
			case '*':
				System.out.println(a*b);
				break;
			case '/':
				System.out.println(a/b);
				break;
			case '?':
				System.exit(0);
			}
		}

	}

}

Measured memory_bytes: 26308
n, m = gets.chomp.split(' ').map(&:to_i)

min, max = gets.chomp.split(' ').map(&:to_i)
(m - 1).times do
  l, r = gets.chomp.split(' ').map(&:to_i)
  min = l if min < l
  max = r if r < max
end
if max - min + 1 > 0
  puts max - min + 1
else
  puts 0
end


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

// region template
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll gcd(ll a, ll b) { return __gcd(a, b); }

ll euclid(ll a, ll b, ll &x, ll &y) {
    if (b) { ll d = euclid(b, a % b, y, x);
        return y -= a/b * x, d; }
    return x = 1, y = 0, a;
}

typedef unsigned long long ull;
typedef long double ld;
ull mod_mul(ull a, ull b, ull M) {
    ll ret = a * b - M * ull(ld(a) * ld(b) / ld(M));
    return ret + M * (ret < 0) - M * (ret >= (ll)M);
}
ull mod_pow(ull b, ull e, ull mod) {
    ull ans = 1;
    for (; e; b = mod_mul(b, b, mod), e /= 2)
        if (e & 1) ans = mod_mul(ans, b, mod);
    return ans;
}

const ll mod = 1000000007;
struct Mod {
    ll x;
    Mod(ll xx) : x(xx) {}
    Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
    Mod operator-(Mod b) { return Mod((x - b.x) % mod); }
    Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
    Mod operator/(Mod b) { return *this * invert(b); }
    Mod invert(Mod a) {
        ll x, y, g = euclid(a.x, mod, x, y);
        assert(g == 1); return Mod((x + mod) % mod);
    }
    Mod operator^(ll e) {
        if (!e) return Mod(1);
        Mod r = *this ^ (e / 2); r = r * r;
        return e & 1 ? *this * r : r;
    }
};
// endregion


int main() {
    cin.sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit);

    int n, r;

    while (true) {
        cin >> n >> r;
        if (!n && !r) break;

        vector<int> v(n);
        rep(i, 0, n) v[i] = n - i;

        rep(i, 0, r) {
//            for (int h : v) cout << h << " "; cout << endl;
            int p, r; cin >> p >> r;
            --p;
            vector<int> v2;
            rep(j, p, p + r) v2.push_back(v[j]);
            rep(j, 0, p) v2.push_back(v[j]);
            rep(j, p + r, n) v2.push_back(v[j]);
            v = v2;
        }
//        for (int h : v) cout << h << " "; cout << endl;

        cout << v[0] << endl;
    }
}


Measured memory_bytes: 3004
fun main(args: Array<String>) {
    val s = arrayOf(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)
    val k = readLine()!!.toInt()
    println(s[k-1])
}


Measured memory_bytes: 31836
//In the name of God
//SMani24
#include<bits/stdc++.h>
#define endl '\n'
#define debug(x) cerr<<#x<<"="<<x<<endl
using namespace std;
typedef long long ll;

const int mn=3000+100;

vector<int> adj[mn];
int a[mn];
int n;
int mark[mn],state[mn];
int h[mn];

bool go(int v=0){
	mark[v]=1;
	bool ret=0;
	for(int u:adj[v]){
		if(a[u]<a[v]){
			a[v]--;
			ret=ret||(!go(u));
			a[v]++;
		}
	}
	mark[v]=0;
	return ret;
}

int main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin>>n;
	memset(state,-1,sizeof state);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n-1;i++){
		int u,v;
		cin>>u>>v;
		u--,v--;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	for(int i=0;i<n;i++){
		bool f=go(i);
		if(f)
			cout<<i+1<<" ";
	}
	cout<<endl;
	return 0;
}

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

int m,nmin,nmax,ans,gap;
int a[1001];
int main(){
	while(1){
		cin >>m;
		if(m==0)break;
		for(int i=0;i<m;i++){
			cin >>a[i];
		}
		sort(a,a+(m));
		gap=1000001;
		for(int i=1;i<m;i++){
			if(a[i]-a[i-1]<=gap){
				gap=a[i]-a[i-1];
			}

		}
		cout << gap<<endl;
	}
	
}

Measured memory_bytes: 3084
x = int(input())

if 1800 <= x:
  kyu = 1
elif 1600 <= x:
  kyu = 2
elif 1400 <= x:
  kyu = 3
elif 1200 <= x:
  kyu = 4
elif 1000 <= x:
  kyu = 5
elif 800 <= x:
  kyu = 6
elif 600 <= x:
  kyu = 7
elif 400 <= x:
  kyu = 8

print(kyu)

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

int main()
{
	int N, M, C;
	cin >> N >> M >> C;

	int B[20];
	for (int i = 0; i < M; i++)
	{
		cin >> B[i];
	}

	int A[20][20];
	for (int j = 0; j < N; j++)
	{
		for (int k = 0; k < M; k++)
		{
			cin >> A[j][k];
		}
	}
	int ans = 0;
	int num;
	for (int l = 0; l < N; l++)
	{
		num = C;
		for (int m = 0; m < M; m++)
		{
			num += A[l][m] * B[m];
		}

		if (num > 0)
		{
			ans += 1;
		}
	}

	cout << ans;
	return 0;
}

Measured memory_bytes: 256
from fractions import gcd
for i in range(int(input())):
    a,b,c,d=map(int,input().split())
    g=gcd(b,d)
    r=a%g
    if r>=b-d and c>=b-(g-r) and a>=b:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 5304