akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define showall(obj) for(auto x:obj)cout<<x<<endl;
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
typedef vector<int> vint;
typedef vector<ll> vll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int n,m;
	cin>>n>>m;
	if(n>=m){cout<<0<<endl; return 0;}
	vint x(m);
	rep(i,m)cin>>x[i];
	sort(all(x));
	vint l(m-1);
	rep(i,m-1){
		l[i] = x[i+1]-x[i];
	}
	sort(all(l));
	ll nr = 0;
	for(int i = 1; i<=n-1; ++i){
		nr += l[m-i-1];
	}
	cout<<x[m-1]-x[0]-nr<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
 
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define ll long long
#define int ll
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define VAR(v, i) __typeof( i) v=(i)
#define forit(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
 
using namespace std;
 
const int maxn = (int)112;
const int mod = (int)1e9 + 7;
 
#define inf mod
 
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;   
typedef vector<ll> Vll;               
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;

int n, m, dp[maxn][maxn][maxn];
char s[maxn][maxn];
int dfs(int x, int y, int lst){
	if(x == 1 && y == 1){
		return (!lst && s[x][y] == '#');
	}
	int &res = dp[x][y][lst];
	if(res != -1) return res;
	res = inf;
	if(x > 1) res = min(res, dfs(x - 1, y, (s[x][y] == '#' ? 1 : 0)) + (!lst && s[x][y] == '#'));
	if(y > 1) res = min(res, dfs(x, y - 1, (s[x][y] == '#' ? 1 : 0)) + (!lst && s[x][y] == '#'));
	return res;
}
main () {
	cin >> n >> m;
	forn(i, 1, n)
		forn(j, 1, m)
			cin >> s[i][j];
	memset(dp, -1, sizeof(dp));
	cout << dfs(n, m, 0);
}

Measured memory_bytes: 11264
#include <bits/stdc++.h> // Tomasz Nowak
using namespace std;     // XIII LO Szczecin
using LL = long long;    // Poland
#define FOR(i, l, r) for(int i = (l); i <= (r); ++i)
#define REP(i, n) FOR(i, 0, (n) - 1)
template<class T> int size(T &&x) {
	return int(x.size());
}
template<class A, class B> ostream& operator<<(ostream &out, const pair<A, B> &p) {
	return out << '(' << p.first << ", " << p.second << ')';
}
template<class T> auto operator<<(ostream &out, T &&x) -> decltype(x.begin(), out) {
	out << '{';
	for(auto it = x.begin(); it != x.end(); ++it)
		out << *it << (it == prev(x.end()) ? "" : ", ");
	return out << '}';
}
void dump() {}
template<class T, class... Args> void dump(T &&x, Args... args) {
	cerr << x << ";  ";
	dump(args...);
}
#ifdef DEBUG
  struct Nl{~Nl(){cerr << '\n';}};
# define debug(x...) cerr << (strcmp(#x, "") ? #x ":  " : ""), dump(x), Nl(), cerr << ""
#else
# define debug(...) 0 && cerr
#endif
mt19937_64 rng(0);
int rd(int l, int r) {
	return uniform_int_distribution<int>(l, r)(rng);
}
// end of templates

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

	string s;
	cin >> s;
	REP(i, 3)
		cout << s[i];
	cout << '\n';
}


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <climits>
#include <cstring>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;

struct l
{
    double a;
    double b;
    double c;
};

int bit[112345], bit_n;

int bit_sum(int i)
{
    int s = 0;
    while (i > 0)
    {
        s += bit[i];
        i -= i & -i;
    }
    return s;
}

void bit_add(int i, int x)
{
    while (i <= bit_n)
    {
        bit[i] += x;
        i += i & -i;
    }
}

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

    l p[41234];

    int n;

    cin >> n;

    REP(i, n)
    cin >> p[i].a >> p[i].b >> p[i].c;

    sort(p, p + n, [](const l &s, const l &t) {
        return ((s.a / s.b) < (t.a / t.b));
    });

    double lx = -10e8, rx = 10e8, ly = -10e8, ry = 10e8;

    int t = ((n * (n - 1) / 2) + 1) / 2;

    REP(z, 200)
    {
        double mid = (lx + rx) / 2;

        bit_n = n + 1;
        memset(bit, 0, sizeof(bit));

        vector<pair<double, int>> v;

        REP(i, n)
        {
            double c = (p[i].c - p[i].a * mid) / p[i].b;

            v.push_back({c, i + 1});
        }

        SORT(v);

        int sum = 0;

        REP(i, n)
        {
            sum += v[i].second - 1 - bit_sum(v[i].second);
            bit_add(v[i].second, 1);
        }

        if (sum < t)
            lx = mid;
        else
            rx = mid;
    }

    sort(p, p + n, [](const l &s, const l &t) {
        return ((s.b / s.a) < (t.b / t.a));
    });

    REP(z, 200)
    {
        double mid = (ly + ry) / 2;

        bit_n = n + 1;
        memset(bit, 0, sizeof(bit));

        vector<pair<double, int>> v;

        REP(i, n)
        {
            double c = (p[i].c - p[i].b * mid) / p[i].a;

            v.push_back({c, i + 1});
        }

        SORT(v);

        int sum = 0;

        REP(i, n)
        {
            sum += v[i].second - 1 - bit_sum(v[i].second);
            bit_add(v[i].second, 1);
        }

        if (sum < t)
            ly = mid;
        else
            ry = mid;
    }

    cout << setprecision(30) << rx << " " << ry << endl;

    return 0;
}

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

using namespace __gnu_pbds;
using namespace std;

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

const int MOD = 998244353;

int mul(int a , int b) {
    return a * 1ll * b % MOD;
}

int add (int a , int b) {
    a += b;
    while (a >= MOD) a -= MOD;
    while (a < 0) a += MOD;
    return a;
}

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

    int n;
    cin >> n;

    vector<int> r(n) , c(n) , power(n + 1);
    vector<array<int , 2> > p(n);
    vector<array<int , 4> > ans(n);

    power[0] = 1;
    for (int i = 0 ;i < n ;i++) {
        cin >> r[i] >> c[i];
        p[i] = {r[i] , c[i]};
        power[i + 1] = mul(power[i] , 2);
    }

    vector<int> ind(n);
    iota(ind.begin() , ind.end() , 0);

    sort(ind.begin() , ind.end() , [&](int i , int j) {
       return p[i][0] < p[j][0];
    });


    sort(r.begin() , r.end());
    r.resize(unique(r.begin() , r.end()) - r.begin());

    Tree<int> os;
    int j = 0;
    for (int i = 0 ;i < r.size() ;i++) {
        int st = j;
        while (j < ind.size() && p[ind[j]][0] == r[i]) {
            os.insert(p[ind[j]][1]);
            j++;
        }

        j = st;
        while (j < ind.size() && p[ind[j]][0] == r[i]) {
            int lf = os.order_of_key(p[ind[j]][1] + 1);
            int rt = os.size() - os.order_of_key(p[ind[j]][1]);
            ans[ind[j]][2] = lf - 1;
            ans[ind[j]][0] = rt - 1;
            j++;
        }
    }


    sort(ind.begin() , ind.end() , [&](int i , int j) {
        return p[i][0] > p[j][0];
    });


    reverse(r.begin() , r.end());
    os.clear();

    j = 0;
    for (int i = 0 ;i < r.size() ;i++) {
        int st = j;
        while (j < ind.size() && p[ind[j]][0] == r[i]) {
            os.insert(p[ind[j]][1]);
            j++;
        }

        j = st;
        while (j < ind.size() && p[ind[j]][0] == r[i]) {
            int lf = os.order_of_key(p[ind[j]][1] + 1);
            int rt = os.size() - os.order_of_key(p[ind[j]][1]);
            ans[ind[j]][3] = lf - 1;
            ans[ind[j]][1] = rt - 1;
            j++;
        }
    }

    int res = mul(n , power[n - 1]);
    for (int i = 0 ;i < n ;i++) {
        int a = ans[i][0] , b = ans[i][1];
        int c = ans[i][2] , d = ans[i][3];
        res = add(res , mul(mul(power[a] - 1, power[d] - 1) , power[c]));
        res = add(res , mul(mul(power[a] - 1, power[d] - 1) , power[b] - 1));
        res = add(res , mul(mul(power[b] - 1, power[c] - 1) , power[a]));
        res = add(res , mul(mul(power[b] - 1, power[c] - 1) , power[d] - 1));
        res = add(res , mul(power[a] - 1 , mul(power[b] - 1 ,
                                               mul(power[c] - 1 , power[d] - 1))));
    }

    cout << res;
}

Measured memory_bytes: 17408
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))

using namespace std;
typedef pair<llint, llint> P;

llint n, Q;
llint a[100005], cnt[100005];

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	
	llint ans = 0;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		cnt[a[i]]++;
		ans += a[i];
	}
	
	cin >> Q;
	llint b, c;
	for(int i = 1; i <= Q; i++){
		cin >> b >> c;
		ans += (c-b)*cnt[b];
		cnt[c] += cnt[b];
		cnt[b] = 0;
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 5212
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int n = sc.nextInt();
		int[][] studentPos = new int[n][2];
		int[] useCheckPoint = new int[n];
		int m = sc.nextInt();
		int[][] checkPointPos = new int[m][2];
		
		for (int i = 0; i < n; i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			studentPos[i][0] = x;
			studentPos[i][1] = y;
		}
		
		for (int i = 0; i < m; i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			checkPointPos[i][0] = x;
			checkPointPos[i][1] = y;
		}
		
		for (int i = 0; i < n; i++) {
			int dist = Integer.MAX_VALUE;
			int pos = 0;
			for (int j = 0; j < m; j++) {
				int currDist = Math.abs(studentPos[i][0] - checkPointPos[j][0]) + Math.abs(studentPos[i][1] - checkPointPos[j][1]);
				if (currDist < dist) {
					dist = currDist;
					pos = j + 1;
				}
			}
			useCheckPoint[i] = pos;
		}
		for (int i = 0; i < useCheckPoint.length; i++) {
			System.out.println(useCheckPoint[i]);
		}
	}
  
    static class FastReader {
	    BufferedReader br;
	    StringTokenizer st;
	
	    public FastReader() {
	      br = new BufferedReader(new InputStreamReader(System.in));
	    }
	  
	    String next() { 
	      while (st == null || !st.hasMoreElements()) {
	        try {
	          st = new StringTokenizer(br.readLine());
	        } catch (IOException  e) {
	          e.printStackTrace();
	        }
	      }
	      return st.nextToken();
	    }
	
	    int nextInt() {
	      return Integer.parseInt(next());
	    }
	
	    long nextLong() {
	      return Long.parseLong(next());
	    }
	
	    double nextDouble() { 
	      return Double.parseDouble(next());
	    }
	
	    String nextLine() {
	      String str = "";
	        try{
	            str = br.readLine();
	        } catch (IOException e) {
	            e.printStackTrace();
	        }
	        return str;
	      }
	  }
}


Measured memory_bytes: 21332
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long long int n,d,a,b,c=0,k;
    double e,f;
    cin>>n>>d;
    while(n--)
    {
        cin>>a>>b;
        f=sqrt(a*a+b*b);
        if(f<=d)
        {
            c++;
        }

    }
    cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 3584
"""
I - Coins

考え方:
    N 枚のコインを投げた時, n 枚表になる確率を求める.
    以下の二つの和で求められる(①).
        N - 1 枚投げた時に n - 1 枚表になり, さらに次に投げた時に表になる確率
        N - 1 枚投げた時に n 枚表になり, さらに次に投げた時に裏になる確率
    N を0から始めるとDPで求められる.
    0 <= n <= N / 2 となるすべての n の確立の和が表が半分以下となる確率 X.
    表が半分以上となる(裏より多くなる)確率は 1 - X.
    計算量は O(n^2) <- あってる？？
"""


def solve():
    N = int(input())
    P = [float(i) for i in input().split()]
    dp = [1 for i in range(int((N + 1) / 2))]  # i 枚表になる確率
    for i, p in enumerate(P, 1):
        for j in reversed(range(len(dp))):
            if i <= j:
                # コインの合計枚数が i 枚以下の場合は表にする.
                dp[j] *= p
            elif j == 0:
                # 表のコインの枚数が 0 枚の場合は普通に裏になる.
                dp[j] *= (1 - p)
            else:
                # N 枚のコインを投げて n 枚表になる(①の計算)
                dp[j] = dp[j] * (1 - p) + dp[j - 1] * p
    print(1 - sum(dp))


if __name__ == '__main__':
    solve()


Measured memory_bytes: 3316
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;

int main() {
	int n;
	cin >> n;
	vector<ll> a(n + 1), b(n);
	rep (i, n + 1) cin >> a[i];
	rep (i, n) cin >> b[i];

	ll ans = 0;
	rep (i, n) {
		if (b[i] >= a[i]) {
			ans += a[i];
			b[i] -= a[i];
		}
		else {
			ans += b[i];
			b[i] = 0;
		}
		if (b[i] >= a[i + 1]) {
			ans += a[i + 1];
			a[i + 1] = 0;
		}
		else {
			ans += b[i];
			a[i + 1] -= b[i];
		}
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
using System;
using System.Linq;

namespace aizu
{
    class OnlineJudge
    {
        static void Main()
        {
            int[] data = Console.ReadLine().Split().Select(q => int.Parse(q)).ToArray();
            int max = 0;
            while(data[0]-- > 0){
                int ans = Console.ReadLine().Split().Count(q => q == "1");
                max = max < ans ? ans : max;
            }
            Console.WriteLine(max);
        }
    }
}

Measured memory_bytes: 20252
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	vi a(3);
	rep(i, 3) cin >> a[i];
	sort(all(a));
	int ans = a[2] - a[1];
	a[0] += ans;
	ans += ((a[2] - a[0] + 1) / 2) + ((a[0] & 1) != (a[2] & 1));
	cout << ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 256
//g++ t.cpp -o t && t < p.txt
//d>p.txt&&t<p.txt&&t2<p.txt

#include <iostream> // プログラムの耳と口
#include <vector> // 超有能配列秘書
#include <algorithm> // みんな大好きソートと二分探索
#include <queue> // きゅーちゃん、だいすき
#include <string> // to_string
#include <functional> // 関数を変数に入れる子
#include <set> // 値の取得・挿入・削除を高速に
#include <map> // setの妹 これまた優秀
#include <random> // 乱択さん
#include <ctime>

#define DB cerr<<"D"<<endl
using namespace std; using ll=long long; using ld=long double; const int INF=1e9; const ll LINF=1e18; const double dINF = 1e18; const ld ldINF = 1e18; const double EPS = 1e-6;
template<typename T, typename U, typename O> void caut(T a, U b, O c){cout<<"("<<a<<","<<b<<","<<c<<") ";} template<typename T, typename U> void caut(T a, U b){cout<<"("<<a<<","<<b<<") ";} template<typename T> void caut(T a){cout<<"("<<a<<") ";};
using P=pair<ll,ll>;
const ll M = 1e9+7;
ll mod_pow(ll x, ll a) { ll an = 1; while(a > 0) { if (a&1) an = an * x % M; x = x * x % M; a >>= 1;} return an;}
void add(ll& x, ll y) {x+=y; x%=M;}; void mul(ll& x, ll y) {x*=y; x%=M;}; template<typename T, typename U> void chmax(T& x, U y) {if (x<y) x=y;}; template<typename T, typename U> void chmin(T& x, U y) {if (x>y) x=y;}
bool vaild(int x, int y, int hh, int ww){return 0<=x&&x<hh&&0<=y&&y<ww;}
int keta(ll a) {int res=0; while(a>0) res+=a%10, a/=10; return res;}

int main() {
  ll k; cin>>k;
  ll x = 7 % k, t = 1;
  bool u[k]={}; u[x] = true;
  while(x != 0) {
    x = x * 10 + 7;
    x %= k;
    t++;
    if (u[x]) {cout<<-1<<endl;return 0;}
    u[x]=true;
  }
  cout<<t<<endl;
}
// ・配列の大きさok？　・priority_queueはgreater？　・debug消した？
// ・落ち着いて。提出まで4分待ってね……WJ……1/10……2/10……

// Thank you for making problems and running the contest


Measured memory_bytes: 4496
import java.util.Scanner;

public class Main {

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

		int A = scan.nextInt();
		int B = scan.nextInt();
		
		if(A+B >= 24){
			System.out.println(A+B-24);
		}else{
			System.out.println(A+B);
		}
		
	}

}


Measured memory_bytes: 21972
#include <iostream>
#include <algorithm>
#define int long long
using namespace std;

int n;
int x[200000];
int s[200000];
int rs[200001];	//rs[i] = s[0] + … + s[i - 1]

signed main()
{
	int i;
	
	cin >> n;
	for (i = 0; i < n; i++) cin >> x[i] >> s[i];
	for (i = 1; i <= n; i++) rs[i] = rs[i - 1] + s[i - 1];
	
	int maxR = rs[n] - x[n - 1];
	int ans = 0;
	for (int l = n - 1; l >= 0; l--) {
		int L = x[l] - rs[l];
		ans = max(ans, maxR + L);
		if (l > 0) maxR = max(maxR, rs[l] - x[l - 1]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4992
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] arg) {
		int N = sc.nextInt();
		long[] w = new long[N];
		for (int i = 0; i < N; ++i) {
			w[i] = sc.nextLong();
		}
		long[][] dp = new long[N][N];
		int[][] cut = new int[N][N];
		for (long[] a : dp) {
			Arrays.fill(a, 1L << 60);
		}
		for (int i = 0; i < N; ++i) {
			dp[i][i] = 0;
		}
		for (int i = 0; i < N - 1; ++i) {
			dp[i][i + 1] = w[i] + w[i + 1];
			cut[i][i + 1] = i;
		}
		for (int i = 2; i < N; ++i) {
			long sum = 0;
			for (int j = 0; j < i; ++j) {
				sum += w[j];
			}
			for (int j = 0; j + i < N; ++j) {
				sum += w[j + i];
				int c1 = cut[j][j + i - 1];
				int c2 = cut[j + 1][j + i];
				for (int k = c1; k <= c2; ++k) {
					if (dp[j][k] + dp[k + 1][j + i] < dp[j][j + i]) {
						dp[j][j + i] = dp[j][k] + dp[k + 1][j + i];
						cut[j][j + i] = k;
					}
				}
				dp[j][j + i] += sum;
				sum -= w[j];
			}
		}
		System.out.println(dp[0][N - 1]);
	}
}

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

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {
		solution(args);
		if(in!=null){
			in.close();
		}
	}

	public static void solution(String[] args) throws Exception{

		int N = nextInt();
		int M = nextInt();


		PriorityQueue<Long> q = new PriorityQueue<>(N,Comparator.comparing(Long::longValue,Comparator.reverseOrder()));
		for(int i=0;i<N;i++){
			q.add(nextLong());
		}

		for(int i=0;i<M;i++){
			q.add(q.poll()/2);
		}
		long sum =0;
		for(long x:q){
			sum+=x;
		}
		System.out.println(sum);



	}


	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 99596
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mod 1000000007
const int N=200005;

 
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    /*#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
    */
    string q;
    cin>>q;
    if(q=="Sunny") cout<<"Cloudy";
    else if(q=="Cloudy") cout<<"Rainy";
    else cout<<"Sunny";
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b,c,sum,max,min,t,i,x;
    scanf("%d %d %d",&a,&b,&c);
    max=a>b?a:b;
    max=max>c?max:c;
    min=a<b?a:b;
    min=min<c?min:c;
    t=(a+b+c)-max-min;
    for(i=0;;i++)
    {
        x=max+i;
        if(((x-min)-(x-t)+(x-max))%2==0)
        {
            sum=(x-t)+(x-min-(x-t)+(x-max))/2;
            printf("%d\n",sum);
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 128
using System;

namespace debug
{
    class Program
    {
        static void Main(string[] args)
        {
            ProgramB a = new ProgramB();
            a.main();

        }
    }

    //ABC077
    class ProgramA
    {
        public void main()
        {
            string s1 = Console.ReadLine();
            string s2 = Console.ReadLine();

            if (s1[0] == s2[2] && s1[1] == s2[1] && s1[2] == s2[0])
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");
        }
    }

    //ABC162
    class ProgramC
    {
        public void main()
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = new int[n];

            for (int i = 0; i < n; i++)
                a[i] = int.Parse(Console.ReadLine());

            Array.Sort(a);
            int ans = 0;
            
            for (int i = 0; i < n; i++)
            {
                //偶数の時
                if (i == n - 1)
                {
                    ans += a[i] / 2;
                }
                else
                    ans += a[i];

            }

            Console.WriteLine(ans);
        }
    }

    //ABC161_F問題
    
    class ProgramB
    {
        public void main()
        {
            long n = long.Parse(Console.ReadLine());
            for (long i = 1; i < 100000; i++)
            {
                if(i * i > n)
                {
                    Console.WriteLine((i - 1) * (i - 1));
                    return;
                }

            }
        }
    }

    class ProgramD
    {
        static long[] dp;
        static long[] p;
        public void main()
        {
            string[] s = Console.ReadLine().Split(' ');
            long n = long.Parse(s[0]);
            long x = long.Parse(s[1]);

            //あらかじめ層の数とパティの数は数えておく
            dp = new long[n + 1];
            p = new long[n + 1];
            dp[0] = 1;
            p[0] = 1;
            for (int i = 0; i < n; i++)
            {
                dp[i + 1] = 3 + 2 * dp[i];
                p[i + 1] = 1 + 2 * p[i];
            }

            Console.WriteLine(dfs(n, x));
        }

        /*再帰関数で把握（レベルnのバーガーの下からx番目までにあるパティの数)*/
        static long dfs(long n, long x)
        {
            if (n == 0)
            {
                if (x >= 1)
                    return 1;
                else
                    return 0;
            }
            else if (x <= 1 + dp[n - 1])
                return dfs(n - 1, x - 1);
            else
                return p[n - 1] + 1 + dfs(n - 1, x - 2 - dp[n - 1]);

        }
    }


}


Measured memory_bytes: 13140
N, M = map(int, input().split())
A = list(map(int, input().split()))
total = sum(A)
cnt = 0
for i in range(0, N):
    if A[i] < (total/(4*M)):
        continue
    cnt += 1
if cnt >= M:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 2940
#include <stdio.h> 

int main(void){
  int a, b, c;
  scanf ("%d %d %d", &a, &b, &c);
  int max = a;
  if (b>max && b>c) {
    max = b;
  } else if (c>max && c>=b){
    max = c;
  }  
  
  printf("%d\n", a+b+c-max);
  return 0;
}
    


Measured memory_bytes: 1708
package main

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

func main() {
	defer stdout.Flush()
	_ = readInt()
	s := readString()

	max := 0
	for i := 1; i < len(s); i++ {
		left := make(map[rune]bool)
		right := make(map[rune]bool)
		for _, r := range s[:i] {
			left[r] = true
		}
		for _, r := range s[i:] {
			right[r] = true
		}
		count := 0
		for k, _ := range left {
			if right[k] {
				count++
			}
		}
		if count > max {
			max = count
		}
	}
	println(max)
}

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	i, err := strconv.Atoi(readString())
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}


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

int main() {

	long long N, A, B;
	cin >> N >> A >> B;

	cout << (((A - B) % 2 == 0) ? (A - B > 0 ? (A - B) / 2 : (B - A) / 2) : (((min(A, B) - 1) > (N - max(A, B)) ? (2 * N - A - B) / 2 + 1 : (A + B) / 2))) << endl;

}

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


/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))


/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;


/* constant */
const int inf = pow(2, 62);
const int mod = 1e9 + 7;
int dx[8]={1,0,-1,0,-1,1,-1,1};
int dy[8]={0,1,0,-1,-1,-1,1,1};



/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
string readline(){string s;getline(cin, s);return s;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}


/* general_method */
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }




/* main */




signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);




    int a, b; cin >> a >> b;

    print( a + b/2);

    

    

    



    
    



    







    

    

    




    



    



    

 
    
    


    

    
   
    













}






    










    




    










Measured memory_bytes: 256
//BISMILLAHIR RAHMANIR RAHIM
#include <bits/stdc++.h>
#define mem(a, b) (memset(a, b, sizeof(a)))
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define INF 2147483647
#define MOD 1000000007
#define MAX 200005
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

int arr[MAX], cnt[MAX*10];

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n;

    cin>>n;

    for(int i = 0; i < n; i++) {
        cin>>arr[i];
        cnt[arr[i]]++;
    }

    int ans = 0;
    for(int i = 0; i < n; i++) {
        cnt[arr[i]]--;
        bool found = true;
        for(int j = 1; j * j <= arr[i]; j++) {
            if(arr[i] % j == 0) {
                if(cnt[j] || cnt[arr[i]/j]) {
                    found = false;
                    break;
                }
            }
        }
        cnt[arr[i]]++;
        if(found)
            ans++;
    }

    cout<<ans<<endl;

    return 0;
}



Measured memory_bytes: 8232
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            String S = sc.next();
            int N = S.length();

            int[] M = new int[N + 1];

            for (int i = 0; i < N; i++) {
                M[i] = S.charAt(N - 1 - i) - '0';
            }

            StringBuilder sb = new StringBuilder();

            long ans = 0;
            for (int i = 0; i <= N; i++) {
                if (M[i] == 10) {
                    M[i + 1]++;
                    sb.append(0);
                    continue;
                }

                if (M[i] <= 4) {
                    ans += M[i];
                    sb.append(M[i]);
                } else if (M[i] == 5) {
                    if (M[i + 1] >= 5) {
                        M[i + 1]++;
                    }
                    ans += 5;
                    sb.append(5);
                } else if (M[i] >= 6) {
                    ans += (10 - M[i]);
                    M[i + 1]++;
                    sb.append(10 - M[i]);
                }
            }

            //System.out.println(sb.reverse().toString());

            System.out.println(ans);
        }
    }

}


Measured memory_bytes: 49132
#include <iostream>
#include <cstdio>
#include <stdio.h>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <bitset>
#include <cmath>
#define ff first
#define ss second
#define MAXN 100005
#define INF 1000000001000000001LL
#define int long long

using namespace std;

const int mod = 998244353; //1000000007;
int n, m, i, j, ans, x, d[MAXN][26];
string s, t;

main(){
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base :: sync_with_stdio(false);
    cin.tie();
    cin >> s >> t;
    n = s.size();
    m = t.size();

    for(i = n - 1; i >= 0; i--){
        for(j = 0; j < 26; j++){
            if(i + 1 == n)
                d[i][j] = n;
            else
                d[i][j] = d[i + 1][j];
        }

        d[i][s[i] - 'a'] = i;
    }

    for(i = 0; i < m;){

        if(d[x][t[i] - 'a'] == n)
            break;

        while(x != n && d[x][t[i] - 'a'] != n){
            x = d[x][t[i] - 'a'] + 1;
            i++;
            if(i == m){
                cout << ans + x;
                return 0;
            }
        }

        x = 0; ans += n;

    }

    cout << -1;

    return 0;
}







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

int main (void){
  int h,w;
  string s[110];

  cin >> h >> w;
  for(int i = 0;i < h;i++){
    cin >> s[i];
  }

  for(int i = 0;i <= w+1;i++){
    cout << '#';
  }
  cout << '\n';

  for(int i = 0;i < h;i++){
    cout << '#' << s[i] << "#\n";
  }

  for(int i = 0;i <= w+1;i++){
    cout << '#';
  }
  cout << '\n';

  return 0;

  /*
  string型の配列を使って文字列を全て受け取ります。
  そして、for文を使って周りを#で埋めれば良いです。
  一行目と最終行は文字列の横幅+1の数だけ#を出力すれば良いです。
  その間のh行文は格納した文字列を#で挟めば良いです。

  cout 関数と一緒に出てくる''と""について少し説明します。
  ''は一文字,""は文字列を中に入れます。''に2文字以上は入らないので注意してください。
  また、改行を表す\nはセットで一文字という扱いです。
  */
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
const int MAX = (5e5)+1;

int n, q, d, a[MAX], curr[MAX], b[MAX];
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> d;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		int pre = (i ? curr[i-1] : d);
		curr[i] = (a[i] < pre << 1 ? abs(pre - a[i]) : pre); 
	}
	b[n-1] = 1;
	for(int i = n-2; i >= 0; i--) {
		if(a[i+1] >= b[i+1] << 1) b[i] = b[i+1];
		else b[i] = b[i+1] + a[i+1];
	}
	cin >> q;
	while(q--) {
		int i;
		cin >> i; --i;
		cout << (b[i] <= (i ? curr[i-1] : d) ? "YES\n" : "NO\n");
	}
}


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

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

  if(N <= 111)
    cout << 111 << endl;
  else if(N <= 222)
    cout << 222 << endl;
  else if(N <= 333)
    cout << 333 << endl;
  else if(N <= 444)
    cout << 444 << endl;
  else if(N <= 555)
    cout << 555 << endl;
  else if(N <= 666)
    cout << 666 << endl;
  else if(N <= 777)
    cout << 777 << endl;
  else if(N <= 888)
    cout << 888 << endl;
  else
    cout << 999 << endl;

  return 0;
}


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

int main(){
  int c[3][3];
  int y[3][2];
  int t[2][3];

  for (int i = 0; i < 3; i++){
    for (int j = 0; j < 3; j++){
      cin >> c[i][j];
    }
  }
  
  for (int i = 0; i < 3; i++){
    for (int j = 0; j < 2; j++){
      y[i][j] = c[i][j + 1] - c[i][0];
    }
  }
  
  for (int i = 0; i < 2; i++){
    for (int j = 0; j < 3; j++){
      t[i][j] = c[i + 1][j] - c[0][j];
    }
  }

  for (int j = 0; j < 2; j++){
    if(y[0][j] != y[1][j]) {
      cout << "No" << endl;
      return 0;
    }
    if(y[0][j] != y[2][j]) {
      cout << "No" << endl;
      return 0;
    }
  }

  for (int i = 0; i < 2; i++){
    if(t[i][0] != t[i][1]) {
      cout << "No" << endl;
      return 0;
    }
    if(t[i][0] != t[i][2]) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;

  return 0;
}

Measured memory_bytes: 256
// This amazing code is by Eric Sunli Chen.
#include<bits/stdc++.h>
using namespace std;
template<typename T> bool get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'&&t!=EOF; t=getchar());
	if(t=='-')neg=true,t=getchar();if(t==EOF)return false;
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;return true;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) (get1(a)&&get1(b))
#define get3(a,b,c) (get1(a)&&get2(b,c))
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
typedef vector<int> vi;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

const int mod=1e9+7;
const int maxn=55;
inline void add(int&x,int y){x+=y;if(x>=mod)x-=mod;}


int n,dp[maxn][maxn],c[maxn][maxn];
int main()
{
	for(int i=0;i<maxn;i++)
	{
		c[i][0]=1;
		for(int j=1;j<=i;j++)
		{
			c[i][j]=c[i-1][j]+c[i-1][j-1];
			if(c[i][j]>=mod)c[i][j]-=mod;
		}
	}
	scanf("%d",&n);
	dp[1][0]=n;dp[1][1]=n;
	for(int i=1;i<=n;i++)for(int j=0;j<=i+1;j++)if(dp[i][j])
	{
		for(int k1=0;k1<=n-i;k1++)for(int k2=0;k2<=n-i;k2++)if(i+k1+k2<=n&&k1+k2>=max(j,1)&&(k1+k2+j)%2==0)
			add(dp[i+k1+k2][abs(j+k1-k2)/2],(LL)dp[i][j]*c[n-i][k1+k2]%mod*c[k1+k2][k1]%mod);
	}
	printf("%d\n",dp[n][0]);
	return 0;
}

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

using int64 = long long;
constexpr int64 kInfty = 1e+17;

int main() {
  int64 n, m, l;
  cin >> n >> m >> l;
  vector<vector<int64>> dist(n, vector<int64>(n, kInfty));
  for (int64 i = 0; i < m; ++i) {
    int64 a, b, c;
    cin >> a >> b >> c;
    --a;
    --b;
    dist[a][b] = dist[b][a] = c;
  }
  for (int64 i = 0; i < n; ++i)
    dist[i][i] = 0;

  for (int64 k = 0; k < n; ++k) {
    for (int64 i = 0; i < n; ++i) {
      for (int64 j = 0; j < n; ++j) {
        int64 kk = dist[i][k] + dist[k][j];
        if (dist[i][j] < kk)
          continue;
        dist[i][j] = kk;
      }
    }
  }
  vector<vector<int64>> fuel(n, vector<int64>(n, kInfty));
  for (int64 i = 0; i < n; ++i) {
    for (int64 j = 0; j < n; ++j) {
      if (dist[i][j] <= l)
        fuel[i][j] = 1;
    }
  }
  
  for (int64 k = 0; k < n; ++k) {
    for (int64 i = 0; i < n; ++i) {
      for (int64 j = 0; j < n; ++j) {
        fuel[i][j] = min(fuel[i][j], fuel[i][k] + fuel[k][j]);
      }
    }
  }

  int64 q;
  cin >> q;
  for (int64 i = 0; i < q; ++i) {
    int64 s, t;
    cin >> s >> t;
    --s;
    --t;
    int64 ret = fuel[s][t] - 1;
    if (ret >= kInfty - 1)
      ret = -1;
    cout << ret << "\n";
  }

  return 0;
}


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

int main(){

string S;
cin >> S;
int ans = 0;
int cnt = 0;

for(int i = 0; i < (int)S.size(); i++){ 
     
    // bool flag = false;

    if(S.at(i) == 'A' || S.at(i) == 'C' || S.at(i) == 'G' || S.at(i) == 'T'){
        cnt++;
        //flag = true;
    }else{
        ans = max(ans, cnt);
        cnt = 0;
        //flag = false;
    }

}
        ans = max(ans, cnt);

cout << ans << endl;  
 }

Measured memory_bytes: 256
# @oj:atcoder
# @id: hitwanyang
# @email: 296866643@qq.com
# @date: 2020-04-20 10:31
# @url:https://atcoder.jp/contests/dp/tasks/dp_b
import sys
def input():
    return sys.stdin.readline().strip()

def main():
    nk=list(map(int,input().split()))
    h=list(map(int,input().split()))
    n=nk[0]
    k=nk[1]
    dp=[10**9]*n
    dp[0]=0
    dp[1]=abs(h[1]-h[0])
    for i in range(2,n):
        dp[i]=min(dp[j]+abs(h[i]-h[j]) for j in range(max(0,i-k),i))
        # for j in range(max(0,i-k),i):
        #     dp[i]=min(dp[j]+abs(h[i]-h[j]),dp[i])

    print (dp[-1])

if __name__ == "__main__":
    main()

Measured memory_bytes: 13980
/*
 * atcoder/abc121/d.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

ll a, b;
ll calc(ll x) {
  ll ret = 0;
  ll start = (x / 4) * 4;
  for (ll i=start; i<= x; i++) ret ^= i;
  return ret;
}
void solve() {
  cin >> a >> b;
  cout << (calc(b) ^ calc(a-1)) << endl;
}
int main() {
  // cout.precision(15); cout << fixed;

  solve();

  return 0;
}


Measured memory_bytes: 256
#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() {
  string s;
  cin >> s;
  if(s[0] == '7' || s[1] == '7' || s[2] == '7'){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
 
  return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
#include<deque>
#include<cassert>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
const int mod = 1000000007;
const int INF = 1001001001;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x;}
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
};

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  map<int, int> mp;
  Sieve s(1000000);
  rep(i, n) {
    auto v = s.factor(a[i]);
    for (auto p : v) {
      mp[p.first] = max(mp[p.first], p.second);
    }
  }
  mint l = 1;
  for(auto p : mp) {
    rep(i, p.second) l *= p.first;
  }

  mint ans = 0;
  rep(i, n) {
    mint b = l / a[i];
    ans += b;
  }
  cout << ans << endl;

}


Measured memory_bytes: 4988
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end() // 昇順ソート
#define rall(v)(v).rbegin(), (v).rend() // 降順ソート
#define INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair < ll, ll >
#define F first
#define S second
const int MOD = 1000000007;
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; }
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main() {
    int A,B;cin >> A >> B;
    int ans = 0;
    for(int i = 1;i < B;i += (A-1))ans++;


    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll n;
ll t[100005],x[100005],y[100005];
int main(void){
    cin>>n;
    t[0]=0; x[0]=0; y[0]=0;
    for(int i=1;i<=n;i++){
        cin>>t[i]>>x[i]>>y[i];
        if(t[i]-t[i-1]<(abs(x[i]-x[i-1])+abs(y[i]-y[i-1]))||(x[i]+y[i])%2!=((x[i-1]+y[i-1]+t[i]-t[i-1])%2)){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    
}


Measured memory_bytes: 5864
N = int(input())
A = [int(x) for x in input().split()]


# plusスタートにする
ans1 = 0
c = 0
plus = True
for a in A:
    c += a
    if plus:
        if c <= 0:
            ans1 += abs(c) + 1
            c = 1
        plus = False
    else:
        if c >= 0:
            ans1 += abs(c) + 1
            c = -1
        plus = True

# minusスタートにする
ans2 = 0
c = 0
plus = False
for a in A:
    c += a
    if plus:
        if c <= 0:
            ans2 += abs(c) + 1
            c = 1
        plus = False
    else:
        if c >= 0:
            ans2 += abs(c) + 1
            c = -1
        plus = True

print(min(ans1, ans2))


Measured memory_bytes: 20044
#include <string>
#include <algorithm>
#include <vector> 
#include <math.h>
#include <iostream>
using namespace std;
long long mod = 1000000000 + 7;

int main()
{
	int r,d,x;
	cin >> r >> d >> x;
	
	long long ans = x;
	for (int i = 0; i < 10; i++) {
		ans = r * ans - d;
		cout << ans << endl;

	}
	return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int a,b,c,d;
  cin >> a >> b >> c >> d;
  long long int ans;
  ans = a*c;
  ans = max(ans,a*d);
  ans = max(ans,b*c);
  ans = max(ans,b*d);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
using namespace std;
 
int main(){
  int N;
  cin >> N;
 
  int p[5000];
  for(int i=0;i<N;i++){
    cin >> p[i];
  }
 
  int min_sum=20000;
 
  for(int I=0;I<=p[0];I++){
    int q[5000];
    for(int j=0;j<N;j++){
      q[j]=p[j];
    }
 
    int sum=I;
    q[0] -= I;
 
    for(int i=0;i<=N-2;i++){
      if(q[i]<=0)
        continue;
 
      sum +=q[i]*2;
      q[i+1]-=q[i];
    }
 
    if(q[N-1]>0){
      sum += q[N-1];
    }
 
    min_sum = min(min_sum,sum);
  }
 
  cout << min_sum << endl;
 
  return 0;
}


Measured memory_bytes: 3128
n = int(input())
p = list(map(int, input().split()))

a = [n*(i+1) for i in range(n)]
b = [0 for i in range(n)]

for i in range(n):
    j = p[i]-1
    b[j]= n*(n+1)-a[j]+i

print(' '.join(map(str,a)))
print(' '.join(map(str,b)))



Measured memory_bytes: 47980
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        long a = Long.parseLong(scan.next());
        String bstr = scan.next();
        BigDecimal bde = new BigDecimal(bstr);
        scan.close();

        long b100 = bde.multiply(new BigDecimal(100)).longValue();

        long ans = a * b100 / 100;
        System.out.println(ans);
    }

}


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

using namespace std;
typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> v(n);
    for(int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    vector<ll> dp(n, (1e18L + 10));
    dp[0] = 0;
    for(int i = 0; i < n; ++i) {
        if(i + 1 < n) {
            dp[i + 1] = min(dp[i + 1], dp[i] + abs(v[i] - v[i + 1]));
        }
        if(i + 2 < n) {
            dp[i + 2] = min(dp[i + 2], dp[i] + abs(v[i] - v[i + 2]));
        }
    }
    cout << dp[n - 1] << endl;
    return 0;
}


Measured memory_bytes: 1408