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

#define int long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define all(c) (c).begin(),(c).end()
#define F first
#define S second
#define fast ios:: sync_with_stdio(false),cin.tie(nullptr);
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;
const ld PI = acos(-1.0);
const int N = 2e5 + 5;
int n,lazy[4*N] , t[4*N];
pair<int,int> a[N];

void build(int v, int tl, int tr) {
    if (tl == tr) {
        t[v] = a[tl].S;
    } else {
        int tm = (tl + tr) / 2;
        build(v*2, tl, tm);
        build( v*2+1, tm+1, tr);
        t[v] = 0;
    }
}
void push(int v) {
    t[v*2] += lazy[v];
    lazy[v*2] += lazy[v];
    t[v*2+1] += lazy[v];
    lazy[v*2+1] += lazy[v];
    lazy[v] = 0;
}

void update(int v, int tl, int tr, int l, int r, int addend) {
    if (l > r)
        return;
    if (l == tl && tr == r) {
        t[v] += addend;
        lazy[v] += addend;
    } else {
        push(v);
        int tm = (tl + tr) / 2;
        update(v*2, tl, tm, l, min(r, tm), addend);
        update(v*2+1, tm+1, tr, max(l, tm+1), r, addend);
        t[v] = max(t[v*2], t[v*2+1]);
    }
}
int get(int v, int tl, int tr, int pos) {
    if (tl == tr) {
        return t[v];
    }
    push(v);
    int tm = (tl + tr) / 2;
    if (pos <= tm)
        return get(v*2, tl, tm, pos);
    else
        return get(v*2+1, tm+1, tr, pos);
}


int32_t main(){
	fast;
	int D,A;
	cin >> n >> D >> A;
	
	for(int i=0 ; i<n ; i++)
		cin >> a[i].F >> a[i].S;

	sort(a, a+n);
	build(1 , 0 , n-1);
	
	int ans = 0;
	
	for(int i=0 ; i<n ; i++)
	{
		int val = get(1 , 0 , n-1,i);
		if(val <= 0)
			continue;
		int x = a[i].F + D;
		int cnt = ceil(val / (ld)A);
		ans += cnt;
		
		int low = i , high = n-1 , mid , ans1 = i;
		while(low <= high)
		{
			mid = (low + high)/2;
			if(a[mid].F <= x + D)
			{
				ans1 = max(ans1 , mid);
				low = mid + 1;
			}
			else
			{
				high = mid - 1;
			}
		}
		update(1 , 0 ,n -1 , i , ans1 , -cnt*A );
	}
	
	cout << ans;

}



Measured memory_bytes: 14592
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
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


import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


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


def read_float():
    return float(buff_readline())


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


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


def read_str_n():
    return readline().strip().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, A):
    ans = 0
    ma = 0
    for a in A:
        ans += max(0, ma-a)
        ma = max(ma, a)
    return ans


def main():
    N = read_int()
    A = read_int_n()
    print(slv(N, A))


if __name__ == '__main__':
    main()


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

int main(){
	
	int N;
	cin>>N;
	
	int fx = 0;
	int n = N;
	while(n!=0){
		fx += n%10;
		n/=10;
	}
	
	if(N%fx==0){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static int MOD = 10007;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] s = sc.next().toCharArray();
		for(int i=0;i<n;i++) {
			if (s[i] == 'J') {
				s[i] = 0;
			}else if(s[i] == 'O') {
				s[i] = 1;
			}else{
				s[i] = 2;
			}
		}
		int[][] dp = new int[n+1][8];
		dp[0][1] = 1;
		for(int i=1;i<=n;i++) {
			for(int j=1;j<8;j++) {
				if ((j >> s[i-1] & 1) == 0) {
					continue;
				}
				for(int k=1;k<8;k++) {
					if ((j & k) == 0) {
						continue;
					}
					dp[i][j] += dp[i-1][k];
					dp[i][j] %= MOD;
				}
			}
		}
		int ans = 0;
		for(int i=0;i<8;i++) {
			ans = (ans + dp[n][i]) % MOD;
		}
//		System.out.println(Arrays.deepToString(dp));
		System.out.println(ans);
	}

}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

vector<pair<int64,int32>> prime_factor(int64 n){
    vector<pair<int64,int32>> res;
    for(int64 p = 2; p * p <= n; ++p){
        int32 cnt = 0;
        while(n % p == 0){
            ++cnt;
            n /= p;
        }
        if(cnt > 0)res.emplace_back(p,cnt);
    }
    if(n > 1){
        res.emplace_back(n,1);
    }
    return res;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int64 n;
  cin >> n;
  auto pf = prime_factor(n);
  int64 ans = 0;
  for(auto [p,e] : pf){
    // cout << p << " " << e << endl;
    int32 m = 1;
    while(e >= m){
      ++ans;
      e -= m;
      ++m;
    }
  }
  ANS(ans);
  return 0;
}

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

#define sz(x) (int)x.size() 
#define pb push_back 
#define mp make_pair 
#define fi(a, b) for(int i=a; i<=b; i++) 
#define fj(a, b) for(int j=a; j<=b; j++) 
#define fo(a, b) for(int o=a; o<=b; o++) 
#define fdi(a, b) for(int i=a; i>=b; i--) 
#define fdj(a, b) for(int j=a; j>=b; j--) 
#define fdo(a, b) for(int o=a; o>=b; o--) 

#ifdef LOCAL
#define err(...) fprintf(stderr, __VA_ARGS__)
#else
#define err(...) while(false) {}
#endif

typedef long long ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef vector<int> vi; 
typedef vector<pii> vpii; 
typedef vector<pll> vpll; 
typedef long double ld;
typedef unsigned long long ull;

/////////////////////////////////

ll a, b, c, k;

void solve() {
	if (k % 2 == 0) {
		printf("%lld\n", a - b);
	} else {
		printf("%lld\n", b - a);
	}
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	scanf("%lld %lld %lld %lld", &a, &b, &c, &k);  
	solve();		

	
#ifdef LOCAL
	err("ELAPSED TIME: %.3Lf\n", (ld) clock() / CLOCKS_PER_SEC);
#endif	
	
	return 0;
}

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

using namespace std;

int main() {
  int a, b, m, x, y, z;
  cin >> a >> b >> m;
  int arr[a], brr[b];
  int ma(100001), mb(100001), ans;
  for (int i = 0; i < a; ++i) {
    cin >> arr[i];
    ma = min(ma, arr[i]);
  }
  for (int i = 0; i < b; ++i) {
    cin >> brr[i];
    mb = min(mb, brr[i]);
  }
  ans = ma + mb;
  for (int i = 0; i < m; ++i) {
    cin >> x >> y >> z;
    ans = min(ans, arr[x-1] + brr[y-1] - z);
  }
  cout << ans << '\n';
  return 0;
}


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


int main() {
	int N, A, B;
	cin >> N >> A >> B;
	int a, b, c, d,e;
	int all_sum = 0;
	for (int n = 0; n <= N; n++) {
		int sum = 0;
		int temp = n;
		while (true) {
			sum+= temp% 10;
			temp = temp / 10;
			if (temp == 0)break;
		}
		if (A <= sum&&sum <= B)all_sum += n;
	}

	cout << all_sum << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
const int inf=1e8;
using namespace std;
int keta(int a){
  int co=0;
  while(a){a/=10;co++;}
  return co;
}
int main(){
  int n;
  cin>>n;
  vector<int>in(n);
  rep(i,n)cin>>in[i];
  sort(all(in));
  vector<int>out;
  int q=(n>3?4:3);
  rep(i,q)rep(j,q)if(i!=j)out.pb(in[i]*pow(10,keta(in[j]))+in[j]);
  sort(all(out));
  cout<<out[2]<<endl;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int s;
string a;
int main()
{
   cin>>a;
   for(int i=0;i<a.size();i++)
   {
   	 if(a[i]=='C')
   	 {
   	    s=1;	
	 }
	 if(a[i]=='F'&&s==1)
	 {
	 	cout<<"Yes"<<endl;
	 	return 0;
	 }
   }
   cout<<"No"<<endl;
	
    return 0;
} 

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

ll gcd(ll a, ll b){return b ? gcd(b, a%b):a;}

int main() {
  int n;
  cin >> n;
  ll res = 0;
  ll ans = 0;
  for (ll i = 1; i <= (n); ++i){
    for (ll j = 1; j <= (n); ++j){
      res = gcd(i,j);
      for (ll k = 1; k <= (n); ++k){
        ans += gcd(res,k);
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3592
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
vector<int> h(14),a(13);
vector<bool> hf(14);
bool ten(int x, int y);
int main(){
  string s;
  while(cin >>s){
    bool f = false;
    for(int i=0; i<13; i++) a[i] = s[i]-'0';
    for(int i=1; i<=9; i++){
      int lot[10]={0};
      bool ax = true;
      for(int j=0; j<13; j++) h[j] = a[j];
      h[13] = i;
      for(int j=0; j<14; j++){hf[j] = true;lot[h[j]]++;}
      for(int j=1; j<10; j++) if(lot[j]>4) ax = false;
      if(ax){
	sort(h.begin(),h.end());
	if(ten(4,1)){
	  if(f) cout <<" ";
	  cout <<i;
	  f = true;
	}
      }
    }
    if(!f) cout <<"0";
    cout <<endl;
  }
  return 0;
}
bool ten(int x, int y){
  bool f=false;
  if(x == 0 && y == 0) return true;
  for(int i=0; i<14; i++){
    if(hf[i]){
      if(y!=0){
	for(int j=i+1; j<14; j++){
	  if(hf[j] && h[i] == h[j]){
	    hf[i] = hf[j] = false;
	    f|=ten(x,0);
	    if(f) return f;
	    hf[i] = hf[j] = true;
	    break;
	  }
	  else if(h[i]!=h[j]) break;
	}
      }
      if(x!=0){
	for(int j=i+1; j<14; j++){
	  if(hf[j] && h[i] == h[j]){
	    for(int k=j+1; k<14; k++){
	      if(hf[k] && h[i] == h[k]){
		hf[i] =	hf[j] = hf[k] = false;
		f|=ten(x-1,y);
		if(f) return f;
		hf[i] = hf[j] = hf[k] = true;
		break;
	      }
	      else if(h[i]!=h[k]) break;
	    }
	  }
	  else if(h[i]!=h[j]) break;
	}
	for(int j=i+1; j<14; j++){
	  if(hf[j] && h[i]+1 == h[j]){
	    for(int k=j+1; k<14; k++){
	      if(hf[k] && h[i]+2 == h[k]){
		hf[i] =	hf[j] = hf[k] = false;
		f|=ten(x-1,y);
		if(f) return f;
		hf[i] = hf[j] = hf[k] = true;
		break;
	      }
	      else if(h[i]+2<h[k]) break;
	    }
	  }
	  else if(h[i]+1<h[j]) break;
	}
      }
    }
  }
  return f;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T>
using vec = std::vector<T>;

int main() {
    int X,Y,Z;
    cin >> X >> Y >> Z;
    cout << (X-Z)/(Y+Z) << endl; 
}

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

int main() {
	int n, max_w;
	cin >> n >> max_w;
	vector<int> w(n), v(n);
	rep(i, n) cin >> w[i] >> v[i];
	vector<vector<int>> value(4);
	rep(i, n) {
		value[w[i]-w[0]].push_back(v[i]);
	}
	rep(i, 4) sort(all(value[i]));
	rep(i, 4) reverse(all(value[i]));
	vector<vector<int>> tot = value;
	rep(i, 4) {
		rep(j, value[i].size()) {
			if(j > 0) tot[i][j] += tot[i][j-1];
		}
	}
	
	int ans = 0;
	for(int w0 = 0; w0 < value[0].size()+1; w0++) {
		int now_w0 = w0 * w[0];
		if(now_w0 > max_w) break;
		for(int w1 = 0; w1 < value[1].size()+1; w1++) {
			int now_w1 = now_w0 + w1 * (w[0] + 1);
			if(now_w1 > max_w) break;
			for(int w2 = 0; w2 < value[2].size()+1; w2++) {
				int now_w2 = now_w1 + w2 * (w[0] + 2);
				if(now_w2 > max_w) break;
				for(int w3 = 0; w3 < value[3].size()+1; w3++) {
					int now_w3 = now_w2 + w3 * (w[0] + 3);
					if(now_w3 > max_w) break;
					int now_v = 0;
					if(w0 > 0) now_v += tot[0][w0-1];
					if(w1 > 0) now_v += tot[1][w1-1];
					if(w2 > 0) now_v += tot[2][w2-1];
					if(w3 > 0) now_v += tot[3][w3-1];
					ans = max(ans, now_v);
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

void compare(int a,int b,int x,int y,int* xx,int* yy)
{
  if(*xx+*yy > x+y){
    *xx = x;
    *yy = y;
  }
  else if(*xx+*yy == x+y){
    if( a*(*xx)+b*(*yy) > a*x+b*y){
      *xx = x;
      *yy = y;
    }
  }
}
int main()
{
  int ans1,ans2;
  int aa,bb;
  int a,b,d;
  while(cin >> a >> b >> d && (a||b||d)){
    ans1 = INF;
    ans2 = INF;

    for(int i=0;i <= 10000;++i){
      if((d+a*i)%b == 0){
	aa = i;
	bb = (d+a*i)/b;
	compare(a,b,aa,bb,&ans1,&ans2);
      }
    }
    for(int i=0;i <= 10000;++i){
      if((d+b*i)%a == 0){
	bb = i;
        aa = (d+b*i)/a;
	compare(a,b,aa,bb,&ans1,&ans2);
      }
    }
    for(int i=0;i <= 10000;++i){
      if(a*i <= d && (d-a*i)%b == 0){
	aa = i;
	bb = (d-a*i)/b;
	compare(a,b,aa,bb,&ans1,&ans2);
      }
    }
    cout << ans1 << " " << ans2 << endl;
  }
  return 0;
}


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

void QQ(){
  for(int i = 0 ; i < 9 ; i++){
    for(int j = 0 ; j < 9 ; j++){
      cout << i+1 << 'x' << j+1 << '=' << (i+1)*(j+1) << endl;
    }
  }
}

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

Measured memory_bytes: 1116
#include <bits/stdc++.h>
#include <stdio.h>
# define M_PI  3.14159265358979323846
using namespace std;

typedef long long ll;
const int N = 2e5 + 9, M = 9e2 + 9, OO = 0x3f3f3f3f;
const double EPS = 0.00000000001;
const int mod = 1000000000+7;



int p, q, r;

int main(){
	//freopen ("i.in","r",stdin);
	//freopen ("no.out","w",stdout);

	scanf("%d%d%d", &p, &q, &r);
	printf("%d\n", min(r+p, min(p+q, q+r)) );


	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python
"""AtCoder Beginner Contest 087: B - Coins
https://atcoder.jp/contests/abc086/tasks/abc087_b
"""

__author__ = 'bugttle <bugttle@gmail.com>'


def main():
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())

    result = 0
    for a_i in range(A+1):
        for b_i in range(B+1):
            for c_i in range(C+1):
                if a_i*500 + b_i*100 + c_i*50 == X:
                    result += 1

    print(result)


if __name__ == '__main__':
    main()


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

int main() {
  int N; cin >> N;
  vector<int> card(N);
  for (int i = 0; i < N; i++) {
    cin >> card[i];
  }
  sort(card.begin(), card.end(), greater<int>());
  
  int Ap = 0, Bp = 0;
  for (int i = 0; i < N; i++) {
    if (i % 2 == 0) Ap += card[i];
    else Bp += card[i];
  }
  cout << Ap - Bp << endl;
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007
#define INF 1000000000
typedef pair<int64_t, int64_t> PII;
typedef vector<int64_t> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

// まずは全探索，次にDP
// 偶奇，逆から，ソート，出現回数，出現位置，DP
// 余事象，包除
// データ構造
// 問題の特徴量
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
int main() {
cin.tie(0);
ios::sync_with_stdio(false);

int N; cin >> N;

rep(i, 1, 10){
    if (N%i == 0 && N/i < 10) {cout << "Yes\n"; return 0;}
}
cout << "No\n";
}

// 境界，出力文字列 チェック



Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::{stdout, stdin, BufWriter, Write};

fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }

    input!{
      n: usize,
    }
    for i in 1..10 {
        for j in 1..10 {
            if n == i*j {
                puts!("{}\n", "Yes");
                return
            }
        }

    }
    puts!("{}\n", "No");
}


Measured memory_bytes: 4352
io = DATA.eof? ? STDIN : DATA
n,k=io.gets.split.map(&:to_i)
ar=io.gets.split.map(&:to_i)
cum=Array.new(n,1)
acm=1
from=0
n.times do |i|
  if i>=k
    if ar[i]>ar[i-k]
      puts 'Yes'
    else
      puts 'No'
    end
  end
end
__END__


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

int par[100200];

int find(int u){
	return par[u]=(par[u]==u)?u:find(par[u]);	
}

int join(int u, int v){
	if(find(u)<find(v))swap(u,v);	
	par[find(u)] = find(v);
}

int main(){
	int n, m;
	cin>>n>>m;
	vector<int> A(n);
	for(int i=0;i<n;i++){
		cin>>A[i];
		par[i] = i;
	}
//	cout<<"A";
	for(int i=0;i<m;i++){
		int x, y;
		cin>>x>>y;
		join(x-1, y-1);
	}
//	cout<<"B";
	int ct = 0;
	for(int i=0;i<n;i++){
		if(find(i) == find(A[i]-1) ) ct++;	
	}
	cout<<ct<<"\n";
}

Measured memory_bytes: 1024
N = int(input())
AAA = input().split()

ev_AAA = []
for n in AAA:
	if int(n) % 2 == 0:
		ev_AAA.append(n)
        
result = "APPROVED"
for ev_a in ev_AAA:
  if int(ev_a) % 3 == 0:
    continue
  elif int(ev_a) % 5 == 0:
    continue
  else:
    result = "DENIED"
    
print(result)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;

const int MOD = 1e9+7;

ll sum(ll left, ll right) {
  return (left+right)*(right-left+1)/2;
}

int main() {
  int n,k;
  cin >> n >> k;
  ll ans = 0;
  for(int i = k; i <= n+1; ++i) {
    ll left = sum(0, i-1);
    ll right = sum(n-i+1, n);
    ans += (right-left+1)%MOD;
  }
  cout << ans%MOD << endl;
  return 0;
}

Measured memory_bytes: 3608
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class A
{
	public static void Main()
	{
		int N = Int32.Parse(Console.ReadLine());
		int A = Int32.Parse(Console.ReadLine());		
		Console.WriteLine(((N % 500) <= A) ? "Yes" : "No");
	}	
}





Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define REP(i,n) for (long long i=0;i<(n);i++)
#define FOR(i,a,b) for (long long i=(a);i<(b);i++)
#define RREP(i,n) for(long long i=n;i>=0;i--)
#define RFOR(i,a,b) for(long long i=(a);i>(b);i--)
#define dump1d_arr(array) REP(i,array.size()) cerr << #array << "[" << (i) << "] ==> " << (array[i]) << endl
#define dump2d_arr(array) REP(i,array.size()) REP(j,array[i].size()) cerr << #array << "[" << (i) << "]" << "[" << (j) << "] ==> " << (array[i][j]) << endl
#define dump(x)  cerr << #x << " => " << (x) << endl
#define dumpP(p) cerr << "( " << p.first << " , " << p.second << " )" << ends
#define SORT(c) sort((c).begin(),(c).end())
#define MIN(vec) *min_element(vec.begin(), vec.end())
#define MAX(vec) *max_element(vec.begin(), vec.end())
#define UNIQ(vec) vec.erase(unique(vec.begin(), vec.end()),vec.end()) //ソートの必要あり
#define IN(n,m)  (!(m.find(n) == m.end()))
#define ENUM(m) for (auto itr = m.begin(); itr != m.end(); ++itr)
#define dump_MAP(m) for(auto itr = m.begin(); itr != m.end(); ++itr) { cerr << itr->first << " --> "  << itr->second << endl; }
#define FINDL(vec,x) (lower_bound(vec.begin(),vec.end(),x) - vec.begin())
#define FINDU(vec,x) (upper_bound(vec.begin(),vec.end(),x) - vec.begin())
#define ROUND(N) setprecision(N)
#define ROUND_PRINT(N,val) cout << fixed;cout << setprecision(N) << val << endl
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

using namespace std;
constexpr long double pi = M_PI;
constexpr double eps = 1e-10;
constexpr long mod = 1000000007;
constexpr short shINF = 32767;
constexpr long loINF = 2147483647;
constexpr long long llINF = 9223372036854775807;
typedef long long LL;
typedef vector<LL> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<LL,LL> pr;
typedef vector<pr> VP;
struct Order {
	bool operator() (pr const& a,pr const& b) const {
		return a.first > b.first || ((a.first == b.first) && (a.second > b.second));
	}
};

int main (void) {
	LL Q,H,S,D,N;
	cin >> Q >> H >> S >> D;
	cin >> N;
	N *= 4;
	H = min(Q*2,H);
	S = min(H*2,S);
	D = min(S*2,D);

	LL sum = 0;
	//dump(N/8);
	sum += (N / (8)) * D;
	N = (N % 8);
	//dump(N/4);
	sum += (N / 4) * S;
	N = (N % 4);
	//dump(N/2);
	sum += (N / 2) * H;
	N = (N % 2);
	//dump(N);
	sum += (N) * Q;

	cout << sum << endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define dcout cout << fixed << setprecision(15)
#define arep(i, a) for(auto i : a)
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
#define MOD 1000000007
#define INF 10000000000
#define int long long
#define KETA(n) floor(log10(n) + 1)
using namespace std;
signed main() {
    int n, k;
    cin>>n>>k;
    if(n % k == 0)
        cout << 0;
    else
        cout << 1;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <fstream>
#include <vector>
#include <bitset>
#include <unordered_map>
#include <algorithm>
#include <queue>
#include <math.h>
#include <iomanip>

using namespace std;

/********** TEMPLATE STARTS HERE ***********/

#define IOS ios::sync_with_stdio(false), cin.tie(0);
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define pb push_back
#define PI 3.1415926535897932384626433832795
#define gcd __gcd 
#define digits(n) (int)(log10(n) + 1)

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <long long> vl;
typedef vector <pll> vll;
typedef vector <pii> vii;

const int INF = 0x3f3f3f3f;
const int LINF = 0x3f3f3f3f3f3f3f3f;

template <typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template <typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

/********** TEMPLATE ENDS HERE ***********/

const int DIM = 55555;

bool isPrime(int n) 
{
	for(int i = 2; i * i <= n; i++) 
	{
		if(n % i == 0) 
			return false;
	}
	
	return (n != 1);
}
 
vi prime;
 
main()
{
	IOS
	
	int n;
	cin >> n;
 
	for(int i = 11; i <= DIM && n; i += 5)
	{
		if(isPrime(i)) 
		{
			prime.push_back(i);
			n--;
		}
	}
	
	for(auto i : prime)
		cout << i << ' ';
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int a[2020][2020],b[2020][2020],c[2020][2020];
int main(){
    int n,m,q;
    cin>>n>>m>>q;
    string s[n];
    rep(i,n)cin>>s[i];
    rep(i,n)rep(j,m){
        if(s[i][j]=='1')++a[i+1][j+1];
    }
    rep(i,n)rep(j,m-1){
        if(s[i][j]=='1'&&s[i][j+1]=='1')++b[i+1][j+1];
    }
    rep(i,n-1)rep(j,m){
        if(s[i][j]=='1'&&s[i+1][j]=='1')++c[i+1][j+1];
    }
    rep(i,n)rep(j,m+1){
        a[i+1][j]+=a[i][j];
        b[i+1][j]+=b[i][j];
        c[i+1][j]+=c[i][j];
    }
    rep(i,n+1)rep(j,m){
        a[i][j+1]+=a[i][j];
        b[i][j+1]+=b[i][j];
        c[i][j+1]+=c[i][j];
    }
    while(q--){
        int x1,y1,x2,y2;
        scanf("%d %d %d %d",&x1,&y1,&x2,&y2);
        int p=a[x2][y2]+a[x1-1][y1-1]-a[x2][y1-1]-a[x1-1][y2];
        int q=b[x2][y2-1]+b[x1-1][y1-1]-b[x2][y1-1]-b[x1-1][y2-1];
        int r=c[x2-1][y2]+c[x1-1][y1-1]-c[x2-1][y1-1]-c[x1-1][y2];
        printf("%d\n",p-q-r);
    }
    return 0;
}

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

ll n,k;
ll R,S,P;
string s;
ll dp[100005][3];
ll solve(ll i,ll sy)
{
	if(i>=n)return 0;
	if(dp[i][sy]==-1){
		
		ll co = 0;
		if(s[i]=='r' and sy==2)
		{
			co+=P;
		}
		if(s[i]=='s' and sy==0)
		{
			co+=R;
		}
		if(s[i]=='p' and sy==1)
		{
			co+=S;
		}
		
		if(sy==0)
		{
			co+=max(solve(i+k,1),solve(i+k,2));
		}
		if(sy==1)
		{	
			co+=max(solve(i+k,0),solve(i+k,2));
		}
		if(sy==2)
		{
			co+=max(solve(i+k,0),solve(i+k,1));
		}
		
		dp[i][sy] = co;
		
		
	}
	
	return dp[i][sy];
}


int main()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    memset(dp,-1,sizeof(dp));
    
    cin>>n>>k;
    cin>>R>>S>>P;
    cin>>s;
    
    ll ans = 0;
    
    for(ll  i=0;i<k;i++)
    {
		ll z = 0;
		z = max(z,solve(i,0));
		z = max(z,solve(i,1));
		z = max(z,solve(i,2));	
		//cout<<i<<" "<<z<<endl;	
		ans+=z;
		
	}
	cout<<ans;
    
}


Measured memory_bytes: 7504
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<list>
#include<map>
#include<vector>

using namespace std;


#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define ll long long

#define IMIN INT_MIN;
#define IMAX INT_MAX;

int maxelem(vector<int> src) {
	int dst = IMIN;
	rep(i, src.size()) {
		dst = (dst > src[i]) ? dst : src[i];
	}
	return dst;
}

int secondelem(vector<int> src) {
	int dst = IMIN;
	int dst2 = IMIN;
	rep(i, src.size()) {
		if (dst < src[i]) {
			dst2 = dst;
			dst = src[i];
		}
		else if (dst2 < src[i]) {
			dst2 = src[i];
		}
	}
	return dst2;
}

vector<int> count(vector<int> a) {
	int ma = maxelem(a);
	vector<int> count(ma+1, 0);
	rep(i, a.size()) {
		count[a[i]]++;
	}
	return count;
}

int find(vector<int> a, int b) {
	rep(i, a.size()) {
		if (a[i] == b) return i;
	}
	return -1;
}

int main(){

	int R;
	cin >> R;
	if (R < 1200) cout << "ABC" << endl;
	else if (R < 2800) cout << "ARC" << endl;
	else cout << "AGC" << endl;

	return 0;
}




Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;
#define ll long long
int main()
{
	ll n,a,b;
	cin>>n>>a>>b;
	if(a==0)
	{
		cout<<0<<endl;
	}
	else
	{
		ll sum=n/(a+b);
		sum*=a;
		ll c=n%(a+b);
		if(c<=a)
		{
			sum+=c;
		}
		else
		{
			sum+=a;
		}
		cout<<sum<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/









int N; 
ll A[101010], B[101010];
ll C[101010];
int vis[101010];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N) cin >> A[i];
    rep(i, 0, N) cin >> B[i];
 
    ll smA = 0;
    rep(i, 0, N) smA += A[i];
 
    int ans = 0;
    rep(i, 0, N) C[i] = B[i];
    
    ll smB = 0;
    rep(i, 0, N) smB += B[i];
 
    if (smA < smB) {
        printf("-1\n");
        return;
    }
 
    ll d = smA - smB;
    vector<pair<int,int>> up;
    int ng = 0;
    int same = 0;
    rep(i, 0, N) {
        if (A[i] < B[i]) ng++;
        else if (B[i] < A[i]) up.push_back({ A[i] - B[i],i });
        else same++;
    }
 
    sort(all(up));
    fore(p, up) {
        if (p.first <= d) {
            d -= p.first;
            C[p.second] = A[p.second];
        }
    }
 
    rep(i, 0, N) if (A[i] != C[i]) ans++;
    if (d) {
        if (ans == 0) ans++;
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long X,sum=100,a=1;
    
    cin >> X;
    
    while(1){
        sum *= 1.01;
       if(sum>=X){
           break;
       }
       a++;
    }
    
    cout << a << endl;
    return 0;
}


Measured memory_bytes: 3620
n = int(raw_input())
a = map(int,raw_input().split())

ave = float(sum(a))/float(len(a))
if ave - int(ave) >= 0.5:
    ave = int(ave)+1
else:
    ave = int(ave)

cost = 0

for var in a:
    cost = cost + (var-ave)**2

print cost


Measured memory_bytes: 2568
#include <stdio.h>

int main(void)
{
  int N;
  int K;
  int X;
  int Y;
  
  if (scanf("%d", &N) < 1) {
    return 1;
  }
  if (scanf("%d", &K) < 1) {
    return 1;
  }
  if (scanf("%d", &X) < 1) {
    return 1;
  }
  if (scanf("%d", &Y) < 1) {
    return 1;
  }

  int i;
  int total = 0;
  for (i = 1; i <= N; i++) {
    if (i <= K) {
      total += X;
    } else {
      total += Y;
    }
  }
  printf("%d", total);
  return 0;
}

Measured memory_bytes: 128
# coding: utf-8
import sys
# import bisect
# import math
# import numpy as np


"""Template"""


class IP:
    """
    入力を取得するクラス
    """
    def __init__(self):
        self.input = sys.stdin.readline

    def I(self):
        """
        1文字の取得に使います
        :return: 数
        """
        return int(self.input())

    def IL(self):
        """
        1行を空白で区切りリストにします(int
        :return: リスト
        """
        return list(map(int, self.input().split()))

    def SL(self):
        """
        1行の文字列を空白区切りでリストにします
        :return: リスト
        """
        return list(map(str, self.input().split()))

    def ILS(self, n):
        """
        1列丸々取得します(int
        :param n: 行数
        :return: リスト
        """
        return [int(self.input()) for _ in range(n)]

    def SLS(self, n):
        """
        1列丸々取得します（str
        :param n: 行数
        :return: リスト
        """
        return [self.input() for _ in range(n)]


class Idea:
    def __init__(self):
        pass

    def HF(self, p):
        """
        Half enumeration
        半分全列挙です
        pの要素の和の組み合わせを作ります。
        ソート、重複削除行います
        :param p: list : 元となるリスト
        :return: list : 組み合わせられた和のリスト
        """
        return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))

    def Bfs2(self, a):
        """
        bit_full_search2
        bit全探索の改良版
        全探索させたら2進数のリストと10進数のリストを返す
        :return: list２つ : １個目 2進数(16桁)  2個目 10進数
        """
        # 参考
        # https://blog.rossywhite.com/2018/08/06/bit-search/
        # https://atcoder.jp/contests/abc105/submissions/4088632
        value = []
        for i in range(1 << len(a)):
            output = []

            for j in range(len(a)):
                if ((i >> j) & 1) == 1:
                    """右からj+1番目のiが1かどうか判定"""
                    # output.append(a[j])
                    output.append(a[j])
            value.append([format(i, 'b').zfill(16), sum(output)])

        value.sort(key=lambda x: x[1])
        bin = [value[k][0] for k in range(len(value))]
        val = [value[k][1] for k in range(len(value))]
        return bin, val


"""ここからメインコード"""


def main():
    # 1文字に省略
    r, e = range, enumerate
    ip = IP()
    id = Idea()

    """この下から書いてね"""
    s = str(ip.I())
    ans = 0
    # 最後に+は付けられない
    n = len(s) - 1

    # bit全探索
    for i in r(1 << n):
        # sの中に+を入れて計算する
        p = ""
        for j in r(n):
            p += s[j]
            if (i >> j & 1) > 0:
                p += "+"
        p += s[-1]
        ans += eval(p)
    print(ans)


main()


Measured memory_bytes: 3188
import math
import io

nim, mike, kite = map(int, input().split())
H = [int(input()) for _ in range(nim)]

OK = max(H)//kite+1
NG = 0

ans = OK
while OK-NG > 1:
    mid = (OK+NG)//2  # 試行する値
    cnt = 0

    for h in H:
        if h > mid*kite:
            cnt += math.ceil((h-mid*kite)/(mike-kite))

    if cnt <= mid:
        OK = mid
    else:
        NG = mid

print(OK)


Measured memory_bytes: 7068
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int h1 = sc.nextInt();
    int m1 = sc.nextInt();
    int h2 = sc.nextInt();
    int m2 = sc.nextInt();
    int k = sc.nextInt();
    int time = 0;
    
    time = (h2-h1)*60 + (m2-m1) - k;

    System.out.println(time);
    
  }
}

Measured memory_bytes: 35552
#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>;
#define chmax(x,y) x = max(x,y);

int main() {
    string s, t;
    cin >> s >> t;
    int n = s.size(), m = t.size();
    vector<vector<int>> is(26);
    rep(i,n) is[s[i]-'a'].push_back(i);
    rep(i,n) is[s[i]-'a'].push_back(i+n);
    ll ans = 0;
    int p = 0;
    rep(i,m) {
        int c = t[i]-'a';
        if (is[c].size() == 0) {
            cout << -1 << endl;
            return 0;
        } 
        p = *lower_bound(is[c].begin(), is[c].end(), p) + 1;
        if (p >= n) {
            p -= n;
            ans += n;
        }
    } 
    ans += p;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4624
from collections import Counter
N,K = map(int,input().split())
sarr = list(map(int,input().split()))
arr = sorted(sarr)
def xsum(arr,n):
    s = 0
    for i in arr:
        s += n^i
    return s
c = Counter()
for i in arr:
    n = 1
    while n <= K:
        if i%2:
            c[n] += 1
        else:
            c[n] += 0
        n *= 2
        i = i >> 1
ans = 0
p = [1]
while(p[-1]*2 <= K):
    p.append(p[-1]*2)
for i in p[::-1]:
    if c[i] < N - c[i]:
        if ans + i <= K :
            ans += i
print(max(xsum(arr,ans),xsum(arr,K)))

Measured memory_bytes: 70640
#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

using ll = long long;
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define tc() int t; cin>>t; while(t--)
#define print(n) cout<<n<<"\n"
#define inp(n) int n; cin>>n
#define all(cont) cont.begin(), cont.end()
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define mp make_pair
#define pb push_back
#define maxn 1000010
#define mod 1e9+7
#define ff  first
#define ss  second
#define fora(var, start, end) for(int var = start; var < end; var++)
int main()
{
    fast();
    map<ll,ll> map;
    int n;
    cin>>n;
    vector<ll> temp(n);
    fora(i,0,n)
    {
       
        cin>>temp[i];
        map[temp[i]]++;
    }
    ll ans=0;
    foreach(it,map)
    {
        ans+= ((it->ss)*(it->ss-1))/2;
    }
   // print(ans);
    debug(map);
    fora(i,0,n)
    {
        print(ans-map[temp[i]]+1);
    }
    return 0;
}

Measured memory_bytes: 18944
#include<iostream>
using namespace std;
bool isPower2(int);

int main() {
	int n;
	long long a[300];
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}

	for (int i = 1; i <= n; i++) {
		cout << "node " << i << ": key = " << a[i] << ", ";
		if (1 <= i / 2)	cout << "parent key = " << a[i / 2] << ", ";
		if (2*i <= n) cout << "left key = " << a[2*i] << ", ";
		if (2*i + 1 <= n) cout << "right key = " << a[2*i+1] << ", ";
		cout << endl;
	}
}

bool isPower2(int k) {
	while (1) {
		if (k == 1) return true;
		if (k % 2 == 1) return false;
		else {
			k /= 2;
		}
	}
}

Measured memory_bytes: 1168
// 2_jsc2019q_b
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
#define MOD (1000000007)
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k;
    cin >> n >> k;

    vector<ll> a(n);
    rep(i, n){
        cin >> a[i];
    }

    vector<ll> d(n);
    vector<ll> e(n);

    rep(i, n){
        ll cnt = 0;
        rep(j, n){
            if(a[i] > a[j]) cnt++;
        }
        d[i] = cnt;

        ll cnt2 = 0;
        for(int j = i + 1; j < n; j++){
            if(a[i] > a[j]) cnt2++;
        }
        e[i] = cnt2;
    }

    ll ans = 0;
    rep(i, n){
//        ans = (ans + d[i] * k * (k - 1) / 2 + e[i] * k) % MOD;
        ans = (ans + e[i] * k) % MOD;
        ll tmp;
        if(k % 2 == 0){
            tmp = k / 2;
            tmp = tmp * d[i] % MOD;
            tmp = tmp * (k - 1) % MOD;
        }else{
            tmp = (k - 1) / 2;
            tmp = tmp * d[i] % MOD;
            tmp = tmp * k % MOD;
        }
        ans = (ans + tmp) % MOD;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

vll table(1010,1);

ll mod=1e9+7;

bool is_prime(ll x){
    if(x<=1)return false;
    for(ll i=2;i*i<=x;i++){
        if(x%i==0)return false;
    }
    return true;
}

long long INF = 1LL<<60;
int main( ){
    ll n;
    cin>>n;
    vll cnt(n+1,0);
    rep(i,1,n+1){
        if(is_prime(i)){
            rep(j,1,n+1){
                if(j%i==0){
                    ll t=j;
                    while(t%i==0){
                       t/=i;
                       cnt[i]++;
                    }
                }
            }
        }
    }
    ll res=1;
    rep(i,1,n+1){
        if(cnt[i]){
            res=res*(1+cnt[i])%mod;
            if(res<0)res+=mod;
        }
    }
    cout<<res<<endl;
    return 0;
}




Measured memory_bytes: 256
#配列の長さ
array_length = gets.to_i

#入力を配列化
array_value = gets.chomp.split(" ").map(&:to_i)

#output用配列
output_array_value = []

#昇順に挿入ソートを実施
array_value.each_with_index do |item, index|
    
    #挿入対象の値
    v = item
    
    #挿入対象のインデックスより1つ小さいインデックスを用意
    j = index - 1
    
    #挿入対象以下のインデックスをソート
    while (j >= 0) && (array_value[j] > v) do   #インデックスが0以上かつ挿入対象より大きい値の場合
        #インデックスが1大きい場所へコピー
        array_value[j+1] = array_value[j]
        
        #走査対象のインデックスをデクリメント
        j -= 1
    end
    
    #挿入対象の値をソート後の位置へ代入
    #A[j+1] == A[j+2]またはj+1が最後のインデックスになっているはず
    array_value[j+1] = v
    
    #ソート操作を1回行う度に出力
    puts array_value.join(" ")
end







Measured memory_bytes: 6908
/// Code By t_bone_289 (Tushar Singh)
/// An Immature Programmer.... I'm still developing !!
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define M 1000000007
#define error(x) cout << #x << " = " << x << endl;
#define pi 3.14159265358979323846
typedef long long ll;
typedef double d;
typedef long double ld;
template <typename T>
void ContainerError(T &v){cout<<"{";for(auto &x:v){cout<<x<<',';}cout<<"}"<<endl;return;}
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
ll mpow(ll base,ll exp){ll res=1;while(exp>0){if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return (res);}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll sol(ll i,ll rem,ll n,string &s,vector<vector<ll> > &dp)
{
    if(i==n)
    {
        if(rem==5)
        {
            return 1;
        }
        return 0;
    }
    if(dp[i][rem]!=-1)
    {
        return dp[i][rem];
    }
    if(s[i]!='?')
    {
        ll temp = (10*rem+s[i]-'0')%13;
        //temp = (10*temp)%13;
        return dp[i][rem]=sol(i+1,temp,n,s,dp);
    }
    ll ans=0;
    for(ll j=0;j<10;j++)
    {
        ll temp = (10*rem+j)%13;
        //temp = (10*temp)%13;
        ans = (ans+sol(i+1,temp,n,s,dp))%M;
    }
    return dp[i][rem] = ans;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin>>s;
    ll n=s.size();
    vector<vector<ll> > dp(n+1,vector<ll>(13,-1));
    ll ans=sol(0,0,n,s,dp);
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 22992
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int n;
    int i, count;

    for(;sc.hasNextInt();){
      n = sc.nextInt();
      count = 0;
      for(i = 1;i <= n;i++)if(isprime(i) && isprime(n + 1 - i))count++;
      System.out.println(count);
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }

  private static boolean isprime(int p){
    int i;
    if(p == 1)return false;
    for(i = 2;i * i <= p;i++)if(p % i == 0)return false;
    return true;
  }
}

Measured memory_bytes: 23360
#include <bits/stdc++.h>
#include <atcoder/all>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define ins insert

#define debug(a) cerr<<(a)<<endl
#define dbrep(a,n) rep(_i,n) cerr<<(a[_i])<<" "; cerr<<endl
#define dbrep2(a,n,m) rep(_i,n){rep(_j,m) cerr<<(a[_i][_j])<<" "; cerr<<endl;}

using namespace std;
using namespace atcoder;

template<class A, class B>
ostream &operator<<(ostream &os, const pair<A,B> &p){return os<<"("<<p.fi<<","<<p.se<<")";}
template<class A, class B>
istream &operator>>(istream &is, pair<A,B> &p){return is>>p.fi>>p.se;}

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M; cin>>N>>M;
    scc_graph G(N);
    rep(i,M){
        int a,b; cin>>a>>b;
        G.add_edge(a,b);
    }
    auto gs = G.scc();
    cout<<gs.size()<<endl;
    for(auto g:gs){
        cout<<g.size();
        for(auto v:g) cout<<" "<<v;
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 40132