akhauriyash/Code-Regression huggingface dataset:
#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)
using Graph = vector<vector<int>>;
#define grepq priority_queue<double, std::vector<double>, std::greater<double>>
#define all(v) v.begin(),v.end()
ll INF = 10010001010;

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

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

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> A(M+2);
    vector<int> B(M+2);
    for (int i = 0; i < M;i++)
    {
        cin >> A[i] >> B[i];
    }
    for (int i = 1; i <= N;i++)
    {
        int ans = 0;
        for (int j = 0; j < M;j++)
        {
            if(A[j] == i|| B[j] == i){
                ans++;
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
n=int(input())
f=[list(map(int,input().split())) for i in range(n)]
p=[list(map(int,input().split())) for i in range(n)]
ans=float("-inf")
for i in range(1,2**10):
    i=list(map(int,list(bin(i)[2:].zfill(10))))
    x,y=0,0
    for j in range(n):
        y=0
        for k in range(10):
            if i[k]==f[j][k]==1:y+=1
        x+=p[j][y]
    ans=max(ans,x)
print(ans)

Measured memory_bytes: 3188
import java.util.Arrays;
import java.util.Scanner;

public class Main {
  Scanner sc;

  class Team implements Comparable<Team> {
    int id;
    int[] wc;
    int ac;
    int pn;

    Team(int id, int p) {
      this.id = id;
      wc = new int[p + 1];
      ac = 0;
      pn = 0;
    }

    void c(int pid, int time) {
      ++ac;
      pn += time + wc[ pid ] * 1200;
    }

    void w(int pid) {
      ++wc[ pid ];
    }

    @Override
    public int compareTo(Team o) {
      if ( ac > o.ac ) {
        return -1;
      } else if ( ac < o.ac ) {
        return 1;
      } else {
        if ( pn < o.pn ) {
          return -1;
        } else if ( pn > o.pn ) {
          return 1;
        } else {
          return id - o.id;
        }
      }
    }

  }

  void run() {
    for ( ;; ) {
      int t, p, r;
      t = ni();
      p = ni();
      r = ni();

      if ( ( t | p | r ) == 0 ) {
        break;
      }

      Team[] teams = new Team[t + 1];
      teams[0] = new Team(0, 0);
      teams[0].ac = -1;
      for ( int i = 1; i <= t; ++i ) {
        teams[ i ] = new Team( i, p );
      }

      for ( int i = 0; i < r; ++i ) {
        int tid = ni();
        int pid = ni();
        int time = ni();
        char c = sc.next().toCharArray()[ 0 ];
        if ( c == 'C' ) {
          teams[ tid ].c( pid, time );
        } else {
          teams[ tid ].w( pid );
        }
      }

      Arrays.sort( teams );

      for ( int i = 0; i < t; ++i ) {
        System.out.println( teams[ i ].id + " " + teams[ i ].ac + " "
            + teams[ i ].pn );
      }
    }
  }

  Main() {
    sc = new Scanner( System.in );
  }

  int ni() {
    return sc.nextInt();
  }

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

  void debug(Object... os) {
    System.err.println( Arrays.deepToString( os ) );
  }

}

Measured memory_bytes: 64148
N, *AS = $stdin.read.split.map(&:to_i)
M = 10**5
C = Array.new(M+1, 0)
AS.each{|a| C[a] += 1 }
D = Array.new(N+1, 0)
for i in 1..M
  D[C[i]] += 1
end

ans = 0
left = false
for k in 1..N
  if k.even? && D[k].odd?
    left = !left
  end
  ans += D[k]
  #p k: k, dk: D[k], ans: ans, left: left
end
p ans + (left ? -1 : 0)


Measured memory_bytes: 10492
import bisect
import sys
input = sys.stdin.readline

A,B,Q = map(int,(input().split()))
s = [[0]*3 for _ in range(A)]
t = [[0]*3 for _ in range(B)]
x = [[0]*3 for _ in range(Q)]
slen = []
tlen = []
road = []
for i in range(A):
    s[i][0] = int(input())
    slen.append(s[i][0])
    s[i][1] = "s"
    road.append(s[i])
for i in range(B):
    t[i][0] = int(input())
    tlen.append(t[i][0])
    t[i][1] = "t"
    road.append(t[i])
for i in range(Q):
    x[i][0] = int(input())
road.sort()

for i in range(len(s)):
    index = bisect.bisect_left(tlen,s[i][0])
    if index < B:
        s[i][2] = min(abs(s[i][0]-tlen[index-1]),abs(tlen[index]-s[i][0]))
    else:
        s[i][2] = abs(s[i][0]-tlen[index-1])
for i in range(len(t)):
    index = bisect.bisect_left(slen,t[i][0])
    if index < A:
        t[i][2] = min(abs(t[i][0]-slen[index-1]),abs(slen[index]-t[i][0]))
    else:
        t[i][2] = abs(t[i][0]-slen[index-1])

for i in range(Q):
    index = bisect.bisect_left(road,x[i])
    if index < A+B:
        print(min(abs(x[i][0]-road[index-1][0])+road[index-1][2],abs(x[i][0]-road[index][0])+road[index][2]))
    else:
        print(abs(x[i][0]-road[index-1][0])+road[index-1][2])

Measured memory_bytes: 132076
using System;
using System.Collections.Generic;
using System.IO;
 
class MainClass
{
  static public void Main(string[] args)
  {
    var N = Convert.ToInt64(Console.ReadLine());
    long res = 0;
    for (long i = 1; i <= N; i++) {
      var n = N / i;
      res += (i * n * (n + 1)) / 2;
    }
    Console.WriteLine(res);
  }
}

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

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

    int n = s.size();

    if(n%2 !=0 ){
    	cout<<"No"<<endl;
    }else{

    	bool ans = true;

    	for(int i=0;i<n;i++){
    		if(i & 1){
    			if(s[i]!='i'){
    				ans = false;
    				break;
    			}
    		}else{
    			if(s[i]!='h'){
    				ans = false;
    				break;
    			}
    		}
    	}
        
         if(ans){
    	cout<<"Yes"<<endl;
    }else{
    	cout<<"No"<<endl;
    }


    }

   

	return  0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    bool chk=true;
    string O,E;
    cin >> O >> E;
    if(O.size()!=E.size())
    {
        chk=false;
    }
    for(int i=0; i<O.size(); i++)
    {
        cout << O.at(i);
        if(i==O.size()-1&&chk==false) {break;}
        cout << E.at(i);
    }
    cout << endl;
}

Measured memory_bytes: 3588
#include <iostream>
#include <deque>
#include <utility>
#include <vector>
#include <queue>
using namespace std;

#define F first
#define S second
#define PB push_back

constexpr int kN = int(1E3 + 10), kInf = int(1E9 + 10), dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};


int h, w, dis[kN * kN], idx[kN][kN];
bool board[kN][kN], went[kN * kN];
string s[kN];
vector<int> graph[kN * kN], graph0[kN * kN];

bool ok(int x, int y) {
	if (x < 1 || x > h || y < 1 || y > w) return false;
	return board[x][y];
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int ch, cw, dh, dw, now = 0, nxt;
	deque<int> dq;
	cin >> h >> w >> ch >> cw >> dh >> dw;
	for (int i = 1; i <= h; i++) cin >> s[i];
	for (int i = 1; i <= h; i++) for (int j = 0; j < w; j++) board[i][j + 1] = (s[i][j] == '.');
	for (int i = 1; i <= h; i++) for (int j = 1; j <= w; j++) idx[i][j] = ++now;
	for (int i = 1; i <= h; i++) for (int j = 1; j <= w; j++) {
		for (int x = -2; x <= 2; x++) for (int y = -2; y <= 2; y++)
			if (ok(i + x, j + y)) graph[idx[i][j]].PB(idx[i + x][j + y]);
		for (int k = 0; k < 4; k++) 
			if (ok(i + dx[k], j + dy[k])) graph0[idx[i][j]].PB(idx[i + dx[k]][j + dy[k]]);
	}
	for (int i = 1; i <= now; i++) dis[i] = kInf;
	dis[idx[ch][cw]] = 0;
	dq.push_front(idx[ch][cw]);
	while (!dq.empty()) {
		nxt = dq.front();
		dq.pop_front();
		if (went[nxt]) continue;
		went[nxt] = true;
		for (int i : graph0[nxt]) if (dis[i] > dis[nxt]) {
			dis[i] = dis[nxt];
			dq.push_front(i);
		}
		for (int i : graph[nxt]) if (dis[i] > dis[nxt] + 1) {
			dis[i] = dis[nxt] + 1;
			dq.push_back(i);
		}
	}

	if (!went[idx[dh][dw]]) dis[idx[dh][dw]] = -1;
	cout << dis[idx[dh][dw]] << '\n';
}


Measured memory_bytes: 171264
#include <bits/stdc++.h>
using namespace std;
#define modulo 2019
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000000000001

int main(){
	string S;
	cin>>S;
	
	int p;
	p = 2019;
	
	vector<vector<long long>> dp(2,vector<long long> (p,0));
	long long ans = 0;
	for(int i=0;i<S.size();i++){
		dp[1][S[i]-'0']++;
		for(int j=0;j<modulo;j++){
			dp[1][(j*10+S[i]-'0')%p] += dp[0][j];
			dp[0][j]=0;
		}
		ans += dp[1][0];
		swap(dp[0],dp[1]);
	}
		
	cout<<ans<<endl;
		
	return 0;
}


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

#define pp push_back
#define pf push_front
#define mp make_pair
#define fs first
#define sc second
#define sf scanf

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

const int N = (int) 1e9;

int main(int argc, char *argv[])
{
	// ios_base::sync_with_stdio(false);
	// cin.tie(NULL);

	string a, b;
	cin >> a >> b;
	bool ok = true;
	for (int i = 0; i < a.length(); ++i) {
		if (a[i] != b[2 - i]) {
			ok = false;
		}
	}
	puts(ok ? "YES" : "NO");

	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, int> LP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int 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{
		mint res(*this);
		return res+=a;
	}
	mint operator-(const mint a) const{
		mint res(*this);
		return res-=a;
	}
	mint operator*(const mint a) const{
		mint res(*this);
		return res*=a;
	}
	mint pow(ll t) const{
		if(!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if(t&1) a *= *this;
		return a;
	}
	mint inv() const{
		return pow(mod-2);
	}
	mint& operator/=(const mint a){
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const{
		mint res(*this);
		return res/=a;
	}
	bool operator==(const mint a){
		return x == a.x;
	}
};

istream& operator>>(istream& is, const mint& a){return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a){return os << a.x;}

// 2^n
mint f(int n){
	if(n == 0) return 1;
	mint x = f(n/2);
	x *= x;
	if(n%2 == 1) x *= 2;
	return x;
}

// nCa
mint choose(int n, int a){
	mint x = 1, y = 1;
	rep(i,a){
		x *= n-i;
		y *= i+1;
	}
	return x / y;
}

struct Combination{
	vector<mint> fact, ifact;
	Combination(int n):fact(n+1),ifact(n+1){
		assert(n < mod);
		fact[0] = 1;
		for(int i = 1; i <= n; i++) fact[i] = fact[i-1]*i;
		ifact[n] = fact[n].inv();
		for(int i = n; i >= 1; i--) ifact[i-1] = ifact[i]*i;
	}
	mint operator()(int n, int k){
		if(k < 0 || k > n) return 0;
		return fact[n]*ifact[k]*ifact[n-k];
	}
};

struct Sieve{
	int n;
	vector<int> f, primes;
	Sieve(int n):n(n), f(n+1){
		f[0] = f[1] = -1;
		for(long long i = 2; i <= n; i++){
			if(f[i]) continue;
			primes.push_back(i);
			f[i] = i;
			for(long long j = i*i; j <= n; j += i){
				if(!f[j]) f[j] = i;
			}
		}
	}
	bool isPrime(int x){return f[x] == x;}
	vector<int> factorList(int x){
		vector<int> res;
		while(x != 1){
			res.push_back(f[x]);
			x /= f[x];
		}
		return res;
	}
	vector<pair<int, int>> factor(int x){
		vector<int> fl = factorList(x);
		if(fl.size() == 0) return {};
		vector<pair<int, int>> res(1, pair<int, int>(fl[0], 0));
		for(int p : fl){
			if(res.back().first == p){
				res.back().second++;
			}
			else{
				res.emplace_back(p, 1);
			}
		}
		return res;
	}
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, k;
	cin >> n >> k;
	Sieve sie(k+1);
	vector<mint> v(k+1);
	for(int i = 1; i <= k; ++i){
		v[i] = mint(k/i).pow(n);
	}
	for(auto p : sie.primes){
		for(int i = p; i <= k; i+=p){
			v[i/p] -= v[i];
		}
	}
	mint ans = 0;
	for(int i = 1; i <= k; ++i){
		ans += v[i] * i;
	}
	cout << ans.x << endl;
	return 0;
}

Measured memory_bytes: 4500
// Problem : D - Pairs
// Contest : AtCoder - AtCoder Beginner Contest 155
// URL : https://atcoder.jp/contests/abc155/tasks/abc155_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

//Macros

#define ll long long
#define db long double
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define inf 1e18
#define PI acos(-1.0)
#define int long long
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 100005

//Solution

void solve(){
    int n,k;
    cin>>n>>k;
    vi pos,neg;
    int z = 0;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        if(a > 0) pos.pb(a);
        else if(a < 0) neg.pb(a);
        else z++;
    }
    int zc = z*(n-z)+z*(z-1)/2;
    int negc = sz(pos)*sz(neg);
    if(k <= negc){
        int lo = -1, hi = inf, ans;
        for(int &i : neg) i *= -1;
        sort(all(pos));
        sort(all(neg));
        while(lo <= hi){
            int mid = (lo+hi)/2;
            int cnt = 0;
            for(int i : pos){
                int mult = (mid+i-1)/i;
                cnt += neg.end()-lower_bound(all(neg),mult);
            }
            if(cnt >= k) lo = mid+1, ans = mid;
            else hi = mid-1;
        }
        cout<<-ans<<endl;
    } else if(k <= negc+zc) cout<<0<<endl;
    else{
        k -= negc+zc;
        int lo = -1, hi = inf, ans;
        for(int &i : neg) i *= -1;
        sort(all(pos));
        sort(all(neg));
        while(lo <= hi){
            int mid = (lo+hi)/2;
            int cnt = 0;
            for(int i : pos){
                int mult = mid/i;
                cnt += upper_bound(all(pos),mult)-pos.begin();
                if(i*i <= mid) cnt--;
            }
            for(int i : neg){
                int mult = mid/i;
                cnt += upper_bound(all(neg),mult)-neg.begin();
                if(i*i <= mid) cnt--;
            }
            cnt /= 2;
            if(cnt >= k) hi = mid-1, ans = mid;
            else lo = mid+1;
        }
        cout<<ans<<endl;
    }
}

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int tests;
    //cin>>tests;
    tests = 1;
    while(tests--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 5180
/*************************
author : coldbeer
2019-05-20 10:38:08 PM IST
*************************/
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	long double n;
	int k;
	cin >> n >> k;

	long double ans = 0;
	for(int i = 1;i < n + 1;i++){
		int p = i;
		int d = 0;
		if(p <= k - 1){
			while(p <= (k - 1)) p = 2 * p,d++;
		}
		long double tmp = 0.5;
		ans += powl(tmp,d);

	}
	ans = ans / n;
	cout << fixed << setprecision(12) << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int x,y,d;
  scanf("%d%d",&x,&y);

  if(x==1){
    d=y;
  }
  else if(y==1){
    d=x;
  }
  else if(x==y){
    d=x;
  }
  else if(x>y){
    while(x%y!=0){
      d=x%y;
      x=y;
      y=d;
      if(x%d==0 && y%d==0) break;
    }
  }
  else if(y>x){
    while(y%x!=0){
      d=y%x;
      y=x;
      x=d;
      if(x%d==0 && y%d==0) break;
    }
  }
  printf("%d\n",d);
  return 0;
}



Measured memory_bytes: 2084
<?php

fscanf(STDIN, "%d %d", $N, $M);

$arg=[];
$result=0;
for ($i=0; $i < $N; $i++) { 
	$input = explode(" ", trim(fgets(STDIN)));
	for ($j=1; $j <= $input[0]; $j++) { 
		$arg[$input[$j]]++;
	}
}
foreach ($arg as $key => $value) {
	if ($value==$N) {
		$result++;
	}
}
echo $result;

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

int main(){
	int64_t K, N;
  	cin >> K >>  N;
  	vector<int64_t> A(N);
  	
  	for(int i = 0; i < N; i++){
    	cin >> A.at(i);	
    }
  	
  	vector<int64_t> B(N);
  	for(int i = 0; i < N - 1; i++){
    	B.at(i) = abs(A.at(i) - A.at(i+1));
    }
   	if(A.at(0) == 0){B.at(N-1) = K - A.at(N-1);}
  	else {B.at(N-1) = K - A.at(N - 1) + A.at(0);}
	sort(B.begin(),B.end());
 	cout << (K - B.at(N-1)) << endl;
} 


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

int main() {
    int a, b, c, x, ans = 0;
    cin >> a >> b >> c >> x;
    for (int i = 0; i <= a; i++) {
        for (int j = 0; j <= b; j++) {
            for (int k = 0; k <= c; k++) {
                if (500*i + 100*j + 50*k == x) {
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>

using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ll> pdl;
typedef pair<ld, ld> pdd;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
//typedef boost::multiprecision::cpp_int bigint;

map<ll, ll> MAP[2];

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	ll N;
	cin >> N;
	if (N < 1200)cout << "ABC\n";
	else cout << "ARC\n";
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {



			var inputArray = retreiveLongArray();
			var inputCount = 1;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			long N = inputArray[0];
			var S = retreiveStringArray()[0].Select(x=>x).ToArray();

			if (N%2 != 0) {
				Console.WriteLine("No");
				return;

			}

			for (int i = 0; i < N/2; i++) {
				if (S[i] != S[i+N/2]) {
					Console.WriteLine("No");
					return;
				}
			}

			//答えの出力
			var ans = "Yes";
			Console.WriteLine(ans);

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}


		/// <summary>
		/// 2組みずつの入力データ(数値)からTuppleListを作成する
		/// </summary>
		/// <param name="N"></param>
		/// <returns></returns>
		private static List<Tuple<long, long>> createLongTuppleList(long N) {
			var inpList = new List<Tuple<long, long>>();

			for (int i = 0; i < N; i++) {
				var inp = retreiveLongArray();
				var item1 = inp[0];
				var item2 = inp[1];
				inpList.Add(new Tuple<long, long>(item1, item2));
			}
			return inpList;
		}
	}
}




Measured memory_bytes: 27980
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;

class Myon
{
    static Scanner cin;
    public Myon() { }
    public static int Main()
    {
        cin = new Scanner();
        new Myon().calc();
        return 0;
    }
    
    public void calc()
    {
        int N = cin.nextInt();
        int odd = 0;
        for (int i = 0; i < N; i++)
        {
            int num = cin.nextInt();
            if (num % 2 == 1) odd++;
        }
        if (odd % 2 == 0) Console.WriteLine("YES");
        else Console.WriteLine("NO");
    }
    
}

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        while (i >= s.Length)
        {
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
        }
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

}

Measured memory_bytes: 15576
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

typedef long long ll;
#define INF 100000000
#define MOD 1000000007

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

	if (a <= c && b >= c) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return (0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    while(1){
        string str;
        cin >> str;
        if(str == "0") break;
        int count = 0;
        for(int i=0; i<str.size(); i++){
            count += (str.at(i)- '0');
        }
        cout << count << endl;
    }
    return 0;
}


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

int main(){
  int N, A, B, pass=0,overseas=0;
  cin >> N >> A >> B;
  char x;
  for(int i = 0; i < N; i++){
    cin >> x;
    if(x == 'a'){
      if(pass < A + B){
        pass++;
        cout << "Yes" << endl;
      }else cout << "No" << endl;
    }
    
    else if(x == 'b'){
      overseas++;
      if(pass < A + B && overseas <= B){
        pass++;
        cout << "Yes" << endl;
      }else cout << "No" << endl;
    }
    
    else cout << "No" << endl;
  }
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a,b;
    scanf("%lld%lld",&a,&b);
    if(a>b)
    {
        long long temp=a;
        a=b;
        b=temp;
    }
    long long c=b-a;
    if(c%2==0)
    {
        printf("%lld\n",a+(c/2));
    }
    else
    {
        printf("IMPOSSIBLE\n");
    }
    return 0;
}


Measured memory_bytes: 256
n,k = map(int,input().split())
a = [0]*n
for i in range(k):
    d = int(input())
    ai = list(map(int,input().split()))
    for j in ai:
        a[j-1] += 1
ans = 0
for i in range(n):
    if a[i] == 0:
        ans += 1
print(ans)

Measured memory_bytes: 67772
//#include "IntMod.h"
//typedef IntMod<1000000007> MInt;

//#include "Union_Find.h"

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <list>
#include <bitset>

using namespace std;
#define REP(i,a,n) for(int i = (a); i < (int)(n); ++i)
#define REPM(i,n,a) for(int i = ((n) - 1); i >= (a); --i)
#define EPS 0.0001
#define INF 0x3FFFFFFF
#define INFLL 0x3FFFFFFF3FFFFFFF
#define INFD 1.0e+308
#define FLOAT setprecision(16)
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;

template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U>
ostream& operator<<(ostream& ost, pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N>
void Fill(T(&dest)[N], const TCompatible& val) { fill(begin(dest), end(dest), val); }
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }

#if 1
#include <array>
#include <unordered_set>
#include <unordered_map>
template<class T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
#endif


int N;
list<int> L;
int main() {
	cin >> N;
	REP(i, 0, N) {
		int a;
		cin >> a;
		if ((N - i) % 2 == 0) {
			L.push_back(a);
		} else {
			L.push_front(a);
		}
	}
	for (auto it = L.begin(); it != L.end(); ++it) {
		cout << *it << (it != prev(L.end()) ? ' ' : '\n');
	}
	return 0;
}

Measured memory_bytes: 8448
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define EPS      (double)1e-9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cerr<<' ';cout<<elem;}cerr<<endl;}

int f(int x,int y,int z){
	int res=0;
	res+=x*x+y*y+z*z;
	res+=x*y+y*z+z*x;
	return res;
}

int main(){
	int n;
	cin>>n;
	
	map<int,int> mp;
	REP(i,100)REP(j,100)REP(k,100){
		int res=f(i+1,j+1,k+1);
		mp[res]++;
	}
	
	for(int i=1;i<=n;++i) cout<<mp[i]<<endl;
}

Measured memory_bytes: 5416
#include <stdio.h>
struct tree{
  int id;
  int left;
  int right;
  int p;
  int s;
  int dep;
  int deg;
  int h;
};

int main(){
  int in,n,i,j,si1,si2,pa,pc,hc,he;
  struct tree num[25];

  scanf("%d",&n); //節点の数の入力

//親、兄弟の初期値をー１、次数、高さの初期値を０に設定する
  for(i=0;i<n;i++){
    num[i].p=-1;
    num[i].s=-1;
    num[i].deg=0;
    num[i].h=0;
  }


  //左右の子供の設定
  for(i=0;i<n;i++){
    scanf("%d ",&in);
    num[in].id=in;
    scanf("%d %d",&num[in].left,&num[in].right);
    if(num[in].left!=-1 && num[in].right!=-1) num[in].deg=2;
    else if(num[in].left!=-1 || num[in].right!=-1) num[in].deg=1;

    si1=num[in].left;
    si2=num[in].right;
    num[si1].p=num[in].id;
    num[si2].p=num[in].id;
    num[si1].s=si2;
    num[si2].s=si1;
  }

  //depthを求める
  for(i=0;i<n;i++){
    if(num[i].p==-1)num[i].dep=0;
    
    else {
    pa=num[i].p;
    pc=1;
 
      while(num[pa].p!=-1){
  
      pc++;
      pa=num[pa].p;
      }
    
    num[i].dep=pc;
    }
  }

 

  //heightを求める
  for(i=0;i<n;i++){
    if(num[i].deg==0){
      hc=0;
      num[i].h=hc;
      pa=num[i].p;
      // pa=num[i].p;
      while(pa!=-1){
	hc++;
	if(num[pa].h<=hc) num[pa].h=hc;

	pa=num[pa].p;
      }
    }
  }


  for(i=0;i<n;i++){
  printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d,",
	 i,num[i].p,num[i].s,num[i].deg,num[i].dep,num[i].h);
  if(num[i].p==-1)printf(" root\n");
  else if(num[i].left==-1 && num[i].right==-1) printf(" leaf\n");
  else  printf(" internal node\n");
  }


  return 0;
}

Measured memory_bytes: 612
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>

#include <algorithm>
#include <numeric>
#include <functional>
#include <iterator>
#include <random>
#include <complex>
#include <utility>
#include <tuple>
#include <memory>

#include <array>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <csignal>
#include <cstdint>
#include <cstddef>

#ifdef ONLINE_JUDGE
#define NDEBUG
#endif
#include <cassert>
#include <stdexcept>
#include <exception>

// << pair
template <typename T1, typename T2>
std::ostream&operator<<(std::ostream&os,const std::pair<T1,T2>&p){return os<<"("<<p.first<<", "<<p.second<<")";}
// << container
template <typename C>
std::ostream&_debug_go(std::ostream&os,const C&v) {bool first=true;os<<"[";for(auto i:v){if(!first)os<<", ";os<<i;first=false;}return os<<"]";}
// << {vector, set, map} delegating to _debug_go
template<typename T> std::ostream&operator<<(std::ostream&os,const std::vector<T>&v){return _debug_go(os, v);}
template<typename T> std::ostream&operator<<(std::ostream&os,const std::set<T>&v){return _debug_go(os, v);}
template<typename T1, typename T2> std::ostream&operator<<(std::ostream&os,const std::map<T1,T2>&v){return _debug_go(os, v);}
struct Debugger{template<typename T>Debugger&operator,(const T&v){std::cerr<<v<<" "; return *this;}} dbg;
#ifndef NDEBUG
#define debug(args...) do {dbg,args; cerr << "\n";} while(0)
#else
#define debug(args...)
#endif

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ITER(i, s, e) for (auto i((s)); i != (e); ++i)
#define IT(i, c) ITER(i, (c).begin(), (c).end())

using namespace std;

using ui = uint32_t;
using ll = int64_t;
using ull = uint64_t;
template <typename T = int> using Pt = complex<T>;

template <typename T>
T cross(const Pt<T>& a, const Pt<T>& b) { return a.real() * b.imag() - a.imag() * b.real(); }

template <typename T>
bool cmpPt(const Pt<T>& a, const Pt<T>& b) {
    return a.real() < b.real() || (a.real() == b.real() && a.imag() < b.imag());
}
// END TEMPLATE


ll solve(int N, int M, vector<pair<int, int>> J) {
    sort(J.begin(), J.end());
    int k = 0;
    for (int i = N-1; k < N && i >= 0; ++k, --i) {
        while (i >= 0 && J[i].first + k > M) --i;
        if (i < 0) break;
    }
    int ans = 0;
    set<pair<int, int>> feas;
    for (int i = 0, j = k-1; j >= 0; --j) {
        while (i < N && J[i].first + j <= M) feas.insert({-J[i].second, i}), ++i;
        assert(!feas.empty());
        ans += -feas.begin()->first;
        feas.erase(feas.begin());
    }

    return ans;
}

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

    int N, M; cin >> N >> M;
    vector<pair<int, int>> J(N);
    for (auto& j : J) cin >> j.first >> j.second;

    cout << solve(N, M, J) << '\n';

    return 0;
}


Measured memory_bytes: 6528
#include <iostream>
#include <algorithm>
#define INF 1e+9
using namespace std;

int main() {
	int n,m;
    while(1){
        cin>>n>>m;
        if(n==0&&m==0)break;
        
        int k,cost[101][101],time[101][101],a,b,c,d,p,q,r;
        for(int i=0;i<101;i++){
            for(int j=0;j<101;j++){
                if(i==j){
                    time[i][j]=0;
                    cost[i][j]=0;
                }else{
                    time[i][j]=INF;
                    cost[i][j]=INF;
                }
            }
        }
        
        for(int i=0;i<n;i++){
            cin>>a>>b>>c>>d;
            cost[a][b]=c;
            cost[b][a]=c;
            time[a][b]=d;
            time[b][a]=d;
        }
        
        for(int k=0;k<=m;k++){
            for(int i=0;i<=m;i++){
                for(int j=0;j<=m;j++){
                    cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j]);
                    time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
                }
            }
        }
        
        cin>>k;
        for(int i=0;i<k;i++){
            cin>>p>>q>>r;
            if(r==0){
                cout<<cost[p][q]<<endl;
            }else if(r==1){
                cout<<time[p][q]<<endl;
            }
        }
    }
	return 0;
}

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

using ll = long long;
using pp = pair<ll,ll>;
const ll amari = 1e9+7;
const char BC = 'A' - 'a';
#define ben(a) a.begin(),a.end()
#define pb(a,b) a.push_back(b)
//fixed << setprecision(20)

int main(){
	int n;
	cin >> n;
	int b[n];
	int sum = 0;
	for(int i = 0; i < n - 1; i++){
		cin >> b[i];
	}
	for(int i = 0; i < n; i++){
		if(i == 0)sum += b[0];
		else if(i == n - 1)sum += b[n - 2];
		else sum += min(b[i - 1],b[i]);
	}
	
	cout << sum << endl;
	return 0;
}


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

int main(void) {
	unsigned short A[2000001], B[2000001];
	int C[10001], n;
	cin >> n;

	for (int i = 0; i <= 10000; i++) {
		C[i] = 0;
	}

	for (int i = 0; i < n; i++) {
		cin >> A[i + 1];
		C[A[i + 1]]++;
	}
	for (int i = 1; i <= 10000; i++) C[i] += C[i - 1];
	for (int i = 1; i <= n; i++) {
		B[C[A[i]]] = A[i];
		C[A[i]] --;
	}
	for (int i = 1; i <= n; i++) {
		if (i > 1) cout << " ";
		cout << B[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 9008
# -*- coding: utf-8 -*-

import sys
import os
import math

lines = sys.stdin.readlines()
game_num = len(lines) // 2

for i in range(game_num):
    s0 = lines[2 * i].strip()
    s1 = lines[2 * i + 1].strip()

    A = list(map(int, s0.split()))
    B = list(map(int, s1.split()))

    hit = 0
    blow = 0
    for j in range(4):
        if A[j] == B[j]:
            hit += 1
        elif A[j] in B:
            blow += 1
    print(hit, blow)

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

#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define MOD 1000000007
#define len(x) x.size()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define all(v) v.begin(), v.end()
#define alla(a, n) a, a + n
#define endl "\n";
#define MOD 1000000007

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef unordered_map<ll, ll> ump;

int32_t main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n, x, t;
    cin >> n >> x >> t;
    int cnt = 0;
    if (n % x == 0)
    {
        cnt = n / x;
    }
    else
    {
        cnt = (n / x) + 1;
    }
    cout << cnt * t;

    return 0;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define Decimal fixed << setpresicion(20)
#define SHOWP(x) cerr<<"["<<(x).FI<<", "<<(x).SE<<"]";
#define SHOWX(x) cerr<<#x<<": "<<x<<endl;
#define SHOWVEC(v, e) REP(i, e) cerr << (v[i]) << ' '; cerr << endl;
#define SHOW2D(a, h, w) REP(i, h){REP(j, w)cerr<<setw(3)<<(a[i][j])<<' ';cerr<<endl;}

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


int main()
{
  ll N, M, C;
  cin >> N >> M >> C;
  vector<ll> B(M);
  REP(i, M) cin >> B[i];
  vector<vector<ll>> A(N, vector<ll>(M));
  REP(i, N) REP(j, M) cin >> A[i][j];

  ll ans = 0;
  REP(i, N) {
    ll sum = 0;
    REP(j, M) sum += A[i][j]*B[j];
    sum += C;
    if (sum > 0) ans++;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

M = getN()
A = getList()
plus = []
minus = []
for i in A:
    if i >= 0:
        plus.append(i)
    else:
        minus.append(i)
plus.sort()
minus.sort(reverse = True)

if len(minus) == 0:
    print(sum(plus) - 2 * min(plus))
    now = plus[0]
    for i in range(1, M - 1):
        print(now, plus[i])
        now = now - plus[i]
    print(plus[M - 1], now)
    exit()

if len(plus) == 0:
    print(-sum(minus) + 2 * max(minus))
    now = minus[0]
    for i in range(1, M):
        print(now, minus[i])
        now = now - minus[i]
    exit()

print(sum(plus) - sum(minus))
now = minus[0]
for i in range(1, len(plus)):
    print(now, plus[i])
    now = now - plus[i]

print(plus[0], now)
now = plus[0] - now

for i in range(1, len(minus)):
    print(now, minus[i])
    now = now - minus[i]

Measured memory_bytes: 101940
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b; cin>>a>>b;
	if (a<=9&&b<=9) cout<<(a*b);
	else cout<<"-1";
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
<?php
  $c1 = trim(fgets(STDIN));
  $c2 = trim(fgets(STDIN));
  
  $rev_c1 = strrev($c1);
  $rev_c2 = strrev($c2);
  if($c1 == $rev_c2 && $c2 == $rev_c1){
    echo "YES\n";
  }else{
    echo "NO\n";
  }

Measured memory_bytes: 4604
#include <bits/stdc++.h>
using namespace std;
 
#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long
 
int main() {
    int n;
    cin >> n;
 
    vector<int> a(n+1);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
 
    int pos = 1;
    for (int i = 0; i < 1000000; i++) {
        if (pos == 2) { // 最初に判定
            cout << i << endl;
            return 0;
        }
        
        pos = a[ pos ];
    }
 
    cout << -1 << endl;
 
    return 0;
}

Measured memory_bytes: 640
from collections import defaultdict
d = defaultdict(int)

N, K = map(int, input().split())
li = [list(map(int, input().split())) for n in range(N)]

for i in li:
  d[i[0]] += i[1]
  
count = 0
new = sorted(d)

for i in new:
  count += d[i]
  
  if count >= K:
    print(i)
    break

Measured memory_bytes: 33824
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>

int main(){
  int N; cin >> N;
  int A[N]; rep(i,N) cin >> A[i];
  sort(A, A+N, greater<int>());

  ll l = 0, s = 0, r = 0;
  int cnt = 0;
  rep(i,N){
    if (i<N-1 && A[i]==A[i+1]){
      if (cnt==0) {
        cnt++;
        l=A[i];
        i++;
      }
      else {
        s=A[i];
        break;
      }
    }
    
  }
  cout << l*s << endl;


  // cout << fixed << setprecision(10);
  
  return 0;
}



Measured memory_bytes: 640
// おまじない
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  string vec;
cin>>vec;
  int m=0;
  for(int i=0; i<3; i++){
    if(vec.at(i)==vec.at(i+1)){
      m=1;
      break;}}
  
  if(m==1){
    cout<<"Bad"<<endl;}
  else{
    cout<<"Good"<<endl;}
}
    
    
    
    
    


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define INF             1e14
#define dd              double
#define MOD             1000000007
#define my_sizeof(type) ((char *)(&type+1)-(char*)(&type)) 
#define nl              cout<<endl
#define fill(a,val)     memset(a,val,sizeof(a))
#define mp              make_pair
#define endl            "\n"
#define pb              push_back
#define ff              first    
#define ss              second
#define SIZE            200005
#define all(v)          v.begin(),v.end()
#define s(ar,n)         sort(ar,ar+n)
#define rs(ar,n)        sort(ar, ar+n, greater<ll>()) 
#define oa(a,n)         for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n)         for(ll i=0;i<n;i++)cin>>a[i];
#define maxa(ar,N)      *max_element(ar,ar+N)
#define mina(ar,N)      *min_element(ar,ar+N)
#define fastio()        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define printclock      cerr<<"Time : "<<1000*(long double)clock()/(long double)CLOCKS_PER_SEC<<"ms\n";
ll power(ll x, ll y){
    ll res=1;x=x;
    while(y>0){
        if(y&1)
            res = (res*x);
        y = y>>1;
        x = (x*x);
    }
    return res;
}  
ll logtwo(ll n){
    if(n==1)
        return 0;
    return logtwo(n/2)+1;
}
signed main()
{
    fastio();   
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    int t=1;
    //cin>>t;
    while(t--)
    {
        ll N;
        cin>>N;
        ll ar[N];
        cn(ar,N);
        map<ll,ll> ma1;
        map<ll,ll> ma2;
        for(ll i=0;i<N;i++)
        {
            ma1[ar[i]+i+1]++;
            ma2[i+1-ar[i]]++;
        }
        ll ans=0;
        for(ll i=0;i<N;i++)
        {
            ans+=ma1[i+1-ar[i]];
            ans+=ma2[i+1+ar[i]];
        }   
        cout<<ans/2<<endl;
    }
}

Measured memory_bytes: 50484
a,b=map(int,input().split())
if a<=0 and b>=0:
    print("Zero")
    exit()
if a>0:
    print("Positive")
    exit()
tmp=0
for i in range(a,b+1):
    tmp+=1
if tmp%2==0:
    print("Positive")
else:
    print("Negative")

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

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

    int ans = 0;
    rep(i, 3){
        if(s[i] == 'R'){
            if(ans == 0) {
                ans++;
            } else if(s[i-1] == 'R') {
                ans++;
            } else {
                ans = 1;
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i,n) for (int i=(int)(n)-1; i>=0; --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;
const int FIVE = 101010;

//=============================
int A,B,C,X,Y;
//=============================
void input()
{
    cin>>A>>B>>C>>X>>Y;
}
//=============================
void func(){}
//=============================
void solve()
{

    // ABピザを買う枚数でわける
    int mx = max(X,Y)*2;
    int ans = INF;
    int xcnt,ycnt;
    int xleft,yleft;
    int cost;
    for (int i=0; i<= mx; i += 2){
        xcnt=ycnt=i/2;
        cost = i*C;

        xleft = max(0LL,X-xcnt);
        yleft = max(0LL,Y-ycnt);

        cost += xleft*A + yleft*B;
        ans = min(ans, cost);
    }
    cout<<ans<<endl;
    
    
    


}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 256
line = $stdin.read.split(' ')
all_numbers = line[1..-1].map(&:to_i)
if all_numbers.include?(0)
  puts 0
else
  result = 1
  all_numbers.each do |number|
    result = result * number
    break if result > 10**18
  end
  if result > 10**18
    puts '-1'.to_i
  else
    puts result
  end
end

Measured memory_bytes: 21748
#include <bits/stdc++.h>
using  namespace std;
typedef long long ll;
#define RAP(i, n) for(ll i=0;i<(n);i++)
#define FOR(i, a, b) for(ll i=(a);i<(b);i++)

#include <iostream>
#include <vector>
using namespace std;

//重複順列
vector<ll> buf;
void permutation(ll i, const ll size, const ll range_start, const ll range_end)
{
    if (i == size) {
      // ここで所望の作業を行う
      for(ll itr:buf){
        cout << itr;
      }
    }
    else{
        for(ll j = range_start; j <= range_end; ++j){
            buf[i] = j;
            permutation(i + 1, size, range_start, range_end);
        }
    }
}
int main(void)
{
  ll n, m, a;
  ll mod = pow(10,9) + 7;
  cin >> n >> m;
  vector<ll> A(n+1);
  A[0] = 1;
  RAP(i, m){
    cin >> a;
    A[a] = -1;
  }
  for(ll i = 1;i<=n;i++){
    if(A[i]==-1){
    continue;
    }
    if(i == 1){
     A[i]=A[i-1];
      continue;
    }
    if(A[i-1]==-1 && A[i-2]==-1){
      break;
    }else if(A[i-1] == -1){
      A[i] = A[i-2];
    }else if(A[i-2] == -1){
      A[i] = A[i-1];
    }else{
      A[i] = (A[i-1] + A[i-2])%mod;
    }
  }
 
  cout << A[n] << endl;
  return 0;
}


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

int main(){
  int N, T, c, t, ans;

  cin >> N >> T;
  ans = 9999;
  for(int i = 0; i < N; ++i){
    cin >> c >> t;
    if(t <= T && ans > c) ans = c;
  }

  if(ans==9999){
    cout << "TLE" << endl;
  }else{
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 256
//In the Name of God
//Ya Ali

#include<bits/stdc++.h>

#define int long long

#define pb push_back

#define err(A) cout<<#A<<" = "<<(A)<<endl

using namespace std;

const int maxn=100100;

int n,k;

int a[maxn];

int p[maxn];
int q[maxn];

int ans;

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

  cin>>n>>k;

  for(int i=1;i<=n;i++)
    cin>>a[i];
  for(int i=1;i<=n;i++)
    p[i]=p[i-1]+a[i],
    q[i]=q[i-1]+max(a[i],0ll);
  
  for(int i=k;i<=n;i++)
    ans=max(ans,q[n]-q[i]+q[i-k]+max(p[i]-p[i-k],0ll));

  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<stdio.h>
#include<vector>
#include<ctype.h>
#include<string>
#include<cmath>
#include<string.h>
#include<sstream>
using namespace std;

int h1,m1,h2,m2,K;

int main(){
    cin>>h1>>m1>>h2>>m2>>K;
    cout<<(h2*60+m2)-(h1*60+m1)-K<<endl;
    return 0;
}


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

using namespace std;

int main(){
  int N,A[30],B[30],C[30],x=0,y;
  cin >>N;
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  for(int i=0;i<N;i++){
    cin>>B[i];
  }
  for(int i=0;i<N-1;i++){
    cin>>C[i];
  }
  for(int i=0;i<N;i++){
   x = x + B[i];
  }
  for(int i=0;i<N-1;i++){
    if(A[i]+1==A[i+1]){
      y=A[i];
      x=x+C[y-1];
    }
  }
  cout<<x;

 return 0;
}


Measured memory_bytes: 256
ABCD = input()
def DP(x , i):
    if i == 4:
        if eval(x) == 7:
            print(x + '=7')
            exit()
        else:
            return
    else:
        DP(x + '+' + ABCD[i] , i + 1)
        DP(x + '-' + ABCD[i] , i + 1)
        return

DP(ABCD[0],1)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
const ll MOD = 1000000000+7;

int main(){
  int n;
  cin >> n;
  vector<ll> a(n);
  for(int i=0;i<n;i++) cin >> a[i];

  ll sum = 0;
  ll place = 1;
  for(int bit=0;bit<62;bit++){
    int one=0,zero=0;
    for(int i=0;i<n;i++){
      if(a[i]>>bit & 1 == 1){
        one++;
      }else{
        zero++;
      }
    }
    sum += place * one % MOD * zero;
    sum %= MOD;
    place *= 2;
    place %= MOD;
  }

  cout << sum << endl;
}


Measured memory_bytes: 2560
#include "bits/stdc++.h"
// #include "boost/math/common_factor.hpp" // gcd, lcm
using namespace std;

#define int long long

signed main(void) {
  // int num; // num
  double num;
  num = 0; // count, result
  // num = numeric_limits<int>::min(); // max
  // num = numeric_limits<int>::max(); // min
  int n;
  int h, w;
  cin >> n;
  cin >> h;
  cin >> w;

  num = (n - w + 1)* (n - h + 1);
  
  cout << num << endl;
  return 0;
}


Measured memory_bytes: 256