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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n; cin >> n;
	string s; cin >> s;
	
	ll res = 0;

	vvl dp(n+1,vl(n+1,0));
	FORD(i,0,n) FORD(j,0,n) {
		if (s[i] != s[j]) continue;
		dp[i][j] = dp[i+1][j+1] + 1;
		
		ll k = min(j-i,dp[i][j]);
		res = max(res,k);
	}
	cout << res << endl;
}



Measured memory_bytes: 195968
a, b, k = list(map(int, input().split()))

for i in range(k):
    if i % 2 == 0:
        if a % 2 == 1:
            a -= 1
        b += a / 2
        a = a / 2
    else:
        if b % 2 == 1:
            b -= 1
        a += b / 2
        b = b / 2
print("{} {}".format(int(a), int(b)))

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long ll;
const ll mod=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<n+1;i++)

vector<ll> divisor_enumerate(ll N){
    vector<ll> front,back;
    for(ll i=1;i*i<N+1;i++){
        if(N%i==0){
            front.push_back(i);
            back.push_back(N/i);
        }
    }
    if(front.back()==back.back()) front.pop_back();
    // while(!back.empty()){
    //     if(back.back()==front.back()) back.pop_back();
    //     else{
    //         front.push_back(back.back());
    //         back.pop_back();
    //     }
    // }
    return front;
}

int main(){
    ll N;
    cin>>N;
    vector<ll> vec;
    vec=divisor_enumerate(N);
    ll ans=0;
    ll num;
    while(!vec.empty()){
        num=vec.back();
        vec.pop_back();
        if(N/num==(num+1)) continue;
        ans+=N/num-1;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
def main():
    from collections import Counter
    n=int(input())
    a=list(map(int,input().split()))

    ctr = Counter(a)
    frm_n = sum(x * (x - 1) // 2 for x in ctr.values())

    ans = []
    for x in a:
        ans.append(frm_n - ctr[x] + 1)

    print(*ans, sep='\n')


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok


Measured memory_bytes: 30004
# https://atcoder.jp/contests/diverta2019/tasks/diverta2019_b

r, g, b, n = gets.split.map(&:to_i)
# dp[r][g][b] = sum
dp = Array.new(3000).map { Array.new(3000) }.map { Array.new(3000) }

res = 0

0.upto(n / r) do |i|
  break if i * r > n
  0.upto(n / g) do |j|
    rest = n - (i * r + j * g)
    break if rest < 0
    res += 1 if rest % b == 0
  end
end

puts res

Measured memory_bytes: 142716
#include <atcoder/dsu>
#include <cstdio>

using namespace std;
using namespace atcoder;

int main() {
    int n, q;
    scanf("%d %d", &n, &q);
    dsu d(n);
    for (int i = 0; i < q; i++) {
        int t, u, v;
        scanf("%d %d %d", &t, &u, &v);
        if (t == 0) {
            d.merge(u, v);
        } else {
            if (d.same(u, v)) {
                printf("1\n");
            } else {
                printf("0\n");
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3556
#!/usr/bin/env python3
import sys


def solve(S: str, T: str):
    s = 0
    for i in range(len(S)):
        if S[i] != T[i]:
            s+=1
    print(s)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    solve(S, T)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9740
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100001,INF=1<<30;

ll rui(ll a,ll b){
    if(b==1) return a%mod;
    else if(b==0) return 1;
    else if(b%2==0) return (rui(a,b/2)*rui(a,b/2))%mod;
    else return (rui(a,b-1)*a)%mod;
}

ll inv[MAX],fac[MAX],finv[MAX];

void make(){
    
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    
    for(int i=2;i<MAX;i++){
        inv[i]=mod-inv[mod%i]*(mod/i)%mod;
        fac[i]=fac[i-1]*(ll)i%mod;
        finv[i]=finv[i-1]*inv[i]%mod;
    }
    
}

ll comb(ll a,ll b){
    if(a<b) return 0;
    return fac[a]*(finv[b]*finv[a-b]%mod)%mod;
}

int main(){

    int N,K;cin>>N>>K;
    make();
    cout<<comb(N+K-1,K-1)<<endl;
}




Measured memory_bytes: 5436
#include<iostream>
#include<string>
#include<algorithm>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <set>
#include <queue>
#include <stack>
#include <map>

using namespace std;
typedef int status;
typedef long long ll;
typedef unsigned long long ull;
const ull base = 343;
const int INF = int(1e9);
const int MAX = 200002;

int N;
int a[200];
int x,y;

int main()
{
    cin>>N;
    for(int i = 1;i<=N;i++)
        cin>>a[i];
    sort(a+1,a+1+N);
    for(int i = N;i>=1;i--){
        if((N-i)%2==0)x+=a[i];
        else y+=a[i];
    }
    cout<<x-y<<endl;

    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func ZArray(s string) []int {
	n := len(s)
	z := make([]int, n)
	var l, r, k int
	for i := 0; i < len(s); i++ {
		if i > r {
			l = i
			r = i
			for r < n && s[r-l] == s[r] {
				r++
			}
			z[i] = r - l
			r--
		} else {
			k = i - l
			if z[k] < r-i+1 {
				z[i] = z[k]
			} else {
				l = i
				for r < n && s[r-l] == s[r] {
					r++
				}
				z[i] = r - l
				r--
			}
		}
	}
	return z
}

func main() {
	var n int
	var s string
	fmt.Scan(&n, &s)
	var ans int

	for i := 0; i < n; i++ {
		z := ZArray(s[i:n])
		for j := 0; j < n-i; j++ {
			if z[j] > j {
				z[j] = j
			}
			if ans < z[j] {
				ans = z[j]
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 7680
# -*- Coding: utf-8 -*-
n, m = map(int, input().split())
INF = 1001001001
key_list = []
cost_list = []
for i in range(m):
  a, b = map(int, input().split())
  cost_list.append(a)
  c = list(map(int, input().split()))
  s = 0
  for j in range(b):
    s |= 1 << c[j] - 1
  key_list.append(s)
   
dp = [INF] * (1 << n)
dp[0] = 0
for s in range(1 << n):
  for i in range(m):
    t = s | key_list[i]
    cost = dp[s] + cost_list[i]
    dp[t] = min(cost, dp[t])
if dp[-1] == INF:
  ans = -1
else:
  ans = dp[-1]
print(ans)


Measured memory_bytes: 45800
#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>;
using Graph = vector<vector<int>>;

int main(){
    string s;
    cin >> s;
    int n=s.size(), ans=0;
    for(int i=0; i<n/2; ++i){
        if(s[i]==s[n-i-1]) continue;
        ++ans;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

typedef struct node{
  char mark;
  int val;
} card;

int main(){
  card a[36],b[36],put;
  int n,i,j,minj,flag = 0;
  char putc;

  scanf("%d",&n);
  for(i = 0;i < n;i++){
    scanf(" %c%d",&a[i].mark,&a[i].val);
    b[i] = a[i];
  }

  for(j = 0;j < n-1;j++){//bub
    for(i = n-1;i > j;i--){
      if(b[i-1].val > b[i].val){
	put = b[i];
	b[i] = b[i-1];
	b[i-1] = put;
      }
    }
  }

  for(i = 0;i < n;i++){
    if(i != 0) printf(" ");
    printf("%c%d",b[i].mark,b[i].val);
  }
  printf("\nStable\n");

  for(i = 0;i < n-1;i++){//cho
    minj = i;
    for(j = i+1;j < n;j++){
      if(a[j].val < a[minj].val){
	minj = j;
      }
    }
    put = a[i];
    a[i] = a[minj];
    a[minj] = put;
  }
  for(i = 0;i < n;i++){
    if(i != 0) printf(" ");
    printf("%c%d",a[i].mark,a[i].val);
    if(a[i].mark != b[i].mark) flag++;
  }
  printf("\n");
  if(flag > 0) printf("Not stable\n");
  else printf("Stable\n");

  return 0;
}



Measured memory_bytes: 2048
#include<bits/stdc++.h>
#define ll long long
#define MOD int(1e9+7)
#define pb push_back
using namespace std;

int main()
{
    int n,m=INT_MAX;
    cin>>n;
    int ans=0;
    while(n--)
    {
        int x;
        cin>>x;
        if(x<=m) ans++;
        m=min(m,x);
    }
    cout<<ans;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include <math.h>

//#define rep(i,n) for(int i = 0;i<(n);i++);



int ASCttenannoryaku(const void *a,const void *b) {
	return *(int *)a - *(int *)b;
}
int main(void)
{
	int n;
	scanf("%d",&n);
	int ans = n / 2;
	if (n % 2 == 1)ans += 1;
	printf("%d",ans);

	return 0;
}


Measured memory_bytes: 128
N = int(input())
A = list(map(int, input().split()))
X = [0]*N

for i in A:
    X[i-1] += 1

cnt = 0
for i in X:
    cnt += i* (i-1) // 2

for i in A:
    ans = cnt - (X[i-1] - 1)
    print(ans)

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

#define pb push_back
#define eb emplace_back
#define mk make_pair
#define fi first
#define se second
#define mset(a, b) memset(a, b, sizeof(a))
#define DBG(x) cout << "[" << #x << "]: " << x << endl
using ll = long long;
using pii = pair<int, int>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template<class Ty> Ty rnd(Ty a, Ty b) { return uniform_int_distribution<Ty>(a, b)(rng); }
template<class num> inline void rd(num& x) {
	char c; while(isspace(c = getchar()));
	bool neg = false;
	if(!isdigit(c)) neg = (c == '-'), x = 0;
	else x = c - '0';
	while(isdigit(c = getchar())) x = (x << 3) + (x << 1) + c - '0';
	x = neg ? -x : x; }
template <class... Args> inline void rd(Args&... args) { (rd(args), ...); }
template <class... Args> inline void rf(Args&... args) { (cin >> ... >> args); }
template <class... Args> inline void pr(Args&&... args) { (cout << ... << args); }

const int MAXN = 2e5 + 5, INF = 0x3f3f3f3f;

int main() {
	int n; rd(n);
	n%=10;

	if (n == 2 or n == 4 or n == 5 or n == 7 or n == 9) puts("hon");
	else if (n == 0 or n == 1 or n == 6 or n == 8) puts("pon");
	else puts("bon");
}

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

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

	int A[10000 + 10],count,answer;
	count = 0;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		while (A[i] % 2 == 0) {
			count++;
			A[i] /= 2;
		}
	}

	answer = count;

	cout << answer;
}

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

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        Integer a = Integer.parseInt(scanner.next());
        Integer b = Integer.parseInt(scanner.next());
        Integer c = Integer.parseInt(scanner.next());

        Integer total = a + b + c;
        if (total >= 22) {
            System.out.println("bust");
        } else {
            System.out.println("win");
        }
    }
}


Measured memory_bytes: 21972
package main

import (
	"fmt"
	//"math"
	"strings"
)

func main() {
	var n,k int
	var s string
	fmt.Scan(&n,&k,&s)
 
	str := strings.Split(s,"")
	str[k-1] = strings.ToLower(str[k-1])
 
	fmt.Println(strings.Join(str,""))
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
int main() {
	int N, cunt = 0;
	long long res = 0, mini = 9999999999;
	cin >> N;
	vector<long long> A(N);
	for (int i = 0; i < N; i++){
		cin >> A.at(i);
		if (A.at(i)<0) {cunt++;	}
	}
	for (int i = 0; i < N; i++)
	{
		mini = min(mini, abs(A.at(i)));
		res += abs(A.at(i));
	}
	if (cunt % 2 == 0) {cout << res << endl;}
	else {
		res = res - 2 * mini;
		cout << res << endl;
	}
}

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

    const int MOD = 1000000007;
    const double PI = acos(-1); 

    //long long
    using ll = long long;

    //出力系
    #define print(x) cout << x << endl
    #define yes cout << "Yes" << endl
    #define YES cout << "YES" << endl
    #define no cout << "No" << endl
    #define NO cout << "NO" << endl
    
    // begin() end()
    #define all(x) (x).begin(),(x).end()

    //for
    #define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

    //最大公約数（ll）
    ll gcd(ll x, ll y) { return y ? gcd(y,x%y) : x;}

    //素因数分解
    vector<pair<ll, int>>factorize(ll n){
      vector<pair<ll, int>> res;
      for(ll i = 2; i * i <= n; ++i){
        if(n % i) continue;
        res.emplace_back(i, 0);
        while(n % i == 0){
          n /= i;
          res.back().second++;
        }
      }
    if(n != 1) res.emplace_back(n, 1);
    return res;
    }



  // // 二分探索(最小値を出す問題は疑う)
  // bool C(ll x){
  //     ll res = 0;
  //     for(int i = 0; i < N; ++i){
  // 		res += max(0ll, A[i]-x/F[i]);
  //     }
  //     return res <= K;
  // }

  //   ll binary_search(ll ok, ll ng){
  //     while(abs(ok - ng) > 1){
  //       ll mid = (ok + ng) / 2;
  //       if(C(mid)) ok = mid;
  //       else ng = mid;
  //     }
  //     return ok;
  //   }



  int main(){
    int A, B, C;
    cin >> A >> B >> C;
    if(A + B + 1 >= C) print(B + C);
    else print((A + B + 1) + B);
  }

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

int main() {
  string s;cin>>s;
  int n=s.size();
  int cnt=0;
  rep(i,n){
    int t=s[i]-'0';
    cnt+=t;
  }
  if(cnt%9==0)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3736
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <iostream>
#include <queue>
#include <list>
#include <stack>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  int W, H;
  cin >> W >> H;

  vector<ll> P(W), Q(H);
  rep(i,W){
    cin >> P[i];
  }
  rep(i,H){
    cin >> Q[i];
  }

  sort(ALLOF(P));
  sort(ALLOF(Q));

  ll ret = 0;
  int i = 0, j = 0;
  while(true){
    if(i>=W && j>=H) break;
    if(i>=W){
      ret += Q[j];
      j++;
    }
    else if(j>=H){
      ret += P[i];
      i++;
    }
    else {
      if(P[i] <= Q[j]){
        ret += P[i] * (H+1 - j);
        i++;
      }else{
        ret += Q[j] * (W+1 - i);
        j++;
      }
    }
  }
  
  cout << ret << endl;
  return 0;
}



Measured memory_bytes: 1792
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>

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)
using ll = long long;
#define EPS 1e-9
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const int MINF = -1e9;;


int main() {
	ll l, r;
	cin >> l >> r;
	if (r - l >= 2019) {
		cout << 0 << endl;
		return 0;
	}
	else {
		ll res = 2018;
		for (ll i = l; i < r; ++i) {
			for (ll j = i + 1; j <= r; ++j) {
				res = min(res, (i*j) % 2019);
			}
		}
		cout << res << endl;
	}
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Text;
using CompLib.Util;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int h = sc.NextInt();
        int w = sc.NextInt();
        string[] a = new string[h];
        for (int i = 0; i < h; i++)
        {
            a[i] = sc.Next();
        }

        bool[] rr = new bool[h];
        bool[] cc = new bool[w];

        for (int i = 0; i < h; i++)
        {
            bool flag = true;
            for (int j = 0; j < w; j++)
            {
                if (a[i][j] == '#')
                {
                    flag = false;
                    break;
                }
            }

            rr[i] = flag;
        }

        for (int j = 0; j < w; j++)
        {
            bool flag = true;
            for (int i = 0; i < h; i++)
            {
                if (a[i][j] == '#')
                {
                    flag = false;
                    break;
                }
            }

            cc[j] = flag;
        }

        var sb = new StringBuilder();
        for (int i = 0; i < h; i++)
        {
            if (rr[i]) continue;
            for (int j = 0; j < w; j++)
            {
                if (cc[j]) continue;
                sb.Append(a[i][j]);
            }

            sb.AppendLine();
        }

        Console.Write(sb);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 13140
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

#ifdef DEBUG
mt19937 mrand(300); 
#else
mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count()); 
#endif

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int mod = (int) 1e9 + 7;

int mul(int a, int b) {
  return (long long) a * b % mod;
}

void add(int &a, int b) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
}

const int maxn = (int) 1e5 + 5;
int n;
char tmp[maxn];
string s;

bool read() {
  if (scanf("%d", &n) < 1) {
    return false;
  }
  scanf("%s", tmp);
  s = tmp;
  return true;
}

const int sigma = 26;
int cnt[sigma];

void solve() {
  for (int i = 0; i < sigma; i++) {
    cnt[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    cnt[s[i] - 'a']++;
  }
  int res = 1;
  for (int i = 0; i < sigma; i++) {
    res = mul(res, cnt[i] + 1);
  }
  add(res, mod - 1);
  printf("%d\n", res);
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 384
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        List<int> a = Console.ReadLine().Split().Select(i => int.Parse(i)).ToList();
        List<int> b = Console.ReadLine().Split().Select(i => int.Parse(i)).ToList();
        List<int> gap = new List<int>();
        List<int> adv = new List<int>();

        for (int i = 0; i < a.Count; i++)
        {
            if (a[i] < b[i])
            {
                gap.Add(b[i] - a[i]);
            }
            else if (b[i] < a[i])
            {
                adv.Add(a[i] - b[i]);
            }
        }
        ulong gap_sum = 0;
        for (int i = 0; i < gap.Count; i++)
        {
            gap_sum += (ulong)gap[i];
        }
        Debug.WriteLine(gap_sum);
        long ans = gap.Count;
        adv.Sort((x, y) => y - x);
        for (int i = 0; i < adv.Count; i++)
        {
            if (gap_sum <= 0) break;
            if (gap_sum < (ulong)adv[i]) gap_sum = 0;
            else gap_sum -= (ulong)adv[i];
            ans++;
        }
        if (0 < gap_sum) Console.WriteLine(-1);
        else Console.WriteLine(ans);
    }
}

Measured memory_bytes: 33828
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
const int INF = 1000000009;
const ll LINF = 1e18;

int n;

void dfs(string s, char mx) {
  if (s.size() == n) {
    cout << s << endl;
    return;
  }

  for (char c = 'a'; c <= mx + 1; c++) {
    string t = s;
    t += c;
    dfs(t, max(mx, c));
  }
}

int main() {
  cin >> n;
  dfs("", 'a' - 1);
}


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

int main(){
	int n, x;
	cin >> n >> x;
	int temp = 0;
	int ans = 1;
	for(int i = 0; i < n; i++){
		int z;
		cin >> z;
		temp += z;
		if(temp <= x)
			ans++;
	}
	cout << ans << endl;
	return 0;
}

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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long



int32_t main() {

    int n, m; cin >> n >> m;
    priority_queue<int> pq;
    for(int i = 0; i < n; ++i) {
        int x; cin >> x;
        pq.push(x);
    }

    for(int i = 0; i < m; ++i) {
        int x = pq.top(); pq.pop();
        pq.push(x/2);
    }

    int ans = 0;
    while(!pq.empty()) {
        ans += pq.top(); pq.pop();
    }

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


Measured memory_bytes: 1400
#include<bits/stdc++.h>
#define MOD (1e9 +7)
#define rep(i, x, n) for(int i = x; i < n; i++)
#define repr(i, x, n) for(int i = x; i > n; i--)

#define ll long long
const long long iinf = 1e18;
const int inf = 1e9; 
using namespace std;


void solve()
{
    int k;
    string s;
    cin >> k >> s;

    if(s.size() <= k) cout << s;
    else{
        string ans(s.begin(), s.begin()+k);
      
        cout << ans+"...";
    }

}

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

    // int t; cin >> t;
    // int i = 1;
    // while(t--){
    //     //cout << "Case " << i++ << ": " ;
    //     solve();
    //     cout  << endl;
    // }
    solve();

    return 0;
}

Measured memory_bytes: 3656
import java.util.Scanner;

public class Main
{
    public static void main(String [] args)
    {
        Scanner key = new Scanner(System.in);
        int num = key.nextInt();
        long sum = 0;
        for(int i=0; i<=num; i++)
        {
            
            if(i % 3 == 0 || i % 5 == 0)
                continue;
            else
            {
                sum = sum + i;
            }
                
            
        }
        System.out.println(sum);
    }
}

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

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);
		Scanner s = new Scanner(System.in);
		
		String[] split = f.readLine().split("\\s+");
		long a = Long.parseLong(split[0]), b = Long.parseLong(split[1]), x = Long.parseLong(split[2]);
		long fB = fn(b, x);
		long fA = fn(a-1, x);
		System.out.println(fB-fA);
	}
	
	static long fn(long n, long x) {
		if(n<0) return 0;
		return n / x + 1;
	}
}

Measured memory_bytes: 9804
#include <bits/stdc++.h>
typedef  long long ll;
#define fr(i,a,b) for(ll i=a; i<b; i++)
#define rf(i,a,b) for(ll i=a; i>=b; i--)
typedef std::vector<long long > vi ;
#define F first
#define S second
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define PB push_back
#define MP make_pair
#define PI 3.14159265358979323846
#define all(a) a.begin(),a.end()
#define mx(a) *max_element(all(a))
#define mn(a) *min_element(all(a))
#define endl '\n'
#define show(a) for(auto el:a)cout<<el<<" "
const ll INF=LLONG_MAX/2;
const ll N=2e5+1;
#define yesno(f) yes(f);no(f);
#define yes(f) if(f)cout<<"YES\n";
#define no(f) if(!f)cout<<"NO\n";
using  namespace std;
ll pow1(ll n,ll p)
{
	if(p==0)	return 1;
	ll x=pow1(n, p/2);
	x=(x*x);
	if(p%2==0)
		return x;
	else
		return (x*n);
}
int main()
{
    fast;
   ll t;
   t=1;
   while(t--)
   {
       string s,t,u;
       cin>>s>>t;
       ll h,n,k,sum=0,a,b;
       std::cin >>a>>b>>u;
       if(u==s)
       cout<<a-1<<" "<<b<<"\n";
       else
       cout<<a<<" "<<b-1<<"\n";
       
   }
}

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

int main(void){
    double x1,x2,y2,y1;

    scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);

    printf("%lf\n",sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
    return 0;
}

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

int main(void){
    int i, j, H, W;
    while(1){
        cin >> H >> W;
        if(H==0 && W==0) break;
        for(i=0; i<H; i++){
            for(j=0; j<W; j++){
                if(i%2==0 && j%2==0) cout << "#";
                if(i%2==0 && j%2==1) cout << ".";
                if(i%2==1 && j%2==0) cout << ".";
                if(i%2==1 && j%2==1) cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}



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

if n == 100000:
    ans = 90000 + 900 + 9
elif n >= 10000:
    ans = n - 9999 + 900 + 9
elif n >= 1000:
    ans = 900 + 9
elif n >= 100:
    ans = n - 99 + 9
elif n >= 10:
    ans = 9
else:
    ans = n

print(ans)

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

using ll = long long;

ll n;

std::map<ll, ll> mapa;

int main() {
    std::cin >> n;
    ll solutions = 0;
    for (ll i = 0, tmp; i < n; ++i) {
        std::cin >> tmp;
        solutions += mapa[i - tmp];
        mapa[i + tmp] += 1;
    }
    std::cout << solutions;
    return 0;
}

Measured memory_bytes: 26324
import itertools


def is_achievable(problems_fully_solved, target):
    score = 0
    n_problems_solved = 0
    for problem in problems_fully_solved:
        score += p_n[problem] * 100 * problem + c_n[problem]
        n_problems_solved += p_n[problem]
    if score >= target:
        return True, n_problems_solved
    problem_partially_solved = max(set(range(1, D+1)) - set(problems_fully_solved))
    for _ in range(1, p_n[problem_partially_solved]):
        score += problem_partially_solved * 100
        n_problems_solved += 1
        if score >= target:
            return True, n_problems_solved
    return False, None


D, G = map(int, input().split(" "))
p_n, c_n = [None, ], [None, ]

for i in range(1, D+1):
    p, c = map(int, input().split(" "))
    p_n.append(p)
    c_n.append(c)

answer = 10000
for combination in itertools.product([True, False], repeat=D):
    l = [i+1 for i in range(D) if combination[i]]
    flag, n_problems_solved = is_achievable(l, G)
    if flag:
        if n_problems_solved < answer:
            answer = n_problems_solved
print(answer)






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

int main(){
  int H,W;
  cin >> H >> W;
  
  vector<vector<char>> table(H, vector<char>(W));
  int k;
  for (int i = 0; i<H;i++){
    k =0;
    for (int j =0;j<W;j++){
    cin >> table.at(i).at(j);
      if(table.at(i).at(j) == '.') k ++;
      if(k == W) {
        i --;
        H --;
      }  
    }
  }  

  
  for (int j=0;j<W;j++){
    k =0;
    for (int i =0;i<H;i++)
      if(table.at(i).at(j) == '.') k ++;
          
    if(k == H){
      for (int m = j;m<W;m++){
        for(int n = 0;n < H; n++)
         if(m != W-1)  
         table.at(n).at(m) = table.at(n).at(m+1);
      }
      j --;
      W --;
     }
  } 
    
    
 	for (int i=0;i<H;i++){    
    for (int j=0;j<W;j++){
      cout << table.at(i).at(j);
      if (j == W-1) cout << endl;
    }
 	}

}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <stack>
#include <string>
using namespace std;
using ll=long long;

const int nmax=55555;
int prime[nmax+1];
bool is_prime[nmax+1];
int p=0;

int sieve(int n){
    for(int i=0;i<=n;i++){
        is_prime[i]=true;
    }
    is_prime[0]=is_prime[1]=false;
    for(int i=2;i<=n;i++){
        if(is_prime[i]){
            prime[p]=i;
            p++;
            for(int j=2*i;j<=n;j+=i){
                is_prime[j]=false;
            }
        }
    }
}

int main(){
    int N;
    cin>>N;
    sieve(nmax);
//    int sp=sizeof(prime);
    int ans[N];
    int ct=0;

    for(int i=0;i<p;i++){
        if(prime[i]%5==1){
            ans[ct]=prime[i];
            ct++;
            if(ct==N){
                break;
            }
        }
    }
    for(int i=0;i<N;i++){
        cout<<ans[i]<<" ";
//        cout<<p<<" ";
//        cout<<prime[p-1]<<" ";
    }
    cout<<endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main(){
    int n,m;
    cin>>n>>m;
    priority_queue<ll> pq;
    rep(i,n){
        ll a;
        cin>>a;
        pq.push(a);
    }

    rep(i,m){
        ll x=pq.top();
        pq.pop();
        pq.push(x/2);
    }

    ll ans=0;
    rep(i,n){
        ll x=pq.top();
        pq.pop();
        ans+=x;
    }

    cout<<ans<<endl;
}



Measured memory_bytes: 4304
# coding: utf-8

n = int(input())

d = list(map(int, input().split()))

s = (n * (n - 1)) / 2

sumv = 0
for i in range(len(d)-1):
    for j in range(i+1, len(d)):
        sumv += d[i] * d[j]

print(sumv)

Measured memory_bytes: 3060
#include <stdio.h>
#include <algorithm>

using namespace std;

#define H 19
#define W 15
bool banmen[H+1][W];
int dirs[8][2];

int solve(int x, int y, int te) {
  //printf("%d,%d,%d\n",x,y,te);
  if(y>=H-1) return te;
  int ans = 9999;
  for(int dir_index = 0; dir_index < 8; dir_index++) {
    int dx = dirs[dir_index][0];
    int dy = dirs[dir_index][1];
    int count = 0;
    int ax = x+dx;
    int ay = y+dy;
    //printf("(%d,%d,%d,%d,%d)\n",ax>0,ax+dx<W,ay>0,ay+dy<=H,banmen[ax][ay]);
    while(((ay+dy==H&&ax>=0&&ax<W&&ax+dx>=-1&&ax+dx<=W)||(ay+dy!=H&&ax>=0&&ax<W&&ax+dx>=-1&&ax+dx<=W))&&ay>0&&ay<H&&ay+dy>=0&&ay+dy<=H && banmen[ay][ax]) {
      banmen[ay][ax] = false;
      ax+=dx;
      ay+=dy;
      count++;
    }
    //printf("(x,y,c)=(%d,%d,%d)\n",dx,dy,count);
    if(count>0 && (ay>=H||(ax>=0&&ax<W))) {
      int ret = solve(ax,ay,te+1);
      if(ret!=-1) {
        ans = min(ans,ret);
      }
    }
    for(int i = 1; i <= count; i++) {
      banmen[y+dy*i][x+dx*i] = true;
    }
  }
  return (ans==9999)?-1:ans;
}

int main() {
  int x,y;
  for(int i = 0; i < H; i++) {
    char row[W+1];
    scanf("%s",row);
    for(int j = 0; j < W; j++) {
      banmen[i][j] = (row[j]=='X');
      if(row[j]=='O') {
        y = i;
        x = j;
      }
    }
  }
  /*
  for(int i = 0; i < H+1; i++) {
    for(int j = 0; j < W; j++) {
      printf("%d ",banmen[i][j]);
    }
    printf("\n");
  }
  */
  for(int j = 0; j < W; j++) {
    banmen[H][j] = false;
  }

  dirs[0][0] = 1;
  dirs[0][1] = 1;
  dirs[1][0] = 1;
  dirs[1][1] = 0;
  dirs[2][0] = 1;
  dirs[2][1] = -1;
  dirs[3][0] = 0;
  dirs[3][1] = -1;
  dirs[4][0] = -1;
  dirs[4][1] = -1;
  dirs[5][0] = -1;
  dirs[5][1] = 0;
  dirs[6][0] = -1;
  dirs[6][1] = 1;
  dirs[7][0] = 0;
  dirs[7][1] = 1;

  printf("%d\n",solve(x,y,0));
}



Measured memory_bytes: 2756
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;


static class P
{
    static void Main()
    {
        string s = Console.ReadLine();
        Console.WriteLine(s.TakeWhile(x => x == '1').Count() >= long.Parse(Console.ReadLine()) ? '1' : s.First(x => x != '1'));
    }
}


Measured memory_bytes: 13268
require 'pp'

def gets; ARGF.gets; end

class Solver

  def initialize
  end

  def main
    n, k = gets.chomp.split.map(&:to_i)

    ary = gets.chomp.split.map(&:to_i)
    ans = ary.count do |h|
      k <= h
    end

    puts ans
  end
end

if __FILE__ == $0
  Solver.new.main
end


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    ll n;
    cin >> n;
    if (n == 1) {
        cout << 0 << endl;
        return 0;
    }
    map<ll, int> mp;
    ll t = n;
    for (int i=2; i<=sqrtl(t); ++i) {
        while (t%i==0) {
            t /= i;
            mp[i]++;
        }
        if (t==1) break;
    }
    if (t > 1) mp[t]++;
    priority_queue<ll, vll, greater<ll>> q;
    for (auto p : mp) {
        ll a = 1;
        rep(i, p.second) {
            a *= p.first;
            q.emplace(a);
        }
    }
    ll ans = 0;
    while (n > 1) {
        ll p = q.top(); q.pop();
        if (p > n) break;
        if (n%p != 0) continue;
        n /= p;
        ++ans;
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int Sum_AllDigits (int);

int main (void) 
{

  /* Variable_Proclamation */
  int N;    // input
  int min;  // output

  int i;    // subscript
  int A, B;
  int A_sda, B_sda;
  int sum_sda;


  /* Input, Array_Proclamation */
  cin >> N;


  /* Initialize */
  min = INT_MAX;


  /* Calculation */
  for(i=1; i<=N/2; i++)
  {

    A = i;
    B = N -i;

    A_sda = Sum_AllDigits(A);
    B_sda = Sum_AllDigits(B);

    sum_sda = A_sda + B_sda;
    // cout << endl;
    // cout << sum_sda << endl;

    if(min > sum_sda)
    {
      min = sum_sda;
    }

  }
  

  /* Output */
  cout << min << endl;


  return 0;

}

int Sum_AllDigits (int n)
{

  int sum;

  sum = 0;
  while(n > 0)
  {
    sum += n %10;
    n   /= 10;
  }

  return sum;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<n;++i)

using namespace std;

typedef pair<int,int>P;

struct edge{
	int to;
	int cost;
};

const int MAX_N = 100005;

int sdir[MAX_N];
int tdir[MAX_N];
int spt[MAX_N];
int tpt[MAX_N];
map<P,int> mp;
vector<int> G[MAX_N];

void bfs(int u,int* flag)
{
    queue<P> que;
    que.push(P(u,0));
    while(!que.empty()){
        P p = que.front();
        que.pop();
        rep(i,G[p.first].size()){
            if(flag[G[p.first][i]] > p.second + 1){
                flag[G[p.first][i]] = p.second + 1;
                que.push(P(G[p.first][i],flag[G[p.first][i]]));
            }
        }
    }
    return;
}

int main()
{
    int n,m,s,t;
	scanf("%d%d%d%d",&n,&m,&s,&t);
	rep(i,m){
		int x,y;
        scanf("%d%d",&x,&y);
        G[x-1].push_back(y-1);
        G[y-1].push_back(x-1);
        mp[P(x-1,y-1)]++;
        mp[P(y-1,x-1)]++;
	}
    fill(sdir,sdir+n,INF);
    fill(tdir,tdir+n,INF);
    bfs(s-1,sdir);
    sdir[s-1] = 0;
    bfs(t-1,tdir);
    tdir[t-1] = 0;
    rep(i,n){
        if(sdir[i] != INF && tdir[i] != INF){
            spt[sdir[i]]++;
            tpt[tdir[i]]++;
        }
    }
    int min_dir = sdir[t-1];
    ll res = 0;
    rep(i,min_dir-1){
        res += (ll)spt[i] * tpt[min_dir - i - 2];
    }
    printf("%lld\n",res);
	return 0;
}

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

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	a = min(a, b);
	c = min(c, d);
	cout << a + c << endl;
}

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

using namespace std;



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

    int test = 0;

    if(n%2==0) {
        for(int i=0;i<n/2;i++){
            if(s.at(i)!=s.at(n/2+i)){
                cout<<"No"<<endl;
                test = 1;
                break;
            }
        }
    }else{
        test = 1;
        cout<<"No"<<endl;
    }

    if(test==0){
        cout<<"Yes"<<endl;
    }


}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main{
    private static void solver(InputReader sc, PrintWriter out) throws Exception {
      int n = sc.nextInt();
      long mid = n-1;
      long ans = n * mid / 2;
      out.println(ans);

    }
    private static boolean helper(long x){
        double ans = Math.sqrt(x);
        return ans%1!=0;
    }

    private static int gcd(int a, int b){
        if(b==0)
            return a;
        return gcd(b, a%b);
    }
    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solver(in,out);
        out.close();
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int[] readIntArray(int n){
            int arr[] = new int[n];
            for(int i=0;i<n;i++) arr[i] = nextInt();
            return arr;
        }
    }
}
class Pair  {
    int x;
    int y;

    Pair(int x, int y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Pair pair = (Pair) o;
        return x == pair.x &&
                y == pair.y;
    }

    @Override
    public int hashCode() {
        return Objects.hash(x, y);
    }
}

Measured memory_bytes: 21972
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int n;
    cin >> n;
    ll h;
    cin >> h;
    vector<ll> a(n), b(n);
    ll amax = 0;
    vector<ll> baccum(n+1, 0);
    rep(i, n) {
        cin >> a[i] >> b[i];
        amax = max(amax, a[i]);
    }
    sort(b.rbegin(), b.rend());
    ll cnt = 0;
    rep(i, n) {
        if (h <= 0) {
            cout << cnt << endl;
            return 0;
        }
        if (b[i] <= amax) {
            cnt += (h+amax-1) / amax;
            cout << cnt << endl;
            return 0;
        }
        h -= b[i];
        ++cnt;
    }
    cout << cnt + (h+amax-1)/amax << endl;
    return 0;
}


Measured memory_bytes: 5580
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<cstdio>
#include<stdio.h>
#include<cmath>
#include<math.h>
#include<vector>
#include<set>
#include<queue>
#include<map>
#define forn(i,n) for(int (i)=0;i<(n);i++)
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int>pii;
typedef long long ll;
typedef pair<ll,ll> pll;
const int MAXN=100005;
const int INF=2147483647;
const ll LINF=9223372036854775807;
const int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
int a[3][3],n,b[3][3];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	forn(i,3)forn(j,3)cin>>a[i][j];
	cin>>n;
	forn(i,n)
	{
		int x;
		cin>>x;
		forn(j,3)forn(k,3)if(a[j][k]==x)b[j][k]=1;
	}
	forn(i,3)
		if(b[i][0]&&b[i][1]&&b[i][2])
		{
			cout<<"Yes";
			return 0;
		}
	forn(i,3)
		if(b[0][i]&&b[1][i]&&b[2][i])
		{
			cout<<"Yes";
			return 0;
		}
	if(b[0][0]&&b[1][1]&&b[2][2])cout<<"Yes";
	else if(b[0][2]&&b[1][1]&&b[2][0])cout<<"Yes";
	else cout<<"No";
	return 0;
}


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


using namespace std;
string yn(bool a)
{
  if (a){return "Yes";}
  else{return "No";}
}

int main()
{
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  cout<<(-9*(n/100)-9*(n/10)+n);
  return 0;
}

Measured memory_bytes: 256
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
#include <numeric>
#include <random>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef vector<pair<LL, LL> > VP;
typedef vector<string> VS;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define INF 999999999999999997;
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
#define O(s) cout<<s<<endl;

#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}

template<class T>T IN() { T d; cin >> d; return d; }

LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; } // 最大公約数（Greatest Common Divisor）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; } // 最小公倍数（Least Common Multiple）
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); } // うるう年判定

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int dxx[8] = { 0,1,1,1,0,-1,-1,-1 };
int dyy[8] = { 1,1,0,-1,-1,-1,0,1 };

// vector注意
// vec[i][j]の形に入力を入れるとき、vecは初期化してある必要がある.

// ------------------- include, typedef, define END. -------------------


int main() {
	FAST_IO;
	bool dbgF = true; // for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;

	LL N, P;
	cin >> N >> P;
	VL A;
	FOR(i, 0, N)
		A.push_back(IN<LL>());

	// 偶奇個数カウント
	LL guusuuNum = 0, kisuuNum = 0;
	FOR(i, 0, A.size()) {
		if (A[i] % 2 == 0)
			guusuuNum++;
		else
			kisuuNum++;
	}

	if (guusuuNum == N) {
		if (P == 0) {
			LL ans = pow(2, N);
			O(ans);
		}
		else {
			O(0);
		}
	}
	else {
		// 奇数1袋を除いた選び方
		LL last = pow(2, N - 1);
		O(last);
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const ll infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;
void YesNo(bool j){cout << (j ? "Yes" : "No") << endl; return;}
void yesno(bool j){cout << (j ? "yes" : "no") << endl; return;}
template<class Head> void pt(Head&& head){cout << head << endl; return;}


int main() {
  int n,m;
  cin >> n >> m;
  vector<ll> h(n);
  vector<int> a(n,0);
  rep(i,n) cin >> h[i];
  rep(i,m) {
      int b,c;
      cin >> b >> c;
      b--; c--;
      if(h[b]>h[c]) a[c]++;
      if(h[b]<h[c]) a[b]++;
      if(h[b]==h[c]) {
          a[c]++;
          a[b]++;
      }
  }
  int ans=0;
  rep(i,n) {
      if(a[i]==0) ans++;
    //pt(a[i]);
  }
  pt(ans);
  return 0;
}

Measured memory_bytes: 4580
#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>;
using Graph = vector<vector<int>>;
int main(int argc, const char * argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    double r,g;
    cin>>r>>g;
    cout<<2*g-r<<endl;

    return 0;
}


Measured memory_bytes: 3784
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_136
{
    class A
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int[] abc = ReadInts();
            int a = abc[0];
            int b = abc[1];
            int c = abc[2];
            WriteLine(b + c - Min(a, b + c));
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 13140