akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;


typedef long long i64;
const int inf = (int)1.05e9;


int main()
{
	int n;
	vector<int> ds;

	scanf("%d", &n);
	ds.resize(n);
	for(int i = 0; i < n; ++i)
		scanf("%d", &ds[i]);

	bool has_zero = false;
	for(auto d : ds)
		has_zero = has_zero || (d == 0);

	if(has_zero || n >= 24) {
		printf("0\n");
		return 0;
	}

	int ans = 0;

	for(int bit = 0; bit < (1 << n); ++bit) {

		int count[24] = {0};

		for(int i = 0; i < n; ++i) {
			int d = ds[i];
			if((bit >> i) & 1)
				d = 24 - d;
			count[d] += 1;
		}

		int diff = 100;
		int prev = 0;

		for(int i = 0; i < 24; ++i) {
			int c = count[i];
			if(c > 1) {
				diff = 0;
			} else if(c == 1) {
				diff = min(diff, i - prev);
				prev = i;
			}
		}

		diff = min(diff, 24 - prev);

		ans = max(ans, diff);
	}

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

	return 0;
}

/* waffle */


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
using namespace atcoder;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
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; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, q;
  cin >> n >> q;
  dsu uf(n);
  rep(_, q) {
    int t, a, b;
    cin >> t >> a >> b;
    if (t)
      cout << uf.same(a, b) << '\n';
    else
      uf.merge(a, b);
  }
  return 0;
}

Measured memory_bytes: 3972
#include<iostream>
#include<queue>

using namespace std;

int n, M[100][100], d[100];

void bfs (int s) {

    int i, u, v;

    queue<int> Q;
    Q.push(s);
    for (i = 0; i < n; i++) {
        d[i] = (1 << 21);
    }
    d[s] = 0;
    while (!Q.empty()) {
        u = Q.front();
        Q.pop();
        for (v = 0; v < n; v++) {
            if (M[u][v] == 0) {
                continue;
            }
            if (d[v] != (1 << 21)) {
                continue;
            }
            d[v] = d[u] + 1;
            Q.push(v);
        }
    }
    for (i = 0; i < n; i++) {
        cout << i + 1 << " " << ((d[i] == (1 << 21)) ? (-1) : d[i]) << endl;
    }
}

int main () {

    int u, k, v, i, j;

    cin >> n;
    for (i = 0; i < n; i++) {
        for (j = 0; j < n; j++) {
            M[i][j] = 0;
        }
    }

    for (i = 0; i < n; i++) {
        cin >> u >> k;
        u--;
        for (j = 0; j < k; j++){
            cin >> v;
            v--;
            M[u][v] = 1;
        }
    }

    bfs (0);

    return 0;

}

Measured memory_bytes: 3108
#include <iostream>
using namespace std;
int main(){
    int n,m,l;
    int A[100][100],B[100][100];
    long C[100][100];
    cin>>n>>m>>l;

    //??????A
    for (int i = 0; i < n ; ++i) {
        for (int j = 0; j < m ; ++j) {
            cin>>A[i][j];
        }
    }

    //??????B
    for (int i = 0; i < m ; ++i) {
        for (int j = 0; j < l ; ++j) {
            cin >> B[i][j];
        }
    }

    //??????C
    for (int i = 0; i < n ; ++i) {
        for (int j = 0; j < l ; ++j) {
            for (int k = 0; k < m ; ++k) {
                C[i][j] += A[i][k]*B[k][j];
            }
        }
    }
    //??????
    for (int i = 0; i < n ; ++i) {
        for (int j = 0; j < l-1  ; ++j) {
            cout<<C[i][j]<<" ";
        }
        cout << C[i][l-1] << endl;
    }
    return 0;
}

Measured memory_bytes: 1312
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

int main(){
    int n;
    cin >> n;
    vector<ll> v(n);
    rep(i, n) cin >> v[i];

    ll val = 0;
    int pos = 0;
    rep(i, n){
        if(abs(val) < abs(v[i])){
            val = v[i];
            pos = i;
        }
    }

    using P = pair<int, int>;
    vector<P> ans;

    rep(i, n){
        if(val > 0 && v[i] < 0){
            v[i] += val;
            ans.push_back({pos, i});
        }
        if(val < 0 && v[i] > 0){
            v[i] += val;
            ans.push_back({pos, i});
        }
    }

    if(val >= 0){
        rep(i, n-1) ans.push_back({i, i+1});
    }
    else{
        for(int i=n-1; i>=1; i--) ans.push_back({i, i-1});
    }

    cout << ans.size() << endl;
    rep(i, ans.size()) cout << ans[i].first+1 << " " << ans[i].second+1 << endl;
}

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

int main() {
    int h, w;
    cin >> h >> w;
    
    vector<string> a(h);
    for (int i = 0; i < h; i++) {
        cin >> a.at(i);
    }
    
    for (int i = 0; i < w + 2; i++) {
        cout << "#";
    }
    cout << endl;
    
    for (int i = 0; i < h; i++) {
        cout << "#" << a.at(i) << "#" << endl;
    }
    
    for (int i = 0; i < w + 2; i++) {
        cout << "#";
    }
    cout << endl;
}

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

int main() {
  int N;
  cin >> N;
  
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  
  set<int> B;
  
  for (int i = 0; i < N; i++) {
    if (B.count(A.at(i))) B.erase(A.at(i));
    else B.insert(A.at(i));
  }
  
  cout << B.size() << endl;
}

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

long long gcd(long long a,long long b){
  long long r;

  if(a<b) swap(a,b);
 
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

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

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

  long long g = t[0];
  for (int i = 1; i < n; i++)
  {
    g = t[i]/gcd(g,t[i])*g;
  }
  cout << g << endl;  
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n, y int
	fmt.Scan(&n, &y)
	for i := 0; i <= n; i++ {
		for j := 0; j <= (n - i); j++ {
			k := n - i - j
			if i*10000+j*5000+k*1000 == y {
				fmt.Println(i, j, k)
				return
			}
		}
	}
	fmt.Println(-1, -1, -1)
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main{
  static int A,B,K;
  static int C;
  static int[] D;
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int j=0;
    A = sc.nextInt();
    B = sc.nextInt();
    K = sc.nextInt();
    D = new int[110];
    C = gcm(A,B);
    for(int i=C;i>0;i--){
      if(C%i==0){
        D[j]=i;
        j++;
      }
    }
    System.out.println(D[K-1]);

  }

  static int gcm(int a,int b){
	if(a<b){
      return gcm(b,a);
    }
    else{
      if(b==0){
        return a;
      }
      else{
        return gcm(b,a%b);
      }
    }
  }

}

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

int pos;
string mol;
map<string, int> weight;

int molecule();
int atom();
int num();

int molecule(){
  int res = atom();
  while(pos < mol.length() && isupper(mol[pos])){
    pos++;
    if(pos < mol.length() && islower(mol[pos])){
      string a; a.append(1, mol[pos-1]); a.append(1, mol[pos]);
      if(weight.find(a) == weight.end()){
        return -300000000;
      }
      pos++;
      res += weight[a] * num();
    }else{
      string a; a.append(1, mol[pos-1]);
      if(weight.find(a) == weight.end()){
        return -300000000;
      }
      res += weight[a] * num();
    }
    res += atom();
  }
  return res;
}

int atom(){
  int res = 0;
  while(pos < mol.length() && mol[pos] == '('){
    int x = 1, a;;
    pos++;
    a = molecule();
    pos++;
    x = num();
    res += a*x;
  }
  res *= num();
  return res;
}

int num(){
  int res = 1;
  int n = 0;
  while(pos < mol.length() && isdigit(mol[pos])){
    n *= 10;
    n += mol[pos] - '0';
    pos++;
  }
  return max(res, n);
}

int main(void){
  while(1){
    int w;
    string a;
    cin >> a;
    if(a == "END_OF_FIRST_PART") break;
    cin >> w;
    weight[a] = w;

  }
  while(cin >> mol, mol != "0"){
    pos = 0;
    int ans = molecule();
    if(ans <= 0) cout << "UNKNOWN" << endl;
    else cout << ans << endl;;
  }

}

Measured memory_bytes: 1236
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<utility>
#include<algorithm>
#include<queue>
#define llong long long
using namespace std;

const int N = 5e5;
struct SegmentTree
{
	struct SgTNode
	{
		int val;
	} sgt[(N<<2)+2];
	void pushup(int pos) {sgt[pos].val = max(sgt[pos<<1].val,sgt[pos<<1|1].val);}
	void modify(int pos,int le,int ri,int lrb,int val)
	{
		if(le==lrb && ri==lrb) {sgt[pos].val = val; return;}
		int mid = (le+ri)>>1;
		if(lrb<=mid) {modify(pos<<1,le,mid,lrb,val);}
		else if(lrb>mid) {modify(pos<<1|1,mid+1,ri,lrb,val);}
		pushup(pos);
	}
	int querymax(int pos,int le,int ri,int lb,int rb)
	{
		if(lb<=le && rb>=ri) {return sgt[pos].val;}
		int mid = (le+ri)>>1;
		int ret = 0;
		if(rb>mid) {ret = max(ret,querymax(pos<<1|1,mid+1,ri,lb,rb));}
		if(lb<=mid) {ret = max(ret,querymax(pos<<1,le,mid,lb,rb));}
		return ret;
	}
} smt;
struct Edge
{
	int v,nxt;
} e[(N<<1)+2];
int a[N+3];
int b[N+3];
int ind[N+3];
int fe[N+3];
priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > pq;
pair<int,int> ans[N+3];
int fans[N+3];
int n,m,en;

void addedge(int u,int v)
{
//	printf("addedge%d %d\n",u,v);
	en++; e[en].v = v; ind[v]++;
	e[en].nxt = fe[u]; fe[u] = en;
}

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1; i<=n; i++) {int x; scanf("%d",&b[i]); a[b[i]] = i;}
	for(int i=1; i<=n; i++)
	{
		ans[i].second = a[i];
		int x = smt.querymax(1,0,n,max(a[i]-m+1,0),a[i]);
		int y = smt.querymax(1,0,n,a[i],min(a[i]+m-1,n));
		if(x) {addedge(x,i);}
		if(y) {addedge(y,i);}
//		printf("iquery %d %d %d\n",i,max(0,a[i]-m+1),min(n,a[i]+m-1));
//		printf("imodify %d %d %d\n",i,ans[i].second,ans[i].first);
		smt.modify(1,0,n,ans[i].second,i);
//		printf("ans%d %d %d\n",i,ans[i].first,ans[i].second);
	}
	for(int i=1; i<=n; i++) if(ind[i]==0) {pq.push(make_pair(a[i],i));}
	int j = 0;
	while(!pq.empty())
	{
		pair<int,int> tmp = pq.top(); pq.pop();
		j++; b[j] = tmp.first; int u = tmp.second;
		for(int i=fe[u]; i; i=e[i].nxt)
		{
			ind[e[i].v]--;
			if(ind[e[i].v]==0)
			{
				pq.push(make_pair(a[e[i].v],e[i].v));
			}
		}
	}
	for(int i=1; i<=n; i++) fans[b[i]] = i;
	for(int i=1; i<=n; i++) printf("%d\n",fans[i]);
	return 0;
}

Measured memory_bytes: 31092
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(myOut);

function main(){
  var n = next(), nn = n*n;
  var p = nexts(nn);
  var dist = Array(n).fill().map((a,y)=>Array(n).fill().map((b,x)=>Math.min(y,x,n-x-1,n-y-1)));
  var grid = xArray(1,n,n);
  var ans = 0;
  for(var i = 0; i < nn; i++){
    var r = p[i]-1, y = r / n | 0, x = r % n;
    ans += dist[y][x];
    grid[y][x] = 0;
    var q = [y,x];
    while(q.length){
      x = q.pop(), y = q.pop();
      var cost = dist[y][x];
      if(x && dist[y][x-1] - grid[y][x] > cost)dist[y][x-1] = cost + grid[y][x], q.push(y,x-1);
      if(y && dist[y-1][x] - grid[y][x] > cost)dist[y-1][x] = cost + grid[y][x], q.push(y-1,x);
      if(x < n-1 && dist[y][x+1] - grid[y][x] > cost)dist[y][x+1] = cost + grid[y][x], q.push(y,x+1);
      if(y < n-1 && dist[y+1][x] - grid[y][x] > cost)dist[y+1][x] = cost + grid[y][x], q.push(y+1,x);
    }
  }
  return ans;
}

Measured memory_bytes: 106368
#include<iostream>
#include<vector>
using namespace std;
#define inf 1e9

int frog2(vector<int>ar,int n,int k)
{
    vector<int>dp(n+1);
    dp[1]=0;
    for(int i=2;i<=n;i++)
    {
        dp[i]=inf;
        for(int j=i-1;j>=1 and (i-j)<=k;j--)
        {
            dp[i]=min(dp[i],abs(ar[i]-ar[j])+dp[j]);
        }
    }
    return dp[n];
}

int main()
{
    int n,k;
    cin>>n>>k;
    vector<int>ar(n+1);

    for(int i=1;i<=n;i++)
    {
        cin>>ar[i];
    }
    cout<<frog2(ar,n,k);

}



Measured memory_bytes: 4264
n = int(input())
a = list(map(int, input().split()))

res = []
s = 0
for i in range(n):
    s += a[i] * [-1, 1][i % 2 ==0]
res.append(s)

for i in range(1, n):
    res.append(2*a[i-1] - res[i-1])

print(' '.join(map(str, res)))


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

struct init_ { init_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } init_;

template<class C> using iodef_rng_t = typename enable_if<decltype(declval<C>().begin(), true_type{})::value && !is_same<C, string>::value>::type;
template<class C, class = iodef_rng_t<C>> istream& operator>>(istream& in, C& c) { for (auto& v : c) { in >> v; } return in; }
template<class C, class = iodef_rng_t<C>> ostream& operator<<(ostream& out, const C& c) { int i = 0; for (const auto& v : c) { if (i++) { out << ' '; } out << v; } return out; }
template<size_t N, class T, class R> using when_last = typename enable_if<N == tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N, class T, class R> using when_init = typename enable_if<N != tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_last<N, T, istream&> { return in >> get<N>(t); }
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_init<N, T, istream&> { return operator>><N + 1>(in >> get<N>(t), forward<T>(t)); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_last<N, T, ostream&> { return out << get<N>(t); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_init<N, T, ostream&> { return operator<<<N + 1>(out << get<N>(t) << ' ', t); }

#ifdef LOCAL
template<class T> void trace_(const char* s, const T& v) { cerr << s << "=" << v; }
template<class T, class... Ts> void trace_(const char* s, const T& v, const Ts&... vs) { for (; *s != ','; ++s) { cerr << *s; } cerr << "=" << v << ","; trace_(++s, vs...); }
#define TRACE(...) (cerr << "\033[2m\033[33m", trace_(#__VA_ARGS__, __VA_ARGS__), cerr << "\033[0m\n")
#else
#define TRACE(...)
#endif

int main() {
    int n;
    cin >> n;
    int d = n % 10;
    if (d == 3) puts("bon");
    else if (d == 2 || d == 4 || d == 5 || d == 7 || d == 9) puts("hon");
    else puts("pon");
}


Measured memory_bytes: 3656
n = int(input())
a = [[] for i in range(n)]
for i in range(n):
    ai = int(input())
    for j in range(ai):
        x = list(map(int, input().split()))
        a[i].append(x)
ans = 0
for i in range(2 ** n):
    i_str = format(i, '0' + str(n) + 'b')
    flag = False
    z = [-1 for _ in range(n)]
    h = []
    for j in range(n):
        if i_str[j] == '1':
            h.append(j)
    for j in h:
        for x, y in a[j]:
            if z[x - 1] >= 0 and z[x - 1] != y:
                flag = True
                break
            elif z[x - 1] < 0:
                z[x - 1] = y
        if flag:
            break
    else:
        for zj, sj in zip(z, i_str):
            if zj >= 0 and zj != int(sj):
                flag = True
                break
    if not flag:
        ans = max(ans, sum(map(int, i_str)))
print(ans)


Measured memory_bytes: 3064
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
mini = 10000
ans = -1
for i in range(N):
    dt = abs(T - H[i]*0.006 - A)
    if dt < mini:
        ans = i
        mini = dt
print(ans+1)

Measured memory_bytes: 3060
#include <cstdlib>
#include <iostream>
#include <vector>
#include <map>

// std::vector<int> count(N, 0);

template <typename T>
struct edge
{
	T src;
	T dst;
};

template <typename T>
class graph
{
public:
	graph() = default;

	void emplace_edge(const edge<T> &edge)
	{
		edges_[edge.src].emplace_back(edge.dst);
		edges_[edge.dst].emplace_back(edge.src);
	}

	std::vector<T> get_connected_vertices(const T &vertex)
	{
		return edges_[vertex];
	}
	
private:
	std::map<T, std::vector<T>> edges_;
};

template <typename T>
T read_cin()
{
	T input;
	std::cin >> input;
	return input;
}

int main(void)
try
{
	const int N = read_cin<int>();
	const int M = read_cin<int>();
	std::vector<int> H(N);
	for (int i = 0; i < N; i++)
	{
		H[i] = read_cin<int>();
	}

	graph<int> graph;
	for (int i = 0; i < M; i++)
	{
		graph.emplace_edge({ read_cin<int>()-1, read_cin<int>()-1 });
	}

	unsigned int good_count = 0;
	
	for (int i = 0; i < N; i++)
	{
		const std::vector<int> vertices = graph.get_connected_vertices(i);
		const int base_height = H[i];
		bool bad = false;
		for (const int &vertex: vertices)
		{
			const int height = H[vertex];
			if (base_height <= height)
			{
				bad = true;
				break;
			}
		}
		if (!bad)
		{
			++good_count;
		}
	}

	std::cout << good_count << std::endl;
}
catch (const std::exception& e)
{
	std::cout << e.what();
	return EXIT_FAILURE;
}
catch (...)
{
	return EXIT_FAILURE;
}

Measured memory_bytes: 14352
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<unordered_map>
#include<stdio.h>
using namespace std;

int main() {
	int x, a, b;
	cin >> x >> a >> b;
	if (abs(a - x) < abs(b - x)) {
		cout << "A" << endl;
	}
	else {
		cout << "B" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>//stw(数字)で空白による桁揃え
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値

using namespace std;

int main(void){
    int N,M;cin>>N>>M;
    vector<bool> oks(N+1,true);
    for(int i=0;i<M;i++){
        int a;cin>>a;
        oks[a] = false;
    }
    vector<long> dp(N+1);
    dp[0] = 1;
    for(int now=0;now<N;now++){
        for(int next=now+1;next<=min(now+2,N);next++){
            if(oks[next]==true){
                dp[next] += dp[now];
                dp[next] %= 1000000007;
            }
        }
    }
    cout << dp[N] << endl;
    return 0;
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,n) for(int i=1;i<=(int)(n);i++)
#define rep3(i,n) for(int i=0;i<=(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
#define repll(i,n) for(ll i=0;i<(ll)(n);i++)
#define repll2(i,n) for(ll i=1;i<=(ll)(n);i++)
#define REPLL(i,m,n) for(ll i=m;i<(ll)(n);i++)
#define INF 1e9  //
#define LINF 1e18  //
#define MOD (1e9)+7
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

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

//------------------------------------------------------

int main() {
    ll x, y;
    cin >> x >> y;
    ll a = x;
    int cnt = 0;
    while (a <= y) {
        a *= 2;
        cnt++;
    }

    cout << cnt << endl;

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,x,ans=0;
    cin>>n>>x;
    long int a[n+1];
    for(int i=1;i<n+1;i++)
    {
        cin>>a[i];
    }
    long int i=0,j=1;
    while(i<=x)
    {
       // cout<<i<<" ";
        i=i+a[j];
        j++;
        ans++;
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 256
//Author - Rahil Malhotra
#include <bits/stdc++.h>
using namespace std;
 
template <typename T> void print(T t) { cout<<t<<endl; }
template<typename T, typename... Args> void print(T t, Args... args) { cout<<t<<" "; print(args...); }
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define int long long
#define double long double
 
int mod=1e9+7;
int power(int x,int y,int p)
{ 
    int res = 1;      
    x = x % p;  
    while (y > 0) 
    { 
        if((y & 1)==1) 
            res = (res * x) % p; 
        y = y >> 1;  
        x = (x * x) % p;  
    } 
    return res; 
} 
int32_t main()
{
    IOS;
    int n;
    cin>>n;
    if(n==1)
    {
        print(0);
        return 0;
    }
    int total=power(10,n,mod);
    int need=(2*power(9,n,mod))%mod;
    int left=(power(8,n,mod));
    int get=(need-left+mod)%mod;
    print(((total-get+mod))%mod);
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
#include<vector>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define CEVCOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define P pair<int , int>
#define V vector<int>
#define M map<int , int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void){

  
  int N;    cin >> N;
  V a(N);   VECCIN(a);
  V cnt(100005);

  for(int i = 0 ; i < N ; i++){
    for(int j = 0 ; j <= 2 ; j++) 
      cnt[a[i] + j] += 1;
  }

  sort(ALL(cnt)); 
  int max = cnt.back();
  SCOUT(max) << endl;


  return 0;
}


Measured memory_bytes: 1024
s = input()
n_count = (1 if s.count('N')>=1 else 0)
s_count = (1 if s.count('S')>=1 else 0)
w_count = (1 if s.count('W')>=1 else 0)
e_count = (1 if s.count('E')>=1 else 0)
ns = not(n_count ^ s_count)
we = not(w_count ^ e_count)
if ns & we:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define N 101
int a[N], n, ans;
int main() {
    scanf("%d", &n);
    for (int i = 1; i <= 2 * n; i++) scanf("%d", &a[i]);
    sort(a + 1, a + 2 * n + 1);
    for (int i = 1; i <= n; i++) ans += a[(i << 1) - 1];
    printf("%d\n", ans);
    return 0;
}

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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = LLONG_MAX;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;
}

signed main() {
	ll a, b;

	cin >> a >> b;

	ll x = max(a + b, a - b);

	x = max(x, a * b);

	cout << x << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int a,b,i,c;
  scanf("%d %d",&a,&b);
  if(a>b){
    c=b;
    b=a;
    a=c;
  }
  for(i=0;i<b;i++){
    printf("%d",a);
  }
  printf("\n");

}

Measured memory_bytes: 128
N,Q = map(int,input().split())
S = input()
lr = []
S_temp = []
S_temp.append(0)
for i in range(1,N):
    if S[i-1] == "A" and S[i] == "C":
        S_temp.append(S_temp[i-1] + 1)
    else:
        S_temp.append(S_temp[i-1])
for i in range(Q):
    a,b = map(int,input().split())
    lr.append([a-1,b-1])

for i in range(Q):
    print(S_temp[lr[i][-1]] - S_temp[lr[i][0]])

    


Measured memory_bytes: 22868
#include <iostream>
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <string>
#include <algorithm>

using namespace std;
		
int main(void){
	string str;
	int num;
	cin>>str;
	cin>>num;
	for(int i=0;i<num;i++){
		string op,temp,usiro;
		cin>>op;
		if(op=="replace"){
			int a,b;
			cin>>a>>b>>temp;
			str.replace(a,b-a+1,temp);
		}
		else if(op=="reverse"){
			int a,b;
			cin>>a>>b;
			reverse(&str[a],&str[b+1]);
		}
		else if(op=="print"){
			int a,b;
			cin>>a>>b;
			cout<<str.substr(a,b-a+1)<<endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>

using namespace std;

int main() {

	string s,t;
	cin >> s >> t;

	for (int i = 0; i < s.size(); i++)
	{
		s = s[s.size() -1] + s;
		s.pop_back();
		if (s == t) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;


	
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
 
int main(void){
    // Your code here!
  int n;
  long long int a;
  long long int count=0;
  cin >> n >>a;
  rep(i,n-1){
    long long int b;
    cin >> b;
    if(b<a) {
     count+=(a-b);
     b = a;
    }
    a = b;
  }
  cout << count << endl;
}


Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
using namespace std;
// 多倍長テンプレ
/* ---------------------- ここから ---------------------- */
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
/* ---------------------- ここまで ---------------------- */
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
int main() {
  int N;
  cin >> N;
  vector<int>A;
  long long int sum=0;
  int tmp;
  for(int i=0;i<N;i++){
    cin >> tmp;
    A.push_back(tmp);
    if(i>0){
      if(A[i]<A[i-1]){
        sum+=A[i-1]-A[i];
        A[i]=A[i-1];
      }
    }
  }
  
  cout << sum;
  cout << endl;
  return 0;
}


Measured memory_bytes: 4316
#include<bits/stdc++.h>
using namespace std;
struct memo{int sy,sx,gy,gx;};

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int h,w; cin>>h>>w;
	vector<vector<int>>a(h,vector<int>(w));
	for(auto&&i:a){
		for(auto&&j:i){
			cin>>j;
		}
	}
	--w;
	vector<memo>ans;
	for(int i=0;i<h;++i){
		for(int j=0;j<w;++j){
			if(a.at(i).at(j)%2==0)continue;
			++a.at(i).at(j+1);
			ans.push_back({i+1,j+1,i+1,j+2});
		}
		if(i+1>=h||a.at(i).at(w)%2==0)continue;
		++a.at(i+1).at(w);
		ans.push_back({i+1,w+1,i+2,w+1});
	}
	cout<<ans.size()<<"\n"s;
	for(auto&&i:ans)cout<<i.sy<<" "s<<i.sx<<" "s<<i.gy<<" "s<<i.gx<<"\n"s;
}


Measured memory_bytes: 6328
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time    : 2018/7/21 20:19
# @Version : 1.1
# @Author  : Jade
# @File    : acm.py
# @Software: PyCharm
#
s = input()
t = input()

if(s == t):
    print('Yes')
elif(len(s) != len(t)):
    print('No')
else:
    flag = True
    for i in range(len(s)):
        if(s[i:] + s[:i] == t):
            print('Yes')
            flag = False
            break
    if(flag):
        print('No')

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

int main() {
    int N;
    cin>>N;
    string S;
    cin>>S;
    for(int i=0;i<S.size();++i){
        if(S[i]+N>'Z') S[i] = S[i] + N - 26;
        else S[i] += N;
    }
    cout<<S<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define int long long int
#define vi vector<int>
#define vvi vector < vi >
#define pii pair<int,int>
#define mod 1000000007
#define inf 1000000000000000001
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second
#define tr(k,st,en) for(int k = st; k <= en ; k++)
#define trb(k,en,st) for(int k = en; k >= st ; k--)
using namespace std;

//int n = 2;
//
//void add_self(int& a, int b){
//    a += b;
//    if (a >= mod) {
//        a-=mod;
//    }
//}
//
//int mul(int a, int b){
//    int c = a*b;
//    return c%mod;
//}
//
//struct M {
//    vector<vector<int>> t;
//    M(){
//        t.resize(n, vector<int>(n));
//    }
//    M operator * (M& b){
//        M c;
//        tr(i,0, n-1){
//            tr(j,0,n-1){
//                tr(k,0,n-1){
//                    add_self(c.t[i][j] , mul(t[i][k] ,b.t[k][j]));
//                }
//            }
//        }
//        return c;
//    }
//};
//M power(M x, int k){
//    M ans;
//    tr(i,0,n-1){
//        ans.t[i][i] = 1;
//    }
//    while (k) {
//        if (k%2) {
//            ans = ans * x;
//        }
//        x = x*x;
//        k/=2;
//    }
//    return ans;
//}


int32_t main()
{
    std::ios::sync_with_stdio(false);
    map<int,int> freq;
    int n,temp;
    cin>>n;
    tr(i,1,n-1){
        cin>>temp;
        freq[temp]++;
    }
    tr(i,1,n){
        cout<<freq[i]<<endl;
    }
    return 0;
}




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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

struct UnionFind{
	vector<int> par;
	vector<int> rank;

	UnionFind(int n=1){
		init(n);
	}

	// n要素で初期化
	void init(int n=1){
		par.resize(n);
		rank.resize(n);
		REP(i, n){
			par[i]=i;
			rank[i]=0;
		}
	}

	// xの根を求める
	int find(int x){
		if(par[x]==x){
			return x;
		}
		else{
			return par[x]=find(par[x]);
		}
	}

	// xとyが属する集合を併合
	bool unite(int x, int y){
		x=find(x);
		y=find(y);
		if(x==y){
			return false;
		}
		if(rank[x]<rank[y]){
			par[x]=y;
		}
		else{
			par[y]=x;
			if(rank[x]==rank[y]){
				++rank[x];
			}
		}
		return true;
	}

	// xとyが同じ集合に属するか判定
	bool issame(int x, int y){
		return find(x)==find(y);
	}
};

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k, l, p, q, r, s;
	cin>>n>>k>>l;
	UnionFind uf1(n), uf2(n);
	REP(i, k){
		cin>>p>>q;
		--p;
		--q;
		uf1.unite(p, q);
	}
	REP(i, l){
		cin>>r>>s;
		--r;
		--s;
		uf2.unite(r, s);
	}
	pii a[214514], b[214514];
	REP(i, n){
		a[i]=b[i]=pii(uf1.find(i), uf2.find(i));
	}
	sort(a, a+n);
	REP(i, n){
		cout<<upper_bound(a, a+n, b[i])-lower_bound(a, a+n, b[i])<<" \n"[i==n-1];
	}
	return 0;
}


Measured memory_bytes: 7168
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    LL n, c, k;
    cin >> n >> c >> k;
    LL a[n];
    for( int i = 0; i < n; ++i ) cin >> a[i];
    int cnt = 0;
    sort( a, a + n );
    int tim = a[0];
    int cnt_n = 1;

    for( int i = 1; i < n; ++i ) {
        if( a[i] - tim > k || cnt_n == c ) {
            ++cnt;
            tim = a[i];
            cnt_n = 0;

        }
        ++cnt_n;
    }
    cout << cnt + 1 << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
//最大公約数
ll gcd(ll a, ll b) {
  while (a && b) {
    if (a >= b) a %= b;
    else b %= a;
  }
  return a + b;
}
//最小公倍数
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b;}
int main()
{
  int N; cin >> N;
  ll ans = 1;
  FOR(i,0,N) {
    ll in; cin >> in;
    ans = lcm(ans, in);
  }
  cout << ans << endl;
  return 0;
}

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


int main(){
	
	int tmp;

	std::cin >> tmp;


	std::cout << ((tmp>=30)?"Yes":"No") << endl;

	return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>
int main(void)
{
	int n, i, x, y, b, p, s[1000];
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d %d %d %d", &x, &y, &b, &p);
		s[i] = x*b + y*p;
		if (b >= 5 && p >= 2)
			s[i] = s[i] * 0.8;
		if (b < 5) {
			b = 5;
		}
		if (p < 2) {
			p = 2;
		}
		if (s[i]>(x*b + y*p)*0.8)
			s[i] = (x*b + y*p)*0.8;
	}
	for (i = 0; i < n; i++) {
		printf("%d\n", s[i]);
	}
	return 0;
}

Measured memory_bytes: 604
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	if(a>b) swap(a,b);
	if(b>c) swap(b,c);
	c *= (1<<k);
	cout << a+b+c << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
    static MyReader in = new MyReader();
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int A = in.i();
        int B = in.i();
        int K = 33;
        int L = K * 2;
        char[][] s = new char[L][L];
        for (int i = 0; i < K; i++) {
            Arrays.fill(s[i], '#');
        }
        for (int i = K; i < L; i++) {
            Arrays.fill(s[i], '.');
        }
        for (int i = 0, j = 0, k = 0; i < A - 1; i++, k += 4) {
            if (L <= k) {
                k = (++j & 1) * 2;
            }
            s[j][k] = '.';
        }
        for (int i = 0, j = K + 1, k = 0; i < B - 1; i++, k += 4) {
            if (L <= k) {
                k = (++j & 1) * 2;
            }
            s[j][k] = '#';
        }

        out.print(L);
        out.print(' ');
        out.println(L);
        for (int i = 0; i < L; i++) {
            out.println(s[i]);
        }
        out.flush();
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    int i() {
        int k = next() - '0';
        boolean minus = k == -3;
        int n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        int k = next() - '0';
        boolean minus = k == -3;
        long n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    char[] s(final int N) {
        char[] s = new char[N];
        for (int i = 0; i < N; i++) {
            s[i] = next();
        }
        next();
        return s;
    }

    public int read(char[] cbuf) {
        int i;
        char c;
        for (i = 0; (c = next()) != ' ' && c != '\n'; i++) cbuf[i] = c;
        return i;
    }

    public String readLine() {
        try {
            return super.readLine();
        } catch (IOException e) {
            return null;
        }
    }
}


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

using namespace std;

typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli>> mat;

lli k;

priority_queue<vll> pq;
set<lli> used;

int main(){
  cin >> k;
  pq.push(vll({-1,1}));
  while(!pq.empty()){
    vll x = pq.top();
    pq.pop();
    if(used.count(x[1])) continue;
    if(x[1] == 0){
      cout << -x[0] << endl;
      return 0;
    }
    used.insert(x[1]);
    pq.push(vll({x[0]-1,(x[1]+1)%k}));
    pq.push(vll({x[0],(x[1]*10)%k}));
  }
  return 0;
}


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

using namespace std;
using int64 = long long;
int main() {
    int64 a,b,c,d,e,f;
    cin >> a >> b >> c >> d >> e >> f;
    a *= 100;
    b *= 100;

    vector<int64> water;
    for (int64 i=0; i*a<=f; i++) {
        int64 aw = i*a;
        for (int64 j=0; j*b<=f; j++) {
            water.push_back(aw + j*b);
        }
    }

    vector<int64> sugar;
    for (int64 i=0; i*c<=f; i++) {
        for (int64 j=0; j*d<=f; j++) {
            sugar.push_back(i*c + j*d);
        }
    }

    double con = 0;
    int64 water_ans = 0;
    int64 sugar_ans = 0;
    for (auto w : water) {
        for (auto s : sugar) {
            if (w + s > f) continue;
            if (w/(double)100*e < s) continue;
            double c = 100 * s / (double)(w+s);
            if (c >= con) {
                con = c;
                water_ans = w;
                sugar_ans = s;
            }
        }
    }

    cout << water_ans + sugar_ans << " " << sugar_ans << endl;
}

Measured memory_bytes: 4848
PROGRAM ATCODER

implicit none
integer :: n, l, i, j
character(len = 100),allocatable :: a(:)
character(len = 100) :: c
character(len = 100*100) :: answer

read(*,*) n, l
allocate (a(n))

do i = 1, n
	read(*,*) a(i)
end do

! ここに計算式
do i = 1, n
	do j = i+1, n
		if (lgt(a(i),a(j)))then
			c = a (i)
			a(i) = a(j)
			a(j) = c
        end if
	end do
end do
! ここに出力結果

answer = trim(a(1))
do i = 2, n
	answer = trim(answer)//trim(a(i))
end do

write(*,'(a)') trim(answer)

END PROGRAM ATCODER

Measured memory_bytes: 504
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#include <cstring>

using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define RREP(i,n) for(int i = n - 1; i >= 0; i--)

#define ALL(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

#define UNIQUE(v) do{sort(v.begin(), v.end()); v.erase( unique(v.begin(), v.end()), v.end() );} while(0)

#define y0 y3487465
#define y1 y8687969

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;

ll N, M;

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

cout << (1900 * M + 100 * (N - M)) * ll(pow(2, M)) << endl;


  return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
X = list(map(int, input().split()))
X.sort()
A = []
for i in range(1, M):
    L = X[i] - X[i - 1]
    A.append(L)
A.sort()
A = A[M - N:]
ans = X[-1] - X[0] - sum(A)
if N >= M:
    ans = 0
print(ans)
  


Measured memory_bytes: 20472
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <iostream>
#include <limits>
#include <numeric>
#include <type_traits>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define MOD 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define REVERSE(s) reverse(s.begin(), s.end());
#define SUM(s) accumulate(s.begin(), s.end(), 0LL);
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
//#define int ll
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int ndx[8] = { 0,1,0,-1, 1,1,-1,-1 };
int ndy[8] = { 1,0,-1,0, 1,-1,-1,1 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }



int main() {
	int x;
	cin >> x;
	int a500 = x / 500;
	int amari = x % 500;
	int a5 = amari / 5;
	cout << a500 * 1000 + a5 * 5 << endl;
	return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
int main()
{
   long long n,m,sum=0;
   scanf("%lld",&n);
   m=n;
   while(n>0)
   {
      sum+=n%10;
      n/=10;
   }
   m%sum==0?puts("Yes"):puts("No");
   return 0;

}


Measured memory_bytes: 384
#include<iostream>
        #include<cstdio>
        #include<math.h>
        #include<string>
        #include<algorithm>
        #include<functional>
        #include<vector>
        #include<set>
        #include<map>
        #define INF 999999
        #define EPS 1.0e-6
         
        using namespace std;
         
        typedef long long ll;
        typedef pair<int, int> P;
        typedef pair<int, P> PP;
         
        int n, k;
         
        int main()
        {
        	cin >> n >> k;
        	int a = 1;
        	for (int i = 0; i < n; i++) {
        		if (a + k > 2 * a)a = 2 * a;
        		else a += k;
        	}
        	cout << a << endl;
        	return 0;
        }

Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int MOD = 1_000_000_007;
		char[] T = sc.next().toCharArray();
		long[] dp = new long[5];
		dp[1] = 1;
		for(int i = 0; i < T.length; i++) {
			if(T[i] == '?') {
				for(int j = 4; j >= 1; j--)
					dp[j] = (3 * dp[j] + dp[j-1]) % MOD;
			}
			else
				dp[T[i]-'A'+2] = dp[T[i]-'A'+2] + dp[T[i]-'A'+1];
		}
		System.out.println(dp[4] % MOD);
	}

}


Measured memory_bytes: 27832
#include<iostream>
using namespace std;
//const int mod = 1e9 + 7;

int main(){
 long long w,a,b;
 cin>>w>>a>>b;
 if(b>a+w)
 cout<<b-(a+w)<<endl;
 else if(b+w<a)
 cout<<a-(b+w)<<endl;
 else
 cout<<"0"<<endl;
	
	
	return 0;
} 

Measured memory_bytes: 256
using static System.Math;
using System.Collections.Generic;
using System.Linq;
using System;

public class hello
{
    public static void Main()
    {
        var plist = GeneratePrime(50000);
        while (true)
        {
            var n = int.Parse(Console.ReadLine().Trim());
            if (n == 0) break;
            var count = 0;
            for (int i = 0; plist[i] <= n / 2; i++)
            {
                var w = n - plist[i];
                var s = Array.BinarySearch(plist, w);
                if (s >= 0) count++;
            }
            Console.WriteLine(count);
        }
    }
    public static int[] GeneratePrime(int m)
    {
        var plist = new List<int>();
        int prime;
        var sqrtMax = Sqrt(m);
        var searchList = Enumerable.Range(2, m - 1).ToList();
        do
        {
            prime = searchList.First();
            plist.Add(prime);
            searchList.RemoveAll(n => n % prime == 0);
        }
        while (prime < sqrtMax);
        plist.AddRange(searchList);
        return plist.ToArray();
    }
}






Measured memory_bytes: 16564
#include<bits/stdc++.h>
using namespace std;
#define rei(i,a,n) for(int i=(a);i<(n);i++)
#define red(i,a,n) for(int i=(a)-1;i>=(n);i--)
#define rep(i,n) rei(i,0,n)
#define rem(i,n) red(i,n,0)
#define pb push_back
#define fr first
#define sc second
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
int msb(ll x)
{
    union{double a;int32_t b[2];};
    a=x;
    return (b[1]>>20)-1023;
}
int mx=(int)1e9+7;
void sol()
{
    int n;
    ll s=0,ans=0;
    cin>>n;
    vi a(n);
    rep(i,n)
    {
        cin>>a[i];
        s+=a[i];
    }
    s%=mx;
    s+=mx;
    rep(i,n)
    {
        ans+=(s-a[i])*a[i];
        ans%=mx;
    }
    if(ans&1)ans=(ans+mx)/2;
    else ans/=2;
    ans%=mx;
    cout<<ans;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--)sol();
}


Measured memory_bytes: 3968
fun main() {
    val x = readLine() ?: return
    var r = 0
    var sC = 0
    x.forEach {
        when (it) {
            'S' -> {
                sC++
            }
            'T' -> {
                if (sC > 0) {
                    sC--
                    r += 2
                }
            }
        }
    }
    println((x.length - r).toString())
}


Measured memory_bytes: 38196
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    rep(i, n) cin >> a[i] >> b[i];
    vector<int> c(n), d(n);
    rep(i, n) cin >> c[i] >> d[i];

    
    typedef std::pair<int, int> pair;
    // 小さい順
    vector<pair> C;
    rep(i, n) C.push_back(pair(i, c[i]));
    sort(all(C), [](const pair& lhs, const pair& rhs) {
        return lhs.second < rhs.second;
    });

    // 大きい順
    vector<pair> B;
    rep(i, n) B.push_back(pair(i, b[i]));
    sort(all(B), [](const pair& lhs, const pair& rhs) {
        return lhs.second < rhs.second;
    });
    reverse(all(B));

    vector<int> visited(n);
    int nPair = 0;
    rep (i, n) {
        int blue = C[i].first;
        int x2 = c[blue];
        int y2 = d[blue];
        rep (j, n) {
            int red = B[j].first;
            if (visited[red] >= 1) {
                continue;
            }

            int x1 = a[red];
            int y1 = b[red];
            if (x1 < x2 && y1 < y2) {
                visited[red] = 1;
                nPair++;
                break;
            }
        }
    }

    put(nPair);


    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define pii pair<long long,long long>
#define pll pair<long long, long long>
#define rep(i,l,r) for(long long i = l;i<r;i++)

#define SSTR( x ) static_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str()

#define fastout  ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
using namespace __gnu_pbds;

typedef tree<pll,null_type,less<pll>,rb_tree_tag,tree_order_statistics_node_update> order_set;

const long long INF = (long long)1e9 + 7;
const long long LLINF = (long long)1e18 + 7;

mt19937 mt('O' + '4' + 'K' + 'O');

void kekek()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    mt();
    #ifdef EB_UG
        freopen("in.txt", "r", stdin), freopen("out.txt", "w", stdout);
    #endif
}

int main() {
	kekek();
	string s1, s2;
	cin >> s1 >> s2;
	int ans = 0;
	for (int i = 0; i < 3; i++) {
		ans += (s1[i] == s2[i]);
	}
	cout << ans;
}

Measured memory_bytes: 256