akhauriyash/Code-Regression huggingface dataset:
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 1_000_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "a", long, "b");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    auto x = lread();
    bool prime;
    while(!prime)
    {
        if(x.isPrime)
            prime = true;
        
        x++;
    }
    writeln(x - 1);
}

bool isPrime(long x)
{
    auto limit = cast(long) sqrt(cast(real) x).floor();
    bool ret = true;
    foreach (i; iota(2, limit))
    {
        if(!(x % i))
        {
            ret = false;
            break;
        }
    }
    return ret;
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
signed main(void){

    char str[3000];
    char *tok;
    int m,n;
    int i1,i2,i3,i4,i44;
    int gn,gm,sn,sm;
    int fin=0;
    int nn,nm;
    unsigned long long int k;
    unsigned long long int a;
    unsigned long long int b;
    unsigned long long int ans=0;
    
    for(i1=0;i1<=0;i1++){
        fgets(str, sizeof(str), stdin);
        tok=strtok(str," ");
        a=strtol(tok,NULL,10);
        tok=strtok(NULL," ");
        b=strtol(tok,NULL,10);

    }
    
    if(b%a==0){
        printf("%d",a+b);
    }else{
        printf("%d",b-a);
    }

    
    
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string str;
cin>>str;
set<char> s;
for(int i=0;i<str.size();i++)
    s.insert(str[i]);
if(s.size()>1)
{
    cout<<"Yes"<<endl;
}
else
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define ALL(a) (a).begin(),(a).end()
#define EACH(e,v) for(auto& e:v)
#define SORT(v) sort(ALL(v))
#define PERM(v) SORT(v);for(bool c##p=1;c##p;c##p=next_permutation(ALL(v)))
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <class T> void chmax(T & a, T const & b) { if (b > a) a = b; }
template <typename T>
string to_string(const T &n){ostringstream stm;stm << n;return stm.str();}
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = 1000'000'007;
 
signed main(){
    double W,H,x,y;
    cin>>W>>H>>x>>y;
    double ans=0.0;
    ans+=W*H/2;

    if(W/2==x&&H/2==y){
        cout<<fixed<<setprecision(10)<<ans<<" "<<1<<endl;
    }else{
        cout<<fixed<<setprecision(10)<<ans<<" "<<0<<endl;
    }
 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main() {
  int N, cnt = 0;
  cin >> N;
  vector<int> a(N);
  REP(i, N) {
    cin >> a[i];
  }
  REP(i, N) {
    if ((i+1) % 2 == 1 && a[i] % 2 == 1) {
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3592
n = int(input())
v = [int(x) for x in input().split()]
v.sort(reverse=True)
t = 2
for i in range(n-1):
    v[i] = v[i]/t
    t = t*2
t = t // 2
v[n-1] = v[n-1]/t
print(sum(v))

Measured memory_bytes: 3060
#include <iostream>
#include <vector>

#define NUM 100001

using namespace std;

int main() {
	int Q;
	vector<bool> prime(NUM, true);

	//素数判定
	for (int i = 2; i*i <= NUM; i++) {
		if (prime[i]) {
			for (int j = 2; i*j <= NUM; j++) {
				prime[i*j] = false;
			}
		}
	}

	//2017に似た数の累積和計算
	vector<int> sum(NUM, 0);
	for (int i = 2; i < NUM; i++)
	{
		sum[i] = sum[i - 1];
		if (prime[i] && (i + 1) % 2 == 0 && prime[(i + 1) / 2])
			sum[i]++;
	}

	cin >> Q;
	vector<int> ans(Q);
	for (int i = 0; i < Q; i++)
	{
		int l, r;
		cin >> l >> r;
		ans[i] = sum[r] - sum[l - 1];
	}

	for (int i = 0; i < Q; i++)
	{
		cout << ans[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c),end(c)
#define mp make_pair
#define pb push_back
#define xx first
#define yy second
#define FOR(i,a,b) for (ll i=(a); i<(b); i++)
#define FORD(i,a,b) for (ll i=ll(b)-1; i>=(a); i--)

void self_min(ll &a, ll b) {
	a = min (a,b);
}

int main() {
	ios::sync_with_stdio(false);

	ll n, K; cin >> n>> K;
	vl h(n);
	FOR(i,0,n) cin >> h[i];

	vl dp(n,oo);
	dp[0] = 0;

	FOR(i,0,n) {
		FOR(k,1,K+1) {
			if (i < n - k) {
				self_min(dp[i+k], dp[i] + abs(h[i+k] - h[i]));
			}
		}
	}
	cout << dp[n-1] << endl;
	return 0;
}


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

int main(){
  int N, M, a, b;
  cin >> N >> M;
  vector<int> vec(N,0);
  for(int i = 0; i < M; i++){
    cin >> a >> b;
    vec.at(a-1)++;
    vec.at(b-1)++;
  }
  for(int i = 0; i < N; i++){
    cout << vec.at(i) << endl;
  }
  return 0;
}
    


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin>>n;
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]+n>90)
		{
			cout<<char(64+(s[i]+n)%90);
		}
		else
		{
			cout<<char(s[i]+n);
		}
		
	}
	
	
 
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define INF (1<<29)
using namespace std;
typedef long long ll;
int main(){
      int n,k;
      int a[100000];
      while(cin>>n>>k&&n&&k){
            REP(i,n)cin>>a[i];
            int sum=0;
            REP(i,k)sum+=a[i];
            int ans=sum;
            REP(i,n-k){
                  sum=sum+a[i+k]-a[i];
                  ans=max(ans,sum);
            }
            cout<<ans<<endl;
      }
}

Measured memory_bytes: 1548
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll a,b,c;
  cin>>a>>b>>c;
  ll cnt=0;
  for(int i=1000;i>=1;i--){
    if(a%i==0&&b%i==0)cnt++;
    if(cnt==c){
      cout<<i<<endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
    int a,b,c,d;
    int flagt=0;

    cin >> a >> b >> c >> d;
    while(1){
        c = c - b;
        if(c <= 0) {
            break;
        }
        a = a - d;
        if(a <= 0) {
            flagt=1;
            break;
        }
    }
    if(flagt) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

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

int main() {
  ll N, T;
  cin >> N >> T;
  vector<P> ab(N);
  vector<ll> z;
  REP(i, N) {
    ll a, b;
    cin >> a >> b;
    if (a == 0) {
      z.push_back(b);
    }
    ab[i] = make_pair(a, b);
  }
  sort(ALL(z));
  ll M = SZ(z);
  vector<ll> s(M + 1, 0);
  REP(i, M) { s[i + 1] = s[i] + z[i] + 1; }
  sort(ALL(ab), [&](P p1, P p2) {
    return 1.0 * p1.first / (p1.second + 1) > 1.0 * p2.first / (p2.second + 1);
  });
  ll L = min(40LL, N - M), INF = 1e18;
  vector<vector<ll>> dp(N - M + 1, vector<ll>(L + 1, INF));
  dp[0][0] = 0;
  REP(i, N - M) {
    REP(j, L) {
      if (dp[i][j] == INF) {
        continue;
      }
      chmin(dp[i + 1][j], dp[i][j]);
      ll nt = (dp[i][j] + 1) * (ab[i].first + 1) + ab[i].second;
      if (nt > T) {
        continue;
      }
      chmin(dp[i + 1][j + 1], nt);
    }
  }
  // REP(i, N - M + 1) {
  //   REP(j, L) {
  //     if (dp[i][j] != INF) {
  //       DUMP(i);
  //       DUMP(j);
  //       DUMP(dp[i][j]);
  //     }
  //   }
  // }
  ll ans = 0;
  REP(j, L + 1) {
    if (dp[N - M][j] > T) {
      continue;
    }
    ll cnt = (lower_bound(s.begin() + 1, s.end(), T - dp[N - M][j] + 1) -
              s.begin()) +
             j - 1;
    ans = max(ans, cnt);
  }
  cout << ans << endl;
}

Measured memory_bytes: 73728
s = input()
k = int(input())
ans = 0
s2 = s[0]
for i in range(len(s) - 1):
  if s2[i] == s[i + 1]:
    s2 += '9'
    ans += 1
  else:
    s2 += s[i + 1]
ans = ans * k 
if s2[0] == s2[-1] and len(s) >= 2:
  m = 0
  for i in range(len(s)):
    if s[i] == s2[-1]:
      m += 1
    else:
      break
  if m % 2 == 1:
    ans += k - 1
if len(s) == 1:
  ans = k // 2
if len(list(set(list(s)))) == 1:
  ans = len(s) * k // 2
print(ans)

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

int main(){

 	
  long double L;
  
  cin>>L;
  
  long double a=1.0000000000000000;
    
  a=L/3.0;
  
  cout<<setprecision(9)<<a*a*a<<endl;
  
}

Measured memory_bytes: 256
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y)
	{
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
ll gcd(ll a, ll b)
{
	if (b == 0)return a;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region LCM
ll lcm(ll a, ll b)
{
	return a / gcd(a, b) * b;
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	ll n, d; cin >> n >> d;
	d *= d;
	int res = 0;
	rep(i, n)
	{
		ll x, y; cin >> x >> y;
		if (powl(x, 2) + powl(y, 2) <= d)++res;
	}
	cout << res << endl;
}

Measured memory_bytes: 3616
using System;

namespace Ex160425_1{
    public class Program{
        public static void Main(string[] args){
            string input;
            while((input = Console.ReadLine()) != null){
                var card = Array.ConvertAll(input.Split(','), int.Parse);

                var cnt = 0;
                for(var i = 0; i < 5; i++){
                    for(var j = i + 1; j < 5; j++){
                        if(card[i] == card[j]) cnt++;
                    }
                }

                if(cnt == 0){
                    var straight = true;
                    var start = 1;
                    Array.Sort(card);

                    if(card[0] == 1 && card[4] == 13)
                        start = 2;
                    for(var i = start; i < 5; i++)
                        if(card[i] - card[i - 1] != 1) straight = false;

                    Console.WriteLine(straight ? "straight" : "null");
                } else if(cnt == 1){
                    Console.WriteLine("one pair");
                } else if(cnt == 2){
                    Console.WriteLine("two pair");
                } else if(cnt == 3){
                    Console.WriteLine("three card");
                } else if(cnt == 4){
                    Console.WriteLine("full house");
                } else if(cnt == 6){
                    Console.WriteLine("four card");
                }
            }
        }
    }
}

Measured memory_bytes: 8956
#include<iostream>
#include<vector>
#include<stdlib.h>
#include <math.h>
using namespace std;

long long int Sum(vector<int> A,int i,int j){
  long long int sum=0;
  for(int k=i;k<j;k++){
    sum+=A[k];
  }
  return sum;
}

long long int FIND(vector<int> A,long long int sum){
  double inf=INFINITY;
  long long int left=0;
  long long int min=inf;
  for(int i=0;i<A.size();i++){
    left+=A[i];
    if(min>=llabs(sum-2*left)){
      min=llabs(sum-2*left);
    }else{
      break;
    }
  }
  return min;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long int sum=0;
  int N;
  cin>>N;
  vector<int> A(N);
  for(int i=0;i<A.size();i++){
    cin>>A[i];
    sum+=A[i];
  }
  cout<<FIND(A,sum)<<endl;
  return 0;
  
}


Measured memory_bytes: 1920
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
  static Scanner sc = new Scanner(System.in);
  static int N;

  public static void main(String[] args) {
    N = sc.nextInt();
    ArrayList<ArrayList<Integer>> tree = new ArrayList<>();
    for (int i = 0; i < N; i++) {
      tree.add(new ArrayList<>());
    }
    for (int i = 1; i < N; i++) {
      int A = Integer.parseInt(sc.next()) - 1;
      tree.get(A).add(i);
    }
    ArrayList<Integer> order = new ArrayList<>(N);
    order.add(0);
    for (int i = 0; i < N; i++) {
      order.addAll(tree.get(order.get(i)));
    }
    int[] depth = new int[N];
    for (int i = N - 1; i >= 0; i--) {
      int idx = order.get(i);
      ArrayList<Integer> child = tree.get(idx);
      if (child.isEmpty()) {
        depth[idx] = 0;
        continue;
      }
      int[] d = new int[child.size()];
      for (int j = 0; j < child.size(); j++) {
        d[j] = depth[child.get(j)];
      }
      Arrays.sort(d);
      for (int j = 0; j < d.length; j++) {
        depth[idx] = Math.max(depth[idx], d.length - j + d[j]);
      }
    }
    System.out.println(depth[0]);
  }

}


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

#i%2==0 の時+
cnt=0
sums=0

for i in range(n):
    if i%2==0:
        if sums+a[i]<=0:
            tmp=abs(sums+a[i])+1
            sums=1
            cnt+=tmp
        else:
            sums+=a[i]
            tmp=a[i]
    else:
        #マイナスになってほしい
        if sums+a[i]>=0:
            tmp=abs(sums+a[i])+1
            sums=-1
            cnt+=tmp
        else:
            sums+=a[i]
            tmp=a[i]
    #print(a[i],tmp)

ans=cnt
#print("##############")
#i%2==0 の時+
cnt=0
sums=0

for i in range(n):
    if i%2==1:
        if sums+a[i]<=0:
            tmp=abs(sums+a[i])+1
            sums=1
            cnt+=tmp
        else:
            tmp=a[i]
            sums+=a[i]
    else:
        #マイナスになってほしい
        if sums+a[i]>=0:
            tmp=abs(sums+a[i])+1
            sums=-1
            cnt+=tmp
        else:
            tmp=a[i]
            sums+=a[i]
    #print(a[i],tmp)

print(min(cnt,ans))







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

int main() {
  int N;
  cin>>N;
  int a=0;
  while(N>0){
    N=N/2;
    a++;
  }
  int A=1;
  for(int i=0;i<a;i++){
    A=A*2;
  }
  cout<<A/2<< endl;
}


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

int main()
{
    int A, B, sum=0;
    cin >> A >>B;

    for (int i = 0; i < 2;i++){
        if (A > B)
        {
            sum += A;
            A--;
        }
        else{
            sum += B;
            B--;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
n, m = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]

x.sort()
y = [abs(x2 - x1) for x1, x2 in zip(x[1:], x[:-1])]
y.sort()

if n == 1:
    print(sum(y))
else:
    print(sum(y[:-(n-1)]))

Measured memory_bytes: 13840
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
bonus = 0

for i in range(N-1):
  if A[i+1]==A[i]+1:
    bonus+=C[A[i]-1]

print(sum(B)+bonus)

Measured memory_bytes: 3064
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int n,a[100],x,sum=0;
	cin>>n>>x;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		sum=sum+min(x-a[i],a[i])*2;
	}
	cout<<sum<<endl;
} 

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

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

    cout << N * (N - 1) / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

ll cnt(string s){
    s += 'X';
    ll ret = 0;
    ll same_cnt = 1;
    ll size = s.size();
    REP(i, size-1){
        if (s[i] == s[i+1]){
            same_cnt++;
        } else {
            ret += same_cnt / 2;
            same_cnt = 1;
        }
    }
    return ret;
}



int main(void){
    string s; cin >> s;
    ll k; cin >> k;
    ll size = s.size();
    bool all_same = true;
    ll false_idx = -1;
    REP(i, size-1){
        if (s[i] != s[i+1]) {
            all_same = false;
            false_idx = i;
        }
    }
    if (all_same){
        cout << (size*k) / 2 << endl;
        return 0;
    }
    string mae_s;
    string ato_s;
    for (int i=false_idx+1; i<size; i++){
        ato_s += s[i];
    }
    for (int i=0; i<false_idx+1; i++){
        mae_s += s[i];
    }
    ll ans = 0;
    ans += cnt(ato_s);
    ans += cnt(mae_s);
    dump(s)
    dump(k)
    dump(mae_s)
    dump(cnt(mae_s))
    dump(ato_s)
    dump(cnt(ato_s))
    dump(cnt(ato_s+mae_s))
    dump(ans)
    dump(cnt(ato_s + mae_s) * (k-1))
    ans += cnt(ato_s + mae_s) * (k-1);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
inline void read(int &x){
	x=0;static char ch;static bool flag;flag = false;
	while(ch=getchar(),ch<'!');if(ch == '-') ch=getchar(),flag = true;
	while(x=10*x+ch-'0',ch=getchar(),ch>'!');if(flag) x=-x;
}
#define rg register int
#define rep(i,a,b) for(rg i=(a);i<=(b);++i)
#define per(i,a,b) for(rg i=(a);i>=(b);--i)
const int maxn = 512;
const int zero = 250;
int fa[maxn],siz[maxn],oud[maxn],ind[maxn];bool h[maxn];
int find(int x){return fa[x] == x ? x : fa[x] = find(fa[x]);}
inline void Union(int x,int y){
	x = find(x);y = find(y);
	if(x == y) {++siz[x];return ;}
	fa[x] = y;siz[y] += siz[x] + 1;
}
int main(){
	int n,H;read(n);read(H);
	rep(i,1,H)  fa[i+zero] = i+zero,siz[i+zero] = 1;
	rep(i,-H,-1)fa[i+zero] = i+zero,siz[i+zero] = 1;
	int a,b,c,d;
	rep(i,1,n){
		int x,y;
		read(a);read(b);read(c);read(d);
		if(c == 0) x = a;else x = -c;
		if(d == 0) y = -b;else y = d;
		++ oud[x + zero];++ ind[y + zero];
		Union(x+zero,y+zero);
	}
	rep(i,1,H)  if(oud[i+zero] < ind[i+zero]) return puts("NO"),0;
	rep(i,-H,-1)if(ind[i+zero] < oud[i+zero]) return puts("NO"),0;
	rep(i,1,H)  h[find(i+zero)] |= (ind[i+zero]!=oud[i+zero]);
	rep(i,-H,-1)h[find(i+zero)] |= (ind[i+zero]!=oud[i+zero]);
	rep(i,1,H)  if(siz[find(i+zero)] > 1 && (find(i+zero) == i+zero) && (h[i+zero] == false)) return puts("NO"),0;
	rep(i,-H,-1)if(siz[find(i+zero)] > 1 && (find(i+zero) == i+zero) && (h[i+zero] == false)) return puts("NO"),0;
	puts("YES");
	return 0;
}


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

int main() {
  	long long int N;
  	cin >> N;
  	long long int sum = 0;
  	for (long long int i = 1; i <= N; i++){
      	sum += ((N / i * i) + i) * (N / i) / 2;
    }
  	cout << sum << endl;
}

Measured memory_bytes: 3616
#include <iostream>

constexpr static long long MOD = 1e9 + 7;
constexpr long long fastpow_mod(long long base, unsigned long long exp, long long mod) {
    base %= mod;

    if (exp == 0)
        return 1LL;
    if (exp == 1)
        return base;

    long long pow = 1;
    while (exp > 0) {
        if (exp & 1) {
            pow *= base;
            pow %= mod;
            exp -= 1;
        } else {
            base *= base;
            base %= mod;
            exp >>= 1;
        }
    }

    return pow;
}

int main() {
    std::ios_base::sync_with_stdio(false);

    long long N;
    std::cin >> N;

    if (N == 1) {
        std::cout << 0 << std::endl;
        return 0;
    }

    long long optionsFull = fastpow_mod(10, N, MOD);
    long long optionsWithout0 = fastpow_mod(9, N, MOD);
    long long optionsWithout9 = optionsWithout0;
    long long optionsWithout0And9 = fastpow_mod(8, N, MOD);

    long long solution = (optionsFull - optionsWithout0 + MOD - optionsWithout9 + optionsWithout0And9);
    solution = (solution + MOD) % MOD;

    std::cout << solution << std::endl;
    return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
const int mod = 1000000007;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};
mint comb(int n, int r) {
  if (n - r < r) r = n - r;
  if (r == 0) return 1;
  if (r == 1) return n;
 
  vector<mint> numerator(r, 0), denominator(r, 0);
  for (int k = 0; k < r; k++) {
    numerator[k] = n - r + k + 1;
    denominator[k] = k + 1;
  }
 
  for (int p = 2; p < r + 1; p++) {
    mint pivot = denominator[p - 1];
    if (pivot.x > 1) {
      int offset = (n - r) % p;
      for (int k = p - 1; k < r; k += p) {
        numerator[k - offset] /= pivot;
        denominator[k] /= pivot;
      }
    }
  }
 
  mint res = 1;
  for (int k = 0; k < r; k++) {
    if (numerator[k].x > 1) {
      res *= numerator[k];
    }
  }
  return res;
}

int main() {
  ll x,y;
  cin >> x >> y;
  ll b = (2*x -y)/3;
  ll a = x-2*b;
  mint ans = 0;
  if(a>=0 and b>=0)ans = comb(a+b,a);
  if((a+2*b !=x)|(2*a+b!=y))ans=0;
  cout<<ans.x<<endl;
  return 0;
}

Measured memory_bytes: 8444
#include <bits/stdc++.h>
using namespace std;
long long dp[100][10];
int main()
{
    int n, p, x;
    dp[0][0] = 1, dp[0][1] = 0;
    scanf("%d%d", &n, &p);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &x);
        if (x % 2 == 0) {
            dp[i][0] = dp[i - 1][0] * 2;
            dp[i][1] = dp[i - 1][1] * 2;
        }
        else {
            dp[i][0] = dp[i - 1][1] + dp[i - 1][0];
            dp[i][1] = dp[i - 1][1] + dp[i - 1][0];
        }
    }
    printf("%lld\n", dp[n][p]);
    return 0;
}


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

#define F first
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 55, M = 3, INF = 0x3f3f3f3f;

int n, m;
int a[N];

int main()
{
	cin >> n >> m;
	for (int i = 0; i < n; i ++ ) cin >> a[i];
	
	int res = -INF;
	for (int l = 0; l <= min(n, m); l ++ )
		for (int r = 0; r <= min(n - l, m - l); r ++ )
		{
			int rest = m - l - r;
			vector<int> t;
			for (int i = 0; i < l; i ++ ) t.push_back(a[i]);
			for (int i = n - 1; i >= n - r; i -- ) t.push_back(a[i]);
			sort(t.begin(), t.end());
			
			int sum = 0;
			for (auto u : t)
				if (u < 0 && rest) rest -- ;
				else sum += u;
			res = max(res, sum);
		}
	
	cout << res << endl;
	return 0;
}

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

#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
    int N; cin >> N;
    vector<pair<int64_t, int64_t>> points(N);
    REP(i, N) cin >> points[i].first >> points[i].second;

    vector<vector<int64_t>> f(N);
    REP(i, N) {
        auto [x, y] = points[i];
        f[i] = {x-y, x+y};
    }

    int64_t ans = numeric_limits<int64_t>::min();
    REP(d, 2) {
        auto m1 = numeric_limits<int64_t>::max();
        auto m2 = numeric_limits<int64_t>::min();
        REP(i, N) m1 = min(m1, f[i][d]);
        REP(i, N) m2 = max(m2, f[i][d]);
        ans = max(ans, m2 - m1);
    }
    cout << ans << endl;
}


Measured memory_bytes: 16864
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
	static List<Integer>[] path;
	static int[] dis_u;
	static int[] dis_v;
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int u = sc.nextInt();
		int v = sc.nextInt();
		path = new ArrayList[n + 1];
		dis_u = new int[n + 1];
		dis_v = new int[n + 1];
		if(u == v) {
			System.out.println(0);
			return;
		}

		for(int i = 1 ; i <= n ; i++) {
			path[i] = new ArrayList<>();
		}
		for(int i = 0 ; i < n - 1 ; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			path[a].add(b);
			path[b].add(a);
		}
		Arrays.fill(dis_u, -1);
		Arrays.fill(dis_v, -1);
		dis_u[u] = 0;
		dis_v[v] = 0;

		dfsU(u,n);
		dfsV(v,n);
		int ans  = 0;
		for(int i = 1 ; i <= n ; i++) {
			int uDis = dis_u[i];
			int vDis = dis_v[i];
			if(uDis < vDis) {

					ans = Math.max(ans, dis_v[i] - 1);
			}

		}
		/*for(int i = 1 ; i <= n ; i++) {
			System.out.println(i + ", u : " + dis_u[i] + " v : " + dis_v[i]);
		}*/




		sc.close();
		System.out.println(ans);

	}
	public static void dfsU(int now , int n) {
		List<Integer> edge = path[now];
		int nowDis = dis_u[now];
		for(int ed : edge) {
			if(dis_u[ed] < 0) {
				dis_u[ed] = nowDis + 1;
				dfsU(ed , n);
			}
		}
	}
	public static void dfsV(int now , int n) {
		List<Integer> edge = path[now];
		int nowDis = dis_v[now];
		for(int ed : edge) {
			if(dis_v[ed] < 0) {
				dis_v[ed] = nowDis + 1;
				dfsV(ed , n);
			}
		}
	}

}



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

int main()
{
    string str1;
    string str2 = "abcdefghijklmnopqrstuvwxyz";
    int flag = 0;
    cin >> str1 ;

    for (int i = 0; i < str2.size();i++){
        if (str1.find(str2.at(i)) == std::string::npos)
        {
            cout << str2.at(i) << endl;
            flag = 1;
            break;
        }
    }
    if(flag==0){
        cout << "None" << endl;
    }

}

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

x,y,h=[],[],[]
for i in range(n):
  a,b,c=map(int,input().split())
  x.append(a)
  y.append(b)
  h.append(c)

for i in range(n):
  if h[i]!=0:s=i;break

for cx in range(101):
  for cy in range(101):
    H=h[s]+abs(x[s]-cx)+abs(y[s]-cy)
    for i in range(n):
      if h[i]!=max(0,H-abs(x[i]-cx)-abs(y[i]-cy)):break
      if i==n-1:print(cx,cy,H);exit()

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
using namespace std;
int main() {
    vector<vector<int>> T(3, vector<int>(3, 0));
    for (int i=0; i<3; i++) for (int j=0; j<3; j++) cin>>T[i][j];

    vector<int> a(3, 0), b(3, 0);
    b[0] = T[0][0];
    b[1] = T[0][1];
    b[2] = T[0][2];
    a[1] = T[1][0] - b[0];
    a[2] = T[2][0] - b[0];

    bool flg = true;
    for (int i=0; i<3; i++) {
        for (int j=0; j<3; j++) {
            if (T[i][j] != a[i] + b[j]) {
                flg = false;
                break;
            }
        }
    }

    flg ? cout<<"Yes"<<endl : cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3136
#include <stdio.h>
#include <math.h>

int jiecheng(int n)
{
    int sum = 1;
    for (int i = 1; i <= n; ++i)
        sum *= i;
    return sum;
}

int main(void)
{
    int n, sum = 0;
    scanf("%d", &n);
    int a[2][n], s[2] = {0, 0};
    for (int j = 0; j < 2; ++j)
        for (int i = 0; i < n; ++i)
            scanf("%d", &a[j][i]);
    for (int k = 0; k < 2; ++k)
        for (int i = 0; i < n; ++i)
        {
            s[k] += (a[k][i] - 1) * jiecheng(n - i - 1);
            for (int j = i + 1; j < n; ++j)
                if (a[k][j] > a[k][i])
                    --a[k][j];
        }
    printf("%d\n", abs(s[0] - s[1]));

    return 0;
}

Measured memory_bytes: 256
#ABC 091 B - Two Colors Card Game
import collections
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]
c = collections.Counter(s) - collections.Counter(t)
if not c:
    print(0)
else:
    print(c.most_common()[0][1])

Measured memory_bytes: 3316
#include <stdio.h>
#include <string.h>
int main(void){
	char a[1000000];
	int n,i;
	scanf("%s",a);
	n=strlen(a);
	for(i=0;i<n;i++){
		if(a[i]=='?'){
			a[i]='D';
		}
	}
	printf("%s\n",a);
	return 0;
}

Measured memory_bytes: 1864
N, K = map(int, input().split())
a = list(map(int, input().split()))
tentou = []
tentou_all = []
for i in range(N):
    now = a[i]
    count = 0
    for j in range(i+1, N):
        if now > a[j]:
            count += 1
    tentou.append(count)

for i in range(N):
    now = a[i]
    count = 0
    for j in range(N):
        if now > a[j]:
            count += 1
    tentou_all.append(count)

ans = 0
for i in range(N):
    x = tentou[i] + tentou_all[i]*(K-1)
    y = tentou[i]
    ans += (K*(x+y))//2
    ans %= 1000000007

print(ans)


Measured memory_bytes: 42460
import java.util.Scanner;

public class Main{
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int C = scan.nextInt();
		int D = scan.nextInt();
		String result = "Yes";
		int numT=C/B;
		if(C%B>0) {
			numT++;
		}
		int numA=A/D;
		if(A%D>0) {
			numA++;
		}
		if(numT>numA) {
			result="No";
		}		

		System.out.println(result);
	}
}

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

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

int main() {
    string S;
    cin >> S;

    int cnt = 0;
    bool w = true;
    rep (i, 3) {
        if (w) {
            if (S[i] == (char)'R') {
                cnt++;
            } else {
                continue;
            }
            w = false;
        }
        if ((S[i] == (char)'R') && (S[i+1] == (char)'R')) {
            cnt++;
            } else {
                continue;
            }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define ll long long
#define MOD 1000000007

using namespace std;

ll mypow(int c) {
  ll o = 1, b = 2;
  while(c) {
    if(c & 1)
      o = o * b % MOD;
    c = c / 2;
    b = b * b % MOD;
  }
  return o;
}

int main() {
  ll n, o = 0;
  cin >> n;
  vector<ll> c(n);
  for(int i = 0; i < n; i++)
    cin >> c.at(i);
  sort(c.begin(), c.end());
  for(int i = 0; i < n; i++)
    o = (o + (n + 1 - i) * c.at(i) % MOD) % MOD;
  cout << mypow(2 * n - 2) * o % MOD << endl;
}

Measured memory_bytes: 1792
//AUTHOR:BlackBox Inc.//
#include<bits/stdc++.h>
#include<unordered_map>
#include<tr1/unordered_map>
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vlli vector<long long int>
#define vvi vector<vector<int>>
#define vpii vector<pair<int,int>>
#define vs vector<string>
#define lin1(x) ll int x; x = scan();
#define lin2(x,y) ll int x, y; x = scan(), y = scan();
#define lin3(x,y,z) ll int x, y, z; x = scan(), y = scan(), z = scan();
#define pb(x) push_back(x)
#define makep(x,y) make_pair(x,y)
#define mx(a,b) (a)>(b)?(a):(b)
#define mn(a,b) (a)<(b)?(a):(b)
#define fori(s,e) for(i=s;i<=e;i++)
#define forj(s,e) for(j=s;j<=e;j++)
#define fork(s,e) for(k=s;k<=e;k++)
#define rep(i,s,e) for(int i=s;i<=e;i++)
#define brep(i,s,e) for(int i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x));
#define bits1(x) __builtin_popcount(x)
#define pi 3.14159265358979323846264338327950
#define MOD7 1000000007
#define MOD9 1000000009
#define fast std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
using namespace std::tr1;

int main()
{
#ifdef RAHUL
    freopen("input.txt","r",stdin);
#endif


ll t;
cin >>t;

cout<<t*t*t<<"\n";


return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ff        first
#define ss        second
#define ll        long long
#define int       long long
#define inf       ((ll)1e18)
#define mod       1000000007
#define double    long double
#define ull       unsigned long long
#define vi        vector<ll>
#define ppi       pair<int,int>
#define pii       pair<pair<int,int>,int>
#define pb        push_back
#define pi        2*acos(0.0)
#define rev       greater<int>()
#define pr(a,x,y) for(int i=x;i<y;i++){cout<<a[i]<<" ";}
#define ps(s)     for(auto i:s){cout<<i<<" ";}
#define sp(x,y)   fixed<<setprecision(y)<<x
#define w(x)      ll x; cin>>x; while(x--)
#define all(v)    v.begin(), v.end()
#define rall(v)   v.rbegin(), v.rend()
#define test      cout<<"This is test"<<endl;
#define str       string
#define endl      '\n'
#define e         cout<<'\n';
void kehsihba(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	/*#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif*/
}
void solve(){
	ll n;cin>>n;
	vi v(n,0);
	for(int i=0;i<n;i++){v[i]=i+1;}
	vi a(n,0);
	vi b(n,0);
	for(auto &x:a){cin>>x;}
	for(auto &x:b){cin>>x;}
	int x=-1,y=-1;
	int i=1;
	do{
		if(a==v){x=i;}
		if(b==v){y=i;}
		i++;
	}while(next_permutation(all(v)));
	cout<<abs(x-y);
}
int32_t main(){
	kehsihba();
	//init();
	ll t=1;
	//cin>>t;
	for(int k=1;k<=t;k++){
		//cout<<"Case "<<k<<": ";
		solve();
		//e;
	}
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int MOD = 1000000007;
//const int MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const double pi = acos(-1.0);
const double EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

struct update{
    int j, k, res;
    update(int j, int k, int res) : j(j), k(k), res(res) {}
};

int main(){
    int N;
    cin >> N;
    int A[3*N+2];
    rep(i, 3*N) cin >> A[i];
    A[3*N] = A[3*N+1] = 0;

    int dp[N+1][N+1];
    rep(i, N+1) rep(j, N+1) dp[i][j] = -inf;
    dp[A[0]][A[1]] = 0;
    int M = 0, base = 0;
    int Mx[N+1], My[N+1];
    fill(Mx, Mx+N+1, -inf), fill(My, My+N+1, -inf);
    rep(i, N+1){
        rep(j, N+1){
            chmax(Mx[i], dp[i][j]), chmax(My[j], dp[i][j]);
        }
    }
    queue<update> que;

    rep(i, N){
        int b[] = {A[3*i+2], A[3*i+3], A[3*i+4]};
        if(b[0] == b[1] && b[1] == b[2]) {base++; continue;}
        rep(p, 3){
            int q = (p+1)%3, r = (q+1)%3;
            rep(j, N+1){
                que.emplace(j, b[p], max(Mx[j], My[j]));
            }
            if(b[q] == b[r]){
                int k = b[q];
                rep(j, N+1){
                    que.emplace(j, b[p], dp[j][k]+1), que.emplace(j, b[p], dp[k][j]+1);
                }
            }
            que.emplace(b[q], b[r], max(M, dp[b[p]][b[p]]+1));
        }
        while(!que.empty()){
            update e = que.front(); que.pop();
            if(chmax(dp[e.j][e.k], e.res)){
                chmax(M, e.res);
                chmax(Mx[e.j], e.res), chmax(My[e.k], e.res);
            }
        }
    }
    cout << M+base << endl;
}

Measured memory_bytes: 19436
#include <stdio.h>

int main(void) {
   int  N,A,B,C,D,price_X,price_Y,mod;
   scanf( "%d %d %d %d %d" , &N,&A,&B,&C,&D );
   mod=( N%A != 0 );
   price_X=(N/A+mod)*B;
   mod=( N%C != 0 );
   price_Y=(N/C+mod)*D;
   if( price_X < price_Y ){
	 printf("%d\n" , price_X);
      }else{
    	 printf("%d\n" , price_Y);
      }
   return 0;
}



Measured memory_bytes: 2124
//  ROAD TO GREEN
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>

#define ll long long
#define uint unsigned int
#define ull unsigned ll
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define for(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)

using namespace std;
int n,m,q,k;
string s;
const ll MAXN = 2e5+2;
vector<bool> used(MAXN,false);



int main(){
   cin >> n >> m;
   for(i,m-n+1,m+n-1){
       cout << i << " ";
   } 
    return 0;
}

Measured memory_bytes: 256
maxn = 100000

n , m , k = map(int, input().split())

par = [0] * (n+1)
rank = [0] * (n+1)

#初期化
for i in range(n+1):
    par[i] = i
    rank[i] = 0

#判定(一番上野根を求める)
def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
    
#結合
def unite(x , y):
    rx = find(x)
    ry = find(y)
    
    if rx == ry:
        return
    
    if rank[rx] < rank[ry]:
        par[rx] = ry
    elif rank[rx] > rank[ry]:
        par[ry] = rx
    else:
        par[ry] = x
        rank[rx] += 1

a = [0]*m
b = [0]*m
        
for i in range(m):
    a[i] ,b[i]  = map(int, input().split())
    unite(a[i] ,b[i] )
    
from collections import Counter
par2 = [find(i) for i in range(n+1)]
s = Counter(par2)
ans = [s[i] for i in par2]

for i in range(m):
    ans[a[i]] -= 1
    ans[b[i]] -= 1

for _ in range(k):
    c,d = map(int, input().split())
    if find(c) == find(d):
        ans[c] -= 1
        ans[d] -= 1

ans = [ans[j]-1 for j in range(1,n+1)]
print(*ans)

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

using namespace std;

map <int, int> dem;
int x, n, id, id1;
vector <int> v;
long long res;

bool cmp(int x, int y){
    return x == y;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("test.inp", "r", stdin);
//    freopen("test.out", "w", stdout);
    cin >> n;
    for (int i = 1; i <= n; i++){
        cin >> x;
        v.push_back(x);
        dem[x]++;
    }
    sort(v.begin(), v.end());
    vector<int>::iterator it;
    it = unique(v.begin(), v.end(), cmp);
    v.resize(distance(v.begin(), it));
    for (auto x: v)
        if (dem[x] >= 4)
            res = max(res, 1LL * x * x);
    for (auto x: v)
        if (dem[x] > 1)
            id = max(id, x);
    for (auto x: v)
        if (x != id && dem[x] > 1)
            id1 = max(id1, x);
    cout << max(res, 1LL * id * id1);
}


Measured memory_bytes: 5368
n,m = map(int,input().split())
from1_ls = []
togoal_ls = []
for i in range(m):
    a,b = map(int,input().split())
    if a == 1:
        from1_ls.append(b)
    if b == n:
        togoal_ls.append(a)
set_from = set(from1_ls)
set_to = set(togoal_ls)
intersection = set_from & set_to
ans = 'IMPOSSIBLE'
if intersection:
    ans = 'POSSIBLE'
print(ans)

Measured memory_bytes: 21844
#include <iostream>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
#include <complex>
#include <random>
#include <bitset>
#include <list>
// #include <prettyprint.hpp>
using namespace std;
#define repi(i,n) for(int i=0;i<n;++i)
#define rep(i,n) for(ll i=0;i<n;++i)
#define repinvi(i,n) for(int i=n-1;i>=0;--i)
#define sll(n) scanf("%lld", &n);
#define sii(n) scanf("%d", &n);
#define slf(n) scanf("%lf", &n);
#define pll pair<ll,ll>
#define pii pair<int,int>
#define psi pair<si,si>
typedef long long ll;
typedef double lf;
typedef short int si;


void Main(){
    ll a;
    sll(a);
    cout << a + a*a + a*a*a<<endl;

}

int main(){
    Main();
}

Measured memory_bytes: 3292
S = input()

flag = 'Yes'

for s in range(len(S)):
    if S[s] != "U" and S[s] != "D":
        if s%2 == 0 and S[s] != "R":
            flag = 'No'
            break
        elif s%2 == 1 and S[s] != "L":
            flag = 'No'
            break

print(flag)

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

#define int long long
#define PB push_back
#define PPB pop_back
#define ALL(X) (X).begin(),(X).end()
typedef pair<int, int> pii;

static const int INF = 1LL << 61;
//static const int MAX_N = 100005;

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

    string S;
    cin >> S;
    bool n = false, w = false, s = false, e = false;
    for (int i = 0; i < S.size(); ++i) {
        switch(S[i]) {
        case 'N':
            n = true;
            break;
        case 'S':
            s = true;
            break;
        case 'W':
            w = true;
            break;
        case 'E':
            e = true;
        }
    }

    if (n ^ s || w ^ e) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
int transform(char x)
{
	if(x == '.')
	{
		return 1;
	}
	else
	{
		return 0;
	}
}
int main()
{
	int n,m;
	int a[51][51];
	int b[51][51];
	char x;
	cin >> n >> m;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			cin >> x;
			a[i][j] = transform(x);
		}
	}
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<m;j++)
		{
			cin >> x;
			b[i][j] = transform(x);
		}
	}
	for(int i=0;i<=(n-m);i++)
	{
		for(int j=0;j<=(n-m);j++)
		{
			for(int k=0;k<m;k++)
			{
				for(int l=0;l<m;l++)
				{
					if(a[i+k][j+l] != b[k][l])
					{
						goto exit;
					}
				}
			}
			cout << "Yes" << endl;
			return 0;
			exit:
			;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
	int x, y;
	int i;

	scanf("%d %d", &x, &y);
	for(i=0;i<3000;i++){
		if (x == 0 && y == 0){
			break;
		}
		if (x <= y){
			printf("%d %d\n", x, y);
		}
		else if(y <= x){
			printf("%d %d\n", y, x);
		}
		scanf("%d %d", &x, &y);
	}
	
	return 0;
}

Measured memory_bytes: 596
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


class BIT:
    """ 1-indexで使用しないと無限ループするので注意 """
    def __init__(self, n):
        self.n = n
        self.bit = [0] * (n + 1)

    def update(self, idx, x):
        """ idx番目にxをO(logN)で加算する """
        while idx <= self.n:
            self.bit[idx] += x
            idx += idx & (-idx)

    def query(self, idx):
        """ 1 ~ idx番目までの区間和をO(logN)で返す """
        res = 0
        while idx > 0:
            res += self.bit[idx]
            idx -= idx & (-idx)
        return res

    def sec_sum(self, left, right):
        """ left ~ right番目までの区間和をO(logN)で返す """
        return self.query(right) - self.query(left - 1)

    def lower_bound(self, w):
        """ 区間和がw以上になる最小のindexをO(logN)で返す """
        if w <= 0:
            return 0
        x = 0
        k = 1 << self.n.bit_length()
        while k:
            if x + k <= self.n and self.bit[x + k] < w:
                w -= self.bit[x + k]
                x += k
            k //= 2
        return x + 1

    def debug(self):
        """ bitの状態を出力する """
        print(*[self.sec_sum(i, i) for i in range(1, self.n + 1)])


def resolve():
    n, q = map(int, input().split())
    A = list(map(int, input().split()))
    bit = BIT(n)
    for i in range(1, n + 1):
        bit.update(i, A[i - 1])

    for _ in range(q):
        t, *query = map(int, input().split())
        if t == 0:
            p, x = query
            bit.update(p + 1, x)
        else:
            l, r = query
            print(bit.sec_sum(l + 1, r))


if __name__ == '__main__':
    resolve()


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

const long long inf = 1e15 + 7;

long long get_sum(vector<long long> &prefix, int left, int right)
{
	if(left != 0)
		return prefix[right] - prefix[left-1];
	else
		return prefix[right];
}

void Slimes(vector<long long> &a)
{
	int n = a.size();
	vector<long long> prefix = a;
	
	for(int i = 1; i < n; i++)
		prefix[i] += prefix[i-1];

	vector<vector<long long>> dp(n, vector<long long>(n, inf));

	/* dp[i][j] represents the min cost to compress arr[i...j] to 
	 * a single element
	 */

	for(int i = n - 1; i >= 0; i--)
	{
		for(int j = i; j < n; j++)
		{
			if(i == j)
			{
				dp[i][j] = 0;
				continue;
			}

			for(int k = i; k < j; k++)
			{
				auto current_cost = get_sum(prefix, i, j);
				dp[i][j] = min(dp[i][j], dp[i][k] + dp[k+1][j] + current_cost);
			}
		}
	}

	cout << dp[0][n-1] << endl;
}

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

	vector<long long> a(n);
	for(auto &ele : a)
		cin >> ele;

	Slimes(a);
	return 0;
}



Measured memory_bytes: 4824
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
  ll N;
  cin>>N;
  ll ans=N+54;
  for(ll i=1;i*i<=N;i++){
    if(N%i==0){
      ans=min(ans,i+N/i);
    }
  }
  cout<<ans-2<<endl;
}

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

int main(){
    char c;
    cin >> c;
    if(c=='o') cout << "vowel" << endl;
    else if(c=='a') cout << "vowel" << endl;
    else if(c=='i') cout << "vowel" << endl;
    else if(c=='u') cout << "vowel" << endl;
    else if(c=='e') cout << "vowel" << endl;
    else cout << "consonant" << endl;
}


Measured memory_bytes: 256