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

struct Unionfind {
  // tree number
  vector<int> par;
  // constructor
  Unionfind(int n = 1) : par(n, -1) {}
  // search root
  int root(int x) {
    if (par[x] < 0) return x;
    return par[x] = root(par[x]);
  }
  // is same?
  bool issame(int x, int y) { return root(x) == root(y); }

  // add
  // already added, return 0
  bool uni(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return 0;
    if (par[x] > par[y]) swap(x, y);
    par[x] += par[y];
    par[y] = x;
    return 1;
  }
  int size(int x) { return -par[root(x)]; }
};

long long n, m, k;
vector<vector<int>> fr, bl;
Unionfind uf;

int main() {
  cin >> n >> m >> k;
  uf = Unionfind(n);
  bl.resize(n);
  fr.resize(n);
  for(int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    uf.uni(a, b);
    fr[a].push_back(b);
    fr[b].push_back(a);
  }
  for(int i = 0; i < k; ++i) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    bl[a].push_back(b);
    bl[b].push_back(a);
  }
  for(int i = 0; i < n; ++i) {
    int res = uf.size(i);
    res -= (int)fr[i].size();
    --res;
    for(auto x : bl[i])
      if(uf.issame(i, x)) --res;
    if(i != 0) cout << " ";
    cout << res;
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 12152
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
    int a,b;
    while(~scanf("%d%d",&a,&b)){
        int ans=a-2*b;
        if(ans>=0)
            printf("%d\n",ans);
        else printf("0\n");
    }
    return 0;
}


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

public class Main {
	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		var n = sc.nextInt();
		var a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();
		Arrays.sort(a);

		var sameSet = new HashSet<Integer>();
		for (int i = 0; i < a.length - 1; i++) {
			if (a[i] == a[i + 1]) {
				sameSet.add(a[i]);
			}
		}

		var result = 0;
		var set = new HashSet<Integer>();
		for (int i = 0; i < a.length; i++) {
			if (!sameSet.contains(a[i])) {
				var divisors = getDivisors(a[i]);
				var check = true;
				for (int j = 0; j < divisors.size(); j++) {
					if (set.contains(divisors.get(j))) {
						check = false;
						break;
					}
				}
				if (check) {
					result++;
				}
			}
			set.add(a[i]);
		}

		System.out.println(result);
	}

	public static List<Integer> getDivisors(int n) {
		var list = new ArrayList<Integer>();
		for (var i = 1; i < (int)Math.sqrt(n) + 1; i++) {
			if (n % i == 0) {
				list.add(i);
				var divisor = n / i;
				if (divisor != i) {
					list.add(divisor);
				}
			}
		}

		Collections.sort(list);
		return list;
	}
}


Measured memory_bytes: 73812
N = int(input())
heights = list(map(int, input().split()))


def can_get_ocean_view(subheights):
    return 1 if max(subheights) == subheights[-1] else 0


def count_hotels_with_ocean_view(heights):
    hotels_with_ocean_view = [can_get_ocean_view(heights[:i]) for i in range(1, len(heights)+1)]
    return sum(hotels_with_ocean_view)


print(count_hotels_with_ocean_view(heights))


Measured memory_bytes: 2940
#include <cstdio>
#include <algorithm>
using namespace std;
int a[51], b[51];
int main()
{
    int n, k, L, R, i, j,tans=0,ans=0;
    scanf("%d%d", &n, &k);
    for (i = 0; i < n; i++)
        scanf("%d", a + i); //input
    int mNK = min(n, k);
    for (L = 0; L <= mNK; L++)//left can be zero,and mNK
    {
        for (R = 0; R <= mNK - L; R++)//can be zero
        {
            for (i = 0; i < L; i++)//L,the number of "sth" get from left
            {
                b[i] = a[i];
            }
            for (j = 0; j < R; j++)//R,the number
            {
                b[i + j] = a[n - 1 - j];
            }
            sort(b, b + L + R);
            i = 0;
            while (i < k - L - R && b[i] < 0)//have the right to operate,and there are negative numbers
            {
                i++;
            }
            tans = 0;
            for (; i < L + R;i++)
            {
                tans += b[i];
            }
            ans = max(tans, ans);
        }
    }
    printf("%d\n", ans);

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);
			int a = sc.nextInt();
			int b = sc.nextInt();

			double d = ((double) a + b) / 2;

			System.out.println((int) Math.ceil(d));

			sc.close();
		}
}

Measured memory_bytes: 21588
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define MOD(x, y) ((((x) % (y)) + (y)) % (y))
#define DIV(x, y) (((x) - MOD((x), (y))) / (y))

// #define DEBUG
#ifdef DEBUG
#define debug_printf printf
#else
#define debug_printf 1 ? 0 : printf
#endif

typedef long long int ll;
typedef vector<ll> Vl;
typedef vector<int> Vi;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pl;

#define FST first
#define SND second

const int MAX_H = 500;                  // 10^5
// const int MAX_N = 100000;                  // 10^5
// const int MAX_N = 1000000000;              // 10^9
// const ll  MAX_N = 1000000000000000000;     // 10^18
// const int BASE  = 1000000000 + 7;          // 10^9 + 7
// const int INFI  = 1000000000 + 7;          // 10^9 + 7
// const ll INFL  = 1000000000000000000 + 7; // 10^18 + 7

string COLOR = "RGBY";

int H, W, D;
char MAP[MAX_H][MAX_H + 1];

void solve() {
  for (int i = 0; i < H; i++)
    for (int j = 0; j <= W; j++) MAP[i][j] = '\0';

  for (int r = 0; r < H; r++) {
    for (int c = 0; c < W; c++) {
      int x = r + c, y = r - c;
      int z = DIV((2 * x + D - 1), (2 * D));
      int w = DIV((2 * y + D - 1), (2 * D));
      z = MOD(z, 2);
      w = MOD(w, 2);
      #ifdef DEBUG
      cout << r << " " << c << endl;
      cout << x << " " << y << endl;
      cout << z << " " << w << endl;
      cout << endl;
      #endif
      int k = 2 * z + w;
      MAP[r][c] = COLOR[k];
    }
  }

  for (int i = 0; i < H; i++)
    cout << MAP[i] << endl;
}

int main() {
  cin >> H >> W >> D;

  solve();

  return 0;
}

Measured memory_bytes: 768
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<list>
#include<vector>
#include<cmath>

using namespace std;

typedef struct{
    bool is_in;
    int ball_num;
}box_t;

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

    box_t box[n];
    for(int i=0;i<n;i++){
        box[i].is_in = false;
        box[i].ball_num = 1;
    }
    box[0].is_in = true;

    for(int i=0;i<m;i++){
        int x, y;
        cin >> x >> y;

        if(box[x-1].ball_num<2){
            if(box[x-1].is_in){
                box[x-1].is_in = false;
                box[y-1].is_in = true;
            }
        }else{
            if(box[x-1].is_in){
                box[y-1].is_in = true;
            }
        }
        box[x-1].ball_num--;
        box[y-1].ball_num++;
    }

    int ans = 0;
    for(int i=0;i<n;i++){
        if(box[i].is_in)ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
//
//  main.cpp
//  20190801lesson
//
//  Created by Priscilla Leang on 8/1/19.
//  Copyright 漏 2019 Priscilla Leang. All rights reserved.
//

#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
    int f, m, a, b, c, x;
    string s;
    bool b1 = false;
    bool b2 = false;
    bool b3 = false;
    
    x = 0;
    f = 0;
    m = 0;
    cin>> a >> b;
    int a2[a];
    for (int i = 0; i< a; i++){
        cin>>a2[i];
    }
    
    for (int i = 0; i<a; i++){
        f = b -a2[i];
        m = 0 -a2[i];
        if (f<0){
            f = -1*f;
        }
        if (m<0){
            m = -1*m;
        }
        if(f<= m ){
            x = x+f;
        }
        else {
            x += m;
        }
    }
    cout << x*2;
    
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,a[100005],s=0;
struct road
{
	int x,y,yen;
};
vector<road> v;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	v.push_back({0,1,abs(a[1]-0)});
	for(int i=1;i<=n-1;i++)
		v.push_back({i,i+1,abs(a[i]-a[i+1])});
	v.push_back({n,0,abs(a[n]-0)});
	for(int i=0;i<v.size();i++)
		s+=v[i].yen;
	for(int i=1;i<=n;i++)
	{
		int ans=s;
		ans-=v[i-1].yen;
		ans-=v[i].yen;
		ans+=abs(a[v[i-1].x]-a[v[i].y]);
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 2932
import math

def main():
    n, d = list(map(int, input().split()))
    X = []
    for i in range(n):
        X.append(list(map(int, input().split())))

    count = 0
    for i in range(n):
        if i == n: break
        for j in range(i+1, n):
            #Xi, Xj = np.array(X[i]), np.array(X[j])
            #diff = Xj - Xi
            #dist = np.linalg.norm(diff)

            dis = get_distance(X[i], X[j], d)
            if dis.is_integer(): count += 1
            #print('distance:', dis)
    print(count)

def get_distance(P1, P2, d):
    s = 0
    for i in range(d):
        s += (P2[i] - P1[i])**2
    return math.sqrt(s)

main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
using namespace std;
#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
#define rreps(i, n) for(int i=((int)(n)); i>0; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pl(s) cout << (s) << "\n";
#define pls(...) {bool space = false; for(auto i : __VA_ARGS__) (cout << (space?" ":"") << i), space = true; cout << "\n";}
#define plexit(s) {cout << (s) << "\n"; exit(0);}
#define yes(s) cout << ((s)?"Yes":"No") << "\n";
#ifdef __LOCAL
#include <dump.hpp>
#define dump(...) DUMPOUT << "  " << string(#__VA_ARGS__) << ": " << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl << "    ", dump_func(__VA_ARGS__)
#else
#define dump(...)
#endif
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
struct IOInit { IOInit() { cin.tie(nullptr); ios::sync_with_stdio(false); dump("READY"); /*cout << unitbuf;*/} } IO_INIT;
using ll = long long; using ull = unsigned long long; using ld = long double;
template<typename T = int> using V = vector<T>; template<typename T = int> using P = pair<T, T>;
using Vi = V<int>; using Vl = V<ll>; using Vd = V<ld>; using VVi = V<Vi>; using VVl = V<Vl>; using Pi = P<int>; using Pl = P<ll>; using Pd = P<ld>;
constexpr ll MOD = 1000000007; constexpr int INF = (1 << 30) - 1; constexpr ll INFL = 1LL << 60; constexpr ld EPS = 1e-12; constexpr ld PI = 3.141592653589793238462643383279;



signed main(void) {
  int d; cin >> d;
  const int N = 26;
  Vi c(N); rep(i,N) cin >> c[i];
  VVi s(d, Vi(N)); rep(i,d) rep(j,N) cin >> s[i][j];
  Vi last(N);

  auto getScore = [](int d, Vi& c, VVi& s, Vi& t) -> int {
    Vi last(N);
    int ret = 0;
    reps(i,d) {
      ret += s[i-1][t[i-1]];
      last[t[i-1]] = i;
      rep(j,N) ret -= c[j] * (i - last[j]);
      //pl(ret)
    }
    return ret;
  };

  Vi t(d); reps(i,d) {
    int ma = -INF;
    t[i-1] = 0;
    rep(j,N) {
      int ret = s[i-1][j];
      last[j] = i;
      rep(k,N)  ret -= c[j] * (i - last[j]);
      if(chmax(ma,ret)) {
        t[i-1] = j;
      }
    }
  }

  //dump(getScore(d, c, s, t));

  rep(i,d) {
    pl(t[i]+1)
  }



  // int m; cin >> m;
  // rep(i,m) {
  //   int d, q; cin >> d >> q;
  //   --d; --q;
  //   t[d] = q;
  //   pl(getScore())
  // }
  return 0;
}


Measured memory_bytes: 3716
/**
 *
 * @author Daipayan Mukherjee
 * @Jadavpur University,Information Technology
 *
 */
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String st = br.readLine();
        int n = Integer.parseInt(st);
        int[] a = new int[n];
        int[] b = new int[n];
        int[] c = new int[n];
        
        for(int i=0;i<n;i++){
            String[] s = br.readLine().split(" ");
            a[i] = Integer.parseInt(s[0]);
            b[i] = Integer.parseInt(s[1]);
            c[i] = Integer.parseInt(s[2]);
        }
        int[][] dp = new int[n][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] = Math.max(dp[i-1][1],dp[i-1][2]) + a[i];
            dp[i][1] = Math.max(dp[i-1][0],dp[i-1][2]) + b[i];
            dp[i][2] = Math.max(dp[i-1][0],dp[i-1][1]) + c[i]; 
        }
        System.out.println(Math.max(dp[n-1][0],Math.max(dp[n-1][1],dp[n-1][2])));
    }
}


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

public class Main{
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    String S=scanner.next();
    String[] strArray = new String[S.length()];
    String[] strArray2 = new String[S.length()];
    int ans1=0;
    int ans2=0;

    for (int i = 0; i < S.length(); i++) {
      String str2 = String.valueOf(S.charAt(i));
      strArray[i] = str2;
    }

    System.arraycopy(strArray,0,strArray2,0,S.length());

    for(int i=0;i<S.length(); i++){
      if(i%2==0){
        if(strArray[i].equals("1")) ans1++;
        if(strArray[i].equals("0")) ans2++;
      }
      else{
        if(strArray[i].equals("0")) ans1++;
        if(strArray[i].equals("1")) ans2++;
      }
    }

    if(ans1<ans2) System.out.println(ans1);
    else System.out.println(ans2);
  }
}


Measured memory_bytes: 32036
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        String[] x = null;
        Scanner sc = new Scanner(System.in);
		String ip = sc.nextLine();
		x = ip.split(" ", 0);
		int a = Integer.parseInt(x[0]);
		int b = Integer.parseInt(x[1]);
		int c = Integer.parseInt(x[2]);
		int t = 0;

		if(a>b){
		    t=b;
		    b=a;
		    a=t;
		}
		if(b>c){
		    t=c;
		    c=b;
		    b=t;
		}
		if(a>b){
		    t=b;
		    b=a;
		    a=t;
		}
		System.out.println(a+" "+b+" "+c);
    }
}


Measured memory_bytes: 26256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
//#pragma warning(disable : 4996)

#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#define __builtin_popcountll __popcnt64

#endif

#include <limits.h>
#include <math.h>
#include <time.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << '\n'
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) cout << v[i] << " \n"[i==(int)v.size()-1]
template <typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template <typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 1e9 + 7;
constexpr int MAX = 500050;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr ll LINF = 1e17 + 1;
constexpr int INF = 1e9 + 1;
//int dx[4] = { 0,0,-1,1 }, dy[4] = { 1,-1,0,0 };


void solve() {
	int N, X, T; cin >> N >> X >> T;
	print((N + X - 1) / X * T);
}



signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q;
	//cin >> q;
	//while (q--)
	solve();

}


Measured memory_bytes: 3656
H, W, A, B = map(int, input().split())
mod = 10**9+7
facs = [1] * (H+W+1)
invs = [1] * (H+W+1)
nfac = 1
for i in range(1, H+W+1):
    nfac = nfac * i % mod
    facs[i] = nfac
    invs[i] = pow(facs[i], mod-2, mod)

def combs(n, r):
    return facs[n] * invs[r] * invs[n-r] % mod

ans = 0
for i in range(B, W):
    ans += combs(H-A-1+i, i) * combs(A-1+W-i-1, A-1) % mod
    ans %= mod

print(ans)

Measured memory_bytes: 18892
#include <stdio.h>
int n, ans;
char s[100];
int main() {
	scanf(" %s", s);
	while (s[n] != NULL)n++;
	for (int i = 0; i < n; i++) {
		if (s[i] != s[n - 1 - i])ans = 1;
	}
	for (int i = 0; i < (n - 1) / 2; i++) {
		if (s[i] != s[(n - 1) / 2 - 1 - i])ans = 1;
	}
	for (int i = (n + 1) / 2; i < n; i++) {
		if (s[i] != s[n + (n + 1) / 2 - 1 - i])ans = 1;
	}
	if (ans)printf("No\n");
	else printf("Yes\n");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  ll q;
  cin >> q;
  vector<ll> b(q), c(q);
  rep(i, q)  cin >> b[i] >> c[i];

  Ml m;
  rep(i, n) m[a[i]]++;
  ll ans = accumulate(a.begin(), a.end(), 0ll);

  rep(i, q) {
    ans += (c[i] - b[i]) * m[b[i]];
    cout << ans << endl;
    m[c[i]] += m[b[i]];
    m[b[i]] = 0;
  }

  return 0;
}


Measured memory_bytes: 11372
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int N, D;
    cin >> N >> D;

    vector<vi> X(N, vi(D));
    REP(i, N) REP(j, D) cin >> X[i][j];

    int cnt = 0;
    REP(i, N) FOR(j, i + 1, N) {
        ll s = 0;
        REP(k, D) s += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);

        int tmp = sqrt(s);
        if (tmp * tmp == s) {
            cnt++;
        }
    }

    print(cnt);
    
}


Measured memory_bytes: 3616
#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>
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using namespace std;

int main() {
	int a[5];
	rep(i, 5) cin >> a[i];
	int a10 = 0;
	int cnt = 0;
	int sum = 0;
	rep(i, 5) {
		if (a[i] % 10 != 0) {
			sum += (a[i] / 10) * 10;
			a[i] = a[i] - ((a[i] / 10) * 10);
			sum += (10 - a[i])+a[i];
		}
		else if(a[i] % 10 == 0){
			cnt++;
			sum += a[i];
			a[i] = 10;
		}
	}
	sort(a, a + 5);
	sum -= 10 - a[0];
	cout << sum << endl;
	return 0;
}

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

using namespace std;

int main() {
	int city;
	int road, a, b;
	cin >> city >> road;
	int road_sum[city] = {};
	for (int i = 0; i < road; i++) {
		cin >> a >> b;
		road_sum[a-1]++;
		road_sum[b-1]++;
	}
	for (int i = 0; i < city; i++) {
		cout << road_sum[i] << endl;
	}
}


Measured memory_bytes: 3588
#include <climits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <memory.h>
#include <cassert>
#define FAST_INPUT_OUTPUT

//#define MORE_THAN_ONE_TESTCASE // COMMENT IT








#define vi vector<int>
#define vl vector<long long>
#define vs vector<string>
#define vvi vector<vector<int>>
#define viil vector<vector<long long>>
#define mii map<int , int>
#define mll map<long long , long long>
#define msi map<string , i>
#define msl map<string , long long>
#define mci map<char , int >
#define mcl map<char , long long>
#define umii unordered_map<int,int>
#define umll unordered_map<long long ,long long>
#define umsi unordered_map<string , int>
#define umsl map<string , long long> 
#define si set<int>
#define sl set<long long>
#define pii pair<int , int >
#define psi pair<string,int>
#define psl pair<string , long > 
#define pll pair<long long , long long>
#define vpii vector<pii>
#define vpll vector<pll>
#define vpsi vector<psi>
#define vpsl vector<psl>
#define pqi priority_queue<int>
#define pql priority_queue<long long>
#define ub upper_bound
#define lb lower_bound
#define bint long long int
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define iv(v) for(auto &i:v){cin>>i;}
#define ov(v) for(auto i:v){cout<<i<<" ";}cout<<endl;
#define ovn(v) for(auto i:v){cout<<i<<endl;}
#define euv(v) for(auto i:v){cerr<<i<<" ";}cerr<<endl;
#define eovn(v) for(auto i:v){cerr<<i<<endl;}
#define os(s) for(auto itr:s){cout<<itr<<" ";}cout<<endl;
#define osn(s) for(auto itr:s){cout<<itr<<endl;}
#define eos(s) for(auto itr:s){cerr<<itr<<" ";}cerr<<endl;
#define eosn(s) for(auto itr:s){cerr<<itr<<endl;}
#define rep(i,x) for(auto i=0 ; i<x; ++i)
#define repa(i,a,b) for(auto i=a; i<b; ++i)
#define repe(i,x) for(auto i=0; i<=x; ++i)
#define repea(i,a,b) for(auto i=a;i<=b;++i)
#define ef else if
#define wh while
#define el else
#define ivar(x) int x; cin>>x
#define lvar(x) bint x; cin>>x
#define svar(x) string x; cin>>x
#define cvar(x) char x; cin>>x
#define fvar(x) float x; cin>>x
#define dvar(x) double x; cin>>x
#define endl '\n'
using namespace std;


auto SOLUTION_FUNCTION( void ) ->void {
    // your solution goes here 
    dvar(n);
    cout<<1.0 - double(double(int(n/2))/(double)n);
    return ;
}

int main(void){
#ifdef FAST_INPUT_OUTPUT
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout<<setprecision(10);
    cout<<fixed;
    cout<<boolalpha;
#endif
#ifdef MY_LOCAL_PROJECT
    freopen("input","r",stdin);
    freopen("output","w",stdout);
#endif
    int testcase = 1;


#ifdef MORE_THAN_ONE_TESTCASE
    cin>>testcase;
#endif
    
    while(testcase--){
        SOLUTION_FUNCTION();
    }

#ifdef MY_LOCAL_PROJECT
    cout<<"Time : "<<1.0*(double)clock()/CLOCKS_PER_SEC<<endl;
#endif
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
  int n,k,count,h; cin>>n>>k; count=0;
  vector<int> v(n);
  rep(i,n){ cin>>h; if(h>=k) count++;}
  cout<<count<<endl;
}


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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep1(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep1は「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=n;i>=(long long)(s);i--)
//reprは「nからsまで」の繰り返し

typedef long long ll;

const ll inf = 1e18+7;
const ll mod = 1e9+7;


int main() {
    ll n,cnt=0;
    cin>>n;

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

    rep(i,n){
        if(a[i]>b[i]){
            cnt+=b[i];
        }
        else {
            cnt+=a[i];
            if(a[i+1]-(b[i]-a[i])<0){
                cnt+=a[i+1];
                a[i+1]=0;
            }
            else {
                cnt+=b[i]-a[i];
                a[i+1]-=b[i]-a[i];
            }
        }
    }

    cout<<cnt<<endl;
}



Measured memory_bytes: 1792
function main(input) {
  var N = input[0]-0;
  for(var i=0;i<N;i++){
    for(var j=0;j<N;j++){
      if(i*4+j*7 == N){
        console.log('Yes');
        return;
      }
    }
  }
  console.log('No');
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))


Measured memory_bytes: 7372
#!/usr/bin/python3

def get_patten(B):
    return ''.join(map(str, B))

def change_left(index, B):
    C = B.copy()
    C[index], C[index - 1] = C[index - 1], C[index]
    return C

def change_right(index, B):
    C = B.copy()
    C[index], C[index + 1] = C[index + 1], C[index]
    return C

def change_top(index, B):
    C = B.copy()
    C[index], C[index - 3] = C[index - 3], C[index]
    return C

def change_bottom(index, B):
    C = B.copy()
    C[index], C[index + 3] = C[index + 3], C[index]
    return C

# main
boad = []
for i in range(3):
    boad.extend(map(int, input().split()))
exist_patten = set()

q = []
q.append((boad, None, 0))

while len(q) > 0:
    B, prev, count = q.pop(0)
    p = get_patten(B)
    if p in exist_patten:
        continue
    exist_patten.add(p)
    if p == '123456780':
        print(count)
        exit()

    index = B.index(0)

    if index % 3 != 0 and prev != 'right':
        C = change_left(index, B)
        q.append((C, 'left', count + 1))

    if index % 3 != 2 and prev != 'left':
        C = change_right(index, B)
        q.append((C, 'right', count + 1))

    if index >= 3 and prev != 'bottom':
        C = change_top(index, B)
        q.append((C, 'top', count + 1))

    if index <= 5 and prev != 'top':
        C = change_bottom(index, B)
        q.append((C, 'bottom', count + 1))

Measured memory_bytes: 38484
#include "stdio.h"
#include "iostream"
#include "vector"
#include "algorithm"
#include "iomanip"
#include "map"
#include "set"
#include "bitset"
#include "queue"
#include "string.h"
#include "math.h"
#include "numeric"

using namespace std;
using LL = long long;


int main() {
    string s;
    for (int i = 0; i < 4; ++i) {
        char c; cin >> c;
        s.push_back(c);
    }
    sort(s.begin(), s.end());
    puts(s == "1479" ? "YES" : "NO");
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>

int euclidean_gcd(int a, int b) {
	while(a > 0 && b > 0) {
		if(a > b) a %= b;
		else b %= a;
	}
	int ret = (a == 0 ? b : a);
	return ret;
}

int main(void) {
	// input
	int n, x0;
	std::cin >> n >> x0;
	std::vector<int> x(n);
	for(int i = 0; i < n; ++i) {
		int buf;
		std::cin >> buf;
		x[i] = std::abs(buf - x0);
	}
	
	// gcd
	int gcd = 0;
	for(int i = 0; i < n; ++i) {
		gcd = euclidean_gcd(gcd, x[i]);
	}

	std::cout << gcd << std::endl;

	return 0;
}


Measured memory_bytes: 640
S = STDIN.gets.chomp
Q = STDIN.gets.chomp.to_i
QUERY = []
while line = STDIN.gets
  QUERY << line.chomp.split(' ')
end

ans = S
ans1 = []
ans2 = []
ptr = 1

QUERY.each do |query|
  if query[0] == '1'
    ptr = ptr == 1 ? 2 : 1
  elsif query[0] == '2'
    #puts "ans:#{ans} query[2]:#{query[2]}"
    if query[1] == '1'
      # 先頭に
      if ptr == 1
        ans1 << query[2]
      else
        ans2 << query[2]
      end
    elsif query[1] == '2'
      # 末尾に
      if ptr == 1
        ans2 << query[2]
      else
        ans1 << query[2]
      end
    end
  end
  #puts ans
end

if ptr == 1
  puts "#{ans1.reverse.join}#{ans}#{ans2.join}"
else
  puts "#{ans2.reverse.join}#{ans.reverse}#{ans1.join}"
end



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

const int N = 2e5 + 10, mod = 1e9 + 7;



int main() {
    // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int tc = 1; 
    //scanf("%d", &tc);
    while(tc--) {
        int s, w; cin >> s >> w;
        if(w < s) puts("safe");
        else puts("unsafe");
    }    
    return 0;
}

Measured memory_bytes: 3612
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int edge[3];
  while(cin >>edge[0]>>edge[1]>>edge[2],edge[0]||edge[1]||edge[2]){
    int n;
    cin >>n;
    sort(edge,edge+3);
    while(n--){
      int x;
      cin >>x;
      if(edge[0]*edge[0]+edge[1]*edge[1]<x*x*4){cout <<"OK"<<endl;}
      else{cout <<"NA"<<endl;}
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<string> svec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-8;

//閉路やばそう
//閉路の総和がPより大きいとヤバそう
//小さい場合は閉路を回る必要がないが

//閉路判定以外やるだけでは？

struct edge {
	int to; ll cost;
};
vector<edge> G[2500];
vector<int> rG[2500];
ll score[2500];

bool cangoal[2500];
bool canstart[2500];
void solve() {
	int n, m; cin >> n >> m; ll p; cin >> p;
	rep(i, m) {
		int a, b, c; cin >> a >> b >> c; a--; b--;
		G[a].push_back({ b,c });
		rG[b].push_back(a);
	}
	fill(score, score + n, -INF);
	score[0] = 0;

	//頂点0から行けてかつN-1に到達するやつを列挙
	queue<int> q; q.push(n - 1); cangoal[n - 1] = true;
	while (!q.empty()) {
		int id = q.front(); q.pop();
		rep(j, rG[id].size()) {
			int to = rG[id][j];
			if (cangoal[to])continue;
			cangoal[to] = true; q.push(to);
		}
	}
	//rep(i, n)cout << i << " " << cangoal[i] << endl;
	q.push(0); canstart[0] = true;
	while (!q.empty()) {
		int id = q.front(); q.pop();
		rep(j, G[id].size()) {
			int to = G[id][j].to;
			if (canstart[to])continue;
			canstart[to] = true; q.push(to);
		}
	}
	rep(i, n) {
		if (!canstart[i])cangoal[i] = false;
	}

	//とりあえず5000回更新
	rep(aa, 5000) {
		rep(i, n) {
			if (!cangoal[i])continue;
			rep(j, G[i].size()) {
				int to = G[i][j].to;
				if (!cangoal[to])continue;
				ll ns = score[i] + G[i][j].cost - p;
				//cout << i << " " << to << " " << ns << endl;
				if (score[to] < ns) {
					score[to] = ns;
				}
			}
		}
	}

	//まだ更新されるなら無限に回ってる
	rep(i, n) {
		if (!cangoal[i])continue;
		rep(j, G[i].size()) {
			int to = G[i][j].to;
			if (!cangoal[to])continue;
			ll ns = score[i] + G[i][j].cost - p;
			if (score[to] < ns) {
				//cout << i << " " << to << endl;
				cout << -1 << endl; return;
				score[to] = ns;
			}
		}
	}
	if (score[n - 1] < 0)score[n - 1] = 0;
	cout << score[n - 1] << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
	//stop
	return 0;
}


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

const int MAX_N = 15;
const int MAX_W = 110000;
int dp[MAX_N][MAX_W];

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

    vector<int> weight;
    for (int i = 1; i <= W; i *= 6) weight.push_back(i);
    for (int i = 9; i <= W; i *= 9) weight.push_back(i);
    int n = (int)weight.size();

    for (int i = 0; i < MAX_N; ++i) for (int w = 0; w < MAX_W; ++w) dp[i][w] = 1 << 29;
    for (int i = 0; i <= n; ++i) dp[i][0] = 0;

    for (int i = 0; i < n; ++i) {
        for (int w = 0; w <= W; ++w) {
            dp[i+1][w] = min(dp[i+1][w], dp[i][w]);
            if (w >= weight[i]) dp[i+1][w] = min(dp[i+1][w], dp[i+1][w-weight[i]] + 1);
        }
    }
    cout << dp[n][W] << endl;
}

Measured memory_bytes: 6656
import os
import sys

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

MOD = 10 ** 9 + 7
N, M = list(map(int, sys.stdin.readline().split()))
S = list(map(int, sys.stdin.readline().split()))
T = list(map(int, sys.stdin.readline().split()))
S = np.array([-1] + S)
T = np.array([-1] + T)

# # dp[i][j]: S[i] と T[j] で終わる組み合わせの数
# # S[i] != T[j] のとき 0
# # S[i] == T[j] のとき、sum(dp[:i][:j])
# dp = np.zeros((len(S), len(T)), dtype=int)
# dp[0][0] = 1
# # dp の二次元累積和
# cumsum = np.ones(len(T), dtype=int)
# for i in range(1, len(S)):
#     for j in range(1, len(T)):
#         if S[i] != T[j]:
#             continue
#         # dp[i][j] = dp[:i, :j].sum() % MOD
#         dp[i][j] = cumsum[j - 1] % MOD
#     cumsum += dp[i].cumsum()
#     cumsum %= MOD
# print(cumsum[-1])


cumsum = np.ones(len(T), dtype=int)
for i in range(1, len(S)):
    cumsum[1:] += ((T == S[i])[1:] * cumsum[:-1] % MOD).cumsum()
    cumsum %= MOD
print(cumsum[-1])


Measured memory_bytes: 12472
#include<stdio.h>
int main()
{
int i;
int count = 1;
for(;;)
{
 scanf("%d",&i);
 if(i != 0)
  {
   printf("Case %d: %d\n",count,i);
   count++;
  }
 else
 {
 break;
 }
}
return 0;
}

Measured memory_bytes: 600
#include <cstdio>
#include <iostream>

using namespace std;

typedef long long LL;

int K, a, b;

int main() {
	scanf("%d%d%d", &K, &a, &b);
	int cnt = b / K - (a - 1) / K;
	puts(cnt ? "OK" : "NG");
	return 0;
}

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

ll	f(ll h)
{
	if (h == 1)
		return (1);
	return (1 + 2 * f(h / 2));
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	ll h;
	cin >> h;
	cout << f(h) << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        char[] c = sc.next().toCharArray();
        int ans = 0;
        PriorityQueue<Integer> wq = new PriorityQueue<>();
        PriorityQueue<Integer> rq = new PriorityQueue<>((x,y) -> y-x);
        for (int i = 0; i < n; i++) {
            if(c[i] == 'R') rq.add(i);
            else wq.add(i);
        }
        while(!rq.isEmpty() && !wq.isEmpty() && rq.peek() > wq.peek()){
            ans++;
            wq.add(rq.poll());
            rq.add(wq.poll());
        }
        System.out.println(ans);
        sc.close();

    }

}


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

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());

        int n = Integer.parseInt(st.nextToken());
        long ans=1;
        for (int i = 2; i<=n; i++){
            ans*=i;
            ans=ans%1000000007;
        }
        System.out.println(ans);
    }


}


Measured memory_bytes: 21204
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>
#include <stack>
#include <queue>
#define REP(i, n) for(LL i = 0;i < n;i++)
#define REPR(i, n) for(LL i = n;i >= 0;i--)
#define FOR(i, m, n) for(LL i = m;i < n;i++)
#define FORR(i, m, n) for(LL i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort((v).begin(), (v).end());
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef long long LL;
//typedef LL int;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> l;
    REP(i, n){
        int x;
        cin >> x;
        l.pb(x);
    }

    VSORT(l);
    reverse(all(l));
    int ans = 0;

    REP(i, k){
        ans+= l[i];
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()

if int(-(-n//1.08) * 1.08) != n:
    print(":(")
else:
    print(int(-(-n//1.08)))

Measured memory_bytes: 61860
#include<stdio.h>

int main()
{
	int n, t, c[3][100], min, i, o=0;

	

	scanf("%d %d", &n, &t);
	for (i = 0;i < n;i++) {
		scanf("%d %d", &c[0][i], &c[1][i]);
	}
	for (i = 0;i < n;i++) {
		c[2][i] = 0;
	}
	min = c[0][0];
	
	for (i = 0;i < n;i++) {
		if (c[1][i] <= t) {
			c[2][i] = 1;
		}
		else {
			o++;
		}
	}
	for (i = 0;i < n;i++) {
		if (c[2][i] == 1) {
			if (c[0][i] < min&&i!=99) {
				min = c[0][i];
			}
		}
	}

	if (o != n) {
		printf("%d\n", min);
	}
	else {
		printf("TLE\n");
	}

	return 0;

}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

template <class T, typename T::value_type D>
struct Find {
    Find(const T &s, const T &t) : m(t.size()), o(t.size() * 2 + 1), a(o + s.size()) {
        auto at = [&](size_t i) {
            return i < t.size() ? t[i] : i == t.size() ? D : s[(i - t.size() - 1) % s.size()];
        };
        int j = a[0] = -1;
        for (size_t i = 0; i < a.size() - 1; i++) {
            while (j >= 0 && at(i) != at(j)) j = a[j];
            a[i + 1] = ++j;
        }
    }
    int operator[](int i) const {
        return a[o + i] == m;
    }
    const int m, o;
    vector<int> a;
};

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

    int n;
    cin >> n;

    vector<int> a(n), b(n), c(n), d(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i];
    }

    c[0] = a[n - 1] ^ a[0];
    d[0] = b[n - 1] ^ b[0];
    for (int i = 1; i < n; i++) {
        c[i] = a[i - 1] ^ a[i];
        d[i] = b[i - 1] ^ b[i];
    }

    Find<vector<int>, 1 << 30> u(c, d);

    for (int i = 0; i < n; i++) {
        if (u[i]) cout << i << ' ' << (a[i] ^ b[0]) << '\n';
    }

    return 0;
}

Measured memory_bytes: 8960
#include<stdio.h>
int main(void){
	float xa,ya,xb,yb,xc,yc,xd,yd;
	double a1,a2;
	double s,l,t,u;
	while(scanf("%f",&xa) != EOF){
		scanf("%f%f%f%f%f%f%f",&ya,&xb,&yb,&xc,&yc,&xd,&yd);
		if(xa == xb && yd == yc){
			printf("YES\n");
			continue;
		}
		if(xd == xc && yb == ya){
			printf("YES\n");
			continue;
		}
		if(xb == xa || xd == xc){
			printf("NO\n");
			continue;
		}
		s = xb - xa;
		l = yb - ya;
		t = xd - xc;
		u = yd - yc;
		
		/*a1 = (double)((yb -ya) / (xb - xa));
		a2 = (double)((yd -yc) / (xd - xc));*/
		if(l * u == -1 * s * t){
			printf("YES\n");
		}
		else{
			printf("NO\n");
		}
	}
	return 0;
}

Measured memory_bytes: 608
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>
#include <functional>

using namespace std;
#define ALL(x)              (x).begin(),(x).end()
typedef long long           ll;
#define REP(i, n)           for (ll i = 0 ; i < (ll)n ; ++i)
#define REPN(i, m, n)       for (ll i = m ; i < (ll)n ; ++i)
#define INF                 (ll)1e9
#define MOD                 (1000 * 1000 * 1000 + 7)
#define Ceil(x, n)          (((((x))+((n)-1))/n))
#define CeilN(x, n)         (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)        ((x)-(x)%(n))
#define IsOdd(x)            (((x)&0x01UL) == 0x01UL)
#define IsEven(x)           (!IsOdd((x)))
#define M_PI                3.14159265358979323846
typedef pair<ll, ll>	    P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
struct MyCin {
	void operator()(ll &a) {
		cin >> a;	
	}
};

int main()
{
	ll N;
	cin >> N;
	vector<ll> A(N), B(N);
	for_each(ALL(A), MyCin());
	for_each(ALL(B), [](ll &a){ cin >> a; });

	ll fusoku = 0;
	vector<ll> yoyuu(N);
	REP(i, N) {
		yoyuu[i] = A[i] - B[i];
		if (yoyuu[i] < 0) fusoku -= yoyuu[i];
	}

	ll ans = 0;
	sort(ALL(yoyuu), [](ll a, ll b){return a > b; });
	REP(i, N) {
		if (fusoku <= 0) break;
		if (yoyuu[i] <= 0) break;
		fusoku -= yoyuu[i];
		ans++;
	
	}

	REP(i, N) {
		if (yoyuu[i] < 0) {
			ans++;
		}
	}

	if (fusoku > 0) ans = -1;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define pb push_back
#define fi first
#define se second
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define caset int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
#define get(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
const ll mod = 1e9 + 7;
const int Max = 1e6 + 10;
ll powmod(ll a, ll b) { ll res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res*a%mod; a = a*a%mod; }return res; }

void solve() {
	int n, k;
	int ans = 0;
	cin >> n >> k;
	VI a(n);
	rep(i, 0, n)cin >> a[i];
	sort(all(a));
	rep(i, 0, k) {
		ans += a[i];
	}
	cout << ans << endl;
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//caset{
	solve();
	//}
	return 0;
}






Measured memory_bytes: 3648
using System;
using System.Linq;
using System.Collections.Generic;
using System.Numerics;

namespace b
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = BigInteger.Parse(Console.ReadLine());
            var n = BigInteger.Parse("100");

            var year = 0;
            while(n < x){
                n += n / 100;
                year += 1;
            }

            Console.WriteLine(year);
        }
    }
}


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

using namespace std;

typedef long long int ll;
const ll MOD = (ll)1e9 + 7;
const int MAX = 2020;
vector<int> fact,invf;

ll pwr(ll a, ll n){
	if(n < 0) return 0;
	if(n==0) return 1;
	ll q = pwr(a,n/2);
	q = q * q % MOD;
	if(n&1) q = q * a % MOD;
	return q; 
}
ll inv(ll a){
	return pwr(a,MOD-2);
}

ll add(ll a, ll b){
	a += b;
	if(a >= MOD)
		a -= MOD;
	return a;	
}

ll mul(ll a, ll b){
	return a * b % MOD;
}

void init(){
	fact.resize(MAX);
	invf.resize(MAX);
	fact[0] = 1;
	for(int i = 1; i < MAX; i++){
		fact[i] = mul(fact[i-1],i); 
	}
	invf[MAX-1] = inv(fact[MAX-1]);
	for(int i = MAX-2; i >= 0; i--){
		invf[i] = mul(invf[i+1],i+1);
	}
}
ll C(int n, int k){
	if(k > n || n < 0 || k < 0) return 0;
	return mul(fact[n], mul(invf[n-k],invf[k]));
}


int main(){
	int n;
	cin >> n;
	ll a = pwr(10,n) - 2 *  pwr(9,n) + pwr(8,n);
	while(a < 0){
		a+=MOD;
	}
	a%MOD;
	cout << a << "\n";
	return 0;
}


Measured memory_bytes: 3572
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long int ll;
int N,M;
ll B[100000];ll A[100000];
ll C[100000];
int P[100000];
int sum[100001];
int main()
{
	scanf("%d%d",&N,&M);
	for(int i=0;i<M;i++){
		scanf("%d",&P[i]);
	}
	for(int i=0;i<M-1;i++){
		int st=P[i];int go=P[i+1];
		if(st>go)swap(st,go);
		st--;go--;sum[st]++;sum[go]--;
	}
	for(int i=1;i<=N;i++){
		sum[i]+=sum[i-1];
	}
	//for(int i=0;i<=N;i++)printf("%d:%d\n",i,sum[i]);
	ll ans=0;
	for(int i=0;i<N-1;i++){
		scanf("%lld%lld%lld",&A[i],&B[i],&C[i]);
		ans+=min(A[i]*(ll)sum[i],C[i]+B[i]*(ll)sum[i]);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4312
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <map>
#define ll long long
#define MAXN 100000
using namespace std;

int ThrPow(int x) {
    int ret=1;
    for(int j=1;j<=x;j++)
        ret*=3;
    return ret;
}

int A[22];
int B[22];

int main() {
    int N;
    cin>>N;
    for(int i=0;i<N;i++) {
        cin>>A[i];
    }
    
    int nc = ThrPow(N);
    int ans=0;
    for(int j=0;j<nc;j++) {
        int m=j;
        bool ok=false;
        for(int i=0;i<N;i++) {
            int c = (m%3==0 ? -1 : (m%3==1 ? 0 : 1));
            B[i]=(A[i]+c);
            if (B[i]%2==0)
                ok=true;
            m/=3;
        }
        if (ok)
            ans++;
    }
    cout << ans << endl;
    
}

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

int main() {
    char input[1000];
    while (cin >> input) {
        char pre = '0';
        int output = 0;
        for (int i = 0; input[i] != '\0'; i++) {
            switch (input[i]) {
            case 'M':
                output += (pre == 'C') ? 800 : 1000;
                break;
            case 'D':
                output += (pre == 'C') ? 300 : 500;
                break;
            case 'C':
                output += (pre == 'X') ? 80 : 100;
                break;
            case 'L':
                output += (pre == 'X') ? 30 : 50;
                break;
            case 'X':
                output += (pre == 'I') ? 8 : 10;
                break;
            case 'V':
                output += (pre == 'I') ? 3 : 5;
                break;
            case 'I':
                output++;
                break;
            }
            pre = input[i];
        }
        cout << output << endl;
    }
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include <climits>
#include<fstream>
using namespace std;
//---------------------------------------------------
//library zone!!!!!
typedef long long ll;
typedef long double ld;
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld mod_pow(ld x, ll n, ll p) {
	ld res = 1;
	while (n > 0) {
		if (n & 1) res = res * x;
		x = x * x;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
signed main() {
	int k;
	cin>>k;
	cout<<(k/2)*((k+1)/2)<<endl;
}


Measured memory_bytes: 256