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

using namespace std;
#define inf             0x3f3f3f3f
#define INF             2e18
#define eps             1e-9

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
#define fRead           freopen("input.txt","r",stdin)
#define fWrite          freopen("output.txt","w",stdout)

#define LL              long long
#define ull            unsigned long long
#define PI              acos(-1.0)
#define pb              push_back
#define mk              make_pair
#define pii             pair<int,int>
#define pLL             pair<LL,LL>
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define SQR(a)          ((a)*(a))
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(min(a,b),min(c,d))
#define max4(a,b,c,d)   max(max(a,b),max(c,d))
#define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
#define vi              vector <int>
#define vL              vector <LL>
#define LB(a,x)         (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x)         (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.
#define prec(n)         fixed << setprecision(n)

#define MEM(a,x)        memset(a,x,sizeof(a))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define IT(it,x)	    for(it=x.begin();it!=x.end();it++)
int main()
{
    long double n;
    cin>>n;
    long double x=n/3,y=n/3,z=n/3;
    cout<<prec(10)<<x*y*z;

}


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

typedef long long ll;

#define REP(i,m,n) for(int i=(int)m; i < (int) n; ++i)
#define rep(i,n) REP(i,0,n)
#define all(a) (a).begin(), (a).end()


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

  int n, a, b; cin >> n >> a >> b;
	string s; cin >> s;

	int pass = 0, cnt = 0;
	rep(i, n) {
		if(s[i] == 'a') {
			if(pass < a+b) {
				cout << "Yes" << '\n';
				pass++;
			} else {
				cout << "No" << '\n';
			}
		}
		if(s[i] == 'b') {
			if(pass < a+b && cnt < b) {
				cout << "Yes" << '\n';
				pass++;
				cnt++;
			} else {
				cout << "No" << '\n';
			}
		}
		if(s[i] == 'c') {
			cout << "No" << '\n';
		}
	}
	
	return 0;
}

Measured memory_bytes: 848
s = input()
n = len(s) // 2
lst = [(i + j) for (i, j) in zip(s[::2], s[1::2])]

check = 0
for i in range(n):
    if lst[i] == 'hi':
        check = 1
    else:
        check = 0
        break

if len(s) % 2 == 1:
    check = 0

if check == 1:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
n = int(input())
p = list(map(int,input().split()))
c=0
for i in range(1,n-1):
    if (p[i-1] < p[i] and p[i] <= p[i+1]) or (p[i-1] >= p[i] and p[i] > p[i+1]):
        c += 1
print(c)

Measured memory_bytes: 3060
"""
author : halo2halo
date : 2, Feb, 2020
"""

import sys
import itertools

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S = readline().decode('utf8').rstrip()
vowel = 'aiueo'

print('vowel' if S in vowel else 'consonant')


Measured memory_bytes: 19748
#include<stdio.h>

int main(){
int N;
int i;
int X[100010]={0};
int k;
scanf("%d\n",&N );//ボタンの個数読み込み
int a[100000];
for (i = 0; i < N; i++) {//a[i]に値を読み込み
    scanf("%d\n",&a[i] );
    a[i]--;
}
k=0;
for (i = 0; i < N; i++) {
  /* code */

  if(X[k]==1){
    printf("%d\n",-1 );
    return 0;
  }
X[k]++;
k=a[k];
  if(k==1){
    break;
  }
}
printf("%d\n",i+1 );


return 0;






}


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



Measured memory_bytes: 2036
#include <iostream>
#include <map>

constexpr int ALPHA_SIZE = 'z' - 'a' + 1;
std::array<int, ALPHA_SIZE> Counter;
constexpr int MAX_SIZE = 10;
char str[MAX_SIZE+10];

int main(void){
    int n; scanf("%d", &n);
    std::map<std::array<int, ALPHA_SIZE>, int> C;
    for(int i = 0; i < n; ++i){
        std::fill(Counter.begin(), Counter.end(), 0);
        scanf("%s", str);
        for(int j = 0; j < MAX_SIZE; ++j) Counter[str[j]-'a']++;
        C[Counter]++;
    }
    long long int res = 0;
    for(auto& itr : C){
        long long int a = itr.second - 1; a *= itr.second; a /= 2;
        res += a;
    }
    printf("%lld\n", res);
    return 0;
}

Measured memory_bytes: 15872
#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;

int main() {
    int N; cin >> N;
    vector<int> X(N);
    vector<int> Xc(N);
    rep(i, N){
        cin >> X[i];
        Xc[i] = X[i];
    }
    sort(Xc.begin(), Xc.end());
    int n2 = N/2;
    rep(i, N){
        int x = X[i];
        int xn = lower_bound(Xc.begin(), Xc.end(), x) - Xc.begin();
        if(xn < n2){
            cout << Xc[n2] << endl;
        } else {
            cout << Xc[n2-1] << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 4772
import java.io.*;

public class Main {

	final static long MOD = 1000000007;
	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ

		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String S = in.readLine();
		String[] Ws = S.split(" ");

		int A = Integer.parseInt(Ws[0]);
		int B = Integer.parseInt(Ws[1]);


		int sum = 1;
		int ans = 0;
		while(B-sum>0){
			sum=sum-1+A;
			ans++;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 23124
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
#from fractions  import gcd
#input=sys.stdin.readline
import bisect
s=input()
t=input()
n=len(s)
ans=0
for i in range(n):
    if s[i]!=t[i]:
        ans+=1
print(ans)

Measured memory_bytes: 74240
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>

using namespace std;
static const int MAX = 100;
static const int INFTY = (1<<21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n, M[MAX][MAX];

int prim(){
    int u, minv;
    int d[MAX], p[MAX], color[MAX];

    for (int i=0;i<n;i++){
        d[i] = INFTY;
        p[i] = -1;
        color[i] = WHITE;
    }
    d[0] = 0;

    while(true){
        minv = INFTY;
        u = -1;
        for (int i=0;i<n;i++){
            if (minv > d[i] and color[i] != BLACK){
                u = i;
                minv = d[i];
            }
        }
        if(u== -1){
            break;
        }
        color[u] = BLACK;
        for (int v=0;v<n;v++){
            if (color[v] != BLACK and M[u][v] != INFTY){
                if( d[v] > M[u][v]){
                    d[v] = M[u][v];
                    p[v] = u;
                    color[v] = GRAY;
                }
            }
        }
    }
    int sum = 0;
    for (int i=0;i<n;i++){
        if(p[i] != -1){
            sum += M[i][p[i]];
        }
    }
    return sum;

}

int main(){
    

    cin >> n;
    for (int i=0;i<n;i++){
        for (int j= 0;j<n;j++){
            int e;
            cin >> e;
            M[i][j] = (e==-1) ? INFTY : e;
        }
    }

    cout << prim() << endl;

}


Measured memory_bytes: 3136
MOD = 10 **9 + 7
INF = 10 ** 10

def main():
    K = int(input())
    A = list(map(int,input().split()))
    m = 2
    M = 2
    flag = True
    for i in range(K - 1,-1,-1):
        x = (m + A[i] - 1)//A[i]
        y = M//A[i]
        if x > y:
            flag = False
            break
        M = y*A[i] + A[i] - 1
        m = x*A[i]
    if flag:
        print(m,M)
    else:
        print(-1)         
if __name__ == '__main__':
    main()

Measured memory_bytes: 14252
/*
 ╔═══╦═══╦═══╗
 ║╔═╗║╔══╩╗╔╗║
 ║║░║║╚══╗║║║║
 ║║░║║╔══╝║║║║
 ║╚═╝║╚══╦╝╚╝║
 ╚══╗╠═══╩═══╝
 ░░░╚╝░░░░░░░░
 */

#include <bits/stdc++.h>
#define ll					long long
#define MOD					1000000007
#define MAX					1e9
#define MIN                 -1e9
#define PI					acos(-1.0)
#define vi					vector<int>
#define vii					vector<vi>
#define vll					vector<ll>
#define mid(s,e)			(s+(e-s)/2)
#define clz(n)				__builtin_clzll(n))

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...);}
template<typename T>
void printVec(const T &v, char sep=' ') {for (auto &i: v) cout << i << sep;}
template<typename T>
void printVecPair(const T &v, char sep=' ') {for (auto &i: v) cout << i.first <<" " << i.second<< sep;}


#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

int main() {
	ios::sync_with_stdio(false);
 	cin.tie(0);
	int n;
	cin>>n;
	vi a(n), b(n), c(n);
	for(int i=0;i<n;i++ ) cin>>a[i]>>b[i]>>c[i];
	vii dp(n,vi(3));
	dp[0][0] = a[0];
	dp[0][1] = b[0];
	dp[0][2] = c[0];
	for(int i=1;i<n;i++) {
			dp[i][0] = a[i] + max(dp[i-1][1], dp[i-1][2]);
			dp[i][1] = b[i] + max(dp[i-1][0], dp[i-1][2]);
			dp[i][2] = c[i] + max(dp[i-1][0], dp[i-1][1]);
	}
	cout<<max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2]));
	return 0;
}





Measured memory_bytes: 6912
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
const double pi=acos(-1.0);

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,m;cin >> n >> m;
	vector<int> a(n);
	rep(i,m){
		int x,y;cin >> x >> y;
		x--;y--;
		a.at(x)++;
		a.at(y)++;
	}
	rep(i,n) cout << a.at(i) << endl;
}

Measured memory_bytes: 256
n=list(input())
n=[int(i) for i in n]
if len(n)<=2 and n!=[1,0]:
    print(sum(n))
else:
    d=sum(n[2:])
    if n[:2]==[1,0]:
        print(d+10)
    else:
        print(d+sum(n[:2]))        

Measured memory_bytes: 3064
#include<stdio.h>
#include <string.h>

int main(void){

    int n,k,r,s,p;
    int i=0;
    int cr=0, cs=0, cp=0;

    scanf("%d %d", &n, &k);
    
    char t[n+1], at[n+1];
    scanf("%d %d %d", &r, &s, &p);
    scanf("%s", &t);

    for(i = k; i<n; i++){
        if (t[i] == t[i-k]){
            t[i] = 'a';   
        }
    }

    i=0;

    while(i<n){

        if(t[i]=='r'){
            cp++;
            at[i]='r';
        }else if(t[i]=='s'){
            cr++;
            at[i]='s';
        }else if(t[i]=='p'){
            cs++;
            at[i]='p';
        }
        i++;
    }

    printf("%d", (r*cr+s*cs+p*cp) );
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> a(n - 1);
    for(int i = 0; i < n - 1; i++){
        cin >> a[i];
    }
    int ans = a[0];
    for(int i = 0; i < n - 2; i++){
        ans += min(a[i], a[i + 1]);
    }
    cout << ans + a[a.size() - 1] << endl;
}

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

int main() {
  int N,M;
  cin>>N>>M;
  for(int i=0; i<M; i++){
    int A;
    cin>>A;
    N-=A;
  }
  if(N>=0)
    cout<<N<<endl;
  else
    cout<<"-1"<<endl;
}


Measured memory_bytes: 3648
// https://atcoder.jp/contests/dp/tasks/dp_b
#include "bits/stdc++.h"

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

const int inf = 1e9 + 7;


void mini(int& a, int b) {
  a = min(a, b);
}

int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  
  vector<int> h(n, 0);
  for (int& x : h) scanf("%d", &x);

  vector<int> dp(n, inf);
  dp[0] = 0;
  for (int i = 0; i < n; ++i)
    for (int j=i+1; j<=i+k; ++j)  
      if (j < n) mini(dp[j], dp[i] + abs(h[i] - h[j]));

  printf("%d", dp.back());

  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <sstream>
using namespace std;

#define rep(i, s, e) for (int i = (s); i <= (e); i++)
#define rrep(i, s, e) for (int i = (s); i >= (e); i--)

int n;
int l;
int q;
vector<int> x;

//2^17 = 131072 > 100000
//x[i] - x[i-1] <= L という条件より100000日以内には到着する
int dp[18][100010];

int main()
{
    cin >> n;
    x.resize(n, 0);
    rep(i, 0, n - 1)
    {
        cin >> x[i];
    }

    cin >> l >> q;

    stringstream result;

    rep(i, 0, n - 1)
    {
        {
            auto ite = upper_bound(x.begin(), x.end(), x[i] + l);
            ite--;
            int j = ite - x.begin();
            dp[0][i] = j;
        }
    }
    rep(i, 1, 17)
    {
        rep(j, 0, n - 1)
        {
            dp[i][j] = dp[i - 1][dp[i - 1][j]];
        }
    }

    rep(c, 0, q - 1)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        if (a > b)
            swap(a, b);

        int ans = 0;
        int now = a;

        rrep(i,17,0)
        {
            if(dp[i][now] < b)
            {
                now = dp[i][now];
                ans += 1 << i;

            }
        }

        if(now < b)
        {
            ans++;
        }

        result << ans << endl;
        
    }

    cout << result.str();
    return 0;
}

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

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

    int ans = 0;

    for(int c=1; c <= n-1; c++){
        int tmp = n - c;


        int tmpi = 1;   //tmpの約数の個数
        for(int i=2; i*i <= tmp; i++){
            int ex = 0;     //次数
            while(tmp % i == 0){
                ex ++;
                tmp /= i;
            }
            tmpi *= ex+1;

            if(tmp == 1) break;
        }
        if(tmp != 1) tmpi *= 2;

        ans += tmpi;
    }

    cout << ans << endl;
}

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

int main() {
  
  int A,B;
  string S;
  cin >> A >> B >> S;
  
  int count = 0;
  for ( int i = 0 ; i < S.size() ; i++ ){
  	if( S.at(i) == '-' )
      count++;
  }
  
  if ( count == 1 && S.at(A) == '-')
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;
int N = 100001;

int main(){
  vector<bool> prime(N, true);
  prime[0] = prime[1] = false;
  for(int i = 2; i * i < N; ++i) for(int j = 2; i * j < N; ++j) {
    prime[i * j] = false;
  }
  vector<int> cnt(N, 0);
  REP(i, N) if(i % 2 == 1 && prime[i] && prime[(i + 1) / 2]) cnt[i] = 1;
  REP(i, N - 1) cnt[i + 1] += cnt[i];

  int Q;
  cin >> Q;
  REP(i, Q) {
    int l, r;
    cin >> l >> r;
    int ret = cnt[r] - cnt[l - 1];
    cout << ret << endl;
  }
  return 0;
}



Measured memory_bytes: 1024
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


d, t, s = LI()
ans = 'Yes' if d / s <= t else 'No'
print(ans)


Measured memory_bytes: 9192
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define MOD (ll)(1e9+7)
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
ll calc(ll x,ll y,ll z)
{
	return (x+y)*(x+y) + (y+z)*(y+z) + (x+z)*(x+z);
}
int main()
{
	ll n;
	cin>>n;
	vector<ll>dp(1e4+1,0);
	for(ll i=1;i<=100;i++){
		for(ll j=1;j<=100;j++){
			for(int k=1;k<=100;k++){
				ll cur = calc(i,j,k);
				if(cur%2 == 0 && cur/2 <= n)dp[cur/2]++;
				
			}
		}
	}
	for(int i=1;i<=n;i++)cout<<dp[i]<<'\n';
}


Measured memory_bytes: 3624
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int ans = 0;
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int count = 0;
        for (int i = 0; i < n - 1; i++) {
            if (a[i] == a[i + 1]) {
                a[i + 1] = 0;
                ans++;
            }
        }
        System.out.println(ans);
    }    
}


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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)x.size())
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

/*{
  }*/

using vi = vector<int>;
using vvi = vector<vi>;
using P = pair<int,int>;

class UnionFind
{
public:
  int n;
  vector<int> par, rnk;

  UnionFind(int n_)
  {
    n = n_;
    par.resize(n);
    rnk.resize(n);
    for(int i = 0; i < n; i++){
      par[i] = i;
      rnk[i] = 0;
    }
  }

  int find(int x)
  {
    if(par[x] == x) return x;
    return par[x] = find(par[x]);
  }

  void unite(int x, int y)
  {
    x = find(x);
    y = find(y);
    if(x == y) return;

    if(rnk[x] < rnk[y]){
      par[x] = y;
    }else{
      par[y] = x; 
      if(rnk[x] == rnk[y]) rnk[x]++;
    }
  }

  bool same(int x, int y)
  {
    return find(x) == find(y);
  }
};

int dist(int a, int b, int c, int d){
  return min(abs(a-c), abs(b-d));
}

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

  vi x(n), y(n);
  rep(i, 0, n) cin >> x[i] >> y[i];

  vector<pair<P, int>> v, w;
  rep(i, 0, n){
    v.emplace_back(P(x[i], y[i]), i);
    w.emplace_back(P(y[i], x[i]), i);
  }

  sort(all(v));
  sort(all(w));

  vector<pair<int, P>> es;
  rep(i, 1, n){
    es.emplace_back(
        dist(v[i-1].first.first, v[i-1].first.second,
             v[i].first.first, v[i].first.second),
        P(v[i-1].second, v[i].second));
    es.emplace_back(
        dist(w[i-1].first.second, w[i-1].first.first,
             w[i].first.second, w[i].first.first),
        P(w[i-1].second, w[i].second));
  }

  sort(all(es));

  UnionFind uf(n);
  int ans = 0;
  rep(i, 0, sz(es)){
    int a = es[i].second.first;
    int b = es[i].second.second;
    if(!uf.same(a, b)){
      ans += es[i].first;
      uf.unite(a, b);
    }
  }

  cout << ans << endl;

  return 0;
}



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

using namespace std;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define all(c) c.begin(), c.end()
#define rall(c) c.end(), c.begin()
#define INF (int)1e9
#define MOD 1000000007
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef map<int, int> MPII;
typedef set<int> SETI;

const int mxN = 2e5;
int a[mxN];
int n, m, k, x;

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

    cin >> n >> m >> k;

    vll a(n);
    vll b(m);

    for (auto &x : a)
        cin >> x;
    for (auto &x : b)
        cin >> x;

    vll sA(n + 1);
    vll sB(m + 1);
    sA[0] = 0, sB[0] = 0;

    for (int i = 0; i < n; ++i)
        sA[i + 1] = sA[i] + a[i];
    for (int i = 0; i < m; ++i)
        sB[i + 1] = sB[i] + b[i];

    ll ans = 0, j = m;
    for (int i = 0; i < n + 1; ++i)
    {
        if (sA[i] > k)
            break;
        while (sB[j] > k - sA[i])
            j -= 1;
        ans = max(ans, i + j);
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 9540
#include <math.h>
#include <stdio.h>

int main(void){
    double debt = 100; //  x100
    int n;
    
    scanf("%d",&n);
    for (int i=0; i<n; i++){
        debt *= 1.05;
        debt = ceil(debt);
    }
    printf("%d000\n", (int)debt);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define REP(i,n) FOR(i,0,n)
int main(){
int n,sum=0;
  cin>>n;
  vector<int> v(n);
  REP(i,n)cin>>v[i];
  sort(v.begin(),v.end());
  REP(i,n){
  if(i==n-1)v[i]/=2;
  sum+=v[i];
  }
  cout<<sum<<endl;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	ll N,K;
	cin>>N>>K;
	vector<lp> array(N);
	rep(i,N){
		cin>>array[i].first>>array[i].second;
	}
	ll cnt = 0LL;
	sort(all(array));
	rep(i,N){
		if(cnt+array[i].second<K){
			cnt += array[i].second;
		}else{
			cout<<array[i].first<<endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,d;
    scanf("%d%d",&d,&n);
    if(d==0)
    {
        if(n==100) printf("101\n"),exit(0);
        printf("%d\n",n),exit(0);
    }
    if(d==1)
    {
        if(n==100) printf("10100\n"),exit(0);
        printf("%d\n",100*n),exit(0);
    }
    if(n==100) printf("1010000\n"),exit(0);
    printf("%d\n",10000*n),exit(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;

struct st{int a,b,c;}s[200000];
ll sumx[200000],sumy[200000];

int main(){
	int x,y,z;cin>>x>>y>>z;
	int n=x+y+z;
	rep(i,n){
		scanf("%d%d%d",&s[i].a,&s[i].b,&s[i].c);
	}
	sort(s,s+n,[](st a,st b){
		return a.a-a.b>b.a-b.b;
	});
	ll sum=0;
	priority_queue<P>que;
	rep(i,x){
		que.push(P(s[i].c-s[i].a,i));
		sum+=s[i].a;		
	}
	sumx[x-1]=sum;
	for(int i=x;i<n;i++){
		if(que.top().first>s[i].c-s[i].a){
			auto p=que.top();que.pop();
			sum-=s[p.second].a;
			sum+=s[p.second].c;
			que.push(P(s[i].c-s[i].a,i));
			sum+=s[i].a;
		}
		else{
			sum+=s[i].c;
		}
		sumx[i]=sum;
	}
	sum=0;
	while(!que.empty())que.pop();
	for(int i=n-1;i>=n-y;i--){
		que.push(P(s[i].c-s[i].b,i));
		sum+=s[i].b;
	}
	sumy[n-y]=sum;
	for(int i=n-y-1;i>=0;i--){
		if(que.top().first>s[i].c-s[i].b){
			auto p=que.top();que.pop();
			sum-=s[p.second].b;
			sum+=s[p.second].c;
			que.push(P(s[i].c-s[i].b,i));
			sum+=s[i].b;
		}
		else{
			sum+=s[i].c;
		}
		sumy[i]=sum;
	}
	ll ans=0;
	for(int i=x-1;i<n-y;i++){
		ans=max(ans,sumx[i]+sumy[i+1]);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 4088
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll H, I = 0;
  cin >> H;
  while(true) {
    if (H == 1) {
      I++;
      break;}
    else {
      I++;
      I *= 2;
      H /= 2;
    }
  }
  cout << I << endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,a,n) for(int i=n;i>=a;i--)
#define pb push_back
#define SZ(x) ((int)(x).size())
#define fastin ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
char s[1010];
int main(){
	scanf("%s",s+1);
	int len=strlen(s+1);
	printf("%s",s+1);
	if(s[len]!='s'){
		puts("s");
	}
	else{
		puts("es");
	}
	return 0;
}


Measured memory_bytes: 3820
from bisect import bisect_right,bisect_left
N= int(input())
L = list(map(int,input().split()))
ans=0

L.sort()

for i in range(N-1,1,-1):
    a = L[i]
    b_list = L[:bisect_right(L,(a-1))]
    for j in range(len(b_list)-1,0,-1):
        b = b_list[j]
        c_list = b_list[:bisect_right(b_list,(b-1))]
        for k in c_list:
            if k > a-b:
                ans += 1
print(ans)

Measured memory_bytes: 9164
{-# LANGUAGE FlexibleInstances    #-}
{-# LANGUAGE TypeSynonymInstances #-}

import           Control.Applicative
import           Control.DeepSeq
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                  as A
import qualified Data.Array.IArray           as IA
import qualified Data.Array.IO               as AI
import qualified Data.Array.MArray           as MA
import qualified Data.Array.ST               as STA
import qualified Data.Array.Unboxed          as AU
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import qualified Data.Graph                  as G
import           Data.Int
import qualified Data.IntMap                 as IM
import qualified Data.IntSet                 as IS
import           Data.List
import qualified Data.Map.Strict             as M
import           Data.Maybe
import           Data.Ord
import qualified Data.Sequence               as SQ
import qualified Data.Set                    as S
import           Data.Time
import qualified Data.Tree                   as T
import qualified Data.Vector                 as V
import qualified Data.Vector.Mutable         as VM
import qualified Data.Vector.Unboxed         as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

class Printable a where
  format :: a -> String

instance Printable Int where
  format = show

instance Printable Integer where
  format = show

instance Printable Double where
  format = show

instance Printable Float where
  format = show

instance Printable Char where
  format = show

instance Printable String where
  format x = x

instance Printable Bool where
  format = show

put :: Printable a => a -> IO ()
put = putStr . format

putLn :: Printable a => a -> IO ()
putLn = putStrLn . format

putList :: Printable a => [a] -> IO ()
putList [a] = put a
putList (a:as) = do
  put a
  putStr " "
  putList as

readInt :: IO [Int]
readInt = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

readInts :: Int -> IO [[Int]]
readInts n = replicateM n readInt

readInteger :: IO [Integer]
readInteger = map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine

readIntegers :: Int -> IO [[Integer]]
readIntegers n = replicateM n readInteger

readString :: IO [String]
readString = map BS.unpack . BS.words <$> BS.getLine

readStrings :: Int -> IO [[String]]
readStrings n = replicateM n <$> readString

toPair :: [a] -> (a, a)
toPair [x, y] = (x, y)

count :: Eq a => a -> [a] -> Int
count a as = length $ filter (== a) as

main = do
  [t, x] <- map read <$> readString
  let s = t / x
   in print s


Measured memory_bytes: 508
#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;
template <typename T> using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; //greater<T> for sorting decreasingly

#define ll         long long
#define pll        pair<ll,ll>
#define unique(a)  a.resize(unique(a.begin(), a.end()) - a.begin())
#define fill(v, p) memset(v,p,sizeof v)
#define all(x)     x.begin(), x.end()
#define at_(x,i)   x.find_by_order(i)
#define koto_(x,i) x.order_of_key(i)
#define PI         acos(-1.0)
#define EPS        0.000000001
#define INF        1LL<<62
#define MAX        300005
#define MOD        1000000007

ll vis[1005][10005], dp[1005][10005];

ll a[MAX], b[MAX], h, n;

ll rec(ll pos, ll health)
{
	if(pos>=n)
	{
		if(health<=0)
			return 0;
		return INT_MAX;
	}
	
	if(health<=0) return 0;
	
	if(vis[pos][health]) return dp[pos][health];
	
	ll p= b[pos]+rec(pos,health-a[pos]);
	ll q= rec(pos+1,health);
	
	if(health<0) health=0;
	
	vis[pos][health]=1;
	
	return dp[pos][health]=min(p,q);
}

signed int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(0);
	
	cin >> h >> n;
	
	for(int i=0;i<n;i++)
	{
		cin >> a[i] >> b[i];
	}
	
	cout << rec(0,h) << endl;
	
	return 0;
}


Measured memory_bytes: 160512
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
char ch[110000];
int main(){
	scanf("%s",ch+1);
	if (strlen(ch+1)>=4&&ch[1]=='Y'&&ch[2]=='A'&&ch[3]=='K'&&ch[4]=='I'){
		printf("Yes\n"); return 0;
	} else printf("No\n");
	return 0;
}

Measured memory_bytes: 256
def main():
    N, X, M = map(int, input().split())
    l = [X]
    lset = set(l)
    ans = X
    bf = X
    for i in range(N):
        nx = bf**2%M
        if nx in lset:
            break
        ans += nx
        lset.add(nx)
        l.append(nx)
        bf = nx
    st = l.index(nx)
    retry = l[st:]
    remain = N - len(l)
    ans += (remain//len(retry))*sum(retry) + sum(retry[:remain%len(retry)])
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 13776
n=int(input())

s=[]
e=[]
for i in range(n):
  a,b=map(int,input().split())
  s.append(a)
  e.append(b)


s=sorted(s)
e=sorted(e,reverse=True)

if n%2==1:
  x=n//2
  ans=(e[x]-s[x]+1)

else:
  x=n//2
  ts=(s[x]+s[x-1])/2
  te=(e[x]+e[x-1])/2
#  print(ts,te)
  ans=(te-ts)//0.5+1


print(int(ans))

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

int main(){
int n,k,x,y,sum=0;
cin >> n>>k>>x>>y;
if (n-k>0)sum=k*x+(n-k)*y;
else if(n==k)sum=k*x;
else sum=n*x;
cout << sum<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include <math.h>
#include<stdio.h>
#include <climits>
#include<algorithm>
#include<string>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define LL  long long 
#define Pi 3.14159265358979;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int i = 0, j = 0;//ループ用配列

	int n,d,x;
	int a[100] = {};
	int eat;
	
	cin >> n >> d >> x;
	rep(i, n) {
		cin >> a[i];
	}
	
	rep(i, n) {
		x = x+floor((d-1) / a[i]) + 1;
	}
	cout << x << "\n";
	
	
}


Measured memory_bytes: 256
namespace ConsoleAtCoder
{
    class Program
    {
        static void Main(string[] args)
        {

            var inputs = System.Console.ReadLine().Split(' ');
            
            int.TryParse(inputs[0].Trim(), out var h1);
            int.TryParse(inputs[1].Trim(), out var m1);
            int.TryParse(inputs[2].Trim(), out var h2);
            int.TryParse(inputs[3].Trim(), out var m2);
            int.TryParse(inputs[4].Trim(), out var k);

            var wakeUp = System.DateTime.Today.AddHours(h1).AddMinutes(m1);
            var goToBed = System.DateTime.Today.AddHours(h2).AddMinutes(m2);
            var studyTime = System.TimeSpan.FromMinutes(k);
            

            if(goToBed < wakeUp || goToBed.Subtract(wakeUp) < studyTime)
            {
                System.Console.WriteLine("0");
            }
            else
            {
                System.Console.WriteLine(goToBed.Subtract(wakeUp).Subtract(studyTime).TotalMinutes.ToString());
            }
            
        }
    }
}


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

int main() {
  int N;
  cin >> N;
  bool y = false;
  
  for (int i = 0; i < N; i++) {
    string A;
    cin >> A;
    if (A == "Y") {
      y = true;
      cout << "Four" << endl;
      break;
    }
  }
  if (!y) {
  cout << "Three" << endl;
  }
}

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

int main() {
        int n, a, b;
        cin >> n >> a >> b;
        string s;
        cin >> s;
        int passed = 0;
        int abrd = 0;
        for (int i = 0; i < n; i ++) {
                if (s[i] == 'a') { 
                        if (passed < a + b) {
                                cout << "Yes" << endl;
                                passed ++;
                        } else {
                                cout << "No" << endl;
                        }
                }
                else if (s[i] == 'b') {
                        abrd ++;
                        if (passed < a + b && abrd <= b) {
                                cout << "Yes" << endl;
                                passed ++;
                        } else {
                                cout << "No" << endl;
                        }
                } else {
                        cout << "No" << endl;
                }
        }
        return 0;
}



Measured memory_bytes: 896
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
//typedef vector<unsigned int>vec;
typedef vector<ll>vec;
typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
//const ll MOD = 998244353;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    string S;
    cin >> S;

    queue<int> q;
    vector<int> ans;
    vector<int> dist(N+1, -1);
    dist[N] = 0;
    q.push(N);
    while(!q.empty()){
        int cur = q.front();
        q.pop();
        if(cur == 0) break;
        for(int i=M;i>=1;i--){
            if(cur - i < 0){
                ans.push_back(cur);
                dist[0] = dist[cur] + 1;
                break;
            }
            if(S[cur-i] == '1' || dist[cur-i] != -1) continue;
            ans.push_back(i);
            q.push(cur-i);
            dist[cur-i] = dist[cur] + 1;
            break;
        }
    }
    if(dist[0] == -1){
        cout << -1 << endl;
        return 0;
    }
    reverse(ans.begin(), ans.end());
    REP(i,ans.size()) cout << ans[i] << " ";
    cout << endl;
}


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

int main(){
    int n;
    cin >> n;
    int ans[4];
    for(int i=0; i<4; i++){
        ans[i] = 0;
    }
    for(int i = 0; i < n; i++){
        char c;
        cin >> c;
        if(c=='P'){
            ans[0] = 1;
        }else if(c=='W'){
            ans[1] = 1;
        }else if(c=='G'){
            ans[2] = 1;
        }else if(c=='Y'){
            ans[3] = 1;
        }
    }
    int res = accumulate(ans, ans+sizeof(ans)/sizeof(ans[0]), 0);
    if(res==3){
        cout << "Three" << endl;
    }else if(res==4){
        cout << "Four" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

struct edge {
    ll to, cost;
};

int V;
vector<edge> G[1000000];
ll d[1000000];

void addedge(int st, int ed, ll co) {
    edge e;
    e.to = ed;
    e.cost = co;
    G[st].push_back(e);
}

int h[1000000];
vector<int> tsorted;

//トポロジカルソート。結果はtsortedに入る。
bool tsort() {
    fill(h, h + V, 0);
    for (int i = 0; i < V; i++) {
        int len = G[i].size();
        for (int j = 0; j < len; j++) {
            h[G[i][j].to]++;
        }
    }
    queue<int> que;
    for (int i = 0; i < V; i++) {
        if (h[i] == 0) {
            que.push(i);
            tsorted.push_back(i);
        }
    }
    while (!que.empty()) {
        int p = que.front();
        que.pop();
        int len = G[p].size();
        for (int i = 0; i < len; i++) {
            int mark = G[p][i].to;
            h[mark]--;
            if (h[mark] == 0) {
                que.push(mark);
                tsorted.push_back(mark);
            }
        }
    }
    int sortedsize = tsorted.size();
    if (sortedsize == V) {
        return true;
    } else {
        return false;
    }
}

ll dp[100010];

int main() {
    ll N, M;
    cin >> N >> M;
    V = N;
    ll x[M], y[M];
    REP(i, 0, M) {
        cin >> x[i] >> y[i];
        addedge(x[i] - 1, y[i] - 1, 1);
    }
    tsort();
    // cout << "aaa" << endl;
    fill(dp, dp + N, 0);
    // REP(i, 0, N) {
    //     cout << tsorted[i] << endl;
    // }
    REP(i, 0, N) {
        REP(j, 0, G[tsorted[i]].size()) {
            ll to = G[tsorted[i]][j].to;
            dp[to] = max(dp[to], dp[tsorted[i]] + 1);
        }
    }
    ll ans = 0;
    REP(i, 0, N) {
        ans = max(ans, dp[i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 30328
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+100;
const int INF=0x3f3f3f3f;

int k,x;
int main()
{
    cin>>k>>x;
    for(int i=x-k+1;i<=k+x-1;i++)
        cout<<i<<" ";
    cout<<endl;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
ans = 1
lim = int(1e+18)
if a.count(0):
    print(0)
    exit()
for i in range(n):
    ans *= a[i]
    if lim < ans:
        print(-1)
        exit()
print(ans)

Measured memory_bytes: 21628
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        n: usize,
        a: [i64; n],
    }

    let mut a = a
        .into_iter()
        .sorted()
        .collect::<std::collections::VecDeque<_>>();

    let mut l = a.pop_front().unwrap();
    let mut r = l;
    let mut res = 0;
    while let (Some(f), Some(b)) = (a.front(), a.back()) {
        let x = *[
            ((f - l).abs(), 0),
            ((f - r).abs(), 1),
            ((b - l).abs(), 2),
            ((b - r).abs(), 3),
        ]
        .iter()
        .max()
        .unwrap();
        res += x.0;
        if x.1 == 0 {
            l = *f;
            a.pop_front();
        } else if x.1 == 1 {
            r = *f;
            a.pop_front();
        } else if x.1 == 2 {
            l = *b;
            a.pop_back();
        } else if x.1 == 3 {
            r = *b;
            a.pop_back();
        }
    }
    println!("{}", res);
}


Measured memory_bytes: 4460
(let* ((n (loop :repeat 9 :collect (read))))
  (loop :repeat (read) :do(let* ((a (position (read) n)))
                            (if a (setf (nth a n) 0))))
  (if (or (= 0 (loop :for k :in '(0 1 2) :sum(nth k n)))
          (= 0 (loop :for k :in '(3 4 5) :sum(nth k n)))
          (= 0 (loop :for k :in '(6 7 8) :sum(nth k n)))
          (= 0 (loop :for k :in '(0 3 6) :sum(nth k n)))
          (= 0 (loop :for k :in '(1 4 7) :sum(nth k n)))
          (= 0 (loop :for k :in '(2 5 8) :sum(nth k n)))
          (= 0 (loop :for k :in '(0 4 8) :sum(nth k n)))
          (= 0 (loop :for k :in '(2 4 6) :sum(nth k n))))
      (princ "Yes")
      (princ "No")))

Measured memory_bytes: 15840
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ll long long
#define ld long double
#define zeros(x) x^(x-1)&x
#define pii pair<ll,ll>
#define cd complex<double>
#define dbg(x) cerr<<#x<<": "<<x<<endl;
#define Nmax 200005
#define OFF 100001
using namespace std;

int n,l,sav,v[Nmax];

int main()
{
    cin >> n >> l;
    for (int i=1;i<=n;i++){
        cin >> v[i];
        if (v[i] + v[i-1] >= l) sav = max(1,i-1);
    }
    if (sav == 0){
        cout << "Impossible\n";
        return 0;
    }
    cout << "Possible\n";
    for (int i=1;i<sav;i++) cout << i << '\n';
    for (int i=n-1;i>=sav;i--) cout << i << '\n';
    return 0;
}


Measured memory_bytes: 1152
#include<stdio.h>

void trace(int A[], int n){
  int i;
  for(i=0; i<n; i++){
    if(i>0) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

int main(void){
  int n;
  int A[100];
  int i,j,v;
  
  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf("%d", &A[i]);
  }
  trace(A,n);
  
  for(i=1; i<n; i++){
    v = A[i];
    j = i - 1;
    while(j>=0 && A[j]>v){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;

    trace(A,n);
  }
  return 0;
}

Measured memory_bytes: 1852
using System;
using System.Linq;
using System.Collections.Generic;

public class BinarySearch{
	public static void Main()
	{
		Console.ReadLine();
		var sList = ReadLineAndToIntList().ToList();
		Console.ReadLine();
		var tList = ReadLineAndToIntList();
	
		int count = 0;
	
		foreach (var t in tList)
		{
			if(sList.BinarySearch(t) > -1) count++;
		}
		
		Console.WriteLine(count);
	}
	
	//??????????????????????????????
	public static IEnumerable<int> ReadLineAndToIntList()
	{
		return Console.ReadLine().Split().Select (c => int.Parse(c));
	}
}

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

int main() {
	string s;
	cin >> s;
	bool a0 = s[0] == 'R';
	bool a1 = s[1] == 'R';
	bool a2 = s[2] == 'R';
	if (a0 && a1 && a2) cout << 3 << endl;
	else if (a0 && a1) cout << 2 << endl;
	else if (a1 && a2) cout << 2 << endl;
	else if (a0) cout << 1 << endl;
	else if (a1) cout << 1 << endl;
	else if (a2) cout << 1 << endl;
	else cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 3160
#include <bits/stdc++.h>
    using namespace std;
     
    int main(){
      vector<int> n(5);
      for(int i=0; i<5; i++)cin >> n.at(i);
      int k; 
      cin >> k;
      //int a = s.at(6);
      //cout << a << endl;
      for(int i=0; i<5; i++){
        for(int j=i+1; j<5; j++){
          if((n.at(j)-n.at(i))>k){
            cout << ":(" << endl;
            return 0;
          }
        }
      }
      cout << "Yay!" << endl;
      //if(s.at(5)=='1') cout << "TBD" << endl;
      //else if(4<(a-48)) cout << "TBD" << endl;
      //else cout << "Heisei" << endl;
      return 0;
    }

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

	for (int i = 0; i < S.length() - 1; i++) {
		if (S[i] == 'A' && S[i + 1] == 'C') {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}




Measured memory_bytes: 256
import Control.Monad
import Data.List

main :: IO ()
main = readLn >>= main'
    where
        main' n = replicateM n readLn >>= print . solve n 

solve :: Int -> [Int] -> Int 
solve n as
    | even n = 2 * (sum ys - sum xs) - head ys + last xs
    | otherwise = max s t 
    where
        bs = sort as
        (xs, ys) = splitAt (n `div` 2) bs 
        (us, vs) = splitAt (n `div` 2 + 1) bs

        s = 2 * (sum ys - sum xs) - (sum $ take 2 ys)
        t = 2 * (sum vs - sum us) + (sum . take 2 $ reverse us)


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

#define int long long

const int N = 20 + 2;
int n, m, c, ans, a[N], ar[N][N];

int32_t main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> m >> c;
	for (int i = 0; i < m; i++)
		cin >> a[i];
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)
			cin >> ar[i][j];
	
	for (int i = 0; i < n; i++) {
		int sum = c;
		for (int j = 0; j < m; j++)
			sum += ar[i][j] * a[j];
		ans += (sum > 0);
	}
	cout << ans << endl;
}

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

int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  if(A+B > C+D) cout << "Left" << endl;
  else if(A + B == C + D) cout << "Balanced" << endl;
  else cout << "Right" << endl;
}


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

int main(void){
	int n;
	cin>>n;
	for (int i=0; i<n; i++){
		double xa, ya, ra, xb, yb, rb, r;
		cin>>xa>>ya>>ra>>xb>>yb>>rb;
		r=pow(pow((xa-xb),2)+pow(ya-yb,2),.5);
		if (r>ra+rb) cout<<0<<endl;
		else if (r<ra-rb) cout<<2<<endl;
		else if (r<rb-ra) cout<<-2<<endl;
		else cout<<1<<endl;
	}
	return 0;
}

Measured memory_bytes: 1288
from collections import defaultdict
import numpy as np
N, K = map(int, input().split())
A = [0] + list(map(int, input().split()))
A = np.array(A)
A %= K
A = A.cumsum()
tmp = np.arange(N + 1)

B = (A - tmp) % K

ans = 0
d = defaultdict(int)
for i in range(min(K, N + 1)):
    x = B[i]
    ans += d[x]
    d[x] += 1

if N > K:
    for i in range(K, N + 1):
        x = B[i]
        y = B[i - K]
        d[y] -= 1
        ans += d[x]
        d[x] += 1

print(ans)


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

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (int i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (int i = x.size()-1; i >= 0; i--)
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define MAX(a,b) a = max(a,b)
#define MIN(a,b) a = min(a,b)
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define fst first
#define scd second
#define nextline putchar('\n')
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

int main()
{
    int h, a;
    cin>>h>>a;
    cout<<(h + a - 1) / a<<endl;

    return 0;
}


Measured memory_bytes: 256
a = gets.split
n1 = a[0].to_i
n2 = a[1].to_i
b = n1-1
t = n1-1

b.times do
  if n2 - t < -1000000
  else
      print n2 - t," " 
      t = t - 1
  end
end

print n2 , " "

t = 1
b.times do
  if n2 + t > 1000000
  else
      print n2 + t," " 
        t = t + 1
  end
end

Measured memory_bytes: 1788