akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e12 + 5);

const int MAX_N = (int)(1e5 + 5);

int a, b, q;
ll s[MAX_N];
ll t[MAX_N];

ll calc(ll x) {
  int ind_a = upper_bound(s, s + a, x) - s;
  int ind_b = upper_bound(t, t + b, x) - t;

  vector<ll> vec_a;
  if (ind_a < a) vec_a.push_back(s[ind_a]);
  if (ind_a > 0) vec_a.push_back(s[ind_a - 1]);

  vector<ll> vec_b;
  if (ind_b < b) vec_b.push_back(t[ind_b]);
  if (ind_b > 0) vec_b.push_back(t[ind_b - 1]);

  ll ret = INF;

  for (auto &es : vec_a) {
    for (auto &et : vec_b) {
      ret = min(ret, abs(x - es) + abs(es - et));
    }
  }

  for (auto &et : vec_b) {
    for (auto &es : vec_a) {
      ret = min(ret, abs(x - et) + abs(et - es));
    }
  }

  return ret;
}

int main(void) {
  // Here your code !
  scanf("%d %d %d", &a, &b, &q);

  for (int i = 0; i < a; ++i) {
    scanf("%lld", &(s[i]));
  }

  for (int i = 0; i < b; ++i) {
    scanf("%lld", &(t[i]));
  }

  sort(s, s + a);
  sort(t, t + b);

  for (int i = 0; i < q; ++i) {
    ll x;
    scanf("%lld", &x);

    printf("%lld\n", calc(x));
  }

  return 0;
}


Measured memory_bytes: 2816
#include <stdio.h>

int main (void)
{
	int i = 1, x, n;
	
	scanf("%d", &n);
	
	do {
		x = i;
		if (x % 3 == 0) {
			printf(" %d", i);
		} else {
			do {
				if (x % 10 == 3) {
					printf(" %d", i);
					break;
				}
				x /= 10;
			} while (x);
		}
	} while (++i <= n);
	
	putchar('\n');
	
	return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<vector>
#include<functional>
#include<algorithm>
#include<cmath>
#include<string>
#include<iomanip>
using namespace std;

int main()
{
	const int num=400;
	int n;
	cin>>n;
	long long a[num];
	long long sum[num]={};
	long long dp[num][num];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		dp[i][0]=0;
		if(i)sum[i]=sum[i-1];
		sum[i]+=a[i];
	}
	for(int j=1;j<n;j++)
	{
		for(int i=0;i+j<n;i++)
		{
			long long mx=999999999999999;
			for(int k=0;k<j;k++)
			{
				mx=min(mx,(dp[i][k]+dp[i+k+1][j-k-1]));
			}
			dp[i][j]=mx+sum[i+j];
			if(i)dp[i][j]-=sum[i-1];
		}
	}
	cout<<dp[0][n-1]<<endl;
	return 0;
}
	

Measured memory_bytes: 1536
using System;
using System.Collections.Generic;
//using System.Linq;
//using System.Numerics;

class Program {
    static void Main (string[] args) {
        var input = INP();
        var input2 = INP();
        if(input[0].Length > input2[0].Length) {
            CWL("GREATER");
            return;
        } else if(input[0].Length < input2[0].Length) {
            CWL("LESS");
            return;
        }

        for(int i = 0 ;i < input[0].Length;i++) {
            int a = TOI(input[0].Substring(i,1));
            int b = TOI(input2[0].Substring(i,1));

            if(a>b) {
                CWL("GREATER");
                return;
            }else if(a<b) {
                CWL("LESS");
                return;
            }
        }

        CWL("EQUAL");
    }

    public static List<int> PrimeFactors (int n) {
        var tmpList = new List<int>();
        int i = 2;
        int tmp = n;

        while(i * i <= n) {
            if(tmp % i == 0) {
                tmp /= i;
                tmpList.Add(i);
            } else {
                i++;
            }
        }

        if(tmp != 1) tmpList.Add(tmp);

        return tmpList;
    }

    static string[] INP () {
        return Console.ReadLine().Split(' ');
    }

    static void CWL (string value) {
        Console.WriteLine(value);
    }

    static void CWL (int value) {
        Console.WriteLine(value);
    }

    static void CWL (long value) {
        Console.WriteLine(value);
    }

    static void CWL (float value) {
        Console.WriteLine(value);
    }

    static void CWL (double value) {
        Console.WriteLine(value);
    }

    static int TOI (string str) {
        return int.Parse(str);
    }

    static long TOL (string str) {
        return long.Parse(str);
    }

    static float TOF (string str) {
        return float.Parse(str);
    }

    static double TOD (string str) {
        return double.Parse(str);
    }

    /*static void Main (string[] args) {
        var input = INP();
        var input2 = INP();
        var input3 = INP();

        CWL("dummy");
    }*/
}

Measured memory_bytes: 11092
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Player : IComparable
    {
        internal int id, point;

        public Player(int id, int point)
        {
            this.id = id;
            this.point = point;
        }

        public override string ToString()
        {
            return id + " " + point;
        }

        public int CompareTo(object obj)
        {
            Player other = obj as Player;

            if (point == other.point)
            {
                return id - other.id;
            }
            return other.point - point;
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            while (true)
            {
                int n = int.Parse(Console.ReadLine());

                if (n == 0) break;

                Player[] players = new Player[n];

                for (int i = 0; i < n; i++)
                {
                    int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

                    var query = input.Skip(1).ToArray();

                    int point = CalcPoint(query);

                    players[i] = new Player(input[0], point);
                }

                Array.Sort(players);

                foreach (var p in players)
                {
                    sb.AppendLine(p.ToString());
                }
            }
            Console.Write(sb);
        }

        static int CalcPoint(int[] arr)
        {
            int ret = 0, idx = 0;

            for (int game = 1; game < 10;)
            {
                if (arr[idx] == 10)
                {
                    ret += (arr[idx] + arr[idx + 1] + arr[idx + 2]);
                    idx++;
                    game++;
                }
                else
                {
                    int temp = arr[idx] + arr[idx + 1];

                    if (temp == 10)
                    {
                        ret += (temp + arr[idx + 2]);
                    }
                    else
                    {
                        ret += temp;
                    }

                    idx += 2;
                    game++;
                }
            }

            for (int i = idx; i < arr.Length; i++)
            {
                ret += arr[i];
            }
            return ret;
        }
    }
}

Measured memory_bytes: 10012
// どこで下に移動するかに注目して全探索.
#include<iostream>
using namespace std;
int main(){
  int A[5][105];
  int n; cin >> n;
  for(int i=1;i<=2;i++){
    for(int j=1;j<=n;j++) cin >> A[i][j];
  }
  
  int ans=0;
  for(int s=1;s<=n;s++){
    int count=0;
    for(int k=1;k<=s;k++) count += A[1][k];
    for(int l=s;l<=n;l++) count += A[2][l];
    
    if(ans<=count) ans = count;
  }
  
  cout << ans << endl;
  return 0;
}

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

using namespace std;


int main(void){

	while( true ) {
		int n;
		cin >> n;
		if( !n ) break;
		n = 1000 - n;
		int ans = 0;
		int p[] = { 500, 100, 50, 10, 5, 1 };
	
		for( int i = 0; i < 6; i++ ) {
			ans += n / p[i];
			n %= p[i];
		}
		cout << ans << endl;
	}

    return 0;
}

Measured memory_bytes: 1160
package main

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

func foo(p []int, n, k int) float64 {
  past := 0.0
  for j := 0; j < k; j++ {
    past += float64((p[j]*(p[j]+1)))/float64((2*p[j]))
  }
  maxsum := past
  for l := 1; l < n-k+1; l++ {
    le := float64((p[l+k-1]*(p[l+k-1]+1)))/float64((2*p[l+k-1])) - float64((p[l-1]*(p[l-1]+1)))/float64((2*p[l-1]))
    past = past + le
    if le <= 0 {
      continue
    }
    if past > maxsum {
      maxsum = past
    }
  }

  return maxsum
}


var sc = bufio.NewScanner(os.Stdin)
func nextInt() int {
    sc.Scan()
    i, e := strconv.Atoi(sc.Text())
    if e != nil {
        panic(e)
    }
    return i
}

func nextText() string {
    sc.Scan()
    return sc.Text()
}

func main() {
  // input
  sc.Split(bufio.ScanWords)
  n := nextInt()
  k := nextInt()

  // store to slice
  var p []int
  for i := 0; i < n; i++ {
    p = append(p, nextInt())
  }

  // output
  fmt.Printf("%f\n", foo(p, n, k))

}


Measured memory_bytes: 7552
#include <cstdio>

struct date{
	int year, month, day;
};

bool judge_pre_meiji(struct date d);
int era_trans_1(struct date d);

int era_l_year[4] = {1868, 1912, 1926, 1989}; //各eraの最初の年
int era_u_year[3] = {1912, 1926, 1989}; //各eraの最後の年
int era_u_month[3] = {7, 12, 1}; //各eraの最後の月
int era_u_day[3] = {29, 24, 7}; //各eraの最後の日
char era_name[4][20] = {"meiji", "taisho", "showa", "heisei"};

int main(void)
{
	struct date d;
	int n, era_year;

	while (scanf("%d%d%d", &d.year, &d.month, &d.day) != EOF) {
		if (judge_pre_meiji(d)) {
			printf("pre-meiji\n");
		} else {
			n = era_trans_1(d);
			era_year = d.year - era_l_year[n] + 1;
			printf("%s %d %d %d\n", era_name[n], era_year, d.month, d.day);
		}
	}
}

bool judge_pre_meiji(struct date d)
{//pre-meijiか判定する
	if (d.year < 1868) {
		return true;
	} else if (d.year == 1868 && d.month < 9) {
		return true;
	} else if (d.year == 1868 && d.month == 9 && d.day < 8) {
		return true;
	} else {
		return false;
	}
}
int era_trans_1(struct date d)
{//eraに応じた数字を返す
	int i;
	for (i=0; i<3; i++) {
		if (d.year < era_u_year[i]) {
			break;
		} else if (d.year == era_u_year[i] && d.month < era_u_month[i]){
			break;
		} else if (d.year == era_u_year[i] && d.month == era_u_month[i] && d.day <= era_u_day[i]) {
			break;
		}
	}
	//i = 0 :: meiji
	//i = 1 :: taisho
	//i = 2 :: showa
	//i = 3 :: heisei
	return i;
}

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

int main() {
	int n, i;
	long debt = 100000;
	cin >> n;
	for (i = 0; i < n; i++) {
		debt = debt * 1.05;
		debt = ceil((double)debt / 1000) * 1000;
	}
	cout << debt << endl;
	return 0;
}

Measured memory_bytes: 3112
S = input()
a = int(S[:2])
b = int(S[2:])
if (a > 12 or a == 0) and (b > 12 or b == 0):
	print("NA")
else:
	if a > 12 or a == 0:
		print("YYMM")
	elif b > 12 or b == 0:
		print("MMYY")
	else:
		print("AMBIGUOUS")

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N;
    cin >> N;

    vector<Pll> p;
    rep (i, N) {
        ll x, y;
        cin >> x >> y;
        p.push_back(make_pair(x, y));
    }

    map<Pll, ll> m;
    rep (i, N) {
        rep (j, N) {
            if (i != j) {
                ll dx = p[j].first - p[i].first;
                ll dy = p[j].second - p[i].second;
                m[make_pair(dx, dy)]++;
            }
        }
    }

    ll cnt = 0;
    rep (i, N) {
        rep (j, N) {
            ll dx = p[j].first - p[i].first;
            ll dy = p[j].second - p[i].second;
            cnt = max(cnt, m[make_pair(dx, dy)]);
        }
    }

    cout << N-cnt << endl;
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<cmath>
#include<queue>
#include<limits>
#include<cassert>
#include<set>
#include<tuple>
#include<map>

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

using namespace std;
typedef long long ll;

int main()
{
	int n, k;
	cin >> n >> k;
	vector<int> mp(200000, 0);
	REP(i, n) {
		int a;
		cin >> a;
		mp[a]++;
	}
	sort(mp.begin(), mp.end(), greater<int>());
	int sum = 0;
	REP(i, k) sum += mp[i];
	cout << n - sum << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
using ll = long long;
using namespace std;
int main() {
  	string s;
    string p = "";
    string n = "";
  	cin >> s;
  
  	ll ct = 0;
  	REP(i, s.length()) {
      	n += s[i];
      	if (p != n) {
          	ct++;
          	p = n;
          	n = "";
        }
    }
  	cout << ct << endl;
  	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int i,ans=0;
int main(){
	string a;
	cin>>a; 
	for(i=0;i<a.size();i++){
		if(a[i]!=a[i-1]) ans++;
	}
	cout<<ans-1;
	
	return 0;
}

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

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

#define MAX_V 10000
ll d[MAX_V][MAX_V];
int V;
void warshall_floyd() {
	rep(k, 0, V) rep(i, 0, V) rep(j, 0, V) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
}

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

	int N, M, R;
	cin >> N >> M >> R;
	V = N;
	vector<int> r;
	rep(i, 0, V) rep(j, 0, V) {
		if(i == j) d[i][j] = 0;
		else d[i][j] = 1e18;
	}

	rep(i, 0, R) {
		int tmp;
		cin >> tmp;
		tmp--;
		r.push_back(tmp);
	}

	rep(i, 0, M) {
		int a, b, c;
		cin >> a >> b >> c;
		a--, b--;
		d[a][b] = c;
		d[b][a] = c;
	}

	vsort(r);
	ll ans = 1000000000000000;
	warshall_floyd();
	do {
		ll sm = 0;
		rep(i, 0, R - 1) sm += d[r[i]][r[i + 1]];
		ans = min(ans, sm);
	} while (next_permutation(r.begin(), r.end()));
	cout << ans << endl;
}


Measured memory_bytes: 14720
N=input()
A=[0]+map(int,raw_input().split())+[0]
A_sum=0
for i in range(N+1):
	A_sum+=abs(A[i+1]-A[i])

for i in range(1,N+1):
	print A_sum-( abs( abs(A[i-1]-A[i])+abs(A[i]-A[i+1])-abs(A[i+1]-A[i-1]) ) )
	


Measured memory_bytes: 11132
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ll, P> e;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};

struct UnionFind {
private:
    vector<int> par,ran;
    vector<int> edge,size;
    int n;
public:
    UnionFind(int x){
      n=x;
      par.resize(n,0);
      ran.resize(n,0);
      edge.resize(n,0);
      size.resize(n,1);
      rep(i,n){
        par[i]=i;
      }
    }
    int find(int x) {
        if (par[x]==x)return x;
        else return par[x]=find(par[x]);
    }
    void unite(int x, int y) {
        x=find(x),y=find(y);
        if (x==y){
            edge[x]++;
            return;
        }
        if (ran[x]<ran[y]) {
            par[x]=y;
            size[y]+=size[x];
            edge[y]+=edge[x]+1;
        }
        else {
            par[y]=x;
            size[x]+=size[y];
            edge[x]+=edge[y]+1;
            if (ran[x]==ran[y])ran[x]++;
        }
    }
    bool same(int x,int y) {
        return find(x)==find(y);
    }
    int getSize(int x){
        return size[find(x)];
    }
    int getEdge(int x){
        return edge[find(x)];
    }
};

int n,m;
ll a[100010];
ll sum[100010],cnt[100010];
vector<e> es;

void solve(){
    cin >> n >> m;
    rep(i,n) {
        cin >> a[i];
        sum[i]=a[i];
    }
    rep(i,m){
        int u,v,y;
        cin >> u >> v >> y;
        u--;v--;
        es.push_back(e(y,P(u,v)));
    }
    sort(es.begin(),es.end());
    UnionFind uf(n);
    int ans=0;
    rep(i,m){
        ll d=es[i].first;int u=uf.find(es[i].second.first),v=uf.find(es[i].second.second);
        uf.unite(u,v);
        int s=uf.find(u);
        if(u!=v){
            if(u==s){
                sum[s]+=sum[v];
                cnt[s]+=cnt[v];
            }
            else{
                sum[s]+=sum[u];
                cnt[s]+=cnt[u];
            }
        }
        if(d<=sum[s]){
            ans+=cnt[s]+1;
            cnt[s]=0;
        }
        else cnt[s]+=1;
    }
    cout << m-ans << endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    LL N, K;
    cin >> N >> K;
    vector<int> v(N + 1);
    for(int i = 1; i <= N; ++i) {
        cin >> v[i];
    }

    int cnt[SIZE];
    int vis[SIZE] = {};
    int c = 0;
    int ac = 0;
    int pos = 1;
    int st = 0;
    while(vis[pos] != 3) {
        vis[pos]++;
        cnt[pos] = c;
        pos = v[pos];
        if(vis[pos] == 2 && c == 0) st = pos;
        if(vis[pos] == 2) ++c;

    }


    pos = 1;
    while(vis[pos] < 2) {
        ++ac;
        pos = v[pos];

    }

    if(K <= ac) {
        pos = 1;
        while(K--) {
            pos = v[pos];

        }
        cout << pos << endl;
        return 0;
    }

    K -= ac;
    K %= c;
    pos = st;
    while(K--) {
        pos = v[pos];

    }
    cout << pos << endl;

    return 0;
}


Measured memory_bytes: 4784
#include<stdio.h>
     
    int main(int argc, char *argv[]){
        int R;
        int G;
        
        char buf[128];
     
        if(argc==1){
            fgets(buf, 127, stdin);
            sscanf(buf, "%d", &R);
            fgets(buf, 127, stdin);
            sscanf(buf, "%d", &G);
     
        }else if(argc==3){
            printf("A: %s\n", argv[1]);
            sscanf(argv[1], "%d", &R);
            printf("B: %s\n", argv[2]);
            sscanf(argv[2], "%d", &G);
        }
        
            printf("%d\n",2*G-R);
        
    
        return 0;
    }

Measured memory_bytes: 128
#include<algorithm>
#include<cstdio>
#include<vector>
using namespace std;

int n, k;
int a[5000];
bool jdg[5000];

int main() {
    scanf("%d %d", &n, &k);
    for (int i = 0; i < n; i++) scanf("%d", &a[i]);
    sort(a, a + n, [](const int &i1, const int &i2)->bool {
        return i1 > i2;
    });
    
    for (int i = 0; i < n; i++) {
        if (a[i] >= k) {
            jdg[i] = true;
            continue;
        }
        int sum = a[i];
        vector<int> ind;
        ind.push_back(i);
        for (int j = i + 1; j < n; j++) {
            if (sum + a[j] >= k) {
                jdg[j] = true;
                for (auto &l : ind) jdg[l] = true;
                ind.clear();
            }
            else {
                sum += a[j];
                ind.push_back(j);
            }
        }
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (!jdg[i]) ans++;
    }

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


Measured memory_bytes: 256
// In the name of god
#include <bits/stdc++.h>
#pragma GCC optimize("02")
using namespace std;
using ll =long long ;
const ll maxn=2e5+5,inf=1e18+5;
ll n,a[maxn],ans;
map <ll,ll> mp;
int main(){
	ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0);
	cin>>n;
	for(ll  i=0;i<n;i++){
		cin>>a[i];
		mp[i-a[i]+1]++;
	}
	for(int i=0;i<n;i++){
		ans+=mp[i+a[i]+1];
	}
	cout<<ans;
}


Measured memory_bytes: 27840
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

typedef long long ll;

#define INF 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { debug(itr); }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

int main() {
  int r;
  cin >> r;
  cout << 3 * r * r << endl;
}


Measured memory_bytes: 256
/**
 *    Author  : Ador
 *    Created : 24.07.2020
**/
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <algorithm>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <cctype>
typedef long long int ll ;
typedef unsigned long long int ull ;
using namespace std ;
int main(void)
{
    ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
        //freopen("input.txt", "r", stdin) ;
        //freopen("output.txt", "w", stdout) ;
    int i , x ,track ;
    for(i = 1 ; i <= 5 ; ++i)
    {
        cin >> x ;
        if(!x) track = i ;
    }
    cout << track << "\n" ;
    return 0 ;
}


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

long long modinv(long long a) {
  long long b=mod,u=1,v=0;
  while(b){
    long long t=a/b;
      a-=t*b;swap(a, b);
      u-=t*v;swap(u, v);
  }
  u%=mod;
  if(u<0)u+=mod;
  return u;
}

long long moddevide(long long a,long long b){return (a*modinv(b))%mod;}

long long modncr(long long n,long long r){
  long long i,plus=1;
  for(i=0;i<r;i++){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

int main(){
  ll i,N,K;
  cin>>N>>K;
  for(i=0;i<K;i++)cout<< (modncr(K-1,i)*modncr(N-K+1,i+1))%mod <<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

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

Measured memory_bytes: 128
import java.util.*;
import java.io.*;

class Main {

	void solve() {
		
		int a = inint(), b = inint();
		StringBuilder sb = new StringBuilder();
		
		if (a == b) {
			for (int i=0; i<a; i++) {
				sb.append(b);
			}
			out.println(sb);
		}
		else {
			if (a < b) {
				for (int i=0; i<b; i++) {
					sb.append(a);
				}
				out.println(sb);
			}
			else {
				for (int i=0; i<a; i++) {
					sb.append(b);
				}
				out.println(sb);
			}
		}
		
	}

	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}

	public int inint() {
		return in.nextInt();
	}

	public long inlong() {
		return in.nextLong();
	}

	public double indouble() {
		return in.nextDouble();
	}

	public String instr() {
		return in.next();
	}

	public char inchar() {
		return in.next().charAt(0);
	}

	public int[] inintar(int num) {
		int[] a = new int[num];
		for (int i=0; i<num; i++) {
			a[i] = in.nextInt();
		}
		return a;
	}

	public char[] incharar() {
		return in.next().toCharArray();
	}

	public char[][] incharmap(int h, int w) {
		char[][] a = new char[h][w];
		for (int i=0; i<h; i++) {
			String temp = in.next();
			for (int j=0; j<w; j++) {
				a[i][j] = temp.charAt(j);
			}
		}
		return a;
	}

}

Measured memory_bytes: 21844
n = int(input())
h = list(map(int, input().split()))
INF = 10**8
dp = [INF]*n
dp[0] = 0
for i in range(1, n):
    if i == 1:
        dp[i] = abs(h[i]-h[i-1])
    else:
        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
print(dp[n-1])


Measured memory_bytes: 13924
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		// 計算
		int result = 0;
		if(a > b){
		    result = a + a - 1;
		}else if(a < b){
		    result = b + b - 1;
		}else{
		    result = a + b;
		}
		
		// 出力
        System.out.println(result);
	}
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

inline void fastio () {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
}

#define whats(x) cerr << #x << " = " << (x) << "\n"; 

using LL = long long;
using LD = long double;

const LL INF = LLONG_MAX;
const LL MOD = 998244353;
const LL N = 2e5+1;

int main() {
	fastio();

	LL a, b = 0;
	cin >> a;
	string s;
	cin >> s;
	for (auto e : s) {
		if (e != '.') {
			b += (e-'0');
			b *= 10;
		}
	}
	b /= 10;

	cout << a*b/100 << "\n";

}


Measured memory_bytes: 3652
//#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<vector>
#include<queue>
#include<cstdio>
#include<sstream>
#include<cmath>
#include<set>
#include<algorithm>
#include<map>
#define mp make_pair
#define pii pair<int,int>
#pragma GCC optimize ("O3")
#define pdd pair<double,double>
#define pll pair<ll,ll>
#define mst(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double eps = 1e-7;
const int maxn = 1e6+9;
const double pi=acos(-1.0);
const double inf = 1e17;
const int mod = 1e9+7;

int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    ll ans=0;
    for(int i=1;i<=n;++i) ans+=1ll*i*(n+1-i);
    for(int i=0;i<n-1;++i){
        int a,b;
        cin>>a>>b;
        if(a>b) swap(a,b);
        ans-=1ll*a*(n+1-b);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3620
import sys
import numpy as np
K, T = map(int, sys.stdin.readline().rstrip().split())
A = list(map(int, sys.stdin.readline().rstrip().split()))
A.sort(reverse=True)
ans = A[0] - 1
for a in A[1:]:
    ans = max(0, ans - a)
print(ans)

Measured memory_bytes: 21260
H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]
for i in range(H):
	for j in range(W):
		if S[i][j] == ".":
			cnt = 0
			if i != 0:
				cnt += S[i - 1][max(0, j - 1): min(j + 1, W - 1) + 1].count("#")
			cnt += S[i][max(0, j - 1): min(j + 1, W - 1) + 1].count("#")
			if i != H - 1:
				cnt += S[i + 1][max(0, j - 1): min(j + 1, W - 1) + 1].count("#")
			S[i][j] = str(cnt)
for x in range(H):
	print("".join(S[x]))


Measured memory_bytes: 3188
import java.util.*

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

object Problem {
    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val a = sc.next().toCharArray()[0]
        pw.println(if (a in 'A'..'Z') "A" else "a")
    }
}


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

using namespace std;

int main()
{
    int a,b;  cin >> a >> b;
    if(a < b){
        for(int i = 0;i<b;i++)   cout << a;
    }
    else {
        for(int i = 0;i<a;i++)   cout << b;
    }
    return 0;
}


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

void MAIN() {
    int n;
    scanf("%d", &n);
    std::vector<int> arr(n << 1);
    for(int &now: arr) {
        scanf("%d", &now);
    }
    std::sort(arr.begin(), arr.end());
    int ans = 0;
    for(int i = 0; i < n; ++ i) {
        ans += arr[i << 1];
    }
    printf("%d\n", ans);
}

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


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    int A[N];
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        cout << A[i];
        if (i != N - 1) cout << " ";
    }
    cout << endl;

    for (int i = 1; i < N; i++) {
        int v = A[i];
        int j;
        for (j = i - 1; j >= 0 && A[j] > v; j--) {
            A[j+1] = A[j];
        }
        A[j+1] = v;
        for (int k = 0; k < N; k++) {
            cout << A[k];
            if (k != N - 1) cout << " ";
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 3088
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint
from statistics import mean,median,mode

INF = float("inf")

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

def I():
    return int(input())

def MI():
    return map(int,input().split())

def RI():
    return list(map(int,input().split()))

def CI(n):
    return [ int(input()) for _ in range(n) ]

def LI(n):
    return [ list(map(int,input().split())) for _ in range(n) ]

def S():
    return input()

def MS():
    return input().split()

def RS():
    return list(input())

def CS(n):
    return [ input() for _ in range(n) ]

def LS(n):
    return [ list(input()) for _ in range(n) ]

ddict = defaultdict(lambda: 0)
# ddict = defaultdict(lambda: 1)
# ddict = defaultdict(lambda: int())
# ddict = defaultdict(lambda: list())
# ddict = defaultdict(lambda: float())

n = I()
s = CS(n)

for i in s:
    if i[0]=='M':
        ddict['M'] += 1
    elif i[0]=='A':
        ddict['A'] += 1
    elif i[0]=='R':
        ddict['R'] += 1
    elif i[0]=='C':
        ddict['C'] += 1
    elif i[0]=='H':
        ddict['H'] += 1
    else:
        pass

l = list(combinations(['M','A','R','C','H'],3))
# print(l)

x = 0
for t in l:
    x += ddict[t[0]]*ddict[t[1]]*ddict[t[2]]
print(x)

Measured memory_bytes: 88344
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e-9;
const ll MOD = 1000000007;

struct mint
{
  ll x;
  mint(ll x = 0) : x((x % MOD + MOD) % MOD) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= MOD)
      x -= MOD;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += MOD - a.x) >= MOD)
      x -= MOD;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime MOD
  mint inv() const { return pow(MOD - 2); }
  mint &operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream &operator>>(istream &is, const mint &a) { return is >> a.x; }
ostream &operator<<(ostream &os, const mint &a) { return os << a.x; }

int main()
{
  long long N;
  scanf("%lld", &N);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++)
  {
    scanf("%lld", &A[i]);
  }
  mint ans = 1;
  vector<int> cnt(3, 0);
  for (int i = 0; i < N; ++i)
  {
    ans *= count(cnt.begin(), cnt.end(), A[i]);
    cnt[find(cnt.begin(), cnt.end(), A[i]) - cnt.begin()]++;
  }
  cout << ans << endl;

  return 0;
}


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

typedef long long int64;

int main() {
// #ifndef ONLINE_JUDGE
//     freopen("a.in", "r", stdin);
//     freopen("a.out", "w", stdout);
// #endif

    int n, m, a, b;

    scanf("%d %d %d %d", &n, &m, &a, &b);
    printf("%d\n", n * m - a * m - b * n + a * b);
    return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using namespace std;
constexpr int inf = 1<<30;
constexpr int mo = 1e9+7;
constexpr ll infl = 1ll<<60;
constexpr int mo2 = 998244353;

ll modpow(ll a,ll n){
    ll ret = 1ll;
    while(n > 0){
        if(n&1)ret *= a;
        a *= a;
        n >>=1;
    }
    return ret;
}
int main(){
    cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    
    int n,k;
    cin>>n>>k;
    vector<pair<int,int>> v(k);
    for(auto & a:  v) cin>>a.first>>a.second,a.second++;
    vector<int> dp(n+1);
    dp[1] = 1;
    dp[2] = -1;
    for(int i=0;i<n;++i){
        (dp[i+1] += dp[i])%=mo2;
        for(int j=0;j<k;++j){
            if(i + v[j].first <= n) (dp[i+v[j].first] += dp[i])%=mo2;
            if(i + v[j].second <= n) (dp[i+v[j].second] +=mo2 - dp[i])%=mo2;
        }
    }
    
    cout << dp[n]%mo2 << endl;
    return 0;
    
}

Measured memory_bytes: 4000
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		sc.close();

		int max = (n - 1) * (n - 2) / 2;
		if (k > max) {
			System.out.println(-1);
			return;
		}

		int m = n - 1;
		int plus = max - k;
		m += plus;
		System.out.println(m);
		for (int i = 2; i <= n; i++) {
			System.out.println("1 " + i);
		}

		int cnt = 0;
		label:
		for (int i = 2; i <= n - 1; i++) {
			for (int j = i + 1; j <= n; j++) {
				if (cnt < plus) {
					System.out.println(i + " " + j);
					cnt++;
				} else {
					break label;
				}
			}
		}
	}
}


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


int main(){
	const int MAX_N = 2e5 + 10;
	int N;
	pair<int, int> p[MAX_N];
	cin >> N;
	for (int i = 0; i < N; ++i){
		int a,b;
		cin >> a >> b;
		p[i] = make_pair(b,a);
	}
	sort(p, p+N);

	int t = 0;
	bool ans = true;
	for (int i = 0; i < N; ++i){
		t += p[i].second;
		if (t > p[i].first) {
			ans = false;
			break;
		}
	}
	cout << (ans ? "Yes" : "No") << endl;
}


Measured memory_bytes: 1792
N, X, M = map(int, input().split())

ans = 0
C = [0]
Xd = [-1] * (M+1)

for i in range(N):
    x = X if i==0 else x**2 % M
    
    if Xd[x] > -1:
        break
    Xd[x] = i
    ans += x
    C.append(ans)

loop_len = i - Xd[x]
if loop_len > 0:
    S = C[i] - C[Xd[x]]
    loop_num = (N - i) // loop_len
    ans += loop_num * S
    m = N - loop_num * loop_len - i
    ans += C[Xd[x]+m] - C[Xd[x]]

print(ans)

Measured memory_bytes: 68564
#include <iostream>

int main() {
  unsigned long w, h, x, y;
  std::cin >> w >> h >> x >> y;

  const double half_area = w / 2.0 * h;
  if (x * 2 == w && y * 2 == h) {
    std::cout << half_area << " 1" << std::endl;
  } else {
    std::cout << half_area << " 0" << std::endl;
  }

  return 0;
}


Measured memory_bytes: 256
N = int(input())
Al = list(map(int,input().split()))
Al.sort()
Bl = []

if N % 2 == 0:
  for i in range(1,N+1,2):
    Bl.append(i)
    Bl.append(i)

else:
  Bl.append(0)
  for i in range(2,N+1,2):
    Bl.append(i)
    Bl.append(i)

if Al != Bl:
  print(0)
else:
  print(2 ** (N // 2) % ((10 ** 9) + 7))


Measured memory_bytes: 14008
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int h,w;
  cin >>h>>w;
  int i,j,k,l;
  vector<string> vec(h);
  for( i=0; i<h; i++) cin>>vec.at(i);
  for( j=0; j<w+2;j++) cout<<"#";//いち番上を#で埋める
  cout << endl;//改行
  for(k=0;k<h;k++){
    cout<<"#"<< vec.at(k)<<"#"<<endl;
  }//H行の出力
  for(i=0;i<w+2;i++) cout << "#";
  cout << endl;
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

struct edge{
    int from,to;
    int64_t cost;
    bool operator<(const edge &other)const{
        return cost<other.cost;
    }
};

class union_find{
	private:
	vector<int> parent,rank,gs;
    int size;
	public:
    int count_group;
    union_find()=default;
    union_find(int n){ init(n); }
    void init(int n){
		size=n;
		count_group=n;
		parent.resize(size);
		rank.assign(size,0);
        gs.assign(size,1);
		for(int i=0; i<size; ++i) parent[i]=i;
	}
	int find(int x){
		if(parent[x]==x) return x;
		else return parent[x]=find(parent[x]);
	}
	void unite(int x,int y){
		x=find(x);
		y=find(y);
		if(x==y) return;
		if(rank[x]<rank[y]){
			parent[x]=y;
            gs[y]+=gs[x];
		} else {
			parent[y]=x;
            gs[x]+=gs[y];
			if(rank[x]==rank[y]) ++rank[x];
		}
		--count_group;
	}
	bool is_same_group(int x,int y){
		return find(x)==find(y);
	}
    int group_size(int x){
        return gs[find(x)];
    };
};

void solve(){
    int n,q;
    cin >> n >> q;
    vector<edge> edges;
    vector<int64_t> cost(n,inf64);
    rep(i,0,q){
        int a,b;
        int64_t c;
        cin >> a >> b >> c;
        edges.push_back(edge({a,b,c}));
        cost[a]=min(cost[a],c+1);
        cost[b]=min(cost[b],c+2);
    }
    rep(i,0,n*2) cost[i%n]=min(cost[i%n],cost[(i-1+n)%n]+2);
    rep(i,0,n) edges.push_back(edge({i,(i+1)%n,cost[i]}));

    sort(edges.begin(),edges.end());
    union_find uf(n);
    int64_t ans=0;
    for(edge &e:edges){
        if(uf.is_same_group(e.from,e.to)) continue;
        uf.unite(e.from,e.to);
        ans+=e.cost;
    }
    cout << ans << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}


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

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

    int d, t, s;
    cin >> d >> t >> s;
    bool ok = d <= s * t;

    cout << (ok ? "Yes" : "No") << '\n';

    return 0;
}


Measured memory_bytes: 3648
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

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

	int N;
	string S;
	cin >> N >> S;

	int ans = 0;
	int pos = 0;
	while( (pos = S.find( "ABC", pos )) != string::npos ) {
		pos += 3;
		ans += 1;
	}

	cout << ans << endl;

	return 0;
}


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

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

inline void write(int x)
{
    if(x<0)
    {
        putchar('-');
        x=-x;
    }
    if(x>9)
        write(x/10);
    putchar(x%10+'0');
}
ll arr[1000000];
ll brr[1000000];
ll crr[1000000];
char cc[1000000];
int main()
{
  ll a, b;a =read(),b=read();
  ll sum = a*b/__gcd(a,b);
  cout<<sum<<endl;
    return 0;
}


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

int main() {
  string n;
  cin >> n;
  bool flag = false;
  rep(i, 3) {
    if(n.at(i) == '7') flag = true;
  }
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3580
def insert(st):
    if st[0]=="A":
        return 0
    elif st[0]=="C":
        return 1
    elif st[0]=="G":
        return 2
    else:
        return 3
 
def finder(li,st):
    serach=insert(st)
    return "yes" if st in li[serach] else "no"
 
n=int(input())
dic=[set() for _ in range(4)]
for i in range(n):
    s,c=input().split()
    if s[0]=="i":
        dic[insert(c)].add(c)
    else:
        print(finder(dic,c))


Measured memory_bytes: 31088
#include<stdio.h>
#include<set>
#include<string.h>
#include<iostream>
using namespace std;
int main() {
	int n;
	scanf("%d",&n);
	set<int>st;
	for(int i=0; i<n; i++) {
		int x;;
		cin>>x;
		if(st.count(x))
		{
			st.erase(x);
		}
		else 
		st.insert(x);
	}
	cout<<st.size()<<endl;
	return 0;
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
 
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);
 
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;
 
constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433;
 
template <class T> vector<T> multivector(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto multivector(size_t N,T... t){return vector<decltype(multivector(t...))>(N,multivector(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

int main() {
    set<int> st;
    int A,B, C; cin >> A >> B >> C;
    st.insert(A);
    st.insert(B);
    st.insert(C);
    Yn(st.size()==2);

    return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
std = []
for _ in range(m):
  a, b, c = map(int, input().split())
  a -= 1
  b -= 1
  std += [[a, b, -c]]

def bellman_ford(s):
  # std = [[s0, t0, d0], [s1, t1, d1], ... , [sm, tm, dm]]
  # (si, ti, di): si, ti間に重さdiの辺がある
  dist = [float('inf')]*n 
  dist[s] = 0
  for u in range(n):
    for s, t, d in std:
      if dist[t] > dist[s] + d:
        dist[t] = dist[s] + d
        if u == n-1 and t == n-1:
          return -1
  return dist

dist = bellman_ford(0)
if dist != -1:
  print(-dist[n-1])
else:
  print('inf')

Measured memory_bytes: 45800
_,*s=open(i:=0)
t='.'
b=t*101
q=range(101)
for s in s:
 a=[i];i+=1
 for x,y,z,c in zip(b,t+s,s,q):a+=min(c+(t>z<x),a[-1]+(t>z<y)),
 b,q=s,a[1:]
print(a[-2])

Measured memory_bytes: 8996