akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <math.h>
#include <cstdio>
using namespace std;
#define PI 3.14159265
int main()
{
    double x=0,y=0;
    int r,dth,th=0;
    while(true){
        scanf("%d,%d",&r,&dth);
        if(!r&&!dth)break;
        x+=r*sin((double)th*PI/180);
        y+=r*cos((double)th*PI/180);
        th+=dth;
    }
    cout<<int(x)<<endl;
    cout<<int(y)<<endl;
    return 0;
}
 

Measured memory_bytes: 1212
#include<stdio.h>

int LinearSearch(int *,int *,int,int);

int main(){
  int n,q;
  scanf("%d",&n);
  int i,S[n];
  for(i=0;i<n;i++)scanf("%d",&S[i]);
  scanf("%d",&q);
  int T[q];
  for(i=0;i<q;i++)scanf("%d",&T[i]);
  printf("%d\n",LinearSearch(&S[0],&T[0],n,q));
  return 0;
}

int LinearSearch(int *x ,int *y,int n,int q){
  int i,j,cnt=0;
  if(n<q){
  for(i=0;i<n;i++){
    for(j=0;j<q;j++){
      if(x[i]==y[j]){
	cnt++;
	break;
      }
    }
  }
  }
  else {
    for(i=0;i<q;i++){
      for(j=0;j<n;j++){
	if(y[i]==x[j]){
	  cnt++;
	  break;
      }
    }
  }
  }
  return cnt;
}



Measured memory_bytes: 2052
#!/usr/bin/env python

from collections import deque, defaultdict
import itertools as ite
import sys
import math
import decimal

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

N = input()
S = raw_input()
ans = N
for i in range(N - 1):
    if(S[i] == S[i + 1]):
        ans -= 1
print ans

Measured memory_bytes: 34664
#include <iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <cstring>
#include <map>
using namespace std;
typedef long long ll;
ll mod = 1e9 + 7;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
	ll n, k; cin >> n >> k;
	ll ans = 0;
	// 4
	//01 ~ 23 : 1 ~ 5 : 5
	//012 ~ 123 : 3 ~ 6 : 4
	//0123 : 1
	//n - k
	for (ll i = k; i <= n; i++) {
		ll t = n - i;
		ll Left = (i - 1) * i / (ll)2;
		ll Right = n * (n + 1) / (ll)2 - t * (t + 1) / (ll)2;
		ans += (Right - Left + (ll)1);
		ans %= mod;
	}

	cout << (ans + 1) % mod << '\n';

}

Measured memory_bytes: 3196
#include<stdio.h>
#define name 10
#define N 100005
typedef struct{
 char s[name];
  int time;
}R;
R a[N+1];
int head,tail;
void Enqueue(R );
R Dequeue(void);
int main()
{
  int i,n,q,T=0;
  R y;
  scanf("%d%d",&n,&q);
  for(i=0;i<n;i++){
    scanf("%s%d",y.s,&y.time);
    Enqueue(y);
  }
  while(n!=0){
    y=Dequeue();
    if(y.time>q){
      y.time=y.time-q; 
      T+=q;
      Enqueue(y);
    } 
    else{
      T=T+y.time;
      printf("%s %d\n",y.s,T);
      n--;
    }
  }
  return 0;
}

void Enqueue(R Y){
  if(N==tail) tail=0; 
    a[tail]=Y;
    tail++;
}

R Dequeue(void){
  if(head==N) head=0;
  return a[head++];
}

Measured memory_bytes: 2156
import java.util.Scanner;
class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        int ans;
        if(B<A){
            ans = A + A - 1;
        }
        else if(A < B){
            ans = B + B - 1;
        }
        else{
            ans = 2*A;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23124
N = int(input())

c = []
for i in range(10):
    c.append([0] * 10)

for i in range(N):
    s = str(i+1)
    i1 = int(s[0])
    i2 = int(s[-1])
    c[i1][i2] += 1
    
total = 0
for i in range(10):
    for j in range(10):
        total += c[i][j] * c[j][i]
        
print(total)

Measured memory_bytes: 3064
let N = stdin.ReadLine() |> int
let A = stdin.ReadLine().Split() |> Array.map int
let B = stdin.ReadLine().Split() |> Array.map int
let C = stdin.ReadLine().Split() |> Array.map int

let rec resolver p r i =
    if i = N then r
    elif p + 1 = A.[i] then resolver A.[i] (r + B.[A.[i] - 1] + C.[p - 1]) (i + 1)
    else resolver A.[i] (r + B.[A.[i] - 1]) (i + 1)

resolver -1 0 0 |> stdout.WriteLine


Measured memory_bytes: 11220
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const double PI = acos(-1);
const ll MOD = 1000000007;
// const ll MOD = 998244353;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

using Graph = vector<vector<ll>>;

const ll MAX = 1e18;

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N,M; ll L; cin >> N >> M >> L;
    Graph D(N, vector<ll>(N,MAX));
    rep(i,N) D[i][i] = 0;
    rep(i,M) {
        int a,b; ll c; cin >> a >> b >> c;
        a--; b--;
        D[a][b] = D[b][a] = c;
    }
    int Q; cin >> Q;
    vector<int> s(Q),t(Q);
    rep(i,Q) {
        cin >> s[i] >> t[i];
        s[i]--; t[i]--;
    }

    rep(k,N) {
        rep(i,N) {
            if (D[i][k] == MAX) continue;
            rep (j,N) {
                if (D[k][j] == MAX) continue;
                chmin(D[i][j],D[i][k] + D[k][j]);
            }
        }
    }

    Graph G(N, vector<ll>(N));
    rep(i,N) {
        rep(j,N) {
            if (D[i][j] == 0) G[i][j] = 0;
            else if (D[i][j] <= L) G[i][j] = 1;
            else G[i][j] = MAX;
        }
    }

    rep(k,N) {
        rep(i,N) {
            if (G[i][k] == MAX) continue;
            rep(j,N) {
                if (G[k][j] == MAX) continue;
                chmin(G[i][j],G[i][k]+G[k][j]);
            }
        }
    }

    rep(i,Q) {
        if (G[s[i]][t[i]] == MAX) cout << -1 << endl;
        else cout << G[s[i]][t[i]] - 1 << endl;
    }
}

Measured memory_bytes: 2688
/*Author: Gautam*/
 
 
#include<bits/stdc++.h>
#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
#define MOD 1000000007
#define ull unsigned long long int
#define newline cout<<endl
 
 
/* TYPE DEFINITIONS */
typedef     long long int        ll;
typedef     vector<ll>     vi;
typedef     pair<int,int>   pi;
 
 
 
/* MATH */
bool isPrime(ull n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ull i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
} 
 
ll pow(ll a,ll b,ll m)
{
    ll res=1;
    while(b>0)
    {
        if(b&1)res=(res*a)%m;
        a=(a*a)%m;
        b>>=1;
    }
    return res;
}

  
//
/* MACROS */
 
#define  all(A)         (A).begin() , (A).end()
#define  arrall(A,n)    (A),((A)+(n))
#define  rall(A)        (A).rbegin() , (A).rend()
#define  sz(A)          (int)(A).size()
#define  pb             push_back
#define  ppb            pop_back
#define  mp             make_pair
#define  ln(X)          (int)(X).length()
#define  square(X)      ((X)*(X))
#define  cube(X)        ((X)*(X)*(X))
#define  forn(i, n)  for (int i = 0; i < int(n); i++)
#define  forr(i, n)  for (int i = int(n - 1); i >= 0; i--)
#define  fora(i, a, b)  for (int i = int(a); i <= int(b); i++)
#define  forb(i, a, b)  for (int i = int(a); i >= int(b); i--)
#define  fore(it, a)    for(__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++) 
void solve()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    string ans="";
    ans+=s[0];
    fora(i,1,n-1)
    {
        if(ans[ln(ans)-1]!=s[i])ans+=s[i];
    }
    cout<<ln(ans)<<endl;

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

Measured memory_bytes: 592
n = int(input())
s = input()
 
S = len(s)
mod = 10 ** 9 + 7
 
tmp_ans = pow(26, n, mod)
div = pow(26, -1, mod)
 
ans = tmp_ans
 
for i in range(1, n+1):
    tmp_ans = (tmp_ans * 25 * div) % mod
    tmp_ans = ((tmp_ans * (S-1+i)) * pow(i, -1, mod)) % mod
    ans = (ans + tmp_ans) % mod
 
ans %= mod
 
print(ans)

Measured memory_bytes: 10940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PLL = pair<ll, ll>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repn(i,n) for(int i = 0; i <= (int)(n); i++)
#define srep(i,l,n) for(int i = l; i < (int)(n); i++)
#define srepn(i,l,n) for(int i = l; i <= (int)(n); i++)
#define drep(i,n) for(int i = (int)(n-1); i >= 0; i--)
#define drepn(i,n) for(int i = (int)(n); i >= 0; i--)
#define size(s) (int)s.size()
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<typename T> inline istream& operator>>(istream &i, vector<T> &v) {rep(j, size(v)) i >> v[j]; return i;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T> T gcd(T a, T b) {if(b==0)return a; else return gcd(b,a%b);}
template<class T> T lcm(T a, T b) {return a/gcd(a,b)*b;}
template<class T = int> using V = vector<T>;
template<class T = int> using VV = vector<V<T>>;
bool isIn(int i, int j, int h, int w) {return i >= 0 && i < h && j >= 0 && j < w;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define ep emplace_back

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

int num(char c) {
    return c - '0';
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int n = size(s);
    int ans = INF;
    rep(i, n - 2) {
        int now = num(s[i]) * 100 + num(s[i + 1]) * 10 + num(s[i + 2]);
        chmin(ans, abs(now - 753));
    }
    cout << ans << endl;
}

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

int main(){
    int n;
    cin >> n;
    int Amax = 1000001;
    vector<int> A(Amax,0);
    vector<int> B(Amax,1);

    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        A[a]++;
    }

    for(int i=1;i<Amax;i++){
        if(A[i]==0){
            B[i] = 0;
        }
    }

    for(int i=1;i<Amax;i++){
        if(B[i]){
            if(A[i]>1){
                B[i] = 0;
            }
            for(int j=i*2;j<Amax;j+=i){
                B[j] = 0;
            }
        }
    }
    
    int ans =0;

    for(int i=1;i<Amax;i++){
        if(B[i]){
            ans++;
        }
    }

    cout << ans << endl;
}


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

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

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

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


using namespace std;

// #define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

const int MOD = 1e9 + 7;
const int INF = INT_MAX;

int get_group(int v){
    if(v == 2) return 3;
    if(v == 4 || v == 6 || v == 9 || v == 11) return 2;
    return 1;
}

signed main() {
    Fast();

    int x, y;
    cin >> x >> y;
    cout << (get_group(x) == get_group(y) ? "Yes" : "No") << endl;    

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define INF 100000000000000000
#define modulo 1000000007
#define int long long int
using namespace std;
vector<int>seg;
vector<int>lazy;
int S;
void build(){
      S=(1<<((int)ceil(log2(seg.size()))));
      int l=S-seg.size();
      for(int i=0;i<l;i++)seg.pb(INF);
      reverse(all(seg));
      for(int i=1;i<seg.size();i+=2)seg.pb(min(seg[i],seg[i-1]));
      seg.pb(INF);
      reverse(all(seg));
      lazy.resize(seg.size()*2,INF);
}
void push(int j){
      int x=lazy[j];
      seg[j]=min(seg[j],lazy[j]);
      lazy[j*2]=min(lazy[j*2],x);
      lazy[j*2+1]=min(lazy[j*2+1],x);
      lazy[j]=INF;
}
void up(int j){
      while(j>0){
            push(j);
            if(j*2<seg.size()){
            push(j*2);
            push(j*2+1);
            seg[j]=min(seg[j*2],seg[j*2+1]);
            }
            j/=2;
      }
}
void update(int j,int a,int b,int x,int y,int key){
      push(j);
      if(y<a||b<x)return;
      if(a<=x&&y<=b){
            lazy[j]=min(lazy[j],key);
            up(j);
      }
      else{
            update(j*2,a,b,x,(x+y)/2,key);
            update(j*2+1,a,b,(x+y)/2+1,y,key);
      }
}
int query(int j,int a,int b,int x,int y){
      push(j);
      if(y<a||b<x)return INF;
      if(a<=x&&y<=b) return seg[j];
      else{
            return min(query(j*2,a,b,x,(x+y)/2),query(j*2+1,a,b,(x+y)/2+1,y));
      }
}
int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      int n,m;
      cin>>n>>m;
      seg.resize(n,INF);
      map<int,set<ii> > Y;
      for(int i=0;i<m;i++){
            int x,y,w;
            cin>>x>>y>>w;x--,y--;
            Y[y].insert({x,w});
      }
      build();
      update(1,0,0,0,S-1,0);
      for(map<int,set<ii>>::iterator itr=Y.begin();itr!=Y.end();itr++){
            for(set<ii>::iterator it=itr->second.begin();it!=itr->second.end();it++){
                  update(1,it->first,itr->first,0,S-1,query(1,it->first,itr->first,0,S-1)+it->second);          
            }
      }
      int ans=query(1,n-1,n-1,0,S-1);
      if(ans==INF)cout<<-1;
      else cout<<ans;
}


Measured memory_bytes: 21636
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////

ll a,b,c,d[100005] = {},n,m;
string s,t;


int main(){
    
    cin >> a >> b >> c;

    ll ans = 0;
    ll aa = 0;
    
    aa = min(b,c);
    ans += aa * 2;
    
    b -= aa;
    c -= aa;
    if(c < 0)c = 0;
   
    if(b > 0)ans += b;
    
    aa = min(a,c);
    ans += aa;
    c -= aa;
    if(c > 0)ans++;
    P(ans);
	return  0;
}

Measured memory_bytes: 256
/////////////////////////////////////////////////////////
//
//  c/temp.cpp file
//  Last Updated: 2018-10-23 ...Maybe
//
//    I hope you adding this code to the setting file
//    alias g++='g++ -std=c++1y -DDEBUG_LOCAL'
//
/////////////////////////////////////////////////////////

#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

//#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _REP(i,n) REAP(i,0,n)
#define REAP(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,REAP,_REP,)(__VA_ARGS__)

#define _REPR(i,n) REAPR(i,n,0)
#define REAPR(i,a,b) for(int i=int(a-1);i>=int(b);--i)
#define REPR(...) _overload3(__VA_ARGS__,REAPR,_REPR,)(__VA_ARGS__)

#define ALL(a) a.begin(),a.end()
#define rALL(a) a.rbegin(),a.rend()

#define coutALL(a) {int loop_coutALL=0;for(auto e:a) cout<<(loop_coutALL++?" ":"")<<e; cout<<endl;}

#define coutYN(a) cout<<((a)?"YES":"NO")<<endl;
#define coutYn(a) cout<<((a)?"Yes":"No")<<endl;
#define coutyn(a) cout<<((a)?"yes":"no")<<endl;

#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)

const int INF=1145141919;
//const long long INF=114514191911451419;
const int MOD=(int)1e9+7;
const double EPS=1e-12;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
//const int dx[]={-1,-1,-1,0,1,1,1,0},dy[]={-1,0,1,1,1,0,-1,-1};

using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;

typedef pair<int,int> pii;
typedef pair<int,string> pis;
typedef pair<string,int> psi;
typedef pair<string,string> pss;

typedef long long ll;

template<typename T> istream &operator >> (istream &is, vector<T> &v){for(T &x:v) is>>x;return is;}
template<typename T> ostream &operator << (ostream &os, vector<T> &v){int i=0;for(T &x:v) os<<(i++?" ":"")<<x;return os;}

ll rev(ll n){ll x=0;for(;n>0;){x=x*10+n%10;n/=10;}return x;}

ll upper(ll n,ll m){return (n+m-1)/m;};
ll rounding(ll n){return (long double)n+0.5;};

bool inG(ll x,ll n){return 0<=x && x<n;}
bool outG(ll x,ll n){return x<0 || n<=x;}

inline int qp(int a,ll b){if(!b)return 1;int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
inline int qp(int a,ll b,int mo){if(!b)return 1;int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

inline ll fac(ll k,ll n){ll a=1;for(int i=0;i<n;i++)a*=k--;return a;}
inline ll fac(ll k,ll n,int mo){ll a=1;for(int i=0;i<n;i++)a*=k--,a%=mo;return a;}

inline int dsum(ll n){int a=0;for(;n;n/=10)a+=n%10;return a;}

struct Arithmetic{Arithmetic(){cin.tie(0);ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);}};

//#define DEBUG_LOCAL

#ifdef DEBUG_LOCAL
template<typename T> void deb(T a){cerr<<"deb: "<<a<<"です"<<endl;}
#define debl {cerr<<"debug: "<<__LINE__<<"行目だ"<<endl;}
void what_cr(){cout<<__GCC_ATOMIC_CHAR16_T_LOCK_FREE<<" ←？"<<endl;}
//ori_func S

//ori_func E
#else
template<typename T>void deb(T a){}
#define debl
void what_cr(){}void t_t(){}
#endif

signed main(){

  Arithmetic Exception;

  int n;
  cin>>n;

  double ans=0;

  REP(i,n){

    double x;
    cin>>x;

    ans+=1/x;

  }

  cout<<1/ans<<endl;

  return 0;

}


Measured memory_bytes: 256
require 'pp'

# サイズが H, W の文字の2次元配列を返却する
def gets_HW_char
  h, w = gets.split.map(&:to_i)
  board = h.times.map { gets.chomp.chars }
  return h, w, board
end

H, W, b = gets_HW_char

unless b.flatten.include?("#")
  puts "Yes"
  exit
end

# 4方向走査
H.times do |i|
  W.times do |j|
    if b[i][j] == "#"
      canDraw = false
      [
        [-1,  0], # 上
        [ 1,  0], # 下
        [ 0, -1], # 左
        [ 0,  1], # 右
      ].each do |di, dj|
        if 0 <= i + di && i + di < H && 0 <= j + dj && j + dj < W
          canDraw = true if b[i + di][j + dj] == "#"
        end
      end

      unless canDraw
        puts "No"
        exit
      end
    end
  end
end
puts "Yes"


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

template <
    typename TYPE,
    std::size_t SIZE>
std::size_t a_len(const TYPE (&array)[SIZE])
{
    return SIZE;
}

using namespace std;
using ll = long long int;
using vi = vector<ll>;

#define REPS(a, i, n) for (ll(i) = a; (i) < (n); ++(i))
#define REP(i, n) REPS(0, i, n)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 912345678;

int a[11][11];

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

    REP(i, n)
    REP(j, d)
    {
        cin >> a[i][j];
    }

    int sum = 0;

    REP(i, n)
    {
        REPS(i + 1, j, n)
        {
            int sumd = 0;
            REP(k, d)
            {
                int dd = abs((a[i][k] - a[j][k]));
                sumd += dd*dd;
            }
            if ((int)sqrt((double)sumd)==(double)sqrt((double)sumd))
                sum++;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x,h,w) (y) < 0 || (h) <= (y) || (x) < 0 || (w) <= (x)
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
const long double pi = acos(-1);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }


int main() {
    init();

    string s; cin >> s;
    int len = s.length();
    VL a(len + 1, 0);
    FOR(i, 0, len)if (s[i] == '<') {
        chmax(a[i + 1], a[i] + 1);
    }
    rFOR(i, 0, len)if (s[i] == '>') {
        chmax(a[i], a[i + 1] + 1);
    }

    ll sum = 0;
    for (ll i : a)sum += i;
    cout << sum << "\n";
}


Measured memory_bytes: 4764
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <complex>
#include <iomanip>
using namespace std;
#define rep(i,n) for (int i=0; i < (n); i++)

typedef double D;
typedef complex<D> P;
typedef pair<P, P> L;
typedef vector<P> VP;
const D EPS = 1e-9;
#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

D cross(P a, P b) {		// (2)
  return (conj(a)*b).Y;
}

P crosspointLL(P a1, P a2, P b1, P b2) { // (16)
  D d1 = cross(b2-b1, b1-a1);
  D d2 = cross(b2-b1, a2-a1);
  if (EQ(d1, 0) && EQ(d2, 0)) return a1;
  return a1 + d1/d2*(a2-a1);
}

P circumcenter(P a, P b, P c) {
  a = (a-c)*0.5;
  b = (b-c)*0.5;
  return c + crosspointLL(a, a*P(1,1), b, b*P(1,1));
}

int main() {
  P a1, a2, a3;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    double x1, y1, x2, y2, x3, y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    a1 = P(x1, y1);
    a2 = P(x2, y2);
    a3 = P(x3, y3);
    P ans = circumcenter(a1, a2, a3);
    std::cout << fixed << setprecision(3) << ans.X << " " << ans.Y << " " << abs(ans-a1) << std::endl;
  }

}

Measured memory_bytes: 1312
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

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

	int INF=1<<28;
	double EPS=1e-12;

	int n, a, b, c, x;
	int[] ys;

	void run(){
		for(;;){
			n=sc.nextInt();
			if(n==0){
				break;
			}
			a=sc.nextInt();
			b=sc.nextInt();
			c=sc.nextInt();
			x=sc.nextInt();
			ys=new int[n];
			for(int i=0; i<n; i++){
				ys[i]=sc.nextInt();
			}
			solve();
		}
	}

	void solve(){
		int frame, at;
		for(frame=0, at=0; frame<=10000; frame++){
			if(x==ys[at]){
				at++;
				if(at==n){
					break;
				}
			}
			x=(a*x+b)%c;
		}
		println(at==n?""+frame:"-1");
		// debug(frame, at,at==n);
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

Measured memory_bytes: 31604
#include <stdio.h>

int main(void){

  int a,b;

  while(1){
    scanf("%d %d",&a,&b);
    if(a==0 && b==0){
      break;
    }else if(a>=b){
      printf("%d %d\n",b,a);
    }else{
      printf("%d %d\n",a,b);
    }
    
  }
    
  return 0;
}

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

#define rep(i,l,r) for(int i=(l);i<(r);i++)
#define pb push_back
#define fi first
#define se second

using ll = long long;
using G = vector<vector<int>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const ll MOD = 1000000007;

ll GCD(ll x, ll y){
	return y ? GCD(y, x%y) : x;	
}
ll LCM(ll x, ll y){
	return x/GCD(x, y)*y;
}

int main() {
	int x, y, a, b, c; cin >> x >> y >> a >> b >> c;
	ll p[100005], q[100005], r[100005];
	rep(i, 0, a) cin >> p[i];
	rep(i, 0, b) cin >> q[i];
	rep(i, 0, c) cin >> r[i];
	sort(p, p+a);
	sort(q, q+b);
	vector<ll> select;
	for(ll i=a-1;i>=a-1-(x-1);i--) select.pb(p[i]);
	for(ll i=b-1;i>=b-1-(y-1);i--) select.pb(q[i]);
	rep(i, 0, c) select.pb(r[i]);
	sort(select.rbegin(), select.rend());
	ll ans = 0;
	rep(i, 0, x+y){
		ans += select[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 9780
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string a,b;
  cin>>a>>b;
  if(a[0]==b[2]&&a[1]==b[1]&&a[2]==b[0]){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
  return 0;
}

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

signed main(){
  int N;
  cin>>N;
  int C[4];
  rep(i,4)C[i]=0;
  vector<string> S(N);
  rep(i,N)cin>>S[i];
  rep(i,N){
    if(S[i]=="AC")C[0]+=1;
    if(S[i]=="WA")C[1]+=1;
    if(S[i]=="TLE")C[2]+=1;
    if(S[i]=="RE")C[3]+=1;
  }
  cout<<"AC x "<<C[0]<<endl;
  cout<<"WA x "<<C[1]<<endl;
  cout<<"TLE x "<<C[2]<<endl;
  cout<<"RE x "<<C[3]<<endl;
  return 0;
}

Measured memory_bytes: 6372
from collections import deque, defaultdict
import sys

sys.setrecursionlimit(10**8)
N, M = map(int, input().split())
graph = [[] for _ in range(N)]

for i in range(M):
    a, b = map(int, input().split())
    a -= 1; b -= 1;
    graph[a].append(b)
    graph[b].append(a)


visited = [False for _ in range(N)]
color = [0 for _ in range(N)]

def dfs(now, c):

    color[now] = c

    for adj in graph[now]:
        if color[adj] == c:
            return False

        if color[adj] == 0 and not dfs(adj, -c):
            return False

    return True

ans = dfs(0, 1)
white = color.count(-1)
black = N - white
if ans:
    print(black * white - M)
else:
    print(N * (N-1)//2 - M)


Measured memory_bytes: 36096
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>

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

int main() {
  int N, A;
  string S, T;
  cin>>N;
  cin>>S;
  T = S;
  
  for(int i=0; i<S.size();i++){
    if(S[i] + N >= 91){
      T[i] = S[i] -(26 - N);
    }
  	else T[i] = S[i] + N;
  }
  //vector<int> a(N+1);
  cout<<T<<endl;
  
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <map>
#include <set>
#include <string.h>
#include <queue>
#include <functional>
#include <utility>
using namespace std;

signed main() {
	int ans = 0, cnt = 0;
	char c;
	while (scanf("%c", &c), c == 'S' || c == 'T') {
		if (c == 'S') { cnt++; }
		if (c == 'T') {
			if (cnt > 0) { cnt -= 1; }
			else { ans += 1; }
		}
	}
	ans += cnt;
	cout << ans;

}

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

int waruni(int n) {
  int cnt = 0;
  while(n%2 != 1) {
    cnt++;
    n = n/2;
  }
  return cnt;
}

int main() {
  int ans = 0;
  int N; 
  cin >> N;
  for (int i = 0;i < N;i++) {
    int a;
    cin >> a;
    ans += waruni(a);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
# include<bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, int> pdi;
typedef pair<ll, ll> pll;
 
# define S second
# define F first
# define kill(x) return(cout << x << endl, 0)
# define debug(x) cerr<< #x << " : " << x << endl
# define ddebug(x, y) cerr<< #x << " : " << x  << ", " << #y << " : " << y << endl
# define sz(s) (int)s.size()
# define sq(x) (x) * (x)
# define PB(x) push_back(x)
# define smax(x, y) (x) = max((x), (y))
# define smin(x, y) (x) = min((x), (y))
# define all(x) x.begin(), x.end()
# define SP fixed << setprecision(10)
# define UB upper_bound

const int MAXN = 100 * 1000 + 10;
int n, 
    arr[MAXN];
vector <int> adj[MAXN];
int c, cmp[MAXN];
bool mark[MAXN];

void dfs(int u)
{
	mark[u] = true;
	cmp[u] = c;
	for (int v : adj[u])
		if (!mark[v])
			dfs(v);
}

void dfs_all()
{
	for (int i = 0; i < n; i ++)
		if (!mark[i])
		{
			dfs(i);
			c ++;
		}
}

int32_t main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

	int m;
	cin >> n >> m;
	for (int i = 0; i < n; i ++)
	{
		cin >> arr[i];
		arr[i] --;
	}

	for (int i = 0; i < m; i ++)
	{
		int u, v;
		cin >> u >> v;
		u --, v --;
		adj[u].PB(v);
		adj[v].PB(u);
	}

	dfs_all();

	int ans = 0;
	for (int i = 0; i < n; i ++)
		if (cmp[i] == cmp[arr[i]])
			ans ++;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 8576
#include <iostream>
#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <limits>
#include <map>
#include <set>
#include <iomanip>
#include <cmath>

using namespace std;

typedef long long int ll;
typedef std::numeric_limits<double> dbl;
const long long int LL_INF=1LL<<60;

vector<string> split(const string& input, char delimiter)
{
    stringstream stream(input);
    
    string field;
    vector<string> result;
    while (getline(stream, field, delimiter)) {
        result.push_back(field);
    }
    return result;
}

//#define DEBUG

ll A, B, M, N, D, K, Q, W, H, T, X, Y;

int main()
{
    cin >> N >> M;
    vector<int> nums(N);
    for (int i = 0; i < M; ++i) {
        int a,b; cin >> a >> b;
        if (a != b) {
            nums[a-1]++; nums[b-1]++;
        }
    }

    for (auto n : nums) cout << n << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int M = scanner.nextInt();
    long sum = 0;
    for (int i = 0; i < M; i++) {
      int A = scanner.nextInt();
      sum += A;
    }
    System.out.println(Math.max(N - sum, -1));
  }
}


Measured memory_bytes: 37904
#include<bits/stdc++.h>
using namespace std;
 
#define reps(i,j,n) for(int i = (j) ; i < (int)(n) ; ++i)    
#define rep(i,n) reps(i,0,n)  
#define each(it,c) for(__typeof (c).begin() it = (c).begin(); it != (c).end(); it++)    
typedef pair< int , int > Pi;  
typedef pair< int , Pi > Pii;
typedef long long int64;  
const int INF = 1 << 30;  
template<typename T1, typename T2> istream& operator>>(istream& is, pair<T1,T2>& a){ return is>>a.first>>a.second; }  
template<typename T1, typename T2> ostream& operator<<(ostream& os, pair<T1,T2>& a){ return os<<a.first<<" "<<a.second; }  
template<typename T> istream& operator>>(istream& is, vector< T >& vc){ rep(i,sz(vc)) is >> vc[i]; return is;}  
template<typename T> ostream& operator<<(ostream& os, vector< T >& vc){ rep(i,sz(vc)) os << vc[i] << endl; return os; }

int N;
Pi data[300000];

int calc(int value) { //value:許容匹数
  int64 sum = 0; //放出量の合計
  priority_queue< Pi, vector< Pi >, greater< Pi > > que; //許容量が小さい順
  for(int i = 0; i < N; i++){
    que.push( Pi( data[i].second, data[i].first));
    sum += data[i].first;
    // sum / que.size() を摂取する → sum / que.size() <= que.top()
    while(que.size() > value || !que.empty() && sum > (int64)value * que.top().first){
      sum -= que.top().second;
      que.pop();
    }
    if(que.size() >= value) return true;
  }
  return false;
}

int Binary_Search( int row, int high) {
  int mid = (row + high + 1) >> 1;
  if(row == high)    return(row);
  else if(calc(mid)) return(Binary_Search( mid, high));
  else               return(Binary_Search( row, mid - 1));
}

int main() {

  scanf("%d", &N);
  for(int i = 0; i < N; i++){
    scanf("%d %d", &data[i].first, &data[i].second);
  }
  sort( data, data + N);
  cout << Binary_Search( 0, N) << endl;
}

Measured memory_bytes: 11448
#include<iostream>
    #include<cstdlib>
    #include<math.h>
    #include<set>
    #include<string>
    #include<stdlib.h>
    using namespace std ;
    int main(){
      int X,A,B;
      cin>>X>>A>>B;
      if(A>=B){
        cout<<"delicious"<<endl;
        return 0;
      }
      if(A+X<B){
        cout<<"dangerous"<<endl;
        return 0;
      }
      else cout<<"safe"<<endl;
      return 0;
    }

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

type Pair struct {
	a, b int
}

func ri() (n int) {
	sc.Scan()
	for _, v := range sc.Bytes() {
		n = n*10 + int(v-48)
	}
	return
}

func main() {
	sc.Split(bufio.ScanWords)
	n := ri()

	aMax := Pair{a: -1, b: 0}
	for i := 0; i < n; i++ {
		a, b := ri(), ri()
		if a > aMax.a {
			aMax = Pair{a: a, b: b}
		}
	}

	fmt.Println(aMax.a + aMax.b)
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
using std::cin;
using std::cout;
using std::endl;

int main(){
  int k, x, i, j;

  cin >> k >> x;
  int a[2 * k];
  a[k - 1] = x;

  for (i = 1; i < k; i++){
    a[k - i - 1] = x - i;
    a[k + i - 1] = x + i;
  }

  for (i = 0; i < 2 * k - 1; i++){
    printf("%d ", a[i]);
  }

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
#include<vector>
using namespace std;
typedef pair<int, int>P;
typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)
//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
map<ll, ll>ins;
void facterize(ll n) {
	ll a = 2;
	while (n >= a * a) {
		if (n % a == 0) {
			ins[a]++;
			ins[a] = ins[a] % 1000000007;
			n /= a;
		}
		else {
			a++;
		}
	}
	ins[n]++;
}

int keta(int x) {
	int y = 0;
	while (x > 0) {
		y++;
		x /= 10;
	}
	return y;
}

ll dx[8] = { 0,0,-1,1 };
ll dy[8] = { -1,1,0,0 };
ll dp[1010][1010];
ll land[101][101];
bool flag[101][101];
ll h, w;

void dfs(ll y, ll x) {
	flag[y][x] = false;
	for (ll dx = -1;dx <= 1;++dx) {
		for (ll dy = -1;dy <= 1;++dy) {
			if (0 <= y + dy && y + dy < h && 0 <= x + dx && x + dx < w && flag[y + dy][x + dx]) {
				dfs(y + dy, x + dx);
			}
		}
	}
	return;
}

//long longしか使わない
int main() {
	while (cin >> w >> h,w||h) {
		for (ll i = 0;i < h;++i) {
			for (ll j = 0;j < w;++j) {
				cin >> land[i][j];
				if (land[i][j])flag[i][j] = true;
			}
		}
		ll ans = 0;
		for (ll i = 0;i < h;++i) {
			for (ll j = 0;j < w;++j) {
				if (flag[i][j]) {
					dfs(i, j);
					ans++;
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}



Measured memory_bytes: 3292
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */

#define MAXN (100000)
#define MOD (1000000007)

int main(void)
{
    int k,x;
    scanf("%d %d",&k, &x);

    for(int i=x-k+1;i<x+k;i++) printf("%d ", i);
    printf("\n");

    return 0;
}





Measured memory_bytes: 128
#include "bits/stdc++.h"

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  string S;
  string T;
  cin >> S >> T;
  ll n = S.size();
  bool flg=false;
  rep(i, n){
    string a = S.substr(i, n-i) + S.substr(0, i);
    cerr << a << endl;
    if(a==T){
      flg = true;
    }
  }
  if(flg){
    cout <<"Yes";
  }else{
    cout << "No";
  }
  return 0;
}


Measured memory_bytes: 3592
#include <atcoder/twosat>
#include <iostream>
#include <vector>

using namespace std;
using namespace atcoder;

int main() {
    int n, d;
    cin >> n >> d;
    vector<int> x(n), y(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
    }

    // ts[i] = (i-th flag is located on x[i])
    two_sat ts(n);

    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (abs(x[i] - x[j]) < d) {
                // cannot use both of x[i] and x[j]
                ts.add_clause(i, false, j, false);
            }
            if (abs(x[i] - y[j]) < d) {
                ts.add_clause(i, false, j, true);
            }
            if (abs(y[i] - x[j]) < d) {
                ts.add_clause(i, true, j, false);
            }
            if (abs(y[i] - y[j]) < d) {
                ts.add_clause(i, true, j, true);
            }
        }
    }

    if (!ts.satisfiable()) {
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;
    auto answer = ts.answer();
    for (int i = 0; i < n; i++) {
        if (answer[i])
            cout << x[i] << endl;
        else
            cout << y[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 3684
n = int(input())
A, B = 0, 0

for _ in range(n):
    s1, s2 = input().split()
    if s1 < s2:
        B += 3
    elif s1 > s2:
        A += 3
    else:
        A += 1
        B += 1

print(A, B)


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

#ifdef NON_SUBMIT
#define TEST(n) (n)
#define tout cerr
#else
#define TEST(n) ((void)0)
#define tout cin
#endif

using namespace std;

int cnt[2][60];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt", "r", stdin));
	TEST(freopen("output.txt", "w", stdout));
	TEST(freopen("debug.txt", "w", stderr));
	int N;
	long long K, A, ans=0;
	for(cin>>N>>K;N;N--) {
		cin>>A;
		for(int b=59;b>=0;b--) cnt[(A>>b)&1][b]++;
	}
	A=0;
	for(int b=59;b>=0;b--) {
		if(cnt[0][b]>cnt[1][b] && (A|(1LL<<b))<=K) {
			A|=1LL<<b;
			ans+=cnt[0][b]*(1LL<<b);
		}
		else ans+=cnt[1][b]*(1LL<<b);
	}
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 256
import sys,queue,math,copy,itertools,bisect,collections,heapq

class Node:
    def __init__(self,x):
        self.data = x
        self.count = 1
        self.left = None
        self.right = None

def insert(node,x):
    if node is None: return Node(x)
    if node.data == x:
        node.count += 1
    elif x < node.data:
        node.left = insert(node.left,x)
    else:
        node.right = insert(node.right,x)
    return node

def search_min(node):
    if node.left is None: return node.data
    return search_min(node.left)

def delete_min(node):
    if node.left is None:
        if node.count > 1:
            node.count -= 1
        else:
            return node.right
    else:
        node.left = delete_min(node.left)
    return node

def delete(node,x):
    if node:
        if x == node.data:
            if node.count > 1:
                node.count -= 1
            elif node.left is None:
                return node.right
            elif node.right is None:
                return node.left
            else:
                node.data = search_min(node.right)
                node.right = delete_min(node.right)
        elif x < node.data:
            node.left = delete(node.left,x)
        else:
            node.right = delete(node.right,x)
    return node


def main():
    sys.setrecursionlimit(10**7)
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]

    N,M = LI()
    p = [LI() for _ in range(M)]

    p.sort()

    r = [[] for _ in range(N+1)]
    d = 0
    j = 0
    root = None
    for i in range(1,N):
        update = False
        while j < M and p[j][0] == i:
            root = insert(root,d + p[j][2])
            update = True
            r[p[j][1]].append(d + p[j][2])
            j += 1
        for z in r[i]:
            root = delete(root,z)
            update = True
        if root == None:
            print(-1)
            return
        if update:
            d = search_min(root)
    print(d)

if __name__ == '__main__':
    main()

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

int main(){

    int N, i, a;
    cin >> N;
    int t[N], x[N], y[N];
    a = 0;
    t[0]=0;
    x[0]=0;
    y[0]=0;

    for(i=1; i<=N; i++){
        cin >> t[i] >> x[i] >> y[i];
    }
    
    for(i=0; i <N; i++){
        if( (t[i+1]-t[i]) < abs(x[i+1]-x[i])+abs(y[i+1]-y[i]) ){
            a = 1;
            break;
        }
    }
    for(i=0; i <N; i++){
        if( abs(((t[i+1]-t[i])-(x[i+1]-x[i])-(y[i+1]-y[i])))%2 == 1 ){
            a = 1;
            break;
        }
    }
    if(a==0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 1408
N, M = map(int, input().split())


def make_divisors(n):
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            yield i
            if i != n // i:
                yield n // i


ans = 0
for x in make_divisors(M):
    if x >= N:
        ans = max(ans, M // x)
print(ans)


Measured memory_bytes: 2940
import sys
def input():return sys.stdin.readline()[:-1]
def N(): return int(input())
def NM():return map(int,input().split())
def L():return list(NM())

D=N()
c=[0]+L()
s=[[0]*27]+[[0]+L() for i in range(D)]

dp=[]
T=[0]
ld=[0]*(27)
for i in range(1,D+1):
    ma=0
    t=0
    for j in range(1,27):
        tmp=s[i][j]+(i-ld[j])*(D-i+1)*c[j]
        if tmp>ma:
            ma=tmp
            t=j
    T.append(t)
    ld[t]=i
        
sc=sum(c)
def point():
    ld=[0]*(27)
    score=-sc*((D+1)*D//2)
    for i in range(1,D+1):
        t=T[i]
        score+=s[i][t]+(i-ld[t])*(D-i+1)*c[t]
        ld[t]=i
    return score


ma=point()
TT=T[:]
import random
for i in range(200000):
    d1,q1=random.randrange(1,D+1),random.randrange(1,27)
    d2,q2=random.randrange(1,D+1),random.randrange(1,27)
    old1=T[d1]
    old2=T[d2]
    T[d1]=q1
    T[d2]=q2
    new=point()
    if new>ma:
        ma=new
        TT=T[:]

T=TT[:]
now=ma
for i in range(100000):
    d1,q1=random.randrange(1,D+1),random.randrange(1,27)
    d2,q2=random.randrange(1,D+1),random.randrange(1,27)
    old1=T[d1]
    old2=T[d2]
    T[d1]=q1
    T[d2]=q2
    new=point()
    if new>now:
        now=new
    else:
        T[d1]=old1
        T[d2]=old2

for i in range(100000):
    d1,q1=random.randrange(1,D+1),random.randrange(1,27)

    old1=T[d1]

    T[d1]=q1

    new=point()
    if new>now:
        now=new
    else:
        T[d1]=old1
for i in T[1:]:
    print(i)


Measured memory_bytes: 90092