akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

int main(){
	
	
	string s;
	cin >> s;
	int ans = 0;
	for(int i=0;i<s.length();i++) if(s[i] != "CODEFESTIVAL2016"[i]) ans++;
	cout << ans << endl;
	
	
	
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define amod 998244353
#define mod 1e9 + 7
#define ll long long
#define N (ll)(1000005)

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

  ll n, count = 0, a;
  cin >> n;
  vector<int> ff(N);
  map<ll, ll> mp;

  while (n--)
  {
    cin >> a;
    mp[a]++;
  }

  for (auto x : mp)
  {
    a = x.first;

    if (!ff[a])
    {
      if (x.second == 1)
        count++;

      for (ll i = a; i < N; i += a)
        ff[i] = 1;
    }
  }

  cout << count << "\n";

  return 0;
}


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


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

    vector<int> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }

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

    int cnt = 0;
    for (int i = 0; i < N; i++)
    {
        x -= A[i];
        if (x < 0)
            break;
        cnt++;
    }
    if (x > 0)
        cout << cnt-1 << endl;
    else
        cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string N;
  cin>>N;
  
  if((N.at(0)==N.at(1)&&N.at(1)==N.at(2))||(N.at(1)==N.at(2)&&N.at(2)==N.at(3))){
    cout<<"Yes"<<endl;
  }
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cstdio>

using namespace std;

double s(double n)
{
    double ans=n;
    for(int i=1;i<10;++i)
    {
        if(i&1==1) n *= 2;
        else n /= 3;
        ans += n;
    }
    return ans;
}
int main()
{
    double n;
    while(cin >> n) printf("%.8f\n",s(n));
}

Measured memory_bytes: 1236
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

nums = [a,b,c,d,e]
f = [[0 for i in range(2)] for j in range(5)]
for i in range(len(nums)):
  ichi = str(nums[i])[-1]
  atai = nums[i]
  if int(ichi) == 0:
    f[i][0] = 0
  else:
    f[i][0] = 10 - int(ichi)
  f[i][1] = atai
  #f.append(str(nums[i])[-1])
n = len(nums)
f_sorted =sorted(f)
#print(f_sorted)
ans = 0
for i in range(len(nums)):
  if i != n-1:
    if f_sorted[i][1] % 10 == 0:
      ans += f_sorted[i][1]
    else:
      ans += ((f_sorted[i][1] // 10) + 1) * 10
  else:
    ans += f_sorted[i][1]
  #print(ans)
print(ans)
  

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
	while(1){
		int n,m,f,ans;
		int s[1001];
		int d[1001];
		cin>>n>>m;
		if(n==0&&m==0)break;
		for(int i=1;i<=n;i++){
			cin>>s[i];
		}
		for(int i=0;i<m;i++){
			cin>>d[i];
		}
		int c=1;
		for(int i=0;i<m;i++){
			c+=d[i];
			//cout<<"???"<<c<<endl;
			if(c>=n){
				cout<<i+1<<endl;
				break;
			}
			c+=s[c];
			if(c>=n){
				cout<<i+1<<endl;
				break;
			}
		}
	}
}
				

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

#define MEM(a, b) memset(a, b, sizeof a);
#define REP(i, k) for(int i = (0); i < int(k); i++ )
#define FOR(i, a, b) for(int i = (a); i <= int(b); i++)
#define TRAV(a, e) for(auto x : e)

#define ALL(cont) cont.begin(), cont.end()
#define RALL(cont) cont.begin(), cont.end()
#define FOREACH(it, l) for(auto it=l.begin(); it != l.end(); it++)
#define mp make_pair
#define pb push_back
#define INF (int)INT_MAX
#define EPS (int)1e-9
#define PI acos(-1)
#define MOD 1000000007

#ifdef DEBUG
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

typedef long L;
typedef unsigned long UL;
typedef long long LL;
typedef unsigned long long ULL;

string to_string(string s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string) s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> v[20];
    for (int i = 0; i < m; i++) {
        int k;
        cin >> k;
        for (int j = 0; j < k; j++) {
            int s;
            cin >> s;
            v[i].push_back(s);
        }
    }

    vector<int> p;
    int a;
    for (int i = 0; i < m; i++) { cin >> a; p.push_back(a); }


    int ans = 0;
    for (int i = 0; i <= n; i++) {
        // switches
        vector<int> b(n, 1);
        fill(b.begin(), b.begin() + i, 0);
        do {
            vector<int> counter(m, 0);
            for (int j = 0; j < m; j++) {
                for (int k = 0; k < v[j].size(); k++) { 
                    if (b[v[j][k] - 1] ) counter[j]++;
                }
            }

            for (int j = 0; j < m; j++) {
                if (counter[j] % 2 != p[j]) goto fail;
            }
            ans++;
fail:
            continue;
        } while (next_permutation(b.begin(), b.end()));
    }

    cout << ans << endl;
}


int main() {
#ifdef FILE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin.tie(0);
    ios_base::sync_with_stdio(false);

    /*int TC;
      cin >> TC;
      REP(tc, TC) {
      solve(tc);
      }*/
    solve();
#ifdef TIME
    cout << "Execution time(second) : " << int(clock() * 1000.0 / CLOCKS_PER_SEC) << " ms" << endl;
#endif
}

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

typedef long long ll;

int main() {
    int N, K, ans = 0;
    cin >> N >> K;
    while (N > 0) {
        ans++;
        N /= K;
    }
    cout << ans << endl;
}

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

typedef long long ll;
#define ar array
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define fork(i, n) for (ll i = 0; i < (n); i++)
#define forn for (ll i = 0; i < (n); i++)
#define fori(i, k, n) for (ll i = k; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define en '\n'
#define FILL(x, v) memset(x, v, sizeof(x))
#define pb push_back
#define fast                 \
	ios::sync_with_stdio(0); \
	cin.tie(0);              \
	cout.tie(0);

template <typename A, typename B>
inline void chmin(A &a, B b)
{
	if (a > b)
		a = b;
}
template <typename A, typename B>
inline void chmax(A &a, B b)
{
	if (a < b)
		a = b;
}
template <typename T>
void print(vector<T> &a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}
template <typename T>
void print(deque<T> &a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}
template <typename T>
void print(vector<vector<T>> &a)
{
	for (int i = 0; i < a.size(); i++)
	{
		for (int j = 0; j < a[i].size(); j++)
			cout << a[i][j] << ' ';
		cout << en;
	}
}

void solve()
{
	int n, m, x;
	cin >> n >> m >> x;
	vector<vector<int>> a(n, vector<int>(m));
	vector<int> c(n);
	for (int i = 0; i < n; i++)
	{
		cin >> c[i];
		for (int j = 0; j < m; j++)
			cin >> a[i][j];
	}
	int ans = 12345678;
	int all = 1 << n; // 2^n
	for (int mask = 0; mask < all; mask++)
	{
		vi level(m);
		vi cost(all);
		for (int i = 0; i < n; i++)
		{
			if ((mask >> i) & 1)
			{
				cost[mask] += c[i];
				for (int j = 0; j < m; j++)
				{
					level[j] += a[i][j];
				}
			}
		}
		bool ok = 1;
		// check algo stats
		for (int j = 0; j < m; j++)
		{
			if (level[j] < x)
				ok = 0;
		}
		if (ok)
			ans = min(ans, cost[mask]);
	}
	if (ans == 12345678)
		cout << -1 << endl;
	else
		cout << ans << endl;
}

int main()
{
	fast;
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	solve();
	return 0;
}

Measured memory_bytes: 3660
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
#define rep(i,a,n) for (int (i)=(a);(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef long double ld;
int n, pa[100000];
struct A {
	int x, a;
};
bool operator<(A a, A b) { return a.x < b.x; }
struct B {
	int y, a;
};
bool operator<(B a, B b) { return a.y < b.y; }
struct C {
	int from, to, cost;
};
bool operator<(C a, C b) { return a.cost < b.cost; }
A a[100001];
B b[100001];
vector<C>c;
int root(int x) {
	if (pa[x] == x) return x;
	return pa[x] = root(pa[x]);
}
void unite(int x, int y) {
	x = root(x);
	y = root(y);
	pa[x] = y;
}
signed  main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		int x, y;
		cin >> x >> y;
		a[i] = { x,i };
		b[i] = { y,i };
		pa[i] = i;
	}
	sort(a, a + n);
	sort(b, b + n);
	for (int i = 0; i < n-1; i++) {
		c.push_back(C{ a[i].a,a[i + 1].a,a[i + 1].x - a[i].x });
		c.push_back(C{ b[i].a,b[i + 1].a,b[i + 1].y - b[i].y });
	}
	sort(c.begin(), c.end());
	int sum = 0;
	for (int i = 0; i < c.size(); i++) {
		if (root(c[i].from) == root(c[i].to)) continue;
		unite(c[i].from, c[i].to);
		sum += c[i].cost;
	}
	cout << sum << endl;
	getchar(); getchar();
}

Measured memory_bytes: 6900
function main(input) {
    const args = input.split('\n');
    const n = parseInt(args[0], 10);
    const x = args[1].split(' ').map(n => parseInt(n, 10));
  	
  	var ans = -1, mn = 1e9;
  	for (var i = 1; i <= 100; i++) {
      	var tmp = 0;
      	for (var j = 0; j < n; j++) tmp += Math.pow(i - x[j], 2);
      	if (tmp < mn) {
          	mn = tmp;  ans = i;
        }
    }
    console.log(mn);
}

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


Measured memory_bytes: 7372
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstring>
#include<queue>

using namespace std;

#define INF 999999999

int tim[24*60*60];

int main(){
	int i, j, k, n, ts, tg;
	int ans;
	string s, g;
	while(1){
		cin >> n;
		if(!n)break;
		for(i=0;i<24*60*60;i++) tim[i]=0;
		ans = 0;
		for(i=0;i<n;i++){
			cin >> s >> g;
			ts = ((s[0]-'0')*10+(s[1]-'0'))*60*60
			+ ((s[3]-'0')*10+(s[4]-'0'))*60
			+ (s[6]-'0')*10+(s[7]-'0');
			tg = ((g[0]-'0')*10+(g[1]-'0'))*60*60
			+ ((g[3]-'0')*10+(g[4]-'0'))*60
			+ (g[6]-'0')*10+(g[7]-'0');
			for(j=ts;j<tg;j++) tim[j]++;
		}
		for(i=0;i<24*60*60;i++)if(ans<=tim[i]) ans=tim[i];
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1540
import itertools
N, K = map(int, input().split())
maxi = ((N-1)*(N-2))//2
if maxi < K:
    print(-1)
else:
    graph = []
    for i in range(1, N):
        graph.append((i, N))
    delk = list(itertools.combinations([i for i in range(1, N)], 2))
    graph += delk[:maxi-K]
    print(len(graph))
    for i in range(len(graph)):
        print(graph[i][0], graph[i][1])


Measured memory_bytes: 4084
#include <bits/stdc++.h>
#define rep(i, l, r) for(register int i = l; i < r; i++)
#define hrp(i, l, r) for(register int i = l; i <= r; i++)
#define rev(i, r, l) for(register int i = r; i >= l; i--)
#define ms(n, t) memset(n, t, sizeof(n))
#define U 10050
#define pb push_back
#define int ll
#ifndef JOEON
#define D(...)
#define R(x, l)
#define sp
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
template<typename tn> inline tn next(void);
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v);
signed main(void)
{
	#ifdef JOEON
//		freopen("C:\\Users\\Joeon\\Desktop\\IN.txt", "r", stdin);
//		freopen("C:\\Users\\Joeon\\Desktop\\OUT.txt", "w", stdout);
	#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b, c, d, e;
	cin>>a>>b>>c>>d>>e;
	if (b == d)
	{
		if (a == c) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
		return 0;
	}
	if (0 <= 1.0*abs(a-c)/(b-d) && 1.0*abs(a-c)/(b-d) <= e) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}
template<typename tn> inline tn next(void)
{
	tn k;
	cin>>k;
	return k;
}
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v)
{
	rep(i, 0, v.size()) os<<v[i]<<' ';
	return os;
}

Measured memory_bytes: 3652
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

/* Macros reg. ends here */

const ll INF = 1LL << 55;

static const long long mod = 1000000007;

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n;
  cin >> n;

  vll as(n + 1);
  rep(i, n + 1) cin >> as[i];

  vll csum(n + 1, 0);
  rep(i, n + 1) {
    if (i == 0)
      csum[n - i] = as[n - i];
    else
      csum[n - i] = csum[n - i + 1] + as[n - i];
  }

  ll ans = 0;
  ll tmp = 1;
  rep(i, n + 1) {
    if(tmp < as[i]){
      cout << -1 << endl;
      return 0;
    }
    ans += min(tmp, csum[i]);
    tmp = (tmp - as[i]) * 2;
    chmin(tmp, INF);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4840
#include "bits/stdc++.h"
using namespace std;
typedef long long li;

int main() {
    li n, m;
    cin >> n >> m;
    string s, t;
    cin >> s >> t;

    li lcm = n * m / __gcd(n, m);

    map<li, char> constraints;

    for (li i = 0; i < n; ++i) {
        constraints[i * (lcm / n)] = s[i];
    }

    bool ok = true;
    for (li i = 0; i < m; ++i) {
        li idx = i * (lcm / m);
        if (constraints.find(idx) == constraints.end()) {
            continue;
        }
        if (constraints[idx] != t[i]) {
            ok = false;
        }
    }

    cout << (ok ? lcm : -1) << endl;
    return 0;
}

Measured memory_bytes: 6144
from collections import defaultdict

N = int(input())
S = input()
first = S[:N]
last = S[::-1][:N]

d = defaultdict(int)
ans = 0

def paint(str, ptn):
  p = ['', '']
  for i in range(N):
    p[int(2**i & ptn > 0)] += str[i]
  return tuple(p)

for i in range(2**N):
  d[paint(first, i)] += 1
  
for i in range(2**N):
  ans += d[paint(last, i)]
  
print(ans)


Measured memory_bytes: 179444
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>

//エイリアス
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    template<typename T>
    vector<T> read_vec(size_t n){
        vector<T> tmp(n);
        for(size_t i = 0; i < n; i++){
            cin >> tmp[i];
        }
        return tmp;
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};



int main(){
    Stream io;

    int N;
    io.read(N);
    auto a = io.read_vec<int>(N);

    int ans = 0;
    for(int i = 0; i < N; i++){
        if((i + 1) % 2 && a[i] % 2) ans++;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
unsigned long long res=0,n;
int main()
{
    cin>>n;
    int x=ceil(sqrt(n));
    for (int i=1;i<x;++i)
        if (n%i==0&&n/(n/i-1)==n%(n/i-1)) res=res+n/i-1;
    cout<<res;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<stack>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
typedef long long ll;
int main(){

	string x;
	cin >> x;

	stack<char> s;

	int l = x.size();
	rep(i,l){
		if (x[i]=='S') s.push('S');
		else if (s.empty()) s.push('T');
		else if (s.top()=='S') s.pop();
		else s.push('T');
	}
	cout << s.size() << endl;
	return 0;
}


Measured memory_bytes: 644
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;

class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		FastScanner sc=new FastScanner();
		PrintWriter pw=new PrintWriter(System.out);
		char[] cs=sc.next().toCharArray();
		int ans=0;
		for(char c:cs)if(c=='2')++ans;
		pw.println(ans);
		pw.close();
	}
	
	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}


class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public int nextInt() {
    	return Integer.parseInt(next());
    }
    
    public long nextLong() {
    	return Long.parseLong(next());
    }
}

Measured memory_bytes: 22356
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define inf 1e16
#define MOD 1e9+7
#define gcd __gcd //最大公約数,gcd(x,y)
int lcm(int a, int b){return a/gcd(a, b)*b;} //(int)最小公倍数,lcm(x,y)
ll llcm(ll a, ll b){return a/gcd(a, b)*b;}//(ll)最小公倍数,lcm(x,y)


int main(){
    string s;
    int n,q,l,r,i;
    cin >> n >> q >> s;
    int tmp[n] = {};
    for(i=1 ; i<n ; i++){
        tmp[i] = tmp[i-1];
        if((s[i-1]=='A')&&(s[i]=='C')){
            tmp[i]++;
        }
    }
    for(i=0 ; i<q ; i++){
        cin >> l >> r;
        cout << tmp[r-1]-tmp[l-1] << endl;
    }
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll read()
{
    char ch=getchar();
    ll x=0,f=1;
    while(ch<'0' || ch>'9')
    {
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
    {
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}


int main()
{
    string s;
    cin>>s;
    if(s[0]=='7'||s[1]=='7'||s[2]=='7')
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#define ll long long
using namespace std;
int main() {
	ll a, b;
	cin >> a >> b;
	if (a<=b) {
		cout << a << endl;
	}
	else {
		cout << a-1 << endl;
	}
	

}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <set>
#include <cmath>
using namespace std;

typedef long long ll;

int main() {
    string s;
    cin >> s;
    int n = s.size();

    for (int i = 0; i <= 7; i++) {
        string t = s.substr(0, i) + s.substr(n - 7 + i, 7 - i);
        if (t == "keyence") {
            cout << "YES" << endl;
            return 0;
        }
    }

    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
package main

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

var MIN int = 0

var sc = bufio.NewScanner(os.Stdin)

type Node struct {
	key, pri    int
	left, rigth *Node
}

func next() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i

}

func nextString() string {
	sc.Scan()
	return sc.Text()

}

func rigthRotate(t *Node) *Node {
	s := t.left
	t.left = s.rigth
	s.rigth = t
	return s
}

func leftRotate(t *Node) *Node {
	s := t.rigth
	t.rigth = s.left
	s.left = t
	return s
}

func insert(t *Node, key int, pri int) *Node {
	if t == nil {
		return &Node{key: key, pri: pri}
	}
	if key == t.key {
		return t
	}
	if key < t.key {

		t.left = insert(t.left, key, pri)
		if t.pri < t.left.pri {
			t = rigthRotate(t)
		}
	} else {
		t.rigth = insert(t.rigth, key, pri)
		if t.pri < t.rigth.pri {
			t = leftRotate(t)
		}

	}
	return t
}

func find(t *Node, key int) bool {
	if t == nil {
		return false
	}

	if t.key == key {
		return true
	}

	if t.key > key {
		return find(t.left, key)

	} else if t.key < key {
		return find(t.rigth, key)

	}
	panic("error")
}

func erase(t *Node, key int) *Node {
	if t == nil {
		return nil
	}
	if key == t.key {
		if t.left == nil && t.rigth == nil {
			return nil

		} else if t.left == nil {
			t = leftRotate(t)
		} else if t.rigth == nil {
			t = rigthRotate(t)

		} else {
			if t.left.pri > t.rigth.pri {
				t = rigthRotate(t)

			} else {

				t = leftRotate(t)

			}

		}
		return erase(t, key)

	}
	if key < t.key {
		t.left = erase(t.left, key)

	} else {
		t.rigth = erase(t.rigth, key)

	}
	return t
}

func printInOrder(t *Node) {
	if t == nil {
		return
	}

	printInOrder(t.left)
	fmt.Printf(" %d", t.key)
	printInOrder(t.rigth)

}

func printPreOrder(t *Node) {
	if t == nil {
		return
	}

	fmt.Printf(" %d", t.key)
	printPreOrder(t.left)
	printPreOrder(t.rigth)

}

func main() {
	sc.Split(bufio.ScanWords)

	var head *Node

	m := next()
	for i := 0; i < m; i++ {

		switch nextString() {

		case "insert":
			k, p := next(), next()
			head = insert(head, k, p)

		case "print":
			printInOrder(head)
			fmt.Println()
			printPreOrder(head)
			fmt.Println()
		case "find":
			k := next()
			if find(head, k) {
				fmt.Println("yes")
			} else {
				fmt.Println("no")
			}
		case "delete":
			k := next()
			head = erase(head, k)

		}

	}
}



Measured memory_bytes: 16564
N,M = map(int,input().split())

K = [0]*N

A = [[] for i in range(N)]

Dict ={}

for i in range(N):
    temp = list(map(int,input().split()))
    K[i] = temp[0]
    A[i] = temp[1:]
    
for i in range(M):
    Dict[i+1]=0
    
cnt = 0


for i in range(N):
    
    for j in A[i]:
        Dict[j]+=1
        
        
for i in Dict.keys():
  
    if Dict[i] >=N:
        cnt+=1
        
print(cnt)

Measured memory_bytes: 3064
n = int(input())

a = []

if n > 0:
    while n > 0:
        a.append(n % 2)
        n //= 2

    a.append(0)
    a.append(0)
    for i in range(len(a) - 1):
        if i % 2 == 1:
            if a[i] == 1:
                a[i + 1] += 1
            elif a[i] == 2:
                a[i + 1] += 1
                a[i] = 0
        else:
            if a[i] == 2:
                a[i + 1] += 1
                a[i] = 0

    for i in range(len(a)):
        a[i] = str(a[i])
    for i in range(len(a) - 1, -1, -1):
        if a[i] == '0':
            a[i] = ''
        else:
            break
    print(''.join(reversed(a)))
elif n == 0:
    print('0')
else:
    n = 0 - n
    while n > 0:
        a.append(n % 2)
        n //= 2

    a.append(0)
    a.append(0)
    for i in range(len(a) - 1):
        if i % 2 != 1:
            if a[i] == 1:
                a[i + 1] += 1
            elif a[i] == 2:
                a[i + 1] += 1
                a[i] = 0
        else:
            if a[i] == 2:
                a[i + 1] += 1
                a[i] = 0

    for i in range(len(a)):
        a[i] = str(a[i])
    for i in range(len(a) - 1, -1, -1):
        if a[i] == '0':
            a[i] = ''
        else:
            break
    print(''.join(reversed(a)))

Measured memory_bytes: 3188
function Main(input) {
  input = input.split("\n");
  const X = Number.parseInt(input[0].split(" ")[0]);
  const N = Number.parseInt(input[0].split(" ")[1]);
  let p = [];
  let answerD = X;
  let answerP = X;
  let answer;

  for (let i = 0; i < N; i++) {
    p[i] = Number.parseInt(input[1].split(" ")[i]);
  }

  for (let i = 0; i < 100; i++) {
    if (p.indexOf(X - i) === -1) {
      console.log(X - i);
      return;
    } else if (p.indexOf(X + i) === -1) {
      console.log(X + i);
      return;
    }
  }

}

// デバッグ用
function debug() {
  var input = document.getElementById("input").value;
  Main(input);
}

//* この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29536
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fsp(x) fixed << setprecision(x)
#define xout cerr
const ll inf = LLONG_MAX;
const long double pi = acosl(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
#define _GLIBCXX_DEBUG

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	//const ll p = 1e9 + 7;
	//const ll p = 998244353;

	string s;
	cin >> s;
	if (s == "ABC") cout << "ARC" << endl;
	else cout << "ABC" << endl;
}


Measured memory_bytes: 3588
n = gets.to_i
a = gets.split.map(&:to_i)
b = Hash.new(0)
a.each do |num|
    b[num] += 1
end
ans = 0
i = 32
b.keys.sort.reverse.each do |num|
    i -= 1 while num*2 < 2**i
    if num*2 == 2**i
        ans += b[num]/2
    else
        m = (b[num] < b[2**i-num] ? b[num] : b[2**i-num])
        ans += m
        b[2**i-num] -= m
    end
end
puts ans

Measured memory_bytes: 46572
N = int(input())
xy = [[int(_) for _ in input().split()] for i in range(N)]

xsort_n = sorted(range(N), key=lambda n:xy[n][0])
ysort_n = sorted(range(N), key=lambda n:xy[n][1])

from collections import defaultdict

neighbors = defaultdict(list)

for i in range(N - 1):
    x1 = xsort_n[i]
    x2 = xsort_n[i+1]
    y1 = ysort_n[i]
    y2 = ysort_n[i+1]
    neighbors[x1].append(x2)
    neighbors[x2].append(x1)
    neighbors[y1].append(y2)
    neighbors[y2].append(y1)

from heapq import *

isused = [0] * N

h = []

heappush(h, (0, 0))

result = 0

while h:
    d, n = heappop(h)
    if isused[n]:
        continue
    result += d
    isused[n] = 1
    for i in neighbors[n]:
        if not isused[i]:
            d1 = min(abs(xy[n][0] - xy[i][0]), abs(xy[n][1] - xy[i][1]))
            heappush(h, (d1, i))
    
print(result)


Measured memory_bytes: 125400
#include <bits/stdc++.h>
using namespace std;
 
#define int         long long
#define endl        "\n"
#define pii         pair<int, int>

const int mod = 1e9+7;
const int MAXN = 1e5+5;
const int N = 1e5+5;

int fac[N];
int spf[MAXN]; 

void pre(int p) {
    fac[0] = 1;
    for(int i=1; i<N; i++) {
        fac[i] = (fac[i-1] * i) % p;
    }
}


void sieve() 
{ 
    spf[1] = 1; 
    for (int i=2; i<MAXN; i++) spf[i] = i; 
    for (int i=4; i<MAXN; i+=2) spf[i] = 2; 
  
    for (int i=3; i*i<MAXN; i++) 
    { 
        if (spf[i] == i) 
        { 
            for (int j=i*i; j<MAXN; j+=i) if (spf[j]==j) spf[j] = i; 
        } 
    } 
} 

vector<int> getFactorization(int x) 
{ 
    vector<int> ret; 
    while (x != 1) 
    { 
        ret.push_back(spf[x]); 
        x = x / spf[x]; 
    } 
    return ret; 
} 

unsigned long long power(unsigned long long x, 
                         int y, int p) 
{ 
    unsigned long long res = 1; // Initialize result 
  
    x = x % p; // Update x if it is more than or 
    // equal to p 
  
    while (y > 0) { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res * x) % p; 
  
        // y must be even now 
        y = y >> 1; // y = y/2 
        x = (x * x) % p; 
    } 
    return res; 
} 
  
// Returns n^(-1) mod p 
unsigned long long modInverse(unsigned long long n, int p) 
{ 
    return power(n, p - 2, p); 
} 
  
// Returns nCr % p using Fermat's little 
// theorem. 
unsigned long long nCr(unsigned long long n, 
                                 int r, int p) 
{ 
    // Base case 
    if (r == 0) return 1; 
    return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p; 
}

///////////////////////////////////////////////////////////////////////////////////////////////////
 
void solve(int TC) { 
    int n; cin >> n;
    int ans = 0;
    for(int i=0; i<n; i++) {
        int l, r; cin >> l >> r;
        ans += r - l + 1;
    }
    cout << ans << endl;
}
 
signed main() {
 
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(12);
 
 
    int T = 1;
    //cin >> T;
    for(int i=1; i<=T; i++) {
        solve(i);
    }
    return 0;
 
}

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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) x.begin(), x.end()
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)

const static int MOD = 1000000000 + 7;
const static llong INF = 1LL << 60;
const static int dy[] = {0, 1, 0, -1};
const static int dx[] = {1, 0, -1, 0};

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

    llong H, W;
    cin >> H >> W;

    llong ans = INF;
    for (llong w = 1; w < W; ++w) {
        if (W == 2) {
            // 横
            if (H % 2 == 0) {
                ans = min(ans, max(w * H, (W - w) * H / 2) - min(w * H, (W - w) * H / 2));
            } else {
                ans = min(ans,  max(w * H, (W - w) * ((H / 2 + 1))) - min(w * H, (W - w) * H / 2));
            }
        } else {
            // 横
            if (H % 2 == 0) {
                ans = min(ans, max(w * H, (W - w) * (H / 2)) - min(w * H, (W - w) * (H / 2)));
            } else {
                ans = min(ans,  max(w * H, (W - w) * (H / 2 + 1)) - min(w * H, (W - w) * (H / 2)));
            }
            // 縦
            if ((W - w) % 2 == 1) {
                if ((W - w) != 1) ans = min(ans,  max(w * H, H * ((W - w) / 2 + 1)) - min(w * H, H * ((W - w) / 2)));
            } else {
                if ((W - w) != 1) ans = min(ans, max(w * H, H * ((W - w) / 2)) - min(w * H, H * (W - w) / 2));
            }
        }
            // cout << w << " " << ans << " " << "縦終わり" << endl;
    }

    for (llong h = 1; h < H; ++h) {
        if (H == 2) {
            //縦
            if (W % 2 == 0) {
                ans = min(ans, max(h * W, (H - h) * W / 2) - min(h * W, (H - h) * W / 2));
            } else {
                ans = min(ans,  max(h * W, (H - h) * (W / 2 + 1)) - min(h * W, (H - h) * W / 2));
            }
        } else {
            // 縦
            if (W % 2 == 0) {
                ans = min(ans, max(h * W, (H - h) * W / 2) - min(h * W, (H - h) * W / 2));
            } else {
                ans = min(ans,  max(h * W, (H - h) * (W / 2 + 1)) - min(h * W, (H - h) * (W / 2)));
            }

            // 横
            if ((H - h) % 2 == 1) {
                if ((H - h) != 1) ans = min(ans, max(h * W, W * (((H - h) / 2) + 1)) - min(h * W, W * ((H - h) / 2)));
            } else {
                if ((H - h) != 1) ans = min(ans, max(h * W, W * (H - h) / 2) - min(h * W, W * ((H - h) / 2)));
            }
        }
        //cout << h << " " << ans << endl;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int x = c - a;
  int y = d - b;
  cout << c - y << ' ' << d + x << ' ' << a - y << ' ' << b + x << endl;
}

Measured memory_bytes: 256
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = [int(input()) for _ in range(N)]

bingo = [[0] * 3 for _ in range(3)]

for i in range(N):
    for h in range(3):
        for w in range(3):
            if A[h][w] == B[i]:
                bingo[h][w] = 1

# H側
ans = "No"
for h in range(3):
    cnt = 0
    for w in range(3):
        if bingo[h][w]:
            cnt += 1
    if cnt == 3:
        ans = "Yes"

for w in range(3):
    cnt = 0
    for h in range(3):
        if bingo[h][w]:
            cnt += 1
    if cnt == 3:
        ans = "Yes"

cnt = 0
for a in range(3):
    if bingo[a][a]:
        cnt += 1
    if cnt == 3:
        ans = "Yes"
cnt = 0
for a, b in zip([0, 1, 2], [2, 1, 0]):
    if bingo[a][b]:
        cnt += 1
    if cnt == 3:
        ans = "Yes"
print(ans)

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
    int a,b,x;
    char op;
    cin >> a >> op >> b;
    while(op!='?'){
        if ( op == '+' ){x=a+b;}
        else if ( op == '-' ){x=a-b;} 
        else if ( op == '*' ){x=a*b;}
        else if ( op == '/' ){x=a/b;}
        cout << x << endl;
        cin >> a >> op >> b;
    }return 0;
}



Measured memory_bytes: 3052
#include <iostream>
 #include <set>                                                                                                        
  #include <vector>
  
  int main(){
     std::string s;
     int K;
      std::cin >> s >> K;
  
     int count = 0;
     for(char ch='a'; ch<='z'; ++ch){
        std::set<std::string> sets;
        for(int i=0; i<s.size(); ++i){
           if(s[i]==ch){
              std::string tmp;
              for(int j=0; j<K; ++j){
                 if(i+j>=(int)s.size()) break;
                 tmp += s[i+j];
                 sets.insert(tmp);
              }
           }
        }
        if(count+sets.size()<K){
           count += sets.size();
        }else{
           auto itr = sets.begin();
           for(int j=0; j<K-count-1; ++j) ++itr;
           std::cout << *itr << std::endl;
           return 0;
        }
  
     }
  
     return -1;
  }

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

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		int A = sc.nextInt();
		int B = sc.nextInt();
		
		if (A < 2 * B) {
			System.out.println(0);
		} else {
			System.out.println(A - 2 * B);
		}
	}

}


Measured memory_bytes: 22612
#include <stdio.h>
#define N 100
int main(){

  int i,j,num;
  int minj,count=0;
  int A[N],tmp;

  scanf("%d",&num);
  
  for(i=0;i<num;i++){
    scanf("%d",&A[i]);
  }

 
  for(i=0;i<num;i++){
    minj=i;
    for(j=i;j<num;j++){
      if(A[j]<A[minj]){
	minj=j;
      }
    }
    if(A[i]!=A[minj]){
      count++;
    }
    tmp=A[minj];
    A[minj]=A[i];
    A[i]=tmp;
     
  }


for(i=0;i<num-1;i++){
  printf("%d ",A[i]);
 }
printf("%d\n",A[num-1]);
printf("%d\n",count);



return 0;
}



Measured memory_bytes: 2144
#include <cstdio>
int main() {
	int a,b,c,d,e,f;
	while(scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)!=EOF) {
		double y=(double)(c*d-a*f)/(b*d-a*e);
		double x=(c-b*y)/a;
		printf("%.3lf %.3lf\n",x,y);
	}
}

Measured memory_bytes: 1064
N = int(input())
if N%2==1:
  print(0)
  exit()
else:
  ans = 0
  for i in range(1,19):
    ans +=N//(10**i)
    l=1
    while N>=10**i*5**l: 
      m=N//(10**i*5**l)
      if m%2==0:
        ans+=m//2
      else:
        ans+=(m+1)//2
      l+=1
print(ans)

Measured memory_bytes: 3064
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
const int maxn=2e5+10;
int a[maxn];
int dp[maxn];
int main(){
	int n,res=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
		dp[a[i]]=dp[a[i]-1]+1;
		res=max(res,dp[a[i]]);
	}
	cout<<n-res;
}

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

#define pb push_back
#define mp make_pair
#define sz(x) (int)(x).size()
#define li long long
#define ld long double
#define x first
#define y second
#define pt pair<int, int>
#define pll pair<ll, ll>
#define forn(i, t) for(int i = 0; i < (t); i++)
#define fore(i, f, t) for(int i = (f); i < (t); i++)
#define forr(i, f, t) for(int i = (f) - 1; i >= (t); i--)
#define all(x) (x).begin(), (x).end()
#define ins insert

using namespace std;


const int INF = 1e9;
const int MOD = 1e9 + 7;
const li INF64 = 1e18;
const ld EPS = 1e-7;

mt19937 myrand(time(NULL));

const int N = 100 * 1000 + 13;

int n;
li a[N], b[N];


bool read(){
	if(scanf("%d", &n) != 1)
		return 0;
	forn(i, n)
		scanf("%lld%lld", &a[i], &b[i]);
	return 1;
}


void solve(){
	li ans = 0;
	forr(i, n, 0){
		a[i] += ans;
		ans += (a[i] % b[i] == 0 ? 0 : b[i] - (a[i] % b[i]));
	}
	printf("%lld\n", ans);	
}


int main(){
	#ifdef _DEBUG
		freopen("input.txt", "r", stdin);
	#endif
	while(read())
		solve();
	return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
int main(void){
    int a,b,c,j;
    int count=0;
    scanf("%d %d %d",&a,&b,&c);
    for(j=1;j<=b;j++){
        if(c%j==0 && a<=j && j<=b){
            count++;
        }
        
    }
    printf("%d\n",count);
    return 0;
}


Measured memory_bytes: 2104
#define ll long long
#define lld long double
#define cn(n)  ll n;cin >> n;
#define tes(t) ll t;cin>>t;while(t--) 
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define al(v) v.begin(), v.end()
#define oset(X) tree<X, null_type, less<X>, rb_tree_tag, tree_order_statistics_node_update>
#define roset(X) tree<X, null_type, greater<X>, rb_tree_tag, tree_order_statistics_node_update>
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const long double PI = 3.141592653589793;
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
using namespace __gnu_pbds;
using namespace std;
ll power(ll x, ll y, ll p){ll res = 1;x %= p;while (y > 0){if (y & 1)res = (res * x) % p;y = y >> 1;x = (x * x) % p;}return res;}
ll po(ll base, ll powerRaised){if (powerRaised != 0)return (base * po(base, powerRaised - 1));else return 1;}
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
ll lcm(ll a, ll b){return (a * b) / gcd(a, b);}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
// #ifndef ONLINE_JUDGE
//   freopen("input.txt", "r", stdin);
//   freopen("output.txt", "w", stdout);
// #endif //*
  ll n;
  cin>>n;
  string s;
  cin>>s;
  int c1=0,c2=0;
  rep(i,0,n-1)
  {
    if(s[i]=='R')
    c1++;
    else c2++;
  }
  string ans="";
  while(c1>0)
  {
    ans+='R';
    c1--;
  }
  while(c2>0)
  {
    ans+='W';
    c2--;
  }
  int res=0;
  rep(i,0,n-1)
  {
    if(s[i]!=ans[i])
    res++;
  }
  // cout<<ans;
  cout<<res/2;

  
}


Measured memory_bytes: 3868
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int>A(N);
  for(int i=0;i<N;i++){
    cin>>A.at(i);
  }
  vector<int>B;
  int mark=1;
  for(int i=0;i<N;i++){
    if(A.at(i)==mark){
      B.push_back(mark);
      mark=mark+1;
    }
  }
  if(B.size()==0){
    cout<<-1<<endl;
  }
  else{
    cout<<N-B.size()<<endl;
  }
}

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

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {REP(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
// clang-format on
/* }}} */


signed main() 
{
    int x,sum=0;
    cin >> x;
    int nx=x;
    while(true)
    {
        int tmp=nx;
        sum+=tmp%10;
        if(nx/10>0) nx=nx/10;
        else break;
    }
    if(x%sum==0) cout << "Yes" << endl;
    else cout << "No" << endl; 
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(long long i=a; i<b; i+=1)
#define repr(i,a,b) for(long long i=a; i<=b; i+=1)
#define vec vector<ll>
#define map map<string,int>
#define repa(p,A) for(auto p:A)
#define pb push_back
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())

using namespace std;
int main() {
  string S;
  cin>>S;
  if(S[2]==S[3] && S[4]==S[5])
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define REP(i,n,m) for(int i = (n); i < (m); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cerr << v << " "; cerr << endl;
#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << v << " "; cerr << endl; } 
#define debugP(vec) for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } 

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

template<class T> inline bool chmax(T& a, T b) { if (a <= b) { a = b; return true; } else return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } else return false; }

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

	ll n; cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a[i];

	ll ans = INF;
	for (int i = -100; i <= 100; i++){ 
	  ll ans0 = 0;
	  rep(j,n) {
		  ans0 += (i - a[j])* (i - a[j]);
	  }
		chmin(ans, ans0);
	}

	cout << ans << endl;
}

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

using namespace std;

int main()
{
  int N, M;
  scanf("%d %d", &N, &M);
  vector< int > ss(N);
  iota(begin(ss), end(ss), 1);
  for(int i = 0; i < M; i++) {
    int E;
    scanf("%d", &E);
    ss[--E] = -i;
  }
  vector< int > idx(N);
  iota(begin(idx), end(idx), 0);
  sort(begin(idx), end(idx), [&](int a, int b)
  {
    return (ss[a] < ss[b]);
  });

  for(int i = 0; i < N; i++) {
    printf("%d\n", idx[i] + 1);
  }
}

Measured memory_bytes: 4396
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;

int main() {
	int n;
	scanf("%d", &n);
	vector<long long> ar(n);
	long long sum = 0;
	for(int i = 0;i < n;i++){
		scanf("%lld", &ar[i]);
		sum += ar[i];
	}
	int ans = 0;
	for(int i = 0;i < n - 1;i++){
		sum -= ar[i];
		ans += ((ar[i] * (sum % MOD)) % MOD);
		ans %= MOD;
	}
	printf("%d\n", ans);
	return 0;
}
//ios_base::sync_with_stdio(false);
//cin.tie(0);
//tod-ngen


Measured memory_bytes: 4852
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;
#define print(x) cout<<(x)<<endl

#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007

int main() {
	Int N, A, B; cin >> N >> A >> B;
	print(max((B - A)*(N - 2) + 1, (Int)0));



	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;
typedef tuple<string, int, int> T;

int n;
string s; int p;
T t[100];

signed main() {
	int i;
	
	cin >> n;
	rep(i, n) {
		cin >> s >> p;
		t[i] = T(s, -p, i + 1);
	}
	sort(t, t + n);
	
	rep(i, n) cout << get<2>(t[i]) << endl;
	return 0;
}

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

using namespace std;

int numOfDividableByTwo(int n) {

    bool stop = false;
    int count = 0;
    while (!stop) {

        if (n % 2 == 0) {
            n = n / 2;
            count += 1;
        } else {
            stop = true;
        }
    }

    return count;

}


int main() {


    int N;

    cin >> N;

    int currentMax = -1;
    int result = -1;
    for (int i = 1; i <= N; i++) {

        int k = numOfDividableByTwo(i);

        if (currentMax < k) {
            result = i;
            currentMax = k;
        }
    }

    cout << result << "\n";


    return 0;
}

Measured memory_bytes: 256