akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

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

    int N;
    cin >> N;
    vector<int> L(N);
    Rep (i, N) cin >> L[i];

    sort(L.begin(), L.end());

    ll ans = 0;
    Rep (i, N) {
        for (int j = i+1; j < N; j++) {
            int idx = lower_bound(L.begin(), L.end(), L[i] + L[j]) - L.begin();
            ans += idx - j - 1;
            // cout << i << " " << j << " " << idx-1 << endl;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mt make_tuple
#define mp make_pair
#define pu push_back
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-6
#define ll long long int
#define ld long double
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define pr(v) { for(int i=0;i<v.size();i++) { v[i]==INF? cout<<"INF " : cout<<v[i]<<" "; } cout<<endl;}
#define t1(x)                cerr<<#x<<" : "<<x<<endl
#define t2(x, y)             cerr<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<endl
#define t3(x, y, z)          cerr<<#x<<" : " <<x<<" "<<#y<<" : "<<y<<" "<<#z<<" : "<<z<<endl
#define t4(a,b,c,d)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<endl
#define t5(a,b,c,d,e)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<endl
#define t6(a,b,c,d,e,f)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<" "<<#f<<" : "<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define _ cerr<<"here"<<endl;
#define __ {ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}

using namespace std;
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){ return out<<"("<<a.first<<", "<<a.second<<")";}
template <int> ostream& operator<<(ostream& os, const vector<int>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { if(v[i]!=INF) os << v[i]; else os << "INF";if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { os << v[i]; ;if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 


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

  bool boo = false;
  for(int i=1;i<=100000;i++)
  {
    if((int)(i*(0.08)) == a && (int)(i*(0.10)) == b)
    {
      boo = true;
      cout << i << endl;
      break;
    }
  }
  if(!boo) cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 256
public class Main {
    public static void main(String[] args) {

        // ?????????????????\???????????????????????????????????????.
        java.util.Scanner sc = new java.util.Scanner(System.in);

        // ?????????????????????????????¨??????????´???????.
        // ???????????? char ???????????????????????????.
        // ???????????°??????????????????
        // ??????????????°??????????????¨???.
        while (true) {
            String s = sc.nextLine();
            char[] c = s.toCharArray();
            if (c[0] == '0') { break; }
            int sum = 0;
            for (int i = 0; i < s.length(); i ++) { sum += c[i] - '0'; }
            System.out.println(sum);
        }
    }
}

Measured memory_bytes: 26452
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
const int loose = 0;
const int tight = 1;


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

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}


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

	ll n, k;
	cin >> n >> k;

	Array h(n, 0);
	REP(i, n) cin >> h[i];

	sort(all(h), greater<ll>());

	ll ans = 0;
	rep(i, k, n)ans += h[i];

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long ll;

ll mod=1e9+7;

ll mod_pow(ll a,ll b){
	a%=mod;
	if(b==0)return 1;
	if(b==1)return a;
	ll res=mod_pow(a,b/2)%mod;
	res*=res; res%=mod;
	if(b%2)res*=a;
	return res%mod;
}

int n;
vector<int> g[200200];
ll p[200200];
ll d[202020];

ll q[202020];
ll qq[202020];

void dfs(int s,int pp){
	d[s]=1;
	for(int t:g[s]){
		if(t==pp)continue;
		p[t]=s;
		dfs(t,s);
		d[s]+=d[t];
		(q[s]*=q[t])%=mod;
	}
	(q[s]*=mod_pow(d[s],mod-2))%=mod;
}

void dfs2(int s,int p){
	ll re=1;
	for(int t:g[s]){
		if(t==p)continue;
		(re*=q[t])%=mod;
	}
	for(int t:g[s]){
		if(t==p)continue;
		(qq[t]*=qq[s]*re%mod*mod_pow(q[t],mod-2)%mod*mod_pow((n-d[t]),mod-2)%mod)%=mod;
		dfs2(t,s);
	}
}

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cin >> n;
	for(int i=1;i<n;i++){
		int a,b; cin >> a >> b;
		a--; b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	for(int i=0;i<n;i++){
		q[i]=1;
		qq[i]=1;
	}
	p[0]=-1;
	dfs(0,-1);
	dfs2(0,-1);
	ll res=1;
	for(int i=1;i<n;i++){
		(res*=i)%=mod;
	}
	for(int i=0;i<n;i++){
		ll ans=res;
		for(int t:g[i]){
			if(p[t]==i){
				(ans*=q[t])%=mod;
			}else{
				(ans*=mod_pow(n-d[i],mod-2))%=mod;
				ll re=q[t];
				(re*=d[t])%=mod;
				(re*=mod_pow(q[i],mod-2))%=mod;
				(ans*=re)%=mod;
				(ans*=qq[t])%=mod;
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 20212
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

namespace std {
	#define u(x, a, b) for(ll x = a; x < b; x++)
	#define d(x, a, b) for(ll x = a; x > b; x--)
}

typedef long long ll;
typedef long double ld;

#define MAXI 100010
#define MOD 1000000007

int main(){
	ll n, u, v;
	cin >> n;
	
	ll tot = 0;
	u(one, 1, n+1){
		tot += one*(n+1-one);
	}
	
	u(one, 0, n-1){
		cin >> u >> v;
		
		if(u<v){swap(u,v);}
		
		//now u > v;
		
		tot -= (n+1-u)*v;
	}
	
	cout << tot;
}


Measured memory_bytes: 3632
N, X = gets.split.map(&:to_i)
xs = gets.split.map(&:to_i)
target = (xs.push(X)).sort
ans = 0
a = []
(target.length-1).times{|num|
    a[num] = target[num+1] - target[num]
}
 
def gcd(a, b)
    a, b = b, a if a > b
    until a == 0
      a, b = b%a, a
    end
    return b
end
 
if a.length == 1
    ans = a[0]
else
    ans = a.inject{|a,b| gcd(a,b)}
end
 
puts ans

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

int main() {
  ll n, a, b; cin >> n >> a >> b;
  ll ans;
  ll l = a * (n-1) + b;
  ll r = b * (n-1) + a;
  ans = r - l + 1;
  if (a > b) {
    ans = 0;
  } else {
    if (n == 1) {
      if (a == b) ans = 1;
      else ans = 0;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3620
//Written by Zhu Zeqi
//Come on,baby
//Hack,please
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define CLR(x) memset(x,0,sizeof x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define MAX 1000000000000000000
#define MOD 1000000007
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f
typedef long long ll;
//orz yht
using namespace std;
string i_s(int x){
	if(x==0)
	return "0";
	string ret="";
	while(x){
		ret=ret+(char)(x%10+'0');
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
string add(string a,string b){
	if(a=="")
	a="0";
	if(b=="")
	b="0";
	if(a.length()<b.length())
	swap(a,b);
	while(b.length()<a.length()){
		b='0'+b;
	}
	for(int i=0;i<a.length();i++){
		a[i]=a[i]+(b[i]-'0');
	}
	bool big=false;
	for(int i=a.length()-1;i>=0;i--){
		if(big){
			a[i]++;
		}
		big=false;
		if(a[i]>'9'){
			a[i]=a[i]-10;
			big=true;
		}
	}
	if(big)
	a='1'+a;
	return a;
}
string mul(string a,string b){
	vector<int> va,vb;
	if(a=="0" || b=="0")
	return "0";
	string ans;
	for(int i=0;i<a.length();i++){
		va.push_back(a[i]-'0');
	}
	for(int i=0;i<b.length();i++){
		vb.push_back(b[i]-'0');
	}
	reverse(va.begin(),va.end());
	reverse(vb.begin(),vb.end());
	vector<int> res;
	res.clear();
	res.resize(1005);
	for(int i=0;i<a.length();i++){
		for(int j=0;j<b.length();j++){
			res[i+j]+=(va[i]*vb[j]);
		}
	}
	for(int i=0;i<1005;i++){
		if(res[i]>9){
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	for(int i=0;i<1005;i++){
		ans+=(res[i]+'0');
	}
	reverse(ans.begin(),ans.end());
	int k=0;
	while(ans[k]=='0'){
		k++;
	}
	ans=ans.substr(k);
	return ans;
}
bool is_prime(int n){
	if(n<2)
    return false;
    for(int i=2;i*i<=n;i++)
    if(n%i==0)
    return false;
    return true;
}
int n,nowx,nowy,nowt;
int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);
	cin>>n;
	while(n--){
		int t,x,y;
		cin>>t>>x>>y;
		int sol=abs(x-nowx)+abs(y-nowy);
		if(t-nowt<sol){
			cout<<"No";
			return 0;
		}
		if(t-nowt>sol && (t-nowt-sol)%2==1){
			cout<<"No";
			return 0;
		}
		nowt=t;
		nowx=x;
		nowy=y;
	}
	cout<<"Yes";
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
S=list(map(str,input()))
if (S[0]==S[1] and S[2]==S[3]):
  if S[0]!=S[2]:
    print("Yes")
  else:
    print("No")
elif (S[0]==S[2] and S[1]==S[3]):
  if S[0]!=S[1]:
    print("Yes")
  else:
    print("No")
elif (S[0]==S[3] and S[1]==S[2]):
  if S[0]!=S[1]:
    print("Yes")
  else:
    print("No")
else:
  print("No")

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

inline int pow_2(int n) {
	int ret = 1;

	while (n--) {
		ret *= 2;
	}
	return ret;
}

inline bool select(int value, int bit) {
	return ((0x1 & (value >> bit)) == 0x1);
}

int main() {
	int ret = INT_MAX;
	int tmp;
	int n, m, x;
	int c[16], b[16], a[16][16];
	int last;
	bool flag;

	cin >> n >> m >> x;

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

	last = pow_2(n);
	for (int k=0; k<last; k++) {
		for (int j=0; j<m; j++) {
			b[j] = 0;
		}
		tmp = 0;
		flag = true;
		for (int i=0; i<n; i++) {
			if (select(k, i)) {
				for (int j=0; j<m; j++) {
					b[j] += a[i][j];
				}
				tmp += c[i];
			}
		}
		for (int j=0; j<m; j++) {
			if (b[j] < x) {
				flag = false;
			}
		}
		if ((flag == true) && (tmp < ret)) {
			ret = tmp;
		}
	}

	if (ret == INT_MAX)
		ret = -1;

	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
 
#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define inter ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
 
// policy-based
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;	
 
 
using namespace std;
 
 
typedef long long ll; // int or long long
typedef long double ld;
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
 	
/*
typedef tree<
ll,
null_type,
less<ll>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
*/
 
const ll MAX = 1e6+10;
const ll inf = 1e9;
 


int main(){
	fastio;
	ll n;
	cin>>n;
	ll x = n%1000;
	cout<< (x ?  1000-x:0)<<endl;
	return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define N 1000000007
#define pll pair<ll,ll>

int main() {

    ll n;
    cin>>n;

    // vector<ll> A(n);
    // for(int i=0;i<n;i++)
    // 	cin>>A[i];

    cout<<n*n*n<<endl;

    return 0;
}


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

int main(void)
{
    long long int a,b,c,d,i,j,x,y;

    cin >> a >> b >> c >> d;

    if(a<b) x=a;
    else x=b;

    if(c<d) y=c;
    else y=d;

    cout << x+y;

    return 0;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007

using namespace std;

bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) x*=i;
    return x;
}

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

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

void f(ll rest,string s){
    if(rest==0){
        cout<<s<<endl;
    }else{
        for(char c='a';c<='c';c++){
            f(rest -1,s+c);
        }
    }
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,m;
    cin>>n>>m;
    vector<ll> a,b;
    rep(i,m){
        ll start,finish;
        cin>>start>>finish;
        if(start==1){
            if(finish==n){
                cout<<"POSSIBLE"<<endl;
                return 0;
            }else a.push_back(finish);
        }else if(finish==n) b.push_back(start);
    }
    sort(ALL(a));
    sort(ALL(b));
    
    vector<ll> result;
    //↓積集合を指し示すやつだって！！
    set_intersection(ALL(a), ALL(b), back_inserter(result));
    cout<<(result.size()>0 ? "POSSIBLE":"IMPOSSIBLE")<<endl;
    return 0;
}


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

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

using namespace std ;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;




int main()
{
  int a, b ;
  cin >> a >> b ;
  
  if(a%3==0 || b%3==0 || (a+b)%3==0){
    cout <<"Possible"<<endl ;
  }
  else{
    cout <<"Impossible"<<endl ;
  }
    return 0 ;
}

/*　吾輩はやれば出来る子である。 
　　　　∩∩ 
　　　（´･ω･） 
　　 ＿|　⊃／(＿＿_ 
　／　└-(＿＿＿_／ 
　￣￣￣￣￣￣￣ 
　やる気はまだない 

　　 ⊂⌒／ヽ-、＿_ 
　／⊂_/＿＿＿＿ ／ 
　￣￣￣￣￣￣￣　　*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAXN=std::numeric_limits<int>::max(); 

int main()
{
	int n,i,j,k,ans=0;
	cin>>n;
	int cost[n][3];
	int dp[n+1][3];
	
	for(i=0;i<n;i++)
		for(j=0;j<3;j++)
		{
			cin>>cost[i][j];
			dp[i][j]=0;
		}
		dp[n][0]=0;
		dp[n][1]=0;
		dp[n][2]=0;
	
	for(i=0;i<3;i++)
		dp[1][i]=cost[0][i];
		
	for(i=2;i<=n;i++)
	{
		for(j=0;j<3;j++)
		{
			for(k=0;k<3;k++)
			{
				if(j!=k)
					dp[i][j]=max(dp[i][j],dp[i-1][k]+cost[i-1][j]);
			}
			
		}
	}
	for(k=0;k<3;k++)
		ans=max(ans,dp[n][k]);
		
	cout<<ans<<endl;
	
}

Measured memory_bytes: 2560
import numpy as np
N = int(input())
abc = []
for i in range(N):
    abc.append(list(map(int, input().split())))
    
dp = np.zeros(shape=(N, 3), dtype=int)
dp[0, :] = abc[0]
for i in range(N-1):
    dp[i+1, 0] = max(dp[i+1, 0], dp[i, 1] + abc[i+1][0], dp[i, 2] + abc[i+1][0])
    dp[i+1, 1] = max(dp[i+1, 1], dp[i, 0] + abc[i+1][1], dp[i, 2] + abc[i+1][1])
    dp[i+1, 2] = max(dp[i+1, 2], dp[i, 0] + abc[i+1][2], dp[i, 1] + abc[i+1][2])
print(max(dp[N-1, :]))

Measured memory_bytes: 43156
#include <iostream>

using namespace std;

int main()
{
	int K, S;
	cin >> K >> S;
	int ans = 0;

	for (int X = 0; X <= K; ++X) {
		for (int Y = 0; Y <= K; ++Y) {
			int Z = S - X - Y;
			if (0 <= Z && Z <= K) {
				++ans;
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
using namespace std;
#define ll long long

int main(){
    string a;
    int mod=0;
    cin>>a;
    cin>>mod;
    for(int i=0;i<a.size();i++){
        if(i%mod==0){
            cout<<a[i];
        }
    }
    cout <<endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>
#include <functional>

using namespace std;
#define ALL(x)              (x).begin(),(x).end()
typedef long long           ll;
#define REP(i, n)           for (ll i = 0 ; i < (ll)n ; ++i)
#define REPN(i, m, n)       for (ll i = m ; i < (ll)n ; ++i)
#define INF                 (ll)1e9
#define MOD                 (1000 * 1000 * 1000 + 7)
#define Ceil(x, n)          (((((x))+((n)-1))/n))
#define CeilN(x, n)         (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)        ((x)-(x)%(n))
#define IsOdd(x)            (((x)&0x01UL) == 0x01UL)
#define IsEven(x)           (!IsOdd((x)))
#define M_PI                3.14159265358979323846
typedef pair<ll, ll>	    P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
/* 約数の列挙 */
vector<ll> divisorExec(ll n)
{
	vector<ll> res;
	for (ll i = 1; i <= sqrt(n); i++){
		if ((n % i) == 0) {
			res.push_back(i);
			if ((i * i) != n) {
				res.push_back(n / i);
			}
		}
	}
	sort(res.begin(), res.end());
	return res;
}

ll calcOne(ll A, ll B)
{
	ll calc = 0;
	calc += A * A * A * A * A;
	calc -= B * B * B * B * B;
	return (calc);
}

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

	ll A, B;
	vector<ll> yakusuAll = divisorExec(X);
	for (auto yakusu : yakusuAll) {
		for (int j = -120; j <= 120; j++) {
			ll lbAns = calcOne(yakusu + j, j);
			if (lbAns == X) {
				A = yakusu + j;
				B = j;
				goto EXIT;
			}
		}
	}

EXIT:
	cout << A << " " << B << endl;
	return 0;
}


Measured memory_bytes: 3724
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include <cmath>
using namespace std;

#define mod 1000000007
#define ten5 100005
#define ten52 200005
#define ten6 1000005
#define PI 3.1415926
#define pb(x) push_back(x)
#define all(x) x.begin(),x.end()
#define mkpr(x1,x2) make_pair(x1,x2)
typedef long long int ll;


//stack<char> stk;
//set<ll> sll;
//map<string,ll> mp,mp1;
//map<pair<ll,ll>,ll>::iterator iter;
//map<ll,ll> mp;
//deque<ll> deq;
vector<ll> vll;
ll num[ten52];

int main(void)
{
    long long int m,n,i,j;
    cin>>m;
    if(m%1000 == 0) cout<<0;
    else cout<<1000*(m/1000+1)-m;
    return 0;
}





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

vector<int> tfs = {3, 5, 7};
int ans = 0;

void dfs(int n, int m, int cur, vector<int> used) {
	if (m <= n && used.at(0) > 0 && used.at(1) > 0 && used.at(2) > 0) ans++;
	if (cur < 9) {
		int p = 1;
		for (int i = 0; i < cur; i++) {
			p *= 10;
		}
		for (int i = 0; i < 3; i++) {
			used.at(i)++;
			dfs(n, m + tfs.at(i) * p, cur + 1, used);
			used.at(i)--;
		}
	}else return;
}

int main() {
	int n; cin >> n;
	vector<int> used(3, 0);
	dfs(n, 0, 0, used);
	cout << ans << endl;
}

Measured memory_bytes: 256
sn,qn=map(int,input().split())
s=input()
x=list(list(map(int,input().split())) for _ in range(qn))

s2=[0]*sn

for i in range(sn-1):
	if s[i]=='A' and s[i+1]=='C':
		s2[i+1]=s2[i]+1
	else:
		s2[i+1]=s2[i]

for i in range(qn):
	res=s2[x[i][1]-1]-s2[x[i][0]-1]
	print(res)

Measured memory_bytes: 30664
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	t1 := getNextInt64(scanner)
	t2 := getNextInt64(scanner)
	a1 := getNextInt64(scanner)
	a2 := getNextInt64(scanner)
	b1 := getNextInt64(scanner)
	b2 := getNextInt64(scanner)

	if a1*t1+a2*t2 == b1*t1+b2*t2 {
		fmt.Println("infinity")
		return
	}
	if a1 > b1 && a2 > b2 {
		fmt.Println("0")
		return
	}
	if a1 < b1 && a2 < b2 {
		fmt.Println("0")
		return
	}
	if a1 == b1 || a2 == b2 {
		fmt.Println("1")
		return
	}

	if a1*t1+a2*t2 > b1*t1+b2*t2 {
		if a1 > b1 {
			fmt.Println("0")
			return
		}
		perdiff := (a1*t1 + a2*t2) - (b1*t1 + b2*t2)
		ans := (b1 - a1) * t1 / perdiff * 2
		if ((b1-a1)*t1)%perdiff > 0 {
			ans++
		}
		fmt.Println(ans)
		return

	}
	if a1 < b1 {
		fmt.Println("0")
		return
	}
	perdiff := (b1*t1 + b2*t2) - (a1*t1 + a2*t2)
	ans := (a1 - b1) * t1 / perdiff * 2
	if ((a1-b1)*t1)%perdiff > 0 {
		ans++
	}
	fmt.Println(ans)
	writer.Flush()
}


Measured memory_bytes: 640
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//
constexpr ll MOD = 1e9 + 7;
/*/
const ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
inline bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
inline bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n;
  cin >> n;
  vll a(n);
  rep(i, n){
    cin >> a[i];
  }
  ll mi = INF;
  ll ans = 0;
  ll S = accumulate(ALL(a), 0ll);
  rep(i, n){
    if(chmin(mi, abs(n*a[i]-S))){
      ans = i;
    }
  }
  print(ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

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

    int a,b,c;
    cin>>a>>b>>c;
    int m = 3*max({a,b,c});
    m -= a+b+c;
    if(m & 1) {
        cout<<(m+3)/2;
    }
    else {
        cout<<m/2;
    }
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		
		Scanner sc = new Scanner(System.in);
		//.useDelimiter
		
		int w = sc.nextInt();		
		int n = sc.nextInt();
		
		ArrayList<Integer> line_number = new ArrayList<Integer>();
		
		for(int i=1; i<=w; i++){
			line_number.add(i);
		}
		
		for(int i=1; i<=n; i++){
			String[] str = sc.next().split(",");
	    	int a = Integer.parseInt(str[0]);
			int b = Integer.parseInt(str[1]);
			
			int temp_1 = line_number.get(a-1);
			int temp_2 = line_number.get(b-1);
			
			line_number.set(a-1,temp_2);
			line_number.set(b-1,temp_1);
		}
		for(int j=0; j<w; j++){
			System.out.println(line_number.get(j));
		}
	}
}

Measured memory_bytes: 17204
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;
import java.util.OptionalDouble;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class AThumbnail {
        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            int n = in.ints();
            int[] a = in.ints(n);
            double avg = IntStream.of(a).average().orElse(0);
            int mi = -1;
            double d = 1000000000;
            for (int i = 0; i < n; i++) {
                if (Math.abs(avg - a[i]) < d) {
                    mi = i;
                    d = Math.abs(avg - a[i]);
                }
            }
            out.println(mi);
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int ints() {
            return Integer.parseInt(string());
        }

        public int[] ints(int length) {
            return IntStream.range(0, length).map(x -> ints()).toArray();
        }

    }
}



Measured memory_bytes: 28756
N, Q = map(int, input().split())
S = input()
LRs = [list(map(int, input().split())) for i in range(Q)]

counts = []
for i in range(len(S)-1):
    if S[i] == 'A' and S[i+1] == 'C':
        counts.append(1)
    else:
        counts.append(0)
counts.append(0)

rev_counts = [0]
for i in reversed(range(len(S)-1)):
    rev_counts.append(rev_counts[-1] + counts[i])
rev_counts = list(reversed(rev_counts))
# print(counts)
# print(rev_counts)


for LR in LRs:
    start = LR[0] - 1
    end = LR[1]  -1
    print(rev_counts[start] - rev_counts[end])

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

typedef long long ll;
typedef pair<ll,int> pli;

const int N = 1e5;

vector<pli> vi;
int par[N+5];
int n,m;

int find_par(int x){
	if(x < 0) return -1;
	if(par[x] == x) return x;
	return par[x] = find_par(par[x]);
}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for(int i=1;i<=m;i++) par[i] = i;
	for(int i=1;i<=n;i++){
		int u; ll v;
		cin >> u >> v;
		vi.push_back(make_pair(v,u));
	}
	sort(vi.begin(),vi.end());
	reverse(vi.begin(),vi.end());
	ll ans = 0ll;
	for(int i=0;i<vi.size();i++){
		int tmp = vi[i].second;
		int jadi = m - tmp;
		jadi = find_par(jadi);
		if(jadi == -1) continue;
		ans+=vi[i].first;
		par[jadi] = jadi-1;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int main() {
	string str;
	int alph[26];
	for (int i = 0; i < 26; i++)alph[i] = 0;
	cin >> str;

	bool miss = false;
	for (int i = 0; i < str.size(); i++) {
		int c = str[i] - 97;
		if (alph[c] > 0) {
			miss = true;
			break;
		}
		else alph[c] += 1;
	}

	if (miss)cout << "no" << endl;
	else cout << "yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
const int MOD = 1000000007;
const int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;

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

  bool ok = true;
  string S;
  cin >> S;
  int i=0;
  int N = S.size();
  if(N % 2 == 1){
    cout << "No" << endl;
    return 0;
  }
  while(N>i){
    if(S[i] == 'h' && S[i+1] == 'i'){
      i += 2;
    }
    else{
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

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

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T LCM(T a,T b){return a/GCD(a,b)*b;}

const int INF=1e9;
const double eps=0.0000000001;

int main(){
  ll n;
  ll a[10000]={0},v;
  cin >> n;
  for(ll i=2;i<n+1;i++){
    v=i;
    for(ll j=2;j<n+1;j++){
      
      while(v%j==0){
        v/=j;
        a[j]++;
      }
    }
  }
  ll ans=1;
  FOR(i,10000){
    ans=ans*(a[i]+1)%MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 384
using System;
using System.IO;
using System.Collections.Generic;
using System.Numerics;

namespace abc139
{
    class Program
    {
        static void Main(string[] args)
        {
            //Console.SetIn(new StreamReader("input.txt"));
            solve_abc139B();
        }
        
        public static void solve_abc139B()
        {
            string[] ab = Console.ReadLine().Split(' ');
            int a = Convert.ToInt32(ab[0]);
            int b = Convert.ToInt32(ab[1]);

            /*
            Предположение полностью не правильное
            Визуальное представление, что у нас розетка и пилиоты, которые
            подключаются по цепочке, не соответствует тому, что задано в
            условии. Поэтому в данном случае додумывание было ошыбочным.
            Даже если условие задачи тяжело представить в голове, его надо
            воспринимать, как есть. Без опасных додумываний.
            Один свободный слот по условию нужно воспринимать, как есть. Это
            один свободный слот. Далее, Один пауэр стрип по условию это A свободных
            слотов из которых один не свободный. То есть У нас A - 1 свободных слотов,
            при добавлении одного пауэр стрипа.
            Теперь, нам надо иметь хотя бы B свободных слотов. Но по условию  у нас один 
            слот свободный уже есть. Тогда получается надо иметь хотябы B - 1 свободных слотов.
            В моем же случае, я сам себя обманул и считал, что один свободный слот у нас всегда
            становится занятым, если мы добавляем новый пауэр стрим. И это неправда по условию.
             */
            Console.WriteLine(((b - 1) + (a - 1) - 1) / (a - 1));

            /*int w = 1;
            if (a <= b)
            {
                w = ((b - 1) + a - 1) / a;
                int d = w - 1;
                int r = a * w - d;
                if (r < b - 1)
                {
                    w++;
                }
            }

            Console.WriteLine(w);
            */
            /*
            //Округление вверх не работает. Узнать почему
            int t = (b + a - 1) / a;
            int d = t - 1;
            if (b > a * t - d)
            {
                t++;
            }
            Console.WriteLine(t);
            */
        }

        public static void solve_abc139A()
        {
            string s1 = Console.ReadLine();
            string s2 = Console.ReadLine();

            int c = 0;

            if (s1[0] == s2[0])
            {
                c++;

            }
            if (s1[1] == s2[1])
            {
                c++;
            }
            if (s1[2] == s2[2])
            {
                c++;
            }
            Console.WriteLine(c);
        }
    }
}


Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
#define all(v) ((v).begin()),((v).end())
#define ll long long
#define fastIO cout << fixed << setprecision(12), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
double const EPS = 1e-12, PI = acos(-1);
const int N = 4e5 + 9, M = 5e3 + 9, OO = 1e9 + 7, MOD = 1e9 + 7;
const ll inf = 1e18;

int main() {
  fastIO;
#ifdef LOCAL
  freopen("input.in", "rt", stdin);
#endif
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll g = __gcd(c, d);
  ll lcm = (c * d) / g;

  ll total = b - a + 1;
  ll totalDivC = (b / c) - ((a - 1) / c);
  ll totalDivD = (b / d) - ((a - 1) / d);
  ll totalDivLcm = (b / lcm) - ((a - 1) / lcm);

  ll totalDiv = totalDivC + totalDivD - totalDivLcm;
  cout << total - totalDiv;
  return 0;
}


Measured memory_bytes: 256
from sys import exit, stdin

input = stdin.readline
import copy

# from collections import deque,Counter
# import numpy as np

(S,) = input().split()
(T,) = input().split()


ans = 10000
for i in range(len(S) - len(T) + 1):
    cnt = 0
    tmp = S[0 + i : len(T) + i]
    for s, t in zip(tmp, T):
        if s != t:
            cnt += 1
    if cnt == 0:
        ans = 0
        break
    else:
        if ans > cnt:
            ans = cnt


print(ans)


Measured memory_bytes: 9280
s = input()
n = len(s)


def point(c0, c1):
    if c0 == "p" and c1 == "p":
        return 0
    if c0 == "p" and c1 == "g":
        return 1
    if c0 == "g" and c1 == "p":
        return -1
    if c0 == "g" and c1 == "g":
        return 0


answer = 0
for i in range(n):
    c0 = "g" if i % 2 == 0 else "p"
    answer += point(c0, s[i])

print(answer)


Measured memory_bytes: 9168
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef vector<int> vi;
const int inf = 1e9+7;
const int INF = 1e18+7;
//26

signed main(){
	int n = 9;
	rep(i,n){
		string str;int x, y;
		cin >> str;
		scanf("%lld%lld", &x, &y);
		int ans = x*200+y*300;
		cout << str << " ";
		printf("%lld %lld\n", x+y, ans);
	}
	return 0;
}


Measured memory_bytes: 3252
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x) cout << #x << " = " << (x) << endl;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define P pair<int, int>
#define V vector<int>
#define M map<int, int>
#define S set<int>
int comb(int n, int k)
{
    const int mod = MOD;
    int comb_f[3000];
    comb_f[0] = 1;
    for (int i = 1; i < 2900; i++)
        comb_f[i] = (comb_f[i - 1] * i) % mod;
    int comb_res = 1;
    int comb_res_k = mod - 2;
    int comb_y = (comb_f[n - k] * comb_f[k]) % mod;
    while (comb_res_k) {
        if (comb_res_k & 1)
            comb_res = (comb_res * comb_y) % mod;
        comb_y = (comb_y * comb_y) % mod;
        comb_res_k /= 2;
    }
    return (comb_f[n] * comb_res) % mod;
}
int N, K;
void solve()
{
}

signed main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N >> K;
    for (int i = 1; i <= K; i++) {
        int ans;
        if (i - 1 > N - K) {
            ans = 0;
        } else {
            ans = comb(K - 1, i - 1) * comb(N - K + 1, i);
            //     cout << comb(K - 1, i - 1) << " " << comb(N - K + 1, i) << endl;
            ans = ans % MOD;
        }
        cout << ans << endl;
    }
    solve();
    return 0;
}


Measured memory_bytes: 256
n,x,y=map(int, input().split())
ans=[0]*(n-1)
for i in range(1,n):
    for j in range(i+1,n+1):
        d1=abs(x-i)+abs(y-j)+1
        d2=j-i
        ans[min(d1,d2)-1]+=1

for i in range(n-1):
    print(ans[i])


Measured memory_bytes: 3444
// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


void solve(long long n, std::vector<long long> a){
    int gc = a[0];
    int m = 1000007;
    vector<vector<int>> table(m);
    for(int i = 2; i < m; ++i){
        if(!table[i].empty())
            continue;
        for(int j = i; j < m; j += i)
            table[j].emplace_back(i);
    }
    for(int i = 0; i < n; ++i)
        gc = gcd(gc, a[i]);

    vector<int> cnt(m, 0);
    for(auto x : a){
        for(auto y : table[x])
            ++cnt[y];
    }
    if(*max_element(cnt.begin(), cnt.end()) <= 1)
        cout << "pairwise coprime\n";
    else if(gc == 1)
        cout << "setwise coprime\n";
    else
        cout << "not coprime\n";
}


signed main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 70244
w = input()

t = []
while True:
    t0 = input()
    if t0 == 'END_OF_TEXT':
        break
    t.append(t0)

tt = []
for s in t:
    for s_sp in s.split():
        tt.append(s_sp)

count = 0
for s in tt:
    if w == s.lower(): count += 1

print(count)


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

int main()
{
  double eye[2];
  int data[4][2];
  memset(data,0,sizeof(data));
  for(;cin>>eye[0]>>eye[1];)
    {
      for(int i=0;i<2;i++)
	{
	  if(eye[i]>=1.1)
	    data[0][i]++;
	  else if(eye[i]>=0.6)
	    data[1][i]++;
	  else if(eye[i]>=0.2)
	    data[2][i]++;
	  else
	    data[3][i]++;
	}      
    }
  for(int i=0;i<4;i++)
    {
      cout<<data[i][0]<<" "<<data[i][1]<<endl;
    }
}

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

int main() {
	// your code goes here
	int n;
	cin>> n;
	int a[n];
	for(int i=0;i<n;i++)
	{
	    cin >> a[i];
	}
	int flag =0;
	for(int i=0;i<n;i++)
	{
	    if(a[i]%2 == 0)
	    {
	        if((a[i]%3 == 0) ||(a[i]%5) == 0)
	        {
	            flag = 0;
	        }
	        else
	        {
	            flag = 1;
	            break;
	        }
	    }
	    
	}
	if(flag == 1)
	{
	    cout << "DENIED\n";
	}
	else
	{
	    cout << "APPROVED\n";
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int N, T; cin >> N >> T;
	vector<int> p(T+1, 0);
	for (int i = 0; i < N;i++) {
		int l, r; cin >> l >> r;
		p[l]++; p[r]--;
	}
	int Ans = 0;
	int Sum = 0;
	for (int t : p) {
		Sum += t;
		Ans = max(Ans, Sum);
	}
	cout << Ans << endl;
}

Measured memory_bytes: 3328
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long ll;
struct edge{
	int k,next;
}e[5000005];
struct trie{
	ll mx,add;
}t[20005];
int n,m,sum[5005],a[5005][205],home[5005][205],cnt=-1,nxt[5005][205],now[205];
ll b[5005];
void add(int x,int y,int z){
	cnt++;
	e[cnt].k=z;
	e[cnt].next=home[x][y];
	home[x][y]=cnt;
}
void pwd(int k,int l,int r){
	if(l==r) return;
	l=k<<1,r=k<<1|1;
	if(t[k].add){
		t[l].add+=t[k].add;
		t[r].add+=t[k].add;
		t[l].mx+=t[k].add;
		t[r].mx+=t[k].add;
		t[k].add=0;
	}
}
void build(int k,int l,int r){
	if(l==r){
		t[k].mx=b[l];
		return;
	}
	int mid=l+r>>1;
	build(k<<1,l,mid);
	build(k<<1|1,mid+1,r);
	t[k].mx=max(t[k<<1].mx,t[k<<1|1].mx);
}
void update(int k,int l,int r,int L,int R,ll val){
	pwd(k,l,r);
	if(L<=l&&R>=r){
		t[k].add+=val;
		t[k].mx+=val;
		return;
	}
	int mid=l+r>>1;
	if(L<=mid) update(k<<1,l,mid,L,R,val);
	if(R>mid) update(k<<1|1,mid+1,r,L,R,val);
	t[k].mx=max(t[k<<1].mx,t[k<<1|1].mx);
}
int main(){
	memset(home,-1,sizeof(home));
	scanf("%d%d",&n,&m);
	for(int i=1;i<n;i++) scanf("%d",&sum[i+1]);
	for(int i=1;i<=n;i++)
		for(int p=1;p<=m;p++) scanf("%d",&a[i][p]);
	for(int i=1;i<=m;i++) nxt[n][i]=n+1;
	for(int i=n-1;i;i--){
		for(int p=1;p<=m;p++){
			nxt[i][p]=nxt[i+1][p];
			while(nxt[i][p]<=n&&a[nxt[i][p]][p]<=a[i][p]) nxt[i][p]=nxt[nxt[i][p]][p];
			if(a[i+1][p]>a[i][p]) nxt[i][p]=i+1;
		}
	}
	ll o=0;
	for(int i=1;i<=n;i++){
		for(int p=1;p<=m;p++){
			now[p]=max(now[p],a[i][p]);
			b[i]+=now[p];
		}
		o+=sum[i];
		b[i]-=o;
	}
	build(1,1,n);
	ll ans=t[1].mx;
	for(int i=1;i<n;i++){
		update(1,1,n,i+1,n,sum[i+1]);
		for(int p=1;p<=m;p++){
			for(int j=i+1;j<=n&&a[j][p]<a[i][p];j=nxt[j][p]){
				update(1,1,n,j,nxt[j][p]-1,a[j][p]-a[i][p]);
			}
		}
		ans=max(ans,t[1].mx);
	}
	printf("%lld",ans);
	return 0;
}

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

string s;

int main()
{
    cin >> s;
    if (s == "A")
    {
        cout << "T" << endl;
    }
    if (s == "T")
    {
        cout << "A" << endl;
    }
    if (s == "G")
    {
        cout << "C" << endl;
    }
    if (s == "C")
    {
        cout << "G" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
const int maxn=1e5+10;
using namespace std;
int n,m,k,t,a[maxn];
int main()
{
    int i,j;
    scanf("%d",&n);
    ll mi=1e18;
    for(i=0;i<n;i++)scanf("%d",&a[i]);
    for(i=-100;i<=100;i++)
    {
        ll p=0;
        for(j=0;j<n;j++)
            p+=(i-a[j])*(i-a[j]);
        mi=min(mi,p);
    }
    printf("%lld\n",mi);
    //system("pause");
    return 0;
}


Measured memory_bytes: 256
/// Code By t_bone_289 (Tushar Singh)
/// An Immature Programmer.... I'm still developing !!
#include<bits/stdc++.h>
using namespace std;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define M 1000000007
typedef long long ll;
typedef double d;
typedef long double ld;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin>>s;
    ll k;
    cin>>k;
    if(s.size()==1 || k==1)
    {
        cout<<s[0]<<endl;
        return 0;
    }
    if(s[0]!='1')
    {
        cout<<s[0]<<endl;
        return 0;
    }
    ll i=0;
    while(s[i]=='1')
    {
        i++;
    }
    if((i+1)>k)
    {
        cout<<1<<endl;
        return 0;
    }
    cout<<s[i]<<endl;
    return 0;
}




Measured memory_bytes: 256
// ABC179B.cpp

#include <iostream>
using namespace std;
using ll = long long;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
int main()
{
    int n;
    cin >> n;
    int d[110][2];
    rep(i, n) {
        cin >> d[i][0] >> d[i][1];
    }
    int i = 0;
    string ans = "No";
    // n=5 i=0,1,2,3,4 
    while(i<n-2) {
        if (d[i][0] == d[i][1]&& d[i + 1][0] == d[i + 1][1]&& d[i + 2][0] == d[i + 2][1]) {
            ans = "Yes";
            break;
        }
        i++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3124
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define F first
#define S second
#define INF 1 << 30

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int main(){
  int N;
  while(scanf("%d", &N) && N){
    int W, H, x, y, S, T;
    int field[101][101] = {};
    memset(field, 0, sizeof(field));
    scanf("%d%d", &W, &H);
    rep(i, N){
      scanf("%d%d", &x, &y);--x;--y;
      field[y][x] = 1;
    }
    scanf("%d%d", &S, &T);

    int res = 0;
    rep(i, H-T+1) rep(j, W-S+1){
      int c = 0;
      REP(k, i, i+T) REP(l, j, j+S) if(field[k][l]) c++;
      res = max(res, c);
    }

    printf("%d\n", res);
  }
  return 0;
}

Measured memory_bytes: 1236
#include <stdio.h>

int main(void){
    int m1,d1,m2,d2;
    
    scanf("%d %d",&m1,&d1);
    scanf("%d %d",&m2,&d2);
    
    switch (d1) {
        case 28:
            if (m1==2) {
                printf("1\n");
            } else {
                printf("0\n");
            }
            break;
        case 30:
            if (m1==4||m1==6||m1==9||m1==11) {
                printf("1\n");
            } else {
                printf("0\n");
            }
            break;
        case 31:
            if (m1==1||m1==3||m1==5||m1==7||m1==8||m1==10||m1==12) {
                printf("1\n");
            } else {
                printf("0\n");
            }
            break;
        default:
            printf("0\n");
            break;
    }
    return 0;
}


Measured memory_bytes: 256