akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>
#include<functional>
#include<numeric>
#include<tuple>

using namespace std;
using ll = long long;
using ld = long double;
#define int long long
#define all(a) (a).begin(),(a).end()
#define EPS (1e-7)
#define fs first
#define sc second
#define xx first
#define yy second.first
#define zz second.second
#define H pair<int, int>
#define P pair<int, pair<int, int>>
#define Q(i,j,k) mkp(i,mkp(j,k))
#define R pair<pair<int, int>, pair<int, int>>
#define S(i,j,k,l) mkp(mkp(i,j),mkp(k,l))
#define rep(i,n) for(int (i) = 0 ; (i) < (n) ; (i)++)
#define rng(i,s,n) for(int (i) = (s) ; (i) < (n) ; (i)++)
#define req(n,i) for(int (i) = (n) - 1 ; (i) >= 0 ; (i)--)
#define mkp make_pair
#define mem(x,k) memset(x,k,sizeof(x))
#define vec vector
#define pb emplace_back
#define lb lower_bound
#define ub upper_bound
#define crdcomp(b) sort(all((b)));(b).erase(unique(all((b))),(b).end())
#define ssp(i,n) (i==n-1?"\n":" ")
#define ctoi(c) (int)(c-'a')
#define itoc(c) (char)(c+'a')
#define itn int
#define pri_que priority_queue
#define pp(x,y) pb(H{x,y})
#define ppp(x,y,z) pb(Q(x,y,z))
#define pppp(x,y,z,w) pb(S(x,y,z,w))
#define cyes cout<<"Yes\n"
#define cno cout<<"No\n"
const int mod = 1e9 + 7;
const int Mod = 998244353;
const ll inf = 3 * 1e18;
const int Inf = 15 * 1e8;
const vec<int>dx{ -1,1,0,0 }, dy{ 0,0,-1,1 };
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; }
ll read() { ll u, k = scanf("%lld", &u); return u; }
string reads() { string s; cin >> s; return s; }
ll gcd(ll i, ll j) { return j ? gcd(j, i % j) : i; }
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
ll bitcount(ll x) {
	int sum = 0; for (int i = 0; i < 60; i++)if ((1ll << i) & x) sum++;
	return sum;
}
/*const int fn_ = 1000005;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll Mod = mod) {
	if (!fact_[0]) {
		fact_[0] = 1; comp_[0] = 1;
		for (int i = 1; i < fn_; i++) {
			fact_[i] = fact_[i - 1] * i % Mod;
			comp_[i] = mod_pow(fact_[i], Mod - 2, Mod);
		}
	}
	if (x < y) return 0;
	return fact_[x] * comp_[x - y] % Mod * comp_[y] % Mod;
}*/
//--------------------------------------------------------------
signed main() {
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	if (a[0] != a[1] && a[1] == a[2]) cout << "Yes\n";
	else if (a[0] == a[1] && a[1] != a[2]) cout << "Yes\n";
	else cout << "No\n";
}

Measured memory_bytes: 764
#!/usr/bin/env python3
import sys
# import math
# import numpy as np
# from functools import lru_cache

args = sys.argv
if len(args) == 2:
  from IPython import embed
  em = True
else:
  em = False

# sys.setrecursionlimit(10000)

#### input
a = int(input())
s = input()
# a, b = map(int, input().split())
# a = list(map(int, input().split()))
# a = list(map(lambda x: int(x)*(-1), a))  # 各要素を-1倍


# n = int(input())
# t = [int(input()) for i in range(n)]
if em: sys.stdin = open('/dev/tty')

#### function
# @lru_cache(maxsize=10000)

#### process
if a >= 3200:
  print(s)
else:
  print("red")
# if em: embed()

## heapsort, O(NlogN)
# import heapq
# heapq.heapify(A)
# min = heapq.heappop(A)
# heapq.heappush(A, new_element)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}
const int INF = 1e18;

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

    int res = 0;
    for(int i=2; i*i<N; i++) {
        int cnt = 0;
        while(N%i==0) {
            N /= i;
            cnt++;
        }
        if(cnt) {
            double t = -1.0+sqrt(1.0+8.0*double(cnt));
            res += int(t/2.0);
        }
    }
    if(N>1) res++;

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3680
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};

int main(void){
    string S,T;
    cin >> S >> T;
    int SL=S.length(),TL=T.length();
    if(SL>TL){
        rep(i,TL) cout << S[i] << T[i];
        cout << S[TL] << endl;
    }
    else{
        rep(i,TL) cout << S[i] << T[i];
        cout << endl;
    }
}

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

ll sum;
int n;
map<ll, int> mp;
int main() {
    while(~scanf("%d", &n)) {
        sum = 0; mp.clear();
        int x;
        for(int i = 0; i < n; i++) {
            scanf("%d", &x);
            sum += x;
            mp[sum]++;
        }
        ll ans = 0;
        for(auto i: mp) {
            ll num = i.second;
//            cout << "sum = " << i.first << " num = " << num << endl;
            if(!i.first) num++;
            ans += num * (num - 1) / 2;
        }
        printf("%lld\n", ans);
    }
    return 0;
}


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

int main() {
    int n,m;cin>>n>>m;
    vector<int> g[n];
    for (int i=0;i<m;i++) {
        int a,b;cin>>a>>b;a--,b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    queue<int> q;
    q.push(0);
    int vis[n]{1};
    int ans[n];
    while (q.size()) {
        int v=q.front();q.pop();
        for (int u:g[v])
            if (!vis[u]) {
                ans[u]=v+1;
                vis[u]=1;
                q.push(u);
            }
    }
    cout<<"Yes"<<endl;
    for (int i=1;i<n;i++)
        cout<<ans[i]<<endl;
    return 0;
}

Measured memory_bytes: 10904
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int ha=1000000007;
const int maxn=4005;
const int N=200005,inv=ha/2+1;
int n,px[N],py[N],jc[maxn<<1];
int ans=0,f[maxn][maxn],ni[maxn<<1];

inline int add(int x,int y){
	x+=y;
	return x>=ha?x-ha:x;
}

inline int ksm(int x,int y){
	int an=1;
	for(;y;y>>=1,x=x*(ll)x%ha) if(y&1) an=an*(ll)x%ha;
	return an;
}

inline void init(){
	jc[0]=1;
	for(int i=1;i<=8000;i++) jc[i]=jc[i-1]*(ll)i%ha;
	ni[8000]=ksm(jc[8000],ha-2);
	for(int i=8000;i;i--) ni[i-1]=ni[i]*(ll)i%ha;
}

inline void dp(){
	for(int i=0;i<=4000;i++)
	    for(int j=0;j<=4000;j++){
	    	if(i) f[i][j]=add(f[i][j],f[i-1][j]);
	    	if(j) f[i][j]=add(f[i][j],f[i][j-1]);
		}
}

inline int C(int x,int y){
	return jc[x]*(ll)ni[y]%ha*(ll)ni[x-y]%ha;
}

inline void calc(){
	for(int i=1;i<=n;i++) ans=add(ans,f[2000+px[i]][2000+py[i]]);
	for(int i=1;i<=n;i++) ans=add(ans,ha-C((px[i]+py[i])<<1,py[i]<<1));
	ans=ans*(ll)inv%ha;
}

int main(){
	init();
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d%d",px+i,py+i);
		f[2000-px[i]][2000-py[i]]++;
	}
	dp();
	calc();
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 64512
#include <bits/stdc++.h>
using namespace std;
#define N 105
int n,ans,a[N];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i) scanf("%d",&a[i]);
	for(int i=1,t;i<=100;++i)
	{
		t=0;
		for(int j=1;j<=n;++j) t+=(i-a[j])*(i-a[j]);
		if(i==1) ans=t;else ans=min(ans,t);
	}printf("%d\n",ans);return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  string s;
  ll k;
  cin >> s >> k;

  int n = s.size();
  rep(i, n) {
    if (s[i] != '1') {
      if (k < i + 1) cout << '1' << endl;
      else cout << s[i] << endl;
      return 0;
    }
  }
  cout << '1' << endl;




  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

////////////////////
int max_len;
struct DirectedGraph{
    int V;

    vector<vector<int>> to;
    vector<vector<int>> from;

    vector<int> vs;
    vector<int> depth;
    vector<bool> used;
    vector<int> cmp;//cmp[点]=(トポソ後のその点の順位)

    void dfs(int v){
        used[v]=true;
        for(auto t:to[v]) if(!used[t]) dfs(t);
        vs.push_back(v);//帰りがけ
    }
    //k:始点,rdfsがkに戻る→強連結成分
    int r_dfs(int v,int k){
        int ret=0;
        used[v]=true;
        cmp[v]=k;
        for(const auto t:from[v]){
            if(!used[t]) r_dfs(t,k);
            depth[v]=max(depth[v],depth[t]+1);
        }
    }
    DirectedGraph(int V) : V(V),
        to(vector<vector<int>>(V)),
        from(vector<vector<int>>(V)),
        cmp(vector<int>(V)),
        depth(vector<int>(V))
        {}
    
    void add_edge(int from_,int to_){
        to[from_].push_back(to_);
        from[to_].push_back(from_);
    }


    //強連結成分:任意の2頂点を行き来できる部分グラフ
    //          1点だけのも競連結成分
    //順方向帰りがけdfsと逆方向行き止まりまでdfs
    //強連結成分分解O(|V|+|E|)
    int scc_num=-1;
    //scc_num:強連結成分の個数を返す
    int scc(){
        used=vector<bool>(V,false);
        vs.clear();
        for(int v=0;v<V;v++) if(!used[v]) dfs(v);
        used=vector<bool>(V,false);
        scc_num=0;
        for(int i=vs.size()-1;i>=0;i--)if(!used[vs[i]]){
            max_len=max(max_len,r_dfs(vs[i],scc_num++));
        }
        return scc_num;
    }

    bool isCyclic(){
        //強連結成分が全部1点だけのものであれば
        //強連結成分の数は点数と一致し、閉路はない
        return (scc_num!=V);
    }

    //sccの後潰してトポロジカル順序のグラフを作る
    DirectedGraph makeTopologicalGraph(){
        DirectedGraph TG(scc_num);
        rep(s,V) for(auto t:to[s]){
            if(cmp[s]!=cmp[t]) TG.add_edge(cmp[s],cmp[t]);
        }
        return TG;
    }
};
////////////////////////////////




int n,m;

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

    cin>>n>>m;
    DirectedGraph g(n);
    rep(i,m+n-1){
        int a,b;
        cin>>a>>b;a--,b--;
        g.add_edge(a,b);
    }
    g.scc();

    //トポソしたあと，点aの親は辺が生えてる中で一番順位が遅いやつ
    vector<int> ans(n,-1);
    for(int i=0;i<n;i++){
        if(g.from[i].empty()){
            ans[i]=-1;
            continue;
        }
        int par,rank=-1;
        for(auto x:g.from[i]){
            if(chmax(rank,g.cmp[x])){
                par=x;
            }
        }
        ans[i]=par;
    }
    for(auto x:ans){
        cout<<x+1<<endl;
    }
    return 0;
}


Measured memory_bytes: 15100
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <iostream>
#include <string>
#include<algorithm>
#include<map>
#include <vector>
#include <cassert>
#include<cmath>
using namespace std;

int main() {
	int i, j,k;
	int a=0,b=0;
	cin >> a >> b;
	int outa=0, outb=0;
	for (i = 0; i < b; ++i) {
		outb += a;
		outb *= 10;
	}
	outb /= 10;
	for (i = 0; i < a; ++i) {
		outa += b;
		outa *= 10;
	}
	outa /= 10;
	//cout << outa << endl;
	//cout << outb << endl;

	if (a < b) {
		cout << outb << endl;
	}
	else {
		cout << outa << endl;
	}

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <regex>
#include <string>
#include <cstdlib>
#include <math.h>
#include <iomanip>
using namespace std;
int main() {
  int N;
  cin >> N;
  int x[N], y[N], n[N];
  for (int i = 0; i < N; i++) {
    cin >> x[i] >> y[i];
    n[i] = i;
  }
  double sum = 0;
  double cnt = 0;
  do {
    cnt++;
    for (int i = 0; i < N; i++) {
      if (i > 0) {
        sum += sqrt(pow(abs(x[n[i]] - x[n[i - 1]]), 2) + pow(abs(y[n[i]] - y[n[i - 1]]), 2));
      }
    }
  } while(next_permutation(n, n+N));
  cout << fixed << setprecision(10);
  cout << sum / cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
#include <set>
using namespace std;
typedef long long ll;

int main(){
   
   string s;cin>>s;
   int n=s.size();
   int a=0;
   if(s[0]!='A'){cout<<"WA";return 0;}
   for(int i=1;i<n;i++){
       if(islower(s[i]))continue;
       else {
           if(i<2||i==n-1||s[i]!='C'){cout<<"WA";return 0;}
           else {a++;}
       }
   }
   if(a<1||a>1)cout<<"WA";
   else cout<<"AC";
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

	int n, count=0;
	int pre;
	cin >> n;
	vector<int> d(n,0);
	for(int i=0;i<n;i++){
		cin >> d[i];
	}
	sort(d.begin(),d.end());
	for(auto itr = d.rbegin() ; itr!= d.rend(); ++itr){
		if(itr == d.rbegin()){ 
			pre = *itr;
			count++;
		}
		// cout << pre << endl;
		if(pre > *itr){
			count++;
			pre = *itr;
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define SZ(x) ((int)(x.size()))
#define FOR(i,s,n) for (ll i = (s); (i) < (n); ++i)
#define FORD(i,s,l) for (ll i = (s); (i) >= l; --i)
#define F first
#define S second
#define TC int __tc; cin >> __tc; FOR(case_num,1,__tc+1)
#define TEST(x,i) ((x)&(1ll<<(i)))
#define SET(x,i) ((x)|(1ll<<(i)))
#define FLIP(x,i) ((x)^(1ll<<(i)))
#define CLEAR(x,i) ((x)&~(1ll<<(i)))

const double pi = 4 * atan(1);
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;
const int MAXN = 200005;

ll logs[MAXN];
int n;
ll k;

ll ceilDiv(ll a, ll b){
	return a/b+(a%b != 0);
}

bool eval(ll x) {
	ll left = k;
	for (int i = 0; i < n; i++){
		ll v = logs[i];
		ll needed = ceilDiv(v,x);
		if (needed == 1) {
			return true;
		}
		needed--;
		if (left >= needed){
			left-=needed;
		} else {
			return false;
		}
	}
	return true;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	cin >> n;
	cin >> k;
	
	FOR(i,0,n){
		cin >> logs[i];
	}
	
	sort(logs,logs+n,greater<ll>());
	
	ll lo = 1, hi = 1001001001;
	
	while(lo<hi) {
		ll mid = (lo+hi)/2;
		if (eval(mid)) {
			hi = mid;
		} else {
			lo = mid+1;
		}
	}
	
	cout << lo << "\n";

}


Measured memory_bytes: 5168
x,y = map(int,input().split(' '))
G1 = [1,3,5,7,8,10,12]
G2 = [4,6,9,11]
G3 = [2,]

if (x in G1 and y in G1) or (x in G2 and y in G2) or (x in G3 and y in G3):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3060
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

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

    VI a(n);
    vector<P> p(n);
    REP(i,n){
        a[i] = in();
        p[i] = P(a[i], i);
    }
    sort(ALL(p));

    VI non_use(n);
    int ans = 1e9 + 10;
    REP(i,n){
        multiset<int> st;
        VI tmp;
        REP(j,n){
            if (non_use[j]){
                sort(ALL(tmp));
                REP(x,(int)tmp.size() - k + 1){
                    st.insert(tmp[x]);
                }
                tmp.clear();
            }else{
                tmp.push_back(a[j]);
            }
        }
        sort(ALL(tmp));
        REP(x,(int)tmp.size() - k + 1){
            st.insert(tmp[x]);
        }
        // cout << i << endl;
        // for (int x : st) cout << x << " ";
        // cout << endl;
        if (st.size() >= q){
            while (st.size() > q){
                st.erase(st.find(*st.rbegin()));
            }
            int tmp = *st.rbegin() - *st.begin();
            ans = min(ans, tmp);
        }
        non_use[p[i].second] = 1;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define intt long long int
#define intu unsigned long long int
#define vi vector<intt>
#define ii pair<int,int>
#define pb push_back
//#define mp make_pair
#define ff first
#define ss second
#define fast_io ios::sync_with_stdio(0);cin.tie(NULL);std::cout.tie(NULL);
# define PI           3.14159265358979323846 
#define all(a) a.begin(),a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
int mod = 1000000007;
intt gcd(intt a, intt b) {return b ? gcd(b, a % b) : a;}
int lcm(int a, int b) {return a * b / gcd(a, b); }
intt bpow(intt a,intt b) 
{
  intt res = 1;
  while (b > 0) {
    if (b & 1)res = res * a;
      a = a * a;
      b >>= 1;
  }
  return res;
}
intt fact(intt n) { 
   if ((n==0)||(n==1))
      return 1; 
   else
      return n*fact(n-1);
}

void go()
{
#ifndef ONLINE_JUDGE
  freopen("IN.txt","r",stdin);
  freopen("OUT.txt","w",stdout);
  #endif
}
bool prime[2000001];

void SieveOfEratosthenes() 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=2000001; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=2000001; i += p) 
                prime[i] = false; 
        } 
    } 
  
} 
set<intt> s;
int count=0;
bool f=0;

void primeFactors(int n)  
{  
    bool op=0;
    while (n % 2 == 0)  
    {  
    
        n = n/2; 
        if(s.find(2)!=s.end()){
        	f=1;
        	return;
        }
        op=1;
    }  
    if(op){
    	s.insert(2);
    }
  
   	op=0;
    for (int i = 3; i <= sqrt(n); i = i + 2)  
    {  
        op=0;
        while (n % i == 0)  
        {  
            op=1;
            n = n/i;  
            if(s.find(i)!=s.end()){
        	f=1;
        	return;
        	}
        }
        if(op){
        	s.insert(i);
        }  
    }  
  
    // This condition is to handle the case when n  
    // is a prime number greater than 2  
    if (n > 2)  
        {
        	if(s.find(n)!=s.end()){
	        	f=1;
	        	return;
        	}
        	else
       		s.insert(n);
        } 
}  
  

int main(){
	go();
	fast_io
	
	SieveOfEratosthenes();
	intt n;cin>>n;
	vi v(n),uk(n);
	for0(i,n){
		cin>>v[i];
		uk[i]=v[i];
	}
	
	for0(i,n){
		primeFactors(v[i]);
		if(f)
			break;
	}
	if(!f){
		cout << "pairwise coprime" <<"\n";
		return 0;
	}
	intt yo=uk[0];
	for(intt i=1;i<n;i++){
		//cout << yo <<" ";
		yo=gcd(yo,uk[i]);
	}
	if(yo==1){
	//	cout << yo <<" ";
		cout << "setwise coprime" <<"\n";
	}
	else
		cout <<"not coprime"<<"\n";

}




















Measured memory_bytes: 20772
#include <bits/stdc++.h>
#include <fstream>
#include <stdlib.h>
#include <ctime>
typedef long long ll;

using namespace std;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(100);
 //   freopen("input.txt","r",stdin);
    int r;
    cin>>r;
    cout<<3*r*r;
    return 0;
}


Measured memory_bytes: 256
s = list(input())
t = list(input())
s.sort()
t.sort()
t.reverse()
ans = "No"
T = min(len(s),len(t))
for i in range(T) :
    if s[i] < t[i] :
        ans = "Yes"
        break
count = 0
for i in range(T) :
    if s[i] > t[i] :
        break
    if s[i] == t[i] :
        count+=1
if count == T and len(t) > len(s) :
    ans = "Yes"
print(ans)

Measured memory_bytes: 3064
def isMonth(n):
    if 0<n and n<=12:return True
    else:False

s=list(input())
f=int(s[0]+s[1])
b=int(s[2]+s[3])

if isMonth(f) and isMonth(b):print("AMBIGUOUS")
elif isMonth(f) and not isMonth(b):print("MMYY")
elif not isMonth(f) and isMonth(b):print("YYMM")
else:print("NA")

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

static const int MAX = 100005;

struct BC {
  int b, c;
};

bool cmp(const BC &a, const BC &b) {
  return a.c > b.c;
}

int main() {
  int N, M, A[MAX];
  BC bc[MAX];

  cin >> N >> M;
  rep(i, N) cin >> A[i];
  rep(i, M) cin >> bc[i].b >> bc[i].c;

  sort(A, A+N);
  sort(bc, bc+M, cmp);

  /*int *pos;
  int idx;
  pos = lower_bound(A, A+N, bc[0]);
  idx = distance(A, pos);*/
  int idx = 0;
  rep(i, M) {
    rep(j, bc[i].b) {
      if (A[idx] >= bc[i].c) break;
      A[idx] = bc[i].c;
      idx++;
    }
  }
  
  long long ans = 0;

  rep(i, N) ans += A[i];

  cout << ans << endl;


  return 0;

}

Measured memory_bytes: 1408
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1000000007;
const ll INF=2e18;

ll N,M,K,C;
ll a[100010],b,c,d;
string s;
int main(){
    cin>> N>>M;
    ll minR=INF;
    ll maxL=0;
    for(ll i=0;i<M;i++){
        ll l,r;
        cin>>l>>r;
        maxL=max(maxL,l);
        minR=min(minR,r);
    }

    cout<<max(0LL,minR-maxL+1)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
using namespace std;
using Int = int32_t;
int main() {
    Int N, M;
    cin >> N;
    unordered_map<string, int> um;
    vector<string> s(N);
    for (auto& i : s) {
        cin >> i;
        um[i]++;
    }
    cin >> M;
    vector<string> t(M);
    for (auto& i : t) {
        cin >> i;
        um[i]--;
    }
    Int ans = 0;
    for (const auto& p : um) if (p.second > ans) ans = p.second;
    cout << ans << endl;
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
 
void solve(int a, int b, int c) {
	int s = a + b + c;
 
	if (2*a == s || 2*b == s || 2*c == s) {
		cout << "Yes";
	} else {
		cout << "No";
	}
}
 
int main() {
	int a,b,c;
	while (cin >> a >> b >> c) {
		solve(a, b, c);
	}
	return 0;
}

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

using namespace std;


int main()
{
	int r, g, b;
	cin >> r >> g >> b;
	int x = r * 100;
	int y = g * 10;
	int ans = x + y + b;
	if (ans % 4 == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 3604
const main = (input) => {
  input = input.trim().split('\n')
  const n = Number(input[0])
  const [s, t] = input[1].split(' ')
  let result = ''
  for (let i = 0; i < n; i++) {
    result += s[i] + t[i]
  }
  console.log(result)
  
  
  
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))

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

int main(){
  int A,B,K;
  cin>>A>>B>>K;
  
  int count=0;
  for(int i=min(A, B); i>=1; i--){
   if(A%i==0 && B%i==0){
     count++;
     if(count==K){cout<<i<<endl;}}
  }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter

# stdin = open("sample.txt")

h, w = [int(x) for x in stdin.readline().rstrip().split()]

if h == 1 or w == 1:
    print(1)
else:
    if h*w % 2 == 0:
        print(h*w // 2)
    else:
        print((h*w + 1) // 2)

Measured memory_bytes: 3060
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1000000000;

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

    int x = 0;
    for (int i=0; i<n.size(); i++){
        x += stoi(n.substr(i,1));
    }

    if (x%9 == 0){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
}

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

class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		double r = Double.parseDouble(in.readLine());

		double pi = Math.PI;
		double S = r * r * pi;
		double R = 2 * r * pi;
		System.out.printf("%.6f %.6f", S, R);
	}
}

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

using namespace std;

int main() {
	string a = "A";
	string c = "C";
	string g = "G";
	string t = "T";
	string b;
	cin >> b;
	if (b == a) {
		cout << "T\n";
	}
	if (b == c) {
		cout << "G\n";
	}
	if (b == g) {
		cout << "C\n";
	}
	if (b == t){
		cout << "A\n";
	}
	return 0;

}

Measured memory_bytes: 256
H, W = gets.split.map(&:to_i)
s = H.times.map { gets.chomp.chars }
dy = [-1, 0, 1, 0]
dx = [0, 1, 0, -1]
H.times  do |y|
  W.times do |x|
    next if s[y][x] == '.'

    f = false
    4.times  do |k|
      ny = y + dy[k]
      nx = x + dx[k]
      next if ny < 0 || H <= ny || nx < 0 || W <= nx
      f = true if s[ny][nx] == '#'
    end
    unless f
      puts 'No'
      exit
    end
  end end
puts 'Yes'


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

int main (){
  char a, b;
  cin >> a >> b;
  
  if (a=='H'&&b=='H') {
    cout << "H" << endl;
  }
  else if (a=='D'&&b=='D') {
    cout << "H" << endl;
  }
  else {
    cout << "D" << endl;
  }
}

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

using namespace std;


void DFS(int vert, vector<vector<int>>& sons, vector<int>& hight) {
    for (const auto & son: sons[vert]) {
        DFS(son, sons, hight);
    }
    sort(sons[vert].begin(), sons[vert].end(), [&](int a, int b) {
         return hight[a] < hight[b];});
    for (const auto & x: sons[vert]) {
        hight[vert] = max(hight[vert], hight[x]) + 1;
    }
}

int main()
{
    int n;
    cin >> n;
    vector<int> numb(n - 1);
    for (auto & x: numb) {
        cin >> x;
    }
    vector<vector<int>> sons(n);
    for (int i = 0; i < n - 1; ++i) {
        sons[numb[i] - 1].push_back(i + 1);
    }
    vector<int> hight(n);
    DFS(0, sons, hight);
    cout << hight[0];




    return 0;
}


Measured memory_bytes: 14336
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
#define N 250000
ll MOD=1e9+7;

int makeable[2010][10100];
vector<pair<string,int>> dp(10010,pair<string,int>{"{",-1});
vector<string> s;
vector<int> a;

main(){
  int n=in(),k=in();
  set<char> T;
  rep(i,n){
    string S;cin>>S;
    s.pb(S);
    a.pb(S.size());
    for(auto e:S)T.insert(e);
  }
  if(T.size()==1){rep(i,k)cout<<s[0][0];return 0;}
  dp[0].first="";
  makeable[n][k]=1;
  rep3(i,n-1,0){
    int x=a[i];
    rep(j,k+1){
      makeable[i][j]=(makeable[i+1][j]|makeable[i+1][j+x]);
    }
  }
  /*
  rep(i,n+1){
    rep(j,k+1){
      cout<<makeable[i][j]<<" ";
    }
    cout<<endl;
  }
  */
  rep(i,k+1){
    string temp=dp[i].first;
    int index=dp[i].second;
    rep2(j,index+1,n-1){
      if(makeable[j][i]==0)continue;
      string t=temp+s[j];
      if(i+a[j]>k)continue;
      if(dp[i+a[j]].first>t){
        dp[i+a[j]].first=t;
        dp[i+a[j]].second=j;
      }
    }
    /*
    rep(i,k+1){
      cout<<dp[i].first<<" ";
    }
    cout<<endl;
    */
  }
  cout<<dp[k].first;
}


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

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

	bool ans = false;
	if (a == b && a != c || b == c && a != b || a == c && a != b)
	{
		ans = true;
	}
	if (ans)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
num = int(input())
s = list(input())

if num%2 == 1:
  print("No")
  
elif num%2 == 0:
  judge = "Yes"
  for i in range(0,num//2):
    if not s[i] == s[num//2 + i]:
      judge = "No"
      break
    
  print(judge)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std ;
#define  ll long long int 
#define pb push_back 
#define hh 1000000007 
vector<vector<ll>> graph ;
ll n;
ll arr[2][1000000] , painted[2][1000000] ,  visi[2][1000000];
ll doi(ll val ,  ll i , ll par)
{
    if(visi[val][i]==1)
    return arr[val][i] ;
    
    
    ll count = 1;
    
    if(val == 0) // balck
    {
        for( auto j : graph[i])
        {
            if(par != j){
            count  = (count * ( doi(1 , j , i)))%hh ;
            }
            
        }
    }else
    {
        for( auto j : graph[i] )
        {
            if(par!= j)
            {
                
        count  =( count * (((doi(1 , j , i)) + doi(0 , j , i))%hh))%hh ;
        }
        }
    }
    
    
    visi[val][i] = 1 ;
    arr[val][i] =count ;
    return count ;
    
    
}

int main()
{
     cin >> n ;
     vector<vector<ll>> g1(n) ;
     for( ll i = 0 ; i < n-1 ;i++)
     {
         ll a , b ;
         cin >>a>>b ;
         a-- ;
         b-- ;
         g1[a].pb(b) ;
         g1[b].pb(a) ;
         
     }
     
     graph = g1 ;
     
     
   
     cout <<(  doi(1 , 0 ,-1 ) + doi(0 , 0 ,-1))%hh  ;
     return  0 ;
     
}

Measured memory_bytes: 27136
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    bool ok = true;
    for(int i=0;i<N;i++){
        int a;
        cin >> a;
        if(a%2==0) ok &= (a%3==0 || a%5==0);
    }
    cout << (ok? "APPROVED":"DENIED") << "\n";
}

Measured memory_bytes: 256
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
//                       _oo0oo_                         //
//                      o8888888o                        //
//                      88" . "88      ------ hzt1       //
//                      (| -_- |)                        //
//                      0\  =  /0                        //
//                    ___/`---'\___                      //
//                  .' \|     |// '.                     //
//                 / \|||  :  |||// \                    //
//                / _||||| -:- |||||- \                  //
//               |   | \  -  /// |     |                 //
//               | \_|  ''\---/''  |_/ |                 //
//               \  .-\__  '-'  ___/-. /                 //
//             ___'. .'  /--.--\  `. .'___               //
//          ."" '<  `.___\_<|>_/___.' >' "".             //
//         | | :  `- \`.;`\ _ /`;.`/ - ` : | |           //
//         \  \ `_.   \_ __\ /__ _/   .-` /  /           //
//     =====`-.____`.___ \_____/___.-`___.-'=====        //
//                       `=---='                         //
//                                                       //
//                                                       //
//     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~       //
//                                                       //
//                 God-He Bless All.                     //
//           This Code Will Never Explode.               //
//                                                       //
//                                                       //
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
#include<cstdio>
#include<cstring>
#include<cctype>
#include<algorithm>
#include<vector>
#define pb push_back
#define mp make_pair
#define xx first
#define yy second
#define rep(i,a,b) for(int i=(a),i##_end_=(b);i<=i##_end_;i++)
#define dwn(i,a,b) for(int i=(a),i##_end_=(b);i>=i##_end_;i--)
using namespace std;
const int Size=1<<16;
char buffer[Size],*head,*tail;
inline char Getchar() {
    if(head==tail) {
        int l=fread(buffer,1,Size,stdin);
        tail=(head=buffer)+l;
    }
    if(head==tail) return -1;
    return *head++;
}
inline int read() {
    int x=0,f=1;char c=getchar();
    for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
    for(;isdigit(c);c=getchar()) x=x*10+c-'0';
    return x*f;
}
typedef long long ll;
const int maxn=3010;
const int mod=1000000007;
int n,m,f[maxn][maxn][2];
/*
Suppose that there're x red balls in the beginning.
The minium x for a vaild sequence must be 0 for sometimes.
*/
int main() {
	n=read();m=read();
	f[0][0][1]=1;
	rep(i,1,n) f[0][i][0]=1;
	rep(i,0,m-1) rep(j,0,n) rep(c,0,1) {
		int& ans=f[i][j][c];if(!ans) continue;
		if(j) (f[i+1][j-1][c|(j==1)]+=ans)%=mod,(f[i+1][j][c|(j==1)]+=ans)%=mod;
		if(n-j) (f[i+1][j+1][c]+=ans)%=mod,(f[i+1][j][c]+=ans)%=mod;
	}
	int ans=0;
	rep(j,0,m) (ans+=f[m][j][1])%=mod;
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 70784
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n , ans , i , x , j;
    cin >> n;
    vector<long long> v;
    for(i = 0 ; i < n ; i++){
        cin >> x;
        v.push_back(x);
    }
    ans = LLONG_MAX;
    for(i = 1 ; i <= 100 ; i++){
        x = 0;
        for(j = 0 ; j < n ; j++){
            x = x + (v[j] - i) * (v[j] - i);
        }
        ans = min(ans , x);
    }
    cout << ans;
    return 0;
}

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

int main(){
  int H, W;
  cin >> H >> W;
  vector<vector<char>> vec(H, vector<char>(W));
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cin >> vec.at(i).at(j);
    }
  }
  
  for(int k=0; k<H; k++){
    for(int l=0; l<W; l++){
      int count = 0;
      if(vec.at(k).at(l) == '#'){
        cout << '#';
      }
      else{
        if(k-1<0 || l-1<0){
         count = count;
        }
        else if(vec.at(k-1).at(l-1) == '#'){
          count++;
        }
        if(k-1<0){
          count = count;
        }
        else if(vec.at(k-1).at(l) == '#'){
          count++;
        }
        if(k-1<0 || l+1>=W){
          count = count;
        }
        else if(vec.at(k-1).at(l+1) == '#'){
          count++;
        }
        if(l-1<0){
          count = count;
        }
        else if(vec.at(k).at(l-1) == '#'){
          count++;
        }
        if(l+1>=W){
          count = count;
        }
        else if(vec.at(k).at(l+1) == '#'){
          count++;
        }
        if(k+1>=H || l-1<0){
          count = count;
        }
        else if(vec.at(k+1).at(l-1) == '#'){
          count++;
        }
        if(k+1>=H){
          count = count;
        }
        else if(vec.at(k+1).at(l) == '#'){
          count++;
        }
        if(k+1>=H || l+1>=W){
          count = count;
        }
        else if(vec.at(k+1).at(l+1) == '#'){
          count++;
        }
     cout << count;
      }
    }
     cout << endl;
  }
}

Measured memory_bytes: 256
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
using namespace std;
#define     FAST        ios_base::sync_with_stdio(false);cin.tie(NULL)
#define     int 	    long long
#define 	pb 	        push_back
#define 	mp 	        make_pair
#define 	pi 	        2*acos(0.0)
#define     scan(i)     scanf("%lld",&i)
#define     scann(i,j)  scanf("%lld%lld",&i,&j)
#define     print(i)    printf("%lld\n",i)
#define     printt(i,j) printf("%lld %lld\n",i,j)
#define     loop(i,n) 	for(int i = 0 ; i <n ; i++)
#define 	vect 	    vector<int>
#define 	vec_it 	    vector<int>::iterator vi
#define     sorta(v)    sort(v.begin(),v.end())
#define     sortd(v)    sort(v.begin(),v.end(),greater<>())
#define 	mapp 	    map<int,int>
#define 	pairr 	    pair<int,int>
#define 	sett	    set<int>
#define 	set_it 	    set<int>::iterator si
#define     map_it      map<int,int> :: iterator mi
#define 	yes 	    cout<<"Yes"<<endl
#define 	no 	        cout<<"No"<<endl
#define 	ff 	        first
#define 	ss 	        second
#define     mx          INT_MAX
#define     lmx         LLONG_MAX
#define     mn          INT_MIN
#define     lmn         LLONG_MIN
#define     GCD         __gcd(a,b)
#define     LCM         (a/GCD)*b
template <typename T> T gcd(T a,T b){return (b==0)?a:gcd(b,a%b);}
template <typename T> T lcm(T a,T b) {return a*(b/gcd(a,b));}
int modulo (int a, int b) { return a >= 0 ? a % b : ( b - abs ( a%b ) ) % b; }

void solve()
{
  //  freopen ("(input).txt" , "r",  stdin) ;
  //  string st,stt ;
  //  int low=0,high=0;
  //  int l,r;
  //  FAST;
    int n,k,t,b,c,x,y,z,d=0,temp=0,cnt=0,sum=0,f=0;
    cin>>n>>k>>x  ; vect v ,a  ; sett s ; set_it ; mapp m ; pairr p; map_it;
    cout<<(k/x)-(n-1)/x;

}

main()
{
    int t;
  //  cin>>t;
  //  while(t--)
        solve();
}


Measured memory_bytes: 3592
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int N;
        public int[] R;
        public int[] C;

        public void Run()
        {
            N = Input.ReadInt();
            R = new int[N];
            C = new int[N];
            for (int i = 0; i < N; i++)
            {
                var line = Input.ReadIntArray();
                R[i] = line[0];
                C[i] = line[1];
            }

            Console.WriteLine(Solve());
        }

        public int Solve()
        {
            int[,] dp = new int[N, N];
            for (int i = 0; i < N; i++)
            for (int j = 0; j < N; j++)
                dp[i, j] = int.MaxValue;

            for (int k = 0; k < N; k++)
            {
                for (int i = 0; i < N - k; i++)
                {
                    int j = i + k;
                    if (k == 0)
                    {
                        dp[i, j] = 0;
                    }
                    else
                    {
                        for (int m = i; m < j; m++)
                        {
                            int v = dp[i, m] + dp[m + 1, j] + Z(i, m, j);
                            dp[i, j] = Math.Min(dp[i, j], v);
                        }

                    }
                }
            }

            return dp[0, N - 1];
        }

        public int Z(int i, int m, int j)
        {
            return R[i] * C[m] * C[j];
        }

    }

    
    internal static class Input
    {
        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }

    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}


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

// #define int long long
#define ll long long
#define ffor(i,n) for(int i = 0;i < (n); ++i)
#define fro(i,j,n) for(int i = (j);i < (n); ++i)
#define all(v) v.begin(),v.end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vpii vector<pii>
#define ff first
#define ss second


int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    int n,m;
    cin >> n >> m;
    int s = 0;
    ffor(i,m){
      int x;
      cin >> x;
      s += x;
    }

    if(s > n) cout << -1;
    else cout << (n - s);
}		

Measured memory_bytes: 3656
//#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<set>
#include<stack>
#include<iomanip>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<(n);i++)
template<typename T =ll> using v = vector<T>;
template<typename T =ll> using vv = v<v<T>>;
template<typename T =ll,typename U =ll> using p = pair<T,U>;
template<typename T> T chmin(T &a,T b) {return a=min(a,b);}
template<typename T> T chmax(T &a,T b) {return a=max(a,b);}
const ll INF = (ll)1e9;
template <int MOD>
struct ModInt {
    using lint = long long;
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }

    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }

    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

constexpr int MOD = 1e9 + 7;
using mint = ModInt<MOD>;




void a(){
    double r; cin >> r;
    cout<< fixed <<setprecision(15) <<2*M_PI*r<<endl;
}

void b(){
    ll n,m; cin >> n >> m;
    ll sum=0;
    rep(i,m){
        ll a;
        cin >> a;
        sum+=a;
    }
    cout << ((sum<=n?n-sum:-1));
}


void c(){
    ll n; cin >> n;
    auto a = v<>(n,0);
    ll up = 0;
    for(ll i=1;i<n;i++) {
        cin >> up;
        up--;
        a[up]++;
    }
    for(auto i:a){
        cout << i << endl;
    }
}

void d(){
    ll n,k; cin >> n >> k;
    ll sum = n*(n+1)/2;
    auto f0 = [](ll i){
        return i*(i+1)/2;
    };
    mint ans =1;

    for(ll i=k;i<=n;i++){
        ans += sum -f0(n-i)-f0(max((ll)0,i-1))+1;
    }
    cout << ans << endl;
}

void e(){

}

int main(){
    d();
    return 0;
}





Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
// #include<boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
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;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}

inline void solve(void){
  string s;
  in(s);
  int n=count(all(s),'o');
  int k=s.size();
  out(n>=8||n+15-k>=8?"YES":"NO");
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;

int T;
bool tag;
ll a,b,c,d,now,x,y;

int main(){
//	freopen("b.in","r",stdin);
//	freopen("b.out","w",stdout);
	int i;
	scanf("%d",&T);
	while (T--){
		scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
		if (a<b){
			printf("No\n");
			continue;
		}
		now=a; tag=1;
		if (b>d){
			printf("No\n");
			continue;
		}
		if (b<=c){
			printf("Yes\n");
			continue;
		}
		if (b==d){
			if (now%b>c) printf("No\n");
			else printf("Yes\n");
			continue;
		}
		now=now%b;
		x=d%b;
		if (now>c){
			printf("No\n");
			continue;
		}
		if (x==0){
			printf("Yes\n");
			continue;
		}
		if (c==b-1){
			printf("Yes\n");
			continue;
		}
		for (i=1;i<=100000;i++){
			y=(b-1-now)/x;
			now=now+x*y;
			if (now>c){
				tag=0;
				break;
			}
			now=(now+x)%b;
		}
		if (tag) printf("Yes\n");
		else printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 256