akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <cmath>
#include <string>
#include <iomanip>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define inf 1013161010
#define ninf -1013161010
#define mod 1000000007
#define ll long long
#define lf long double
#define in(x) scanf("%d",&x);
#define sz(x) ((int)x.size())
#define lld l64d
#define rep(i,n) for(i=0;i<n;i++)
#define rrep(i,n) for(i=n-1;i>=0;i--)
#define rep1(i,a,b) for(i=a;i<=b;i++)
#define rrep1(i,a,b) for(i=a;i>=b;i--)
#define stlfor(i,t) for(auto i =t.begin();i!=t.end();i++)
#define fr freopen("x.txt","r",stdin)
#define frc freopen("y.txt","w",stdout)
#define all(x) x.begin(),x.end()
#define set0(x) memset(x,0,sizeof(x))
#define dbg cout<<"yo "<<endl;
#define pset(n) fixed<<showpoint<<setprecision(n)

#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpii vector<pair<int,int> >
#define si set<int>
#define mii map<int,int>
#define umii unordered_map<int,int>
#define vi vector<int>
#define pb push_back
#define ff first
#define ss second
#define mp make_pair

typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> OST;

ll toint(const string &s) { stringstream ss; ss << s; ll x; ss >> x; return x; }
string tostring ( ll number ){  stringstream ss; ss<< number; return ss.str();}

const lf pi = 2*acos(0);
const int nn = 2000006;

ll gcd(ll a,ll b){return (b==0)? a:gcd(b,a%b); }
void nope(int num = 0){ if(num==0) cout<<"NO"; else cout<<"-1"; exit(0); }

vector<lf>v;
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    lf i,j,n,tt;
    tt=1;
    //cin>>tt;
    while(tt--)
    {
        lf a,b,c,d,e,f;
        cin>>a>>b>>c>>d>>e>>f;


        for(i=0;i<=3000;i++)
        {
            for(j=0;j<=3000;j++)
            {
                if(c*i+d*j<=f)
                {
                    v.pb(c*i+d*j);
                }
            }
        }

        sort(all(v));


        lf mx=0.0;
        lf wat = 0, sug = 0, lim;
        for(i=0;i<=30;i++)
        {
            for(j=0;j<=30;j++)
            {
                lim = min(e*(i*a+j*b), f-(100*i*a+100*j*b));
                if(lim>=0)
                {
                    int idx = upper_bound(all(v), lim) - v.begin();
                    idx--;

                    if(idx>=0 and (100.0*(v[idx]))/(v[idx] + 100.0*i*a+100.0*(j*b)) >= mx)
                    {
                        //cout<<i<<" "<<j<<" "<<lim<<" "<<idx<<" "<<v[idx]<<endl;
                        mx = (100.0*(v[idx]))/(v[idx] + 100.0*i*a+100.0*(j*b));
                        wat = 100*i*a+ 100*j*b;
                        sug = v[idx];
                    }
                }
            }
        }

        cout<<wat+sug<<" "<<sug<<endl;
    }
    return 0;
}



Measured memory_bytes: 6512
#include <bits/stdc++.h>
// B - Ruined Square

using namespace std;

bool ccw(int x1,int y1,int x2,int y2,int x3,int y3) {
    int dx1,dy1,dx2,dy2;

    dx1 = x2 - x1;
    dy1 = y2 - y1;
    dx2 = x3 - x2;
    dy2 = y3 - y2;

    if (dx1 * dy2 - dx2 * dy1 > 0)
        return true;
    else
        return false;
}

int main() {
    int x1,y1,x2,y2,x3,y3,x4,y4,sideLengthSquared,difX,difY;
    double slope12,slope23;

    scanf("%d%d%d%d",&x1,&y1,&x2,&y2);

    if (x1 == x2) {
        if (y1 > y2)
            printf("%d %d %d %d\n",x2 + (y1 - y2),y2,x1 + (y1 - y2),y1);
        else
            printf("%d %d %d %d\n",x2 - (y2 - y1),y2,x1 - (y2 - y1),y1);
    }
    else if (y1 == y2) {
        if (x1 > x2)
            printf("%d %d %d %d\n",x2,y2 - (x1 - x2),x1,y1 - (x1 - x2));
        else
            printf("%d %d %d %d\n",x2,y2 + (x2 - x1),x1,y1 + (x2 - x1));
    }
    else {
        slope12 = ((double) (y2 - y1)) / (x2 - x1);
        sideLengthSquared = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);

        slope23 = -1.0 / slope12;
        difX = round(sqrt(sideLengthSquared / (1 + slope23 * slope23)));
        difY = round(difX * slope23);
        x3 = x2 + difX;
        y3 = y2 + difY;

        if (!ccw(x1,y1,x2,y2,x3,y3)) {
            difX = -difX;
            difY = round(difX * slope23);
            x3 = x2 + difX;
            y3 = y2 + difY;
        }

        x4 = x1 + difX;
        y4 = y1 + difY;

        printf("%d %d %d %d\n",x3,y3,x4,y4);
    }

    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
string dp[2][3001];
int main(){
    string s,t;
    cin>>s>>t;
    rep(i,s.size())rep(j,t.size()){
        dp[(i+1)%2][j+1]=dp[(i+1)%2][j];
        if(dp[(i+1)%2][j+1].size()<dp[i%2][j+1].size()) dp[(i+1)%2][j+1]=dp[i%2][j+1];
        if(s[i]==t[j]&&dp[(i+1)%2][j+1].size()<dp[i%2][j].size()+1) dp[(i+1)%2][j+1]=dp[i%2][j]+s[i];
    }
    cout<<dp[s.size()%2][t.size()]<<"\n";
}

Measured memory_bytes: 7808
#include <iostream>   
#include <map>   
#include <sstream>   
#include <string.h>   
using namespace std;   
  
map<int, char> AlphabetTable;   
map<int, int> table;   
  
char decode(char a){   
       
    int z = a - 'a';   
       
    for(int i = 0; i < 26; i++){   
        if(table[i] == z) return AlphabetTable[i];   
    }   
}   
  
void makeTable(int a, int b){   
    for(int i = 0; i < 26; i++){   
        table[i] = (a*i+b) % 26;   
    }   
}   
  
void makeAlphabetTable(){   
  
    char c = 'a';   
  
    for(int i = 0; i < 26; i++){   
        AlphabetTable[i] = c;   
        c++;   
    }   
}   
  
int main(){   
  
    string code, tmp;   
    int n;   
       
    getline (cin, code);   
    stringstream ssn(code);   
    ssn >> n;   
    makeAlphabetTable();   
    for(int i = 0; i < n; i++){   
        getline(cin, code );   
        tmp = code;   
        for(int b = 0; b < 26; b++){   
            for(int a = 1; a < 26; a+=2){   
                if(a%13 != 0){   
                    makeTable(a, b);   
                    code = tmp;   
                    for(int j = 0; j < code.length(); j++){   
                        if('a' <= code[j] && code[j] <= 'z'){   
                            code[j] = decode(code[j]);   
                        }   
                    }   
                    if(code.find("this") != -1 || code.find("that")!= -1){   
                        cout << code << endl;   
                        break;   
                    }   
                }   
            }   
        }   
    }   
       
    return 0;   
}  

Measured memory_bytes: 0
// vim: shiftwidth=2 expandtab foldmethod=marker

// include {{{
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <utility>
#include <cstdlib>
// }}}

// misc {{{
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
// }}}

// debug(...) {{{
bool debug_enabled = false;
int debug_max_elms = 10;

void debug1(char const * x) { cout << x; }
template<class T> void debug1(const T& x) { cout << x; }
template<class T1, class T2> void debug1(const pair<T1, T2>& x) { cout << "(" << x.first << ", " << x.second << ")"; }
template<class T> void debug1(const vector<T>& x) {
  cout << "[";
  auto i = x.begin();
  while(i != x.end()) {
    debug1(*i);
	++i;
	if(i != x.end()) cout << ", ";
    if(std::distance(x.begin(), i) > debug_max_elms) {
      cout << "...";
      break;
    }
  }
  cout << "]";
}
template<class K, class V> void debug1(const map<K, V>& x) {
  cout << "{";
  auto i = x.begin();
  while(i != x.end()) {
    debug1(get<0>(*i));
    cout << ": ";
    debug1(get<1>(*i));
    ++i;
    if(i != x.end()) cout << ", ";
  }
  cout << "}";
}

void debug2() { cout << endl; }
template<class T, class... Ts> void debug2(const T& x, const Ts&... xs) {
  cout << ' ';
  debug1(x);
  debug2(xs...);
}

template<class T, class... Ts> void debug(const T& x, const Ts&... xs) {
  if(debug_enabled) {
	cout << "[D] ";
	debug1(x);
	debug2(xs...);
  }
}
// }}}

// main {{{
void solve();
int main() {
  auto v = getenv("DEBUG");
  if(v && string(v) == "1") debug_enabled = true;
  solve();
}
// }}}

void solve() {
  int N, M;
  cin >> N >> M;
  vector<vector<int>> con(N + 1);
  rep2(i,1,M+1) {
    int x, y, z;
    cin >> x >> y >> z;
    con[x].push_back(y);
    con[y].push_back(x);
  }
  debug("con:", con);

  int ans = 0;
  vector<bool> visit(N + 1);
  rep2(i, 1, N + 1) {
    if(visit[i]) continue;
    ++ans;
    stack<int> s;
    s.push(i);
    while(!s.empty()) {
      int x = s.top();
      s.pop();
      if(visit[x]) continue;
      visit[x] = true;
      for(auto v: con[x]) s.push(v);
    }
    debug("i:", i, "visit:", visit);
  }
  cout << ans;
}


Measured memory_bytes: 6520
from heapq import heapify, heappush, heappop
INF = float("inf")
def MAIN():
    n = int(input())
    G = [[i, INF] for i in range(n)]
    G[0][1] = 0
    m = {}
    for _ in range(n):
        A = list(map(int, input().split()))
        m[A[0]] = {}
        for i in range(2, len(A), 2):
            m[A[0]][A[i]] = A[i + 1]
    dp = [(0, 0)]
    while dp:
        cost, u = heappop(dp)
        for v, c in m[u].items():
            if G[v][1] > G[u][1] + c:
                G[v][1] = G[u][1] + c
                heappush(dp, (G[v][1], v))
    print("\n".join(" ".join(map(str, a)) for a in G))
MAIN()



Measured memory_bytes: 50036
def f(n,x):
    if n == 0:return 0 if x <= 0 else 1
    elif x <= 1+b[n-1]: return f(n-1, x-1)
    else:
        return 1+p[n-1]+f(n-1,x-2-b[n-1])

N,X=map(int,input().split())
b,p = [1 for _ in range(N+1)],[1 for _ in range(N+1)]

for i in range(1,N+1):
    b[i] = b[i-1]*2+3
    p[i] = p[i-1]*2+1
print(f(N,X))

Measured memory_bytes: 3064
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

using namespace std;

int main() {
    string s;
    cin >> s;
    int n = s.size();
    s[3] = '8';
    cout << s << endl;
}

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

int main() {
    ll n, k;
    cin >> n >> k;
    unordered_map<int, int> adj;
    rep(i, n) {
        int a;
        cin >> a;
        a--;
        adj[i] = a;
    }
    vector<int> proc{0};
    vector<int> time(n, -1);
    time[0] = 0;
    int cur = 0, cycle, bc;
    while (1) {
        int nxt = adj[cur];
        if (time[nxt] != -1) {
            cycle = time[cur] + 1 - time[nxt];
            bc = nxt;
            break;
        }
        time[nxt] = time[cur] + 1;
        proc.push_back(nxt);
        cur = nxt;
    }
    // for (int a : proc) {
    //     cout << a << " ";
    // }
    // cout << endl;
    for (int i = 0; i < (int)proc.size(); i++) {
        if (proc[i] == bc) {
            k %= cycle;
        }
        if (k == 0) {
            cout << proc[i]+1 << endl;
            return 0;
        }
        k--;
    }
}

Measured memory_bytes: 14044
# n, m, l = map(int, input().split())

# list_n = list(map(int, input().split()))

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]

import sys
input = sys.stdin.readline

N, K, Q = map(int, input().split())
list_P = [K-Q] * N
for i in range(Q):
    A = int(input())
    list_P[A-1] += 1

for i in range(N):
    if list_P[i] <= 0:
        print("No")
    else:
        print("Yes")


Measured memory_bytes: 11656
k = int(input())
lun = [str(e) for e in list(range(10))]
num = [str(e) for e in list(range(10))]
preindex = 1
index = 10
count = 10
while count <= 100003:
    for i in range(preindex,index):
        if int(lun[i][-1]) !=0:
            lun.append(lun[i]+num[int(lun[i][-1])-1])
            count +=1
        lun.append(lun[i] +num[int(lun[i][-1])])
        count +=1
        if int(lun[i][-1]) !=9:
            lun.append(lun[i]+num[int(lun[i][-1])+1])
            count+=1
    preindex = index
    index = count
print(lun[k])
        


Measured memory_bytes: 17304
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/




int N; ll X;
//---------------------------------------------------------------------------------------------------
ll patty[51], tot[51];
ll f(int level, ll x) {
    if (level == 0) return 1;

    if (x < 1) return 0;
    x--;

    if (x < tot[level - 1]) return f(level - 1, x);
    x -= tot[level - 1];

    if (x < 1) return patty[level - 1] + 1;
    x--;

    if (x < tot[level - 1]) return patty[level - 1] + 1 + f(level - 1, x);
    x -= tot[level - 1];

    return patty[level - 1] * 2 + 1;
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> X;
    X--;

    tot[0] = 1;
    rep(L, 1, N + 1) tot[L] = tot[L - 1] * 2 + 3;
    patty[0] = 1;
    rep(L, 1, N + 1) patty[L] = patty[L - 1] * 2 + 1;

    cout << f(N, X) << endl;
}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>

using namespace std;
long long MOD = 1000000007LL;
const double PI = 3.14159265358979323846;
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define endl "\n"

int main() {
	int N;
	cin >> N;
	string s;
	cin >> s;
	int rCount = 0;
	for (int i = 0; i < N; ++i) {
		if (s[i] == 'R')++rCount;
	}


	int count = 0;
	for (int i = 0; i < rCount; ++i) {
		if (s[i] == 'W')++count;
	}

	cout << count << endl;

	return 0;
}




Measured memory_bytes: 3756
use proconio::input;

fn main() {
    input! {
        h: usize,
        w: usize,
        s: [[String; w]; h],
    }

    for i in 0..h {
        for j in 0..w {
            if s[i][j] == "snuke" {
                println!("{}{}", (b'A' + j as u8) as char, i + 1);
                return;
            }
        }
    }
}


Measured memory_bytes: 2212
#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std;
int  a[2000500],i,n;
int main() 
{
	cin>>n;
	if(n<2)
	{
		cout<<"NO";
		return 0;
	}
	for(i=1;i<=n;i++)
	 cin>>a[i];
	sort(a+1,a+n+1);
	for(i=2;i<=n;i++)
	{
		if(a[i]==a[i-1])
		{
			cout<<"NO"<<endl;return 0;
		}
	}
	cout<<"YES"<<endl;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"import itertools as I\n"
"from collections import Counter as C\n"
"n=int(input());s=input();l=s[:n];r=s[n:][::-1];a=C();b=C()\n"
"for i in I.product([0,1],repeat=n):\n"
" t=u=v=w=''\n"
" for j in range(n):\n"
"  if i[j]:t+=l[j];u+=r[j]\n"
"  else:v+=l[j];w+=r[j]\n"
" a[t,v]+=1\n"
" b[u,w]+=1\n"
"print(sum(a[i]*b[i]for i in a.keys()))\n"
"\"";
  system(s);
  return 0;
}            

Measured memory_bytes: 126224
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define sz(a) ((int)a.size())
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll div_num(ll n){
  vl div(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      div[i]++;
    }
  }
  if(n!=1)div[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=div[i];
  }
  return num;
}
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}
long long lopow(ll a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a ;
        a = a * a ;
        n >>= 1;
    }
    return res;
}

        
//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;
ll N,ans;
vb bo={false,false,false};
vi row={3,5,7};
void dfs(ll S,vb x) {
  if (S >N){
      return;
  }
  if(x[0]==true &&x[1]==true&&x[2]==true)ans++;
  for(int i=0;i<3;i++){
    bool ok=false;
    S = 10*S+row[i];
    if(x[i]==true)ok=true;
    else x[i]=true;
    dfs(S,x);
    if(!ok)x[i]=false;
    S/=10;
  }
}
int main(){
 cin>>N;
  ans=0;
  ll s=0;
  dfs(s,bo);
  cout<<ans<<endl;
}






Measured memory_bytes: 3684
#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#undef min
#undef max
#else
#define NDEBUG
#include <bits/stdc++.h>
#endif

using namespace std;
using large = long long;

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

    auto v = vector<int>(n);
    auto c = vector<int>(n);
    for (auto& vi : v)
        cin >> vi;
    for (auto& ci : c)
        cin >> ci;

    auto sum = 0LL;
    for (auto i = 0; i < n; ++i)
        sum += max(0, v[i] - c[i]);

    cout << sum << "\n";
    return 0;
}


Measured memory_bytes: 3608
#include <stdio.h>
#include <stdlib.h>

void put_int(int n) {
    if(!n) {
        putchar_unlocked('0');
        return;
    }
    if(n < 0) n = -n, putchar_unlocked('-');
    char buf[11];
    int i = 0;
    while(n) buf[i++] = (char)(n % 10 + '0'), n /= 10;
    while(i--)putchar_unlocked(buf[i]);
}
int get_uint() {
    int n = 0;
    int c = getchar_unlocked();
    if(c < 48 || 57 < c) return c;
    while(47 < c && c < 58) n = 10 * n + (c & 0xf), c = getchar_unlocked();
    return n;
}

typedef struct QueueKey {
    int num;
} QueueKey;
typedef struct QueueDat {
    QueueKey key;
    struct QueueDat *next;
} QueueDat;
typedef struct Queue {
    size_t len;
    QueueDat *head;
    QueueDat *tail;
} Queue;
#define queue_init(q) ((q) ? ((q)->len = 0, (q)->head = (q)->tail = NULL) : 0)
#define queue_len(q) ((q) ? (q)->len : 0)
void queue_push(Queue *q, QueueKey x) {
    QueueDat *new_dat = malloc(sizeof(QueueDat));
    *new_dat = (QueueDat){x, NULL};
    if(q->len) {
        q->tail->next = new_dat;
        q->tail = new_dat;
    } else {
        q->head = q->tail = new_dat;
    }
    q->len++;
}
QueueKey queue_pop(Queue *q) {
    //assert(q->len);
    QueueDat *old_head = q->head;
    q->head = old_head->next;
    QueueKey key = old_head->key;
    free(old_head);
    q->len--;
    return key;
}
void bfs(int G[100][100], const int N, int d[100]) {
    Queue Q;
    queue_init(&Q);
    queue_push(&Q, (QueueKey){0});
    int u;
    while(queue_len(&Q)) {
        u = queue_pop(&Q).num;
        for(int i = 0; i < N; ++i) {
            if(!G[u][i] || d[i] != 1 << 28) continue;
            d[i] = d[u] + 1;
            queue_push(&Q, (QueueKey){i});
        }
    }
}
int main(int argc, char **argv) {
    int n = get_uint();
    int G[100][100] = {};
    for(int i = 0; i < n; ++i) {
        int u = get_uint() - 1;
        int k = get_uint();
        for(int j = 0; j < k; ++j) G[u][get_uint() - 1] = 1;
    }
    int d[100] = {0};
    for(int i = 1; i < 100; ++i) d[i] = 1 << 28;
    bfs(G, n, d);
    for(int i = 0; i < n; ++i) {
        put_int(i + 1);
        putchar_unlocked(' ');
        put_int(d[i] == 1 << 28 ? -1 : d[i]);
        putchar_unlocked('\n');
    }
    return 0;
}



Measured memory_bytes: 2104
package main

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

var sc *bufio.Scanner

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n := nextInt()

	adj := make([][]int, n)
	for i := 0; i < n; i++ {
		adj[i] = make([]int, n)
		for j := 0; j < n; j++ {
			adj[i][j] = nextInt()
		}
	}

	dist := make([][]int, n)
	for i := range dist {
		dist[i] = make([]int, n)
		copy(dist[i], adj[i])
	}
	for k := 0; k < n; k++ {
		for i := 0; i < n; i++ {
			if i == k {
				continue
			}
			for j := 0; j < n; j++ {
				if j == k {
					continue
				}
				if dist[i][j] > dist[i][k]+dist[k][j] {
					fmt.Println(-1)
					return
				}
				if dist[i][j] == dist[i][k]+dist[k][j] {
					adj[i][j] = 0
				}
			}
		}
	}

	ans := 0
	for _, line := range adj {
		for _, weight := range line {
			ans += weight
		}
	}
	fmt.Println(ans / 2)
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;

int main() {
    int n,d,x; cin >> n >> d >> x;

    int count = x;
    rep(i,n){
        int a;
        cin >> a;
        int num = 0;

        while (num <= d){
            if(num * a + 1 <= d){
                count++;
            }
            num++;
        }
    }
    print(count);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
typedef vector<bool> vb;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define sq(x) ((x)*(x))
#define fo(i,n) for(int i=0;i<n;i++)
#define fp(i,k,n) for(int i=k;i<n;i++)
#define Fo(i,n) for(int i=1;i<=n;i++)
#define all(x) x.begin(),x.end()
#define deb(x) cout<<#x<<"="<<x<<"\n"
#define deb2(x,y) cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<"\n"
#define fi first
#define se second
const double pi = 3.14159265358979323846;
#define uni(c) (c).resize(unique(all(c))-(c).begin())
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
//pair <int, int> w[4] = {mp(-1, 0), mp(0, -1), mp(1, 0), mp(0, 1)};   // for matrix movement:
void cp()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
}
void solve()
{
	ll n; cin >> n;
	ll a[n];
	unordered_map<ll, ll> have;
	fo(i, n) {
		cin >> a[i];
		have[a[i]]++;
	}
	sort(a, a + n);
	ll ma = a[n - 1];
	vb vis(1000016, 0);
	for (int i = 0; i < n; i++)
	{
		if (!vis[a[i]]) {
			for (int j = 2 * a[i]; j <= ma; j += a[i])
				vis[j] = 1;
		}
	}
	ll ans = 0;
	for (int i = 0; i < n; i++)
	{
		if (!vis[a[i]] and have[a[i]] == 1)
			ans++;
	}
	cout << ans;

}
int main()
{
	fast;
	//cp();
	ll t = 1;
	//cin >> t;
	while (t--)
		solve();


	return 0;
}

Measured memory_bytes: 13160
#include <bits/stdc++.h>
using namespace std;
 
void call(int n);

int main() {

  int n;
  cin>>n;
  
  call(n);
  
  return 0;
}

void call(int n){

  for(int i=3;i<=n;i++){
	if(i%3==0)
      cout<<' '<<i;
    else if(i%10==3)
      cout<<' '<<i;
    else{
      int wk=i/10;
      while(wk){
        if(wk%10==3){
          cout<<' '<<i;
          break;
        }
        wk/=10;
      }
    }
    
  }
  cout<<endl;
}




Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
const int INF_INT = 2147483647;
const long long INF_LONG = 9223372036854775807;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

     
int main() {
  int n, m;  cin >> n >> m;
  vector<int> w(n);
  vector<int> v(n);
  rep (i, n) {
    cin >> v[i] >> w[i];
  }
  vector<vector<int>> dp(n, vector<int>(m+1, 0));

  for (int i=w[0]; i<m+1; ++i) dp[0][i] = v[0];
  for (int i=0; i<n-1; ++i) rep (j, m+1) {
    dp[i+1][j] = max(dp[i][j], dp[i+1][j]);
    if (j + w[i+1] > m) continue;
    else dp[i+1][j + w[i+1]] = max(dp[i][j] + v[i+1], dp[i+1][j + w[i+1]]);
  }


  cout << *max_element(dp[n-1].begin(), dp[n-1].end()) << endl;
}


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

using namespace std;

int main()
{
    int n, l, a;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        for (int y = i+1; y < n; y++)
        {
            for (int u = 0; u < 20; u++)
            {
                l = (1 << u);
                if ((i & l) != (y & l))
                {
                    cout << u+1 << " ";
                    break;
                }
            }
        }
        cout << "\n";
    }
    return 0;
}


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

int main() {
    string s;
    cin >> s;
    char c = s[0];
    int section = 1;
    rep(i,s.size()) {
        if (c != s[i]) {
            c = s[i];
            section++;
        }
    }
    cout << section-1 << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int k, n;
    cin >> k >> n;
    int a[n];
    for(int i=0; i<n; i++)
    {
        cin >> a[i];
    }
    vector <int> segments;
    int sum = 0;
    for(int i=1; i<n; i++)
    {
        segments.push_back(abs(a[i]-a[i-1]));
    }
    segments.push_back(abs(k-a[n-1]+a[0]));
    int mx = -1;
    for(auto i:segments)
    {
        mx = max(i, mx);
        sum += i;
    }
    cout << sum - mx << endl;
    return 0;
}


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

int main(){
  int A,B,C,D;
  int x,y,z;
  int a,b;
  cin >> A >> B;
  a = A;
  int x_M = B/10000;
  int y_M = B/5000;
//  cout << x_M << endl;
//  cout << y_M << endl;
  z = 0;
  for(x=0;x<(x_M+1);x++){
    for(y=0;y<(y_M+1);y++){
      b = B;
      b = b - x*10000 - y*5000;
      if(b<0){
        continue;
      }
      z = b/1000;

//cout << x << " " << y << " " << z << endl;
//      cout << x+y+z << endl;
      if(b>=0){
      if((x+y+z) == A) break;
      }
    }
    if(b>=0){
    if((x+y+z) == A) break;
    }
  }
  if((x+y+z) == A){
cout << x << " " << y << " " << z << endl;
  }else{
  cout << "-1" << " " << "-1" << " " << "-1" << endl;
  }
//cout << x+y+z <<endl;
//cout << 10000*x + 5000*y + 1000*z << endl;
  /*
    if(b>=0){
    if((x+y+z) == A) {
      cout << b << endl;
  cout << x << " " << y << " " << z << endl;
    }else{
    cout << b << endl;
  cout << -1 << " " << -1 << " " << -1 << endl;
    }
    }
    */

}

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

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


int n, i, a, f;
string s;
char afs;
int main() {
    cin >> n;
    cout << "ABC" << n << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include<time.h>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<map>
#include<random>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
#include <queue>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;


//BDD,ZDD,kdtree, bdtree,bicalc, bolonoy, doloney, tree, chinesemod,segmenttree,daikusutora, saidairyuu, 2bugurahu, heirokenshutu, topologicalsort, kyourenketuseibun

#define REP(i,a,b) for(int i = a; i < b; ++i)
#define PRI(s) cout << s << endl
#define PRIY PRI("Yes")
#define PRIN PRI("No")


int main() {
	ll N;
	cin >> N;
	if (N % 2 == 0) {
		ll K = N / 2;
		ll sum = 0;
		while (K > 1) {
			K /= 5;
			sum += K;
		}
		PRI(sum);
	}
	else {
		PRI(0);
	}
	return 0;
}




Measured memory_bytes: 3636
#pragma warning disable

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Numerics;
using System.Collections;
using System.Timers;

static class MainClass
{
    public static void Main(string[] args)
    {
        var ab = Console.ReadLine().SplittedStringToBigInteger();
        Console.WriteLine(ab[0] % ab[1]);
    }
    #region ライブラリ
    public static long ToInt64(this string str) => long.Parse(str);
    public static int ToInt32(this string str) => int.Parse(str);
    public static BigInteger ToBigInteger(this string str) => BigInteger.Parse(str);
    public static List<string> SplittedStringToList(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
    public static List<int> SplittedStringToInt32List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();
    public static List<BigInteger> SplittedStringToBigInteger(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => BigInteger.Parse(x)).ToList();

    public const int INF = int.MaxValue / 2;
    #endregion
}



Measured memory_bytes: 18608
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

ll n;
ll minima = 1e18;

int main()
{
    cin >> n;
    for (int i = 0; i < 5; i++)
    {
        long long a;
        cin >> a;
        minima = min(minima, a);
    }
    ll ans = 4 + (n + minima - 1) / minima;
    cout << ans;
}


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

int main()
{
	vector<string> a;
	int N, L;
	cin >> N>>L;
	a.resize(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	for (int i = 0; i < N; i++) {
		cout << a[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

void err() {
	puts(-1);
	exit(0);
}

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

	int N;
	cin >> N;

	set<pair<int, int>>st;
	for (int i = 1; i <= N; i++) {
		for (int j = i + 1; j <= N; j++) {
			st.insert({ i,j });
		}
	}
	if (N % 2 == 0) {
		for (int i = 1; i <= N / 2; i++)st.erase({i,N-i+1});
	}else{
		for (int i = 1; i <= N / 2; i++)st.erase({ i,N-i});
	}
	puts(st.size());
	fore(x, st) {
		cout << x.first << " " << x.second << endl;
	}
	
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <iomanip>
#define REP(i,m,n) for(int i = (int) (m);i < (int) (n);i++)
#define rep(i,n) REP(i,0,n)
using namespace std;

int n, k, h[100500], c;


int main() {
	cin >> n >> k;
	rep(i, n) cin >> h[i];
	rep(i, n) {
		if (h[i] >= k) {
			c++;
		}
	}
	
	cout << c << endl;


	return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<vector<int>> V(10, vector<int>(10));
  for (int i = 1; i <= N; i++) {
    if (i % 10 == 0) continue;
    int x = i, y = i % 10;
    while (x > 9) x /= 10;
    V.at(x).at(y)++;
  }
  int ans = 0;
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      ans += V.at(i).at(j) * V.at(j).at(i);
    }
  }
  cout << ans << "\n";
}

Measured memory_bytes: 256
if ARGV.empty?
  K = $stdin.gets.to_i
  DEBUG = false
else
  K = ARGV[0].to_i
  DEBUG = true
end

def info(*msgs)
  $stderr.puts msgs.join if DEBUG
end

def count(sd, cols)
  if cols == 1
    return 1
  else
    return (sd >= 1 ? count(sd - 1, cols - 1) : 0) +
                      count(sd,     cols - 1)      +
           (sd <= 8 ? count(sd + 1, cols - 1) : 0)
  end
end

def find(rest, cols = 1, from = 1, to = 9)
  info "rest/cols = #{rest}/#{cols}"
  if cols == 1
    count = to - from + 1
    if rest <= count
      return [from + rest - 1]
    else
      return find(rest - (10 - from), cols + 1)
    end
  end
  from.upto(to) do |sd|
    c = count(sd, cols)
    info "[#{sd}#{'x' * (cols - 1)}] count = #{c} / rest = #{rest}"
    if c >= rest
      sd2_from = [sd - 1, 0].max
      sd2_to   = [sd + 1, 9].min
      return [sd] + find(rest, cols - 1, sd2_from, sd2_to)
    end
    rest -= c
  end
  return find(rest, cols + 1)
end

result = find(K)
puts result.join


Measured memory_bytes: 1916
N = int(input())
X_Y = [list(map(int, input().split())) for _ in range(N)]
root_Num = 0
total_root_Num = 1
for i in range(1,N):
    root_Num += i
for i in range(1,N+1):
    total_root_Num *= i
total_root_Num *= N-1
No = total_root_Num // root_Num 
dis = [0] * root_Num
total_dis = 0
for i in range(N):
    for j in range(i+1,N):
        total_dis += ((X_Y[i][0]-X_Y[j][0])**2 + (X_Y[i][1]-X_Y[j][1])**2)**(0.5)       
total_dis *= No
ans = total_dis/(total_root_Num /( N-1))
print(ans)

Measured memory_bytes: 3316
# ABC110C - String Transformation
def main():
    s, t = [input().rstrip() for _ in range(2)]
    d = {}
    for i, j in zip(s, t):
        if i not in d:
            d[i] = j
        else:
            if d[i] != j:
                print("No")
                break
    else:
        print("Yes" if len(set(s)) == len(set(t)) else "No")


if __name__ == "__main__":
    main()

Measured memory_bytes: 3632
#include <bits/stdc++.h>    
#include <unordered_map>
using namespace std;
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cerr<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define endl "\n"
#define fo(i,n) for(int i=0;i<n;i++)
#define foo(i,x,n) for(int i=x;i<n;i++)
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define w(x) int x;cin>>x;while(x--)
#define display(a,n) {fo(i,n) {cout<<a[i]<<" ";}cout<<endl;}
#define fil(a,n,val) {fo(i,n) a[i]=val; }
#define sp(x,y) cout<<fixed<<setprecision(y)<<x<<endl;
const ll MOD   = 1000*1000*1000+7;
const ll MOD2  = 998244353;
const ll N = 1000*1000+5;
const double PI  = 3.14159265;
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
ll search(vl arr, ll l, ll r, ll x){if (r >= l) {ll mid = l + (r - l) / 2;if (arr[mid] == x)return mid;if (arr[mid] > x)return search(arr, l, mid - 1, x);return search(arr, mid + 1, r, x);} return -1;}
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll lcm(ll a , ll b){return (a*b)/ gcd(a,b);}
ll power(ll x, ll y, ll p){ll res = 1;x = x % p;while (y > 0){ if (y & 1) res = (res*x) % p; y = y>>1;x = (x*x) % p; } return res; }
ll modInverse(ll n, ll p){return power(n, p-2, p);}
const int maxn=3e5+5;

double dp[301][301][301];
int n;
int x=0,y=0,z=0;

double solve(int x, int y, int z){
	if(x<0||y<0||z<0)
		return 0;
	if(x==0 and y==0 and z==0)
		return 0;
	if(dp[x][y][z]>-0.9)
		return dp[x][y][z];
	double ex=n+x*solve(x-1,y,z)+y*solve(x+1,y-1,z)+z*solve(x,y+1,z-1);
	return dp[x][y][z]=ex/(x+y+z);
}


int main(){
	fastio();
	fill(dp,-1);
	cin>>n;
	int w;
	fo(i,n){
		cin>>w;
		if(w==1)
			x++;
		else if(w==2)
			y++;
		else
			z++;
	}
	sp(solve(x,y,z),10);
}


Measured memory_bytes: 216852
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//cout << fixed << setprecision(17) << res << endl;
 
int main() {
    string s;
    string t;
    cin >> s >> t;
    s = s + s;
    if (s.find(t) != string::npos) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main() {
	ios;
	int x,y,a,b,c,i;
	cin>>x>>y>>a>>b>>c;
	vector<ll> p(a),q(b),r(c);
	for(i=0;i<a;i++) cin>>p[i];
	for(i=0;i<b;i++) cin>>q[i];
	for(i=0;i<c;i++) cin>>r[i];	
	ll ans=0;
	sort(p.begin(),p.end(),greater<int>());
	sort(q.begin(),q.end(),greater<int>());
	sort(r.begin(),r.end(),greater<int>());	
	vector<ll> vec;
	for(i=0;i<x;i++) vec.push_back(p[i]);
	for(i=0;i<y;i++) vec.push_back(q[i]);
	for(i=0;i<x+y && i<c;i++) vec.push_back(r[i]);
	sort(vec.begin(),vec.end(),greater<int>());
	for(i=0;i<x+y;i++)
		ans+=vec[i];
	cout<<ans<<" \n";
	return 0;
}


Measured memory_bytes: 8944
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    int m,f,r;
    while(cin >> m >> f >> r && (m != -1 || f != -1 || r != -1))
    {
        if(m == -1 || f == -1 || m + f < 30)
        {
            cout << "F\n";
        }
        else if(m + f >= 80)
        {
            cout << "A\n";
        }
        else if(m + f >= 65)
        {
            cout << "B\n";
        }
        else if(m + f >= 50 || r >= 50)
        {
            cout << "C\n";
        }
        else if(m + f >= 30)
        {
            cout << "D\n";
        }
        else
        {
            cout << "F\n";
        }
    }

    return 0;
}


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

int x;
int main(void)
{
	cin>>x;
	int i=0;
	while(1){
		x-=(1+i);
		i++;
		if(x<=0)break;
	}
	cout<<i<<endl;
	return 0;
}


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

ave1 = sum(a) // len(a)
ave2 = ave1 + 1

cost1 = 0
for i in range(n):
    cost1 += (a[i] - ave1)**2

cost2 = 0
for i in range(n):
    cost2 += (a[i] - ave2)**2

print(min(cost1,cost2))



Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
int main()
{
    long long int x,y,i,j,k,c=0,n,z;
    vector<long long int>v,u,w;
    //string s;
    map<long long int ,long long int>m;
    cin>>x>>y>>k;
    for(i=x;i<x+k;i++)
    {
        m[i]++;
    }
    for(i=y;i>=y-k+1;i--)
    {
        m[i]++;
    }
    for(auto p:m)
    {
        if(p.second>=1&&p.first>=x&&p.first<=y)
        {
            v.push_back(p.first);
        }
    }
    sort(v.begin(),v.end());
    for(i=0;i<v.size();i++)
    {
        cout<<v[i]<<endl;
    }


    return 0;

}


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

using namespace std;

typedef long long ll;
typedef long double ld;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin>>n;
    n=25-n;
    cout<<"Christmas ";
    for(int i=1;i<=n;i++)
    {
        cout<<"Eve ";
    }
    cout<<"\n";
    return 0;
}


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

using namespace std;

using ll = long long;

bool Solve() {
    int n, a;
    cin >> n;

    array<int, 3> cnt = {0, 0, 0};
    for (int i = 0; i < n; ++i) {
        cin >> a;
        int p = 0;
        while (a % 2 == 0) {
            ++p;
            a /= 2;
        }
        if (p == 0) ++cnt[0];
        else if (p == 1) ++cnt[1];
        else ++cnt[2];
    }

    bool res = false;
    if (cnt[0] <= cnt[2] || (n / 2 <= cnt[2])) res = true;

    return res;
}

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

    if (Solve()) cout << "Yes\n";
    else cout << "No\n";

    return 0;
}


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

struct unionfind{
  
  vector<int> parent;
  vector<int> size;
  
  void init(int n){
    size.clear();
    parent.clear();
    size.resize(n);
    parent.resize(n);
    
    for(int i=0;i<n;i++){
      parent[i]=i;
      size[i]=1;
    }
  }
  int find(int x){
    if(parent[x]==x)return x;
    else return parent[x]=find(parent[x]);
  }
  bool same(int x,int y){
    return (find(x)==find(y));
  }
  int getSize(int x){
    return size[ find(x) ];
  }
  void unite(int x,int y){
    x=find(x);
    y=find(y);
    if(x==y)return;
    parent[x]=y;
    size[y]+=size[x];
  }
};
  
struct edge{
  int from,to,cost;
  bool operator < (const edge &e) const {
    return cost < e.cost;
  }
};

int n,t,k;
unionfind uf;

int main(){

  
  for(int tc=1;;tc++){
    cin>>n>>t>>k;
    if(n==0&&t==0&&k==0)break;
    vector<edge> E;

    uf.init(n);
    
    for(int i=0;i<n-1;i++){
      int a,b,c;
      cin>>a>>b>>c;
      a--,b--;
      E.push_back( (edge){a,b,-c} );
      uf.unite(a,b);
    }
    assert( uf.getSize(0) == n );
    
    for(int i=0;i<t;i++){
      int a;
      cin>>a;
      a--;
      E.push_back( (edge){a,n,-20000} );
    }
    sort(E.begin(),E.end());
    
    uf.init(n+1);

    vector<edge> tmp;
    
    for(int i=0;i<(int)E.size();i++){
      edge e=E[i];
      if( uf.same(e.from,e.to) ){
        tmp.push_back(e);
      }else{
        uf.unite(e.from,e.to);
      }
    }

    reverse(tmp.begin(),tmp.end());
    
    int ans=0;
    for(int i=0;i< min(k,(int)tmp.size());i++){
      ans-=tmp[i].cost;
    }
    cout<<"Case "<<tc<<": "<<ans<<endl;
    
  }
  return 0;
}

Measured memory_bytes: 3528
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<functional>
#include <random>

using namespace std;

/*
(A[0] + ... + A[i-1]) % MをS[i]とおく。
*/

int main(void) {
	int N, M, A[100000];
	int S[100001];
	long long ans;
	scanf("%d %d", &N, &M);
	for (int i = 0; i < N; i++) {
		scanf("%d", &A[i]);
	}
	S[0] = 0;
	for (int i = 0; i < N; i++) {
		S[i + 1] = (S[i] + A[i]) % M;
	}
	sort(S, S + N + 1);

	ans = 0;
	long long ib = 0;
	long long cnt;
	for (int i = 0; i < N + 1; i++) {
		if (S[i] != S[ib]) {
			cnt = i - ib;
			ans = ans + cnt * (cnt - 1) / 2;
			ib = i;
		}
	}
	cnt = N+1 - ib;
	ans = ans + cnt * (cnt - 1) / 2;
	printf("%lld\n", ans);
	
}









Measured memory_bytes: 896
#include<cstdio>
#include<algorithm>

using namespace std;
#define lli unsigned long long int

lli gcd(lli a,lli b){
  lli c;
  while(a!=0){
    c=a; a=b%a; b=c;
  }
  return b;
}


int main(){
  lli a,b;
  while(~scanf("%lld%lld",&a,&b)){
          
    lli tmp1=gcd(a,b);
    lli tmp2=a*b/tmp1;
    printf("%lld %lld\n",tmp1,tmp2);

  }
  return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Math;
using static System.Array;


namespace AtCoder
{
    class AC
    {
        const int mod = 1000000007;
        const int INF = int.MaxValue / 2;
        const long SINF = long.MaxValue / 2;


        static void Main(string[] args)
        {
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);
            var cin = new Scanner();

            var p = cin.SplitReader();
            int N = p[0];
            int K = p[1];
            long ans = 0;
            for(var b = K + 1; b <= N; b++)
            {
                int M = (N - K) / b;
                ans += M * (b - K);
                
                int L = N % b;
                ans += L >= K ? L - K + 1 : b - K;
                if (K == 0) { ans--; }
            }

            Console.WriteLine(ans);

            //Console.Out.Flush();
        }

        

    }
    public class Scanner
    {
        public int[] SplitReader()
        {
            int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return array;
        }
        public long[] SplitReaderL()
        {
            long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return array;
        }
    }

   public static class Tool
        {
            static public void Initialize<T>(ref T[] array, T initialvalue)
            {
                for (var i = 0; i < array.Length; i++)
                {
                    array[i] = initialvalue;
                }
            }
            static public long ModuloP(long value, long mod)
            {
                long r = value % mod;

                if (r * mod < 0)
                {
                    r += mod;
                }
                return r;
            }

        }

   struct Pair<T> : IComparable<Pair<T>> where T : IComparable<T>
   {
        public T variable;
        public int index;

        public Pair(T val, int i)
        {
            variable = val;
            index = i;
        }

        public int CompareTo(Pair<T> otherPair)
        {
            return variable.CompareTo(otherPair.variable);
        }

        public int CompareIndex(Pair<T> otherPair)
        {
            return index.CompareTo(otherPair.index);
        }
   }

    


}






Measured memory_bytes: 13268
z[4000],*a=z,*b=z+2000,m,i,j;main(n){for(;!scanf("%d",&n)||n;m=!printf("%d\n",m))for(i=++n;i--;j=a,a=b,b=j)for(j=n;j--;)m=fmax(m,b[j]=n+~i&&getchar()>45?1+fmin(fmin(b[j+1],a[j+1]),a[j]):0);exit(0);}

Measured memory_bytes: 0