akhauriyash/Code-Regression huggingface dataset:
#include <utility> // pair make_pair
using std::swap; // c++11
using std::pair;
using std::make_pair;
#include <tuple> // tuple(c++11) make_tuple(c++11)
using std::tuple; // get<address>(variable)
using std::make_tuple;
#include <string> // string stoi(c++11) stoll(c++11) to_string(c++11)
using std::string;
using std::stoi;
using std::stoll;
using std::to_string;
#include <queue> // queue priority_queue
using std::queue;
using std::priority_queue;
#include <stack> // stack
using std::stack;
#include <vector> // vector
using std::vector;
#include <map> // map
using std::map;
#include <set> // set
using std::set; // insert erase find count
#include <algorithm> // min max
using std::sort;
using std::lower_bound; // iterator,  >=
using std::upper_bound; // iterator,  >
using std::min;
using std::max;
using std::min_element; // iterator
using std::max_element; // iterator
#include <complex> // complex
using std::complex; // real imag
#include <iostream> // cin cout
using std::cin;
using std::cout;
using std::endl;
#include <iomanip> // setprecision fixed(manipulator)
using std::setprecision;
using std::fixed;
#include <cmath>
#include <cstdio>

#define lli long long int
#define INF (int)1e09
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define EFOR(i, m, n) for (int i = m; i <= n; i++)
#define RFOR(i, m, n) for (int i = m; i > n; i--)
#define REFOR(i, m, n) for (int i = m; i >= n; i--)
#define VSORT(v) sort((v).begin(), (v).end()) // sort vector
typedef pair<int, int> PI;
typedef tuple<int, int, int> TI;
template <typename T> using Vec = vector<T>; // c++11
#define SEP 2


int main(void) {
    int n;
    cin >> n;
    Vec<int> t(n);
    Vec<int> v(n);
    int time = 0;
    FOR (loop, 0, n) {
        cin >> t[loop];
        time += t[loop];
    }
    FOR (loop, 0, n) {
        cin >> v[loop];
    }

    Vec<int> sped(SEP * time + 1, 0);
    Vec<int> max_s(SEP * time + 1);
    int rui = 0; // ruiseki_time
    max_s[0] = 0;
    FOR (i, 0, n) {
        FOR (j, SEP * rui, SEP * (rui + t[i])) {
            max_s[j] = v[i] * SEP;
        }
        if (i != 0) {
            max_s[SEP * rui] = min(v[i], v[i - 1]) * SEP;
        }
        rui += t[i];
    }

    while (1) {
        bool change = false;
        // operation
        FOR (i, 1, SEP * time) {
            sped[i] += 1;
            if (abs(sped[i - 1] - sped[i]) > 1 || abs(sped[i + 1] - sped[i]) > 1 || sped[i] > max_s[i]) {
                sped[i] -= 1;
            } else {
                change = true;
            }
        }
        if (change == false) {
            break;
        }
    }
    /*
    FOR (i, 0, SEP * time) {
        cout << (double)(i) / SEP << " " << (double)(sped[i]) / SEP << " " << (double)(max_s[i]) / SEP << endl;
    }
     */

    double total = 0;
    FOR (i, 0, SEP * time) {
        int status = sped[i + 1] - sped[i];
        if (status == 1) {
            total += sped[i + 1] * 2 - 1;
        } else if (status == 0) {
            total += sped[i] * 2;
        } else {
            total += sped[i] * 2 - 1;
        }
    }
    total /= (2 * SEP * SEP);
    cout << std::fixed << setprecision(4) << total << endl;

    return 0;
}



Measured memory_bytes: 512
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int n;
    cin >> n;
    cout << (n + 1) / 2 << endl;
    return 0;
}


Measured memory_bytes: 3608
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author HossamDoma
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {

            int n = in.nextInt();

            int[] a = new int[100002];

            for (int i = 0; i < n; ++i) {
                int l = in.nextInt();
                int r = in.nextInt();

                a[l]++;
                a[r + 1]--;
            }


            int ans = 0;
            for (int i = 1; i <= 100000; ++i) {
                a[i] += a[i - 1];

                if (a[i] > 0)
                    ans++;
            }

            out.println(ans);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
  ll a,b;
  cin>>a>>b;
  vector<ll>vec(3);
  vec.at(0)=a*b;
  vec.at(1)=a-b;
  vec.at(2)=a+b;
  sort(vec.begin(),vec.end());
  cout<<vec.at(2)<<endl;
  return 0;
}
    
  
  
    
  


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
 
typedef vector<int> vi;;
typedef vector<ll> vll;

#define l() length()
#define sz() size()
 
#define b() begin()
#define e() end()
#define all(x) x.begin(), x.end()
 
#define pb(i) push_back(i)
#define PB() pop_back()
 
 
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
#define mp make_pair
#define Fi first
#define Se second
 
const int maxx=1e6+9;
 
// Happy Coding!

bool isPalindrome(int n){
    string str=to_string(n);
    int lo=0,hi=str.l()-1;
    while(lo<hi){
        if(str[lo]!=str[hi]){
            return 0;
        }
        lo++;
        hi--;
    }
    return 1;
}
void solve(){
    int l,r;
    cin>>l>>r;
    
    int cnt=0;
    for(int i=l;i<=r;i++){
        cnt+=isPalindrome(i);
    }
    cout<<cnt<<endl;
}



int main() {
    faster;
    int t=1;
    // cin>>t;
    while(t-->0){
        solve();
    }
	return 0;
}

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

int main(){
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  if(k<=a) {
    cout<<k<<endl;
  } else if(k<=a+b) {
    cout<<a<<endl;
  } else if(k>a+b){
    cout<<a+((k-(a+b))*-1)<<endl;
  }
}


Measured memory_bytes: 3636
/*
░░░░██████████████████
░░▄███████▀▀▀▀▀▀███████▄
░▐████▀▒ManavJ07▒▀██████▄
░███▀▒▒▒▒BITS▒▒▒▒▒▒▀█████
░▐██▒▒▒.........▒▒▒▒▒████▌
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌
░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀
░░░░▄██████████████▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐
*/
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define dd double
#define MOD 998244353
#define nl cout<<endl
#define rt ll Q[100005]={0}
#define mp make_pair
#define test() ull t;cin>>t;while(t--)
#define pb push_back
#define ff first	
#define ss second
#define all(v) v.begin(),v.end()
#define s(ar,n) sort(ar,ar+n)
#define rs(ar,n) sort(ar, ar+n, greater<ll>()) 
#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
#define maxa(ar,N) *max_element(ar,ar+N)
#define mina(ar,N) *min_element(ar,ar+N)
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
ll powe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);if(m%2==0)return (t*t);return (((t*t))*n);}
ll mpowe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
ll logtwo(ll n){if(n==1)return 0;return logtwo(n/2)+1;}
int main()
{
    fastio();
    ll N;
    cin>>N;
    ll rem=N%100;
    ll k=N/100;
    if(k*5<rem)
        cout<<0;
    else
        cout<<1;
}

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

int main()
{
  int n,k;
  cin>>n>>k;
  vector<int>arr(n);
  for(int i=0;i<n;i++)
  {
    cin>>arr[i];
  }
  
  vector<int>dp(n,INT_MAX);
  dp[0]=0,dp[1]=abs(arr[1]-arr[0]);
  
  for(int i=2;i<n;i++)
  {
    for(int j=1;j<=k;j++)
    {
    	if(j<=i)
    		dp[i]=min(dp[i], dp[i-j] + abs(arr[i]-arr[i-j]) );
    }
  }
  cout<<dp[n-1];
  
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
//string b="12345";
//a = int(b[4]-48);
using namespace std;
int main()
{
	int H, N,T=0;
	vector<int> A;

	cin >> H >> N;

	for (int i = 0; i < N; i++) {
		int t;
		cin >> t;
		A.push_back(t);
	}
	sort(A.begin(), A.end());
	for (int i = 1; i < N+1; i++) {
		T = T + A[N - i];
	}
	
	if (T < H) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}

}


Measured memory_bytes: 892
import java.util.*;
class Main {
	public static void main (String[] args) throws java.lang.Exception {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		for(int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			if('a' <= c && c <= 'z') System.out.print((char)(c - 32));
			else if('A' <= c && c <= 'Z') System.out.print((char)(c + 32));
			else System.out.print(c);
		}
		System.out.println();
	}
}


Measured memory_bytes: 26856
N, M = map(int, input().split())
S = str(input())
T = str(input())
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
 
def lcm(x, y):
    return (x * y) // gcd(x, y)
X = lcm(N ,M)
 
if S[0] != T[0]:
    print(-1)
elif X == N*M:
    print(N*M)
else:
        L = X
        match = lcm(  L // N,  L // M)
        for j in range(1, (L // match) ):
            if S[j * N * match // L] != T[ j * M * match // L]:
                L = -1
                break
        if L == X :
            print(L)
        else:
            print(-1)
 

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define maxn 200010
using namespace std;
int n,m,a[maxn],b[maxn];
int x,y,cnt[maxn],ans;
int main() {
	scanf("%d %d",&n,&m);
	for (int i=1;i<=n;i++) {
		scanf("%d",&a[i]);
		b[a[i]]++;
	}
	for (int i=1;i<=n;i++)
		for (int j=max(i-b[i],0);j<i;j++)
			cnt[j]++;
	ans=0;
	for (int i=0;i<n;i++)
		if (cnt[i]==0)
			ans++;
	for (int i=1;i<=m;i++) {
		scanf("%d %d",&x,&y);
		if (a[x]-b[a[x]]>=0) {
			cnt[a[x]-b[a[x]]]--;
			if (cnt[a[x]-b[a[x]]]==0)
				ans++;
		}
		b[a[x]]--;
		b[y]++;
		if (y-b[y]>=0) {
			cnt[y-b[y]]++;
			if (cnt[y-b[y]]==1)
				ans--;
		}
		a[x]=y;
		printf("%d\n",ans);
	}
	return 0;
}

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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define bit(n) (1<<(n))

#define out(x) cout<<(x)<<endl;
#define err(x) cerr<<(x)<<endl;
#define errr(x,y) cerr<<(x)<<" "<<(y)<<endl;

#define rep(i,n) for (int i=0;i<(n);i++)
#define repp(i,n) for (int i=1;i<=(n);i++)

#define i5 100002

int main(){
	int n, p[102]={}, num[102]={};
	string s[102]={};
	cin >> n;
	rep(i, n) cin >> s[i] >> p[i];

	rep(i, n) num[i] = i;

	rep(i, n) {
		rep(j, n) {
			if (s[j] < s[j+1]){
				swap(s[j], s[j+1]);
				swap(p[j], p[j+1]);
				swap(num[j], num[j+1]);
			}
			if (s[j] == s[j+1] && p[j] > p[j+1]){
				swap(s[j], s[j+1]);
				swap(p[j], p[j+1]);
				swap(num[j], num[j+1]);
			}
		}
	}

	rep(i, n) cout << num[n-i-1] + 1 << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
#include<iostream>
#include<iomanip>
#include<cmath>
#include<array>
#include<vector>
#include<set>
#include <utility>
#include <map>
using namespace std;

int main(){
  long long x,y;
  cin>>x>>y;
  long long  num=x;
  int ans=1;
  while(num<=y){
    num*=2;
    ans++;
  }
  cout<<ans-1<<endl;
}


Measured memory_bytes: 256
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#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 main() {
	int w, h, n;
	cin >> w >> h >> n;
	int x[150], y[150], a[150];
	rep(i, n) cin >> x[i] >> y[i] >> a[i];
	int s = 0, t = w, u = 0, v = h;
	bool x_exit = false, y_exit = false;
	vector<int> tt, vv;
	rep(i, n) {
		if (a[i] == 1) {
			s = max(s, x[i]);
		}
		else if (a[i] == 2) {
			t = min(t, x[i]);
		}
		else if (a[i] == 3) {
			u = max(u, y[i]);
		}
		else if (a[i] == 4) {
			v = min(v, y[i]);
		}
	}
	int ans = max(0,t-s)* max(0,v-u);
	cout << ans << endl;
	return 0;
}

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

using namespace std;

inline int ctoi(char c) { if(c < '0' || '9' < c) throw invalid_argument("ctoi error"); return c - '0'; }
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for(int i = (int)(k); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T>
inline T gcd(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("gcd error: x <= 0 or y <= 0");
	
	if(x < y) swap(x, y);
	T r = x % y;

	while(r != 0){
		x = y;
		y = r;
		r = x % y;
	}

	return y;
}
template <typename T>
inline T lcm(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("lcm error: x <= 0 or y <= 0");

	return x * y / gcd(x, y);
}

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

	vector<int> input;
	rep(i, n){
		int x;
		cin >> x;
		x--;
		input.push_back(x);
	}

	int now = 0;
	int cnt = 0;
	long long int step = 0;
	long long int cycle = 0;

	vector<pair<bool, int>> path;
	rep(i, n){
		path.push_back(make_pair(false, 0));
	}

	// サイクルをみつける
	while(true){
		cnt++;
		now = input[now];

		// すでに通ったことがあるか？あるならサイクル
		if(path[now].first){
			cycle = cnt - path[now].second;
			step = path[now].second;

			break;
		}
		else{
			path[now].first = true;
			path[now].second = cnt;
		}
	}

	// step分処理
	now = 0;

	rep(i, step){
		if(k <= i){
			break;
		}
		else{
			now = input[now];
		}
	}

	k -= step;

	if(0 < k){
		k %= cycle;

		rep(i, k){
			now = input[now];
		}
	}

	cout << now + 1;

	return 0;
}

Measured memory_bytes: 6156
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * A-Z Cat
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		line = br.readLine();

		StringBuilder sb = new StringBuilder();
		boolean a = true;

		for (char c : line.toCharArray()) {
			if (c == 'A' && a) {
				a = false;
			} else if (c == 'Z' && !a) {
				sb.append("AZ");
				a = true;
			}
		}

		if (sb.length() != 0) {
			System.out.println(sb.toString());
		} else {
			System.out.println(-1);
		}
	}
}

Measured memory_bytes: 24456
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5+5;
typedef pair<int,int> pi;
int n,m,a[N],b[N];
int par[N];ll sz[N];
inline int find(int x){
	return par[x]==x?par[x]:par[x]=find(par[x]);
}

struct node{
	int l,r,h,x;
}f[N<<3];
int cnt;

int merge(int a,int b){
	if(!a||!b)return a|b;
	if(f[a].x>f[b].x)swap(a,b);
	f[a].r=merge(f[a].r,b);
	if(f[f[a].l].h<f[f[a].r].h)swap(f[a].l,f[a].r);
	f[a].h=f[a].r?f[f[a].r].h+1:0;
	return a;
}

int pop(int a){
	return merge(f[a].l,f[a].r);
}

ll ans;

int rt[N],u[N], v[N];
queue<int> q;

bool check(ll p){
	// cout << "check" << p << endl;
	for(int i=1;i<=n;i++){
		if(a[i]-b[i]<=p)q.push(i);
		par[i] = i;
		rt[i] = 0;
		sz[i] = b[i];
	}
	for(int i=2;i<=m*2+1;i++){
		f[i].l=f[i].r=f[i].h=0;
	}
	for(int i=1;i<=m;i++){
		rt[u[i]] = merge(rt[u[i]], i*2);
		rt[v[i]] = merge(rt[v[i]], i*2+1);
	}
	while(q.size()){
		int u = q.front();q.pop();
		// cout << u << ":" << endl;
		if(find(u)!=u)continue;
		// cout << u << " " << sz[u] << ":" << rt[u] << " " << f[rt[u]].x << endl;
		while(rt[u] && f[rt[u]].x<=sz[u]+p){
			// cout << rt[u]/2 << endl;
			int id = rt[u]/2;
			rt[u] = merge(f[rt[u]].l, f[rt[u]].r);
			int nxt = find(::v[id]) + find(::u[id]) - u;
			if(nxt==u)continue;
			else{
				// cout << nxt << endl;
				rt[u] = merge(rt[u], rt[nxt]);
				par[nxt] = u;
				sz[u] += sz[nxt];
			}
		}
	}
	for(int i=1;i<=n;i++){
		if(find(i)!=find(1))return 0;
	}
	return 1;
}

int main()
{
	cin >> n >> m;
	for(int i=1;i<=n;i++)scanf("%d%d",&a[i], &b[i]);
	if(n==1){
		cout << max(a[1],b[1]) << endl;
		return 0;
	}
	for(int i=1;i<=m;i++){
		int u,v;scanf("%d%d",&u,&v);
		::u[i] = u, ::v[i] = v;
		f[i*2].x = a[v] - b[v];
		f[i*2+1].x = a[u] - b[u];
	}
	int l=0,r=1e9;
	while(l<r){
		int mid = (l+r)>>1;
		bool ret=check(mid);
		if(ret)r=mid;
		else l=mid+1;
	}
	// check(0);
	ans = l;
	for(int i=1;i<=n;i++)ans += b[i];
	cout << ans << endl;
	return 0;
}

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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N+1];
        long[] sum = new long[N+1];
        for(int i = 1; i <= N; i++){
            A[i] = sc.nextInt();
            sum[i] = A[i] + sum[i-1];
        }
        // dp[i][j]：ｉ番目からｊ番目までを合体させるときの最小コスト
        long[][] dp = new long[N+1][N+1];
        for(int i = 1; i <= N; i++) Arrays.fill(dp[i], Long.MAX_VALUE);
        for (int len = 1; len <= N; len++) {
            for (int i = 1; i + len - 1 <= N; i++) {
                int j = i + len - 1;
                if(len == 1) dp[i][i] =0;
                else{
                    for (int split = i; split < j; split++) {
                        dp[i][j] = Math.min(dp[i][j], dp[i][split] + dp[split + 1][j] + sum[j] - sum[i - 1]);
                    }
                }
            }
        }
        System.out.println(dp[1][N]);
        sc.close();

    }

}


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

int main()
{
    int n, ans;
    cin >> n;
    if (n % 2 == 0)
        ans = n;
    else
        ans = n * 2;
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#if 0
date +%Y.%m.%d

题解先咕着。
#endif
#include <cstdio>
#include <set>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long ll;

struct {
	inline operator int () { int x; return scanf("%d", &x), x; }
	inline operator ll () { ll x; return scanf("%lld", &x), x; }
	template<class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator ()(a...); }
} read;

const int maxn = 200005;
int p[maxn];
int deg[maxn];
int mex[maxn];
int stack[maxn], sp;
std::set<int> set[maxn];

int main() {
	int n = read;
	for(int i = 1; i <= n; i ++)
		++ deg[p[i] = read];

	for(int i = 1; i <= n; i ++)
		if(!deg[i])
			stack[++ sp] = i;

	while(sp) {
		int x = stack[sp --];

		while(set[x].count(mex[x]))
			++ mex[x];

		set[p[x]].insert(mex[x]);

		-- deg[p[x]];
		if(!deg[p[x]])
			stack[++ sp] = p[x];
	}

	int tot = 0;
	for(int i = 1; i <= n; i ++)
		if(deg[i]) {
			while(set[i].count(mex[i]))
				++ mex[i];
			/* debug("%d : %d\n", i, mex[i]); */
			++ tot;
			set[0].insert(mex[i]);
		}

	if((tot & 1) and set[0].size() == 1) puts("IMPOSSIBLE");
	else puts("POSSIBLE");
}


Measured memory_bytes: 21376
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String x = sc.next();
    String y = sc.next();
    if(x.compareTo(y)>0){
      System.out.println(">");
    }else if(x.compareTo(y)<0){
      System.out.println("<");
    }else{
      System.out.println("=");
    }
  }
}


Measured memory_bytes: 21076
#include<stdio.h>
int main(){
  int A,B;
  scanf("%d %d",&A,&B);
  if(A+B>=A-B && A+B>=A*B){
    printf("%d\n", A+B);
  }
  else if(A-B>=A+B && A-B>=A*B){
    printf("%d\n", A-B);
  }
  else if(A*B>=A+B && A*B>=A-B){
    printf("%d\n", A*B);
  }
  return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

    private static char[]   cells = new char[9];
    private static int [][] cond = {{0,1,2},{3,4,5},{6,7,8},
    	                            {0,3,6},{1,4,7},{2,5,8},
    	                            {0,4,8},{2,4,6}        };

	public static void main(String[] args) {

        //input
        Scanner sc = new Scanner(System.in);

        char ret;
        while(sc.hasNext()){
        	cells = sc.next().toCharArray();
        	ret = check();
        	System.out.println(ret);
        }
	}

	private static char check(){

		char t   = 'n',
		     ret = 'n';

		loop:for(int i=0;i<2;i++){

			ret = 'd';

			if      (i == 0){ t = 'o';}
			else if (i == 1){ t = 'x';}

			for(int j=0;j<8;j++){
				if ( cells[cond[j][0]] == t &&
					 cells[cond[j][1]] == t &&
					 cells[cond[j][2]] == t    ){
					ret = t;
					break loop;
				}
			}
		}
		return ret;
	}
}

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

int main() {
  string s; cin >> s;
  ll sum = 0;
  rep(i,s.size()) {
    sum += s[i] - '0';
  }
  if (sum%9) cout << "No";
  else cout << "Yes";
  cout << endl;
  return 0;
}

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

using namespace std;

int main(){
	int a,b,c,n,i;
	cin >> n;
	for( i = 0; i < n; i++ ){
		cin >> a >> b >> c;
		if(a*a + b*b == c*c){
			cout << "YES" << endl;
		}
		else if(a*a + c*c == b*b){
			cout << "YES" << endl;
		}
		else if(b*b + c*c == a*a){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
		
	}
	
	return 0; 
}

Measured memory_bytes: 1156
/*---------------------------------- NEVER GIVE UP --------------------------------------------*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef double ld;
typedef pair<ll,ll> pii;
typedef tree<ll, null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define fastt ios_base::sync_with_stdio(false); cin.tie(NULL)
#define debug1(x) cerr<<#x<<" : "<<x<<endl
#define debug2(x,y) cerr<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<endl
#define debug3(x,y,z) cerr<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<" "<<#z<<" : "<<z<<endl

const ll modd=1e9+7;
const ll inf=1e18;

ll poww(ll a,ll b){
  ll ans=1;
  while(b){
    if(b&1LL) ans=(ans*a);
    a=(a*a);
    b=b>>1LL;
  }
  return ans;
}

/*    
         -> mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
         -> cout<<"Case #"<<casee<<": "<<ans<<endl; // for google kickstart

*/

/*-----------------------------------------------------------------------------------------------*/

int main(){
   fastt;
   
   ll n,a,b,c,d;
   cin>>n>>a>>b>>c>>d;

   a--,b--,c--,d--;

   string s;
   cin>>s;

   if(c == d){
      cout<<"No"<<endl;
      return 0;
   }

   if(c < d){
      while(a != c){
        if(a+1 <=c && s[a+1] == '.')
          a++;
        else if(a+2 <=c && s[a+2] == '.')
          a+=2;
        else{
          cout<<"No"<<endl;
          return 0;
        }
      }
      while(b != d){
        if(b+1 <=d && s[b+1] == '.')
          b++;
        else if(b+2 <=d && s[b+2] == '.')
          b+=2;
        else{
          cout<<"No"<<endl;
          return 0;
        }
      }    
      cout<<"Yes"<<endl; 
   }

   if(c > d){
      ll copya=a,copyb=b;
      while(a != c){
        if(a+1 <=c && s[a+1] == '.')
          a++;
        else if(a+2 <=c && s[a+2] == '.')
          a+=2;
        else{
          cout<<"No"<<endl;
          return 0;
        }
      }
      while(b != d){
        if(b+1 <=d && s[b+1] == '.')
          b++;
        else if(b+2 <=d && s[b+2] == '.')
          b+=2;
        else{
          cout<<"No"<<endl;
          return 0;
        }
      }
      a=copya,b=copyb;
      ll i=b,check=0;
      if(i > 0 && s[i-1] == '.') i--;
      while(i < d){
         if(s[i+1] == '.' && s[i+2] == '.') check=1;
         if(s[i+1] == '.') i++;
         else if(s[i+2] == '.') i+=2;
      }
      if(check == 0) cout<<"No"<<endl;
      else           cout<<"Yes"<<endl;
   }
 
   return 0;
}


Measured memory_bytes: 592
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define prtd(var, i) cout << fixed << setprecision(i) << var << endl;
#define ll long long
using namespace std;

string f(ll n){
    if(n == 0) return "";
    n--;
    return f(n/26) + string(1, 'a' + n%26);
}

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

    cout << f(n) << endl;

    return 0;
}

Measured memory_bytes: 3652
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int T, N;
int dp[40][110];
int wake[40];
int interview[110];

int main() {
  while (scanf("%d", &T), T) {
    MEMSET(interview, 0x0f);
    REP(i, T) { scanf("%d", &wake[i]); }
    scanf("%d", &N);
    REP(i, N) {
      int d, m;
      scanf("%d %d", &d, &m);
      d--;
      interview[d] = min(interview[d], m);
    }
    MEMSET(dp, 0x0f);
    dp[0][0] = 0;
    REP(day, 100) {
      REP(t, T) {
        if (wake[t] > interview[day]) { continue; }
        dp[(t + 1) % T][day + 1] = min(dp[(t + 1) % T][day + 1], dp[t][day]);
        dp[0][day + 1] = min(dp[0][day + 1], dp[t][day] + 1);
      }
    }
    int ans = 1000;
    REP(t, T) { ans = min(ans, dp[t][100]); }
      printf("%d\n", ans);
  }
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <limits>

int main()
{
  std::vector<int> data;
  while(true){
    int n;
    std::cin >> n;
    if(n!=0) data.push_back(n);
    else break;
  }
  std::vector<long long> num_tet;
  std::vector<long long> num_odd_tet;
  for (int i = 1; i < 200; i++){
    long long num = i*(i+1)*(i+2)/6;
    num_tet.push_back(num);
    if(num%2==1) {
      // std::cout << "i "<<i << std::endl;
      num_odd_tet.push_back(num);
    }
    // std::cout << "num "<< num << std::endl;
  }
  //dp[i+1][j] i番目までの正四面体数で整数jを実現するための最小手数
  int inf = std::numeric_limits<int>::max();
  // std::vector<std::vector<long long>> dp(num_tet.size()+5, std::vector<long long>(1e6+100, inf));
  // std::vector<int> ad(1e6);  // std::vector<std::vector<int>> dp((int)num_tet.size()+5, std::vector<int>(1e6, inf));

  std::vector<long long> dp(1e6+100, inf);
  dp[0] = 0;
  for (int i = 0; i < num_tet.size() ; i++){
    std::vector<long long> new_dp(1e6+100, inf);
    for (int j = 0; j < 1e6+10; j++){
      if(j-num_tet[i] < 0) new_dp[j] = dp[j];
      else new_dp[j] = std::min(dp[j], new_dp[j-num_tet[i]]+1);
    }
    dp = new_dp;
  }

  std::vector<long long> odd_dp(1e6+100, inf);
  odd_dp[0] = 0;
  for (int i = 0; i < num_odd_tet.size(); i++){
    std::vector<long long> new_odd_dp(1e6+100, inf);
    for (int j = 0; j < 1e6+10; j++){
      if(j-num_odd_tet[i] < 0) new_odd_dp[j] = odd_dp[j];
      else new_odd_dp[j] = std::min(odd_dp[j], new_odd_dp[j-num_odd_tet[i]]+1);
    }
    odd_dp = new_odd_dp;
  }

  for(const auto& d: data){
    std::cout << dp[d]<< " "<< odd_dp[d] << std::endl;
  }
  // std::cout << dp[40] << std::endl;
  // for (int i = 0; i < data.size(); i++){
  //   std::cout  <<i << " "<<i<< std::endl;
  // }
}



Measured memory_bytes: 26376
"""
i-1行目の右端のマスとi行目の左端のマスが隣接しており、
それらの行においてはそれ以外のマスは隣接していないこと。

以上を満たした場合に'Possible'を出力すればよさそう。
"""
H, W = map(int, input().split())
table = [input() for _ in range(H)]
pre_row = [i for i, x in enumerate(table[0]) if x == "#"]
for i in range(1, H):
    next_row = [j for j, x in enumerate(table[i]) if x == "#"]
    if len(set(pre_row) & set(next_row)) == 1 and pre_row[-1] == next_row[0]:
        pre_row = next_row
    else:
        print('Impossible')
        exit()
print('Possible')


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

#define ll long long
#define ull unsigned long long
#define N 1000005
#define mod 1000000007
#define boost ios_base::sync_with_stdio(false);cin.tie(0)
#define prec(n) fixed<<setprecision(n)

#define pii pair<int,int> 
#define pll pair<ll,ll> 
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define vi vector<int> 
#define vll vector<ll>
#define all(c) c.begin(),c.end()
#define tr(it,c) for( typeof(c.begin()) it = c.begin() ; it!=c.end() ; it++)

ll modulo(ll num){ return ((num%mod)+mod)%mod;} // for negative integer
ll power(ll b,ll e,ll MOD=mod){ll ans=1; while(e){if(e%2) ans=(ans*b)%MOD; b=(b*b)%MOD; e/=2;} return ans;}
ll inv(ll num,ll MOD=mod){ return power(modulo(num),mod-2,MOD); }

int lp[N+1];
vector<int> pr;
bool is_prime[N]={};
void linearsieve()
{
	for (int i=2; i<=N; ++i) 
	{
		if (lp[i] == 0) 
		{
			lp[i] = i;
			pr.push_back (i);
			is_prime[i]=1;
		}
		for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N; ++j)
			lp[i * pr[j]] = pr[j];
	}  
}
int main()
{
    boost;
    linearsieve();
    
    int size = pr.size();
    int n;
    cin>>n;
    
    for(int i=5;n;i+=5)
    {
        if( is_prime[i*6+1]){ cout<<(i*6)+1<<" "; n--;}
    }
    
    return 0;
}

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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const long long MOD = 1000000007LL;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

vector<int> f(6), g;
int memo[15][15][2];

int solve(int left, int right, int turn, int sen, int go){
    if(sen == 0){
        return 0;
    }
    if(go == 0){
        return 1;
    }
    if(memo[left][right][turn] >= 0){
        return memo[left][right][turn];
    }

    bool res = false, flag = false;
    if(turn == 0){
        rep(i, 6){
            if(f[i] == left - 1){
                res |= solve(left - 1, right, 1, sen - 1, go) == 0;
                flag = true;
            }else if(f[i] == right + 1){
                res |= solve(left, right + 1, 1, sen - 1, go) == 0;
                flag = true;
            }
        }
        if(!flag){
            res |= solve(left, right, 1, sen, go) == 0;
        }
    }else{
        rep(i, 6){
            if(g[i] == left - 1){
                res |= solve(left - 1, right, 0, sen, go - 1) == 1;
                flag = true;
            }else if(g[i] == right + 1){
                res |= solve(left, right + 1, 0, sen, go - 1) == 1;
                flag = true;
            }
        }
        if(!flag){
            res |= solve(left, right, 0, sen, go) == 1;
        }
    }

    if(res){
        return memo[left][right][turn] = turn;
    }else{
        return memo[left][right][turn] = turn ^ 1;
    }
}

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

    int n;
    cin >> n;
    rep(I, n){
        rep(i, 6){
            cin >> f[i];
        }
        g.clear();
        reps(i, 13){
            if(i == 7){
                continue;
            }
            bool flag = true;
            rep(j, 6){
                if(f[j] == i){
                    flag = false;
                }
            }
            if(flag){
                g.emplace_back(i);
            }
        }
        memset(memo, -1, sizeof(memo));
        if(solve(7, 7, 0, 6, 6) == 0){
            cout << "yes" << endl;
        }else{
            cout << "no" << endl;
        }
    }

    return 0;
}


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

int main(){
    int N;
    cin >> N;
    vector<ll> L(N);
    for(int i=0;i<N;i++) cin >> L[i];
    sort(L.begin(), L.end());
    int counter = 0;
    for(int i=0;i<N;i++){
        for(int j=0;j<i;j++){
            if(L[i]==L[j]) continue;
            for(int k=0;k<j;k++){
                if(L[j]==L[k]) continue;
                if(L[i] < L[j]+L[k]) counter++;
            }
        }
    }
    cout << counter << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string n= " ";
    cin >> n;
    for(int i=0; i < 3; i++){
        if (n[i]=='1'){
            n[i] = '9';
        }else if (n[i]=='9'){
            n[i] = '1';
        }
    }
    cout << n;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <cstdint>

int main()
{
	std::int32_t n;
	while (std::cin >> n) {
		std::int32_t num_comb = 0;
		for (std::int32_t a = 0; a < 10; ++a) {
		for (std::int32_t b = 0; b < 10; ++b) {
		for (std::int32_t c = 0; c < 10; ++c) {
		for (std::int32_t d = 0; d < 10; ++d) {
			if (a + b + c + d == n) {
				++num_comb;
			}
		}}}}
		std::cout << num_comb << std::endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>

int main() {
    int n;
    scanf("%d",&n);
    int ac=0,tle=0,wa=0,re=0;
    while(n--) {
        
        char c[10]={0};
        scanf(" %s",&c);
        switch(c[0]) {
            case 'A':
                ac++;
                break;
            case 'T':
                tle++;
                break;
            case 'W':
                wa++;
                break;
            case 'R':
                re++;
                break;
            default:
                break;
        }
    }
    printf("AC x %d\n",ac);
    printf("WA x %d\n",wa);
    printf("TLE x %d\n",tle);
    printf("RE x %d\n",re);
    

}

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

int main(void) {
	int a, b,add,mul,sub;
	cin >> a >> b;
	add = a + b;
	sub = a - b;
	mul = a * b;

	if (add >= sub && add >= mul) {
		cout << add;
	}
	else if (sub >= mul) {
		cout << sub;
	}
	else {
		cout << mul;
	}	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using std::cin;
using std::cout;
using std::endl;
using std::string;

int main() {
  string s;
  string res;

  cin >> s;
  for (char x : s) {
    if (x == '0') res += '0';
    else if (x == '1') res += '1';
    else if (x == 'B' && res != "") res.pop_back();
  }
  cout << res << endl;

  return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define inf (10000000000)
using namespace std;

const long long charbase = '0';
struct RollingHash {
  long long Mod[2], Base[2];
  long long ssize, maxssize;
  string s;
  vector<long long> pow[2];
  vector<long long> hash[2];
  RollingHash(string inis = "") {
    Mod[0] = 1000000007;
    Mod[1] = 1000000009;
    Base[0] = 1009;
    Base[1] = 1007;
    maxssize = 500005;
    for(int t = 0; t < 2; ++t) {
      pow[t].assign(maxssize, 0);
      pow[t][0] = 1;
      for(int i = 1; i < maxssize; ++i)
        pow[t][i] = pow[t][i - 1] * Base[t] % Mod[t];
    }
    init(inis);
  }
  void init(string inis = "") {
    s = inis;
    ssize = s.size();
    sethash();
  }
  void sethash() {
    ssize = s.size();
    for(int t = 0; t < 2; ++t) {
      hash[t].assign(ssize + 1, 0);
      for(int i = 0; i < ssize; ++i) {
        if(i != 0)
          hash[t][i + 1] = hash[t][i] * Base[t] % Mod[t];
        hash[t][i + 1] += (s[i] - charbase);
        hash[t][i + 1] %= Mod[t];
      }
    }
  }
  // [l,r),0-indexed
  pair<long long, long long> calchash(int l, int r) {
    long long ans[2];
    for(int t = 0; t < 2; ++t) {
      ans[t] = hash[t][r];
      ans[t] -= hash[t][l] * pow[t][r - l] % Mod[t];
      while(ans[t] < 0) ans[t] += Mod[t];
      ans[t] %= Mod[t];
    }
    return make_pair(ans[0], ans[1]);
  }
};

string s, t, ns;
RollingHash rh[2];
bool memo[500005] = {0};
long long used[500005] = {0};
long long tsize, ssize;

long long solve();

int main() {
  cin >> s >> t;
  tsize = t.size();
  ssize = s.size();
  ns = s + s;
  while((long long)ns.size() <
        (long long)2 * (long long)max(t.size(), s.size()))
    ns += s;
  rh[0] = RollingHash(ns);
  rh[1] = RollingHash(t);
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long ans = 0;
  for(int i = 0; i < ssize; ++i)
    memo[i] = rh[0].calchash(i, i + tsize) ==
              rh[1].calchash(0, tsize);
  for(int i = 0; i < ssize; ++i) used[i] = -1;
  for(int i = 0; i < ssize; ++i)
    if(used[i] == -1) {
      long long cnt = 0, now = i;
      stack<long long> st;
      while(1) {
        st.push(now);
        if(used[now] != -1) break;
        used[now] = -2;
        if(memo[now])
          now = (now + tsize) % ssize;
        else {
          used[now] = 0;
          break;
        }
        if(used[now] == -2) return -1;
      }
      cnt = used[now] - 1;
      while(st.size() > 0) {
        used[st.top()] = ++cnt;
        st.pop();
      }
      ans = max(ans, cnt);
    }
  if(ans == inf) return -1;
  return ans;
}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>  // Including tree_order_statistics_node_update

using namespace __gnu_pbds;
using namespace std;

#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define tr(c, i) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c, x) ((c).find(x) != (c).end())
#define cpresent(c, x) (find(all(c), x) != (c).end())
#define minei(x) min_element(x.begin(), x.end()) - (x).begin()
#define maxei(x) max_element(x.begin(), x.end()) - (x).begin()
#define LSOne(S) (S & (-S))

#define uns(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
#define acusum(x) accumulate(x.begin(), x.end(), 0)
#define acumul(x) accumulate(x.begin(), x.end(), 1, multiplies<int>());
#define bits(x) __builtin_popcount(x)
#define oo INT_MAX
#define inf 1000000000
#define MAXN 1000007
#define MOD 1000000007

const double pi = acos(-1.0);
const double eps = 1e-11;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

int main() {
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int k, x;
    cin >> k >> x;
    for (int i = x - k + 1; i < x + k; i++) {
        cout << i << " ";
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(v) ((v).begin()),((v).end())
#define ll long long
#define fastIO cout << fixed << setprecision(12), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
double const EPS = 1e-12, PI = acos(-1);
const int N = 2e5 + 9, M = 3e3 + 9, OO = 1e9 + 7, MOD = 1e9 + 7;
const ll inf = 1e18;

int main() {
  fastIO;
#ifdef LOCAL
  freopen("input.in", "rt", stdin);
#endif
  ll a, b;
  cin >> a >> b;
  a *= 3;
  b += a;
  cout << b / 2;
  return 0;
}


Measured memory_bytes: 256
/**
 * File    : D2.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-2-25 19:18:18
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

// const int dx[4] = {1, 0, -1, 0};
// const int dy[4] = {0, 1, 0, -1};

// const int C = 1e6+10;
// const ll M = 1000000007;

string S;
int N;
int K;

int DP[310][310][310];
int DP2[310][26];

int calc(int l, int r, int k) {
  if (r - l <= 2 * k + 1)
    return r - l;
  if (DP[l][r][k] != -1)
    return DP[l][r][k];
  int ans = 0;
  if (l+1 <= r-1 && k-1 >= 0)
    ans = max(ans, calc(l + 1, r - 1, k - 1) + 2);
  if (l <= r-1)
    ans = max(ans, calc(l, r - 1, k));
  int nl = DP2[l][S[r - 1] - 'a'] + 1;
  if (nl <= r-1)
    ans = max(ans, calc(nl, r - 1, k) + 2);
  DP[l][r][k] = ans;
#if DEBUG == 1
  cerr << "DP[" << l << "][" << r
       << "][" << k << "] = " << ans << endl;
#endif
  return ans;
}

int main()
{
  cin >> S >> K;
  N = S.size();
  fill(&DP[0][0][0], &DP[0][0][0] + 310 * 310 * 310, -1);
  for (auto j = 0; j < 26; j++)
  {
    DP2[N][j] = N;
  }
  for (auto i = N-1; i >= 0; i--)
  {
    for (auto j = 0; j < 26; j++)
    {
      DP2[i][j] = DP2[i + 1][j];
    }
    DP2[i][S[i] - 'a'] = i;
  }
  cout << calc(0, N, K) << endl;
}

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

int N, M;
int ans;

int main() {
    cin >> N >> M;
    for (int i = M / N; i > 0; i--) {
        if (M % i == 0) {
            ans = i;
          	break;
        }
    }
    cout << ans << endl;
}

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

int main(){
  int n;
  cin >> n;
  
  long long ans=0;
  for (int i=1;i<=n;++i){
    if (i%3==0) continue;
    if (i%5==0) continue;
    ans+=i;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3552
/**
*    created: 09.05.2020 09:58:16
**/

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int inf =1000000000;

int N, M, Q;
vector<int> a, b, c, d;
int ans = 0;

void dfs(vector<int> A){
    //終端条件
    if(A.size()==N+1){
        int s = 0;
        rep(i,Q){
            if(A[b[i]]-A[a[i]]==c[i]){
                s += d[i];
            }
        }
        ans = max(ans, s);
        return;
    }

    for (int i = A.back(); i <= M;i++){
        A.emplace_back(i);
        dfs(A);
        A.pop_back();
    }
}

int main(){
    cin >> N >> M >> Q;
    a.resize(Q), b.resize(Q), c.resize(Q), d.resize(Q);
    rep(i,Q){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    vector<int> A(1, 1);
    dfs(A);
    cout << ans << endl;
}

Measured memory_bytes: 3644
#include <iostream>

using namespace std;

int main(){
        int T1[11][4] = {};
        int T2[11][4] = {};
        int T3[11][4] = {};
        int T4[11][4] = {};

        int n,b,f,r,v;
        cin >> n;

        for(int i = 1; i <= n; i++){
                cin >> b >> f >> r >> v;

                switch (b){
                        case 1:
                                T1[r][f] += v;
                                break;

                        case 2:
                                T2[r][f] += v;
                                break;

                        case 3:
                                T3[r][f] += v;
                                break;

                        default:
                                T4[r][f] += v;
                                break;

                }
        }

        for(int i = 1; i <= 3; i++){
                for(int j = 1; j <= 10; j++){
                        cout << " " <<T1[j][i];
                }
                cout << "\n";
        }

        cout << "####################\n";

        for(int i = 1; i <= 3; i++){
                for(int j = 1; j <= 10; j++){
                        cout << " " <<T2[j][i];
                }
                cout << "\n";
        }

        cout << "####################\n";

        for(int i = 1; i <= 3; i++){
                for(int j = 1; j <= 10; j++){
                        cout << " " <<T3[j][i];
                }
                cout << "\n";
        }

        cout << "####################\n";

        for(int i = 1; i <= 3; i++){
                for(int j = 1; j <= 10; j++){
                        cout << " " <<T4[j][i];
                }
                cout << "\n";
        }
        return 0;
}

Measured memory_bytes: 1168
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>&p){
  return os << p.first << " " << p.second;
}  
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll s,w;cin>>s>>w;
  ans(s<=w,"unsafe","safe");
  return 0;
}

Measured memory_bytes: 3652
#include <stdio.h>

int main(void)
{
	int a,b;
	int sum=0;
	
	scanf("%d%d",&a,&b);
	
	if(b<10){
		sum=a*10+b;
	}else if(b<100){
		sum=a*100+b;
	}else{
		sum=a*1000+b;
	}
	
	int count=0;
	
	for(int i=1;i<350;i++){
		if(i*i==sum){
			count++;
			break;
		}
	}
	
	if(count!=0){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	
	return 0;
}
		

Measured memory_bytes: 128