akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <map>
#include <utility>
using namespace std;
typedef pair<int,int> pi;
#define F first
#define S second
#define MP make_pair
int main(){
    int n,ans=0;
    long long int now=0,temp;
    map<long long int,int> m;
    scanf("%d",&n);
    m.insert(MP(0,-1));
    for(int i=0;i<n;i++){
        scanf("%lld",&temp);
        now+=temp;
        if(m.find(now)==m.end())m.insert(MP(now,i));
        else ans=max(ans,i-m[now]);
    }
    printf("%d\n",ans);
}



Measured memory_bytes: 15256
import std.stdio, std.string, std.conv, std.algorithm, std.range;

void main() {
    int n = readln.chomp.to!int;
    int[] a = new int[n];
    foreach (i; 0 .. n) {
        a[i] = readln.chomp.to!int;
    }
    int[] b = a.dup.sort!("a > b").array;
    foreach (x; a) {
        if (x != b[0]) b[0].writeln;
        else b[1].writeln;
    }
}

Measured memory_bytes: 6524
#include<bits/stdc++.h>
using namespace std;
#define itn int

int main(void){
    int A,B,m;
    cin >> A >> B >> m;
    int a[A],b[B],x[m],y[m],c[m];
    for(int i = 0;i < A;i++)cin >> a[i];
    for(int i = 0;i < B;i++)cin >> b[i];
    for(int i = 0;i < m;i++)cin >> x[i] >> y[i] >> c[i];
    
    int sum = 1e9;
    for(int i = 0;i < m;i++){
        int num = (a[x[i]-1]+b[y[i]-1]-c[i]);
        sum = min(sum,num);
    }
    sort(a,a+A);
    sort(b,b+B);
    sum = min(sum,a[0]+b[0]);
    cout << sum << endl;
}

Measured memory_bytes: 2176
<?php
list($H, $W) = explode(' ', trim(fgets(STDIN)));
$image = [];
for ($i = 0; $i < $H; $i++) {
    $image[] = trim(fgets(STDIN));
}

for ($i = 0; $i < $H; $i++) {
    echo $image[$i] . "\n";
    echo $image[$i] . "\n";
}

Measured memory_bytes: 3576
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e9 + 7;
const ll MOD = 1e9 + 7;

map<int, int> table;

void prime_facter(int n){
	for (int i = 2; i*i <= n; i++){
		while (n%i == 0){
			++table[i];
			n /= i;
		}
	}
	if (n != 1)table[n]++;
}

int n;

int main(){
	cin >> n;
	FOR(i, 2, n + 1){
		prime_facter(i);
	}
	ll ans = 1;
	FOR(i, 2, n + 1){
		ans *= (table[i] + 1);
		ans %= INF;
	}
	cout << ans << endl;
}

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

long long MOD = 1e9+7;
int MAX_INT = 1e9;

long long gcd(long long a, long long b){
  if(b == 0) return a;
  return gcd(b, a % b);
}

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

  long long N, D;
  cin >> N >> D;
  long long cnt = 0;
  long long dist = D * D;

  for(int i = 0; i < N; i++) {
    long long X, Y;
    cin >> X >> Y;
    long long point = (X * X) + (Y * Y);
    if(dist >= point) {
      // cout << D << " : " << dist << "::"<< point << endl;
      cnt++;
    }
  }

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int N=100010,Mo=1000000007;
int inv[N];
inline int gi() {
    int x=0,o=1;
    char ch=getchar();
    while(ch<'0'||ch>'9') ch=='-'?o=-1:0,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return o*x;
}
int main() {
    int n,sum=1,ans=0;
    cin>>n;
    inv[1]=1;
    for(int i=2;i<=n;i++)
	inv[i]=-1LL*Mo/i*inv[Mo%i]%Mo,sum=(sum+inv[i])%Mo;
    for(int i=1;i<=n;i++) {
	ans=(ans+1LL*sum*gi())%Mo;
	sum=(1LL*sum-inv[n-i+1]+inv[i+1])%Mo;
    }
    for(int i=1;i<=n;i++) ans=1LL*ans*i%Mo;
    cout<<(ans+Mo)%Mo;
    return 0;
}

Measured memory_bytes: 640
import java.util.*;
class Main
{
	public static void main(String args[])
	{
		Scanner input = new Scanner(System.in);
		int a, b, c;
		a = input.nextInt();
		b = input.nextInt();
		c = input.nextInt();
		if(((a < c && b > c) || (a > c && b < c)))
		{
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
string s,t;
  cin>>N>>s>>t;
  int ans=2*N;
  for(int i=0;i<N;i++){
    bool x=true;
  for(int j=0;j<N-i;j++){
  if(t.at(j)!=s.at(i+j)){
   x=false; break;
  }
   }if(x){
  s.erase(i);
    ans=i+N; break;
  }
  
  }cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

int main(void){

	int n;
	char s1[] = "Christmas";
	char s2[] = "Christmas Eve";
	char s3[] = "Christmas Eve Eve";
	char s4[] = "Christmas Eve Eve Eve";

	scanf("%d",&n);

	switch(n){
		case 25:
			printf("%s",s1);
			break;
		case 24:
			printf("%s",s2);
			break;
		case 23:
			printf("%s",s3);
			break;
		case 22:
			printf("%s",s4);
			break;
	}
	
	return 0;
}

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

typedef long long ll;
const ll mod = 1e9+7;

ll mod_pow(ll x,ll n){
  ll res=1;
  while(n){
    if(n%2) res=res*x%mod;
    x=x*x%mod;
    n/=2;
  }
  return res;
}

ll factorial(int i){
  static vector<ll> k(1e6);
  if(!k[0]){k[0]=1;for(int i=1;i<(int)k.size();i++)k[i]=i*k[i-1]%mod;}
  return k[i];
}

ll nCr(ll n,ll r){
  ll a = mod_pow( factorial(r) * factorial(n-r) % mod ,mod-2);
  return factorial(n) * a % mod;
}

int n, m, sum[3005];
string s;
vector<int> L, R;

void init(){
  for(int i=0;i<n;i++){
    sum[i] = s[i] == '1';
    if(i) sum[i] += sum[i-1];
  }
}

int get(int l, int r){
  int res = sum[r];
  if( l != 0 ) res -= sum[l-1];
  return res;
}

int memo[3005][3005], used[3005][3005];

int dfs(int x, int cnt1, int cnt0){
    
  if( cnt0 + cnt1 ){
    
    int l = R[x-1] + 1, r = R[x];
    
    int c1 = get( l, r );
    int c0 = r - l + 1 - c1;
    
    cnt1 += c1;
    cnt0 += c0;
    
  }else{
    
    cnt1 = get( L[x], R[x] );
    cnt0 = R[x] - L[x] + 1 - cnt1;
    
  }
  
  if( used[x][cnt1]++ ) return memo[x][cnt1];
    
  int l = L[x], r = R[x];
  
  if( x == (int)L.size() - 1 ){
    return memo[x][cnt1] = nCr( r - l + 1, cnt0 );
  }
  
  if( R[x] < L[x+1] ){
    return memo[x][cnt1] = nCr( r - l + 1, cnt0 ) * dfs( x + 1, 0, 0 ) % mod;
  }
  
  r = L[x+1] - 1;
  
  int res = 0;
  
  for(int i=0;i<=r-l+1;i++){
    
    int ncnt1 = cnt1 - i;
    int ncnt0 = cnt0 - ( r - l + 1 - i );
    
    if( ncnt1 < 0 || ncnt0 < 0 ) continue;
    
    res += nCr( r - l + 1, i ) * dfs( x + 1, ncnt1, ncnt0 ) % mod;
    res %= mod;
  }
  
  return memo[x][cnt1] = res;
}

int main(){
  
  cin>>n>>m;
  cin>>s;
  
  for(int i=0;i<m;i++){
    
    int l, r;
    cin>>l>>r;
    l--, r--;
    
    if(i){
      int idx = L.size()-1;
      if( L[idx] == l ) R[idx] = max( R[idx], r );
      if( R[idx] < r ){
	L.push_back(l);
	R.push_back(r);
      }
    }else{
      L.push_back(l);
      R.push_back(r);
    }
    
  }
  
  init();
      
  cout << dfs( 0, 0, 0 ) << endl;
    
  return 0;
}


Measured memory_bytes: 39680
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int a = in.nextInt();
            int b = in.nextInt();
            System.out.println(b % a == 0 ? a + b : b - a);
        }
    }
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;

  int N, K;
  cin >> N >> K;
  long double ans = 0;
  long double Max = 0;
  vector<long double> p(N);
  for(int i = 0; i < N; i++){
    long double pi;
    cin >> pi;
    p.at(i) = (pi + 1) / 2;
  }
  for(int i = 0; i < N; i++){
    ans += p.at(i);
    if(i > (K - 1)){
      ans -= p.at(i - K);
    }
    if(ans > Max){
      Max = ans;
    }
  }
  cout << Max <<endl;
}

Measured memory_bytes: 3456
using System;

namespace abc138A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int a = Int32.Parse(Console.ReadLine());
            string b = Console.ReadLine();
            if (a >= 3200)
                Console.WriteLine(b);
            else
                Console.WriteLine("red");
        }
    }
}


Measured memory_bytes: 13140
N = int(input())
a = map(int, input().split())
a = list(a)

alice = 0
bob = 0


while(N !=0) :
    
        
        maxa = max(a)
        max_index = a.index(max(a))
        del a[max_index]

        alice = alice + maxa
        N = N -1

        if (N == 0):
            break
    
        
        
        maxa = max(a)
        max_index = a.index(max(a))
        del a[max_index]

        bob = bob + maxa
        N = N -1

print(alice - bob)

Measured memory_bytes: 3064
n = int(input())
shogen =[]
for i in range(n):
    a = int(input())
    shogen.append([])
    for j in range(a):
        x,y =map(int,input().split())
        x -= 1
        shogen[-1].append((x,y))

def is_honest(i,j):
    return(i >> j)%2 ==1

def honest_cnt(i):
    ans = 0
    for j in range(n):
        ans += is_honest(i,j)
    return ans

ans= 0
for i in range(1<<n):
    bl = True
    for j in range(n):
        if not is_honest(i,j):
            continue
        for (x,y) in shogen[j]:
            if y==0 and is_honest(i,x):
                bl = False
            if y==1 and not is_honest(i,x):
                bl = False
    if bl:
        ans=max(ans,honest_cnt(i))
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <cmath>
#include <limits>
#include <utility>
#include <map>
#include <iomanip>
#include <queue>
#include <cctype>
#include <stack>


#define rep(p,q) for(int i = p;i < q;i++)
#define ll long long

using namespace std;

//126 D

int main(void) {
	vector<vector<pair<int,ll>>> graph = vector<vector<pair<int,ll>>>(100000);
	vector<int> vColor = vector<int>(100000);
	int n;
	cin >> n;
	rep(0, n)vColor[i] = 2;
	rep(0, n - 1) {
		int u, v, w;
		cin >> u >> v >> w;
		graph[u - 1].push_back(make_pair(v - 1, w));
		graph[v - 1].push_back(make_pair(u - 1, w));
	}
	stack<pair<int, ll>>stk = stack<pair<int, ll>>();
	rep(0, graph[0].size())stk.push(graph[0][i]);
	vColor[0] = 0;
	while (stk.size() > 0) {
		pair<int, ll> p = stk.top();
		stk.pop();
		int v = p.first;
		if (p.second % 2 == 0)vColor[v] = 0;
		else vColor[v] = 1;
		vector<pair<int, ll>> nbr = graph[v];
		rep(0, nbr.size()) {
			if (vColor[nbr[i].first] == 2)stk.push(make_pair(nbr[i].first,nbr[i].second + p.second));
		}
	}
	rep(0, n) {
		cout << vColor[i] << endl;
	}
}


Measured memory_bytes: 8320
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)
const ll mod = 1e9+7;
int main(){
  int n;
  cin >> n;
  vector<ll> v(n);
  vector<ll> csum(n+1);
  rep(i,n) cin >> v[i];
  rep(i,n+1){
    if (i == 0) continue;
    else csum[i] = (csum[i-1] + v[i-1])%mod;
  }
  ll ans = 0;
  int id = 1;
  rep(i,n-1){
    ll tmp = (v[i]*csum[n])%mod - (v[i]*csum[id])%mod;
    if (tmp < 0) tmp+=mod; 
    ans += tmp;
    ans %=mod;
    id++;
  }
   cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6340
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define vv(T) std::vector<std::vector<T>>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;

int		main(void)
{
	string S, T;
	cin >> S >> T;

	int ans = 0;
	for (int i = 0; i < (int)(S.size() - T.size()) + 1; i++)
	{
		int cnt = 0;
		for (int j = 0; j < (int)T.size(); j++)
		{
			if (S[i+j] == T[j])
				cnt++;
		}
		ans = max(ans, cnt);
	}
	cout << T.size() - ans << endl;
}



Measured memory_bytes: 3612
n,m=map(int,input().split())
h=list(map(int,input().split()))
ans=[1]*n
for i in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  if h[a]>h[b]:ans[b]=0
  elif h[a]<h[b]:ans[a]=0
  if h[a]==h[b]:ans[a]=ans[b]=0
print(ans.count(1))

Measured memory_bytes: 20128
#include <iostream>
#include <string>
#include <unordered_map>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	int n, p;
	cin>>n>>p;
	string s;
	cin>>s;
	long res = 0;
	if (p == 2 || p == 5) {
		for (int i = 0; i < n; i++) {
			if ((s[i] - '0') % p == 0) {
				res += i + 1;
			}
		}
		cout<<res<<endl;
		return 0;
	}
	unordered_map<int, int> mp;
	mp[0] = 1;
	long lastten = 1;
	long last = 0;
	for (int i = n-1; i >= 0; i--) {
		long cur = ((s[i]-'0')*lastten+last) % p;
		last = cur;
		lastten = lastten * 10 % p;
		auto it = mp.find(cur);
		if (it == mp.end()) {
			mp[cur] = 1;
		} else {
			res += it->second;
			it->second++;
		}
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 916
//#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
//using namespace __gnu_pbds;
//template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;



  #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 

  #define ff first
  #define ss second
  #define pb push_back
  #define pf push_front
  #define mp make_pair
  #define in insert
  #define ld long double


  #define TRACE
  #ifdef TRACE
  #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
  template <typename Arg1>
  void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
  }
  template <typename Arg1, typename... Args>
  void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
  }
  #else
  #define trace(...) 1
  #endif
  template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
  template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
  template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
  typedef long long int ll;

  typedef vector<int> vi;
  typedef vector<ll> vl;
  typedef vector<vi> vvi;
  typedef vector<vl> vvl;
  typedef pair<int,int> pii;
  typedef pair<ll,ll> pll;
  typedef vector<pii> vpii;
  typedef vector<pll> vpll;
  const ll mod =1e9+7;
  const ll MAX_NODES =200001;
  const ll MAX_LOG =50;
  const ll maxn = 400000+10;
  #define endl '\n'
  ll power(ll x, ll n) {
      ll res = 1;
      for (; n > 0; n >>= 1) {
      if (n & 1) res = (res * x) % mod;
      x = (x * x) % mod;
      }
      return res;
  }
int main()
{

	IOS
	int n;
	map<int,pair<int,int>> rm;
	int a[4][4];
	for(int i = 1;i<=3;i++)
	{
		for(int j = 1;j<=3;j++)
		cin>>a[i][j],rm[a[i][j]] = {i,j};
	}
	cin>>n;
	int b[n+1];
	int cnt[4] = {0},cnt1[4] = {0},cnt2 = 0,cnt3= 0;
	for(int i = 1;i<=n;i++)
	{
		cin>>b[i];
		if(rm.count(b[i]))
		{
			cnt[rm[b[i]].ff]++;
			cnt1[rm[b[i]].ss]++;
			if(rm[b[i]].ff - rm[b[i]].ss  == 0)
				cnt2++;
			if(rm[b[i]].ff + rm[b[i]].ss  == 4)
				cnt3++;
			
		}
	}
	for(int i = 1;i<=3;i++)
	{
		if(cnt[i] == 3 || cnt1[i] == 3)
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	if(cnt2==3||cnt3==3)
	{
		cout<<"Yes"<<endl;
		return 0;
	}
	else
	{
		cout<<"No"<<endl;
	}
	


}
 
  


  
  




Measured memory_bytes: 256
n,m=map(int,input().split())
c=[[] for _ in range(n)]
for i in range(m):
    p,y=map(int,input().split())
    c[p-1].append([i,y])
ans=[0]*m
for i in range(n):
    c[i].sort(key=lambda x:x[1])
    for j in range(len(c[i])):
        ID=str(i+1).zfill(6)+str(j+1).zfill(6)
        ans[c[i][j][0]]=ID
print(*ans,sep="\n")

Measured memory_bytes: 41980
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
    
using namespace std;    
typedef long long ll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

ll digitSum(ll n){

    ll sum = 0;
    while(n > 0){
        sum += n % 10;
        n = n / 10;
    }
    return sum;
}

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

    if(N % digitSum(N) == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m; i<n; i++)
#define co(n) cout << n << endl
using namespace std;
int main(){
  long a, b, c=0, d=0, e, f, g, h, n;
  cin >> a >> b;
  if(a==1) co(b);
  else{
    c=b*pow(b-1, a-1);
    co(c);
  }
  
      
  
  return 0;
}

Measured memory_bytes: 256
def main():
  n = int(input())
  ans = []
  flg = 1
  for i in range(1,n+1):
    flg = 1
    anstmp = 0
    for x in range(1,int(i**0.5+1)):
      if flg == 0:
        break
      for y in range(x,int(i**0.5+1)):
        if i-(x**2+y**2+x*y) > x+y:
          j = i-(x**2+y**2+x*y)
          z = int((j+(x+y)**2/4)**0.5-(x+y)/2+0.5)
          if (x+y+z)*z == j:
            if x < y:
              anstmp += 2
            else:
              anstmp += 1
        elif y == 1:
          flg = 0
          break
        else:
          break
    ans.append(anstmp)
  print(*ans,sep="\n")
main()

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

using namespace std;

int main(){
  int n; cin >> n;
  int ans=0;
  int count=0;
  vector<long long> h(n);
  for(int i=0;i<n;i++){
    cin >> h[i];
  }
  for(int i=0;i<n-1;i++){
    if(h[i+1]<=h[i]){
      count++;
      ans=max(ans,count);
    }
    else if(h[i+1]>h[i]){
      ans=max(ans,count);
      count=0;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

int main() {
    int n;
    double m;
    cin >> n >> m;
    double a[n];
    int sum = 0;
    for(int i = 0;i < n;i++){
        cin >> a[i];
        sum += a[i];
    }
    
    double x = 1 / (4.0*m);
    
    int cnt = 0;
    for(int i = 0;i < n;i++){
        if(a[i]/sum >= x){
            cnt++;
       }
    }
    
    if(cnt >= m){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}



Measured memory_bytes: 256
<?php

function input($func = null) {
    if ($func === null) {
        return trim(fgets(STDIN));
    } else {
        return $func(trim(fgets(STDIN)));
    }
}
function input_array($func = null) {
    if ($func === null) {
        return explode(' ', trim(fgets(STDIN)));
    } else {
        return array_map(function($v) use ($func) {
            return $func($v);
        }, explode(' ', trim(fgets(STDIN))));
    }
}

$n = input('intval');
$a = input('strval');
$b = input('strval');
$c = input('strval');

$total_count = 0;
for ($i = 0; $i < $n; $i++) {
    $total_count += count(array_unique([$a[$i], $b[$i], $c[$i]]));
    $total_count--;
}

echo "{$total_count}\n";


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

#define cn count
#define pb push_back
#define in insert
#define fs first
#define sc second
#define sz size
#define len length
#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define forni(i, n) for (ll i = 1; i < (ll) (n); ++i)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;
using ll = long long;
const ll inf = 1e9+7; 
const double PI =  3.141592653589793;

int main(){
	IO;
	ll k,x;
	cin>>k>>x;
	vector<ll>ans;
	forni(i,k){
		ans.pb(x-i);
	}
	ans.pb(x);
	forni(i,k){
		ans.pb(x+i);
	}
	sort(ans.begin(),ans.end());
	forn(i,ans.sz()){
		cout<<ans[i];
		(i!=ans.sz()-1)?cout<<" ":cout<<"\n";
	}
	return 0;
}

// _   .-')                .-. .-')                 .-')                                               
//( '.( OO )_              \  ( OO )               ( OO ).                                             
// ,--.   ,--.).-'),-----. ,--. ,--.  .-'),-----. (_)---\_) ,--. ,--.     .-----.  ,-.-')  .-'),-----. 
// |   `.'   |( OO'  .-.  '|  .'   / ( OO'  .-.  '/    _ |  |  | |  |    '  .--./  |  |OO)( OO'  .-.  '
// |         |/   |  | |  ||      /, /   |  | |  |\  :` `.  |  | | .-')  |  |('-.  |  |  \/   |  | |  |
// |  |'.'|  |\_) |  |\|  ||     ' _)\_) |  |\|  | '..`''.) |  |_|( OO )/_) |OO  ) |  |(_/\_) |  |\|  |
// |  |   |  |  \ |  | |  ||  .   \    \ |  | |  |.-._)   \ |  | | `-' /||  |`-'| ,|  |_.'  \ |  | |  |
// |  |   |  |   `'  '-'  '|  |\   \    `'  '-'  '\       /('  '-'(_.-'(_'  '--'\(_|  |      `'  '-'  '
// """    """     """""""" """  """"      """""""  """""""  """"""""      """"""   """         """""""


Measured memory_bytes: 3652
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<cmath>
int xx,yy,tt;

bool judge(int x,int y,int t)
{
    int time=abs(x-xx)+abs(y-yy);
    //printf("t-tt=%d time=%d\n",t-tt,time);
    if(t-tt<time)
        return false;
    if(((t-tt)-time)%2==0)
        return true;
    return false;
}

int main()
{
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        xx=0,yy=0,tt=0;
        int x,y,t;
        int answer=true;
        while(n--)
        {
            scanf("%d%d%d",&t,&x,&y);
            if(answer==false)
                continue;
            answer=judge(x,y,t);
            tt=t,xx=x,yy=y;
        }
        if(answer)
            printf("Yes\n");
        else
            printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define fi              first
#define se              second
#define ll              long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
const int N=2e5+5;
		
		
int main()
{
	 FIO;
	 
	
	int k;
	cin>>k;
	string s;
	cin>>s;
	if(s.length()<=k)
		cout<<s;
	else
	{
		for(int i=0;i<k;i++)
			cout<<s[i];
		cout<<"...";
	}
				
			
			 
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define MOD (int) (1e9+7)
#define INF (int) 2e9
#define LLINF (ll) 2e18

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

    int r=0, g=0, b=0;
    rep(i, n){
        if(s[i]=='R') r++;
        if(s[i]=='G') g++;
        if(s[i]=='B') b++;
    }

    ll ans = (ll) r * g * b;

    rep(i, n){
        rep(j, n){
            if(i<j){
                int k = j*2-i;
                if(k<n && s[i] != s[j] && s[j] != s[k] && s[k] != s[i]){
                    ans--;
                }
            }
        }
    }
    cout << ans << endl;
    // printf("%d\n", N);
    return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
int main()
{

    int N;
    scanf("%d",&N);
    if(N==1||N==2||N==3||N==4||N==5||N==6||N==7||N==8||N==9||N==10||N==12||N==15||N==14||N==18||N==20||N==21||N==24||N==25||N==27||N==30||N==35
       ||N==32||N==36||N==40||N==42||N==45||N==48||N==49||N==54||N==56||N==63||N==64||N==72||N==81||N==16||N==28)
        printf("Yes\n");
    else
        printf("No\n");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
bool f(vector<int> &A) {
    int N = A.size();
    int even = 0;
    for (int i = 0; i < N; i++) {
        if (A[i] % 2 == 0) even++;
    }
    if (even % 2 == 1) return false;
    if (N != 1 && even == N - 1) {
        for (int i = 0; i < N; i++) if (A[i] % 2 && A[i] >= 2) {
            A[i]--;
            int t = A[0];
            for (auto a : A) t = __gcd(t, a);
            for (auto &a : A) a /= t;
            return !f(A);
        }
    }
    return true;
}
int main() {
    int N; cin >> N;
    vector<int> A(N); for (auto &a : A) cin >> a;
    cout << (!f(A) ? "First" : "Second") << '\n';
    return 0;
}


Measured memory_bytes: 640
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 2000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline ll read()
{
	ll x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

ll a[maxn],ans,n;

inline bool cmp(ll a,ll b){return a>b;}

int main()
{
	n=read(); rep(i,1,n) a[i]=read(); sort(a+1,a+n+1,cmp);
	ll cnt=1,nw=1;
	rep(i,2,n)
	{
		if(nw==2) nw=1,cnt++;
		else nw++; ans+=a[cnt];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5184
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

vector<ll> divisors(ll n) {
    vector<ll> v;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            v.push_back(i);
            if (i * i != n) {
                v.push_back(n / i);
            }
        }
    }
    return v;
}

void solve() {
    int a, b, c;
    cin >> a >> b >> c;
    if (a > b) swap(a, b);
    if (b > c) swap(b, c);
    if (a > b) swap(a, b);
    int ma = a % 2;
    int mb = b % 2;
    int mc = c % 2;
    if (ma == mb && mb == mc) {
        cout << (c - a) / 2 + (c - b) / 2 << endl;
    } else {
        cout << (c - a) / 2 + (c - b) / 2 + (ma == mb ? 1 : 2) << endl;
    }
}



Measured memory_bytes: 256
//Radhe Radhe
#include<bits/stdc++.h>
#define godspeed  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define rep1(i,a,b)    for(ll i=a; i<=b; i++)
#define repVect(i,n)    for(ll i=0; i<sum.size(); i++)
#define fixed cout.setf(ios::fixed);
#define Precise cout.precision(7);
#define yes cout<<"Yes"<<'\n'
#define no cout<<"No"<<'\n'
using namespace std;

int main()
{
    godspeed
    ll  i,j,k,l,x,y,z,a,b,bon,ans=0;
    string s;
    x=300000;
    y=200000 ;
    z=100000 ;
    bon=400000 ;
    cin>>a>>b;
    if(a==1)
        ans=x;
    if(a==2)
        ans=y;
    if(a==3)
        ans=z;
    if(b==1)
        ans+=x;
    if(b==2)
        ans+=y;
    if(b==3)
        ans+=z;
    if(a==1&&b==1)
        ans+=bon;
    cout<<ans<<endl;
    return 0;
}





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

int dp[114514];

int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	int x;
	cin >> x;

	dp[0] = 1;
	for (int v = 100; v <= 105; ++v) {
		for (int i = v; i <= 100000; i++) {
			dp[i] |= dp[i - v];
		}
	}

	if (dp[x]) {
		cout << 1 << '\n';
	} else {
		cout << 0 << '\n';
	}
}


Measured memory_bytes: 640
# ABC 108 C
N, K = map(int,input().split())

if K%2 == 0:
    s = 0
    t = 0
    for k in range(1,N+1):
        if k%K == 0:
            s += 1
        elif k%K == K//2:
            t += 1
    print(s**3+t**3)
else:
    s = 0
    for k in range(1,N+1):
        if k%K == 0:
            s += 1
    print(s**3)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
typedef long long LL;
const int N = 20050;

int a[N], b[N], n;
long long j, k, on, tw; 
int main()
{

	int i;
	scanf("%d", &n), j = k = 0;
	for(i = 1; i <= n; i ++)
		scanf("%d", &a[i]), j += a[i];
	for(i = 1; i <= n; i ++)
		scanf("%d", &b[i]), k += b[i];
	on = tw = k - j;
	for(i = 1; i <= n; i ++){
		if(a[i] > b[i])
			on -= a[i] - b[i];
		else if(a[i] < b[i]){
			tw -= b[i] - a[i] + 1 >> 1;
			if((b[i] & 1) != (a[i] & 1))
				on --;
		}
	}
	if(on >= 0 && tw >= 0 && tw * 2 == on)
		puts("Yes");
	else
		puts("No");

	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include<map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
#define P pair<int,int>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

ll n;
ll ans=0;

bool jud(ll m,ll n){
    return (m>1&&n/m==n%m);
}

int main(){
    
    cin >> n;
    
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            if(jud(i-1,n)){
                ans+=i-1;
            }
            if(jud(n/i-1,n)){
                ans+=n/i-1;
            }
        }
    }
    
    cout << ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<queue>
#include<algorithm>
using namespace std;
char str[40][40];
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int bfs[40][40][1<<8];
int con[30];
int main(){
	int a,b;
	while(scanf("%d%d",&b,&a),a){
		for(int i=0;i<a;i++)scanf("%s",str[i]);
		for(int i=0;i<a;i++)for(int j=0;j<b;j++)for(int k=0;k<(1<<8);k++)
			bfs[i][j][k]=999999999;
		int sr,sc,gr,gc;
		int sz=0;
		for(int i=0;i<30;i++)con[i]=-1;
		for(int i=0;i<a;i++)for(int j=0;j<b;j++){
			if('A'<=(str[i][j])&&(str[i][j])<='Z'&&!~con[(str[i][j])-'A']){
				con[(str[i][j])-'A']=sz++;
			}
		}
		for(int i=0;i<a;i++)for(int j=0;j<b;j++){
			if(str[i][j]=='@'){sr=i;sc=j;}
			if(str[i][j]=='<'){gr=i;gc=j;}
		}
		queue<pair<pair<int,int>,int> > Q;
		Q.push(make_pair(make_pair(sr,sc),0));
		bfs[sr][sc][0]=0;
		while(Q.size()){
			int row=Q.front().first.first;
			int col=Q.front().first.second;
			int st=Q.front().second;
			int cost=bfs[row][col][st];
			Q.pop();
			for(int i=0;i<4;i++){
				int tr=row+dx[i];
				int tc=col+dy[i];
				if(str[tr][tc]=='#')continue;
				if('A'<=str[tr][tc]&&str[tr][tc]<='Z'){
					int bit=con[str[tr][tc]-'A'];
					if((st&(1<<bit))&&bfs[tr][tc][st]>cost+1){
						bfs[tr][tc][st]=cost+1;
						Q.push(make_pair(make_pair(tr,tc),st));
					}
				}else if('a'<=str[tr][tc]&&str[tr][tc]<='z'&&~con[str[tr][tc]-'a']){
					int bit=con[str[tr][tc]-'a'];
					if(bfs[tr][tc][st^(1<<bit)]>cost+1){
						bfs[tr][tc][st^(1<<bit)]=cost+1;
						Q.push(make_pair(make_pair(tr,tc),st^(1<<bit)));
					}
				}else{
					if(bfs[tr][tc][st]>cost+1){
						bfs[tr][tc][st]=cost+1;
						Q.push(make_pair(make_pair(tr,tc),st));
					}
				}
			}
		}
		int ret=999999999;
		for(int i=0;i<(1<<8);i++)ret=min(ret,bfs[gr][gc][i]);
		if(ret<99999)printf("%d\n",ret);
		else printf("-1\n");
	}
}

Measured memory_bytes: 2128
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

using Weight = int;
using Flow = int;
struct Edge {
	int s, d; Weight w; Flow c;
	Edge() {};
	Edge(int s, int d, Weight w = 1) : s(s), d(d), w(w), c(w) {};
	bool operator<(const Edge &e)const { return w < e.w; }
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;

inline ostream &operator<<(ostream &os, const Edge &e) { return (os << '(' << e.s << ", " << e.d << ", " << e.w << ')'); }

void add_edge(Graph &g, int a, int b, Weight w = 1) {
	g[a].emplace_back(a, b, w);
	g[b].emplace_back(b, a, w);
}
void add_arc(Graph &g, int s, int d, Weight w = 1) { g[s].emplace_back(s, d, w); }

//?????????????????£?????°??????
Graph reverse(const Graph &g) {
	Graph rg(g.size());
	for (auto &es : g)
		for (auto &e : es)
			rg[e.d].emplace_back(e.d, e.s, e.w);
	return rg;
}

//?????£?????????????§£
//ret[u] = u ????±??????????????????£??????????????????????????????
vector<int> kosaraju(const Graph &g) {
	int n = g.size();
	Graph rg = reverse(g);
	vector<int> in(n, -1);
	vector<int> post;
	function<void(int, int)> dfs = [&](int u, int idx) {
		if (in[u] != -1)return;
		in[u] = idx;
		for (auto &e : g[u]) {
			if (in[e.d] != -1)continue;
			dfs(e.d, idx);
		}
		post.emplace_back(u);
	};
	int idx = 0;
	for (int u = 0; u < n; u++) {
		if (in[u] == -1) {
			dfs(u, idx++);
		}
	}
	vector<int> in2(n, -1);
	function<void(int, int, int)> dfs2 = [&](int u, int idx, int idx2) {
		if (in2[u] != -1)return;
		if (in[u] != idx)return;
		in2[u] = idx2;
		for (auto &e : rg[u]) {
			if (in2[e.d] != -1)continue;
			if (in[e.d] != idx)continue;
			dfs2(e.d, idx, idx2);
		}
	};
	int idx2 = 0;
	reverse(post.begin(), post.end());
	for (auto &u : post) {
		if (in2[u] == -1) {
			dfs2(u, in[u], idx2++);
		}
	}
	return in2;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int V, E; cin >> V >> E;
	Graph g(V);
	rep(i, 0, E) {
		int s, t; cin >> s >> t;
		add_arc(g, s, t);
	}
	vector<int> res = kosaraju(g);
	cout << (find(all(res), V - 1) == res.end()) << endl;
	return 0;
}

Measured memory_bytes: 3216
#include<iostream>
#include<string>
using namespace std;
int main(){
  int n,i;
  cin >> n;
  string s1,s2;
  int a=0,b=0;
  
  for(i=0;i<n;i++){
    cin >> s1 >> s2;
    if(s1.compare(s2)==0) {
      a++;b++;
    }
    else if(s1.compare(s2)>0){
        a+=3;
    } 
    else{
         b+=3;
    }
  }
  cout << a << " " << b << endl;
}



Measured memory_bytes: 3184
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int MOD = 1000000007;
int INF = numeric_limits<int>::max() / 2;
 
 
signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  
  int N;
  string S;
  cin >> N >> S;
  for(int i=0;i<S.size();i++){
    if('Z' - S[i] < N){
      char c = S[i] - (26 - N);
      S[i] = c;
    }
    else{
      char c = S[i] + N;
      S[i] = c;
    }
  }
  cout << S << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>*/
 
#define pb push_back
#define mp make_pair
#define sz(s) ((int)(s.size()))
#define all(s) s.begin(), s.end()
#define rep(i, a, n) for (int i = a; i <= n; ++i)
#define per(i, n, a) for (int i = n; i >= a; --i)
#define onlycin ios_base::sync_with_stdio(false); cin.tie(0) 
#define F first
#define S second
using namespace std;
// using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;
/*typedef tree<
pair < int, int >,
null_type,
less< pair < int, int > >,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;*/
// find_by_order() order_of_key()
const int MAXN = (int)5e5+228;
const char nxtl = '\n';
const int mod = (int)1e9+7;
const double eps = (double)1e-7;
template<typename T> inline bool updmin(T &a, const T &b) {return a > b ? a = b, 1 : 0;}
template<typename T> inline bool updmax(T &a, const T &b) {return a < b ? a = b, 1 : 0;}

int n;
char s[1505][1505];
int dp[1505][1505], dp2[1505][1505];
int cnt[1505][1505], cnt2[1505][1505];
int pw[1505], p = 339;

int main() {
	#ifdef accepted
		freopen(".in", "r", stdin);
		freopen(".out", "w", stdout);
	#endif
	onlycin;
	pw[0] = 1;
	rep(i, 1, 1000) pw[i] = pw[i-1]*1ll*p%mod;
	cin >> n;
	rep(i, 0, n-1) rep(j, 0, n-1) cin >> s[i][j];
	rep(i, n, n+n) rep(j, n, n+n) s[i][j] = s[i-n][j-n];
	rep(i, n, n+n) rep(j, 0, n-1) s[i][j] = s[i-n][j];
	rep(i, 0, n-1) rep(j, n, n+n) s[i][j] = s[i][j-n];
	rep(i, 0, n+n-2) {
		rep(j, 0, n+n-2) {
			dp[i][j] = ((!j ? 0 : dp[i][j-1]) *1ll * p +(s[i][j]-'a'+1))%mod;
		}
	}
	rep(j, 0, n+n-2) {
		rep(i, 0, n+n-2) {
			dp2[i][j] = ((!i ? 0 : dp2[i-1][j]) *1ll * p +(s[i][j]-'a'+1))%mod;
		}
	}
	/*rep(i, 0, n+n-2) {
		rep(j, 0, n+n-2) {
			cerr << s[i][j] << ' ';
		}
		cerr << nxtl;
	}
	rep(i, 0, n+n-2) {
		rep(j, 0, n+n-2) {
			cerr << dp[i][j] << ' ';
		}
		cerr << nxtl;
	}
	rep(i, 0, n+n-2) {
		rep(j, 0, n+n-2) {
			cerr << dp2[i][j] << ' ';
		}
		cerr << nxtl;
	}*/
	int res = 0;
	rep(i, n-1, n+n-2) {
		rep(j, n-1, n+n-2) {
			bool ok = 1;
			int ii = i, jj = j;
			per(len, n, 1) {
				int h1 = (dp[ii][jj]-((jj-len>=0 ? dp[ii][jj-len] : 0) * 1ll * pw[len] % mod)+mod)%mod;
				int h2 = (dp2[ii][jj]-((ii-len>=0 ? dp2[ii-len][jj] : 0) * 1ll * pw[len] % mod)+mod)%mod;
				if(h1 != h2) { ok = 0; break; }
				h1 = (dp[ii-len+1][jj]-(jj-len>=0 ? dp[ii-len+1][jj-len] : 0) * 1ll * pw[len] % mod+mod)%mod;
				h2 = (dp2[ii][jj-len+1]-(ii-len>=0 ? dp2[ii-len][jj-len+1] : 0) * 1ll * pw[len] % mod+mod)%mod;
				if(h1 != h2) {ok = 0; break; }
				ii--, jj--;
			}
			if(ok) res++;
		}
	}
	cout << res << nxtl;

	return 0;
}

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

const int maxn = 300010;
int n, a[maxn];

int main() {
    scanf("%d", &n), n *= 3;
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
    }
    sort(a + 1, a + n + 1, greater<int>());
    long long sum = 0;
    for (int i = 2; i <= n / 3 * 2; i += 2) {
        sum += a[i];
    }
    printf("%lld\n", sum);
    return 0;
}

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

int main(){
    int N;cin>>N;
    int cmax = 100/4;
    int dmax = 100/7;
    for(int i=0; i<cmax; ++i){
      for(int j=0; j<dmax; ++j){
        if(i*4+j*7==N){
          cout<<"Yes"<<endl;
          return 0;
        }
      }
    }
    cout<<"No"<<endl;
    return 0;
}

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

using namespace std;


int main(){
	int N,Q;
	long K;
	cin >>N>>K>>Q;
	int A[Q];
	long total[N];
	for(int i=0;i<N;i++){
		total[i]=0;
	}
	for(int i=0;i<Q;i++){
		cin >>A[i];
	}
	for(int i=0;i<Q;i++){
		total[A[i]-1]++;
	}
	for(int i=0;i<N;i++){
		if(K-Q+total[i]>0){
			cout <<"Yes"<<endl;
		}else{
			cout <<"No"<<endl;
		}
	}
	return 0;
}

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

typedef long long ll;
const int N = 100005;
const int M = 1000000007;

int n;

int prime[N];
void getPrime() {
  for (int i = 2; i < N; i++) {
    if (!prime[i]) { prime[++prime[0]] = i; }
    for (int j = 1; j <= prime[0] && prime[j] * i < N; j++) {
      prime[prime[j] * i] = 1;
      if (i % prime[j] == 0) { break; }
    }
  }
}

inline ll cube(ll x) { return x * x * x; }

int main() {
  getPrime();
  while (~scanf("%d", &n)) {
    int cnt = 0; ll x;
    map<ll, int> mp;
    for (int i = 0; i < n; i++) {
      scanf("%lld", &x);
      ll t = x;
      for (int i = 1; i <= prime[0] && prime[i] < 1000; i++) {
        while (t % cube(prime[i]) == 0) { t /= cube(prime[i]); }
      }
      if (t == 1) { cnt++; }
      else { mp[t]++; }
    }
    int ans = n - max(0, cnt - 1);
    set<ll> st;
    for (auto &p : mp) {
      if (st.find(p.first) != st.end()) { continue; }
      ll t = p.first * p.first;
      for (int i = 1; i <= prime[0] && prime[i] < 1000; i++) {
        while (t % cube(prime[i]) == 0) { t /= cube(prime[i]); }
      }
      if (mp.find(t) != mp.end()) { ans -= min(p.second, mp[t]); }
      st.insert(t);
    }
    printf("%d\n", ans);
  }
}


Measured memory_bytes: 11648
#include <iostream>

using namespace std;

int main() {
    int n, k, *a;
    int m = 0;
    cin >> n >> k;
    a = new int[n+1];
    for (int i = 0; i <= n; i++)
        a[i] = 0;
    for (int i = 0; i < n; i++) {
        int d;
        cin >> d;
        if (a[d] == 0)
            m++;
        a[d]++;
    }
    int sum = 0;
    for (int i = 0; i < n; i++) {
        sum += a[i+1];
    }
    sort(a, a+n+1, greater<int>());

    for (int i = 0; i < k; i++) {
        sum -= a[i];
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
const int MAX=100040;
char s[MAX];
vector<ll> counter;
struct node{
    node *left, *right;
    int val,depth;
    node(){left=NULL, right=NULL,val=0,depth=0;}
};
ll N,L,fin;
node origin;
void dp(node *x){
    if(x->left==NULL && x->right==NULL) return;
    if(x->left ==NULL) counter.push_back(x->depth);
    else dp(x->left );
    if(x->right==NULL) counter.push_back(x->depth);
    else dp(x->right);
}
int main(){
    scanf("%lld%lld",&N,&L);
    for(ll i=0;i<N;i++){
        scanf(" %s",s);
        ll t=strlen(s);
        origin.val=-1;
        node* now=&origin;
        for(ll j=0;j<t;j++){
            node* next=new node();
            if(s[j]=='0'&&now->left==NULL){
                next->val=0,next->depth=now->depth+1;
                now->left=next;
            }
            else if(s[j]=='1'&&now->right==NULL){
                next->val=1,next->depth=now->depth+1;
                now->right=next;
            }
            if(s[j]=='0') now=now->left;
            else if(s[j]=='1') now=now->right;
        }
    }
    dp(&origin);
    for(ll i=0;i<counter.size();i++){
        //printf("%lld\n",counter[i]);
        ll t=L-counter[i];
        fin^=t&(-t);
    }
    if(fin==0) printf("Bob\n");
    else printf("Alice\n");
}


Measured memory_bytes: 7800
// AGC025
// A - Digits Sum

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

const int MAX_N = 100000;

int N;

int solve() {
    int sum = 0;
    for (; N > 0; N /= 10) {
        sum += N % 10;
    }
    if (sum == 1) {
        return 10;
    }
    return sum;
}

int main() {
    cin >> N;

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 256
s = input()
word = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
s = sorted(s)
if len(set(s)) == len(word):
  print('None')
  exit()
ans = [i for i in word if i not in s]
print(ans[0])

Measured memory_bytes: 4536
n = int(input())
v = []
i = 6
while i<=n:
    v.append(i)
    i *= 6
i=9
while i <= n:
    v.append(i)
    i *= 9
v.sort(reverse=True)
dic = dict()
def dp(i, N):
    if i == len(v):
        return N
    if (i, N) not in dic:
        dic[(i, N)] = min(dp(i, N-v[i])+1, dp(i+1, N)) if N-v[i] >= 0 else dp(i+1, N)
    return dic[(i, N)]
print(dp(0, n))


Measured memory_bytes: 13632
#include <stdio.h>
int main(int argc, const char * argv[]){
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if(a<b){
if(b<c){
printf("Yes\n");
}
else{
printf("No\n");
}
}
else{
printf("No\n");
}
return 0;
}

Measured memory_bytes: 580
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<map> 
#include<iostream>
#include<time.h>
using namespace std;
typedef long long ll;
const double pi=acos(-1.0);
const ll mod=1e9+7;
const int inf=0x3f3f3f3f;
//ll begin_time=clock();
//ll end_time=clock();printf("time=%lldms\n",end_time-begin_time);

struct mmp
{
	int x,y,d,e;
}
q[55];
int main()
{
	int z[11];
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	for(int i=0;i<c;i++)scanf("%d%d%d%d",&q[i].x,&q[i].y,&q[i].d,&q[i].e);
	ll maxn,maxx;
	maxn=0;
	for(int i1=1;i1<=b;i1++)
	{
		z[1]=i1;
		for(int i2=i1;i2<=b;i2++)
		{
			z[2]=i2;
			for(int i3=i2;i3<=b;i3++)
			{
				z[3]=i3;
				for(int i4=i3;i4<=b;i4++)
				{
					z[4]=i4;
					for(int i5=i4;i5<=b;i5++)
					{
						z[5]=i5;
						for(int i6=i5;i6<=b;i6++)
						{
							z[6]=i6;
							for(int i7=i6;i7<=b;i7++)
							{
								z[7]=i7;
								for(int i8=i7;i8<=b;i8++)
								{
									z[8]=i8;
									for(int i9=i8;i9<=b;i9++)
									{
										z[9]=i9;
										for(int i10=i9;i10<=b;i10++)
										{
											z[10]=i10;maxx=0;
											for(int i=0;i<c;i++)
											{
												if(z[q[i].y]-z[q[i].x]==q[i].d)maxx+=q[i].e;
											}
											maxn=max(maxx,maxn);
										}
									}
								}
							}
							
						}
					}
				}
					
			}
		}
	}
	printf("%lld\n",maxn);
}




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

int main() {
    int ans = 0;
    int N, H, W;
    cin >> N >> H >> W;
    ans += 1 - W + N;
    ans *= 1 - H + N;

    cout << ans << endl;
}

Measured memory_bytes: 3592
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d = sc.nextInt();
		int cnt = 1;
		while (cnt * (2 * d + 1) < n) {
			cnt++;
		}
		System.out.println(cnt);
	}
}


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

int main()
{
    int n,k;
    cin >> n >> k;
    vector<int> h(n);
    for(int i=0;i<n;i++)
        cin >> h[i];
    int dp[n];
    dp[0] = 0;
    dp[1] = abs(h[0]-h[1]);

    for(int i=2;i<n;i++)
    {
        dp[i] = INT_MAX;
        if(k>i)
        {
            for(int j=0;j<=i;j++)
                dp[i] = min(dp[i-j]+abs(h[i]-h[i-j]),dp[i]);
        }
        else{
            for(int j=k;j>=0;j--)
                dp[i] = min(dp[i-j]+abs(h[i]-h[i-j]),dp[i]);
        }
    }

    cout << dp[n-1] << "\n";
}



Measured memory_bytes: 4056
def main():
    N, M, Q = [int(x) for x in input().split()]
    queries = [[int(x) for x in input().split()] for _ in range(Q)]

    ans = float("-inf")

    def dfs(A: list):
        nonlocal ans
        if len(A) == N:
            s = sum(d for a, b, c, d in queries if A[b-1]-A[a-1] == c)
            ans = max(ans, s)
        else:
            lo = 1 if not A else A[-1]
            for i in range(lo, M+1):
                A.append(i)
                dfs(A)
                A.pop()
    dfs([])
    print(ans)


if __name__ == '__main__':
    main()


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

int main()
{
    int A, B, K;
    cin >> A >> B >> K;
    if((B - A + 1) >= 2*K) {
        for(int i = 0; i < K; ++i) cout << A + i << endl;
        for(int i = K-1; i >= 0; --i) cout << B - i << endl;
    }
    else {
        for(int i = 0; i < (B - A + 1); ++i) cout << A + i << endl;
    }
    return 0;
}

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

int main()
{ 
  int n, l, sum_l;

  cin >> n >> l;
  sum_l = n * (2 * l + n - 1) / 2;
  if (n + l - 1 < 0)
    sum_l -= n + l - 1;
  else
    sum_l -= max(0, l);
  cout << sum_l << endl;
}

Measured memory_bytes: 256
import sys
i=input
n=int(i())
r0=int(i())
r1=int(i())
x=r1-r0
y=min(r1,r0)
for i in map(int,sys.stdin.readlines()):
    a=i-y
    if x<a:
        x=a
        if 0>a:y=i
    elif y>i:y=i
print(x)

Measured memory_bytes: 19832
#include<iostream>
#include<vector>
#include<bitset>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){ 
    string str;
    int ans=0;
    bool flag=false;
    cin >> str;
    for(int i=1;i<str.size();i++){
        if(str[i]!='9'&&!flag){
          str[i-1]--;
          flag = true;
        }
        if(flag){
            str[i]='9';
        }
    }
    for(int i=0;i<str.size();i++){
        ans+=(str[i]-'0');
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256