akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include <cassert>
    #include <cmath>

    #define INF 1e9
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))

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

    int main(){
      int n;cin>>n;
      auto a = vec(int,n+1);
      REP(i,1,n)cin>>a[i];
      auto b = vec(int,n+1);
      int i = n;
      int sum = 0;
      while(i){
          if(n<2*i)b[i] = a[i];
          else if(n>=2*i && i>1){
              int memo = 0,j = 2;
              while(n>=i*j){
                  memo += b[i*j];
                  j++;
              }
              b[i] = (memo+a[i])%2;
          }
          else b[1] = (a[1]+sum)%2;
          sum += b[i];
          i--;
      }
      cout<<sum<<endl;
      REP(i,1,n)if(b[i])cout<<i<<" ";
    }
    


Measured memory_bytes: 2432
open System
#nowarn "25"

let inline readLine typeOperator = stdin.ReadLine() |> typeOperator
let inline readArray typeOperator = stdin.ReadLine().Split ' ' |> Array.map typeOperator
let modval = 1000000007

let S = readLine
printfn "%s" (if stdin.ReadLine() = "ABC" then "ARC" else "ABC")


Measured memory_bytes: 29480
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

ll		n , cnt;
double 	ans = 0;
vector<vector<double>>	disp(8 , vector<double>(8));

double calc(string s) {
	double ret = 0;
	for(int i=1;i<s.size();i++) {
		ret += disp[s[i-1]-'0'][s[i]-'0'];
	}
	return ret;
}
void makejyunro(ll zan , string s) {
	//cout << "makejyunro "<< zan << " " << s << endl;
	if (zan==0) {
		//cout << s << " " << calc(s) << endl;
		ans += calc(s);
		cnt++;
		return;
	}
	ll bit = 0;
	for(int i=0;i<s.size();i++) {
		bit |= 1 << (s[i]-'0');
	}
	for(int i=0;i<n;i++) {
		if ( (bit & (1<<i)) == 0) {
			char c = i+'0';
			makejyunro(zan-1,s+c);
		}
	}
}
int main() {
	ll		a,b,c,h,i,j,k,l,m,x,y;
	string	s;
	cin >> n;
	vector<ll>	xx(n),yy(n);
	for(i=0;i<n;i++) cin >> xx[i] >> yy[i];
	for(i=0;i<n;i++) {
		xx[i] += 1000;
		yy[i] += 1000;
	}

	for(i=0;i<n;i++) for(j=0;j<n;j++) {
		if (i==j) continue;
		disp[i][j] = sqrt( (xx[i]-xx[j])*(xx[i]-xx[j]) + (yy[i]-yy[j])*(yy[i]-yy[j]) );
	}

	makejyunro(n , s);

	printf("%.10f\n", ans/cnt);
	//cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> ii;
typedef pair<ll, ll> pli;
typedef pair<ll, ll> pll;
typedef long double ld;

#define FOR(i, a, b) for (ll i = (a), _b = (b); i <= _b; i++)
#define FORD(i, b, a) for (ll i = (b), _a = (a); i >= _a; i--)
#define REP(i, n) for (ll i = 0, _n = (n); i < _n; i++)
#define FORE(i, v) for (__typeof((v).begin()) i = (v).begin(); i != (v).end(); i++)
#define fi   first
#define se   second
#define all(a) a.begin(), a.end()
#define MASK(i) (1LL << (i))
#define BIT(x, i) (((x) >> (i)) & 1)
#define endl '\n'

const ll N = 3005, MOD = 1e9 + 7, H = 2e5 + 5;
ll dp[N], h, w, fac[H], n;
ii a[N];

void add(ll &a, ll b) {
	a = (a + b) % MOD;
	return;
}

void sub(ll &a, ll b) {
	a = (a - b + MOD) % MOD;
	return;
}

void mult(ll &a, ll b) {
	a = 1LL * a * b % MOD;
	return;
}

ll mul(ll a, ll b) {
	return 1LL * a * b % MOD;
}

ll modPow(ll a, ll x) {
	ll res = 1;
	while (x) {
		if (x & 1) mult(res, a);
		mult(a, a);
		x >>= 1;
	}
	return res;
}

ll inv(ll a) {
	return modPow(a, MOD - 2);
}

ll C(ll k, ll n) {
	if (k > n) return 0;
	ll ret = fac[n];
	mult(ret, inv(mul(fac[n - k], fac[k])));
	return ret;
}

int main(int argc, char const *argv[])
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	clock_t tStart = clock();

	cin >> h >> w >> n;
	FOR(i, 1, n) cin >> a[i].first >> a[i].second;
	fac[0] = 1;
	FOR(i, 1, H - 3) {
		fac[i] = fac[i - 1];
		mult(fac[i], i);
	}

	sort(a + 1, a + 1 + n);
	FOR(i, 1, n) {
		dp[i] = C(a[i].first - 1, a[i].second + a[i].first - 2);
		FOR(j, 1, i - 1) if (a[j].second <= a[i].second)
			sub(dp[i], mul(dp[j], C(a[i].first - a[j].first, a[i].first + a[i].second - a[j].first - a[j].second)));
	}

	ll res = C(h - 1, h + w - 2);
	FOR(i, 1, n) sub(res, mul(dp[i], C(h - a[i].first, h + w - a[i].first - a[i].second)));
	cout << res << endl;

	fprintf(stderr, "Time taken: %.2fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
	return 0;
}


Measured memory_bytes: 1920
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

struct Ford_fulkerson {
    struct edge {
        int to, cap, rev;
    };
    int n;
    vector<vector<edge>> graph;
    vector<int> vis;

    Ford_fulkerson(int _n) : n(_n), graph(n), vis(n) {}

    void addEdge(int from, int to, int cap) {
        graph[from].push_back((edge){to, cap, (int)graph[to].size()});
        graph[to].push_back((edge){from, 0, (int)graph[from].size() - 1});
    }
    int dfs(int v, int t, int f) {
        if(v == t)
            return f;
        vis[v] = true;
        for(int i = 0; i < (int)graph[v].size(); i++) {
            edge &e = graph[v][i];
            if(!vis[e.to] && e.cap > 0) {
                int d = dfs(e.to, t, min(f, e.cap));
                if(d > 0) {
                    e.cap -= d;
                    graph[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }

    int maxFlow(int s, int t) {
        int flow = 0;
        for(;;) {
            for(int i = 0; i < n; i++)
                vis[i] = false;
            int f = dfs(s, t, INF);
            if(f == 0)
                return flow;
            flow += f;
        }
    }
};

int main() {
    int N;
    cin >> N;
    vector<pii> red(N), blue(N);
    rep(i, N) {
        int a, b;
        cin >> a >> b;
        red[i] = MP(a, b);
    }
    rep(i, N) {
        int a, b;
        cin >> a >> b;
        blue[i] = MP(a, b);
    }
    Ford_fulkerson matching(2 * N + 2);
    rep(i, N) {
        rep(j, N) {
            if(red[i].first < blue[j].first && red[i].second < blue[j].second) {
                matching.addEdge(i + 2, j + N + 2, 1);
            }
        }
    }
    rep(i, N) { matching.addEdge(0, i + 2, 1); }
    rep(i, N) { matching.addEdge(i + N + 2, 1, 1); }
    cout << matching.maxFlow(0, 1) << endl;
    return 0;
}

Measured memory_bytes: 3688
n, k = map(int, input().split())
a = list(map(int, input().split()))

from collections import Counter
c = Counter(a)
key = []
value = []
for i, j in sorted(c.items(), key=lambda x: x[1]):
  key.append(i)
  value.append(j)

print(sum(value[:(len(key)-k)]))

Measured memory_bytes: 42932
import java.util.Scanner;

public class Main{
	public static void main(String[] args){		
		//データの入力の準備
		Scanner sc = new Scanner(System.in);
		
		while (true){
			int num;
			double sum = 0;
			double ave;
			double bunsan = 0;
			
			num = sc.nextInt();
			
			//終了条件の判定
			if (num == 0){
				break;
			}
		
			//データ格納用配列
			double[] datas = new double[num];
		
			//データの入力
			for (int i = 0; i < num;i++){
				double temp = sc.nextDouble();
				sum += temp;
				datas[i] = temp;
			}
		
			//平均を求める
			ave = sum / num;
		
			//分散を計算
			for (int i = 0; i < num; i++){
				bunsan += Math.pow((datas[i] - ave), 2);
			}
			bunsan /= num;
		
			System.out.printf("%f\n",Math.sqrt(bunsan));
		}
	}
}


Measured memory_bytes: 39552
#include <algorithm>
#include <climits>
#include <iostream>
#include <map>
#include <vector>

using namespace std;

int main() {
  int n, k, h, ans;
  cin >> n >> k;
  ans = 0;
  for (int _ = 0; _ < n; _++) {
    cin >> h;
    if (h >= k) {
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 384
#include<stdio.h>
int main()
{
    int A[3],i,sum=0;
    for(i=0;i<3;i++)
    {
        scanf("%d",&A[i]);
    }
    for(i=0;i<3;i++)
    {
        sum=sum+A[i];
    }
    if(sum>=22)
    {
        printf("bust\n");
    }
    else
    {
        printf("win\n");
    }
}


Measured memory_bytes: 2064
#include<iostream>
using namespace std;
#define NIL -1
struct Node{int parent,left,right;};
struct Node T[41];
int n,P[41],I[41];
int search(int x[],int target,int size){
    for(int i=0;i<size;i++){
        if(x[i]==target) return i;
    }
    return 0;
}
void Postorder(int x){
    if(x!=NIL){
        Postorder(T[x].left);
        Postorder(T[x].right);
        if(x==P[0]) cout<<x;
        else cout<<x<<" ";
    }
}
void saisei(int x[],int p,int size){
    int l=0,r=0,mid=search(x,P[p],size);
    int L[40],R[40];
    
    for(int i=0;i<size;i++){
        if(i<mid){L[l]=x[i];l++;}
        else if(i>mid){R[r]=x[i];r++;}
    }
    if(l!=0){
            T[P[p]].left=P[p+1];
            T[P[p+1]].parent=P[p];
            saisei(L,p+1,l);
    }
    if(r!=0){
            T[P[p]].right=P[p+l+1];
            T[P[p+l+1]].parent=P[p];
            saisei(R,p+l+1,r);
    }
    
}
int main(){
    cin>>n;
    for(int i=0;i<n;i++) cin>>P[i];
    for(int i=0;i<n;i++) {
        cin>>I[i];
        T[i+1].parent=T[i+1].left=T[i+1].right=NIL;
    }
    saisei(I,0,n);
    Postorder(P[0]); cout<<endl;
    return 0;
}


Measured memory_bytes: 3100
#include <cstdio>
#include <algorithm>

const int maxn=1e5+5;
#define int long long
int n,m,v,p,last,a[maxn];

inline bool cmp(int a,int b){
	return a>b;
}

inline int max(int a,int b){
	return a>b?a:b;
}

inline bool check(int x){
	if(x<=p) return true;
	if(a[x]+m<a[p]) return false;
	int now=m*(p-1+n-x+1);
	for(int i=p+1;i<x;i++){
		now+=a[x]+m-a[i];
	}now+=a[x]+m-a[p];
	return now>=m*v;
}

signed main(){
	scanf("%lld%lld%lld%lld",&n,&m,&v,&p);
	for(int i=1;i<=n;i++){scanf("%lld",&a[i]);}
	std::sort(a+1,a+n+1,cmp);
	int l=1,r=n,mid,pos=p;
	while(l<=r){
		mid=(l+r)>>1;
		if(check(mid)){
			l=mid+1;
			pos=mid;
		}else r=mid-1;
	}
	printf("%lld\n",pos);
	return 0;
}

Measured memory_bytes: 2516
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  string weather[4];
  weather[0] = "Sunny";
  weather[1] = "Cloudy";
  weather[2] = "Rainy";
  weather[3] = weather[0];
  cin >> s;
  for(int i = 0; i < 3; i++){
    if(s == weather[i]){
      cout << weather[i+1] << endl;
      continue;
    }
  }
  return 0;
}
  
    
  
  

Measured memory_bytes: 256
n = int(input())
lst = [list(map(int,input().split())) for i in range(n)]
lst.sort(key=lambda x:(x[1],x[0]))
#print(lst)
tsum = 0
out = 0
for i in range(n):
  tsum += lst[i][0]
  if tsum > lst[i][1]:
    out = 1
    break
if out == 0:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 66272
///   Journey to the End of earth   ///
/// Gunjan Kumar ///
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// #include <functional> // for less 
// using namespace __gnu_pbds; 
using namespace std;
#define ll  long long
#define s(n) scanf("%d",&n)
#define ls(n) scanf("%lld",&n)
#define p(n) printf("%d",n)
// #define ln() printf("\n")
#define pln(n) printf("%d\n",n)
#define lpln(n) printf("%lld\n",n)
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rev(i,a,n) for(int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define tc           ll t1; cin>>t1; while(t1--)
#define inp         ll n; cin>>n; ll arr[n]; rep(i,0,n) cin>>arr[i];
#define vect vector<ll>
#define sortv(v)       sort(v.begin(),v.end())
#define lower(v,n)    lower_bound(v.begin(),v.end(),n)-v.begin()
#define upper(v,n)    upper_bound(v.begin(),v.end(),n)-v.begin()
#define bitcount(n) __builtin_popcount(n)
#define ln <<endl
#define inf          LONG_MAX
#define ninf         LONG_MIN
#define fast         ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const   ll mod=1e9+7;
const ll N=1e5+5;



int main()
{

         
         int n;
         cin >> n;
         ll arr[n][3];
         rep(i,0,n)
         rep(j,0,3)
         cin >> arr[i][j];
         ll dp[n][3];
         memset(dp,0,sizeof(dp));
         dp[0][0]=arr[0][0];
         dp[0][1]=arr[0][1];
         dp[0][2]=arr[0][2];
         rep(i,1,n)
         {
           dp[i][0]=max(arr[i][0]+dp[i-1][1],arr[i][0]+dp[i-1][2]);
           dp[i][1]=max(arr[i][1]+dp[i-1][0],arr[i][1]+dp[i-1][2]);
           dp[i][2]=max(arr[i][2]+dp[i-1][1],arr[i][2]+dp[i-1][0]);
         }
         cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
         
     return 0;
}



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

int main()
{
    int n;
    cin>>n;
    int a[n][3],dp[n][3];
    for(int i=0; i<n; i++)
        for(int j=0; j<3; j++)
            cin>>a[i][j];
    memset(dp,0,sizeof(dp));
    dp[0][0]=a[0][0]; dp[0][1]=a[0][1]; dp[0][2]=a[0][2];
    for(int i=1; i<n; i++)
    {
        dp[i][0]=a[i][0]+max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]=a[i][1]+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]=a[i][2]+max(dp[i-1][1],dp[i-1][0]);
    }
    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
    return 0;
}


Measured memory_bytes: 2560
#include <algorithm>
#include <sstream>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <stack>
#include <stdio.h>
#include <string>
#include <queue>
#include <vector>
using namespace std;


stack<int> A;
int y = 0;
int NIL = -1;
int MAX = 80;

vector<int> conv(string s) {
	vector<int> V(MAX, NIL);
	int i;
	for (i = 0; i < s.length(); i++) V[MAX - 1 - i] = s[s.length() - 1 - i] - '0';

	return V;
}

void push(int a, int b) {
	int x = a + b;
	if (y > 0) x += y; y = 0;
	if (x > 9) {
		A.push(x % 10);
		y = 1;
	}
	else {
		A.push(x);
	}
}

int main()
{
	int n;

	string a, b;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a >> b;
		if (a.length() > 80 || b.length() > 80) {
			cout << "overflow" << endl;
			continue;
		}

		A = stack<int>();
		vector<int> V1 = conv(a);
		vector<int> V2 = conv(b);

		for (int i = MAX - 1; i >= 0; i--) {
			if (V1[i] != NIL && V2[i] != NIL) {
				push(V1[i], V2[i]);
			}
			else if (V1[i] == NIL && V2[i] != NIL) {
				push(V2[i], 0);
			}
			else if (V2[i] == NIL && V1[i] != NIL) {
				push(V1[i], 0);
			}
		}

		if (y == 1) {
			A.push(1);
			y = 0;
		}

		if (A.size() > 80) {
			cout << "overflow";
		}
		else {
			while (A.size() != 0) {
				cout << A.top(); A.pop();
			}
		}

		cout << endl;
	}
}


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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())

#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
#define LL long long
#define MOD 1000000007

//cout << (c)?"Yay!":":(" << endl;

// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;
    cout << a * (a - 1) / 2 + b * (b - 1) / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;

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

int main(){
    ll N;
    cin>>N;
    v p(N);
    rep(i,0,N)cin>>p[i];

    sort(all(p));

    ll sum = 0;
    rep(i,0,N-1){
        sum += p[i];
    }
    sum += p[N-1]/2;
    cout<<sum;
    return 0;
}

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

void dump(vector<int> &data, string name) {
  cout << name << "= {";
  for(int i = 0; i<data.size(); i++)
    cout << data[i] << " ";
  cout << "} " << endl;
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n+1);
  vector<int> b(n+1);
  rep(i,n) cin >> a[i+1];
  
  for(int i = n/2+1; i<n+1; i++)
    b[i] = a[i];
  // dump(a,"a");
  // dump(b,"b");
  
  for(int i = n/2; i>0; i--) {
    int cnt = 0;
    for(int j = 2; i*j<n+1; j++){
      cnt += b[i*j];
      // cout << i *j << " = " << a[i*j] << " ";
    }
    if(cnt%2 == a[i])
      b[i] = 0;
    else
      b[i] = 1;
    // cout << "cnt%2 = " << cnt%2 << endl;
    // cout << "a[" << i << "] = " << a[i] << endl;
    // dump(a,"a");
    // dump(b,"b");
    // cout << endl;
  }  

  int sum = 0;
  for(int i = 1; i<n+1; i++)
    sum += b[i];
  cout << sum << endl;
  
  for(int i = 1; i<n+1; i++){
    if(b[i] == 1) {
      if(i != n+1)
	cout << i << " ";
      else
	cout << i;      
    }
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s; cin>>s;
    int res=0;
    for (int i = 0; i < s.size(); i++) {
        if(s[i]=='o') res++;
    }
    if(res+15-s.size()>=8)std::cout << "YES" << '\n';
    else std::cout << "NO"<< '\n';
}


Measured memory_bytes: 256
#include<iostream>
int h,w,a,r,P,Q,i,p,mp[26];main(){std::cin>>h>>w;for(i=0;i<h;i++){std::string s;std::cin>>s;for(auto c:s)mp[c-'a']++;}for(p:mp){if(p%2)P++;p-=p%2;if(p%4==2)Q++;}a=h*w%2,r=h%2*(w/2)+w%2*(h/2);puts((P!=a||Q>r||(r-Q)%2)?"No":"Yes");}

Measured memory_bytes: 256
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
 
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e5)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

int main()
{
    ll W, H, x, y;
    cin >> W >> H >> x >> y;
    double ans = W * H / 2.0;
    if (W % 2 == 0 && W / 2 == x && H % 2 == 0 && H / 2 == y) print(setprecision(20) << ans << " " << 1);
    else print(setprecision(20) << ans << " " << 0);
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
#define fo(a,b,c) for (a=b; a<=c; a++)
#define fd(a,b,c) for (a=b; a>=c; a--)
#define mod 998244353
using namespace std;

struct type{
	int len;
	long long s;
} b[200001];
bool a[200001];
int n,i,j,k,l,S,tot;
long long ans,s;
char ch;

bool cmp(type a,type b)
{
	return a.len<b.len;
}

int main()
{
//	freopen("c.in","r",stdin);
	
	scanf("%d",&n);
	
	s=0;
	fo(i,1,n)
	{
		ch=getchar();
		while (ch!='0' && ch!='1')
		ch=getchar();
		
		if (ch=='1')
		a[i]=1;
		
		s=(s*2+a[i])%mod;
	}
	
	ans=(s+1)*(n+n)%mod;
	S=floor(sqrt(n));
	
	fo(i,1,S)
	if (!(n%i))
	{
		l=n/i;
		if (l>1 && (l&1))
		{
			s=0;
			fo(j,1,i)
			s=(s*2+a[j])%mod;
			++s;
			
			fo(j,1,n)
			if (((j-1)/i)&1)
			{
				if (a[j]<(a[(j-1)%i+1]^1))
				{
					--s;
					break;
				}
				else
				if (a[j]>(a[(j-1)%i+1]^1))
				break;
			}
			else
			{
				if (a[j]<a[(j-1)%i+1])
				{
					--s;
					break;
				}
				else
				if (a[j]>a[(j-1)%i+1])
				break;
			}
			
			++tot;
			b[tot].len=i;
			b[tot].s=s;
		}
		
		if (i>1 && (i&1) && i!=l)
		{
			s=0;
			fo(j,1,l)
			s=(s*2+a[j])%mod;
			++s;
			
			fo(j,1,n)
			if (((j-1)/l)&1)
			{
				if (a[j]<(a[(j-1)%l+1]^1))
				{
					--s;
					break;
				}
				else
				if (a[j]>(a[(j-1)%l+1]^1))
				break;
			}
			else
			{
				if (a[j]<a[(j-1)%l+1])
				{
					--s;
					break;
				}
				else
				if (a[j]>a[(j-1)%l+1])
				break;
			}
			
			++tot;
			b[tot].len=l;
			b[tot].s=s;
		}
	}
	
	sort(b+1,b+tot+1,cmp);
	
	fo(i,1,tot)
	{
		fo(j,1,i-1)
		if (!(b[i].len%b[j].len))
		b[i].s=(b[i].s-b[j].s)%mod;
		
		ans=(ans-b[i].s*(n+n-b[i].len-b[i].len)%mod)%mod;
	}
	
	printf("%lld\n",(ans+mod)%mod);
}

Measured memory_bytes: 384
import math
import numpy as np
from operator import mul

# 整数Nを桁ごとのリストにする
# l = [int(x) for x in list(str(N))]

# リストliから重複を削除したリストli_uniqを作成
#li_uniq = []
#for i in li:
#    if x not in li_uniq:
#        li_uniq.append(x)

# 複数行のinput - list版
#list = [list(map(int, input().split())) for i in range(N)]
# 複数行のinput - dictionary版
# key = a, value = b
#for i in range(N):
#    a, b = map(int, input().split())
#    dict[a] = b


N = int(input())
S = list(input().split())
colors = [0,0]

for i in range(N):
    if S[i] == 'P' or S[i] == 'W' or S[i] == 'G':
        colors[0] += 1
    if S[i] == 'Y':
        colors[1] += 1

if colors[1] == 0:
    print('Three')
else:
    print('Four')
    

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

signed main(void)
{
	int ans;
	ans = 700;
	rep(i, 3)
	{
		char c;
		cin >> c;
		if (c =='o') ans += 100;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
n=int(input())
s=input()
freq=[0]*26
for i in s:
    freq[ord(i)-ord('a')]+=1
for i in range(n-1):
    s=input()
    f=[0]*26
    for j in s:
        f[ord(j)-ord('a')]+=1
    for j in range(26):
        freq[j]=min(freq[j],f[j])
ans=''
for i in range(26):
    if freq[i]:
        while freq[i]>0:
            ans+=chr(i+ord('a'))
            freq[i]-=1
print(ans)


Measured memory_bytes: 3064
S=input()
N=len(S)
M=2019

remainder=[0]*M
val=0
for i in range(N):
  val=(int(S[N-1-i])*pow(10,i,M)+val)%M
  remainder[val]+=1

ans=remainder[0]
for i in range(2019):
  ans+=remainder[i]*(remainder[i]-1)//2
print(ans)

Measured memory_bytes: 9324
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

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

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n,k; cin >> n >> k;
    if(k == 0){
        cout << n * n << "\n";
        return 0;
    }
    ll ans = 0;
    rep(i, k+1, n + 1){
        for(int j = 0; j <= n; j += i){
            if(j + k <= n)ans += min(j + i - 1, n) - (j + k) + 1;
        }
        debug(i, ans);
    }

    cout << ans << "\n";
}

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

using namespace std;
using LL = long long;

constexpr int N = 1e5 + 5;

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

    string x;
    cin >> x;

    LL k;
    cin >> k;
    int n = x.size();

    set< char> st;
    for (char &c : x) st.insert(c);

    if (st.size() == 1) {
        cout << (n * 1LL * k) / 2 << endl;
        return 0;
    }


    if (n == 1) {
        cout << k / 2 << endl;
        return 0;
    }

    if (n == 2) {
        if (x[0] == x[1]) {
            cout << k << endl;
        }
        else {
            cout << 0 << endl;
        }
        return 0;
    }

    LL lft = 0, middle = 0, rgt = 0;
    int cntl = 0, cntr = 0;
    while (x.back() == x[0]) {
        cntr++;
        x.pop_back();
    }

    reverse(begin(x), end(x));

    char ch = x.back();
    while (x.back() == ch) {
        cntl++;
        x.pop_back();
    }

    LL result = 0;

    int m = x.size();
    for (int i = 0; i + 1 < m; i++) {
        if (x[i] == x[i + 1]) {
            result ++;
            char c = 'a';
            while (c == x[i] or c == x[(i + 2) % m]) c++;
            x[i + 1] = c;
        }
    }

    result *= k;
    result += cntl / 2;
    result += cntr / 2;
    result += ((cntl + cntr) / 2) * 1LL * (k - 1);
    cout << result << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i, n) for (int i = 0; i < ((int)(n)); i++) // 0-indexed昇順

int main()
{
  int N, M;
  cin >> N >> M;
  vector<int> R(N);
  rep(i, M)
  {
    int a, b;
    cin >> a >> b;
    R.at(--a)++;
    R.at(--b)++;
  }
  rep(i, N)
  {
    cout << R.at(i) << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>

#include<math.h>

int main(void){

  double r,c,s;

  while(scanf("%lf\n",&r)!=EOF)

{

    c = 2.0*r*M_PI;

    s = r*r*M_PI;

    printf("%.6lf %lf\n",s,c);

  }

return 0;

}
 

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

using namespace std;

int main() {
    int n, k;cin >> n >> k;
    vector<ll> v(n), ruiseki;
    ruiseki.push_back(0);
    for(int i = 0;i < n;i++){
        cin >> v[i];
        ruiseki.push_back(ruiseki.back() + v[i]);
    }
    ll ans = 0;
    map<ll, int> mp;
    for(int i = 0;i < n + 1;i++){
        ans += mp[((ruiseki[i] - i) % k + k ) % k];
        mp[((ruiseki[i] - i) % k + k) %k]++;
        if(i >= k - 1){
            mp[((ruiseki[i - k + 1] - (i - k + 1)) % k + k) %k]--;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 18748
#include <bits/stdc++.h>
#include <stdint.h>
#include <algorithm>

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int>a(N,0);
	int tmp = 0;
	int answer = 0;
	
	for (int i = 0;i < a.size(); i++) {
		cin >> tmp;
		while (tmp % 2 == 0){
			a.at(i)++;
			tmp = tmp / 2;
		}
		answer += a.at(i);
	}
	
	cout << answer << endl;
	return 0;
}


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

typedef unsigned long long ULL;
typedef long long LL;

using namespace std;

int main(){
    int N;
    int A,B,count;
    cin >> N;

    count = 0;
    for(A=1;A<N;A++){
        for(B=1; A*B < N; B++){
            count++;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<string>
using namespace std;
int main()
{
    string s;
    cin >> s;
    if(s[0] == 'S') cout << "Cloudy" << endl;
    else if(s[0] == 'C')    cout << "Rainy" << endl;
    else cout << "Sunny" << endl;
    return 0;
}

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

#define sz(x) int(x.size())
#define pii pair<int, int>
#define Task "abc"
#define For(i, a, b) for(int i = (a), _b = (b); i <= b; ++i)
#define Debug(X) cout << #X << " = " << X << '\n'
#define All(x) (x).begin(), (x).end()
#define mp make_pair

typedef unsigned long long ull;
typedef long long ll;

const int maxn = 1e5 + 10;
const int inf = 0x3f3f3f3f;
const ll mod = 1e9 + 7;

int a, b, c;

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
//  freopen(Task".inp", "r", stdin);
//  freopen(Task".out", "w", stdout);
  cin >> a >> b >> c;
  swap(a, b); swap(a, c);
  cout << a <<' ' << b <<' ' << c;

}



Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
import numpy as np
import math
import itertools

def distance(x1, y1, x2, y2):
    return math.sqrt((x1-x2)**2+(y1-y2)**2)

def solve(N: int, x: "List[int]", y: "List[int]"):
    d = 0.0
    for v in itertools.permutations([i for i in range(N)],N):
        for i in range(len(v)-1):
            dist = distance(x[v[i]], y[v[i]],x[v[i+1]], y[v[i+1]])
            d += dist

    print(d/math.factorial(N))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    x = [int()] * (N)  # type: "List[int]"
    y = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
    solve(N, x, y)

if __name__ == '__main__':
    main()


Measured memory_bytes: 22180
/*  Author : Alpha_The_Coder
    Created on 13/09/2020      */
#include <bits/stdc++.h>
using namespace std;
#define iamalpha ios_base::sync_with_stdio(false);cin.tie(NULL);
#define loop(a,n) for(int i=a;i<n;i++)
#define nloop(a,n) for(int j=a;j<n;j++)
#define lli long long int
lli mod=1000000007;
void solve();


int main()
{
    iamalpha;
    int t=1;
    while(t--)
    {
        solve();
    }
}

void solve()
{
    int n;
    lli count=0;
    scanf("%d",&n);
    for(int i=1;i<n;i++)
    {
        int ab=n-i;
        for(int j=1;j<=sqrt(ab);j++)
        {
            if(ab%j==0)
                {
                    if(j*j==ab) count+=1;
                    else count+=2;
                }
         }
    }
    printf("%lli",count);
}


// Solely contributed by Subhojeet Sahoo aka Alpha


Measured memory_bytes: 3788
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void){
    int n,num,i,o,sum;
    char *line,temp[1000001];
    for(;line=malloc(1000001),sum=0,scanf("%d",&n),n;){
        for(i=0;i<n*2;i+=2){
            temp[i]='I';
            temp[i+1]='O';
        }
        temp[i++]='I';
        temp[i]=0;
        scanf("%d",&num);
        scanf("\n%s",line);
        while(line != NULL){
            line=strstr(line,temp);
            if(line != NULL){
                sum++;
                line++;
            }
        }
        printf("%d\n",sum);
    }
    return 0;
}

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

int n, x, y;

signed main() {
  // freopen("in", "r", stdin);
  while(~scanf("%d",&n)) {
    bool ok = 0;
    for(x = 0; x < 100; x++) {
      for(y = 0; y < 100; y++) {
        if(4*x+7*y==n)ok=1;
      }
    }
    puts(ok?"Yes":"No");
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main (void){
int H,W,i,l;
    for(;scanf("%d %d",&H,&W);){
        if(H==0&&W==0){
            break;
        }
        for(i=1;i<=H;i++){
            for(l=1;l<=W;l++){
                if(l==1||l==W){
                    printf("#");}
                else if(i==1||i==H){
                    printf("#");}
                else{
                printf(".");}
            }
            printf("\n");}
        printf("\n");}
    return 0;
}
    
 

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

int main(void){
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    int sum{0};
    if(A<B)
        sum += A;
    else
        sum += B;
    if(C<D)
        sum += C;
    else
        sum += D;
    cout << sum << endl;

}

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

bool IsHarshadNumber(int n) {
	int sum = 0;
	for (int m = n; m > 0; m /= 10) {
		sum += m % 10;
	}
	return n % sum == 0;
}

int main() {
	int N;
	cin >> N;
	map<bool, string> m{};
	m[true] = "Yes";
	m[false] = "No";
	cout << m[IsHarshadNumber(N)];
}

Measured memory_bytes: 256
x,y = map(int, input().split())

if x == 2 or y == 2:
    print("No")
    exit()

a = [1,3,5,7,8,10,12]
b = [4,6,9,11]

if (x in a and y in a) or (x in b and y in b):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010

ll factmemo[SIZE];
ll factmemoMod = -1;
void initFactorial(int n, int M){
  factmemoMod = M;
  factmemo[0] = 1;
  for(int i=1;i<=n;i++) factmemo[i] = (factmemo[i-1] * i)%M;
}

ll factorial(int n,int M){
  if(factmemoMod == M) return factmemo[n];
  
  ll ret=1;
  if(n<=1) return 1;
  
  for(int i=1;i<=n;i++) ret = (ret*i)%M;
  
  return ret;
}

ll power(int k,int n,int M){
  if(n==0) return 1;
  if(n==1) return (ll)k;
  
  ll ret = power(k,n/2,M);
  
  ret=(ret*ret)%M;
  
  if(n%2==1) ret=(ret*k)%M;
  
  return ret;
}


//nCm nPm nHm (mod M)

/*Combination*/
int C(int n,int m,int M){
  if(n<m) return 0;
  if(m==0 || n==m) return 1;
  
  ll chi = factorial(n,M);
  ll mot = (factorial(m,M) * factorial(n-m,M))%M;
  
  mot = power((int)mot,M-2,M);
  
  ll ret = (chi*mot)%M;
  
  return (int)ret;
}

/*Permutation*/
int P(int n,int m,int M){
  if(n<m) return 0;
  if(m==0) return 1;
  
  ll chi = factorial(n,M);
  ll mot = factorial(n-m,M);
  
  mot = power((int)mot, M-2,M);
  
  ll ret = (chi*mot)%M;
  
  return (int)ret;
}

/*Combination with Repetitions*/
int H(int n,int m,int M){
  if(n==0 && m==0) return 1;
  return C(n+m-1,m,M);
}


int main(){
  int n, k;

  cin >> n >> k;

  initFactorial(2020, mod);
  
  ll ans = 0;
  
  for(int i=0;i<k;i++){
    ll add = power(k-i, n, mod) * C(k, i, mod) % mod;
    if(i%2) add *= -1;
    ans = (ans + add + mod)%mod;
  }
  
  cout << ans << endl;
  
  return 0;
}



Measured memory_bytes: 3116
Q = 998244353
def main():
    N, S = map( int, input().split())
    A = list( map( int, input().split()))
    invtwo = pow(2, Q-2, Q)
    # Invtwo = [1]
    # now = 1
    dp = [pow(2, N, Q)]+[0]*S
    for i in range(N):
        a = A[i]
        for i in range(S, a-1,-1):
            # print(i, a, i-a, dp[i-a])
            if dp[i-a] > 0:
                dp[i] += dp[i-a]*invtwo%Q
                dp[i] %= Q
        # print(dp)
    print(dp[S])
                
if __name__ == '__main__':
    main()


Measured memory_bytes: 68396
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n, m, R;
    cin >> n >> m >> R;
    vector<int> r(R);
    rep(i, R) {
        cin >> r[i];
        r[i]--;
    }
    const int INF = 1001001001;
    vector<vector<int>> dist(n, vector<int>(n, INF));
    rep(i, m){
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        dist[a][b] = c;
        dist[b][a] = c;
    }
    rep(i, n) dist[i][i] = 0;

    rep(k, n)rep(i, n)rep(j, n) dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);

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

    int ans = 1001001001;
    do{
        int d = 0;
        rep(i, R - 1) d += dist[r[i]][r[i + 1]];
        ans = min(ans, d);
    }while(next_permutation(r.begin(), r.end()));
    
    cout << ans << endl;
}

Measured memory_bytes: 384
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        long N = in.l();
        long P = in.l();
        int M = (int)Math.sqrt(P);
        
        long ans = 1;
        for (int i = 2; i <= M; i++) {
            long t = 0;
            while (P % i == 0) {
                t++;
                P /= i;
            }
            t = t / N;
            ans *= pow(i, t);
        }
        if (P > 1 && N == 1) {
            ans *= P;
        }
        out.println(ans);
    }

    static long pow(long a, long b) {
        long c = 1;
        while (b > 0) {
            if ((b & 1) == 1) {
                c *= a;
            }
            a *= a;
            b >>= 1;
        }
        return c;
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    void back() {
        head--;
    }

    boolean minus() {
        boolean minus;
        while (true) {
            char c = next();
            if (!isDelimiter(c)) {
                if (!(minus = c == '-')) back();
                return minus;
            }
        }
    }

    void skip() {
        while (isDelimiter(next()));
        back();
    }

    char[] s(int N) {
        char[] cbuf = new char[N];
        read(cbuf, 0, N);
        return cbuf;
    }

    public int read(char[] cbuf, int off, int len) {
        skip();
        int i;
        for (i = 0; i < cbuf.length; i++) {
            char c = next();
            if (isDelimiter(c)) {
                break;
            }
            cbuf[i] = c;
        }
        return i;
    }

    boolean isDelimiter(char c) {
        return c == ' ' || c == '\n' || c == '\r';
    }

    int i() {
        boolean minus = minus();
        int n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        boolean minus = minus();
        long n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }
}


Measured memory_bytes: 32596
#include<bits/stdc++.h>
#define fo(i,n) for(int i=1;i<=n;i++)
#define fo1(i,n) for(int i=0;i<n;i++)
#define llu long long int
#define vi vector <int>
#define pb push_back
#define mod 1000000007

using namespace std;

int main()
{
	string s,t;
	cin>>s>>t;
	int l=s.size();
	int flag=0;
	for(int i=0;i<l;i++)
	{
		if(s[i]!=t[i])
		{
			flag=1;
			break;
		}
	}
	if(flag==1)
		cout<<"No\n";
	else
		cout<<"Yes\n";
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    string t;
    int a,b;
    string u;
    cin>>s>>t>>a>>b>>u;
    if(s==u)
    {
        cout<<a-1<<" "<<b;
    }
    else if(t==u)
    {
        cout<<a<<" "<<b-1;
    }
}


Measured memory_bytes: 256
a,b,c=map(int,input().split())

x=max(a,b,c)
z=min(a,b,c)
y=a+b+c-x-z

ans=x-y
y=x
z+=ans

if (x-z)%2==0:
    ans+=(x-z)/2
else:
    x+=1
    ans+=1
    ans+=(x-z)/2

print(int(ans))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
int a[300005];
ll mod=1e9+7;
ll dp[300005];
int pre[300005];
int f()
{
    int cnt=0;
    for(int i=1;i<=n;i++)
    {
        if(i+1<=n&&a[i]==a[i+1])continue;
        else a[++cnt]=a[i];
    }
    return cnt;
}
int main()
{
#ifndef ONLINE_JUDGE
   // freopen("in.txt","r",stdin);
#endif 
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i];
    n=f();
    memset(pre,-1,sizeof(pre));
    dp[1]=1;pre[a[1]]=1;
    for(int i=2;i<=n;i++)
    {
        if(pre[a[i]]==-1)dp[i]=dp[i-1];
        else dp[i]=(dp[i-1]+dp[pre[a[i]]])%mod;
        pre[a[i]]=i;
    } 
    cout<<dp[n]<<endl;
    return 0;
}


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


#define M_MAX 20
#define N_MAX 50000
#define INFTY 1 << 29

int main(){
long long int a,b,k;
cin >> a >> b >> k;

if(a==0 && b==0){
cout << 0 << " " << 0;
}else if(a>=k){
cout << a-k << " " << b;
}else if(a+b>=k){
cout << 0 << " " << b-(k-a);
}else{
cout << 0 << " " << 0;
}


}


Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        String s=in.nextLine();
        String ss=in.nextLine();
        char ch[]=ss.toCharArray();
        String c="";
        for (int i = 0; i < ch.length-1; i++) {
            c=c+ch[i];
        }
        if(c.equals(s)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 38936
from collections import deque


def main():
    queue = deque()
    process = {}
    current_time = 0
    n, q = map(lambda x: int(x), input().split())
    for _ in range(n):
        name, time = input().split()
        process[name] = int(time)
        queue.append(name)
    while True:
        name = queue.popleft()
        process[name] -= q
        if process[name] > 0:
            queue.append(name)
            current_time += q
        else:
            current_time += q + process[name]
            print(name, current_time)
        if len(queue) == 0:
            break


if __name__ == '__main__':
    main()



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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

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

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

const ll N_MAX = 101010;

ll inv[N_MAX],fac[N_MAX],finv[N_MAX];
void make(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<N_MAX;i++){
        inv[i]=mod-inv[mod%i]*(mod/i)%mod;
        fac[i]=fac[i-1]*(ll) i%mod;
        finv[i]=finv[i-1]*inv[i]%mod;
    }
}

ll Combination(ll C, ll D){
    if(C<D) return 0;
    return fac[C]*(finv[D]*finv[C-D]%mod)%mod;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> cnt(n+1, 0);
    ll dabli;
    vector<ll> a(n+1);
    REP(i, n+1){
    	cin >> a[i];
    	cnt[a[i]]++;
    }
    REP(i, n+1) if(cnt[i] == 2) dabli = i;
    ll ind1 = (1ll<<60), ind2 = -1;
    REP(i, n+1){
    	if(a[i] == dabli){
    		ind1 = min(ind1, (ll)i);
    		ind2 = max(ind2, (ll)i);
    	}
    }
    make();

    REP(i, n+1){
    	ll kosu = i+1;
    	ll res = 0;
    	res += Combination(n+1, kosu);
    	res -= Combination(ind1 + n - ind2, kosu-1);
    	res += mod;
    	res %= mod;
    	/*
    	REP(j, kosu){
    		ll tmp = Combination(ind1, j) * Combination(n-ind2, kosu-j-1);
    		tmp %= mod;
    		res -= tmp;
    		res += mod;
    		res %= mod;
    	}
    	*/
    	cout << res << endl;
    }

    return 0;
}

Measured memory_bytes: 5120
#include <set>
#include <array>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <vector>
#include <tuple>
#include <string>
#include <math.h>
#include <time.h>
#include <bitset>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <limits>
#include <climits>
#include <numeric>
#include <functional>

#define lnd '\n'
// #define reverse(i, n) for(ll i = n-1; i >= 0; --i)
#define from(i, n) for (ll i = 0; i < n; ++i)
#define loop(i, n) for(ll i = 0; i < n; i++)
#define REPN(i, n) for (ll i = 1; i <= n; ++i)
#define ALL(s) (s).begin(), (s).end()
#define rALL(s) (s).rbegin(), (s).rend()
#define sz(s) (int)(s).size()
#define mk make_pair
#define pb push_back
#define sqr(s) ((s) * (s))

using namespace std;

typedef long long ll;
typedef long long int lli;
typedef long double ld;
typedef unsigned long long ull;
typedef unsigned int ui;

template <class T>
T GCD (T a, T b) {
  if(a == 0) return b;
  return GCD(b%a, a);
}

template <class T>
T LCM(T a, T b){
  return a*b/GCM(a,b);
}

template <class T>
T modpow(T x, T p){
    T res = 1;
    while(p > 0){
        if(p&1) res *= x;
        x *= x;
        p /= 2;
    }
    return res;
}

template <class T>
T modpow(T x, T p, ll mod){
    T res = 1;
    while(p > 0){
        if(p&1) res = (res*x)%mod;
        x = (x*x)%mod;
        p /= 2;
    }
    return res%mod;
}

template <class T>
void print(T a[], ll n){
    for (ll i = 0; i < n; i++) std::cout << a[i] << ' ';
    cout << endl;
}

template<class T>
void printc(T c){
    for(auto const& v: c) std::cout << v << ' ';
    cout << endl;
}

struct HASH{
  size_t operator()(const pair<long,long>&x)const{
    return hash<long long>()(((long long)x.first)^(((long long)x.second)<<32));
  }
};

bool pair_sort(const pair<int, int> &p1, const pair<int,int> &p2){
    if(p1.first != p2.first) return p1.first < p2.first;
    else return p1.second < p2.second;
}

const int INF = std::numeric_limits<int>::max();
const ll M_INF = std::numeric_limits<ll>::min();
const ll LL_INF = std::numeric_limits<ll>::max();

void solution();
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solution();
    return 0;
}

ll result[200005] = {0};
void fact(ll n) {
   if (n >= 0) {
      result[0] = 1;
      for (ll i = 1; i <= n; ++i) {
         result[i] = i * result[i - 1];
      }
   }
}

void dfs(ll n, ll m, ll i, vector<ll> &v){
  if(i == n){
  }else{
    for(int k = 1; k <= m; k++){
      v.push_back(k);
      dfs(n, m, i+1, v);
      v.pop_back();
    }
  
  }
}

void solution(){
  ll n;
  cin >> n;
  vector<ll> a(n);
  map<ll, ll> counts;
  loop(i, n){
    cin >> a[i];
  }

  ll ans = 0;
  loop(i, n){
    ans += counts[i - a[i]];
    counts[i+a[i]]++;
  }

  cout << ans << endl;
}     



Measured memory_bytes: 27052