akhauriyash/Code-Regression huggingface dataset:
/*
	author : SAMRAT DE
	username : Alucard_01
	NIT Durgapur
*/

/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>*/
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long int
#define vec(x) vector<x> 
#define st(x) set<x> 
#define pi(x,y) pair<x,y>
#define mpp(x,y) map<x,y>
#define pqq(x) priority_queue<x> 
#define min_heap(x) priority_queue<x, vector<x>, greater<x> >
#define all(x) x.begin(),x.end()
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define rel(i,x,y) for(ll i=x-1;i>=y;i--)
#define rev(x) reverse(x.begin(),x.end())
#define mem(x,a) memset(x,a,sizeof(x))
#define mod 1000000007
#define nxt_per(x) next_permutation(x.begin(),x.end())
#define pb push_back
#define pf push_front
#define indexof order_of_key
#define valueat find_by_order
#define myds tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> 

int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
int dxx[8]={0,0,1,-1,-1,-1,1,1};
int dyy[8]={1,-1,0,0,-1,1,1,-1};

using namespace std;
//using namespace __gnu_pbds;

int32_t main()
{
	fastio;
	//best of luck don't loose hope man	
		
	string s,t;
	cin>>s>>t;
	int count=0;
	rep(i,0,s.size()){
		if(s[i]==t[i])
			count++;
	}
	cout<<count<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int gcd(int x,int y);
int gcd(int x, int y) {
	if (y == 0) {
		return x;
	}
	if (x >= y) {
		return gcd(y, x%y);
	}
	else if (x < y) {
		return gcd(y, x);
	}
}
int main() {
	int x,y;
	cin >> x >> y;
	int result = gcd(x,y);
	cout<<result<<endl;
	return 0;
}


Measured memory_bytes: 3100
sx, sy, tx, ty = map(int,input().split())
way1 = 'R'*(tx-sx)+'U'*(ty-sy)
way2 = 'L'*(tx-sx)+'D'*(ty-sy)
way3 = 'D' + 'R'*(tx-sx+1) + 'U'*(ty-sy+1) + 'L'
way4 = 'U' + 'L'*(tx-sx+1) + 'D'*(ty-sy+1) + 'R'
print(way1+way2+way3+way4)

Measured memory_bytes: 38256
#include <stdio.h>

int main()
{
    char number[1001];
    int  sum = 0;

    int i;
    for (i = 0; ; i++) {
        scanf("%c", &number[i]);
        if (number[0] == '0') {
            break;
        } else if (number[i] == '\n') {
            printf("%d\n", sum);
            i   = - 1;
            sum = 0;
        } else  {
            sum = sum + (number[i] - '0');
        }
    }
    return 0;
}



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

struct Cnt
{
    int r;
    int w;
};

int main()
{
    int n;
    string s;
    cin >> n >> s;
    Cnt left, right;
    left.r = 0; left.w = 0; right.r = 0; right.w = 0;
    rep(i,n)
    {
        if(s[i] == 'R') right.r++;
        else right.w++;
    }
    int ans = 1e9;
    rep(i,n+1)
    {
        int score = 0;
        score += max(left.w, right.r);
        ans = min(ans, score);
        if(s[i] == 'R')
        {
            left.r++;
            right.r--;
        }
        else
        {
            left.w++;
            right.w--;
        }
    }
    cout << ans << endl;

    
    return 0;
}

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

class data {
public:
  int p[5]={1868,1912,1926,1989,2017};
  char c[4]={'M','T','S','H'};
};
int main() {
  int E, Y;
  cin >> E >> Y;
  data d;
  if (E==0) {
    int idx;
    for (int i=0; i<4; i++) {
      if (d.p[i]<=Y && Y<d.p[i+1]) {
        idx=i;
        break;
      }
    }
    printf("%c%d\n", d.c[idx], Y-d.p[idx]+1);
  } else {
    printf("%d\n", Y+d.p[E-1]-1);
  }
  return 0;
}

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

const ll mod = 1e9 + 7;
int n;
vector<vector<int>> a, dp;

int recursion(int m, int w) {
	if (m == n) {
		if (w == 0) {
			return 1;
		}
		return 0;
	}
	if (dp[m][w] != -1)
		return dp[m][w];
	ll total = 0;
	for (int i = 0; i < n; i++) {
		int cur = 1 << i;
		bool avail = (((cur & w) == 0) ? 0 : 1);
		if (avail && a[m][i]) {
			total = (total + recursion(m + 1, cur ^ w)) % mod;
		}
	}
	return dp[m][w] = total;
}

int main() {
	ios_base::sync_with_stdio(false);

	cin >> n;
	a.resize(n, vector<int> (n));
	dp.resize(n);
	for (int i = 0; i < n; i++) {
		dp[i].resize(1 << n, -1);
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> a[i][j];
		}
	}
	int answer = recursion(0, (1 << n) - 1);
	cout << answer;

	return 0;
}

Measured memory_bytes: 172416
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
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; }
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define DEBUG(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

	int N; cin >> N;
	vector<int> P(N), Q(N);
	rep(i, N) cin >> P[i];
	rep(i, N) cin >> Q[i];

	vector<int> v(N);
	rep(i, N)v[i] = i;
	int a, b;
	int cnt = 0;
	do{
		cnt++;
		bool pok = true;
		rep(i, N){
			if(v[i]+1 != P[i]){
				pok = false;
			}
		}
		if(pok) a = cnt;
		bool bok = true;
		rep(i, N){
			if(v[i]+1 != Q[i]){
				bok = false;
			}
		}
		if(bok) b = cnt;
	}while(next_permutation(ALL(v)));
	cout<< abs(a - b) << endl;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
//#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>

using namespace std;
using ll=long long;
using intpair=pair<int,int>;
using intpv=vector<intpair>;
using llpair=pair<ll,ll>;
using llpv=vector<llpair>;
using intvec=vector<int>;
using llvec=vector<ll>;
using intq=queue<int>;
using llq=queue<ll>;
using intmat=vector<intvec>;
using llmat=vector<llvec>;
using pairmat=vector<llpv>;

template<typename T>
using matrix=vector<vector<T>>;
template<typename T>
using pque=priority_queue<T>;
template<typename T>
using lpque=priority_queue<T,vector<T>,greater<T>>;

#define PI 3.141592653589793
#define INTINF 1<<30
#define LLINF 1LL<<60
#define MPRIME 1000000007
#define MPRIME9 998244353

#define len length()
#define pushb push_back
#define fi first
#define se second

#define setpr fixed<<setprecision(15)
#define all(name) name.begin(),name.end()
#define rall(name) name.rbegin(),name.rend()
#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())
#define matin(mat,H,W) for(int i__=0; i__<H; i__++)for(int j__=0; j__<W; j__++) cin>>mat[i__][j__]
#define out(n) cout<<n<<endl

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;
}

template<class T>
inline void outmat(T& a, int y, int x) {
	for(int i=0; i<y; i++) {
		for(int j=0; j<x; j++) cout<<a[i][j]<<" ";
		cout<<endl;
	}
}

template<class T>
inline void init(T& v) {
	for(auto &a__: v) cin>>a__;
}
template<class T, class N>
inline void init(T& v, N n) {
	v.resize(n);
	for(auto &a__: v) cin>>a__;
}

template<class N> void resiz(N n) {} // empty
template<class N, class T, class... U>
void resiz(N n, T&& hd, U&&... tl) {
	hd.resize(n);
	resiz(n,forward<U>(tl)...);
}

ll GCD(ll a, ll b) { //最大公約数
	if(a==0||b==0) return 0;
	if(a<b) swap(a,b);
	ll tmp = a%b;
	while(tmp!=0) {
		a = b;
		b = tmp;
		tmp = a%b;
	}
	return b;
}

ll binpow(ll a, ll ex, ll p) { //繰り返し二乗法
	ll result=1;
	while(ex>0) {
		if(ex&1) result=result*a%p;
		ex>>=1;
		a=a*a%p;
	}
	return result;
}

ll Fact(ll x, ll p) { //階乗
	ll f=1;
	for(ll i=2; i<=x; i++) {
		f*=i;
		f%=p;
	}
	return f;
}

int DigitNum(ll n) { //桁数
	int digit=0;
	ll div=1LL;
	while(n/div) {
		digit++;
		div*=10;
	}
	return digit;
}


ll A,V,B,W,T;

void input() {
	cin>>A>>V>>B>>W>>T;
}

void solve() {
	if(A>B) swap(A,B);
	if(B-A <= (V-W)*T) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}

int main() {
	while(1) {
		input();
		solve();
		break;
	}
}


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

int main() {
  int h, w, a, b;
  cin >> h >> w >> a >> b;
  for(int i = 0; i < h; i++) {
    for(int j = 0; j < w; j++) {
      if(j<a ^ i>=b) printf("0");
      else printf("1");
    }
    printf("\n");
  }
  
  return 0;
}

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

using namespace std;

int a, b, c, d;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> a >> b >> c >> d;
    int ok = 1;
    while (c > 0 && a > 0)
    {
        ok ? c -= b : a -= d;
        ok = !ok;
    }
    cout << (a > 0 ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>

using namespace std;
typedef long long ll;

int main() {
  int N;
  cin >> N;
  vector<vector<int> > A(N, vector<int>(N - 1));
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < N - 1; ++j) {
      int val;
      cin >> val;
      A[i][j] = val - 1;
    }
  }

  vector<int> x(N, 0);
  vector<bool> done(N, false);
  int ndone = 0;
  vector<int> is;
  for (int i = 0; i < N; ++i) {
    is.push_back(i);
  }
  vector<int> nis;
  
  int day = 1;
  while (true) {
    vector<bool> matched(N, false);
    int nmatched = 0;
    for (auto i : is) {
      if (done[i] or matched[i]) continue;
      int j = A[i][x[i]];
      if (done[j] or matched[j]) continue;
      if (A[j][x[j]] == i) {
	x[i]++;
	x[j]++;
	matched[i] = true;
	matched[j] = true;
	nmatched++;
	if (x[i] == N - 1) {done[i] = true; ++ndone;}
	if (x[j] == N - 1) {done[j] = true; ++ndone;}
	nis.push_back(i);
	nis.push_back(j);
      }
    }
    if (nmatched == 0) {
      cout << -1 << endl;
      return 0;
    }
    if (ndone == N) {
      break;
    }
    swap(is, nis);
    nis.clear();
    ++day;
  }

  cout << day << endl;
  return 0;
}


Measured memory_bytes: 4224
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
 
using namespace std;

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

void bfs( vector< vector<int> > &v , int x , vector<int> &vis , vector<int> &dist , vector<int> &pred)
{
    queue<int> q;
    q.push(x);
    vis[x] = 1;

    while( !q.empty() )
    {
        int p = q.front();
        q.pop();

        rep(i,0,v[p].size())
        {
            if ( vis[v[p][i]] == 0 )
            {
                dist[v[p][i]] = dist[p] + 1;
                pred[v[p][i]] = p;
                vis[v[p][i]] = 1;
                q.push(v[p][i]);
            }
        }
    }
}

//START OF CODE ->->->->->->->

void solve()
{
    int n,m;
    cin>>n>>m;

    vector< vector<int> > v(n+1);

    rep(i,0,m)
    {
        int a,b;
        cin>>a>>b;

        v[a].pb(b);
        v[b].pb(a);
    }

    vector<int> vis(n+1,0);
    vector<int> dist(n+1,mod);

    dist[1] = 0;
    vector<int> pred(n+1,-1);
    bfs(v,1,vis,dist,pred);
    int found = 0;
    rep(i,2,dist.size())
    {
        if ( dist[i] == mod )
        {
            found = 1;
            break;
        }
    }
    if ( found == 1)
    {
        cout<<"No"<<endl;
    }
    else
    {
        cout<<"Yes"<<endl;
        rep(i,2,dist.size())
        {
            int l = i;
            // cout<<dist[i]<<endl;
            vector<int> path;
            while( pred[l] != -1 )
            {
                path.pb(pred[l]);
                l = pred[l];
                break;
            }

            cout<<path[0]<<endl;
        }
    }
    
}

//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 14384
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    def size(self, x):
        return -self.parents[self.find(x)]
    def same(self, x, y):
        return self.find(x) == self.find(y)
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]
    def group_count(self):
        return len(self.roots())

N = int(input())
B = [list(map(int,input().split())) for _ in range(N)]

ans = 10**10

for i in range(N):
    for j in range(N):

        if i==j:
            continue

        p = B[i][0]-B[j][0]
        q = B[i][1]-B[j][1]
        uf = UnionFind(N)

        for k in range(N):
            for l in range(N):

                if k==l:
                    continue

                if B[k][0]-B[l][0] == p and B[k][1]-B[l][1] == q:
                    uf.union(k,l)

        ans = min(ans,uf.group_count())

print(ans if N != 1 else 1)

Measured memory_bytes: 3064
#include <stdio.h>

int N[50];

int fib(int n){
  if(n==0)return N[n]=1;
  if(n==1)return N[n]=1;
  if(N[n]!=-1)return N[n]; 
  return N[n]=fib(n-1)+fib(n-2);
}

int main(){
  int n,i;

  for(i=0;i<50;i++)N[i]=-1;

  scanf("%d",&n);

  printf("%d\n",fib(n));

  return 0;
  

}



Measured memory_bytes: 2104
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;


int main() {
	int N;
	cin >> N;
	int A[N+5];
	int A_sort[N+5];
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		A_sort[i] = A[i];
	}
	sort(A_sort, A_sort + N);
	for (int i = 0; i < N; i++) {
		int ret;
		if (A[i] == A_sort[N-1]) ret = A_sort[N-2];
		else ret = A_sort[N-1];
		cout << ret << endl;
	}
}

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

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)

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

  long long m=n;

  FOR(i,1,sqrt(n)){
    if(n%i==0){
      long long a=i;
      long long b=n/i;
      m=min(m,a-1+b-1);
    }
  }

  ANS(m);

  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 reps(i, m, n) for (int i = m; i <= n; ++i)

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

i64 dp[100010];

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

  int n, m;
  cin >> n >> m;

  vector<bool> isOK(n+1, true);
  rep(i, m) {
    int a;
    cin >> a;
    isOK[a] = false;
  }

  dp[0] = 1;
  for (int now = 0; now < n; ++now) {
    for (int next = now + 1; next <= min(n, now + 2); ++next) {
      if (isOK[next]) {
        dp[next] += dp[now];
        dp[next] %= MOD;
      }
    }
  }

  cout << dp[n] << "\n";

  return 0;
}

Measured memory_bytes: 1024
N=int(input())
L1=[]
L2=[]
L3=[]
for i in range(N):
    x,y=map(int,input().split())
    L1.append(x+y)
    L2.append(x-y)
    L3.append(y-x)
L1.sort()
L2.sort()
L3.sort()

M1=L1[-1]-L1[0]
M2=L2[-1]-L2[0]
M3=L3[-1]-L3[0]
print(max(M1,M2,M3))

Measured memory_bytes: 113612
use proconio::input;
use std::cmp;

fn main() {
    input! {
        n: usize,
        pair: [(isize, isize); n],
    }
    let p: Vec<(isize, isize)> = pair.iter().map(|a| (a.0-a.1, a.0+a.1)).collect();
    let mut left: Vec<isize> = p.iter().map(|a| a.0).collect();
    let mut right: Vec<isize> = p.iter().map(|a| a.1).collect();
    left.sort();
    right.sort();
    let ans = cmp::max(left[left.len()-1]-left[0], right[right.len()-1]-right[0]);
    println!("{}", ans); 
    
}


Measured memory_bytes: 16000
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;

int main()
{
  int N, ans = 0;
  vector<int> Xi;

  cin >> N;
  for (int i = 0; i < N; i++)
  {
    int tmpX;
    cin >> tmpX;
    Xi.push_back(tmpX);
  }
  std::sort(Xi.begin(), Xi.end());
  int min;
  for (int p = Xi[0]; p < Xi[N - 1]; p++)
  {
    int sum = 0;
    for (int i = 0; i < N; i++)
    {
      sum += (Xi[i] - p) * (Xi[i] - p);
    }
    if (p == Xi[0])
      min = sum;
    if (sum < min)
    {
      min = sum;
    }
  }
  ans = min;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
string s;
int main() { 
    //freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin>>s;
	s+='&';
	for(int i=0;i<s.size()-1;i++){
		if(s[i]!='h'){
			cout<<"No"<<endl;
			return 0;
		}
		else{
			if(s[i+1]!='i'){
				cout<<"No"<<endl;
				return 0;
			}
			i++;
		}
	}
	cout<<"Yes"<<endl;
    return 0; 
}/*
*/

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int a,b,c,d;
    scanf("%d %d %d",&a,&b,&c);
    d=b/a;
    if (c>d) 
    printf("%d\n",d);
    else if(c<d)
    printf("%d\n",c); 
    else if(c=d)
    printf("%d\n",c);
    return 0;
}



Measured memory_bytes: 128
n,a,b=(int(x) for x in input().split())
c=0
d=[]
def sual(N,A,B):
  l=list('{}'.format(N))
  for y in range(len(l)):
      d.append(int(l[y]))
  e=sum(d)
  d.clear()
  if A<=e<=B:
    return True
  else:
    return False

for x in range(n):
  if sual(x+1,a,b):
    c=c+x+1
print(c)


Measured memory_bytes: 8896
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const int MOD = 1000000007;

void print(const std::vector<int>& v)
{
  std::for_each(v.begin(), v.end(), [](int x) {
    std::cout << x << " ";
  });
  std::cout << std::endl;
}

int main(){
    int N,M;
    cin>>N>>M;
    vector<int> a(M);
    vector<int> b(M);
    map<int,vector<int>> path;
    REP(i,M){
        cin>>a[i]>>b[i];
        a[i]--;b[i]--;
        path[a[i]].push_back(b[i]);
        path[b[i]].push_back(a[i]);
    }
    vector<int> vertex;
    REP(i,N)vertex.push_back(i);//頂点番号の並び
    ll cnt = 0;

    do{
        //print(vertex);
        REP(i,N-1){
            if(find(path[vertex[i]].begin(),path[vertex[i]].end(),vertex[i+1]) == path[vertex[i]].end()){
                // not connected
                break;
            }
            if(i==N-2){
                cnt++;
            }
        }
    }while(next_permutation(vertex.begin()+1,vertex.end()));
    cout<<cnt<<endl;
}

Measured memory_bytes: 384
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		double a=scan.nextInt();
		double b=scan.nextInt();
		//int c=scan.nextInt();
		double ans=a/b;
		System.out.println(ans);
		}
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ll long long
#define P pair<int,int>
#define fast_io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const int MOD = 1000000007;
const int INF = 2002002002;
const ll LLINF = 9009009009009009009;
using namespace std;

int main() {
    fast_io
    string n;
    cin >> n;
    rep(i,3) {
        if (n[i] == '7') {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3624
from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
A.sort()
ans = []
p = A[0]
q = A[-1]
for i in A[1:-1]:
    if i < 0:
        ans.append((q,i))
        q -= i
    else:
        ans.append((p,i))
        p -= i
ans.append((q,p))
print(q-p)
for i,j in ans:
    print(i,j)

Measured memory_bytes: 20544
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define in insert
#define mp make_pair
#define F first
#define pb push_back
#define pf push_front
#define speed ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test ll t; cin>>t; while(t--)
ll exp(ll x,ll y,ll p){ ll res=1; while(y) {if(y%2) res=(res*x%p)%p; x=(x*x)%p; y/=2; } return res;}
ll exp(ll x,ll y){ ll res=1; while(y) {if(y%2) res=(res*x); x=(x*x); y/=2; } return res;}
int main(){
    string s,t; cin>>s>>t;
    ll a,b; cin>>a>>b;
    string u; cin>>u;
    if(s==u)
        a--;
    else b--;
    cout<<a<<" "<<b;
    
    return 0;
}


Measured memory_bytes: 256
import sys

MAX = 2500000
prime = [-1] * MAX
i = 2
while MAX > i:
	if prime[i - 1] == -1:
		prime[i - 1] = 0
		temp = i * 2
		while temp < MAX:
			prime[temp - 1] = 1
			temp += i
	if i == 2:
		i += 1
	else:
		i += 2

while True:
    n = int(sys.stdin.readline())
    
    if n == 0:
        break

    count = 0
    for i in xrange(n + 1,  2 * n + 1):
        if prime[i - 1] == 0:
            count += 1
    print count

Measured memory_bytes: 23764
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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 S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll N, A;
ll x[100];
ll dp[60][6000];
ll base = 3000;

int main()
{
  std::cin >> N >> A;

  rep( i, N ) {
    std::cin >> x[i];

    x[i] -= A;
  }

  dp[0][base] = 1;

  rep( i, N ) rep( j, 6000 ) {
    dp[i+1][j] += dp[i][j];
    dp[i+1][j+x[i]] += dp[i][j];
  }

  std::cout << dp[N][base]-1 << std::endl;

  return 0;
}

Measured memory_bytes: 2560
N=int(input())
ans=N
for i in range(N+1):
    cnt=0
    t=i
    while t>0:
        cnt+=t%6
        t//=6
    j=N-i
    while j>0:
        cnt+=j%9
        j//=9
    ans = min(ans,cnt)
print(ans)

Measured memory_bytes: 70916
# coding:utf-8

import sys
from collections import Counter, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


n, m = LI()
YP = [[y, p] for p, y in (LI() for _ in range(m))]

YP2 = sorted(YP)

P = defaultdict(int)
ans = {}
for y, p in YP2:
    P[p] += 1
    l1, l2 = len(str(p)), len(str(P[p]))
    id = (6 - l1) * '0' + str(p) + (6 - l2) * '0' + str(P[p])
    ans[y] = id

for y, p in YP:
    print(ans[y])


Measured memory_bytes: 42692
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <string>
#include <sstream>
#include <cstdio>
#include <cstring>
#include<cctype>
#define INF 0x3f3f3f3f
#define lb long double
#define LINF 0x3f3f3f3f3f3f3f3f
#define ull unsigned long long
#define random(x) (rand()%x)
#define rep(i, a, b) for(int i=a;i<b;i++)
#define req(j, a, b) for(int j=a;j<b;j++)
#define mem(a, b) memset(a, b, sizeof(a))
#define PI 3.14
#define K 20

using namespace std;
typedef long long ll;
const int maxn = 1e6+5;
const double eps = 1e-14;
const double pi = acos(-1);
const ll mod = 1e9 + 7;
const int hash_mod = 19260817;

inline int read()
{
    int X=0,w=0; char ch=0;
    while(!isdigit(ch)) {w|=ch=='-';ch=getchar();}
    while(isdigit(ch)) X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
    return w?-X:X;
}

inline double dbread()
{
    double X=0,Y=1.0; int w=0; char ch=0;
    while(!isdigit(ch)) {w|=ch=='-';ch=getchar();}
    while(isdigit(ch)) X=X*10+(ch^48),ch=getchar();
    ch=getchar();//读入小数点
    while(isdigit(ch)) X+=(Y/=10)*(ch^48),ch=getchar();
    return w?-X:X;
}

inline void write(int x)
{
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
}

int v[1005];
double w[1005];
int dp[1005][1005];

int sum = 0;

int main()
{
    int a;
    int b;
    cin >> a;
    cin >> b;
    if(a == 1 && b == 2)
        cout << 3 << endl;
    else if(a == 2 && b == 1)
        cout << 3 << endl;
    else if(a == 1 && b == 3)
        cout << 2 << endl;
    else if(a == 3 && b == 1)
        cout << 2 << endl;
    else if(a == 2 && b == 3)
        cout << 1 << endl;
    else if(a == 3 && b == 2)
        cout << 1 << endl;
    return 0;
}


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

int main() {
	long long N;
	cin >> N;
	vector<int> V;
	for (long long X = 2; X * X <= N; X++) {
		if (N % X == 0) {
			int COUNT = 0;
			while (N % X == 0) {
				COUNT++;
				N /= X;
			}
			V.push_back(COUNT);
		}
	}
	if (N != 1) V.push_back(1);
	int ANS = 0;
	for (int X : V) {
		for (long long i = 1; ; i++) {
			if (i * (i + 1) / 2 > X) {
				ANS += i - 1;
				break;
			}
		}
	}
	cout << ANS << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <iostream>
#include <ctime>
using namespace std;
#define _LL long long
#define rep(i, n) for (_LL i = 0; i < (_LL)(n); i++)
#define vecrep(itr, v) for (auto itr = (v).begin(); itr != (v).end(); itr++)

int main()
{
    int n; cin >> n;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    int total = 0;
    int current = 0;
    rep(i, n - 1)
    {
        if( h[i + 1] <= h[i] )
        {
            current++;
            total = max(total, current);
        }
        else
        {
            current = 0;
        }
    }
    cout << total << endl;
    return 0;    
}

Measured memory_bytes: 3784
fun solve(n:Int, s:String){
    var ans = ""
    if(n%2 == 1){
        ans = "No"
    }
    else{
        val a = s.substring(0,s.length/2)
        val b = s.substring(s.length/2)
        if(a == b){
            ans = "Yes"
        }
        else{
            ans = "No"
        }
    }

    println(ans)
}

fun main(){
    val n = readLine()!!.toInt()
    val s = readLine()!!
    solve(n,s)
}

Measured memory_bytes: 34600
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#define maxn 100010
#define mod 1000000007
using namespace std;
int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch-'0'<0||ch-'0'>9){if(ch=='-') f=-1;ch=getchar();}
    while(ch-'0'>=0&&ch-'0'<=9){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n;
int a[maxn],deg[maxn],vis[maxn],cir[maxn],len[maxn],sum[maxn];
int ans=1;
void work(int x)
{
    int now=0,fr=0,ed=0,l=0;
    while(cir[x])
    {
        ++now;cir[x]=0;
        if(len[x])
        {
            if(!fr)  fr=ed=now,l=len[x];
            else{
                ans=1ll*ans*((len[x]<now-ed)+(len[x]<=now-ed))%mod;
                ed=now;
            }
        }
        x=a[x];
    }
    if(!fr)  sum[now]++;
    else{
        ans=1ll*ans*((l<now-ed+fr)+(l<=now-ed+fr))%mod;
    }
}
int f[maxn];
void solve()
{
    for(int i=1;i<=n;i++)
    {
        if(deg[i])  continue;
        int x=i,l=0;
        while(!cir[x])
        {
            x=a[x];
            l++;
        }
        len[x]=l;
    }
    for(int i=1;i<=n;i++)  if(cir[i])  work(i);
    for(int i=1;i<=n;i++)
    {
        if(!sum[i])  continue;
        f[0]=1;
        for(int j=1;j<=sum[i];j++)
        {
            if(i>1&&(i&1))  f[j]=(f[j-1]+f[j-1])%mod;
            else            f[j]=f[j-1];
            if(j>1)  f[j]=(f[j]+1ll*f[j-2]*(j-1)%mod*i%mod)%mod;
        }
        ans=1ll*ans*f[sum[i]]%mod;
    }
}
int main()
{
    n=read();
    for(int i=1;i<=n;i++)  a[i]=read(),deg[a[i]]++;
    for(int i=1;i<=n;i++)
    {
        if(vis[i])  continue;
        int x=i;
        while(!vis[x])  vis[x]=i,x=a[x];
        if(vis[x]!=i)  continue;
        while(!cir[x])  cir[x]=1,x=a[x];
    }
    for(int i=1;i<=n;i++)
    {
        if((cir[i]&&deg[i]>2)||(!cir[i]&&deg[i]>1))
        {
            puts("0");
            return 0;
        }
    }
    solve();
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 2176
N = int(raw_input())

digit = len(str(N))

ans  = 0
num = [9, 0, 900, 0, 90000]
if digit%2 == 1:
    ans += sum(num[:digit-1])
    ans += N - 10 ** (digit-1) + 1
else:
    ans += sum(num[:digit-1])

print ans

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

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    string s;
    cin >> s;

    for (char i = 'a'; i <= 'z'; i++)
    {
        bool b = false;
        REP(j, s.size())
        if (s[j] == i)
        {
            b = true;
            break;
        }

        if (!b)
        {
            cout << i << endl;
            return 0;
        }
    }

    cout << "None" << endl;

    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int main(){
int h,m,s;
do{
scanf("%d",&s);
}while(s<0 || s>86400);
h=s/3600;
m=(s%3600)/60;
s=s%60;
printf("%d:%d:%d\n",h,m,s);
return 0;
}

Measured memory_bytes: 592
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop

BIG_NUM = 2000000000
HUGE_NUM = 9999999999999999
MOD = 1000000007
EPS = 0.000000001


global H,W
global num_diff
global diff_row,diff_col

def rangeCheck(row,col):
    if row >= 0 and row <= H-1 and col >= 0 and col <= W-1:
        return True
    else:
        return False

#table[row][col]にあるQueenの経路を塗る
def paint(table,row,col):

    table[row][col] = 'Q'

    for i in range(num_diff):

        tmp_row = row+diff_row[i]
        tmp_col = col+diff_col[i]

        while rangeCheck(tmp_row,tmp_col) == True:

            table[tmp_row][tmp_col] = 'x'

            tmp_row += diff_row[i]
            tmp_col += diff_col[i]


#table[row][col]にQueenを置けるか調べる
def is_ok(table,row,col):

    #未定義マスでなければfalse
    if table[row][col] != '.':
        return  False

    #他のQueenと衝突するか調べる
    for i in range(num_diff):

        tmp_row = row+diff_row[i];
        tmp_col = col+diff_col[i];

        while rangeCheck(tmp_row,tmp_col) == True:

            if table[tmp_row][tmp_col] == 'Q':
                return False

            tmp_row += diff_row[i]
            tmp_col += diff_col[i]

    return True


def recursive(base_row,base_col,table,put_num):

    if put_num == 8:

        for row in range(H):
            for col in range(W):

                if table[row][col] == 'Q':

                    print("Q",end = "")
                else:
                    print(".",end = "")
            print()
        return

    #置かないで次へ
    if base_col == 7:
        if base_row == 7:
            return

        recursive(base_row+1,0,table,put_num)

    else:
        recursive(base_row,base_col+1,table,put_num)


    #置けないなら打ち切り
    if is_ok(table,base_row,base_col) == False:
        return

    next_table = [[None]*8 for i in range(8)]

    for row in range(H):
        for col in range(W):
            next_table[row][col] = table[row][col]

    paint(next_table,base_row,base_col)

    if base_col == 7:
        if base_row == 7:
            return
        else:
            recursive(base_row+1,0,next_table,put_num+1)

    else:
        recursive(base_row,base_col+1,next_table,put_num+1)


debug = 0
H = 8
W = 8
num_diff = 8
diff_row = [-1,-1,-1,0,0,1,1,1]
diff_col = [-1,0,1,-1,1,-1,0,1]


N = int(input())
first_table = [['.']*8 for i in range(8)]

for loop in range(N):
    row,col = map(int,input().split())
    paint(first_table,row,col)

recursive(0,0,first_table,N)


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

#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define FORV(a, A) for (auto &a : A)

using namespace std;
using ll = long long;
using P = pair<int, int>;

void Main() {
  int n;
  cin >> n;
  vector<int> x(n), y(n);
  rep(i, n) cin >> x[i] >> y[i];
  double ans = 0;
  rep(i, n - 1) REP(j, i + 1, n) {
    ans += sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
  }
  ans /= n;
  cout << ans * 2.0 << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


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

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

using Graph = vector<vector<int>>;

ll calc(ll a, ll b, ll p){//aのb乗をpで割った余り
  if(b == 0) return 1;

  else if(b%2 == 0){
    ll d = calc(a,b/2,p);
    return (d*d)%p;
  }
  else if(b%2 == 1){
    return (a * calc(a,b-1,p))%p;
  }
}

typedef pair<int,int> P;

bool is_prime(int n){//nが素数であるかどうか判定 iで割り切れると素数でない
    if(n == 1) return false;//1は例外
    for(int i = 2;i*i <= n;i++){
        if(n%i == 0) return false;
    }
    
    return true;
}
int factorial(int a){
  int res = 1;
  while(a){
    res *= a;
    a--;
  }
  return res;
}

int main(){
  int N;
  cin >> N;
  if(N%2){
    
    cout << fixed << setprecision(10);
    cout << (double)(N/2 + 1)/N << endl;
  }
  else{
    cout << fixed << setprecision(10);
    cout << (double)(N/2) / N << endl;
  }
 }

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9 + 10;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

int a[MAXN], b[MAXN];

set<pii> st;

void solve(){
	int n;
	scanf("%d", &n);
	REP(i, 0, n) {
		scanf("%d", &a[i]);
	}
	REP(i, 0, n) {
		scanf("%d", &b[i]);
		if (b[i] < a[i]) {
			printf("-1\n");
			return;
		}
		if (b[i] > a[i]) {
			st.insert(mp(-b[i], i));
		}
	}
	ll ans = 0;
	while(!st.empty()) {
		int ind = st.begin()->_2;
		st.erase(st.begin());
		int d = (b[(ind + 1) % n] + b[(ind - 1 + n) % n]);
		int cnt = max(1, (b[ind] - a[ind]) / d);
		ans += cnt;
		b[ind] -= cnt * d;
		if (b[ind] < a[ind]) {
			printf("-1\n");
			return;
		}
		if (b[ind] > a[ind]) {
			st.insert(mp(-b[ind], ind));
		}
	}
	printf("%lld\n", ans);
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


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

using namespace std;
using ll = long long;

ll ans, n, x, a[100000];

int main(){
	cin >> n >> x;
	for(int i = 0; i < n; ++i) cin >> a[i];
	
	for(int i = 0; i < n - 1; ++i){
		if(i == 0){
			if(a[i] + a[i+1] > x){
				ll c = a[i]+a[i+1]-x;
				ans += min(a[i+1], c);
				a[i+1] -= min(a[i+1], c);
				if(a[i] + a[i+1] > x){
					c = a[i]+a[i+1]-x;
					ans += min(a[i], c);
					a[i] -= min(a[i], c);
				}
			}
		}else{
			if(a[i] + a[i+1] > x){
				ans += a[i]+a[i+1]-x;
				a[i+1] -= a[i]+a[i+1]-x;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n,m;cin>>n>>m;
	vector<ll> ca[3];
	FOR(i,0,3)ca[i].resize(n);
	FOR(i,0,n)FOR(j,0,3)cin>>ca[j][i];
	ll ans=0;
	FOR(i,0,8){
		priority_queue<ll> q;
		FOR(j,0,n){
			ll k=0;
			FOR(r,0,3){if(i&1<<r)k+=ca[r][j];else k-=ca[r][j];}
			q.push(k);
		}
		ll ansp=0;
		FOR(j,0,m){
			ansp += q.top();
			q.pop();
		}
		ans=max(ans,ansp);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#from bisect import insort_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
#import heapq
#import numpy as np
#INF = float("inf")
N = int(input())
A = list(map(int,input().split()))
li = [[] for _ in range(N)]
for i in range(N):
    a = A[i]
    if i-a>0:
        li[i-a].append(i)
    if i+a<N:
        li[i+a].append(i)
s = 0
for j in range(N):
    q = li[j]
    n = len(q)
    if n < 2:
        continue
    smal = 0
    big = 0
    for k in q:
        if k < j:
            smal += 1
        else:
            big += 1
    s += smal*big
print(s)

Measured memory_bytes: 108132
#include <bits/stdc++.h>
#define ll long long
#define str string
#define sonic ios_base::sync_with_stdio(0)
using namespace std;
int main(){
	sonic;
	ll n,a;
	cin>>n;
	ll b[n];
	for(ll i=1;i<=n;i++){
		cin>>a;
		b[a]=i;
	}
	for(ll i=1;i<=n;i++)
		cout<<b[i]<<" ";
}

Measured memory_bytes: 1664
#!/usr/bin/env python3
import sys
from math import gcd
from functools import reduce

def f(A):
    ret = [A[0]]
    for a in A:
        ret.append(gcd(ret[-1], a))
    ret[0] = reduce(gcd, A[1:])
    return ret

def solve(N: int, A: "List[int]"):    
    return  max(gcd(g0, g1) for g0, g1 in zip(f(A), f(A[::-1])[-2::-1]))

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, A))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()


Measured memory_bytes: 30932
import java.util.Scanner;

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

	int[] g1 = {1,3,5,7,8,10,12};
	int[] g2 = {4,6,9,11};
	int[] g3 = {2};

	int x = scan.nextInt();
	int y = scan.nextInt();

	int xg = 0;
	int yg = 0;
	for(int i = 0; i < g1.length; i++){
	    if(g1[i] == x){
		xg = 1;
	    }
	    if(g1[i] == y){
		yg = 1;
	    }
	}
	for(int i = 0; i < g2.length; i++){
	    if(g2[i] == x){
		xg = 2;
	    }
	    if(g2[i] == y){
		yg = 2;
	    }
	}
	for(int i = 0; i < g3.length; i++){
	    if(g3[i] == x){
		xg = 3;
	    }
	    if(g3[i] == y){
		yg = 3;
	    }
	}

	if(xg == yg){
	    System.out.println("Yes");
	}else{
	    System.out.println("No");
	}
    }
}


Measured memory_bytes: 21844
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
from itertools import permutations,groupby
import sys
import bisect
import string
alp=string.ascii_lowercase
sys.setrecursionlimit(10**6)
def SI():
    return input().split()
def MI():
    return map(int,input().split())
def I():
    return int(input())
def LI():
    return [int(i) for i in input().split()]
YN=['Yes','No']
mo=10**9+7
#mo=998244353
#input=sys.stdin.readline

M,D=MI()

ans=0


for m in range(1,M+1):
    for d in range(22,D+1):
        d1=d%10
        d10=(d-d%10)//10
        if d1<=1:
            continue
        if m==d10*d1:
            ans+=1
        #print(m,d1,d10,d10*d1)
    
print(ans)

Measured memory_bytes: 39920
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef pair<int, int> P;

const long double EPS = 1e-10;
const long long INF = 1e18;
const int MOD = (int)1e9 + 7;
const long double PI = acos(-1.0L);

int main() {
  list<char> S;
  string s;
  cin >> s;
  rep(i, s.size()) S.push_back(s[i]);
  int q;
  cin >> q;
  bool seq = true;
  rep(i, q) {
    int op;
    cin >> op;
    if (op == 1) {
      seq = !seq;
    } else {
      int func;
      char c;
      cin >> func >> c;
      if (func == 1) {
        if (seq) {
          S.push_front(c);
        } else {
          S.push_back(c);
        }
      } else {
        if (seq) {
          S.push_back(c);
        } else {
          S.push_front(c);
        }
      }
    }
  }
  if (!seq) S.reverse();
  for (char c : S) cout << c;
  cout << endl;

  return 0;
}

Measured memory_bytes: 13000
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,x,max;
    scanf("%d %d",&a,&b);
    max=a+b;
    x=a-b;
    if(x>max)
        max=x;
    x=a*b;
    if(x>max)
        max=x;
    printf("%d",max);
    return 0;
}


Measured memory_bytes: 128
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan()
	A, err := strconv.Atoi(scanner.Text())
	if err != nil {
		log.Fatal(err)
	}

	scanner.Scan()
	B, err := strconv.Atoi(scanner.Text())
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(6 - A - B)

}


Measured memory_bytes: 1836
"""
    こんにちは。これはクシャルです
    
    Author : thekushalghosh (クシャル)
    Team   : CodeDiggers
 
    I prefer Python language over the C++ language :p :D
        
    Visit my website : thekushalghosh.github.io
"""
import sys,math,cmath,time
start_time = time.time()
##########################################################################
################# ---- THE ACTUAL CODE STARTS BELOW ---- #################
    
def solve():
    n = inp()
    s = insr()
    q = s.count("R")
    print(q - s[:q].count("R"))
    
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
 
def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
        sys.stdout.close()
    
#---------------------- USER DEFINED INPUT FUNCTIONS ----------------------#
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    return(input().strip())
def invr():
    return(map(int,input().split()))
 
#------------------ USER DEFINED PROGRAMMING FUNCTIONS ------------------#
def counter(a):
    q = [0] * max(a)
    for i in range(len(a)):
        q[a[i] - 1] = q[a[i] - 1] + 1
    return(q)

def counter_elements(a):
    q = dict()
    for i in range(len(a)):
        if a[i] not in q:
            q[a[i]] = 0
        q[a[i]] = q[a[i]] + 1
    return(q)

def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97],1
    return(q)
 
def factors(n):
    q = []
    for i in range(1,int(n ** 0.5) + 1):
        if n % i == 0: q.append(i); q.append(n // i)
    return(list(sorted(list(set(q)))))
 
def prime_factors(n):
    q = []
    while n % 2 == 0: q.append(2); n = n // 2
    for i in range(3,int(n ** 0.5) + 1,2):
        while n % i == 0: q.append(i); n = n // i
    if n > 2: q.append(n)
    return(list(sorted(q)))

def transpose(a):
    n,m = len(a),len(a[0])
    b = [[0] * n for i in range(m)]
    for i in range(m): 
        for j in range(n): 
            b[i][j] = a[j][i]
    return(b)

#-----------------------------------------------------------------------#
        
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
    input = sys.stdin.readline
main()

Measured memory_bytes: 64252
#include "bits/stdc++.h"
using namespace std;

using ll = long long int;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()


bool my_cp(pair<int, int> a, pair<int, int> b){
  return (double)b.first / (double)(b.second+1) < (double)a.first / (double)(a.second+1);
}

ll cnt_rep = 0;
ll powmod(ll N, ll P, ll M){
  cnt_rep++;
  if(P == 0) return 1;
  if(P%2 == 0){
    ll t = powmod(N, P/2, M);
    return t*t % M;
  }
  return (N * powmod(N, P-1, M)) % M;
}

int N;

void dfs(string s, char m, int N){

  if(s.length() == N){
    cout << s << endl;
  }else{
    for(char c = 'a'; c <= m; c++){
      dfs(s + c, ((c == m)? (m + 1) : m), N);
    }
  }
}





// substr(start, len)

int main(){

  int N, M, ans;
  cin >> N >> M;


  ans = (N-1)*N/2 + (M-1)*M/2;

  cout << ans << endl;
  
// CHECK if it's possible to overflow!!
}

Measured memory_bytes: 256