akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<algorithm>
using namespace std;
int w[101000][2];
long long s;
struct point {
	int a;
	int num, ck;
	bool operator <(const point &p)const {
		return a < p.a;
	}
}P[201000];
int n, cnt, v[101000][2], C1, C2, C3, C4;
long long Mn1 = 1e18, Mn2 = 1e18;
int main() {
	int i;
	scanf("%d", &n);
	for (i = 1; i <= n; i++) {
		scanf("%d", &w[i][0]);
		scanf("%d", &w[i][1]);
		P[cnt++] = { w[i][0],i,0 };
		P[cnt++] = { w[i][1],i,1 };
	}
	sort(P, P + cnt);
	for (i = 0; i < n; i++) {
		s += P[i].a;
		v[P[i].num][P[i].ck] = 1;
	}
	for (i = 1; i <= n; i++) {
		if (v[i][0] && v[i][1])C1++;
		else if (v[i][0])C2++;
		else if (v[i][1])C3++;
		else C4++;
	}
	if (!C1 && !C4) {
		if (!C2 || !C3) {
			printf("%lld\n", s);
		}
		else {
			long long rr = 1e18;
			for (i = 1; i <= n; i++) {
				long long t1, t2;
				if (v[i][0]) {
					t1 = -w[i][0], t2 = w[i][1];
				}
				if (v[i][1]) {
					t1 = -w[i][1], t2 = w[i][0];
				}
				rr = min(rr, Mn1 + t2);
				rr = min(rr, Mn2 + t1);
				Mn1 = min(Mn1, t1);
				Mn2 = min(Mn2, t2);
			}
			printf("%lld\n", s + rr);
		}
	}
	else {
		printf("%lld\n", s);
	}
}

Measured memory_bytes: 4096
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);

		String s = sc.next();

		out.println(s.indexOf("AC") >= 0 ? "Yes" : "No");
		out.flush();
	}

}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) return true;
		else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) return false;
		}
		return true;
	}

	private byte readByte() {
		if (hasNextByte()) return buffer[ptr++];
		return -1;
	}

	private boolean isPrintableChar(byte c) {
		return '!' <= c && c <= '~';
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public String next() {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		byte b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public int nextInt() {
		if (!hasNext()) throw new NoSuchElementException();
		int n = 0;
		boolean minus = false;
		byte b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) throw new NumberFormatException();
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = nextInt();
		}
		return a;
	}

	public long nextLong() {
		if (!hasNext()) throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		byte b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) throw new NumberFormatException();
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++) {
			a[i] = nextInt();
		}
		return a;
	}
}

Measured memory_bytes: 23124
import java.util.*;

public class Main {
	
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int four = 0;
		int odd = 0;
		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			if (a % 4 == 0) {
				four++;
			} else if (a % 2 == 1) {
				odd++;
			}
		}
		if ((four + odd == n && four >= odd - 1) || four >= odd) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 48796
h, w = gets.chomp.split(" ").map(&:to_i)
n = gets.chomp.to_i
arr = gets.chomp.split(" ").map(&:to_i)

x = []
arr.each_with_index do |a, i|
  x += Array.new(a, i+1)
end
i = 1
x.each_slice(w) do |a|
  if i.even?
    puts a.reverse.join(" ")
  else
    puts a.join(" ")
  end
  i += 1
end

Measured memory_bytes: 70660
<?php
  // 愚直に保存して数える
  $nk = array_map("intVal", explode(" ", trim(fgets(STDIN))));
  $n = $nk[0];
  $k = $nk[1];
  $table = [];
  for($i=0; $i<$n; $i++){
    $ab = array_map("intVal", explode(" ", trim(fgets(STDIN))));
    $a = $ab[0];
    $b = $ab[1];
    if(array_key_exists($a, $table)){
      $table[$a] += $b;
    }else{
      $table[$a] = $b; 
    }
  }
  ksort($table);
  $cur = 0;
  foreach($table as $tk=>$tv){
    if($k<=$cur+$tv){
      echo $tk . PHP_EOL;
      exit();
    }else{
      $cur += $tv;
    }
  }
?>

Measured memory_bytes: 8952
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res
def gcd(x, y):
    if x < y: x, y = y, x
    div = x % y
    while div != 0:
        x, y = y, div
        div = x % y
    return y

A,B,K=LI()

print("{} {}".format(max(0, A-K), max(0, B - max(0, K-A))))


Measured memory_bytes: 3064
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

n = int(input())
h = list(map(int, input().split()))
ans = []
now = h[0]
cnt = 0
for i in range(1, n):
    if h[i] > now:
        ans.append(cnt)
        cnt = 0
    else:
        cnt += 1
    now = h[i]
else:
    ans.append(cnt)
print(max(ans))

Measured memory_bytes: 16308
N= int(input())
s = [input() for i in range(N)] 
C = [0,0,0,0]
for i in range(N):
    if s[i] == "AC":
        C[0] = C[0] + 1
    elif s[i] == "WA":
        C[1] = C[1] + 1
    elif s[i] == "TLE":
        C[2] = C[2] + 1
    else:
        C[3] = C[3] + 1

print("AC x " + str(C[0]))
print("WA x " + str(C[1]))
print("TLE x " + str(C[2]))
print("RE x " + str(C[3]))

Measured memory_bytes: 16324
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

int main(void){
	int n;
	float x[3],y[3],a,b,c,d,X,Y,px,py;

	cin >> n;
	for(int i=0;i<n;i++){
		for(int j=0;j<3;j++)
			cin >> x[j] >> y[j];

		a=x[0]-x[1];
		b=y[0]-y[1];
		c=x[0]-x[2];
		d=y[0]-y[2];
		X=pow(x[0],2)-pow(x[1],2)+pow(y[0],2)-pow(y[1],2);
		Y=pow(x[0],2)-pow(x[2],2)+pow(y[0],2)-pow(y[2],2);
		px=(d*X-b*Y)/(a*d-b*c)/2;
		py=(-c*X+a*Y)/(a*d-b*c)/2;

		printf("%.3f %.3f %.3f\n",px,py,sqrt(pow(x[0]-px,2)+pow(y[0]-py,2)));
	}
	return 0;
}

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

int main() {
  int x; cin >> x;
  if (x>=30) cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

int main() {
  char c;
  std::string s = "aiueo";

  std::cin >> c;
  
  std::size_t x = s.find(c);

  if(x != std::string::npos) {
    std::cout << "vowel\n";
    return 0;
  }

  std::cout << "consonant\n";
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main(){
    long long int a,b,c,d,e;
    cin >> a >> b;
    c = a /2;
    d = b / 2;
    if(a == 1 || b == 1){
        e = 1;
    }else if(a != c * 2 && b != d * 2){
        e = a *b /2 + 1;
    }else{
        e = a* b / 2;
    }
    cout << e << endl;
 
}

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

#define ll long long
#define ld double
#define pii pair<ll,ll>
#define vl vector<ll>
#define vb vector<bool>
#define vs vector<string>
#define vp vector<pii>
#define pb push_back
#define mp make_pair
#define sc(a) scanf("%lld",&a);
#define sd(a) scanf("%lf",&a);
#define test() ll tt;cin>>tt;for(ll testcase=1;testcase<=tt;testcase++)
#define all(v) v.begin(),v.end()
#define vivek_ghosh ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX 1000055
#define mod 1000000007
#define ff first
#define ss second
const long long int INF=0x3f3f3f3f3f3f;

ll power(ll x,ll n,ll M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)
        return power((x*x)%M,n/2,M);
    else
        return (x*power((x*x)%M,(n-1)/2,M))%M;
}

ll modinv(ll a,ll m)
{
    ll g =__gcd(a, m);
    ll res=power(a, m-2, m);
    return res;
}

vb prime(MAX,true);
vl prm;
void sieve()
{
	prime[0] = prime[1] = false;
	for(ll p=2;p*p<MAX;p++)
	{
		if(prime[p])
		{
			for(ll i=p*p;i<MAX;i+=p)
				prime[i] = false;
		}
	}
	for(ll p=2;p<MAX;p++)
	{
		if(prime[p])
			prm.pb(p);
	}
}

ll n,m,t,i,j,k,q,x,y,ans=0,cnt=0,sum=0,mx=-1,mn=INT_MAX;
string s;

typedef struct node
{
	ll x,y,left,up,right,down;
}node;

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







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

using ll = long long;

int main() {
    ll N, a[10000], b[10000], achange = 0, bchange = 0;
    //ll asum = 0, bsum = 0;
    cin >> N;
    rep(i, N) {
        cin >> a[i];
        //asum += a[i];
    }
    rep(i, N) {
        cin >> b[i];
        //bsum += a[i];
    }
    rep(i, N) {
        if (a[i] < b[i]) {
            achange += (b[i] - a[i] + 1) / 2;
            bchange += (b[i] - a[i]) % 2;
        } else {
            bchange += a[i] - b[i];
        }
    }
    if (achange < bchange) cout << "No" << endl;
    else cout << "Yes" << endl;
}

Measured memory_bytes: 384
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Gabriel Carrillo
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        AFrog1 solver = new AFrog1();
        solver.solve(1, in, out);
        out.close();
    }

    static class AFrog1 {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt();
            long[] height = new long[n];
            long[] dp = new long[n];
            for (int i = 0; i < n; i++)
                height[i] = in.nextInt();
            dp[0] = 0;
            dp[1] = Math.abs(height[1] - height[0]);
            for (int i = 2; i < n; i++) {
                dp[i] = Math.min(dp[i - 1] + Math.abs(height[i - 1] - height[i]),
                        dp[i - 2] + Math.abs(height[i - 2] - height[i]));
            }

            out.println(dp[n - 1]);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

    }

    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public InputReader(InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



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

int main(){
  int n;
  cin >> n;
  vector<int> h(n);
  for(auto& x:h)
    cin >> x;
  int ans = 0;
  int highest = 0;
  for(auto& x:h){
    if(x >= highest){
      ans++;
      highest = x;
    }
  }
  cout << ans << endl;
}

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

using namespace std;
const long long int MOD=1e9+7;

int main(){
  int n, k, r, s, p;
  string t;
  cin >>n >> k >> r >> s >> p;
  cin >> t;
  long long ans=0;
  for(int i=0;i<k;i++){
    char prev = t[i];
    if(prev == 'r')ans+=p;
    else if(prev == 's')ans += r;
    else ans += s;
    for(int j=1;i+j*k<n;j++){
      if(prev == t[i+j*k])prev = '?';
      else{
        prev = t[i+j*k];
        if(prev == 'r')ans+=p;
        else if(prev == 's')ans += r;
        else ans += s;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
    int N;
    cin >> N;
    long long num[1000000]={};
    long long ans = 0;
    for(int i=0;i<N;i++){
        long long x;
        cin >> x;
        if(x>N){
            ans++;
        }else{
        num[x] ++;
        }
    }
    ans +=num[0];
    for(int i=1;i<=N;i++){
        if(num[i]<i){
            ans +=num[i];
        }else{
            ans +=num[i]-i;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 8064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] num = new int[n];
		for(int i = 0; i < m; i++) {
			num[sc.nextInt()-1]++;
			num[sc.nextInt()-1]++;
		}
		for(int i : num) {
			System.out.println(i);
		}
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp(a, b) make_pair(a, b)
#define ls (rt << 1)
#define rs (rt << 1 | 1) 
typedef pair<int, int> pii; 
const ll mod = 1e9 + 7;
template <class T> T lowbit(T x){return ((x)&(-(x)));}
const int maxn = 2e5 + 10;
int n;
vector<int> E[maxn];
ll fac[maxn], inv[maxn], facinv[maxn], bin[maxn];
int siz[maxn];
ll f[maxn];
void pre()
{
	fac[0] = 1; for(int i = 1; i < maxn; ++i) fac[i] = fac[i - 1] * i % mod;
	inv[1] = 1; for(int i = 2; i < maxn; ++i) inv[i] = (mod - mod / i) * inv[mod % i] % mod;
	facinv[0] = 1; for(int i = 1; i < maxn; ++i) facinv[i] = facinv[i - 1] * inv[i] % mod;
	bin[0] = 1; for(int i = 1; i < maxn; ++i) bin[i] = bin[i - 1] * 2 % mod;
}
void dfs1(int x, int fa)
{
	siz[x] = 1;
	for(auto v : E[x])
		if(v != fa)
		{
			dfs1(v, x);
			siz[x] += siz[v];
			f[1] = f[1] * inv[siz[v]] % mod;
		}
}
void dfs2(int x, int fa)
{
	if(x != 1)
	{
		f[x] = f[fa] * siz[x] % mod * inv[n - siz[x]] % mod;
	}
	for(auto v : E[x])
		if(v != fa)
		{
			dfs2(v, x);
		}
}
int main()
{
	pre();
	scanf("%d", &n);
	for(int i = 1; i < n; ++i) 
	{
		int u, v;
		scanf("%d%d", &u, &v);
		E[u].push_back(v);
		E[v].push_back(u);
	}
	f[1] = fac[n - 1];
	dfs1(1, 0);
	dfs2(1, 0);
	for(int i = 1; i <= n; ++i)
		printf("%lld\n", f[i]);
	return 0;
}

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

using namespace std;

typedef pair< int,int > PII;
typedef long long int lo;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid (bas+son)/2

const lo MAX = -1000000000000000000; 
const lo MIN = 1000000000000000000; 
const lo inf = 1000000000; 
const lo KOK = 100000; 
const lo LOG = 30; 
const lo li = 100005; 
const lo mod = 1000000007; 

lo n,m,cev,b[li],a[li],c[li],dp[li][5];
string s;
vector<int> v;

lo f(lo sira,lo hangi){
	lo mx=MAX;
	if(sira>n) return 0;
	if(~dp[sira][hangi]) return dp[sira][hangi];
	if(hangi==0){
		mx=max(mx,f(sira+1,1)+a[sira]);
		mx=max(mx,f(sira+1,2)+b[sira]);
		mx=max(mx,f(sira+1,3)+c[sira]);
	}
	if(hangi==1){
		mx=max(mx,f(sira+1,2)+b[sira]);
		mx=max(mx,f(sira+1,3)+c[sira]);
	}
	if(hangi==2){
		mx=max(mx,f(sira+1,1)+a[sira]);
		mx=max(mx,f(sira+1,3)+c[sira]);
	}
	if(hangi==3){
		mx=max(mx,f(sira+1,2)+b[sira]);
		mx=max(mx,f(sira+1,1)+a[sira]);
	}
	return dp[sira][hangi]=mx;
}

int main(){
	memset(dp,-1,sizeof(dp));
	scanf("%lld",&n);
	FOR{
		scanf("%lld %lld %lld",&a[i],&b[i],&c[i]);
	}
	//~ FOR{
		//~ scanf("%d",&b[i]);
	//~ }
	//~ FOR{
		//~ scanf("%d",&c[i]);
	//~ }
	//~ sort(a+1,a+n+1);
	//~ sort(b+1,b+n+1);
	//~ sort(c+1,c+n+1);
	printf("%lld",f(1,0));
	return 0;
}


Measured memory_bytes: 11136
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef pair<double,double> P;
typedef complex<double> CP;
typedef long long ll;


int num[11];
char t;

int main(){
	while(cin>>t){
		num[0]=t-'0';
		rep(i,9){
			cin>>t;
			num[i+1]=t-'0';
		}
		rep(i,9){
			rep(j,9-i){
				num[j]=(num[j]+num[j+1])%10;
			}
		}
		cout<<num[0]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1140
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 2e5 + 5;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
int n, m;
int head[N<<4], cnt, tot;
struct node
{
	int to, next, w;
}e[N<<5];
struct seg
{
	int l, r, id;
}tin[N<<4], tout[N<<4];
void add(int u,int v,int w)
{
	e[++cnt].next = head[u];
	e[cnt].to = v;
	e[cnt].w = w;
	head[u] = cnt;
}
void build(int p,int l,int r) 
{
	tin[p].l = l, tin[p].r = r;
	tout[p].l = l, tout[p].r = r;
	if(l==r)
	{
		tin[p].id = tout[p].id = l;
		return;
	}
	int mid = (l+r) >> 1;
	build(p<<1,l,mid);
	build(p<<1|1,mid+1,r);
	tin[p].id = ++tot; tout[p].id = ++tot;
	add(tin[p].id,tin[p<<1].id,0);
	add(tin[p].id,tin[p<<1|1].id,0);
	add(tout[p<<1].id,tout[p].id,0);
	add(tout[p<<1|1].id,tout[p].id,0);
}
void treeadd2(int p,int x,int y,int u,int w) 
{
	int l = tout[p].l, r = tout[p].r;
	if(l>=x&&r<=y)
	{
		add(tout[p].id,u,w);
		return;
	}
	int mid = (l+r) >> 1;
	if(x<=mid) treeadd2(p<<1,x,y,u,w);
	if(y>mid) treeadd2(p<<1|1,x,y,u,w);
}
ll dis[N];
bool vis[N];
void Dijkstra(int s)
{
	memset(dis,0x3f,sizeof(dis));
	memset(vis,0,sizeof(vis));
	dis[s] = 0;
	priority_queue <pli,vector<pli>,greater<pli>> q;
	q.push(mp(0,s));
	while(!q.empty())
	{
		int u = q.top().second; 
		q.pop();
		if(vis[u]) continue;
		vis[u] = 1;
		for(int i=head[u];i;i=e[i].next)
		{
			int v = e[i].to;
			if(dis[v]>dis[u]+e[i].w)
			{
				dis[v] = dis[u] + e[i].w;
				q.push(mp(dis[v],v));
			}
		}
	}
}
int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	cin >> n >> m;
 	//tot = n;
	//build(1,1,n);
 	for(int i=1;i<=m;i++)
 	{
 		int l, r, c;
 		cin >> l >> r >> c;
 		add(l,r,c);
 	}
 	for(int i=2;i<=n;i++) add(i,i-1,0);
 	Dijkstra(1);
 	if(dis[n]==LINF) cout << -1;
 	else cout << dis[n];
	return 0;
}


Measured memory_bytes: 9336
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

ll d[100010];

int main() {
  ll n;
  cin>>n;
  clr(d,0);
  rep(i,0,n){
    ll a;
    cin>>a;
    d[a]++;
  }
  ll ans = n;
  int index1 = 0;
  int index2 = 100000;
  while(1){
    if(d[index1]<2){
      index1++;
      if(index1==index2)break;
      continue;
    }
    if(d[index2]<2){
      index2--;
      if(index1==index2)break;
      continue;
    }
    d[index1]--;
    d[index2]--;
    ans -= 2;
  }
  ll c = d[index1];
  ans -= (c/2)*2;
  cout << ans << endl;
  return 0;
}





Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>

int main(){
    int n;
    std::cin>>n;
    std::vector<int> h(n);
    for (int i = 0; i < n; ++i) {
        std::cin>>h[i];
    }
    std::vector<long long> cost(n,std::numeric_limits<long long>::max());
    cost[0]=0;
    cost[1]=std::abs(h[1]-h[0]);
    for (int i = 2; i < n; ++i) {
        cost[i]=std::min(cost[i-1]+std::abs(h[i]-h[i-1]),cost[i-2]+std::abs(h[i]-h[i-2]));
    }
    std::cout<<cost[n-1]<<std::endl;
    return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using ll = long long;
int main() {
  ll N;
  cin >> N;
  vector<ll> A(N);
  rep(i,N){
    cin >> A.at(i);
  }
  ll kabu = 0, kane = 1000;
  rep(i,N-1){
    if(A.at(i) < A.at(i+1)){
      kabu = kabu + kane/A.at(i);
      kane = kane % A.at(i);
    }
    if(A.at(i) > A.at(i+1)){
      kane = kane + A.at(i)*kabu;
      kabu = 0;
    }
  }
  kane = kane + A.at(N-1)*kabu;
  kabu = 0; 
  cout << kane << endl;
  return 0;
}

Measured memory_bytes: 3596
#include <cstdio>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
map<P, int> m;

int main(){
    int N;
    ll H, W, a, b;
    scanf("%lld %lld %d", &H, &W, &N);
    for(int i = 0; i < N; i++){
        scanf("%lld %lld", &a, &b);
        for(int j = -1; j <= 1; j++){
            for(int k = -1; k <= 1; k++){
                ll cen_a = a + j;
                ll cen_b = b + k;
                if(cen_a <= 1 || cen_b <= 1 || cen_a >= H || cen_b >= W) continue;
                map<P, int>::iterator ite;
                ite = m.find(P(cen_a, cen_b));
                if(ite != m.end()) ite->second++;
                else m.insert(make_pair(P(cen_a, cen_b), 1));
            }
        }
    }
    ll res[10] = {0};
    ll sum = 0;
    map<P, int>::iterator ite;
    for(ite = m.begin(); ite != m.end(); ite++){
        res[ite->second]++;
        sum++;
    }
    res[0] = (H - 2) * (W - 2) - sum;
    for(int i = 0; i < 10; i++) printf("%lld\n", res[i]);
    return 0;
}


Measured memory_bytes: 56448
#include <iostream>

int main(int argc, char** argv)
{
	int n;
	std::cin >> n;

	int a[100];
	for (int i = 0; i < n; ++i)
	{ 
		std::cin >> a[i];
	}

	for (int i = n - 1; i > 0; --i)
	{
		std::cout << a[i] << " ";
	}

	std::cout << a[0] << std::endl;
}


Measured memory_bytes: 3084
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			int n = sc.nextInt();
			int[] A = new int[n];
			for(int i=0;i<n;i++){
				A[i] = sc.nextInt();
			}
			int q = sc.nextInt();

            int buf;
			for(int i=0;i<q;i++) {
				int b = sc.nextInt();
				int e = sc.nextInt()-1;
				for(int j=b;j<(b+e+1)/2;j++) {
					buf = A[j];
					A[j] = A[e-j+b];
					A[e-j+b] = buf;
				}
			}
			System.out.print(A[0]);
			for(int i=1;i<A.length;i++) {
				System.out.print(" " + A[i]);
			}
			System.out.println();
		}
	}
}


Measured memory_bytes: 34592
n, m = map(int, input().split())
lst = [[] for i in range(n + 1)]
for i in range(m):
  tpl = tuple(map(int, input().split()))
  lst[tpl[0]].append(tpl[1])
for i in lst[1]:
  if n in lst[i]:
    print('POSSIBLE')
    exit()
print('IMPOSSIBLE')

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

typedef long long ll;
typedef pair<int, int> ii;

int main()
{
    char inp[10];
    scanf("%s", inp);

    if ((inp[2] == inp[3]) && (inp[4] == inp[5]))
        printf("Yes\n");
    else
        printf("No\n");

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
const int MOD=1000000007;
#define endl "\n"
#define fst first
#define snd second
const int UNDEF = -1;
const int INF=1<<30;
template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }
template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }
typedef pair<ll,ll> pll;typedef vector<ll> vll;typedef pair<int,int> pii;typedef vector<int> vi;typedef vector<vi> vvi;
#ifdef ONLINE_JUDGE
#define assert(...) /* nothing */
#endif
#define DEBUG_CAT
#ifdef DEBUG_CAT
#define dbg(...)   printf( __VA_ARGS__ )
#else 
#define dbg(...)   /****nothing****/
#endif
bool solve(int lim, int init, const vi &a, const vi &b) {
	int n=a.size();
	int lo=1,hi=lim;
	for (int i=n-1;i>=0;i--) {
		if (b[i]==-1) {++hi; chkmin(hi,lim);}
		if (b[i]==1) {--lo; chkmax(lo,1);}
		if (a[i]==-1) {++lo;}
		if (a[i]==1) {--hi;}
		if (lo>hi) return false;
		if (!(1<=lo&&lo<=lim)) return false;
		if (!(1<=hi&&hi<=lim)) return false;
	}
	return lo<=init&&init<=hi;
}
void fail() {
	printf("NO\n"); exit(0);
}
void solve(long long H, long long W, long long N, long long s_r, long long s_c, string S, string T){
	string s[2]; s[0]=S;s[1]=T;
	int n=S.length();
	{
		vi a[2];
		for (int k=0;k<2;k++) {
			a[k].resize(n);
			for (int i=0;i<n;i++) {
				char c=s[k][i];
				if (c=='U') a[k][i]=-1;
				else if (c=='D') a[k][i]=1;
				else a[k][i]=0;
			}
		}
		if (!solve(H,s_r,a[0],a[1])) fail();
	}
	{
		vi a[2];
		for (int k=0;k<2;k++) {
			a[k].resize(n);
			for (int i=0;i<n;i++) {
				char c=s[k][i];
				if (c=='R') a[k][i]=1;
				else if (c=='L') a[k][i]=-1;
				else a[k][i]=0;
			}
		}
		if (!solve(W,s_c,a[0],a[1])) fail();
	}
	printf("YES\n"); exit(0);

}

int main(){	
	long long s_c;
	long long N;
	string S;
	long long H;
	long long W;
	string T;
	long long s_r;
	scanf("%lld",&H);
	scanf("%lld",&W);
	scanf("%lld",&N);
	scanf("%lld",&s_r);
	scanf("%lld",&s_c);
	cin >> S;
	cin >> T;
	solve(H, W, N, s_r, s_c, S, T);
	return 0;
}



Measured memory_bytes: 2696
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int bkup = n / 2;
        int right = n;
        int tmp = 0;
        for(int i = m; i > 0; i--){
            System.out.println(String.format("%d %d", right - i, right));
            right--;
            tmp = right;
            right = bkup;
            bkup = tmp;
        }
    }
}

Measured memory_bytes: 106452
#include <algorithm>
#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for (int i = 0; i <(int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
int main(){
    string s,t;cin>>s>>t;
    if(t==s+t[t.size()-1])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

int main(){
  int N;
  cin >>N;
  vector<int> v(N);
  for(int i = 0;i<N;i++){
    cin >>v.at(i);
  }
  sort(v.begin(),v.end());
  double tmp=(v.at(0)+v.at(1))/2.0;
  for(int i = 2;i<N;i++){
    tmp =(tmp+v.at(i))/2;
  }
  cout <<tmp<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);

    int x,n;
    cin >> x >> n;
    vector<int> arr;
    for (int i=0;i<=n-1;i++)
    {
        int a;
        cin >> a;
        arr.push_back(a);
    }

    sort(arr.begin(),arr.end());
    int base_val=0;
    int min_diff=INT_MAX;
    for (int i=0;i<=101;i++)
    {
        bool check=binary_search(arr.begin(),arr.end(),i);
        
        if (!check)
        {
            int diff=abs(i-x);
            if (diff<min_diff)
            {
                min_diff=diff;
                base_val=i;
            }
        }
    }

    cout << base_val << endl;
    return 0;
}

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

using namespace std;
using ii = pair<int, int>;

vector<vector<ii>> adj;
vector<string> mat;
int n, m;

#define isValid(i, j) ((i >= 0 && j >= 0 && i < n && j < m && mat[i][j] == '.'))
#define toInt(i, j) ((j) + (i) * m)

int dikjstra(int ini, int fim){
    priority_queue<ii, vector<ii>, greater<ii>> pq;
    vector<int> dist(n * m, INT_MAX);
    dist[ini] = 0;
    pq.push({dist[ini], ini});
    while(!pq.empty()){
        int u = pq.top().second;
        int distu = pq.top().first;
        pq.pop();
        if(distu != dist[u])
            continue;
        for(ii p: adj[u]){
            if (distu + p.second < dist[p.first]){
                dist[p.first] = distu + p.second;
                pq.push({dist[p.first], p.first});
            }
        }
    }
    return dist[fim] != INT_MAX ? dist[fim] : -1;
}

int main(){
    cin.sync_with_stdio(0);
    cin.tie(0);
    int xi, yi, xf, yf;
    cin >> n >> m >> xi >> yi >> xf >> yf;
    xi--;yi--; xf--;yf--;

    mat.resize(n);
    for(int i = 0; i < n; i++)
        cin >> mat[i];

    adj.resize(n * m);
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            if(!isValid(i, j))
                continue;
            if(isValid(i + 1, j))
                adj[toInt(i, j)].push_back({toInt(i + 1, j), 0});
            if(isValid(i - 1, j))
                adj[toInt(i, j)].push_back({toInt(i - 1, j), 0});
            if(isValid(i, j + 1))
                adj[toInt(i, j)].push_back({toInt(i, j + 1), 0});
            if(isValid(i, j - 1))
                adj[toInt(i, j)].push_back({toInt(i, j - 1), 0});
            for(int k = -2; k <= 2; k++){
                for(int l = -2; l <= 2; l++){
                    if(k != 0 || l != 0){
                        if(isValid(i + k, j + l))
                            adj[toInt(i, j)].push_back({toInt(i + k, j + l), 1});
                    }
                }
            }
        }
    }
    cout << dikjstra(toInt(xi, yi), toInt(xf, yf)) << endl;
}

Measured memory_bytes: 113576
D,G=[ int(it) for it in input().split() ]
li = [ [ int(it) for it in input().split() ] for i in range(D) ]

import itertools as ite
cmin = 100000000000000000
for cli in ite.product( *([[0,1]]*D) ):
  
  s = 0
  c = 0
  for i in range(D):
    if cli[i]==1:
      s +=  li[i][1] + (i+1)*100*li[i][0]
      c +=  li[i][0]
  
  ds = G-s
  
  for i in range(D-1,-1,-1):
    if (ds<=0):
      break
    if cli[i]==0:
      toku = (ds-1)//((i+1)*100)+1
      toku = min(toku,li[i][0])
      c += toku
      ds -= toku*(i+1)*100
    if (ds<=0):
      break
  if (ds<=0):
    cmin = min(cmin,c)
  else:
    pass
print (cmin)

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

int main(){
	int N, K;
	cin >> N >> K;
	vector<int> l(N);
	rep(i, N) cin >> l[i];
	sort(l.begin(), l.end());
	reverse(l.begin(), l.end());
	int sum = 0;
	rep(i, K) sum += l[i];
	cout << sum << endl;
}

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll x, a;
  cin >> x >> a;
  if (x < a) cout << 0 << endl;
  else cout << 10 << endl;
  return 0;
}


Measured memory_bytes: 764
import sys
input = sys.stdin.readline


def main():
    X = int(input())
    a = [i**5 for i in range(120)]
    for i in range(120):
        for j in range(i+1, 120):
            if a[j]-a[i] == X:
                print(j, i)
                exit()
            if a[j]+a[i] == X:
                print(j, -i)
                exit()


if __name__ == '__main__':
    main()


Measured memory_bytes: 9200
import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
//aryread!string();
//auto PS = new Tuple!(long,string)[](M);
//x[]=1;でlong[]全要素1に初期化
void main()
{
    auto s = sread();
    if (s[0] == 'R' && s[1] == 'R' && s[2] == 'R')
    {
        writeln(3);
        return;
    }
    if ((s[0] == 'R' && s[1] == 'R') || (s[1] == 'R' && s[2] == 'R'))
    {
        writeln(2);
        return;
    }
    else if ((s[0] == 'R') || (s[1] == 'R') || (s[2] == 'R'))
    {
        writeln(1);
        return;

    }
    writeln(0);
}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}

void arywrite(T)(T a)
{
    a.map!text.join(' ').writeln;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,k,c=0;
	cin>>n>>k;
	long double p;
	for(int i=1;i<=n;i++)
	{
	long double a,b;
	cin>>a>>b;
	p=sqrt(a*a+b*b);
	if(p<=k)
	c++;
}
cout<<c<<endl;
	return 0;
}

Measured memory_bytes: 3808
pos = list(map(int,input().split()))

if pos[0] == pos[1] == pos[2] or abs(pos[0] - pos[2]) <= pos[3]:
	print("Yes")
elif abs(pos[0] - pos[1]) <= pos[3] and abs(pos[1] - pos[2]) <= pos[3]:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 3188
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Pine1999
 */

#include <bits/stdc++.h>

using namespace std;

class EBomber {
public:
	void solve(istream& in, ostream& out) {
	    int h, w, m;
	    in >> h >> w >> m;
	    set<pair<int, int>> st;
	    vector<int> col(h), row(w);
	    for (int i = 0; i < m; ++i) {
	        int hh, ww;
	        in >> hh >> ww;
	        --hh; --ww;
	        st.insert({hh, ww});
	        ++col[hh]; ++row[ww];
	    }
	    int max_col = *max_element(col.begin(), col.end());
	    int max_row = *max_element(row.begin(), row.end());
	    vector<int> max_h, max_w;
	    for (int i = 0; i < h; ++i) {
	        if (col[i] == max_col) {
	            max_h.push_back(i);
	        }
	    }
	    for (int i = 0; i < w; ++i) {
	        if (row[i] == max_row) {
	            max_w.push_back(i);
	        }
	    }
	    for (int hh : max_h) {
	        for (int ww : max_w) {
	            if (st.find({hh, ww}) == st.end()) {
	                out << max_col + max_row << '\n';
	                return;
	            }
	        }
	    }
	    out << max_col + max_row - 1 << '\n';
	}
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
	EBomber solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

Measured memory_bytes: 23760
/*
    Author : Nishant Gupta 2.0
*/
#include<bits/stdc++.h>
using namespace std;

#define LL long long int
#define getcx getchar_unlocked
#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define MAX 100005
#define LOG_MAX 20
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL (LL(1e18))
#define chk(a) cerr << endl << #a << " : " << a << endl
#define chk2(a,b) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << endl
#define chk3(a,b,c) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << endl
#define chk4(a,b,c,d) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << "\t" << #d << " : " << d << endl
#define rep(i, a, n) for(i=a;i<n;i++)
#define rev(i, a, n) for(i=a;i>=n;i--)
#define in(x) scanf("%d", &x)
#define inl(x) scanf("%lld", &x)
#define in2(x, y) scanf("%d %d", &x, &y)
#define inl2(x, y) scanf("%lld %lld", &x, &y)
#define MSV(A,a) memset(A, a, sizeof(A))
#define rep_itr(itr, c) for(itr = (c).begin(); itr != (c).end(); itr++)
#define finish(x) {cout<<x<<'\n'; return;}
typedef pair<int, int> pi;
typedef pair<LL, LL> pl;
const char en = '\n';

void solve() {
	int freq[MAX] = {0};
	for(int i=1;i<105;i++) {
		for(int j=1;j<105;j++) {
			for(int k=1;k<105;k++) {
				freq[i*i +j*j +k*k +i*j+j*k+k*i]++;
			}
		}
	}
	
	int n;
	in(n);
	for(int i=1;i<=n;i++) cout<<freq[i]<<en;
}

int main() {
	int t = 1;
	
	//~cin>>t;
	while(t--) {
		solve();
	}
    return 0;
}


Measured memory_bytes: 4144
import java.util.Scanner;

public class Main{
	public static void main(String args[]){

		//???????????£?¨??????????
		int Card [][];
		Card = new int[4][13];

		//????????°????????????????????????????????????
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();


		//N?????°?????????
		for(int i = 0; i < N ; i++){

			//????????¨??°???????????£?????????
			String Mark = sc.next();
			int Suji = sc.nextInt();

			//?????????S?????£??????1
			if(Mark.equals ("S")){
				//??£??\??????
				Card[0][Suji-1] = 1;
			}
			//?????????H?????£??????1
			if(Mark.equals ("H")){
				//??£??\??????
				Card[1][Suji-1] = 1;
			}
			//?????????C?????£??????1
			if(Mark.equals ("C")){
				//??£??\??????
				Card[2][Suji-1] = 1;
			}
			//?????????D?????£??????1
			if(Mark.equals ("D")){
				//??£??\??????
				Card[3][Suji-1] = 1;
			}
		}

		//?????£??????????????¨
		for (int i = 0; i < 4; i++){
			for (int j = 0; j < 13; j++){
				//1??????????????£????????????
				if(Card[i][j] == 0){

					//0?????£??????S
					if(Card[i] == Card[0]){
						System.out.println("S " + (j + 1));
					//1?????£??????H
					}else if(Card[i] == Card[1]){
						System.out.println("H " + (j + 1));
					//2?????£??????C
					}else if(Card[i] == Card[2]){
						System.out.println("C " + (j + 1));
					//3?????£??????D
					}else if(Card[i] == Card[3]){
						System.out.println("D " + (j + 1));
					}
				}
			}
		}
		sc.close();
	}
}

Measured memory_bytes: 26332
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := NewScanner()
	T, X := float64(sc.NextInt64()), float64(sc.NextInt64())

	fmt.Println(T / X)
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


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

int main(){
	char c[3];
	int count=0;
	for(int i=0;i<3;i++){
		cin >>c[i];
		if(c[i]=='o') count++;
	}
	int sum=700+100*count;
	cout <<sum <<endl;
	return 0;
}

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

#define pb push_back
#define mp make_pair
typedef long long LL;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    string s;
    bool even = 0;
    cin >> s;

    while (!even) {
        s.pop_back();
        s.pop_back();
        if (s.substr(0,s.length()/2) == s.substr(s.length()/2, s.length()/2))
            even = 1;
    }
    cout << s.length();
}



Measured memory_bytes: 256
#!/usr/bin/env lua

N = io.read("*num")

s = {}
for i=1, N do
    s[i] = io.read("*num")
end

un = {}
data = {}
for i=1, N do
    un[i] = 0
    data[i] = 0
end

for i=1, N do
    if s[i] % 10 == 0 then
        un[i] = s[i]
    else
        data[i] = s[i]
    end
end

data_cnt = 0
for i = 1, N do
    if data[i] > 0 then
        data_cnt = data_cnt + 1
    end
end

sum = 0
for i = 1, N do
    sum = sum + s[i]
end

min = 100
for i = 1, N do
    if min >= data[i] and data[i] >= 1 then
        min = data[i]
    end
end

if data_cnt == 0 then
    print(0)
else
    if sum % 10 ~= 0 then
        print(sum)
    else
        print(sum-min)
    end
end

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

int main(){
  int N;
  cin >> N;
  vector<tuple<string, int, int>> res;
  string tmp_s;
  int tmp_p;
  for(int i=0; i<N; i++){
    cin >> tmp_s >> tmp_p;
    res.push_back(make_tuple(tmp_s,-tmp_p,i+1));
  }

  sort(res.begin(),res.end());

  for(tuple<string, int, int> t : res){
    int num;
    tie(ignore,ignore,num) = t;
    cout << num << endl;
  }
}

Measured memory_bytes: 256
const fs = require('fs');

const main = (input) => {
  const tail = input.slice(1).map(Number);

  const max = Math.max(...tail);

  console.log(tail.reduce((acc, x) => {
    if (!acc.flag && x === max) {
      return { sum: acc.sum + x / 2, flag: true };
    } else {
      return { flag: acc.flag, sum: acc.sum + x };
    }
  }, { flag: false, sum: 0 }).sum);
};

main(fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n'));


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

int main(void)
{
    long long int H, N;
    cin >> H >> N;
     vector<long long int >A(H);
    long long int count = 0;

    
    for (long long int& a : A)
    {
        cin >> a;
    }
    sort(A.begin(), A.end(), greater<int>());

    for (long long int G=0; G < H; G++)
    {
        if (G < N)
        {
            continue;
        }
        count += A[G];
    }

    cout << count << endl;

}

    

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

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if(abs(c - a) <= d){
    cout << "Yes" << endl;
    return 0;
  }
  if(abs(b - c) <= d && abs(b - a) <= d){
    cout << "Yes" << endl;
    return 0;
  }
  
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
from sys import stdin
import fractions

A, B = [int(x) for x in stdin.readline().rstrip().split()]
gcd = fractions.gcd(A, B)
C = []
y = 1
while y ** 2 <= gcd:
    if gcd % y == 0:
        if y >= 2:
            C.append(y)
        if y ** 2 != gcd:
            C.append(gcd // y)
    y += 1

ans = 1
g = 1
C.sort()
for c in C:
    while gcd % c == 0:
        gcd //= c
        if g != c:
            ans += 1
        g = c

print(ans)

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

using namespace std;

int main()
{
    vector<int>a(6);
    for(int i=0;i<5;i++){
        cin>>a[i];
    }
    for(int i=0;i<5;i++){
        if(a[i]==0){
            cout<<i+1<<endl;
            exit(0);
        }
    }
}

Measured memory_bytes: 3592
# B - Minimum Sum
N = int(input())
A = list(enumerate(list(map(int,input().split()))))
left = [i-1 for i in range(N)]
right = [i+1 for i in range(N)]
A.sort(key=lambda x:x[1],reverse=True)
ans = 0
for i,a in A:
    il,ir = left[i],right[i]
    ans += a*(i-il)*(ir-i)
    if ir<N:
        left[ir] = il
    if il>-1:
        right[il] = ir
print(ans)

Measured memory_bytes: 50984
#include <iostream>
    #include <set>
    #include <map>
    #include <sstream>
    #include <string>
    #include <vector>
    #include <iomanip>
    #include <algorithm>

    #define ll long long

    using namespace std;

    /*   Every goose should go to prison!!!!!
         ██▀▀▄  ██     ██
    ▄███▀██░░░▌ ██     ██
    █████████████████████████████
        ▐██░░░▐ ██     ██
        ▌██░░░░▐██     ██
    █████████████████████████████
       ▐░██░▐▒▒▒██▒▒▒▀▀██
       ▐░██░▐▄▒▒██▒▒▒▒▒██▄
    █████████████████████████████
         ██▄▄▄▄▄██▄▄▄▄▄██▄▄▄▀▄
         ██    ▌██▌▌   ██
    █████████████████████████████
         ██  ▄▄▌██▌▌   ██ */

    int main() {
        ios_base::sync_with_stdio(false);
        cin.tie(nullptr);
        cout.tie(nullptr);
        ll h, a;
        cin >> h >> a;
        cout << (h + a - 1) / a;

        return 0;
    }


Measured memory_bytes: 256
import sys
from operator import itemgetter
input = sys.stdin.readline

n, m = map(int, input().split())
a = list(map(int, input().split()))
bc = [list(map(int, input().split())) for _ in range(m)]

a.sort()
bc.sort(reverse = True, key=itemgetter(1))

a_i = 0
endloop = False
for i, item in enumerate(bc):
    if a_i >= n: break
    for i in range(item[0]):
        if a_i < n and a[a_i] < item[1]:
            a[a_i] = item[1]
            a_i += 1
        else:
            endloop = True
            break
    if endloop: break
print(sum(a))


Measured memory_bytes: 32924