akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

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






std::vector<long long> fact_inv, fact;

long long power(long long a, unsigned long long b, long long m){
    long long ret(1);
    while(b){
        if(b & 1) ret = (ret * a) % m;
        a = (a * a) % m;
        b /= 2;
        if(ret < 0) ret += m;
        if(a < 0) a += 0;
    }
    return ret;
}

long long power(long long a, unsigned long long b) {
    return power(a, b, MOD);
}

long long inv(long long a, long long m){ // GCD(a, m) = 1
    return power(a, m-2, m);
}

long long inv(long long a){
    return inv(a, MOD);
}

long long comb(long long a, long long b, long long m){
    if(a < b) return 0;
    if(a < 0 || b < 0) return 0;
    long long ret = fact[a];
    ret = ret * fact_inv[b] % m;
    ret = ret * fact_inv[a-b] % m;
    return ret;
}

long long comb(long long a, long long b){
    return comb(a, b, MOD);
}

void precom(int n, long long m){
    fact.resize(n);
    fact_inv.resize(n);
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    for(int i = 2; i < n; ++i) fact[i] = fact[i-1] * i % m;
    for(int i = 2; i < n; ++i) fact_inv[i] = inv(fact[i], m);
    return;
}

void precom(int n){
    precom(n, MOD);
    return;
}


int main(){
    int N, M; std::cin >> N >> M;
    precom(M + 4);
    long long ans(fact[M] * fact_inv[M-N] % MOD);
    long long s(ans);
    for(int i(1); i <= N; ++i){
        int a((i % 2) ? 1 : -1);
        long long c(fact[M-i] * fact_inv[M-N] % MOD);
        c *= comb(N, i);
        ans -= a * (c % MOD);
        ans %= MOD;
        if(ans < 0) ans += MOD;
    }
    ans *= s;
    ans %= MOD;
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 10984
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD	1000000007
#define int	long long
#define pii pair<int,int> 
#define vi vector<int>
using namespace std;

int power(int a, int b){ int S = 1; while(b--)S *= a; return S;}

int32_t main(){
	int n, m;
	cin >> n >> m;
	if(n == m){
		cout << "Yes";
	}
	else{
		cout << "No";
	}

	return 0;
}



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

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

  bool same = false;
  if (S[2] == S[3] && S[4] == S[5]) same = true;
  cout << (same ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
def main():
  N=int(input())
  D=[0]*(10**6+1)

  for a in sorted(map(int,input().split())):
    if D[a]==0:
      D[a]=1
      for i in range(2*a,10**6+1,a):
        D[i]=-1
    else:
      D[a]=-1

  print(D.count(1))

main()


Measured memory_bytes: 40188
#include <iostream>   // std::cout, std::endl;
#include <algorithm>  // std::sort, std::unique
#include <vector>     // std::vecto
using namespace std;

void sortAndErase(vector<int>& vec) {
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

int main() {
   
    int n;
    cin >> n;
   
    vector<int> mochi(n);
    for(int i=0; i<n; ++i) {
        cin >> mochi.at(i);
    }
    
    sortAndErase(mochi);
    
    cout << mochi.size() << endl;
    
}

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

typedef long long ll;
typedef pair<ll, ll> P;


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    rep(i, 5) {
        int x; cin >> x;
        if(x == 0) cout << i+1 << endl;
    }
    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

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

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

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 3624
import java.util.Scanner;


class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true){
            int x = sc.nextInt();
            int y = sc.nextInt();
            if ( x == 0 && y == 0 ) {
                break;
            } else {
                if(x >= y){
                    System.out.println(y + " " + x);
                } else {
                     System.out.println(x + " " + y);
                }
            }
        }
    }
}


Measured memory_bytes: 34884
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
typedef pair<ll,string> Pls;
const ll INF=10000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct pos{
	// 1 変数を入れる;
	ll x,cost;
};
P1 t[100001]={};
int main() {

	int n;
	cin>>n;
	rep(i,n){
		ll x,l;
		cin>>x>>l;
		t[i].first=x+l;
		t[i].second=x-l;
	}
	sort(t,t+n);
	int a=1;
	ll c=t[0].first;
	for(int i=1; i<n; i++){
		if(c<=t[i].second){
			c=t[i].first;
			a++;
		}
	}
  	cout<<a<<endl;
	return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<set>
#include<iomanip>
#include<functional>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<ll,ll>P;

const ll INF=2e9;
int main()
{
    int n;
    cin>>n;
    vector<ll> w(n);
    ll amount=0;
    rep(i,n)
    {
        cin>>w[i];
        amount+=w[i];
    }
    for(int i=1;i<n-1;i+=2)
    {
        amount-=2*w[i];
    }
    ll ans=amount;
    cout<<ans<<endl;
    for(int i=1;i<n;i++)
    {
        ans=2*w[i-1]-ans;
        cout<<ans<<endl;
    }
    
    
}   

Measured memory_bytes: 2048
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline



def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    print N ** 3


if __name__ == '__main__':
    main()


Measured memory_bytes: 2932
#include <iostream>
#include <utility>
#include <cstdio>
using namespace std;

void insertionSort(int A[], const int n, const int g, int *cnt)
{
    for( int i = g; i < n; ++i ){
        int tmp = A[i];
        int j = i - g;
        while( -1 < j && tmp < A[j] ){
            //cout << A[j+g] << "<-->" << A[j] << endl;
            A[j+g] = A[j];
            j = j - g;
            ++*cnt;
        }
        A[j+g] = tmp;
    }
}

void shellSort(int A[], const int n)
{
    int cnt = 0;
    int m;
    int G[100];
    for( int i = 0; i < 100; ++i ){
        if( i == 0 ) G[i] = n / 2 + 1;
        else G[i] = G[i-1] / 2 - 1;
        if( G[i] < 0 ){
            G[i-1] = 1;
            G[i] = 0;
            m = i;
            break;
        }
    }

    for( int i = 0; i < m; ++i )
        insertionSort(A, n, G[i], &cnt);

    //??????
    printf("%d\n", m);
    for( int i = 0; i < m; ++i ){
        if( i ) printf(" ");
        printf("%d", G[i]);
    }
    printf("\n%d\n", cnt);
    for( int i = 0; i < n; ++i )
        printf("%d\n", A[i]);
}

int main()
{
    //??\???
    int n;
    scanf("%d", &n);
    int A[n];
    for( int i = 0; i < n; ++i )
        scanf("%d", &A[i]);

    //?????§????????????
    shellSort(A, n);

    return 0;
}

Measured memory_bytes: 7084
N,Y = map(int, input().split())
A = []
for i in range(N+1):
    if A != []:
        break
    else:
        for j in range(N+1-i):
            if A != []:
                break
            elif 10000*i + 5000*j + 1000*(N-i-j) == Y:
                A = [i,j,N-i-j]
                break
            elif 10000*i + 5000*j + 1000*(N-i-j) > Y:
                break
if A != []:
    print('{} {} {}'.format(A[0],A[1],A[2]))
else:
    print('{} {} {}'.format(-1,-1,-1))

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

int main()
{
    string S,T;
    cin>>S>>T;
    int count=0;
    for(int i=0;i<S.size();i++)
    {
        if(S[i]!=T[i])
        {
            count++;
        }
    }
    cout<<count;
}

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

struct UnionFind {
  vector<int> par, size;
  UnionFind (int n) {
    par.resize(n);
    size.resize(n);
    for (int i = 0; i < n; i++) {
      par[i] = i, size[i] = 1;
    }
  }
  int find(int x) {
    if (par[x] == x) return x;
    return par[x] = find(par[x]);
  }
  bool unit(int x, int y) {
    x = find(x), y = find(y);
    if (x == y) return false;
    if (size[x] > size[y]) {
      par[y] = x, size[x] += size[y];
    } else {
      par[x] = y, size[y] += size[x];
    }
    return true;
  }
  bool same(int x, int y) {
    return find(x) == find(y);
  }
};

int main() {
  ios::sync_with_stdio(false);
  int N, M, K;
  cin >> N >> M >> K;
  UnionFind UF(N);
  vector<int> V(N);
  for (int i = 0, A, B; i < M && cin >> A >> B; i++) {
    UF.unit(--A, --B);
    V.at(A)++, V.at(B)++;
  }
  for (int i = 0, C, D; cin >> C >> D; i++) {
    if (UF.same(--C, --D)) V.at(C)++, V.at(D)++;
  }
  for (int i = 0; i < N; i++) {
    cout << UF.size.at(UF.find(i)) - 1 - V.at(i) << "\n";
  }
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;
/*
         ########     ########   ########   #########   ##       #######   ##       #######
         #      #     #      #   #      #       #       # #      #     #   # #      #     #
         #      #     #      #   #      #       #       #  #     #     #   #  #     #     #
         ########     #      #   #      #       #       #   #    #     #   #   #    #     #
         ###          #      #   #      #       #       #    #   #######   #    #   #######
         #  #         #      #   #      #       #       #   #    #     #   #   #    #     #
         #   #        #      #   #      #       #       #  #     #     #   #  #     #     #
         #    #       #      #   #      #       #       # #      #     #   # #      #     #
         #     #      ########   ########       #       ##       #     #   ##       #     #
*/

#define rep(i, a, b) for (__typeof((b)) i = (a); i < (b); i++)
#define nrep(i, a, b) for (__typeof((b)) i = (a); i > (b); i--)
#define all(a) (a).begin(), (a).end()
#define ff first
#define ss second
#define ppi pair<int, int>
#define pppi pair<ppi, int>
#define vi vector<int>
#define vii vector<ppi>
#define viii vector<pppi>
#define vs vector<string>
#define pb push_back
#define bitcount __builtin_popcountll //count no's of ones in a set bit
#define prq priority_queue
#define mp make_pair
#define mem(x, val) memset((x), (val), sizeof(x));
#define sz(x) (int)x.size()
#define M_PI 3.14159265358979323846
#define rootdada                      \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);
#define test  \
    int t;    \
    cin >> t; \
    while (t--)
#define debug(a)          \
    cerr << #a << ": ";   \
    for (auto i : a)      \
        cerr << i << " "; \
    cerr << '\n';
#define trace(a) cerr << #a << ": " << a << "\n"
#define print(ar, n)            \
    for (int u = 0; u < n; u++) \
    {                           \
        cout << ar[u] << " ";   \
    }                           \
    cout << endl;
#define int long long
#define M 1000000007
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
signed main()
{
	rootdada;
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
#endif
	int n;
	cin >> n;
	pair<int, int> p[n];
	rep(i, 0, n)
	{
		cin >> p[i].ff >> p[i].ss;
	}
	int ans = 0;
	int flg = 0;
	rep(i, 0, n)
	{
		if (p[i].ff == p[i].ss && ans < 3)
			ans++;
		if (p[i].ff != p[i].ss)
		{
			ans = 0;
		}
		if (ans >= 3)
		{
			cout << "Yes\n";
			flg = 1;
			break;
		}

	}
	if (!flg)
		cout << "No\n";
}

Measured memory_bytes: 3636
n, k = map(int, input().split())
P = list(map(int, input().split()))
ans = 0
E = []

for p in P:
    E.append(p*(p+1)/(2*p))

cumsumE = [0]
for e in E:
    cumsumE.append(cumsumE[-1] + e)

for i in range(0, n+1-k):
    ans = max(ans, cumsumE[i+k]-cumsumE[i])
print(ans)

Measured memory_bytes: 33724
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N):
    cand = set(a * b for a, b in combinations_with_replacement(range(1, 10), 2))
    if N in cand:
        return 'Yes'
    return 'No'


def main():
    N = read_int()
    print(slv(N))


if __name__ == '__main__':
    main()


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

int main() {
  int n;
  int64_t inf = 100000000000LL;
  cin >> n;
  vector<int> h(n);
  rep(i,n) {
    cin >> h[i];
  }
  vector<int64_t> dp(n,inf);
  dp[0]=0LL;
  dp[1]=abs(h[1]-h[0]);
  for (int i = 2;i < n;i++){
    dp[i]=min(abs(h[i]-h[i-1])+dp[i-1],abs(h[i]-h[i-2])+dp[i-2]);
  }
  cout << dp[n-1]<<endl;
  return 0;
}


Measured memory_bytes: 1408
/*------U Have To DO It------*/
/* BY-> RicoProg */
/*        ___ 
           __|__|
          |  |___       */
#include <bits/stdc++.h>
using namespace std;
 
 
//---------------------------------------------------MACROS----------------------------------------------------------
#define ll long long
#define ld long double
#define beg(i ,n) for(ll i=0;i<n;i++)
#define beg1(i ,n) for(ll i=1;i<n;i++)
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define pb push_back 
#define mp make_pair
#define nl "\n" 
#define vec(v , n) vector<ll> v(n)
#define all(x) x.begin() , x.end()
#define pii pair<int , int>
#define pll pair<ll , ll>
#define mii map<int , int>
#define mll map<ll , ll>
#define msi map<string , int>
#define mci map<char , int>
#define f1 first
#define f2 second

//---------------------------------------------------GLOBAL----------------------------------------------------------
const ll MOD = 1e9 + 7 ;
const ll MAX = 1e5 + 7 ;
const ll inf = 1e18 + 5 ;

//---------------------------------------------------FUNCTIONS-------------------------------------------------------

const ll nax = 3e3 + 5 ;
ll dp[nax][nax], pre[nax] ;

void add_self(ll &a , ll b){
	a+=b ;
	if(a>=MOD) a-=MOD ;
}

void solve(){
	ll n , temp ;
	string s ;
	cin >> n >> s ;
	dp[1][1] = 1 ;
	pre[1] = 1 ;
	for(int i=2 ; i<=n; ++i) add_self(pre[i] , pre[i-1]) ;
	for(int index=2 ; index<=n ; ++index){
		for(int next=1 ; next<=index ; ++next){
			if(s[index-2]=='>'){
				temp = pre[index] - pre[next-1] ;
				if(temp<0) temp+=MOD ;
			}
			else{
				temp = pre[next-1] - pre[0] ;
				if(temp<0) temp+=MOD ;
			}
			add_self(dp[index][next] , temp) ;
		}
		for(int next=1 ; next<=n ; ++next){
			pre[next] = 0 ;
			add_self(pre[next] , pre[next-1] + dp[index][next]) ;
		}
	}
	ll answer = 0 ;
	for(int i=1 ; i<=n ; ++i){
		add_self(answer , dp[n][i]) ;
	}
	cout << answer ;
}

//---------------------------------------------------DRIVER----------------------------------------------------------
int main()
{
    fast ;
    int t=1 ;
    //scanf("%lld" , &t) ;
    while(t--){
        solve() ;
        //cout << "A" << nl ;
    }
    return 0;
}   


Measured memory_bytes: 69120
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

	public void Proc()
	{
        int inutCount = int.Parse(Reader.ReadLine());

        Dictionary<long, bool> dic = new Dictionary<long, bool>();
        for (int i = 0; i < inutCount; i++) {
            long num = long.Parse(Reader.ReadLine());
            if(dic.ContainsKey(num)) {
                dic[num] = !dic[num];
            } else {
                dic[num] = true;
            }
        }
        Console.WriteLine(dic.Count(a=>a.Value));
        


	}


	public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"
 
 
6
12
22
16
22
18
12


 
";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}


Measured memory_bytes: 21216
#include<iostream>
#include<stdio.h>
using namespace std;

 
int main(){
	int a,b,c,d,x,y;
	cin>>a>>b>>c>>d;
	x=a*b;
	y=c*d;
	if ((a>=1)&&(a<=10000))
	if ((b>=1)&&(b<=10000))
	if ((c>=1)&&(c<=10000))
	if ((d>=1)&&(d<=10000))
	if(x>y)
	
	cout<<x;
	else if(y>x)
	cout<<y;
	else
	cout<<x;
	return 0;
}
	
	

Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <iostream>

using namespace std;

int n;
string str[31][6];

bool roll(int x,int y){
	bool flag2=false;
	for(int i=0;i<4;i++){
		string st=str[y][1];
		str[y][1]=str[y][2];
		str[y][2]=str[y][4];
		str[y][4]=str[y][3];
		str[y][3]=st;
		bool flag=true;
		for(int j=0;j<6;j++){
			if(str[y][j]!=str[x][j])flag=false;
		}
		if(flag)flag2=true;
	}
	return flag2;
}

bool check(int x,int y){
	bool flag=true;
	if(roll(x,y))flag=false;
	for(int i=0;i<4;i++){
		string st=str[y][0];
		str[y][0]=str[y][2];
		str[y][2]=str[y][5];
		str[y][5]=str[y][3];
		str[y][3]=st;
		if(roll(x,y))flag=false;
	}
	for(int i=0;i<4;i++){
		string st=str[y][0];
		str[y][0]=str[y][1];
		str[y][1]=str[y][5];
		str[y][5]=str[y][4];
		str[y][4]=st;
		if(roll(x,y))flag=false;
	}
	return flag;
}

int main(void){
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		for(int i=0;i<n;i++){
			for(int j=0;j<6;j++){
				cin >> str[i][j];
			}
		}
		int cnt=0;
		for(int i=0;i<n;i++){
			bool flag=true;
			for(int j=0;j<i;j++){
				if(!check(i,j))flag=false;
			}
			if(flag)cnt++;
		}
		printf("%d\n",n-cnt);
	}
	return 0;
}

Measured memory_bytes: 1260
#include<stdio.h>
int main(){
  int x,k,i;
  scanf("%d%d",&k,&x);
  if(x-k+1>=-1000000 && x+k-1<=1000000){
    for(i=x-k+1; i<=x+k-1; i++){
      printf("%d ",i);
    }
    printf("\n");
  }
  else if(x-k+1>=-1000000){
    for(i=x-k+1; i<=1000000; i++){
      printf("%d ",i);
    }
    printf("\n");
  }
  else{
    for(i=-1000000; i<=x+k-1; i++){
      printf("%d ",i);
    }
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define N 100
int G[N][N];
int n;

int prim()
{
    int visited[n];
    int d[n];
    int p[n];

    for (int i; i < n; i++)
    {
        visited[i] = 0;
        d[i] = 114514;
    }

    d[0] = 0;
    p[0] = -1;

    while (true)
    {
        int mincost = 114514;
        int u;
        for (int i = 0; i < n; i++)
        {
            if (!visited[i] && d[i] < mincost)
            {
                mincost = d[i];
                u = i;
            }
        }

        if (mincost == 114514)
            break;

        visited[u] = 1;

        for (int i = 0; i < n; i++)
        {
            if (!visited[i] && G[u][i] != -1)
            {
                if (G[u][i] < d[i])
                {
                    d[i] = G[u][i];
                    p[i] = u;
                }
            }
        }
    }

    int sum = 0;
    for (int i = 1; i < n; i++)
        sum += d[i];
    return sum;
}

int main()
{
    cin >> n;
    int a;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            cin >> a;
            if (a == -1)
                G[i][j] = 114514;
            else
                G[i][j] = a;
        }
    }
    cout << prim() << endl;
}


Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace template
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var a = cin.ReadInt;
            var b = cin.ReadInt;

            Console.WriteLine(Lcm(a, b));
        }

        // 最小公倍数
        public static long Lcm(long a, long b) {
            return a / Gcd(a, b) * b ;
        }

        // ユークリッドの互除法 
        public static long Gcd(long a, long b) {
            if (a < b)
                // 引数を入替えて自分を呼び出す
                return Gcd(b, a);
            while (b != 0) {
                var remainder = a % b;
                a = b;
                b = remainder;
            }
            return a;
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) 
                {
                    return inputStream.Dequeue();
                }

                string[] tmp = _stream.ReadLine().Split(_separator);
                
                for (int i = 0; i < tmp.Length; ++i)
                {
                    inputStream.Enqueue(tmp[i]);
                }
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}


Measured memory_bytes: 13268
#include <iostream>

using namespace std;

int main() {
  char a, b;
  cin >> a >> b;
  
  const char honest = 'H';
  const char lier = 'D';
  char answer;

  if (a == honest) {
    if (b == honest) {
      answer = honest;
    } else {
      answer = lier;
    }
  } else {
    if (b == honest) {
      answer = lier;
    } else {
      answer = honest;
    }
  }

  cout << answer << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod 100000007
#define rep(i, n) for (int i = 0; i < n; ++i)
ll lcm(ll a, ll b)
{
    return a * b / __gcd(a, b);
}

int main()
{
    int N, M;
    cin >> N >> M;
    cout << (N - 1) * (M - 1) << endl;
}


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

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

using P = pair<int, int>;

static const long long MOD = 1000000007;
static const long long LINF = (ll)(1e18+99);
static const int INF = 1e9+99;

int ans = INF;
int R[200005], W[200005];

int main(void) {
    int N;
    string c = "X", t;
    
    cin >> N >> t;
    c += t;
    rep(i, 1, N+1) {
        R[i] = R[i-1] + (c[i]=='R');
        W[i] = W[i-1] + (c[i]=='W');
    }

    rep(i, 0, N+1) {
        int r_R = R[N] - R[i];
        int l_W = W[i];
        int tmp = min(l_W, r_R);
        l_W -= tmp;
        r_R -= tmp;
        int sum = tmp;
        sum += l_W+r_R;
        ans = min(ans, sum);
    }


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



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

using namespace std;
#define ll long long
int h,w;
int lr[2005][2005],ud[2005][2005];

int main() {
    //freopen("262144.in", "r", stdin);
    //freopen("262144.out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>h>>w;
    for(int i=0;i<h;i++){
        string s;
        cin>>s;
        for(int j=0;j<w;j++){
            if(s[j]=='.'){
                lr[i][j]=1;
                ud[i][j]=1;
            }
            else{
                lr[i][j]=0;
                ud[i][j]=0;
            }
        }
    }
    for(int i=0;i<h;i++){
        int cur=0;
        for(int j=0;j<w;j++){
            if(lr[i][j]){
                cur++;
                lr[i][j]=cur;
            }
            else{
                cur=0;
            }
        }
    }
    for(int i=0;i<h;i++){
        int cur=0;
        for(int j=w-1;j>=0;j--){
            if(lr[i][j]==0){
                cur=0;
            }
            else{
                cur=max(cur,lr[i][j]);
                lr[i][j]=cur;
            }
        }
    }
    for(int i=0;i<w;i++){
        int cur=0;
        for(int j=0;j<h;j++){
            if(ud[j][i]){
                cur++;
                ud[j][i]=cur;
            }
            else{
                cur=0;
            }
        }
    }
    for(int i=0;i<w;i++){
        int cur=0;
        for(int j=h-1;j>=0;j--){
            if(ud[j][i]==0){
                cur=0;
            }
            else{
                cur=max(cur,ud[j][i]);
                ud[j][i]=cur;
            }
        }
    }
    int mx=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            mx=max(mx,lr[i][j]+ud[i][j]-1);
        }
    }
    cout<<mx<<endl;
    return 0;
}


Measured memory_bytes: 31616
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(){

    int H, W;
    cin >> H >> W;

    char map[H][W];
    for(int x = 0; x < H; x++){
        for(int y = 0; y < W; y++){
            cin >> map[x][y];
        }
    }
    for(int y = 0; y < W + 2; y++){
        cout << "#" ;
    }
    cout << endl;
    for(int x = 0; x < H; x++){
        cout << "#" ;
        for(int y = 0; y < W; y++){
            cout << map[x][y];
        }
        cout << "#" << endl;
    }
    for(int y = 0; y < W + 2; y++){
        cout << "#" ;
    }
    cout << endl;



}

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

int main() {
  long long P , X ;
  cin >> X ; 
  int Y=0 ; 
  P=100 ; 
  
  while (P < X){
    P += P/100 ; 
    Y++ ; 
  }
  
  
  cout << Y << endl ; 
  
  
  
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;using ll=long long;using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;using vpl=vector<PL>;
constexpr const int INF=1<<30,MOD=1000000007;constexpr const ll LINF=1ll<<60;
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...)_ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n)for(int i=n-1;i>=0;--i)
#define REPA(i,v)REP(i,v.size())
#define all(v)(v).begin(),(v).end()
#define bit(n)(1ll<<(n))
#define uniq(v)sort(all(v));v.erase(unique(all(v)),v.end())
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b)cout<<((n)?a:b)<<endl
void YES(int n){cho(n,"YES","NO");}void Yes(int n){cho(n,"Yes","No");}void Poss(int n){cho(n,"Possible","Impossible");}
#ifndef LOCAL
struct osd{template<class T>osd&operator<(const T&t){return*this;}template<class T>osd&operator<<(const T&t){return*this;}};osd cer_;template<class...T>void _print(osd&a,T&&...t){}
#define cerr cer_
#endif
template<class T>ostream&operator<(ostream&o,const T&t){return o<<t;}template<class T>istream&operator>(istream&i,T&t){return i>>t;}
void _print(ostream&s){}template<class T,class...U>void _print(ostream&s,T&&t,U&&...u){s<t<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>void print(T&&...t){_print(cout,t...);}template<class...T>void dprint(T&&...t){_print(cerr,t...);}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&v){for(auto&&i:v)o<i<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>j;return i;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<p.F<' '<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>p.F>p.S;}
template<class T>ostream&operator<<(ostream&o,const set<T>&v){for(auto&&i:v)o<i<' ';return o;}
template<class T>vector<T>&operator<<(vector<T>&v,const T&t){v.push_back(t);return v;}
template<class T>queue<T>&operator<<(queue<T>&q,const T&t){q.push(t);return q;}template<class T>queue<T>&operator<<(T&t,queue<T>&q){t=q.front();q.pop();return q;}
template<class T>deque<T>&operator>>(const T&t,deque<T>&q){q.push_front(t);return q;}template<class T>deque<T>&operator<<(T&t,deque<T>&q){t=q.front();q.pop_front();return q;}
template<class T>deque<T>&operator<<(deque<T>&q,const T&t){q.push_back(t);return q;}template<class T>deque<T>&operator>>(deque<T>&q,T&t){t=q.back(t);q.pop_back();return q;}
template<class T>stack<T>&operator<<(stack<T>&s,const T&t){s.push(t);return s;}template<class T>stack<T>&operator>>(stack<T>&s,T&t){t=s.top();s.pop();return s;}

int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    int n,x;
    cin>n>x;
    vi l(n);
    cin>l;
    int c=0;
    int d=0;
    for(int i:l){
        c++;
        d+=i;
        if(d>x)break;
    }
    if(d<=x)c++;
    cout<c<endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <tuple>
template <typename T> constexpr T my_abs(const T &x) { return x < 0 ? -x : x; }
using ll = long long;
constexpr int MOD = 998244353;
inline int quick_pow(int a, int n)
{
	int res = 1;
	while (n)
	{
		if (n & 1)
			res = (ll)res * a % MOD;
		a = (ll)a * a % MOD;
		n >>= 1;
	}
	return res;
}
int fact[305], inv[305], arr[305][305], dp[305];
inline int C(int n, int m) { return (ll)fact[n] * inv[m] % MOD * inv[n - m] % MOD; }
int main()
{
	// freopen("yahoo2019-E.in", "r", stdin);
	// freopen("yahoo2019-E.out", "wt", stdout);
	int n, m, k = 0;
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
			scanf("%d", arr[i] + j);
	}
	fact[0] = inv[0] = 1;
	for (int i = 1; i <= m; i++)
	{
		fact[i] = (ll)fact[i - 1] * i % MOD;
		inv[i] = quick_pow(fact[i], MOD - 2);
	}
	for (int col = 0; col < m; col++)
	{
		int row = k;
		while (row < n && !arr[row][col])
			row++;
		if (row >= n)
			continue;
		std::swap(arr[row], arr[k]);
		for (int i = 0; i < n; i++)
		{
			if (!arr[i][col] || i == k)
				continue;
			for (int j = 0; j < m; j++)
				arr[i][j] ^= arr[k][j];
		}
		k++;
	}
	int ans = (ll)quick_pow(2, m - 1) * quick_pow(2, n) % MOD;
	ans = (ans - (ll)quick_pow(2, n - k) * quick_pow(2, m - 1)) % MOD;
	printf("%d\n", (ans + MOD) % MOD);
	return 0;
}


Measured memory_bytes: 512
N = input()
lst1 = list(map(int, input().split()))
lst2 = sorted(lst1)
 
n = 0
for x, y in zip(lst1, lst2):
    if x != y:
        n += 1
        if n > 2:
            break
 
if n > 2:
    print('NO')
else:
    print('YES')


Measured memory_bytes: 2940
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String atCoder = sc.next();
        String s = sc.next();
        String Contest = sc.next();
            System.out.println("A" + s.charAt(0) + "C");
        }        
    }



Measured memory_bytes: 21588
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

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

import fractions
import math

N,X=two_int()

city=many_int()

temp = list(map(lambda x : abs(x-X), city))


ans = temp[0]
for i in range(1,len(temp)):
    ans = fractions.gcd(ans,temp[i])
print(ans)

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

int main(){

int N,M;
cin >> N;
int T[N];
rep(i,N)cin >> T[i];

cin >> M;
int P[M];
int X[M];
rep(i,M)cin >> P[i] >> X[i];
int t[N];
rep(i,N)t[i] =T[i];
int sum,tem;

rep(i,M){
  sum=0;
  tem = P[i]-1;
  t[tem] = X[i];
  rep(j,N)sum+=t[j];
  cout << sum << endl;
  t[tem] =T[tem];
}

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;

int main(){
    char a;
    cin >> a;
    if(isupper(a)) cout << 'A' << endl;
    else cout << 'a' << endl;
    return 0;
}


Measured memory_bytes: 3556
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 1000000007ll
#define flagcount __builtin_popcount
#define flag(x) (1 << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1 << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define idx_lower(v, x) (distance(v.begin(), low2way(v, x)))  //配列vでx未満の要素数を返す
#define idx_upper(v, x) (distance(v.begin(), high2way(v, x))) //配列vでx以下の要素数を返す
#define idx_lower2(v, x) (v.size() - idx_lower(v, x))         //配列vでx以上の要素数を返す
#define idx_upper2(v, x) (v.size() - idx_upper(v, x))         //配列vでxより大きい要素の数を返す
#define putout(a) cout << a << endl
#define Gput(a, b) G[a].push_back(b)
#define Sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}
template <typename T>
T lcm(T x, T y)
{
    T z = gcd(x, y);
    return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    double sqrtn = sqrt(n);
    for (T i = 3; i < sqrtn + 1; i++)
    {
        if (n % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//2次元配列の宣言
//vector<vector<ll>> field(h, vector<ll>(w));

int main()
{
    cout << fixed << setprecision(30);
    ll n;
    cin >> n;
    vec a(n), b(n), c(n);
    loop(i, n) cin >> a[i] >> b[i] >> c[i];
    vector<vector<ll>> dp(n + 1, vector<ll>(3));
    loop(i, n)
    {
        dp[i + 1][0] = max(dp[i][1] + a[i], dp[i][2] + a[i]);
        dp[i + 1][1] = max(dp[i][0] + b[i], dp[i][2] + b[i]);
        dp[i + 1][2] = max(dp[i][0] + c[i], dp[i][1] + c[i]);
    }
    putout(max(dp[n][0], max(dp[n][1], dp[n][2])));
    return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define V vector<ll>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;


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

    V v(9, 0);

    rep(i, 0, n){
        int a; cin >> a;
        if(a < 400) v[0]++;
        else if(a < 800) v[1]++;
        else if(a < 1200) v[2]++;
        else if(a < 1600) v[3]++;
        else if(a < 2000) v[4]++;
        else if(a < 2400) v[5]++;
        else if(a < 2800) v[6]++;
        else if(a < 3200) v[7]++;
        else v[8]++;
    }

    int ans = 0;
    rep(i, 0, 8){
        if(v[i]) ans++; 
    }

    // みんな3200以上の場合も考慮
    cout << max(ans, 1) << " " << ans + v[8] << endl;
}

Measured memory_bytes: 256
s = input()
a, b, c = 0, 0, 0

for i in s:
    if i == "a" and a == 0:
        a += 1
    elif i == "b" and b == 0:
        b += 1
    elif i == "c" and c == 0:
        c += 1
    else:
        print("No")
        break
else:
    print("Yes")


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


int main(){
	int N;cin >> N;
	int ans = 1;
	while(ans * 2 <= N) ans *= 2;
	cout << ans << endl;
}












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

#define ull unsigned long long int
#define ll long long int

const ll M=1e9+7;

ll mod(ll n){
	return (n%M + M)%M;	
}
ll add(ll a, ll b){
	return mod(mod(a)+mod(b));
}
ll mul(ll a, ll b){
	return mod(mod(a)*mod(b));
}
ll modpow(ll x, ll n) 
{ 
	if (n == 0) 
		return 1%M;
	if (n == 1)
		return x%M; 
	ll u = modpow(x,n/2); 
	u = mul(u,u); 
	if (n%2) 
		u = mul(u,x); 
	return u; 
}
ll gcd(ll a,ll b){
	if(b==0)
		return a;
	return gcd(b,a%b);
}
bool isPrime(ll n){
	int end = sqrt(n);
	for(int i=2;i<=end;i++)
		if(n%i==0)
			return false;
	return true;
}
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    // freopen("inputf.txt","r",stdin);
    // freopen("outputf.txt","w",stdout);
    
    int t=1;

    while(t--){
    	int n;
    	cin>>n;

    	if(n)
    		cout<<"0"<<endl;
    	else
    		cout<<"1"<<endl;
    }

    
    return 0;
}


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

#define INF (int)1e9+7
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define vi vector<int>
#define vl vector<ll>
#define vii vector<vector<int>>
#define vll vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define N 100005
#define pb push_back
#define mp make_pair
#define PI 3.1415926535897932384626433832795



ll binPowM(ll a,ll b, ll m)
{ 
  ll ans=1;
  while(b>0)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }
return ans%m;
}
ll f(ll x,ll y,ll a)
{
  return (a&x)*(a&y);
}

int main()
{
ll n,cnt=0;cin>>n;
vector<ll>a(n+1);
for(int i=1;i<=n;i++)
{
    cin>>a[i];
    a[i]+=i;
}
map<ll,ll>m;
for(int i=1;i<=n;i++)
{
    m[2*i-a[i]]++;
}

for(int i=1;i<=n;i++)
{
  if(m.count(a[i]))cnt+=m[a[i]];
}
cout<<cnt<<"\n";
  return 0;
}





Measured memory_bytes: 16408
import math
import copy
# import numpy as np

# ===FUNCTION===

def getInputNum():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

a = getInputListInt()
min = a[0]
max = a[1]

ans_max = 2019
ans = ans_max

flg = False

for i in range(min, max):
    for j in range(i+1, max+1):
        tmp = (i*j) % ans_max

        if ans > tmp:
            ans = tmp

        if ans == 0:
            flg = True
            break

    if flg:
        break

print(ans)

Measured memory_bytes: 3432
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>

using namespace std;

#define sz(a) static_cast<int>((a).size())
#define f first
#define s second
#define els(v) for (auto &el : (v))


#ifdef KIRYA
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) {
    cerr << _s << " = " << _h << "\n";
}

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;

    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;

    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

const int64_t INF = static_cast<int64_t>(1e9) + 7;
const int64_t LINF = INF * INF;
const int MAXN = static_cast<int>(1e6) + 17;

void solve() {
    int n;
    cin >> n;
// vector<int> vec(n);
    int prev = 0, ans = 0, cur = 0;
    for (int i = 0; i < n; ++i) {
        int val;
        cin >> val;
        if (val <= prev) {
            ++cur;
        } else {
            cur = 0;
        }
        ans = max(ans, cur);
        prev = val;
    }
    cout << ans << '\n';
}

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

    int q = 1;

    for (int i = 0; i < q; ++i) {
        solve();
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define LEN 1000000

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head=1, tail=1, n;

void enqueue(P x){
  strcpy(Q[tail].name,x.name);
  Q[tail].t = x.t;
  if( tail + 1 == LEN )tail = 0;
  else tail++;

}

P dequeue(){
  P x;
  x = Q[head];
  if( head + 1 == LEN )head = 0;
  else head++;
  return x;
}


int main(){
  int elaps = 0, ans=0;
  int i, q, c=0, p_count=0;

  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    if( strlen(Q[i].name) > 10 ){
      printf("%s\n", Q[i].name);
      p_count++;
      break;
    }
    scanf("%d", &Q[i].t);
    enqueue(Q[i]);
  }
  
  while(1){
    c++;
    if( n == p_count )break;
    if( Q[c].t - q > 0 ){
      ans += q;
      Q[c].t -= q;
      enqueue(Q[c]);
    }    
    else{
      ans += Q[c].t;
      printf("%s %d\n", Q[c].name, ans);
      p_count++;
      Q[c] = dequeue();
    }
  }

  return 0;
}

Measured memory_bytes: 21516
#include <cstdio>

using namespace std;

int parse_int()
{
    int n = 0, c;
    while (1)
    {
        c = getchar_unlocked();
        if ('0' <= c && c <= '9')
            n = n * 10 + c - '0';
        else
            break;
    }
    return n;
}

template <size_t N>
struct Solver
{
    bool is_prime[N + 1];
    short ans[N + 1];
    constexpr Solver() : is_prime(), ans()
    {
        is_prime[0] = false;
        is_prime[1] = false;
        for (size_t i = 2; i <= N; i++)
        {
            is_prime[i] = true;
        }
        for (size_t prime = 2; prime <= N; prime++)
        {
            if (is_prime[prime])
            {
                for (size_t q = prime * 2; q <= N; q += prime)
                {
                    is_prime[q] = false;
                }
            }
        }
        for (size_t i = 1; i <= N; i++)
        {
            ans[i] += ans[i - 1];
            if (is_prime[i] && is_prime[(i + 1) / 2])
            {
                ans[i] += 1;
            }
        }
    }
};

int main()
{
    constexpr auto M = 100000;
    constexpr auto solver = Solver<M>();

    int Q = parse_int();
    for (size_t i = 0; i < Q; i++)
    {
        int l = parse_int();
        int r = parse_int();
        auto ans = solver.ans[r] - solver.ans[l - 1];
        printf("%d\n", ans);
    }
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll n;
    cin >> n;
    vll times(n);
    REP(i, n) cin >> times.at(i);
    ll m;
    cin >> m;
    vector<pair<ll, ll>> drinks(m);
    REP(i, m) {
        ll p, x;
        cin >> p >> x;
        drinks.at(i) = make_pair(p, x);
    }
    ll total = accumulate(ALL(times), 0);
    for (auto elem : drinks) {
        cout << total - times.at(elem.first-1) + elem.second << endl;
    }
    return 0;
}

Measured memory_bytes: 256