akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;cin>>s;
  vector<int> v;
  int q=s.size();
  v.push_back(q);
  int now=1;
  bool used[26];
  vector<int> ans;
  fill(used,used+26,false);
  int cnt=0;
  for(int i=s.size()-1;i>=0;i--){
    int num=s[i]-'a';
    if(used[num]==false){
      cnt++;
      used[num]=true;
    }
    if(cnt==26){
      v.push_back(i);
      cnt=0;
      fill(used,used+26,false);
      now++;
    }
  }
  //cout<<v[0]<<v[1];return 0;
  int pla=0;
  for(;;){
    int li=v[v.size()-1];
    bool bo[26];fill(bo,bo+26,false);
    for(int i=pla;i<li;i++){
      int p=s[i]-'a';
      bo[p]=true;
    }
    int nu;
    for(int i=0;i<26;i++){
      if(bo[i]==false){
        ans.push_back(i);
        nu=i;
        v.pop_back();
        break;
      }
    }
    if(ans.size()==now)break;
    for(int i=li;i<v[v.size()-1];i++){
      int r=s[i]-'a';
      if(r==nu){
        pla=i+1;
        break;
      }
    }
  }
  for(int i=0;i<ans.size();i++){
    char u=ans[i]+'a';
    cout<<u;
  }
  cout<<endl;
}

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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define LL long long

struct Pcnt{
    LL p;
    int cnt;
};

LL n;
vector<Pcnt> primes;

long long extGCD(long long a, long long b, long long &x, long long &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a%b, y, x);
    y -= a/b * x;
    return d;
}

LL pow(LL a,LL b){
    LL ret = 1,b_=a;
    while(b){
        if(b%2)ret*=b_;
        b_ = b_*b_;
        b/=2;
    }
    return ret;
}

int main() {
    cin>>n;
    n*=2;
    LL dumn = n;
    FOR(p,2,n){
        if((LL)p*(LL)p >= n || dumn == 1){
            if(dumn != 1)primes.push_back(Pcnt{dumn,1});
            break;
        }
        if(!(dumn%p)){
            FOR(i,1,52){
                if(!(dumn % pow((LL)p,(LL)i)) && dumn % pow((LL)p,(LL)i+1)){
                    primes.push_back(Pcnt{(LL)p,i});
                    dumn /= pow(p,i);
                    break;
                }
            }
        }
    }
    /*REP(i,primes.size()){
        cerr<<primes[i].p<<" "<<primes[i].cnt<<endl;
    }*/
    LL ret = n;
    REP(i,1<<primes.size()){
        LL k=1,x,y;
        REP(j,primes.size()){
            if(i & (1<<j)){
                k*=pow(primes[j].p,primes[j].cnt);
            }
        }
        if(!(k%2))continue;
        if(k==n){
            ret = min(ret,k);
            continue;
        }
        LL kcomp = n/k;
        LL ret_ = extGCD(k,kcomp,x,y);
        //cerr<<k<<" "<<kcomp<<" "<<x<<endl;
        LL kk = ((kcomp-(x+kcomp)%kcomp)*k);
        ret = min(ret,kk);

        kk = (((x+kcomp)%kcomp)*k);
        if(kk!= 1) ret = min(ret,kk-1);
    }
    cout<<ret<<endl;
}

Measured memory_bytes: 4108
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)

#ifdef ENABLE_DEBUG
template <typename T>
void debug(T value) {
  cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                              \
  do {                                          \
    cerr << " \033[33m (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ":\033[0m ";        \
    debug(__VA_ARGS__);                         \
    cerr << endl;                               \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<vector<int>> A(N, vector<int>(N - 1));
  REP(i, N) REP(j, N - 1) {
    int x;
    cin >> x;
    A[i][j] = x - 1;
  }
  vector<int> counter(N);
  set<tuple<int, int>> pairs;
  REP(i, N) {
    int opponent = A[i][0];
    if (i < opponent && A[opponent][0] == i) {
      pairs.emplace(i, opponent);
    }
  }
  auto solve = [&]() -> int {
    int days = 0;
    int rem_count = N * (N - 1);
    set<tuple<int, int>> tmp;
    for (; rem_count > 0; ++days) {
      if (pairs.empty()) return -1;
      tmp.clear();
      swap(tmp, pairs);
      for (auto [x1, x2] : tmp) {
        counter[x1]++;
        counter[x2]++;
        rem_count -= 2;
        for (int i : {x1, x2}) {
          if (counter[i] >= N - 1) continue;
          int opponent = A[i][counter[i]];
          int k = counter[opponent];
          assert(k < N - 1);
          if (A[opponent][k] == i) {
            pairs.emplace(min(i, opponent), max(i, opponent));
          }
        }
      }
    }
    return days;
  };
  cout << solve() << endl;
}


Measured memory_bytes: 7584
#include <iostream>
#include <vector>
#include <stack>
#include <unordered_set>
#include <numeric>
#include <iterator>
#include <unordered_map>
#include <array>
#include <map>
#include <cstring>
#include <iomanip>
#include <string>
#include <algorithm>
#include <cmath>
#include <ctgmath>
#include <set>
#include <queue>
#include <fstream>
#include <ostream>
#include <random>
#include <chrono>

using namespace std;

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

	int n, q;
	cin >> n >> q;

	string s;
	cin >> s;

	vector<int> ans;

	ans.push_back(0);
	for (int i = 1; i < n; i++)
	{
		if (s[i] == 'C' && s[i - 1] == 'A')
		{
			ans.push_back(ans.back() + 1);
		}
		else
		{
			ans.push_back(ans.back());
		}
	}

	while (q--)
	{
		int l, r;
		cin >> l >> r;

		l--; r--;
		cout << ans[r] - ans[l] << "\n";
	}
}


Measured memory_bytes: 1480
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include <functional>
#include <limits>


using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

class BIT{
	vector<int> bit;
	
public:
	
	BIT(){
	}
	
	BIT(int size){
		init(size);
	}
	
	void init(int size){
		bit.clear();
		bit.resize(size+1);
	}
	
	int sum(int i){
		int s = 0;
		while(i > 0){
			s += bit[i];
			i -= i & -i;
		}
		return s;
	}

	void add(int i , int x){
		while(i < bit.size()){
			bit[i] += x;
			i += i & -i;
		}
	}

	int lower_bound(int w){
		if(w <= 0) return 0;
		int x = 0, t = 1;
		while(t*2 < bit.size()) t *= 2;
		
		for(int k = t; k > 0; k /= 2){
			if(x + k < bit.size() && bit[x + k] < w){
				w -= bit[x + k];
				x += k;
			}
		}
		return x + 1;
	}
};

struct fast_io {
	fast_io(){
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
	};
};

signed main(){
	// cout<<fixed<<setprecision(10);
	
	int N, Q;
	string S;
	vector<BIT> bit(26);
	
	cin>>N;
	cin>>S;
	cin>>Q;
	
	for(int i = 0; i < 26; i++){
		bit[i].init(N+10);
	}
	
	for(int i = 0; i < N; i++){
		bit[S[i] - 'a'].add(i+1, 1);
	}
	
	for(int i = 0; i < Q; i++){
		int a, b;
		
		cin>>a>>b;
		
		
		if(a == 1) {
			char c;
			
			cin>>c;
			
			bit[S[b-1] - 'a'].add(b, -1);
			bit[c - 'a'].add(b, 1);
			S[b-1] = c;
			
		} else {
			int r;
			cin>>r;
			
			int con = 0;
			for(int j = 0; j < 26; j++){
				if(bit[j].sum(r) - bit[j].sum(b-1) >= 1) con++;
			}
			
			cout<<con<<endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 102528
#include <iostream>
#include<cstring>

using namespace std;

int main()
{
   string s;
   cin>>s;
   int n=s.length(),c=0;
   for(int i=0;i<n;i++)
   {
     if((i%2==0&&s[i]=='R'||s[i]=='U'||s[i]=='D')||(i%2!=0&&s[i]=='L'||s[i]=='U'||s[i]=='D'))
        c++;
     else
     break;
   }
   if(c==n)
    cout<<"Yes"<<endl;
   else
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int i, x, sum = 0;
	for(i = 0; i < 5; ++i) {
		scanf("%d", &x);
		if(x < 40) {
			sum += 40;
		} else {
			sum += x;
		}
	}
	printf("%d\n", sum / 5);
	return 0;
}

Measured memory_bytes: 1028
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int N = 2e5 + 5, M = 2 * N + 5;

map<string, ll> mp;
int main(){
    IO;
    int n;
    cin >> n;
    for(int i = 0 ; i < n ; ++i){
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        ++mp[s];
    }
    ll ans = 0;
    for(auto i : mp)
        ans += ((i.second * (i.second - 1)) / 2LL);
    cout << ans << endl;
}

Measured memory_bytes: 11264
#include <stdio.h>
#include <stdlib.h>
 
typedef struct{
    int key;
    int left;
    int right;
} Node;
 
void insert(Node*, int, int);
void print1(Node*, int);
void print2(Node*, int);
 
int main()
{
    char s[10];
    Node *t;
    int m;
    int a;
    int i;
 
    scanf("%d", &m);
    t=(Node*)malloc(sizeof(Node)*m);
 
    int count=0;
    for(i=0; i<m; i++){
        scanf("%s", &s);
        if(s[0]=='i'){ scanf("%d", &a); insert(t, count, a); count++; }
        if(s[0]=='p'){
            if(count>0) print1(t, 0);
            printf("\n");
            if(count>0) print2(t, 0);
            printf("\n");
        }
    }
     
    return 0;
 
}
 
void print1(Node *t, int p)
{
    if(t[p].left>=0) print1(t, t[p].left);
    printf(" %d", t[p].key);
    if(t[p].right>=0) print1(t, t[p].right);
}
 
void print2(Node *t, int p)
{
    printf(" %d", t[p].key);
    if(t[p].left>=0) print2(t, t[p].left);
    if(t[p].right>=0) print2(t, t[p].right);
}
 
void insert(Node *t, int count, int z)
{
    int x=0, y;
    if(count<1) x=-1;
 
    t[count].key = z;
    t[count].left = -1;
    t[count].right= -1;
 
    while(x>=0){
        y = x; // ????????¨????
        if(z < t[x].key)
            x = t[x].left; // ??????????????§????
        else
            x = t[x].right; // ??????????????§????
    }
 
    if(count<1){}
    else if(z < t[y].key){
        t[y].left = count; // z ??? y ?????????????????????
    }
    else {
        t[y].right = count; // z ??? y ?????????????????????
    }
}

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

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

  int N, tmp;
  cin >> N;
  vector<int> ans(N+1);

  for (int i = 1; i <= 100; i++)
  {
    for (int j = 1; j <= 100; j++)
    {
      for (int k = 1; k <= 100; k++)
      {
        tmp = i*i + j*j + k*k + i*j + j*k + k*i;
        if(tmp <= N) ans[tmp]++;
      }
    }
  }

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

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

int main() {
  string S;
  cin >> S;
  bool ans = false;
  if (S[0] == S[1] && S[0] != S[2] && S[0] != S[3] && S[2] == S[3]) {
    ans = true;
  }
  else if (S[0] == S[2] && S[0] != S[1] && S[0] != S[3] && S[1] == S[3]) {
    ans = true;
  }
  else if (S[0] == S[3] && S[0] != S[1] && S[0] != S[2] && S[1] == S[2]) {
    ans = true;
  }
  cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
s = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = gets.to_i
puts s[k - 1]


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int x, n;


int main(void){
    cin >> x >> n;
    if(n == 0){
        cout << x << endl;
        return 0;
    }
    vector<bool> p(n, false);
    for(int i = 0; i < n; i++){
        int pi;
        cin >> pi;
        p[pi] = true;
    }
    int mind = INT_MAX;
    int res;
    for(int i = 0; i <= 101; i++){
        if(i >= 1 && i <= 100) if(p[i] == true) continue;
        if(mind > abs(x-i)){
            mind = abs(x-i);
            res = i;
        }
    }
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 3636
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
  int ta, tb;

  REP(i, 7) {
    cin >> ta >> tb;
    cout << ta-tb << endl;
  }
}

Measured memory_bytes: 1160
fun str() = readLine()!!
fun int() = str().toInt()
fun long() = str().toLong()

fun read(d:String = " ") = str().split(d)
fun <T> list(d:String = " ",f:String.()->T) = read(d).map {f(it)}
fun list() = list {toInt()}

fun <T> T.print() = println(this)

const val mod = 998244353L

fun main() {
	abc000X()
}

fun abc000X() {
	val n = int()
	println((n+n*n+n*n*n))
}


Measured memory_bytes: 34560
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <ios>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
using namespace std;
typedef long long ll;
#define mp make_pair;
#define pb push_back;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int X,A;
  cin >> X >> A;

  if(X < A){
  cout << 0 << endl;
  }
  else{
    cout << 10 << endl;
  }


  return 0;
    

}


Measured memory_bytes: 256
n,l,*a=map(int,open(0).read().split())
i=m=0
for j,(x,y)in enumerate(zip(a,a[1:]),1):
  if x+y>m:
    m=x+y
    i=j
if m<l:
  print('Impossible')
else:
  print('Possible')
  print(*range(1,i))
  print(*range(n-1,i,-1))
  print(i)

Measured memory_bytes: 71228
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  ll s;
  cin >> s;

  constexpr ll h = 1000000000;

  ll y3 = (s + h - 1) / h;
  ll x3 = h * y3 - s;

  cout << "0 0 " << h << " " << 1 << " " << x3 << " " << y3 << ln;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
int main(){
    int a,b,c,d,e,f,x,y,z;
    std::cin>>a>>b>>c>>d>>e>>f;
    x=a+b+c+d+e+f;
    y=std::min({a,b,c,d});
    z=std::min({e,f});
    std::cout<<x-y-z<<std::endl;
    return 0;
}



Measured memory_bytes: 3120
#include<iostream>

using namespace std;

int main(){
    int n, H[100000], x[100000], s = 0, s_min = 0;
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> H[i];
    }
    for(int i = 1; i < n; i++){
        if(H[i] < H[i+1]) x[i] = 1;
        else x[i] = -1;
    }
    for(int i = 1; i < n; i++){
        if(x[i] < 0) s += x[i];
        else s = 0;
        if(s_min > s) s_min = s;
    }
    cout << s_min * (-1) << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;
const int MOD = 1000000007;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
inline void swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
inline void swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }



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

	vvi nxt(n, vi(26, n));

	for(int i = n - 1; i >= 1; --i)
		REP(c, 26)
	{
		if (s[i] != 'a' + c)
			nxt[i - 1][c] = nxt[i][c];
		else
			nxt[i - 1][c] = i;
	}

	REP(i, n)
		if (nxt[i][s[i] - 'a'] <= i + 2 && nxt[i][s[i] - 'a'] != n)
		{
			cout << i + 1 << " " << nxt[i][s[i] - 'a'] + 1 << endl;
			return 0;
		}

	cout << "-1 -1" << endl;
}


Measured memory_bytes: 13696
#include <string.h>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <iterator>
#include <functional>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <cstdio>
using namespace std;
#define sz(a)  int((a).size())
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define CLR(a) memset((a), 0, sizeof(a))
#define INF (1 << 31) - 1
const int dh[8] = {-1, 1, 0, 0,1,1,-1,-1};
const int dw[8] = {0, 0, 1, -1,1,-1,1,-1};
typedef long long ll;
typedef pair<ll, ll> p;
typedef vector <int> VI;
typedef vector <string> VS;

int main(){

	int n;
	cin >> n;
	
	int c = 0;
	for(int i = 0; i < n; i++){
		ll x;
		cin >> x;
		if(x % 2 == 1) c++;
	}

	if(c % 2 == 0) {
		cout << "YES" << endl;	
	}else {
		cout << "NO" << endl;	
	}

	return 0;	
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
long long gcd(long m,long n){
	if(n==0) return m;
	else 
		return gcd(n,m%n);
}
long long lcm(long a,long b){
	return a/gcd(a,b)*b;
}

int main(){
	long a,b;
	scanf("%ld%ld",&a,&b);
	printf("%lld\n",lcm(a,b));
	return  0;
}

Measured memory_bytes: 256
A,B,H,M = gets.split.map &:to_i

m = M/60.0
arad = (H+m)/12.0 * 2 * Math::PI
brad = m * 2 * Math::PI

ax = A * Math.cos(arad)
ay = A * Math.sin(arad)
bx = B * Math.cos(brad)
by = B * Math.sin(brad)

dx = ax-bx
dy = ay-by

puts Math.sqrt(dx*dx+dy*dy)

Measured memory_bytes: 14732
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>

#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

typedef long long LL;
typedef double db;

int get(){
	char ch;
	while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
	if (ch=='-'){
		int s=0;
		while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
		return -s;
	}
	int s=ch-'0';
	while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
	return s;
}

const int N = 100005;

int n;
int a[N];

int gcd(int x,int y){
	if (!y)return x;
	return gcd(y,x%y);
}

bool solve(){
	sort(a+1,a+1+n);
	int cnt0=0,cnt1=0;
	fo(i,1,n)
	if (a[i]&1)cnt1++;else cnt0++;
	if (cnt0%2==1)return 1;
	else{
		if (cnt1>1||(cnt1==1&&a[1]==1))return 0;
		fo(i,1,n)if (a[i]&1){a[i]--;break;}
		int g=a[1];
		fo(i,1,n)g=gcd(g,a[i]);
		fo(i,1,n)a[i]/=g;
		return solve()^1;
	}
}

int main(){
	n=get();
	fo(i,1,n)a[i]=get();
	if (solve())printf("First\n");
	else printf("Second\n");
	return 0;
}

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

using namespace std;

#define int long long
#define INF 1e9
#define LINF 1e18

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<int, P> Pi;

typedef pair<P, P> PP;

const int MOD = 1e9 + 7;
const int dy[] = { 0, 0, 1, -1 };
const int dx[] = { 1, -1, 0, 0 };

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

int a, b, N;
int app[1001];

signed main() {
	cin.tie(0);
    ios::sync_with_stdio(false);
    
    int a, b, N;
    cin >> a >> b >> N;
    for(int i = 0; i < N; ++i) {
    	int s, f;
    	cin >> s >> f;
    	++app[s]; --app[f];
    }
    for(int i = 1; i <= 1000; ++i) app[i] += app[i - 1];
    for(int i = a; i < b; ++i) if(app[i]) {
    	cout << 1 << "\n";
    	return 0;
    }
    cout << 0 << "\n";
	return 0;
}



Measured memory_bytes: 3240
#include<stdio.h>
int A[1000000],n;
int binarySearch(int key){
 int left=0;
 int right=n;
 int mid;
 while(left<right){
  mid=(left+right)/2;
  if(key==A[mid])return 1;
  if(key>A[mid])left=mid+1;
  else if(key<A[mid])right=mid;
 }
 return 0;
}
int main(){
 int i,q,k,sum=0;
 scanf("%d",&n);
 for(i=0;i<n;i++){
  scanf("%d",&A[i]);
 }
 scanf("%d",&q);
 for(i=0;i<q;i++){
  scanf("%d",&k);
  if(binarySearch(k))sum++;
 }
 printf("%d\n",sum);
 return 0;
}


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

int main( int argc, char *argv[] )
{
int i;
int N;
char S[ 200 ];
char C;
int iL;
int iR;

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> N;
	cin >> S;

iL = 0;
	iR = 0;
	for( i = 0; i < N; i++ )
	{
		C = S[ i ];
		if( C == ')' )
		{
			if( iL > 0 )
				iL--;
			else
				iR++;
		}
		else
		{
			iL++;
		}
	}

	for( i = 0; i < iR; i++ ) cout << "(";

	cout << S;
	for( i = 0; i < iL; i++ ) cout << ")";

	cout << endl;

	return 0;
}




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

int main() {
    int n; cin >> n;
    vector<int> a(n);
    for (auto &ai: a) cin >> ai;
    vector<int> x(n);
    for (int i = 0; i < n; i++) x[i] = a[i] - (i + 1);
    sort(begin(x), end(x));
    long long ans = 0;
    for (int xi: x) ans += abs(xi - x[n / 2]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
import std.stdio;
import std.conv;
import std.string;

void main()
{
  auto n =(readln.strip.split);
  while( n[1] != "?" ) {
      int a = to!int(n[0]),c = to!int(n[2]);
      switch(n[1]) {
          case "+":
              writeln(a+c);
              break;
          case "-":
              writeln(a-c);
              break;
          case "*":
              writeln(a*c);
              break;
          case "/":
              writeln(a/c);
              break;
          default:
              break;
      }
      n = (readln.strip.split);
  }
}

Measured memory_bytes: 2488
#!/usr/bin/env python3
import sys


def solve(N: int, D: int, X: int, A: "List[int]"):
    chocolates = []
    for a in A:
        chocolates.append(search(D, a))
    print(sum(chocolates) + X)
    return


def search(day: int, ai: int):
    ans = 0
    for i in range(day):
        if i * ai + 1 <= day:
            ans += 1
    return ans


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, D, X, A)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
s = input()
t = input()
a = len(list(s))
b = len(list(t))
#dp[i][j] をsをi番目、ｔをj番目までの最長共通長
INF = float('inf')
dp = [[-INF for j in range(b+1)] for i in range(a+1)]
for i in range(a+1):
    dp[i][0] = 0
for j in range(b+1):
    dp[0][j] = 0
for i, x in enumerate(list(s)):
    for j, y in enumerate(list(t)):
        if x == y:
            dp[i+1][j+1] = dp[i][j] + 1
        else:
            dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j])
#復元パート
ans = ''
while a > 0 and b >0:

    if dp[a][b] == dp[a-1][b]:
        a -= 1
    elif dp[a][b] == dp[a][b-1]:
        b -= 1
    else:
        ans = list(s)[a-1] + ans
        a -= 1
        b -= 1
print(ans)

Measured memory_bytes: 354056
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll oo = 0x3f3f3f3f3f3f3f3fLL;
#define sz(c) ll((c).size())
#define all(c) begin(c),end(c)
#define TR(X) ({ if(1) cerr << "Trace: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll n; cin >> n;
	vector<ll> inp(n);
	for(auto &k: inp) cin >> k;
	sort(all(inp));
	double cur = inp[0];
	for(ll i = 1; i < n; i++) {
		cur = (cur + inp[i]) / 2;
	}
	cout << fixed << setprecision(10) << cur << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Debug_array(a,n) for (ll i=(0); i<(n); i++) cout<<a[i]<<" "
#define Foe(i,s,e) for (ll i=(s); i<=(e); i++)
#define Fod(i,s,e) for (ll i=(s)-1; i>=(e); i--)
#define pii pair<ll,ll>
#define fi first
#define se second
#define endl "\n"
#define mp make_pair
#define big_prime 15486277
#define bigger_prime 179424697
#define biggest_prime 32416188691
//#define random_shuffle(indices.begin(), indices.end());
//std::random_device rd;
//std::mt19937 g(rd());
//std::shuffle(v.begin(), v.end(), g);
using namespace __gnu_pbds; 
using namespace std;
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
// template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE


typedef long long ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set; 

#define Mod 998244353
#define MAX 5002

ll power(ll a,ll b){
	if(b==0) return 1;
	ll temp = power(a,b/2)%Mod;
	if(b%2==0){
		return (temp*temp)%Mod;
	}else{
		return (a*((temp*temp)%Mod))%Mod;
	}
}


int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll n;cin>>n;
	ll zeros=0;
	pii a[n];For(i,0,n){
		cin>>a[i].fi;
		a[i].se = i;
		if(a[i].fi==0) zeros++;
		if(a[i].fi==0 && i!=0){
			cout<<0<<endl;
			return 0;
		}
	}
	if(zeros!=1){
		cout<<0<<endl;
		return 0;
	}
	sort(a,a+n);

	ll i = 1;
	ll k = 1;
	ll prev = 1;

	ll ans = 1;

	while(i<n){
		ll j = i;
		ll count = 0;
		while(j<n && a[j].fi==k){
			count++;
			j++;
		}

		if(count==0){
			cout<<0<<endl;
			return 0;
		}else{
			k++;
			ans = (ans*power(prev,count))%Mod;
			prev = count;
		}

		i = j;
	}

	cout<<ans<<endl;



































	
}

Measured memory_bytes: 1920
#include <iostream>

using namespace std;

const int MOD = 1000000007;

long long fact[200001];
long long inv[200001];
long long factInv[200001];

void init(){
	fact[0] = inv[1] = factInv[0] = 1;
	for(int i=2;i<=200000;i++) inv[i] = inv[MOD%i] * (MOD - MOD/i) % MOD;
	for(int i=1;i<=200000;i++){
		fact[i] = fact[i-1] * i;
		fact[i] %= MOD;
		factInv[i] = factInv[i-1] * inv[i];
		factInv[i] %= MOD;
	}
}

long long comb(int a, int b){
	return fact[a] * factInv[b] % MOD * factInv[a-b] % MOD;
}

int main(){
	int H, W, A, B;
	init();
	while(cin >> H >> W >> A >> B){
		long long res = 0;
		for(int i=0;i<H-A;i++){
			long long a = comb(B-1+i, B-1);
			long long b = comb(W-B-1 + H-i-1, W-B-1);
			res += a*b%MOD;
			res %= MOD;
		}
		cout << res << endl;
	}
}


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

vector<int> T;


void maxHeapify(vector<int> &T, int i){
	// n == H
	int n = T.size() - 1;
	if(n == 0 ||n == 1) return;
	
	// 	index of left son and right son;
	int l, r, largest;
	l = 2 * i;
	r = 2 * i + 1;
	
	if(l <= n && T[i] < T[l]) largest = l;
	else largest = i;
	if(r <= n && T[largest] < T[r]) largest = r;
	
	if(largest != i){
		swap(T[largest], T[i]);
		maxHeapify(T, largest);
	}
	
}

// extract
int extract(){
	if(T.size() <= 1) return INT_MIN;
	
	int max = T[1];
	
	T[1] = T.back();
	T.pop_back();
	maxHeapify(T, 1);
	
	return max;
}



// insert
void upTowardRoot(int i){
	while(T[i] > T[i/2] && i/2 >= 1){
		swap(T[i], T[i/2]);
		i = i/2;
	}
}

void insert(int key){
	T.push_back(key);
	int i = T.size() - 1; 
	upTowardRoot(i);
}


int main(int argc, char** argv) {
	T.push_back(INT_MIN); // T[0] == INT_MIN;
	int key;
	string com;
	while(1){
		//getline(cin, com);
		cin >> com;
	//scanf("%s", &com);
		if(com[0] == 'e' && com[1] == 'n') break;
		if(com[0] == 'i'){
			cin >> key;
			insert(key);
		}
		else{
			cout << extract() << endl;
		}
	}
	
	return 0;
}


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

#define rep(i, j, k) for(int i = (int) j; i < (int) k; ++i)
#define sz(x) ((int) (x).size())
#define ll long long
#define mp make_pair
#define pii pair<int, int >
#define fi first
#define se second
#define pb push_back
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define zero(x) memset((x), (0), sizeof (x))
#define zerox(x, y) memset((x), (y), sizeof (x))

using namespace std;

int main()
{
#ifdef PIT
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
#endif //PIT

	ios_base::sync_with_stdio(false); cin.tie(0);
	string s;
	cin >> s;
	int n = sz(s);
	int t = (n&1) ? 1 : 2;
	while(n) {
		n -= t;
		int k = n / 2;
		int f = 1;
		for(int i = 0; i < k; ++i) if(s[i] != s[k+i]) {
			f = 0;
			break;
		}
		if(f) break;
	}	
	cout << n << endl;

#ifdef PIT
flush(cout);
cerr << endl << "Time: " << (clock() / double(CLOCKS_PER_SEC)) << endl;
#endif //PIT
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <string>
#include <iostream>
#include <cassert>
#include <cmath>
using namespace std;

int main() {
        int n, m;
        scanf("%d%d", &n, &m);
        vector<long long> sum(n + 1);
        sum[0] = 0;
        map<int, int> cnt;
        for (int i = 0; i < n; i ++) {
                int a;
                scanf("%d", &a);
                sum[i + 1] = sum[i] + a;
                sum[i + 1] %= m;
                cnt[sum[i + 1]] ++;
        }
        cnt[0] ++;
        long long ans = 0;
        for (auto it : cnt) {
                ans += (long long) it.second * (it.second - 1) / 2;
        }
        printf("%lld\n", ans);
        return 0;
}



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

int n;
int sq[15][15];

int main(){
    while (1){
	cin >> n;
	if (n == 0) break;
	int mid = n / 2;
	int m = 1;
	int x = mid+1, y = mid;

	for (int i = 0; i < n; i++){
	    for (int j = 0; j < n; j++){
		sq[i][j] = 0;
	    }
	}

	while (m <= n*n){
	    if (sq[x%n][y%n] == 0) sq[x%n][y%n] = m;
	    else {
		while (sq[x%n][y%n] != 0){
		    x++; y--;
		}
		sq[x%n][y%n] = m;
	    }
	    x++; y++;
	    m++;
	}
	for (int i = 0; i < n; i++){
	    for (int j = 0; j < n; j++){
		printf("%4d", sq[i][j]);
	    }
	    cout << endl;
	}
    }
}

Measured memory_bytes: 0
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int K = Integer.parseInt(in.next());
            String S = in.next();
            if (S.length() <= K) {
                out.println(S);
            } else {
                out.println(S.substring(0, K) + "...");
            }

        }

    }
}



Measured memory_bytes: 38520
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from functools import lru_cache

MOD = 10**9 + 7

def Fsmall(L,R):
    return sum(y-x == x^y for x in range(L,R+1) for y in range(x,min(x+x-1,R)+1))

@lru_cache(None)
def F(L,R):
    # x<=y<2x
    if R-L < 10:
        return Fsmall(L,R)
    f = 0
    # x=2a, y=2b
    f += F((L+1)//2,R//2)
    # x=2a+1,y=2b → これはルール違反
    # x=2a,y=2b+1
    f += F((L+1)//2,(R-1)//2)
    # x=2a+1,y=2b+1
    f += G(L//2,(R-1)//2)
    return f%MOD

def Gsmall(L,R):
    return sum(y-x == x^y for x in range(L,R+1) for y in range(x,min(x+x,R)+1))

@lru_cache(None)
def G(L,R):
    # x<=y<=2x
    if R-L < 10:
        return Gsmall(L,R)
    f = 0
    # x=2a, y=2b
    f += G((L+1)//2,R//2)
    # x=2a+1,y=2b → これはルール違反
    # x=2a,y=2b+1
    f += F((L+1)//2,(R-1)//2)
    # x=2a+1,y=2b+1
    f += G(L//2,(R-1)//2)
    return f%MOD

L,R = map(int,read().split())

answer = F(L,R)
print(answer)

Measured memory_bytes: 3684
n, w = map(int, input().split())
V, W = [], []
for i in range(n):
    wi, vi = map(int, input().split())
    W.append(wi)
    V.append(vi)
    
max_sumv = sum(V) 
# dp[i][sum_v] := i-1 番目までの品物から価値がsum_v以上を達成するように選んだときの、重さの総和の最小値   
dp = [[10 ** 9] * (max_sumv + 1) for _ in range(n+1)]

dp[0][0] = 0
for i in range(n):
    for sum_v in range(max_sumv + 1):
        #i番目の商品を選ぶ場合
        if sum_v - V[i] >= 0:
            dp[i+1][sum_v] = min(dp[i+1][sum_v], dp[i][sum_v - V[i]] + W[i])
        #i番目の商品を選ばない場合
        dp[i+1][sum_v] = min(dp[i+1][sum_v], dp[i][sum_v])
ans = 0
for i in range(max_sumv + 1):
    if dp[n][i] <= w:
        ans = i
print(ans)

Measured memory_bytes: 120812
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC157C
{
    class Program
    {
        static void Main(string[] args)
        {
            var NM = ReadInt();
            int N = NM[0];
            int M = NM[1];

            int[] s = new int[M];
            string[] c = new string[M];
            for (int i = 0; i < M; i++)
            {
                var input = ReadInt();
                s[i] = input[0] - 1;
                c[i] = input[1].ToString();
            }

            int ans = Solve(N, M, s, c);

            Console.WriteLine(ans);
            Console.ReadKey();
        }

        static int Solve(int N, int M, int[] s, string[] c)
        {
            int start = (int)Math.Pow(10, N - 1);
            if (N == 1) start = 0;
            int end = (int)Math.Pow(10, N);

            for (int i = start; i < end; i++)
            {
                string str = i.ToString();

                bool ok = true;
                for (int j = 0; j < M; j++)
                {
                    string a = str[s[j]].ToString();
                    if (a != c[j])
                    {
                        ok = false;
                        break;
                    }
                }
                if (ok) return i;
            }
            return -1;
        }

        static int[] ReadInt()
        {
            int[] ret = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return ret;
        }
        static long[] ReadLong()
        {
            long[] ret = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return ret;
        }
    }
}


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

using namespace std;

#define INF 1000007
#define MOD 1000000007
#define int long long int
#define maxn 100
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}

int lcm(int a, int b) { return a / gcd(a, b) * b; }

int mpow(int N, int P, int M) //繰り返し自乗法
{
    if (P == 0)
        return 1;
    if (P % 2 == 0)
    {
        int t = mpow(N, P / 2, M);
        return t * t % M;
    }
    return N * mpow(N, P - 1, M) % M;
}

int counter(int x) //bit計算
{
    if (x == 0)
        return 0;
    return counter(x >> 1) + (x & 1);
}

vector<bool> prime(maxn + 1, true); //素数テーブル
void prime_table(void)
{
    prime[0] = false;
    prime[1] = false;
    for (int i = 2; i * i <= maxn; i++)
    {
        if (!prime[i])
        {
            continue;
        }
        for (int j = i + i; j <= maxn; j += j + i)
        {
            prime[j] = false;
        }
    }
}

bool IsPrime(int num) //素数判定
{
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }

    return true;
}
vector<int> divisor(int n) //約数列挙
{
    vector<int> ret;
    for (int i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            ret.push_back(i - 1);
            if (i * i != n)
            {
                ret.push_back((n / i) - 1);
            }
        }
    }
    sort(ret.begin(), ret.end());
    return (ret);
}

signed main()
{
    int ans=0;
    int x;
    cin>>x;

    ans+=x/500*1000;
    x-=(int)(x/500)*500;

    ans+=x/5*5;

    cout<<ans<<endl;
}


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

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

    int n,k;
    cin>>n>>k;
    int cnt[200010]={},num=0;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        if(cnt[a]==0)num++;
        cnt[a]++;
    }
    sort(cnt,cnt+200010);
    int ans=0;
    for(int i=0;i<200010;i++){
        if(cnt[i]==0)continue;
        if(num<=k)break;
        num--;
        ans+=cnt[i];
    }
    cout<<ans<<endl;

}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

template<typename T>
constexpr T inf = static_cast<T>(pow(10, static_cast<int>(log10(numeric_limits<T>::max())))) + 7;
constexpr llong mod = 1e9+7;

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

	cout << T << S << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int a[100010];
int main(){
    int x, y;
    while(cin>>x>>y){
        ll ans=0;
        bool l=0;
        for(int i=0; i<=x; ++i){
        	if(i*2+(x-i)*4==y){
        		l=1;
        		break;
        	}
        }
        if(l){
        	printf("Yes\n");
        }
        else{
        	printf("No\n");
        }
    }
  return 0;
}




Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    int N,D;
    cin >> N >> D;
    int div = 2*D+1;
    cout << (N+(div-1))/div << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
int main(void){
    int n;
    int i, j, mask;
    int tmp;
    int f[100] = {0};
    long int p[100][11] = {0};
    int kabutta;
    long int profit = 0;
    long int answer;
 
    scanf("%d", &n);
    for (i = 0; i < n*10; i++){
        scanf(" %d", &tmp);
        if (tmp == 1){
            f[i/10] += (int)pow(2, (9-i%10));
        }
    }
    for (i = 0; i < n*11; i++){
        scanf(" %ld", &p[i/11][i%11]);
    }
 
    for (i = 1; i < (1 << 10); i++){
        for (j = 0; j < n; j++){
            kabutta = 0;
            if ((i & f[j]) > 0){
                for (mask = 1; mask < (1 << 10); mask = (mask << 1)){
                    if (((i & f[j]) & mask) == mask){
                        kabutta++;
                    }
                }
            }
            profit += p[j][kabutta];
        }
        if (i == 1){
            answer = profit;
        }
        answer = answer>profit?answer:profit;
        profit = 0;
    }
 
    printf("%ld\n", answer);
    
 
 
    return 0;
}

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

ans = 0
for i in range(1,N+1):
    if i%2 == 0: continue

    cnt = 0
    for j in range(1,i+1):
        if j * j > i : break
        if j * j == i : cnt += 1
        elif i % j == 0 : cnt += 2

    if cnt == 8 : ans += 1

print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map>

using namespace std;

int main(){
	int N, M;
	while(cin >> N >> M){
		map<pair<int,int>, int> edgeIdx;
		vector<int> pos(N), owner(N);
		for(int i=0;i<N;i++){
			pos[i] = i; owner[i] = -1;
			edgeIdx[make_pair(i, -1)] = i;
		}
		vector<vector<int>> vtxList(N);
		vector<int> p(M), q(M), c(M);
		for(int i=0;i<M;i++){
			cin >> p[i] >> q[i] >> c[i];
			--p[i]; --q[i];
			if(!edgeIdx.count(make_pair(p[i], c[i]))){
				int s = edgeIdx.size();
				edgeIdx[make_pair(p[i], c[i])] = s;
				pos.push_back(p[i]);
				owner.push_back(c[i]);
				vtxList[p[i]].push_back(s);
			}
			if(!edgeIdx.count(make_pair(q[i], c[i]))){
				int s = edgeIdx.size();
				edgeIdx[make_pair(q[i], c[i])] = s;
				pos.push_back(q[i]);
				owner.push_back(c[i]);
				vtxList[q[i]].push_back(s);
			}
		}
		vector<vector<int>> g(pos.size());
		for(int i=0;i<M;i++){
			g[edgeIdx[make_pair(p[i], c[i])]].push_back(edgeIdx[make_pair(q[i], c[i])]);
			g[edgeIdx[make_pair(q[i], c[i])]].push_back(edgeIdx[make_pair(p[i], c[i])]);
		}
		for(int i=0;i<N;i++){
			for(int dst : vtxList[i]){
				g[i].push_back(dst);
				g[dst].push_back(i);
			}
		}
		const int INF = 1 << 30;
		vector<int> dist(g.size(), INF);
		priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>> qu;
		qu.emplace(0, 0);
		dist[0] = 0;
		while(!qu.empty()){
			auto pr = qu.top(); qu.pop();
			int cur = pr.second;
			for(int nextPos : g[cur]){
				int nextCost = dist[cur] + (owner[cur] == -1 ? 1 : 0);
				if(dist[nextPos] > nextCost){
					dist[nextPos] = nextCost;
					qu.emplace(nextCost, nextPos);
				}
			}
		}
		cout << (dist[N-1] == INF ? -1 : dist[N-1]) << endl; 
	}
}


Measured memory_bytes: 77464
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        s: Chars,
        w: usize,
    }

    for w in s.chunks(w) {
        print!("{}", w[0]);
    }
}


Measured memory_bytes: 2120
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		boolean flag = false;
		for (int i = 0; i <= N; i++) {
			if(flag) {break;}
			for(int j = 0; j <= N; j ++) {
				if (4 * i + 7 * j == N) {
					flag = true;
					break;
				}
			}
		}
		if(flag) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

}


Measured memory_bytes: 23764
#include <cassert>
#include <iostream>
#include <vector>
#include <queue>

int main() {
  int N, M;
  std::cin >> N >> M;

  std::vector<int> L(M), R(M), D(M);
  for (int i = 0; i < M; ++i) {
    std::cin >> L[i] >> R[i] >> D[i];
    --L[i], --R[i];
  }

  using Edge = std::pair<int, int>;
  using Graph = std::vector<std::vector<Edge>>;
  Graph G(N);
  for (int i = 0; i < M; ++i) {
    G[L[i]].push_back(std::make_pair(R[i], D[i]));
    G[R[i]].push_back(std::make_pair(L[i], -D[i]));
  }

  std::queue<int> que;
  std::vector<bool> visited(N, false);

  bool res = true;
  std::vector<int> X(N, 0);

  for (int v = 0; v < N; ++v) {
    if (visited[v])
      continue;

    visited[v] = true;
    que.push(v);

    while (not que.empty()) {
      int v = que.front();
      que.pop();

      for (auto e : G[v]) {
        int nv = e.first;
        int d = e.second;
        if (visited[nv]) {
          if (X[nv] != X[v] + d)
            res = false;
          continue;
        }

        X[nv] = X[v] + d;
        visited[nv] = true;
        que.push(nv);
      }
    }
  }

  if (res)
    std::cout << "Yes" << std::endl;
  else
    std::cout << "No" << std::endl;

  return 0;
}


Measured memory_bytes: 11776
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
 
const int N=1e5+5;
 
int n, totW;
int w[105], v[105];
int cache[105][N];
 
int dp(int idx, int val)
{
	if(val==0)
		return 0;
	if(val<0)
		return 1e15;
	if(idx==n+1)
		return 1e15;
	int &ans=cache[idx][val];
	if(ans!=-1)
		return ans;
	ans=min(dp(idx+1, val), w[idx]+dp(idx+1, val-v[idx]));
	return ans;
}
 
int32_t main()
{
	IOS;
	memset(cache, -1, sizeof(cache));
	cin>>n>>totW;
	for(int i=1;i<=n;i++)
		cin>>w[i]>>v[i];
	int ans=0;
	for(int i=1;i<=1e5;i++)
	{
		int minWt=dp(1, i);
		if(minWt<=totW)
			ans=i;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 82432
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REP(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;



int main(){
  int L, R;
  cin >> L;
  cin >> R;

  if ((R - L) > 2019) {
    cout << 0 << endl;
  }
  else {
    int l = L % 2019;
    int r = R % 2019;
    int mo = 2019;
    for(int i=l; i<=r-1; i++) {
      for(int j=i+1; j<=r; j++) {
        mo = min(mo, (i * j) % 2019);
        // cout << i << " " << j << " " << mo << endl;
      }
    }
    cout << mo << endl;
  }


  return 0;
}


Measured memory_bytes: 256
import sys
from itertools import accumulate

def main():
  input = sys.stdin.readline
  N, C = map(int, input().split())
  X = []
  V = []
  for _ in range(N):
    x, v = map(int, input().split())
    X.append(x)
    V.append(v)
  Vr = V[::-1]
  Xr = X[::-1]

  F = list(accumulate(V))
  R = list(accumulate(Vr))
  F[0], R[0] = F[0] - X[0], R[0] - (C - Xr[0])
  for i in range(1, N):
    F[i] = max(F[i-1], F[i] - X[i])
    R[i] = max(R[i-1], R[i] - (C - Xr[i]))

  val = 0
  for i in range(N-1):
    v1 = F[i] + R[N-(i+2)] - X[i]
    v2 = R[i] + F[N-(i+2)] - (C - Xr[i])
    val = max(val, v1, v2)
  
  ans = max(0, val, max(F), max(R))
  print(ans)


if __name__ == '__main__':
  main()

Measured memory_bytes: 22276
N,K = map(int,input().split())
x = [0]*(N+2)
x[1] = 1
ans = 0
for i in range(2,N+2):
  x[i] = i + x[i-1]
for k in range(K,N+2):
  small = x[k]
  big = x[N+1] - x[N-k+1]
  ans += big - small + 1

print(ans % (10**9 + 7))  

Measured memory_bytes: 19168