akhauriyash/Code-Regression huggingface dataset:
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;// 998244353;
constexpr long long INF = numeric_limits<LL>::max() / 2;
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourd; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
struct Edge { LL to, cost; };
struct edge { LL from, to, cost; };
vector<vector<int>>g;
vector<edge>edges;
vector<LL>v;
map<LL, LL>ma;
set<Pll>st;
LL h, w, n, m, k, t, s, p, q, last, cnt, sum[210000], ans, dp[500][500], a[210000], b[210000];
string str, ss;
int di[2][4] = { {1,0,-1,0},{0,1,0,-1} };
bool f;
char c[300][300];
int main() {
	cin >> h >> w;
	rep(i, h) {
		rep(j, w) {
			cin >> c[i][j];
		}
	}
	rep(i, h)rep(j, w)dp[i][j] = INF;
	dp[0][0] = 0;
	if (c[0][0] == '#')dp[0][0] = 1;
	priority_queue<Ppll, vector<Ppll>, greater<Ppll>>pq;
	pq.push(Ppll(dp[0][0], Pll(0, 0)));
	while (!pq.empty()) {
		Ppll cur = pq.top();
		pq.pop();
		LL x = cur.second.first, y = cur.second.second, cost = cur.first;
		if (cost > dp[x][y])continue;
		rep(i, 2) {
			LL X = x + di[0][i], Y = y + di[1][i];
			if (X >= 0 && X < h&&Y >= 0 && Y < w) {
				if (c[x][y] != c[X][Y]) {
					if (dp[X][Y] > dp[x][y] + 1)dp[X][Y] = dp[x][y] + 1, pq.push(Ppll(dp[X][Y], Pll(X, Y)));
				}
				else {
					if (dp[X][Y] > dp[x][y])dp[X][Y] = dp[x][y], pq.push(Ppll(dp[X][Y], Pll(X, Y)));
				}
			}
		}
	}
	if (c[h-1][w-1] == '#')dp[h - 1][w - 1]++;
	cout << dp[h - 1][w - 1]/2 << endl;
	return 0;
}


Measured memory_bytes: 2304
// use proconio::marker::Chars;
use proconio::{fastout, input};
use std::cmp::{max, min};

#[fastout]
fn main() {
    input! {
        n: usize,
        k: usize,
        h: [u128; n]
    };

    let mut h: Vec<u128> = h;
    h.sort();

    let mut result = std::u128::MAX;
    for i in k - 1..n {
        result = min(result, h[i] - h[i + 1 - k])
    }

    println!("{}", result);
}


Measured memory_bytes: 5280
#include<iostream>
using namespace std;
int main()
{
     int n,a[200],i,s=0;
     cin>>n;
     for(i=1;i<=n;i++)
     {
         cin>>a[i];
         if(a[i]%2!=0&&i%2!=0)
         {
             s++;
         }
     }
     cout<<s<<endl;
     return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define fi first
#define se second
using namespace std;
typedef pair <int, int> ii;

const ll siz = 5e5 + 10;
const ll SIZ = 1e6 + 10;
const ll mod = 1e9 + 7;
const ll maxx = 2e9;
const ll MAXX = 1e18;

int n, q, t;
string s;
int tree[26][siz];

void updatePos(int letter, int pos, int val)
{
    for (int i = pos; i < siz; i += i & -i)
        tree[letter][i] += val;
}

int getSum(int letter, int pos)
{
    int sum = 0;
    for (int i = pos; i > 0; i -= i & -i)
        sum += tree[letter][i];
    return sum;
}

int getSumRange(int letter, int start, int finish)
{
    return getSum(letter, finish) - getSum(letter, start - 1);
}

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
//    freopen ("IN_4.INP", "r", stdin);
//    freopen ("OUT_4.OUT", "w", stdout);
    cin >> n >> s >> q;
    for (int i = 1; i <= n; i++)
        updatePos(s[i - 1] - 'a', i, 1);
    while (q--)
    {
        cin >> t;
        if (t == 1)
        {
            int p;
            char c;
            cin >> p >> c;
            updatePos(s[p - 1] - 'a', p, -1);
            s[p - 1] = c;
            updatePos(c - 'a', p, 1);
        }
        else
        {
            int l, r;
            cin >> l >> r;
            int ans = 0;
            for (int i = 0; i < 26; i++)
                ans += (getSumRange(i, l, r) > 0);
            cout << ans << "\n";
        }
    }
    return 0;
}


Measured memory_bytes: 102556
#include <iostream>
#include <cmath>
#include <cstring>
using namespace std;

int dp[100002],h[100002];
int main(){
	int n,k;
	memset(dp,0x3f3f3f3f,sizeof dp);
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		cin>>h[i];
	dp[1]=0;
	for(int i=2;i<k;i++){
		for(int j=0;j<i;j++){
			dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]));
		}
	}
	for(int i=k;i<=n;i++){
		for(int j=0;j<=k;j++){
			dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
		}
	}
	cout<<dp[n]<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n - 1); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
using namespace std;
using P = pair<int, int>;
typedef long long ll;
vector<ll> memo(45, -1);


ll fib(ll n){
  if(memo[n] != -1)return memo[n];
  return memo[n] = fib(n-1) + fib(n-2);
}


int main() {
  ll n;
  cin >> n;
  memo[0] = 1;
  memo[1] = 1;
  cout << fib(n) << endl;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	double worth = 0;
	for(int i =0;i<n;i++){
		double price;
		string type;
		cin>>price>>type;
		if(type[0]=='J')
			worth += price;
		else
			worth += 380000.0 * price;
	}
	cout<<worth<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
typedef pair<int,int> P;
int ans,used[100010];
vector<P>in[100010];
int n,m;

void check(int pos){
  if(used[pos]||!ans)return;
  used[pos]=1;
  for(int i=0;i<in[pos].size();i++){
    int nx=in[pos][i].first,idx=in[pos][i].second;
    if(used[nx])ans=0;
    in[pos].erase(in[pos].begin()+i);
    in[nx].erase(in[nx].begin()+idx);
    check(nx);
    i=-1;
  }
}

int main(){
  while(1){
    cin>>n>>m;
    if(!n&&!m)break;
    for(int i=0;i<=n;i++)in[i].clear(),used[i]=0;

    ans=1;
    for(int i=0,a,b;i<m;i++){
      cin>>a>>b;
      in[a].push_back(P(b,in[b].size()));
      in[b].push_back(P(a,in[a].size()-1));
      if(in[a].size()/3||in[b].size()/3) ans=0;
    }
    
    for(int i=1;i<=n;i++) check(i);
    cout <<(ans? "yes":"no")<<endl;
  }
  return 0;
}

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

#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << ": " << arg1 << "\t|";
    __f(comma + 1, args...);
}


#define print(x) for(auto it : x) cout<< it << " "; cout << endl;
typedef long long ll;
typedef unsigned long long ull;

const int MOD = 1e9 + 7;
ll mod(ll a) {
    return (ll) (a % MOD + MOD) % MOD;
}

ll mul(ll a, ll b) {
    return (ll) mod(mod(a) * mod(b));
}

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n, k; cin >> n >> k;
    vector<ll> pos, neg;
    for (int i = 0; i < n; i++) {
        int num; cin >> num;
        if (num >= 0) {
            pos.push_back(num);
        } else {
            neg.push_back(num);
        }
    }
    ll ans = 1;
    if (!pos.empty()) {
        if (k % 2) {
            sort(pos.begin(), pos.end());
            ans = mul(ans, pos.back());
            pos.pop_back();
            k--;
        }
        
        vector<ll> nums;
        sort(pos.begin(), pos.end(), greater<ll>());
        sort(neg.begin(), neg.end());
        for (int i = 0; i < (int) pos.size() - 1; i += 2) {
            nums.push_back((ll) pos[i] * pos[i + 1]);
        }
        for (int i = 0; i < (int) neg.size() - 1; i += 2) {
            nums.push_back((ll) neg[i] * neg[i + 1]);
        }
        if (((int)pos.size() % 2) && ((int) neg.size() % 2)) {
            nums.push_back((ll) pos.back() * neg.back());
        }
        
        sort(nums.begin(), nums.end(), greater<ll>());
        for (int i = 0; i < (k / 2); i++) {
            ans = mul(ans, nums[i]);
        }
    } else {
        sort(neg.begin(), neg.end());
        if (k % 2)
            reverse(neg.begin(), neg.end());
        for (int i = 0; i < k; i++) {
            ans = mul(ans, neg[i]);
        }
    }

    cout << fixed << setprecision(10) << ans << '\n';
    return 0;
}


Measured memory_bytes: 6568
n = int(input())
A = []
for i in range(n):
    A.append(int(input()))

cnt = 0

G = [1]

for i in range(n):
    i += 1
    val = 3 * G[i-1] + 1
    if val > n // 2:
        break
    G.append(val)

G.reverse()

def insertionSort(A, n, g):
    global cnt
    for i in range(g, n, 1):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt += 1
        A[j+g] = v

def shellSort(A, n):
    print(len(G))
    print(" ".join(list(map(str, G))))
    for i in range(len(G)):
        insertionSort(A, n, G[i])


shellSort(A, n)

print(cnt)
for v in A:
    print(v)



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

int main(){
    double a,b,x;
    cin>>a>>b>>x;
    double c=b-(x/(a*a));
    double d=2.0*c/a;
    double e=atan(d)*180.000000000/3.14159265358979;
    double f=atan(a*b*b/(2.0*x))*180.000000000/3.14159265358979;
    if(2.0*c<=b)
    printf("%.10f", e);
    
    else 
    printf("%.10f", f);
    ;
    return 0;
}  


Measured memory_bytes: 256
from math import floor, ceil, sqrt, factorial, log, gcd
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict
from heapq import heappop, heappush, heappushpop
import copy
import numpy as np
import sys
INF = float('inf')
mod = 10 ** 9 + 7
sys.setrecursionlimit(10 ** 6)


def lcm(a, b): return a * b / gcd(a, b)

# 1 2 3
# a, b, c = LI()


def LI(): return list(map(int, sys.stdin.buffer.readline().rsplit()))

# a = I()


def I(): return int(sys.stdin.buffer.readline())

# abc def
# a, b = LS()


def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()

# a = S()


def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')

# 2
# 1
# 2
# [1, 2]


def IR(n): return [I() for i in range(n)]

# 2
# 1 2 3
# 4 5 6
# [[1,2,3], [4,5,6]]


def LIR(n): return [LI() for i in range(n)]

# 2
# abc
# def
# [abc, def]


def SR(n): return [S() for i in range(n)]

# 2
# abc def
# ghi jkl
# [[abc,def], [ghi,jkl]]


def LSR(n): return [LS() for i in range(n)]

# 2
# abcd
# efgh
# [[a,b,c,d], [e,f,g,h]]


def SRL(n): return [list(S()) for i in range(n)]


n, q = LI()
point = [0]*n
graph = [[] for i in range(n)]
visited = [False]*n


def dfs(n):
    visited[n-1] = True
    for node in graph[n-1]:
        if visited[node-1]:
            continue
        point[node-1] += point[n-1]
        dfs(node)


def main():

    for i in range(n - 1):
        a, b = LI()
        graph[a - 1].append(b)
        graph[b - 1].append(a)

    for i in range(q):
        p, x = LI()
        point[p - 1] += x

    dfs(1)

    print(*point)


if __name__ == "__main__":
    main()


Measured memory_bytes: 252620
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            pass System Test!
*/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

template <typename T>
std::ostream& operator<<(std::ostream& out, const std::vector<T>& v) {
  if (!v.empty()) {
    out << '[';
    std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
    out << "\b\b]";
  }
  return out;
}

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

  int N;
  cin >> N;
  string S;
  cin >> S;
  vector<int> cnt(26, 0);
  for (int i = 0; i < S.size(); ++i) {
    if (i % 2 == 0) cnt[S[i] - 'a']++;
  }

  vector<int> ccnt(10, 0);
  for (int i = 0; i < cnt.size(); ++i) {
    ccnt[cnt[i]]++;
  }

  int ans = 0;
  for (int i = 1; i <= 9; ++i) {
    if (i == 1 && ccnt[i] > 0) {
      ans += ccnt[i] * 2;
      continue;
    }
    if (ccnt[i] == 1) {
      ans += 4;
    } else if (ccnt[i] > 1) {
      ans += (ccnt[i] * 2 + 4);
    }
  }
  ans--;
  cout << ans << endl;
}

Measured memory_bytes: 3216
#include<iostream>
#include<algorithm>
#define rep(i, n) for(int i=0; i<n; i++)
using namespace std;

int main(){
    long long N; cin >> N;
    long long sum = (N*(N+1))/2;
    long long three = N/3;
    long long five = N/5;
    long long tf = N/15;
    sum -= 3*(three*(three+1))/2 + 5*(five*(five+1))/2;
    sum += 15*(tf*(tf+1))/2;
    cout << sum << endl;
}

Measured memory_bytes: 3596
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long int ll;
int main(){
	int N;
	bool is[4];
	cin >> N;
	fill(is, is + 4, false);
	for(int i = 1; i <= N; i++){
		char ch;
		cin >> ch;
		if(ch == 'P') is[0] = true;
		if(ch == 'W') is[1] = true;
		if(ch == 'G') is[2] = true;
		if(ch == 'Y') is[3] = true;
	}
	int cnt = 0;
	for(int i = 0; i < 4; i++){
		if(is[i] == true) cnt++;
	}
	if(cnt == 3) cout << "Three" << endl;
	else if(cnt == 4) cout << "Four" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
 
int main() {
  ll n,k;
  ll res = 0;
  cin >> n >> k;
  if(k==0){
    cout << n*n << endl;
    return 0;
  }
  for(int b = k+1;b <= n;b++){
    res += (n/b) * (b-k);
    if(n%b >= k){
      res += (n%b) - k +1 ;
    }
  }
  cout << res << endl;
  return 0;
}




Measured memory_bytes: 384
import math
n=int(input())
a,b=map(int,input().split())
for _ in range(n-1):
    c,d=map(int,input().split())
    l,r,ans=1,10**18,-1
    while(l<=r):
        m=(l+r)//2
        if(m*c>=a and m*d>=b):
            ans=m
            r=m-1
        else:
            l=m+1
    a=ans*c
    b=ans*d
print(a+b)


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

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

    auto counts = map<int, int>();
    for (auto i = 0; i < N; i++)
    {
        int x; cin >> x;
        counts[x]++;
    }

    auto duplicates = 0;
    for (const auto kv : counts)
        duplicates += kv.second - 1;

    cout << counts.size() - duplicates%2 << endl;
}


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

#define rep(i,j,n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(), i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9 + 7;

typedef long long i64;
typedef pair<int, int> pi;

template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;

i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcd(i64 n, i64 m) {return (n / gcd(n, m) * m);}
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

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

  int n, k;
  cin >> n >> k;
  double ans = 0;
  rep(i, 1, n + 1) {
    int num = i;
    double res = 1 / (double)n;
    while(num < k) {
      num *= 2;
      res *= 0.5;
    }
    ans += res;
  }
  cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 256
n,k = map(int, input().split())

count = [0 for i in range(200000)]
for i in range(n):
    a,b = map(int, input().split())
    count[a-1] += b 

cnt = 0 
for i in range(100001):
    if cnt < k  and cnt + count[i] >=k :
        print(i+1)
        break
    cnt +=count[i]



Measured memory_bytes: 6692
#include <stdio.h>          // printf(), getchar(), scanf()
#include <ctype.h>          // isdigit()

#define MAX_N 100000

int
main(int argc, char** argv)
{
	int n, q;
	int a[MAX_N];
	int c;
	int i;

	scanf("%d %d", &n, &q);
	c = getchar();
	for (i = 0; i < n; ++i)
	{
		while (c == ' ' || c == '\n')
			c = getchar();

		int d = 0;
		while (isdigit(c))
		{
			d = d * 10 + c - '0';
			c = getchar();
		}

		a[i] = d;
	}

	for (i = 0; i < q; ++i)
	{
		while (c == ' ' || c == '\n')
			c = getchar();

		long x = 0;
		while (isdigit(c))
		{
			x = x * 10 + c - '0';
			c = getchar();
		}

		long count = 0;
		long sum = 0;
		int s, t;
		for (s = 0, t = 0; s < n; ++s)
		{
			sum += a[s];
			while (sum > x)
				sum -= a[t++];

			count += s - t + 1;
		}

		printf("%ld\n", count);
	}

	return 0;
}

Measured memory_bytes: 988
array = [int(input()) for i in range(4)]
R = int(input())
T = int(input())
array.sort()
count = 0
count += array[-1]
count += array[-2]
count += array[-3]
if R>T:
    count +=R
    print(count)
else:
    count +=T
    print(count)

Measured memory_bytes: 7736
//C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int maxn=100001;
int stoio(std::string str){
    int ret;
    stringstream ss;
    ss << str;
    ss >> ret;
return ret;
}
int main(){
  int n,m;
  cin>>n>>m;
  cout<<(1900*m+100*(n-m))*((int)pow(2,m))<<endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;

namespace AtCoder
{
	public class Program
	{
		static void Main()
		{
			int d = int.Parse(Console.ReadLine());
			if (d == 22) {
				Console.WriteLine("Christmas Eve Eve Eve");
			} else if (d == 23) {
				Console.WriteLine("Christmas Eve Eve");
			} else if (d == 24) {
				Console.WriteLine("Christmas Eve");
			} else {
				Console.WriteLine("Christmas");
			}
		}
	}
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vll vector <ll>
#define vii vector <int>
#define vpii vector <pii>
#define vpll vector <pll>
#define ff first
#define ss second
#define vvll vector <vll>
#define vvii vector <vii>
#define all(v) v.begin(),v.end()
#define PQ priority_queue
using namespace std;
ll mod = 1000000007;
ll pow(ll a, ll b){
	ll res = 1;
	while(b > 0){
		if(b&1) res*=a;
		b/=2;
		a*=a;
	}
	return res;
}
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
  	ll k, x;
  	cin >> k >>  x;
  	ll n = 1e6;
  	for(int i = max(x-k+1ll,-n); i <= min(n,x+k-1ll); i++) cout << i << " ";
	return 0;
}

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

using ll=int64_t;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#ifdef MAROON_LOCAL
#define cerr (cerr<<"-- line "<<__LINE__<<" -- ")
#else
class CerrDummy{}cerrDummy;
template<class T>
CerrDummy& operator<<(CerrDummy&cd,const T&){
	return cd;
}
using charTDummy=char;
using traitsDummy=char_traits<charTDummy>;
CerrDummy& operator<<(CerrDummy&cd,basic_ostream<charTDummy,traitsDummy>&(basic_ostream<charTDummy,traitsDummy>&)){
	return cd;
}
#define cerr cerrDummy
#endif
#define REACH cerr<<"reached"<<endl
#define DMP(x) cerr<<#x<<":"<<x<<endl
#define ZERO(x) memset(x,0,sizeof(x))
#define ONE(x) memset(x,-1,sizeof(x))

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"{";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

ll read(){
	ll i;
	scanf("%" SCNd64,&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(ll x,int suc=1){
	printf("%" PRId64,x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341000];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341000];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

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

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

template<class T>
T Sq(const T& t){
	return t*t;
}

#define CAPITAL
void Yes(bool ex=true){
	#ifdef CAPITAL
	cout<<"YES"<<endl;
	#else
	cout<<"Yes"<<endl;
	#endif
	if(ex)exit(0);
}
void No(bool ex=true){
	#ifdef CAPITAL
	cout<<"NO"<<endl;
	#else
	cout<<"No"<<endl;
	#endif
	if(ex)exit(0);
}

const ll infLL=LLONG_MAX/3;

#ifdef int
const int inf=infLL;
#else
const int inf=INT_MAX/2-100;
#endif

void Merge(pi&x,pi y){
	if(x.first<y.first)swap(x,y);
	chmax(x.second,y.first);
};

signed main(){
	int n=read();
	vector<pi> a(1<<n);
	REP(i,1<<n)
		a[i]=pi(read(),-1);
	REP(j,n)REP(i,1<<n)if((i&(1<<j))==0)
		Merge(a[i+(1<<j)],a[i]);
	int cur=0;
	FOR(i,1,1<<n){
		chmax(cur,a[i].first+a[i].second);
		print(cur);
	}
}


Measured memory_bytes: 7168
#include <iostream>

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

    auto f = [](int n) {
        int res = 0;
        while (n) {
            n /= 10;
            res++;
        }
        return res;
    };

    int ans = 0;
    for (int i = 0; i <= N; i++)
        if (f(i) % 2 == 1) ans++;
    std::cout << ans << "\n";
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {

	int A, a[4] = {}, b[4] = {};

	for (int t = 0; t < 50; t++) {
		int hit = 0, blow = 0;
		cin >> A;
		if (cin.eof()) {
			break;
		}
		else {
			a[0] = A;
			for (int i = 1; i < 4; i++) {
				cin >> a[i];
			}
			for (int i = 0; i < 4; i++) {
				cin >> b[i];
			}
			for (int i = 0; i < 4; i++) {
				for (int j = 0; j < 4; j++) {
					if (a[i] == b[j]) {
						if (i == j) {
							hit++;
						}
						else {
							blow++;
						}
					}
				}
			}
		}
		
		cout << hit << " " << blow << endl;
	}

	return 0;
}


Measured memory_bytes: 3096
class _Node {
  constructor(key, left = null, right = null) {
    this.key = key;
    this.left = left;
    this.right = right;
  }
}

class BinaryTree {
  constructor() {
    this.root = null;
  }

  static get Node() { return _Node; }

  insert(key) {
    this.root = new BinaryTree.Node(key, null, null);
    this.insert = (key) => {
      let x = this.root, y;
      let newNode = new BinaryTree.Node(key, null, null);
      while (x !== null) {
        y = x;
        x = x[key < x.key ? 'left' : 'right'];
      }
      y[key < y.key ? 'left' : 'right'] = newNode;
    }
  }

  printByIneorder() {
    let str = '';
    const innerFunc = (n) => {
      if (n === null) return;
      innerFunc(n.left);
      str += ` ${n.key}`;
      innerFunc(n.right);
    }
    innerFunc(this.root);
    console.log(str);
  }

  printByPreorder() {
    let str = '';
    const innerFunc = (n) => {
      if (n === null) return;
      str += ` ${n.key}`;
      innerFunc(n.left);
      innerFunc(n.right);
    }
    innerFunc(this.root);
    console.log(str);
  }

  print() {
    this.printByIneorder();
    this.printByPreorder();
  }
}

(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());

  const tree = new BinaryTree();
  lines.map((line) => line.split(' ')).forEach(function(cmd) {
    switch(cmd[0].charAt(0)) {
    case 'i': tree.insert(Number(cmd[1])); break;
    default: tree.print();
    }
  });
})();



Measured memory_bytes: 276212
#include<iostream>
#include <cmath>
#include<vector>
#define rep(i, n) for (int i=0;i<n;i++)
#include <map> 
#include<algorithm>
#include <numeric>
#include<deque>
#include<queue>
#include<string>
#include <iomanip>
using namespace std;
typedef long long ll;

 
int main(void){
    ll n;
    cin>>n;
    ll ans=0;
    for(ll i=1;i<=n;i++){
        if(i%3!=0 && i%5!=0) ans+=i;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define maxn 22
using namespace std;
int id[maxn],b[maxn],c[maxn];
int main() {
	// your code goes here
	int n; cin>>n;
	for(int i=1;i<= n; i++) cin>>id[i];
	for(int i=1;i<= n; i++) cin>>b[i];
	for(int i=1;i < n; i++) cin>>c[i];
	
	int total = 0;
	for(int i=1;i<=n;i++){
	    total+=b[id[i]];
	    //printf("%d\n",total);
	    if(i>1){
	    	if(id[i]==(id[i-1]+1)) total+=c[id[i-1]];
	    }
	   // printf("%d\n",total);
	}
	printf("%d\n",total);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main (void)
{
    int n, i, j, tmp = 0, ans = 0;

    scanf("%d", &n);

    for (i = 1; i <= n; i += 2) {
        tmp = 0;
        for (j = 1; j <= n; j++) {
            if (i % j == 0) ++tmp;
        }
        if (tmp == 8) ++ans;
    }

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

    return 0;
}


Measured memory_bytes: 128
def N(d1):
  t1=[0 for i in range(6)]
  t1[0]=d1[1]
  t1[1]=d1[5]
  t1[2]=d1[2]
  t1[3]=d1[3]
  t1[4]=d1[0]
  t1[5]=d1[4]
  return t1
def S(d1):
  t1=[0 for i in range(6)]
  t1[0]=d1[4]
  t1[1]=d1[0]
  t1[2]=d1[2]
  t1[3]=d1[3]
  t1[4]=d1[5]
  t1[5]=d1[1]
  return t1
def E(d1):
  t1=[0 for i in range(6)]
  t1[0]=d1[3]
  t1[1]=d1[1]
  t1[2]=d1[0]
  t1[3]=d1[5]
  t1[4]=d1[4]
  t1[5]=d1[2]
  return t1
def W(d1):
  t1=[0 for i in range(6)]
  t1[0]=d1[2]
  t1[1]=d1[1]
  t1[2]=d1[5]
  t1[3]=d1[0]
  t1[4]=d1[4]
  t1[5]=d1[3]
  return t1
d1=[0 for i in range(6)]
d1[:]=(int(x) for x in input().split())
q=int(input())

for i in range(q):
  t,f=(int(x) for x in input().split())
  if d1[1]==t:
    d1=N(d1)
  elif d1[2]==t:
    d1=W(d1)
  elif d1[3]==t:
    d1=E(d1)
  elif d1[4]==t:
    d1=S(d1)
  elif d1[5]==t:
    d1=N(d1)
    d1=N(d1)
  
  if d1[2]==f:
    d1=W(d1)
    d1=S(d1)
    d1=E(d1)
  elif d1[3]==f:
    d1=E(d1)
    d1=S(d1)
    d1=W(d1)
  elif d1[4]==f:
    d1=E(d1)
    d1=S(d1)
    d1=S(d1)
    d1=W(d1)
  print(d1[2])

    




Measured memory_bytes: 5620
#include <algorithm>
#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for (int i = 0; i <(int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
int main(){
    int a,b,c;cin>>a>>b>>c;
    int sum=a+b+c;
    int count=0;
    int tmp=max(a,b);
    int Max=max(tmp,c);
    while(sum%3!=0||sum/3<Max){
        sum+=2;
        count++;
    }
    cout<<count<<endl;
    

}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define PRECISION(x) cout << fixed << setprecision(x)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define ALLR(X) (X).rbegin(), (X).rend()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second

using namespace std;
 
template<class T> void max_self(T & a, const T & b) { if(a < b) a = b; }
template<class T> void min_self(T & a, const T & b) { if(a > b) a = b; }
typedef long long LL;
const int INF = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = (1e-9);



int main(){
  FAST_IO  
 
  int N, removal = 0;
  unordered_map<int, int> freq;
  cin >> N;

  for(int rep = 0; rep < N; ++rep){
    int x; cin >> x;
    freq[x]++;
  }

  for(auto ele : freq){
    int k = ele.F, v = ele.S;
    if(v < k) removal += v;
    else removal += v - k;
  }

  cout << removal << "\n";

  return 0;
}

Measured memory_bytes: 4260
import sys
input=sys.stdin.readline
n,x=map(int,input().split())
A=list(map(int,input().split()))
cnt=0

if A[0]>x:
  cnt+=A[0]-x
  A[0]-=A[0]-x

for i in range(1,n):
  total= A[i]+A[i-1]
  if total>x:
    cnt+=total-x
    A[i]-=total-x
print(cnt)


Measured memory_bytes: 14656
#include<cstdio>
//#include<cmath>
 
//#include<iostream>
using namespace std;
 
int main(){
long d, x, S;

	while( scanf("%d" , &d)!= EOF){
		for(S=0, x=0; x<600; x+=d)	S+=(x*x);
 		printf("%d\n",S*d);
	}

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const ll INF=INT64_MAX>>3;
int main(){
    ios::sync_with_stdio(false);
    int N;
    set<string> strings;
    string S;
    cin >> N;
    rep(i,N) {
        cin>> S;
        strings.insert(S);
    }
    cout << strings.size() << endl;
        
}

Measured memory_bytes: 19244
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

const ll MAX_N = 1<<17;
ll size, seg[2*MAX_N-1];

void init(int n_){
  size = 1;
  while(size<n_) size*=2;
  REP(i,2*size-1) seg[i] = ((ll)1<<31)-1;
}

void update(ll i, ll a){
  i += size-1;
  seg[i] = a;
  while(i>0){
    i = (i-1)/2;
    seg[i] = min(seg[i*2+1],seg[i*2+2]);
  }
}

ll query(ll a, ll b, ll i, ll l, ll r){
  if(r<=a||b<=l) return INF;
  if(a<=l&&r<=b) return seg[i];
  ll vl = query(a,b,2*i+1,l,(l+r)/2);
  ll vr = query(a,b,2*i+2,(l+r)/2,r);
  return min(vl,vr);
}


int main(){
  ll n,q; cin >> n >> q;
  init(n);
  REP(i,q){
    int com, x, y;
    cin >> com >> x >> y;
    if(com==0) update(x,y);
    else cout << query(x,y+1,0,0,size) << endl;
  }
  return 0;
}



Measured memory_bytes: 5144
using System;

class Project
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        int x1 = int.Parse(input[0]);
        int x2 = int.Parse(input[1]);
        int x3 = int.Parse(input[2]);
        int x4 = int.Parse(input[3]);
        int x5 = int.Parse(input[4]);

        if(x1 == 0)
        {
            Console.WriteLine(1);
        }
        else if(x2 == 0)
        {
            Console.WriteLine(2);
        }
        else if (x3 == 0)
        {
            Console.WriteLine(3);
        }
        else if (x4 == 0)
        {
            Console.WriteLine(4);
        }
        else 
        {
            Console.WriteLine(5);
        }


    }
}

Measured memory_bytes: 27540
fun main(args: Array<String>) {
    val money = readLine()!!.toInt()

    var nowMoney = money
    var uresisa = nowMoney / 500 * 1000
    nowMoney -= nowMoney / 500 * 500
    uresisa += nowMoney / 5 * 5
    println(uresisa)
}


Measured memory_bytes: 31556
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.HashSet;

public class Main
{

  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s = r.readLine();
    String[] sl = s.split(" ");
    int n = Integer.parseInt(sl[0]);
    int m = Integer.parseInt(sl[1]);
    ArrayList<ArrayList<Integer>> g = new ArrayList<>();
    ArrayList<HashSet<Integer>> ig = new ArrayList<>();
    int prof[] = new int[n + 1];
    g.add(new ArrayList<Integer>());
    ig.add(new HashSet<Integer>());
    HashSet<Integer> set = new HashSet<>();
    for(int i = 1; i <= n; i++)
    {
      g.add(new ArrayList<Integer>());
      ig.add(new HashSet<Integer>());
      set.add(i);
    }

    for(int i = 0; i < n - 1 + m; i++)
    {
      s = r.readLine();
      sl = s.split(" ");
      int a = Integer.parseInt(sl[0]);
      int b = Integer.parseInt(sl[1]);
      g.get(a).add(b);
      ig.get(b).add(a);
      set.remove(b);
    }
    Object[] rs = set.toArray();
    int root = (int)rs[0];

    //System.out.println(root);
    ArrayDeque<Integer> q = new ArrayDeque<>();
    ArrayDeque<Integer> q2 = new ArrayDeque<>();

    q.add(root);
    q2.add(0);
    while(!q.isEmpty())
    {
      int proc = q.pop();
      int proc2 = q2.pop();
      ig.get(proc).remove(proc2);
      if(ig.get(proc).isEmpty())
      {
        prof[proc] = proc2;
        for(Integer e : g.get(proc))
        {
          q.add(e);
          q2.add(proc);
        }
      }
    }

    for(int i = 1; i <= n; i++)
    {
      System.out.println(prof[i]);
    }
  }


}


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

int main()
{
	int n, k, s, res;
	while (cin >> n >> k >> s, n || k || s) {
		res = 0;
		for (int i = 0; i < (1 << n); i++) {
			int dec = 0;
			for (int j = 1; j <= i; j <<= 1) {
				if (j & i)
					dec++;
			}
			int da = 0;
			if (dec == k) {
				for (int j = 0; 1 << j <= i; j++)
					if ((1 << j) & i)
						da += j + 1;
				if (da == s)
					res++;
			}
		}
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 2980
#include <stdio.h>
#include <iostream>
#include <queue>
#include <cstdio>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string.h>
#include <limits.h>
#include <map>
#include <string>
#include <bitset>
#include <vector>
using namespace std;
int main()
{
    int n,f=1,f2=0;
    long long ans=1,t,mx=1e18;
    cin>>n;
    while(n--)
    {
        scanf("%lld",&t);
        if(t==0) f2=1;
        //cout<<t<<endl;
        //cout<<mx<<" "<<ans<<endl;
        if(f==0) continue;
        if(mx/ans<t)
        {
            f=0;
        }
        ans*=t;
    }
    if(f&&ans<=1000000000000000000) cout<<ans<<endl;
    else if(f2) cout<<0<<endl;
    else cout<<"-1"<<endl;
    return 0;
}


Measured memory_bytes: 3700
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long ll;
typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
//typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 1000000000;//10^9
ll MOD  = 1000000007;
//vector<int> dy = {0,0,1,-1};
//vector<int> dx = {1,-1,0,0};

ll dp[100010][2];

int main(void){
	string S;
	cin >> S;
	int sl = S.size();
	vector<int> L(sl);
	for(int i = 0; i < sl; i++){
		if(S[i] == '0'){
			L[i] = 0;
		}else{
			L[i] = 1;
		}
	}
	dp[0][0] = 1;
	for(int i = 1; i <= sl; i++){
		if(L[i-1] == 1){

			dp[i][1] = dp[i-1][1] * 3 + dp[i-1][0];
			dp[i][1] %= MOD;
			dp[i][0] = dp[i-1][0] * 2;
			dp[i][0] %= MOD;
		}else{
			dp[i][1] = dp[i-1][1] * 3;
			dp[i][1] %= MOD;
			dp[i][0] = dp[i-1][0];
			dp[i][0] %= MOD;
		}
	}
	cout << (dp[sl][0] + dp[sl][1]) % MOD << endl;

}


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

#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("-O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
using namespace __gnu_pbds;
using ll = long long;

#define     _test int _TC; cin >> _TC; while(_TC--)
#define     CS(x) cout << "Case " << x << ": ";
#define     precision(n) cout << fixed << setprecision(n);
#define     Clear(a, b) memset(a, b, sizeof(a))
#define     sq(x) ((x) * 1LL * (x))
#define     eb emplace_back
#define     all(_n) _n.begin(), _n.end()
#define     rall(_n) _n.rbegin(), _n.rend()
#define     endl "\n"
#define     show(x) cout << x << endl
#define     nl cout << endl
#define     sz(x) int(x.size())
#define     gcd(a, b) __gcd(a, b)
#define     lcm(a, b) (abs((a) * (b)) / gcd(a, b))
#define     parity(a, b) ((a&1) ^ (b&1))
#define     make_unique(x) sort(all((x))); (x).erase(unique(all((x))), (x).end())
#define     IN(a) for(auto &it : a) cin >> it

template <typename T> void print (T t){ for(const auto &it : t) cout << it << ' '; nl; }
template <typename T> using OS = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; // order_of_key find_by_order

const    double Pi = acos(-1.0);
const    int Mod = 1e9 + 7;
const    int Inf = 1 << 30; // INT_MAX = (1LL << 31) -1 // Inf -> 1e9
const    int Maxx = 1e6 + 10;

/************************************[Code Starts Here]************************************/


void _case()
{
    string s, l, r; cin >> s;
    int q; cin >> q;
    int t, f; char c; bool rev = 0;
     
    while (q--) {
        cin >> t;
        if (t == 1) {
            rev ^= 1;
        } else {
            if (rev) {
                cin >> f >> c;
                if (f == 1) r += c;
                else l = c + l;
            } else {
                cin >> f >> c;
                if (f == 2) r += c;
                else l = c + l;
            }
        }
    }
    s = l + s + r;
    if (rev) reverse(all(s));
    show(s);
}

int32_t main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    _case();
    return 0;
}




Measured memory_bytes: 1316
#include<iostream>
#include<cassert>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
const int INF = 1e10;
const long double PI = (acos(-1));


signed main() {
	string N;
	cin >> N;
	if (N[0] == '7' || N[1] == '7' || N[2] == '7')cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 3628
#include <iostream>
using namespace std;
const int MOD = 1e9 + 7;
int H, W;
char a[1100][1100];
int dp[1100][1100];

int add(int &x, int y) {
    x += y;
    if (x >= MOD) x -= MOD;
    return x;
}

int main() {
    cin >> H >> W;
    for (int i = 0; i < H; i++) cin >> a[i];
    
    dp[0][0] = 1;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (i + 1 < H && a[i+1][j] == '.') add(dp[i+1][j], dp[i][j]);
            if (j + 1 < W && a[i][j+1] == '.') add(dp[i][j+1], dp[i][j]); 
        }
    }
    cout << dp[H-1][W-1] << endl;
}

Measured memory_bytes: 5632
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){
    int N; cin >> N;
    int A[N]; REP(i,N) cin >> A[i];
    set<int> s;
    REP(i,N){
        if(s.find(A[i]) == s.end()) s.insert(A[i]);
        else s.erase(A[i]);
    }
    cout << s.size() << endl;
    return 0;
}

Measured memory_bytes: 5248
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000000LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
  int n;
  cin >> n;
  int mx = -1, mn = INF;
  rep(i, n){
    int a; cin >> a;
    chmax(mx, a);
    chmin(mn, a);
  }
  cout << mx - mn << ln;
}
  


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cstdlib>
#include <iomanip>
#define rep(i,x) for(ll i=0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 10010010010;
typedef pair<ll, ll> P;
using graph = vector<vector<ll>>;
const ll mod = 1000000007;
ll gcd(ll a, ll b) {//a>b
    if (a < b)swap(a, b);
    if (a % b == 0) return b;
    else return gcd(b, a % b);
}/*フィボナッチテンプレ
ll memo[50];
ll fibo(ll n) {
    if (memo[n] != 0)return memo[n];
    if (n <= 1)return memo[n] = n;
    else return memo[n] = fibo(n - 1) + fibo(n - 2);
}
*/
bool isp(ll n) {
    bool res = true;
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            res = false;
            break;
        }
    }
    return res;
}

int main() {
  ll N,A,B;
  cin >> N >> A >> B;
  ll ans = N / (A + B) * A;
  ll m = N % (A + B);
  if(m > A)cout << ans + A << endl;
  else cout << ans + m << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <typeinfo>

using namespace std;

int main(){
  string ABCD;
  cin >> ABCD;
  int A=ABCD.at(0)-'0';
  int B=ABCD.at(1)-'0';
  int C=ABCD.at(2)-'0';
  int D=ABCD.at(3)-'0';

  vector<int> op1={1,1,1,1,-1,-1,-1,-1};
  vector<int> op2={1,1,-1,-1,1,1,-1,-1};
  vector<int> op3={1,-1,1,-1,1,-1,1,-1};

  for(int i=0;i<8;i++){
    string x,y,z;
    int ans=A;
    if(op1.at(i)==1)  ans+=B,x="+";
    else  ans-=B,x="-";
    if(op2.at(i)==1)  ans+=C,y="+";
    else  ans-=C,y="-";
    if(op3.at(i)==1)  ans+=D,z="+";
    else  ans-=D,z="-";

    if(ans==7){
      cout << A << x << B << y << C << z << D << "=7" << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
scanf("%d %d",&n,&m);
string a[n],b[m];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < m; i++){
        cin >> b[i];
    }
    for(int i = 0; i < n-m+1; i++){
        for(int j = 0; j < n-m+1; j++){
            bool flg = true;
            for(int k = 0; k < m; k++){
                for(int l = 0; l < m; l++){
                    if(a[i+k][j+l] != b[k][l]) flg = false;
                }
            }
            if(flg){
                
                cout << "Yes" ;
                return 0;
            }
        }
    }
    cout << "No" ;
    return 0;
}

Measured memory_bytes: 256
fun main(args : Array<String>) {
    val n = readLine()!!.toInt()
    val aa = readLine()!!.split(" ").map { it.toLong() }

    val sumA = aa.sum()

    var ans1half = sumA/2
    for (i in 1 until n-1 step 2) {
        ans1half -= aa[i]
    }

    val ans = LongArray(n){0}
    ans[0] = ans1half

    for (i in 1 until n) {
        ans[i] = aa[i-1] - ans[i-1]
    }

    println(ans.map { it * 2 }.joinToString(separator = " "))
}

Measured memory_bytes: 59036
import java.util.Arrays
import java.util.ArrayList

const val MOD: Long = (1e9+7).toLong()
fun Double.format(digits: Int) = String.format("%.${digits}f", this)
fun <T : Comparable<T>> Iterable<T>.argmax(): Int? = withIndex().maxBy{it.value}?.index
fun <T : Comparable<T>> Iterable<T>.argmin(): Int? = withIndex().minBy{it.value}?.index

fun main(args: Array<String>) {
    val reader = System.`in`.bufferedReader()
    val (N, k) = reader.readLine()!!.split(" ").map{it.toLong()}
    val n = N.toInt()
    val c = Array(n, {
        val (a, b) = reader.readLine()!!.split(" ").map{it.toLong()}
        Pair(a, b)
    })

    c.sortBy {it.first}

    var sum = 0L
    for (i in 0..n-1) {
        sum += c[i].second
        if (sum >= k) {
            println(c[i].first)
            return
        }
    }
}


Measured memory_bytes: 87464
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
int n,m,fa[N],dis[N];
int find(int x){
	if (x==fa[x]) return x;
	int y=fa[x];
	fa[x]=find(fa[x]);
	dis[x]+=dis[y];
	return fa[x];
}
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++) fa[i]=i;
	for (int i=1;i<=m;i++){
		int l,r,d;
		scanf("%d%d%d",&l,&r,&d);
		int x=find(l),y=find(r);
		if (x==y&&dis[l]+d!=dis[r]) return puts("No"),0;
		if (x==y) continue;
		fa[x]=y;
		dis[x]=dis[r]-d-dis[l];
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 1024