akhauriyash/Code-Regression huggingface dataset:
// May this submission get accepted!

#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(i, (q).size()) { cerr << (q)[i] << (i == i_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
#define CHOKUDAI_ const
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using cll = DANCE_ DANCE_ CHOKUDAI_;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    ll n; cin >> n;
    vector<ll> s(1LL << n);
    map<ll, ll> m;
    REP(i, 1LL << n) {
        ll si; cin >> si;
        ++m[si];
    }
    
    priority_queue<ll> conn;
    conn.push(1LL << n);

    for (auto itr = m.rbegin(); itr != m.rend(); ++itr) {
        vector<ll> wq;
        if (itr->second > conn.size()) {
            cout << "No" << endl;
            return 0;
        }
        REP(i, itr->second) {
            ll ct = conn.top();
            conn.pop();
            for (ll j = 1; j < ct; j <<= 1) wq.push_back(j);
        }
        for (ll j : wq) conn.push(j);
    }

    cout << "Yes" << endl;
    
}

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

int main() {
  string s;
  cin >> s;
  int len = s.size();
  int a_index = -1;
  int z_index = -1;

  for(int i = 0; i < len; ++i) {
    if(a_index == -1 && s[i]=='A') a_index = i;
    if(s[i]=='Z') z_index = i;
    
  }
  
  cout << z_index - a_index + 1 << endl;
}

Measured memory_bytes: 640
import sys
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
hantei = [[0 for _ in range(w)] for _ in range(h)]
for i in range(h):
    for j in range(w):
        if s[i][j] == "#":
            if i < h-1:
                if s[i+1][j] == "#":
                    hantei[i][j] = 1
                    hantei[i+1][j] = 1
            if j < w-1:
                if s[i][j+1] == "#":
                    hantei[i][j] = 1
                    hantei[i][j+1] = 1

for i in range(h):
    for j in range(w):
        if s[i][j] == "#":
            if hantei[i][j] == 0:
                print("No")
                sys.exit()

print("Yes")

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

int dp[1<<16],mask[101];
int main(){
	int n;
	while(scanf("%d",&n),n){
		memset(dp,0,sizeof(dp));
		int Max=0;
		rep(i,n){
			int m,l;scanf("%d%d",&m,&l);
			int mask=0;
			rep(k,m){
				int s,e;scanf("%d%d",&s,&e);s-=6;e-=6;
				for(int j=s;j<e;j++)mask|=1<<j;
			}
			rep(j,1<<16){
				if(!(j&mask)){
					dp[j|mask]=max(dp[j|mask],dp[j]+l);
					Max=max(Max,dp[j|mask]);
				}
			}
		}
		printf("%d\n",Max);
	}
}

Measured memory_bytes: 3412
import java.util.Scanner;
import java.util.Arrays;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] a1=new long[n];
		for(int i = 0; i<n; i++){
			long a = sc.nextLong();
			a1[i]=a;
		}
		Arrays.sort(a1);
		long a2=a1[0];
		for(int i = 0; i<n; i++){
			a2=gcd(a1[i],a2);
		}
		System.out.println(a2);
	}
	private static long gcd(long m, long n) {
    if(m < n) return gcd(n, m);
    if(n == 0) return m;
    return gcd(n, m % n);
}
}

Measured memory_bytes: 62800
#include <iostream>
#include <string>
#include <map>
#include <cstdint>

int main()
{
	typedef std::map<std::string, char> FigureToIdent;
	FigureToIdent figure_to_idnt;
	figure_to_idnt.insert(std::make_pair("1100000011", 'A'));
	figure_to_idnt.insert(std::make_pair("1000000010000000100000001", 'B'));
	figure_to_idnt.insert(std::make_pair("1111", 'C'));
	figure_to_idnt.insert(std::make_pair("1000000110000001", 'D'));
	figure_to_idnt.insert(std::make_pair("11000000011", 'E'));
	figure_to_idnt.insert(std::make_pair("100000001100000001", 'F'));
	figure_to_idnt.insert(std::make_pair("110000011", 'G'));

	std::string input;
	while (getline(std::cin, input)) {
		if (input == "") {
			getline(std::cin, input);
		}
		for (std::uint16_t i = 1; i < 8; ++i) {
			std::string temp;
			getline(std::cin, temp);
			input += temp;
		}

		for (auto const& value : figure_to_idnt) {
			if (input.find(value.first) != std::string::npos) {
				std::cout << value.second << std::endl;
				break;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 1184
use std::io::Read;
use std::io::{stdout, BufWriter, Write};

fn main() {
    let mut buf = String::new();
    
    let out = stdout();
    let mut out = BufWriter::new(out.lock());

    // 標準入力から全部bufに読み込む
    std::io::stdin().read_to_string(&mut buf).unwrap();

    // 読み込んだStringを空白で分解する
    let mut iter = buf.split_whitespace();

    let a: usize = iter.next().unwrap().parse().unwrap();
    let b: usize = iter.next().unwrap().parse().unwrap();
    let t: usize = iter.next().unwrap().parse().unwrap();
    
    let count = t / a;

	writeln!(out, "{}", b * count);
}

Measured memory_bytes: 4352
def sub_vector(x1, y1, x2, y2)
	return x1 - x2, y1 - y2
end

while line = gets do
	x1, y1, x2, y2, x3, y3, xp, yp = line.split.map(&:to_f)

	*ab = sub_vector(x2, y2, x1, y1)
	*bp = sub_vector(xp, yp, x2, y2)

	*bc = sub_vector(x3, y3, x2, y2)
	*cp = sub_vector(xp, yp, x3, y3)

	*ca = sub_vector(x1, y1, x3, y3)
	*ap = sub_vector(xp, yp, x1, y1)
	
	c1 = ab[0] * bp[1] - ab[1] * bp[0]
	c2 = bc[0] * cp[1] - bc[1] * cp[0]
	c3 = ca[0] * ap[1] - ca[1] * ap[0]
	
	if (c1 > 0 && c2 > 0 && c3 > 0) ||
	   (c1 < 0 && c2 < 0 && c3 < 0); then
	   puts "YES"
	else
	   puts "NO"
	end
end

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

#define ll long long
#define pb push_back
#define pf push_front
#define np next_permutation
#define pp prev_permutation
#define all(x) (x).begin(),(x).end()

using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    char x= n + '0';
    char y= m + '0';
    string a(m,x),b(n,y);
    cout<<min(a,b)<<endl;
    return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;(i)--)
#define rrep1(i,n) for(int i=((int)(n));i>0;(i)--)
#define sz(c) ((int)(c).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<int, pair<int, int> > PP;
const int MAX=1e5+10;

int N;
int H[MAX];
void input(){
    cin>>N;
    rep(i,N)cin>>H[i];
}

void solve(){
    int now=H[0];
    int tr=0;
    int ans=0;
    rep1(i,N-1){
        if(now>=H[i]){
            now=H[i];
            tr++;
        }
        else{
            now=H[i];
            tr=0;
        }
        ans=max(ans, tr);
    }
    cout<<ans<<endl;

}

void output(){
  
}

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


Measured memory_bytes: 640
#import <stdio.h>
int main() {
	char s[3];
	char t[3];
	scanf("%c%c%c ",s,s+1,s+2);
	scanf("%c%c%c ",t,t+1,t+2);
	int ans=0;
	for(int i=0;i<3;i++){
		ans+=(s[i]==t[i]);
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 6356
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
input.split('\n').forEach(function(line) {
  if (line !== '') {
    var nums = line.split(' ').map(Number);
    while (nums[0] !== 0 && nums[1] !== 0) {
      var l = Math.max(nums[0], nums[1]);
      var s = Math.min(nums[0], nums[1]);
      nums[0] = s;
      nums[1] = l % s;
    }
    console.log(nums[0]);
  }
});

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

int main(){
    int64_t N, M;
    cin >> N >> M;
    vector<int64_t> A(N), S(N+1);
    for(int i=0; i<N; i++) cin >> A[i];
    sort(A.begin(), A.end());
    for(int i=0; i<N; i++) S[i+1] = S[i] + A[i];

    // ok : ok以上がM回以上
    int64_t ok = 0, ng = 1e6;
    while(ng-ok>1){
        int64_t mid = (ok+ng)/2;
        int64_t num = 0;
        for(int i=0; i<N; i++){
            num += A.end() - lower_bound(A.begin(), A.end(), mid - A[i]);
        }
        (num >= M ? ok : ng) = mid;
    }
    int64_t ans = 0, num = 0;
    for(int i=0; i<N; i++){
        int pt = lower_bound(A.begin(), A.end(), ok - A[i]) - A.begin();
        num += N-pt;
        ans += S[N] - S[pt] + (N-pt)*A[i];
    }
    ans += ok*(M-num);
    cout << ans << endl;
    return 0;
}


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

#define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert
#define endl '\n'
#define all(x) x.begin(), x.end()

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
using vvll = vector< vector<ll> >;
using vll = vector<ll> ;
using vb = vector<bool> ;
using pll = pair<ll, ll> ;

const ll maxs = 1e6+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 1e15;

ll fast(ll x,ll y){
    ll res=1;
    while(y){
        if(y&1)
            res = (res*x)%mod;
        x = (x*x)%mod;
        y >>= 1;
    }
    return res;
}

ll inv(ll n){
    return fast(n,mod-2);
}


void pre(){


}

void solve(){

    ll n;
    cin  >> n;
    if(n >= 30){
        cout << "Yes";
    }else{
        cout << "No";
    }

}

int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input00.txt","r",stdin);
    // #endif
    IOS;
    pre();
    ll T = 1;
    //cin>>T;
    while(T--){
        solve();   
    }
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
bool f(string s) {auto t = s; reverse(begin(t), end(t)); return s == t;}
int main()
  {string S; cin >> S;
  puts(f(S) and f(S.substr(0, S.size() / 2)) ? "Yes" : "No");}

Measured memory_bytes: 256
a, b = map(int, input().split())
d = [0] * (a+1)

for i in range(b):
    d[int(input())] = -1
d[0] = 1 if d[0] != -1 else 0
d[1] = 1 if d[1] != -1 else 0
for i in range(2, a+1):
    if d[i] != -1:
        d[i] = (d[i-1] + d[i-2]) % 1000000007
    else:
        d[i] = 0
print(d[len(d)-1])


Measured memory_bytes: 6900
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
const int maxn = 305, mod = 1000000007;
#define rep(i, s, t) for(int i=s, tt=t; i<=tt; ++i)
int N, M;
int f[maxn][maxn][maxn];
vector<pair<int,int> > lm[maxn];
bool check(int r, int g, int b, int l, int x) {
    return (r >= l) + (g >= l) + (b >= l) == x;
}
int che(int r, int g, int b, int k) {
    for(int i = 0; i < (int)lm[k].size(); ++i)
	if(!check(r, g, b, lm[k][i].first, lm[k][i].second))
	    return f[r][g][b] = 0;
    return f[r][g][b];
}
int main() {
    scanf("%d%d", &N, &M);
    for(int i = 1, l, r, x; i <= M; ++i) {
	scanf("%d%d%d", &l, &r, &x);
	lm[r].push_back(make_pair(l, x));
    }
    int ans = 0;
    f[0][0][0] = 1;
    rep(i, 0, N) rep(j, 0, N) rep(k, 0, N) {
	int r = max(i, max(j, k));
	if(!che(i, j, k, r)) continue;
	(f[r + 1][j][k] += f[i][j][k]) %= mod;
	(f[i][r + 1][k] += f[i][j][k]) %= mod;
	(f[i][j][r + 1] += f[i][j][k]) %= mod;
	if(r == N) ans = (ans + f[i][j][k]) % mod;
    }
    printf("%d\n", ans);
    return 0;
}
// r g b


Measured memory_bytes: 110976
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    int n, wMax;
    cin >> n >> wMax;
    vector<int> w(n), v(n);
    for(int i=0; i<n; ++i)
        cin >> w[i] >> v[i];

    vector<long long> dp(wMax+1, 0);
    for(int i=0; i<n; ++i){
        for(int j=wMax-w[i]; j>=0; --j){
            dp[j+w[i]] = max(dp[j+w[i]], dp[j] + v[i]);
        }
    }
    cout << dp[wMax] << endl;

    return 0;
}


Measured memory_bytes: 1024
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static PrintWriter out;
	static InputReader ir;

	static void solve() {
		char s=ir.next().charAt(0);
		if(s=='a'||s=='i'||s=='u'||s=='e'||s=='o')
			out.println("vowel");
		else
			out.println("consonant");
	}

	public static void main(String[] args) throws Exception {
		ir = new InputReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	static class InputReader {

		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;

		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}

		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}

		public boolean hasNext() {
			skip();
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}
}

Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define ALL(x) (x).begin(), (x).end()
int main() {
  int n, l;
  cin >> n >> l;
  vector<string> a(n);
  for (int i=0; i < n; i++) cin >> a[i];
  sort(ALL(a));
  for (int i=0; i < n; i++) cout << a[i];
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1e17;
const int inf = 1e5;
typedef long double ld;
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; }
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
struct SegmentTree{
  int N;
  vector<int> node;
  public :
    void intit(vector<int>v){
      int sz = v.size();
      N=1;
      while(N<sz) N*=2;
      node.resize(N);
      for(int i=0 ; i<sz ; i++) node[i+N-1] = v[i];
      for(int i=N-2 ; i>=0 ; i--) node[i] = min(node[i*2+1], node[i*2+2]);
    }
    void update(int x, int val){
      x += N-1;
      node[x+N-1] = val;
      while(x>0){
        x = (x-1)/2;
        node[x] = min(node[x*2+1], node[x*2+2]);
      }
    }
    int getmin(int a, int b, int k, int l, int r){
      if(b<=l || r<=a) return inf;
      else if(a<=l && r<=b) return node[k];
      else{
        int vl = getmin(a, b, 2*k+1, l, (l+r)/2);
        int vr = getmin(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
      }
    }
};
vector<ll> divisor(ll n){
  vector<ll> res;
  for(ll i=1; i*i<=n ; i++){
    while(n%i==0){
      ++res[i];
      n /= i;
    }
  }
  if(n!=1) res[n]=1;
  return res;
}
int main(){
  int N,x,t;
  cin>>N>>x>>t;
  int n = (N+x-1)/x;
  cout<<n*t<<endl;
  return 0;
}


Measured memory_bytes: 3604
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};
fn main() {
    input! {//
        n:usize,
        mut a:[i64;n],
        mut b:[i64;n],
    }
    let mut ans = 1;
    let mut sa = 0;
    let mut sb = 0;
    for i in 0..n {
        if a[i] > b[i] {
            sb += a[i] - b[i];
        }
        if a[i] < b[i] && (b[i] - a[i]) % 2 == 1 {
            sa += (b[i] - a[i] + 1) / 2;
            sb += 1;
        }
        if a[i] < b[i] && (b[i] - a[i]) % 2 == 0 {
            sa += (b[i] - a[i]) / 2;
        }
    }
    if sa < sb {
        ans = 0;
    }
    yn(ans != 0);
}
pub fn yn(ans: bool) {
    if ans {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2444
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
using namespace std;
typedef pair<ll,ll> lp;
const int inf=0x3f3f3f3f;
void A() {
    char c;
    cin>>c;
    if(c<='z'&&c>='a') cout<<'a'<<endl;
    else cout<<'A'<<endl;
}
void B() {
    int n,k;
    cin>>n>>k;
    vector<int> a(n,0);
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a.begin(),a.end());
    int res=0;
    for(int i=0;i<k;i++) res+=a[i];
    cout<<res<<endl;
}
void C() {

}
void D() {

}
void E(){

}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    B();
}


Measured memory_bytes: 3656
/**
  * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_9_B&lang=jp
  * String - Shuffle
  */
object Main {
  def main(args: Array[String]): Unit = {
    Iterator.continually(io.StdIn.readLine()).takeWhile(_ != null).takeWhile(_ != "-")
      .map {
        cards => {
          val n = io.StdIn.readInt()
          val shuffles = Iterator.continually(io.StdIn.readLine()).takeWhile(_ != null).take(n).map(_.toInt)
          shuffles.foldLeft(cards) { (acc, x) =>
            val (lower, upper) = acc.splitAt(x)
            upper + lower
          }
        }
      }
      .foreach(println)
  }
}

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

int main(){
  int n;
  cin>> n;
  vector<int> a(n),b(n),c(n-1);
  for (int i=0; i<n; i++) cin>> a.at(i);
  for (int i=0; i<n; i++) cin>> b.at(i);
  for (int i=0; i<n-1; i++) cin>> c.at(i);
  
  int before_num=a.at(0)-1;
  int num;
  int sum=b.at(before_num);
  for (int i=1; i<n; i++){
    num=a.at(i)-1;
    sum+=b.at(num);
    if (num-before_num==1) sum+=c.at(before_num);
    before_num=num;
  }
  cout<< sum <<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int a, b, c, tmp;

    scanf("%d %d %d", &a, &b, &c);
    if(a > b){
      tmp = a;
      a = b;
      b = tmp;
    }
    if(b > c){
      tmp = c;
      c = b;
      b = tmp;
    }
    if(a > b){
      tmp = a;
      a = b;
      b = tmp;
    }

    printf("%d %d %d\n", a, b, c);

    return 0;
}

Measured memory_bytes: 1796
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
int main()
{
  int n;
  cin >> n;
  vector<ll> a(n);
  ll b = 0;
  for(int i=0;i<n;i++){
    cin >> a[i];
    b ^= a[i];
  }

  for(int i=0;i<n;i++){
    cout << (b^a[i]);
    if(i != n-1) cout << " ";
    else cout << "\n";
  }
}


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

public class Main extends PrintWriter {
	Main() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		Main o = new Main(); o.main(); o.flush();
	}

	void main() {
		int a = sc.nextInt();
		int b = sc.nextInt();
		for (int p = b * 10; p < (b + 1) * 10; p++)
			if (p * 8 / 100 == a) {
				println(p);
				return;
			}
		println(-1);
	}
}


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

int N;
string s,t;
int dp[1001][1001];

// int solve(int i, int j) {
//
//     if (dp[i][j] >= 0) {
//         return dp[i][j];
//     }
//
//     int res;
//     if (i >= n || j >= m) {
//         res = 0;
//     }
//     else if (s[i] == t[j]) {
//         res = solve(i+1, j+1) + 1;
//     }
//     else {
//         res = max(solve(i+1, j), solve(i, j+1));
//     }
//     return dp[i][j] = res;
// }

int main() {
    cin >> N;
    while (N--) {
        cin >> s >> t;
        int n = s.size(), m = t.size();
        fill(dp[0], dp[1001], 0);
        for (int i=0;i<n;++i) {
            for (int j=0;j<m;++j) {
                if (s[i] == t[j]) {
                    dp[i+1][j+1] = dp[i][j] + 1;
                }
                else {
                    dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
                }
            }
        }
        cout << dp[n][m] << endl;
    }
}

Measured memory_bytes: 7064
package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)
	
	w := make([]int,n)
	
	for i := range w {
		fmt.Scan(&w[i])
	}
	
	minAbs := 10000
	for t := 0; t < n; t++ {
		var underT,overT float64
		for i := 0; i < n; i++ {
			if i <= t {
              underT += float64(w[i])
			} else {
              overT += float64(w[i])
			}
		}
      	currentAbs := int(math.Abs(underT - overT))
		if minAbs > currentAbs {
			minAbs = currentAbs
		}
	}
	
	fmt.Println(minAbs)
}

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

int main() {
    int N, M; cin >> N >> M;
    vector<long long> X(M);
    for (int i = 0; i < M; ++i) cin >> X[i];
    sort(X.begin(), X.end());
        
    vector<long long> diffs;
    for (int i = 1; i < X.size(); ++i) diffs.push_back(X[i] - X[i-1]);//push_back=新たな要素を末尾に追加
    sort(diffs.begin(), diffs.end(), greater<long long>());//大きい順にソート
        
    long long res = X.back() - X[0];//座標の最大-最小
    for (int i = 0; i < min((int)diffs.size(), N-1)/*∵同じ座標に複数のコマを置いてもいい*/; ++i) res -= diffs[i];
    cout << res << endl;
}


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

int main()
{
  int H,A,t;
  
  cin >> H >> A;
  int sum=0;
  
  for(int i=0;i<A;i++)
  {
    cin >> t;
    sum=sum+t;
  }
  
  if(sum<H)
  {
    cout <<"No";
  }
  else
  {
    cout <<"Yes";
  }
  
}
  


Measured memory_bytes: 256
#include <bits/stdc++.h>	
using namespace std; 
typedef long long ll; 
const int MAX = 1e5 + 5; 
ll dp[101][MAX] , v[MAX] , w[MAX], W;

int main()
{
	int n; 
	scanf("%d %lld", &n , &W); 
	for (int i = 1; i <= n; ++i) {
		scanf("%lld %lld" , &w[i] , &v[i]) ; 
	}
/*	for (int i =0 ; i<= 100001 ; ++i ) 
		dp[0][i] = 0 ;
	*/	
	for (int i = 0; i<= n ; ++i) {
		for (int j =0 ; j<= 100001 ; ++j) {
			dp[i][j] = 1e18+1 ; 		
		}
	}
	dp[0][0] = 0 ; 
	
	for (int i = 1 ; i<= n ; ++i) {
		for (int j = 0 ; j<= 100000 ; ++j) {
				if (j-v[i] < 0)
				dp[i][j] = dp[i-1][j] ; 
				else 
				dp[i][j] = min(dp[i-1][j] , dp[i-1][j-v[i]]+w[i]) ; 
		}
	}
	ll ans = 0 ;
	for (int i = 0 ; i<= 100001 ; ++i){
		if (dp[n][i] <=W)
			ans = i ;
	}
	printf("%lld\n", ans) ; 
	return 0;
}

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

int main(){
    ll n,a,b;
    cin >> n >> a >> b;
    ll c = n/(a+b);
    ll ans=c*a;
    n=n-c*(a+b);
    if(n>=a) ans+=a;
    else ans+=n;
    cout << ans << endl;

    return 0;
}











Measured memory_bytes: 256
import sys
stdin = sys.stdin

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())

n,m = li()
stu = []
for _ in range(n):
    stu.append(tuple(li()))
chk = []
for _ in range(m):
    chk.append(tuple(li()))
    
for s in stu:
    ans_cand = []
    for c in chk:
        ans_cand.append(abs(c[0] - s[0]) + abs(c[1] - s[1]))
    
    ans = min(ans_cand)
    print(ans_cand.index(ans) + 1)

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

int main(){
    string s;
    cin>>s;
    int b=0;
    for(int i=0;i<s.size();i++){
        int a=i+1;
        if(a%2==1){
            if(s[i]=='R'||s[i]=='U'||s[i]=='D'){
                b++;
            }
        }
        if(a%2==0){
            if(s[i]=='L'||s[i]=='U'||s[i]=='D'){
                b++;
            }
        }
    }
    if(b==s.size())
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<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);
		String S = sc.next();
		if(S.equals("Sunny"))
			System.out.println("Cloudy");
		else if(S.equals("Cloudy"))
			System.out.println("Rainy");
		else if(S.equals("Rainy"))
			System.out.println("Sunny");

	}

}


Measured memory_bytes: 22356
#include "bits/stdc++.h"
using namespace std;

int main(void) {
    int N;
    string s;
    cin >> N;

    for (int i = 0; i < N; i++) {
        cin >> s;

        if (s == "Y") {
            cout << "Four" << endl;
            break;
        }

        // 最後まで Y が出てこない時
        if (i == N - 1) {
            cout << "Three" << endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define rep(i,l,r)for(int i=(l);i<(r);i++)
#define W 700

typedef struct tuple{int x,y;}T;

int qidx[500010];
T query[500010];//[x,y)
int qcmp(const void*p,const void*q){
	if(query[*(int*)p].x/W<query[*(int*)q].x/W)return -1;
	if(query[*(int*)p].x/W>query[*(int*)q].x/W)return 1;
	if(query[*(int*)p].y<query[*(int*)q].y)return -1;
	if(query[*(int*)p].y>query[*(int*)q].y)return 1;
	return 0;
}

int c[500010];
int ans[500010];
int main(){
	int n,q;
	scanf("%d%d",&n,&q);
	rep(i,0,n)scanf("%d",c+i);
	rep(i,0,q){
		int x,y;
		scanf("%d%d",&x,&y);
		query[i].x=x-1;
		query[i].y=y-1;
	}
	
	//クエリをソート
	rep(i,0,q)qidx[i]=i;
	qsort(qidx,q,sizeof(int),qcmp);
	
	//クエリに答える
	int*qi=qidx;
	rep(i,0,n/W+1){
		int temp[500010]={},cnt=0;
		int l=i*W,r=l-1;
		while(qi-qidx<q&&query[*qi].x/W==i){
			while(r<query[*qi].y)cnt+=!temp[c[++r]]++;
			while(l<query[*qi].x)cnt-=!--temp[c[l++]];
			while(l>query[*qi].x)cnt+=!temp[c[--l]]++;
			ans[*qi]=cnt;
			qi++;
		}
	}

	rep(i,0,q)printf("%d\n",ans[i]);
}

Measured memory_bytes: 15344
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int N;
  cin >> N;
  int a[N];
  int ans = 0;
  for (int i = 0; i < N; i++) cin >> a[i];
  for (int i = 0; i < N; i++) {
    if (a[a[i]-1] == i + 1) {
      ans++;
    }
  }
  cout << ans / 2 << endl;
  return 0;
}

Measured memory_bytes: 3932
using System;
class p
{
  static void Main()
  {
    string[] input = Console.ReadLine().Split(' ');
    int A = int.Parse(input[0]);
    int B = int.Parse(input[1]);
    if (A == 1) { A = 14; }
    if (B == 1) { B = 14; }
    
    if (A < B) {
      Console.WriteLine("Bob");
    } else if (A > B) {
      Console.WriteLine("Alice");
    } else {
      Console.WriteLine("Draw");
    }
  }
}

Measured memory_bytes: 13140
#include<set>
#include<map>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<string>
#include<vector>
#include<climits>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<iostream>
#include<algorithm>
#include<functional>

#define	pf	push_front
#define	pb	push_back
#define	mp	make_pair

using namespace std;

typedef	pair<int,int>	pii;

int main()
{
	vector<bool> ms(300000);
	for(int i=0;i<300000;i+=7){
		ms[i+1]=true;
		ms[i+6]=true;
	}

	vector<int> msp;
	for(int i=2;i<300000;i++){
		if(ms[i]){
			msp.pb(i);
			for(int j=i+i;j<300000;j+=i)	ms[j]=false;
		}
	}

	for(int n;cin>>n,n!=1;){
		cout<<n<<':';
		for(int i=0;i<msp.size()&&msp[i]<=n;i++)
			if(n%msp[i]==0)	cout<<' '<<msp[i];
		cout<<endl;
	}

	return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <unordered_map>
#include <vector>
#include <cmath>
#include <unordered_set>
#include <cstdint>

using namespace std;
uint64_t gcd(uint64_t a, uint64_t b) {
	uint64_t r;
	while (0 < b) {
		r = a % b;
		a = b;
		b = r;
	}
  return a;
}

int main() {
  int n;
  cin >> n;
  uint64_t accum = 1;
  for (int i = 0; i < n; ++i) {
    uint64_t t;
    cin >> t;
    accum = accum / gcd(accum, t) * t;
  }
  std::cout << accum << endl;
}


Measured memory_bytes: 256
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/template.hpp"


#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void say(bool val, T yes = "Yes", T no = "No") { cout << (val ? yes : no) << endl; }

template <class T> void chmin(T &a, T b) {
  if (a > b)
    a = b;
}

template <class T> void chmax(T &a, T b) {
  if (a < b)
    a = b;
}


#line 2 "tmp.cpp"

bool f(double a, double b, double x, double theta) {
  if (theta <= atan(b / a)) {
    return 2 * a * a * b - a * a * a * tan(theta) >= 2 * x;
  } else {
    return a * b * b >= 2 * x * tan(theta);
  }
}

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

  double a, b, x;
  cin >> a >> b >> x;

  double ok = 0, ng = M_PI / 2;
  REP(i, 1000000) {
    double mid = (ok + ng) / 2;
    (f(a, b, x, mid) ? ok : ng) = mid;
  }
  coutd(10) << ok * 180 / M_PI << endl;

  return 0;
}


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

using namespace std;

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

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

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

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

const int N=101, M=101;
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n,m;
    cin>>n>>m;

    int a[N][M]={};
    int b[M]={};

    REP(i,n) REP(j,m){
        cin>>a[i][j];
    }

    REP(i,m) cin>>b[i];

    REP(i,n){
        ll ans=0;
        REP(j,m){
            ans += a[i][j]*b[j];
        }
        cout << ans << endl;
    }
    
    return 0;
}


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

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

  vector<int> a(n);
  vector<pair<int,int>> p(m);
  int i,j;
  long long sum=0;
  for(i=0;i<n;i++){
    cin>>a.at(i);
    sum+=a.at(i);
  }
  for(i=0;i<m;i++){
    int b,c;
    cin>>b>>c;
    p.at(i).first=c;
    p.at(i).second=b;
  }

  sort(a.begin(),a.end());
  sort(p.begin(),p.end(),greater<pair<int,int>>());

  int left=0;
  int right=n;
  for(i=0;i<m;i++){
    bool jud=0;
    right=left+p.at(i).second;
    if(right>n)
    right=n;
    // cout<<i<<" left "<<left<<" right "<<right<<endl<<"p.first "<<p.at(i).first<<endl;
    for(j=left;j<right;j++){
      if(p.at(i).first<a.at(j)){
        jud=1;
        break;
      }
      else{
        sum-=a.at(j);
        sum+=p.at(i).first;
      }
      // cout<<"j "<<j<<" sum "<<sum<<endl;
    }
    left=right;
    if(jud)
    break;
  }
  cout<<sum<<endl;
  // for(i=0;i<m;i++)
  // cout<<i<<" f "<<p.at(i).first<<" s "<<p.at(i).second<<endl;

}


Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		long[] num = new long[s.length()+1];
		for(int i = 0; i < num.length; i++) {
			num[i] = 0;
		}
		for(int i = 0; i < s.length(); i++) {
			if(s.charAt(i)=='<' ) {
				num[i+1] = Math.max(num[i+1],num[i]+1);
			}
		}
		for(int i = s.length()-1; i >= 0; i--) {
			if(s.charAt(i)=='>') {
				num[i]=Math.max(num[i+1]+1, num[i]);
			}
		}
		long ans = 0;
		for(int i = 0; i < num.length; i++) {
			ans += num[i];
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 46140
import sys


def input():
    return sys.stdin.readline().rstrip()


def main():
    R, C, K = map(int, input().split())

    field = [[0 for j in range(C)] for i in range(R)]

    for _ in range(K):
        r, c, v = map(int, input().split())
        field[r - 1][c - 1] += v

    dp = [[0] * 4 for j in range(C)]

    for i in range(R):
        for j in range(C):
            ct = field[i][j]
            premax = max(dp[j])

            if ct == 0:
                if j>0:
                    dp[j][0] = max(dp[j - 1][0], premax)
                else:
                    dp[j][0] = premax

                for k in range(1, 4):
                    if j > 0:
                        dp[j][k] = dp[j - 1][k]
            else:
                if j>0:
                    dp[j][0] = max(dp[j - 1][0], premax)
                    dp[j][1] = max(ct + max(dp[j - 1][0], premax), dp[j - 1][1])
                else:
                    dp[j][0] = premax
                    dp[j][1] = premax +ct
                for k in range(2, 4):
                    if j > 0:
                        dp[j][k] = max(dp[j - 1][k - 1] + ct, dp[j - 1][k])

    print(max(dp[C - 1]))


if __name__ == "__main__":
    main()


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

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

  int tmp;
  vector<int> p(n,0);
  rep(i,n){
    cin >> tmp;
    p.at(i) = tmp;
  }
  sort(p.begin(),p.end());

  int ans=0;
  rep(i,k){
    ans += p.at(i);
  }
  cout << ans << endl;
  
}

Measured memory_bytes: 3624
import sys
input = sys.stdin.readline

N = int(input())
p = list(map(int,input().split()))
sort_p= sorted(p)
count = 0
for i in range(N):
    if p[i] != sort_p[i]:
        count += 1
if count <= 2:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 9176
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
#include<iostream>
#include<cmath>
#include<bitset>
using namespace std;


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

return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
#define INF 1000000000
typedef long long int ll;
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t)
{
    std::ostringstream os;
    os << t;
    return os.str();
}
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> v(m);
    for (int i = 0; i < m; i++)
    {
        cin >> v[i];
    }
    if (n >= m)
    {
        cout << 0 << endl;
    }
    else
    {
        sort(v.begin(), v.end());
        vector<int> dis(m - 1);
        for (int i = 0; i < m - 1; i++)
        {
            dis[i] = abs(v[i] - v[i + 1]);
        }
        sort(dis.begin(), dis.end());
        ll ans = 0;
        for (int i = 0; i < m - n; i++)
        {
            ans += dis[i];
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {
		long startTime = System.currentTimeMillis();
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] L = new int[N];
		int[] cnt = new int[2001];
		int[] cnt2 = new int[2001];
		for (int i = 0; i < N; ++i) {
			L[i] = sc.nextInt();
			cnt[L[i]]++;
		}
		for (int i = 1; i < cnt.length; ++i) {
			cnt[i] += cnt[i - 1];
		}
		long ans = 0;
		Arrays.sort(L);
		for (int i = 0; i < N; ++i) {
			cnt2[L[i]]++;
			for (int j = 0; j < i; ++j) {
				int add = cnt[L[i] + L[j] - 1] - cnt[L[i] - 1] - cnt2[L[i]];
				ans += add;
			}
		}
		System.out.println(ans);
	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

Measured memory_bytes: 24588
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define maxn 200010
#define inf 999999999999999
using namespace std;
typedef long long ll;
int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch-'0'<0||ch-'0'>9){if(ch=='-') f=-1;ch=getchar();}
    while(ch-'0'>=0&&ch-'0'<=9){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n,m,A,B;
int X[maxn];
struct Segment_Tree{
    ll t[maxn*4],tx[maxn*4],ty[maxn*4],tag[maxn*4];
    void update(int k)
    {
        t[k]=min(t[k*2],t[k*2+1]);
        tx[k]=min(tx[k*2],tx[k*2+1]);
        ty[k]=min(ty[k*2],ty[k*2+1]);
    }
    void build(int k,int l,int r)
    {
        if(l==r)
        {
            if(l==B)
            {
                t[k]=0;
                tx[k]=l;ty[k]=-l;
            }
            else  t[k]=tx[k]=ty[k]=inf;
            return;
        }
        int mid=(l+r)/2;
        build(k*2,l,mid);
        build(k*2+1,mid+1,r);
        update(k);
    }
    void pushdown(int k)
    {
        if(!tag[k])  return;
        t[k*2]+=tag[k];t[k*2+1]+=tag[k];
        tx[k*2]+=tag[k];tx[k*2+1]+=tag[k];
        ty[k*2]+=tag[k];ty[k*2+1]+=tag[k];
        tag[k*2]+=tag[k];tag[k*2+1]+=tag[k];
        tag[k]=0;
    }
    ll query1(int k,int l,int r,int x,int y)
    {
        if(l>=x&&r<=y)  return tx[k];
        pushdown(k);
        int mid=(l+r)/2;
        ll res=inf;
        if(mid>=x)  res=min(res,query1(k*2,l,mid,x,y));
        if(mid<y)   res=min(res,query1(k*2+1,mid+1,r,x,y));
        return res;
    }
    ll query2(int k,int l,int r,int x,int y)
    {
        if(l>=x&&r<=y)  return ty[k];
        pushdown(k);
        int mid=(l+r)/2;
        ll res=inf;
        if(mid>=x)  res=min(res,query2(k*2,l,mid,x,y));
        if(mid<y)   res=min(res,query2(k*2+1,mid+1,r,x,y));
        return res;
    }
    ll find(int k,int l,int r,int x)
    {
        if(l==r)  return t[k];
        pushdown(k);
        int mid=(l+r)/2;
        if(mid>=x)  return find(k*2,l,mid,x);
        else        return find(k*2+1,mid+1,r,x);
    }
    void modi(int k,int l,int r,int x,ll y)
    {
        if(l==r)
        {
            t[k]=y;
            tx[k]=y+l;
            ty[k]=y-l;
            return;
        }
        pushdown(k);
        int mid=(l+r)/2;
        if(mid>=x)  modi(k*2,l,mid,x,y);
        else        modi(k*2+1,mid+1,r,x,y);
        update(k);
    }
}S;
int main()
{
    n=read();m=read();A=read();B=read();
    for(int i=1;i<=m;i++)  X[i]=read();
    X[0]=A;
    S.build(1,1,n);
    for(int i=1;i<=m;i++)
    {
        int cha=abs(X[i]-X[i-1]);
        ll tmp=S.find(1,1,n,X[i-1])+cha;
        tmp=min(tmp,S.query2(1,1,n,1,X[i])+X[i]);
        tmp=min(tmp,S.query1(1,1,n,X[i],n)-X[i]);
        S.tag[1]+=cha;
        S.modi(1,1,n,X[i-1],tmp);
    }
    cout<<S.t[1]<<endl;
    return 0;
}

Measured memory_bytes: 25600
n,k=map(int,input().split())
h=list(map(int,input().split()))
c=[0]*n
for i in range(1,n):
    c[i]=min([cj+abs(h[i]-hj) for cj,hj in zip(c[max(0,i-k):i],h[max(0,i-k):i])])
print(c[-1])

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

int main (){
  int a[3];
  cin>>a[0]>>a[1]>>a[2];
  int i,c5,c7;
  for(i=0;i<3;i++){
    if(a[i]==5)
      c5++;
    if(a[i]==7)
      c7++;
  }
  if(c5==2&&c7==1)
    cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}
  


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define downque(que) priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;
typedef vector<vector<int>> Matrix;
const int MOD = 1e9 + 7;
const int MAX = 1e7;
const int INF = numeric_limits<int>::max();


int main(){
  vector<int> a(3);   REP(i, 3)cin>>a[i];
  bool flag = false;
  sort(ALL(a));
  
    if (a[0]==a[1]&&a[1]!=a[2]){
      flag=true;
    
    }
   if (a[1]==a[2]&&a[0]!=a[1]){
      flag=true;
    
    }
  
  if (flag)
    cout << "Yes" << endl;
  else
   cout << "No" << endl;

}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var A int64
	var B int64
	fmt.Scan(&A)
	fmt.Scan(&B)
	fmt.Print(A * B)
}
func nextLine() string {
	sc.Scan()
	return sc.Text()
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func MySort(a []int) {
	sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })

}
func SortedBinaryAppend(sortedArr []int, targetValue int) []int {
	return []int{}
}
func SortedBinaryDelete(sortedArr []int, targetValue int) []int {
	return []int{}
}
func SortedBinarySearch(sortedArr []int, targetValue int) int {
	post := len(sortedArr) - 1
	pre := 0
	for {
		div := (post + pre) / 2
		tim := sortedArr[div]
		if tim == targetValue {
			return pre + div
		} else if tim > targetValue {
			post = tim
		} else {
			pre = tim
		}
		if pre == post {
			return -1
		}
	}
}
func Abs(i int) int {
	if i < 0 {
		return -1 * i
	}
	return i
}
func Min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func Max(a, b int) int {
	if a > b {
		return a
	}
	return b
}
func CalcNum(tate int, yoko int, A int, B int, dp *map[[2]int]int) int {
	if (*dp)[[2]int{tate, yoko}] != 0 {
		return (*dp)[[2]int{tate, yoko}]
	}
	return yoko*CalcNum(tate-1, yoko, A, B, dp) + tate*CalcNum(tate, yoko-1, A, B, dp)
}
func arrSum(arr []int) int {
	sum := 0
	for _, a := range arr {
		sum += a
	}
	return sum
}
func scanNums(len int) (nums []int) {
	var num int
	for i := 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return
}
func scanStrings(len int) (strings []string) {
	var str string
	for i := 0; i < len; i++ {
		fmt.Scanf("%s", &str)
		strings = append(strings, str)
	}
	return
}


Measured memory_bytes: 1772
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define mod 1000000007
 
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
 
int lcm(int a, int b) { return a * b / gcd(a, b); }

int main(){
    int n;
    cin >> n;
    vector<pair<ll, ll>> p(n);
    for (int i = 0; i < n; i++){
        ll a, b;
        cin >> a >> b;
        p[i] = make_pair(a, b);
    }

    sort(p.begin(), p.end());

    ll ans = 0;
    ll upper = p[0].first - 1;
    ll mid = p[n - 1].first - p[0].first + 1;
    ll under = p[n - 1].second;
    ans = upper + mid + under;
    cout << ans << endl;
    return 0;
}

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

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

  ll a[51], b[51], c[51], d[51];

  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> c[i] >> d[i];
  }

  for (int i = 0; i < n; i++) {
    ll min = 1000000001;
    int ans;
    for (int j = 0; j < m; j++) {
      if (min > abs(a[i] - c[j]) + abs(b[i] - d[j])) {
        min = abs(a[i] - c[j]) + abs(b[i] - d[j]);
        ans = j+1;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

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

int main() {
  char ch;
  
  cin >> ch;
  
  if (ch == 'a' || ch == 'i' || ch == 'u' || ch == 'e' || ch == 'o') {
    cout << "vowel" << endl;
  } else {
    cout << "consonant" << endl;
   }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 
 
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define in insert
#define ld long double
 
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
 
typedef long long int ll;
 
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =1e9+7;
const ll maxn =200001;
ll power(ll x, ll n) {
    ll res = 1;
    for (; n > 0; n >>= 1) {
    if (n & 1) res = (res * x) % mod;
    x = (x * x) % mod;
    }
    return res;
}

int main()
{
  
  IOS
  ll h;
  cin>>h;
  ll m=1;
  ll ans=0;
  while(h>0)
  {
    ans+=(m);
    h/=2;
    m*=2;
  }
  cout<<ans<<endl;
  
}

Measured memory_bytes: 256