akhauriyash/Code-Regression huggingface dataset:
#include <iostream> 
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mk make_pair
#define MAX 1000001
ll prime[MAX];
#define mod 1000000007

ll rec(vector<vector<ll> >& dp,vector<ll>& arr,int n,int i,int k,int w)
{
  ll ans=0;
  if(i>=n)
    return 0;

  if(dp[i][k]!=-1)
    return dp[i][k];


  if(k!=0)
  ans=max(rec(dp,arr,n,i+1,w,w),arr[i]+rec(dp,arr,n,i+1,k-1,w));
  else
  ans=max(rec(dp,arr,n,i+1,k,w),rec(dp,arr,n,i+1,w,w));

  return dp[i][k]=ans;

}

ll t[400008];
void build(vector<ll>& a, int v, int tl, int tr) {
    if (tl == tr) {
        t[v] = a[tl];
    } else {
        int tm = (tl + tr) / 2;
        build(a, v*2, tl, tm);
        build(a, v*2+1, tm+1, tr);
        t[v] = max(t[v*2] ,t[v*2+1]);
    }
}

ll maxi(int v, int tl, int tr, int l, int r) {
    if (l > r) 
        return 0;
    if (l == tl && r == tr) {
        return t[v];
    }
    int tm = (tl + tr) / 2;
    return max(maxi(v*2, tl, tm, l, min(r, tm)) ,maxi(v*2+1, tm+1, tr, max(l, tm+1), r));
}



void update(int v, int tl, int tr, int pos, ll new_val) {
    if (tl == tr) {
        t[v] = new_val;
    } else {
        int tm = (tl + tr) / 2;
        if (pos <= tm)
            update(v*2, tl, tm, pos, new_val);
        else
            update(v*2+1, tm+1, tr, pos, new_val);
        t[v] = max(t[v*2] ,t[v*2+1]);
    }
}

int main() { 

int a;
cin>>a;
cout<<a+a*a+a*a*a;
return 0;
}


Measured memory_bytes: 3612
#include<iostream>
using namespace std;
int main(){
     int a,b;
     cin>>a>>b;
     if(a<b){
       cout<<"a < b\n";
     }else if(a>b){
       cout<<"a > b\n";
     }else if(a==b){
       cout<<"a == b\n";
     }
     return 0;
} 


Measured memory_bytes: 3084
#include<iostream>
using namespace std;
int main ()
{
  int N = 0;
  cin >> N;
  int B[100];
  for (int i = 0; i < N - 1; i++) {
    cin >> B[i];
  }
  int ans = B[0] + B[N - 2];
  for (int i = 1; i < N - 1; i++) {
    if (B[i - 1] < B[i]) ans += B[i - 1];
    else ans += B[i]; 
  }
  cout << ans;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;
const int MAXN=100005,MAXE=100005;

int n,m;

struct Edge
{
	int x,v1,v2;
	Edge *next;
	Edge():next(NULL){}
	Edge(int a,int b,int c):x(a),v1(b),v2(c),next(NULL){}
}edge[MAXE*2],*ecnt=edge,*adj[MAXN];

void AddEdge(int u,int v,int a,int b)
{
	*ecnt=Edge(v,a,b);
	ecnt->next=adj[u];
	adj[u]=ecnt++;
}

typedef pair<int,int> Po;
priority_queue<Po,vector<Po>,greater<Po> > Q;
long long dis1[MAXN],dis2[MAXN];

void Dijkstra1(int S)
{
	memset(dis1,0x3F,sizeof dis1);
	dis1[S]=0;
	Q.push(make_pair(0,S));
	while(!Q.empty())
	{
		Po t=Q.top();Q.pop();
		if(dis1[t.second]<t.first)
			continue;
		for(Edge *p=adj[t.second];p;p=p->next)
			if(dis1[p->x]>dis1[t.second]+p->v1)
			{
				dis1[p->x]=dis1[t.second]+p->v1;
				Q.push(make_pair(dis1[p->x],p->x));
			}
	}
}
void Dijkstra2(int S)
{
	memset(dis2,0x3F,sizeof dis2);
	dis2[S]=0;
	Q.push(make_pair(0,S));
	while(!Q.empty())
	{
		Po t=Q.top();Q.pop();
		if(dis2[t.second]<t.first)
			continue;
		for(Edge *p=adj[t.second];p;p=p->next)
			if(dis2[p->x]>dis2[t.second]+p->v2)
			{
				dis2[p->x]=dis2[t.second]+p->v2;
				Q.push(make_pair(dis2[p->x],p->x));
			}
	}
}

pair<long long,int> ans[MAXN];

int main()
{
	int S,T;
	scanf("%d%d%d%d",&n,&m,&S,&T);
	for(int q=1,u,v,a,b;q<=m;q++)
	{
		scanf("%d%d%d%d",&u,&v,&a,&b);
		AddEdge(u,v,a,b);
		AddEdge(v,u,a,b);
	}
	
	Dijkstra1(S);
	Dijkstra2(T);
	
	for(int i=1;i<=n;i++)
		ans[i]=make_pair(dis1[i]+dis2[i],i);
	sort(ans+1,ans+n+1);
	int k=1;
	
	for(int i=0;i<n;i++)
	{
		while(ans[k].second<=i)
			k++;
		printf("%lld\n",1000000000000000LL-ans[k].first);
	}
	
	return 0;
}


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

int main(void) {
	string S, T;
	cin >> S >> T;
	bool flag = true;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] != T[i]) {
			flag = false;
			break;
		}
	}

	if (flag) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
	vector<char> s(3);
	rep(i, 3) {
		cin >> s[i];
	}
	int ans = 0;
	rep(i, 3) {
		if (s[i] == '1') {
			ans++;
		}
	}
	cout << ans << endl;
}	

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  int r;
  cin>>r;
  if(r<1200) cout<<"ABC"<<endl;
  else if(r<2800) cout<<"ARC"<<endl;
  else cout<<"AGC"<<endl;
}

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

int main(){
  int n;
  cin>>n;
  vector<pair<int,int>> c(n);
  rep(i,n){
    int x,l;
    cin>>x>>l;
    c[i].first = x+l;
    c[i].second = x-l;
  }
  sort(c.begin(),c.end());
  int ans = 1;
  
  vector<pair<int,int>> d(n);
  rep(i,n) d[i] = {c[i].second,c[i].first};
  
  int now = d[0].second;
  for(int i=1;i<n;i++){   
    if(d[i].first >= now){
      ans++;
      now = d[i].second;
    }
  }  
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include <stdio.h>
int main() {
    int A, B;
    long long X;
    scanf("%lld", &X);
    //char *memo = malloc(sizeof(char) * ((long)sqrt(X) + 2));
    for (B = -120; B < 120; B++) {
        for (A = -120; A < 120; A++) {
            if (A == B) continue;
            int t = A > B ? A - B : B - A;
            if (X % t) continue;
            if ((A * A * A * A * A) - (B * B * B * B * B) == X) break;
        }
        if (A < 120) break;
    }
    printf("%d %d\n", A, B);
    return 0;
}

Measured memory_bytes: 1704
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int INF = 2e9;



int main() {
	int n; cin >> n;
	string s; cin >> s;
	vector<int> ans(n);
	rep(a, 0, 2)rep(b, 0, 2) {
		ans[0] = a; ans[1] = b;
		rep(i, 2, n) {
			int flag = (s[i - 1] != 'o');
			if (ans[i - 1] == 1) flag ^= 1;
			ans[i] = ans[i - 2] ^ flag;
		}
		bool fl = true;
		rep(i, 0, n) {
			int x = i, y = (i + 1) % n, z = (i + 2) % n;
			int flag = (s[y] != 'o');
			if (ans[y] == 1) flag ^= 1;
			if ((ans[x] ^ flag)!=ans[z]) fl = false;
		}
		if (fl) {
			rep(i, 0, n) printf("%c", (ans[i] == 0 ? 'S' : 'W'));
			return 0;
		}
	}
	printf("-1");
	return 0;
}


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

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

using namespace std;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

template<typename T>
void inputArray(T* p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

template<typename T>
void inputVector(vector<T> * p, int a){
    rep(i, a){
        T input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision = 0) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

int A, B;

int main(int argc, const char * argv[]) {
    A = inputValue();
    B = inputValue();
    if (B%A == 0) {
        output(A+B);
    }else {
        output(B-A);
    }
    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict


def main():
    N, K = map(int, input().split())
    d = defaultdict(int)
    for _ in range(N):
        a, b = map(int, input().split())
        d[a] += b

    total = 0
    for k, v in sorted(d.items()):
        if total < K <= total + v:
            print(k)
            return
        total += v


if __name__ == '__main__':
    main()


Measured memory_bytes: 14936
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;

int dx[] = {0, -1, 1, 0};
int dy[] = {-1, 0, 0, 1};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    LL n;
    cin >> n;
    LL a[SIZE], b[SIZE];
    
    for( int i = 0; i < n; ++i ) {
        cin >> a[i];

    }

    for( int i = 0; i < n; ++i ) {
        cin >> b[i];

    }

    LL plus_a = 0, plus_b = 0;
    for( int i = 0; i < n; ++i ) {
        if( a[i] < b[i] ) plus_b += ( b[i] - a[i] ) / 2;
        else plus_a += a[i] - b[i];

    }

    if( plus_a > plus_b ) cout << "No";
    else cout << "Yes";
    cout << endl;


    return 0;
}



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

namespace Contest
{
    partial class Program
    {
        static void Main(string[] args)
        {
            ABC152_D();
        }
        #region ABC152
        static void ABC152_A()
        {
            var nm = ReadIntN();
            Console.WriteLine(nm[0] == nm[1] ? "Yes" : "No");
        }
        static void ABC152_B()
        {
            var ab = ReadIntN();
            var A = ab[0];
            var B = ab[1];
            Console.WriteLine(A < B ? String.Join("", Enumerable.Repeat(A, B)) : String.Join("", Enumerable.Repeat(B, A)));
        }
        static void ABC152_C()
        {
            var N = ReadInt();
            var P = ReadIntN();
            int min = P[0];
            int count = 0;
            for (int i = 0; i < N; ++i)
            {
                if (min >= P[i])
                {
                    count += 1;
                    min = P[i];
                }
            }
            Console.WriteLine(count);
        }
        static void ABC152_D()
        {
            var N = ReadInt();
            long[,] count = new long[10, 10];
            for (int i = 1; i <= N; ++i)
            {
                var A1 = i;
                while (A1 > 9) { A1 /= 10; }
                var A0 = i % 10;
                count[A1, A0]++;
            }
            Console.WriteLine(Enumerable.Range(1, 9).Select(i => Enumerable.Range(1, 9).Select(j => count[i, j] * count[j, i]).Sum()).Sum());
        }
        static void ABC152_E()
        {
            var N = ReadInt();
            var A = ReadIntN();
        }
        #endregion


        static string ReadStr()
        {
            return Console.ReadLine();
        }
        static string[] ReadStrN()
        {
            return Console.ReadLine().Split(' ');
        }
        static int ReadInt()
        {
            return Convert.ToInt32(Console.ReadLine());
        }
        static int[] ReadIntN()
        {
            return Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToArray();
        }
        static long ReadLong()
        {
            return Convert.ToInt64(Console.ReadLine());
        }
        static long[] ReadLongN()
        {
            return Console.ReadLine().Split(' ').Select(s => Convert.ToInt64(s)).ToArray();
        }
        static Tuple<long, long>[]  ReadTupleLong(int n)
        {
            List<Tuple<long, long>> list = new List<Tuple<long, long>>();
            for (int i = 0; i < n; ++i)
            {
                var ab = ReadLongN();
                list.Add(new Tuple<long, long>(ab[0], ab[1]));
            }
            return list.ToArray();
        }
    }
}


Measured memory_bytes: 11220
#include <iostream>
#include <algorithm>

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

using namespace std;

typedef long long ll;

int count_arr(ll a){
    int num=0;
    while(true){
        if(a%2==0){
            a=a/2;
            ++num;
        }else{
            break;
        }
    }
    return num;
}


int main(){

    int N;
     scanf("%d",&N);

    ll a[N];

    ll count=0;

    rep(i,N){
        cin>>a[i];
        count+=count_arr(a[i]);
    }

    cout<<count<<endl;    
}



Measured memory_bytes: 384
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int a,b;
  cin >> a >> b;

  int d = b - a;
  int sum = 0;
  for(int i = 1;i <= d;i++)
  {
    sum += i;
  }

  cout << sum - b << endl;

  return 0;
}
// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putln(x) cout << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef complex<double> comp;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const int MAX = 200000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<31-1;
const int MOD = 1000000007;

int dx4[4]={1,0,-1,0};
int dy4[4]={0,1,0,-1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

void solve(void){
	int N;
	cin >> N;
	cout << (N > 999 ? "ABD" : "ABC") << endl;
}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 256
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

k,x = iim()
l = list(range(x-k+1,x+k))
for item in l:
    print(item,end=' ')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll M = 1e9 + 7;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll n, k;
  cin >> n >> k;
  ll start = 0;
  ll it1 = 0;
  for (int i = 0; i < k; ++i)
  {
    start += it1;
    it1++;
  }
  ll end = 0;
  ll it2 = n;
  for (int i = 0; i < k; ++i)
  {
    end += it2;
    it2--;
  }
  ll cnt = 0;
  for (int i = k; i <= n + 1; ++i)
  {
    cnt += end - start + 1;
    cnt %= M;
    start += it1;
    it1++;
    end += it2;
    it2--;
  }
  cout << cnt;
}

Measured memory_bytes: 3688
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();
    int C=sc.nextInt();
    int D=sc.nextInt();
    
    int X=(A-1)/D;
    int Y=(C-1)/B;
    
    if(Y>X) {
    	System.out.println("No");
    }else {
    	System.out.println("Yes");
    }
  }
    }

Measured memory_bytes: 35524
length = int(input())
target = [int(n) for n in input().split(" ")]
splitter = target[-1]
border = 0
for i, n in enumerate(target):
    if n <= splitter:
        target[i], target[border] = target[border], target[i]
        border += 1
target[border - 1] = [splitter]
print(*target)

Measured memory_bytes: 18360
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>
using namespace std;
int main(){
    int n,m,x;
    cin >> n >> m >> x;
    int i = m;
    vector<int> arr;
    while(i--){
        int t;
        cin >> t;
        arr.push_back(t);
    }
    int count = 0;
    for(int i = 0; i < m; i++){
        if(arr[i] > x){
            count++;
        }
    }
    int count2 = 0;
    for(int i = 0; i < m; i++){
        if(arr[i] < x){
            count2++;
        }
    }
    cout << min({count,count2}) << endl;

}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

#define INF INT_MAX

// graph by adjacency list
template <typename T>
struct Edge {
  int dst; T weight;
  Edge(int dst, T weight) : dst(dst), weight(weight) { }
  bool operator < (const Edge<T> &e) const {
    return weight > e.weight;
  }
};

template <typename T>
struct Graph {
  int V;
  vector<vector<Edge<T>>> E;
  Graph(int V) : V(V) { E.resize(V); }
  void add_edge(int src, int dst, T weight) {
    E[src].emplace_back(dst, weight);
  }
};

template <typename T>
struct Node {
  int v; T dist;
  Node(int v, T dist) : v(v), dist(dist) { };
  bool operator < (const Node<T> &n) const {
    return dist > n.dist; // reverse
  }
};

template <typename T>
struct ShortestPath {
  const Graph<T> g;
  vector<T> dist;
  vector<int> prev;

  ShortestPath(const Graph<T> g) : g(g) { dist.resize(g.V), prev.resize(g.V); }

  void dijkstra(int start) {
    priority_queue<Node<T>> que;
    dist.assign(g.V, INF);
    dist[start] = 0;
    que.emplace(start, 0);
    prev[0] = -1;

    while (!que.empty()) {
      Node<T> n = que.top(); que.pop();
      int v = n.v; T cost = n.dist;
      if (dist[v] < cost) continue;
      for (Edge<T> e : g.E[v]) {
	if (dist[v] < dist[e.dst] - e.weight) {
	  dist[e.dst] = dist[v] + e.weight;
	  prev[e.dst] = v;
	  que.emplace(e.dst, dist[e.dst]);
	}
      }
    }
  }

  vector<int> build_path(int goal) {
    vector<int> path;
    for (int v = goal; v != -1; v = prev[v]) {
      path.emplace_back(v);
    }
    reverse(path.begin(), path.end());
    return path;
  }
};


int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int V, E, r; cin >> V >> E >> r;
  Graph<int> g(V);
  REP(i, E) {
    int s, t, d; cin >> s >> t >> d;
    g.add_edge(s, t, d);
  }
  ShortestPath<int> sp(g);
  sp.dijkstra(r);
  REP(i, g.V) {
    if (sp.dist[i] == INF) {
      cout << "INF" << endl;
    } else {
      cout << sp.dist[i] << endl;
    }
  }
  return 0;
}

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

class UnionFind
{
    std::vector<std::size_t> root;
    const std::size_t maximum_size;

public:
    UnionFind(const std::size_t N) : maximum_size(N + 5)
    {
        this->root = std::vector<std::size_t>(N + 1, this->maximum_size);
    }

    std::size_t find_root(const std::size_t A)
    {
        if (this->root[A] >= this->maximum_size)
        {
            return A;
        }
        this->root[A] = this->find_root(this->root[A]);
        return this->root[A];
    }

    std::size_t size(const std::size_t A)
    {
        return this->root[this->find_root(A)] - this->maximum_size + 1;
    }

    bool unite(const std::size_t A, const std::size_t B)
    {
        std::size_t rootA = find_root(A);
        std::size_t rootB = find_root(B);
        if (rootA == rootB)
        {
            return false;
        }

        if (this->size(rootA) < this->size(rootB))
        {
            std::swap(rootA, rootB);
        }

        this->root[rootA] += this->size(rootB);
        this->root[rootB] = rootA;

        return true;
    }

    bool has_same_root(const std::size_t A, const std::size_t B)
    {
        return this->find_root(A) == this->find_root(B);
    }
};

int main()
{
    size_t N, M;
    cin >> N >> M;

    UnionFind uf(N);
    int ans = N - 1;
    size_t A, B;
    for (size_t i = 0; i < M; i++)
    {
        cin >> A >> B;
        if (uf.unite(A, B))
        {
            ans--;
        }
    }
    cout << ans << endl;
}


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

int main()
{
int a,b;
cin >> a >> b;
if(a > b)
{
cout << "a > b" << endl;
}
else if(a < b)
{
cout << "a < b" << endl;
}
else 
{
cout  << "a == b" << endl;
}
}

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



int main()
{
   int n,d,x,y,c=0;
   cin>>n>>d;
   double ans;
   for(int i=0;i<n;i++)
   {
       cin>>x>>y;
       ans=sqrt(pow(x,2)+pow(y,2));
       if(ans<=d)
       {
           c++;
       }

   }
   cout<<c<<endl;
}


Measured memory_bytes: 3672
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main(){
  int N, M;
  int D[200010], T[200010];

  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> D[i];
  }
  cin >> M;
  for(int i = 0; i < M; i++){
    cin >> T[i];
  }

  sort(D, D+N);
  sort(T, T+M);

  int di = 0, ti = 0;
  bool res = true;
  while(ti < M){
    if(D[di] < T[ti]){
      di++;
    }
    else if(D[di] == T[ti]){
      di++;
      ti++;
    }
    else{
      res = false;
      break;
    }
  }

  if(res) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
  int H, W; cin >> H >> W;
  int N; cin >> N;
  vector<int> a(N); REP(i, N) cin >> a[i];
  int cnt = 0, num = 0, k = 0;
  vector<deque<int>> ans(H);
  bool flag = true;
  while(true) {
    if(flag == true) {
      ans[cnt/W].push_back(k + 1);
    } else if(flag == false) {
      ans[cnt/W].push_front(k + 1);
    }
    cnt++; num++;
    if(cnt % W == 0) {
      flag = !flag;
    }
    if(num == a[k]) {
      num = 0;
      k++;
    }
    if(cnt == H * W) break;
  }
  REP(i, H) {
    REP(k, W) {
      cout << ans[i][k] << " ";
    }
    cout << endl;
  }
}

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define what_is(x) cerr << #x << " is " << x << endl;
#define MT make_tuple
#define eb emplace_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define FOR(i,n) for (int i=0;i < n ; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
clock_t startTime;
long double getTime(){
	return (long double)(clock()-startTime)/CLOCKS_PER_SEC;
}

int main(){
	startTime=clock();
	ll n;
	cin >> n;
	ll array[n];
	ll sum[n+1];
	ll count=0;
	sum[0]=0;
	FOR(i,n){
		cin >> array[i];
		sum[i+1]= sum[i]+array[i] ;  
	}
	sort(sum,sum+n+1);
	ll i=0;
	while(i< n+1 ){
		ll j=i;
		while(j<n+1 && sum[i]==sum[j])j++;
		count+=((j-i)*(j-i-1))/2;
		i=j;
	}
	cout << count;
	return 0;
}

Measured memory_bytes: 6724
#include <iostream>

using namespace std;

#define MAX 1000
 
int main(){
    int n,m;
    int ms[MAX+1];
     
    while(true){
        cin >> n >> m;
        if(!n&&!m) break;
         
        for(int i = 0 ; i < n ; i++) cin >> ms[i];
     
        int go,t=0,cnt = 0;
        bool flg = false;
         
        for(int i = 0 ; i < m ; i++){
            cin >> go;
            if(!flg){
                t += go;
                t += ms[t];
                cnt++;
                if(t >= n-1) flg = true;
            }
        }
        cout << cnt << endl;
    }
    return 0;
}

Measured memory_bytes: 3104
import bisect
N,M,K=map(int,input().split())
alist=list(map(int,input().split()))
blist=list(map(int,input().split()))

sum_alist=[0]
for i in range(N):
  sum_alist.append(sum_alist[-1]+alist[i])
#print(sum_alist)

sum_blist=[0]
for i in range(M):
  sum_blist.append(sum_blist[-1]+blist[i])
#print(sum_blist)

limit_a=bisect.bisect(sum_alist,K)
#print(limit_a)

limit_b=bisect.bisect(sum_blist,K)
#print(limit_b)

answer=0
for i in reversed(range(limit_a)):
  a_sum=sum_alist[i]
  b_sum=K-a_sum
  pos_b=bisect.bisect(sum_blist,b_sum)
  #print(i,pos_b-1,a_sum,sum_blist[pos_b-1],b_sum)
  answer=max(answer,i+pos_b-1)
  
if limit_a==1:
  pos_b=bisect.bisect(sum_blist,K)
  answer=pos_b-1
  
print(answer)

Measured memory_bytes: 132144
#include<stdio.h>
#include<map>
#include<string>
#include<string.h>
#include<utility>
#include<algorithm>
#include<vector>
#include<queue>
#include<iostream>
#include<math.h>
#include<stack>
#include<set>
#define INF 2147483647
#define n 300000
#define loop(i, a, b) for(int i=a; i<=b; i++)
#define mem(arr) memset(arr, 0, sizeof(arr));
using namespace std;
typedef long long lli;
typedef double llf;
typedef pair<int, int> P;
struct edge{
	int to, weight;
};
void solve();
int main()
{
	int times = 1;
//	cin >> times;
	loop(i, 1, times)
	{
		solve();
		cout << '\n';
	}
	return 0;
}
vector<edge> V[n + 50];
lli a, b, c, d, e, f;
int arr[n + 50], arr1[n + 50], arr2[n + 50];
string str, str1, str2;

void solve()
{
	lli ans = 214748364777777;
	cin >> a;	
	int temp = sqrt(a) + 5;
	for(lli i=1; i<=temp; i++)
	{
		if(a % i == 0)
		{
			lli temp = i - 1 + (a / i - 1);
			ans = min(ans, temp);
		}
	}
	cout << ans << '\n';
}

Measured memory_bytes: 8832
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int copy=n;
  int i,count=0;
  while(copy>0){
    copy=copy/10;
    count++;
  }
  if(count==6){
    cout << 90909;
  }
  if(count==4){
    cout << 909;
  }
  if(count==2){
    cout << 9;
  }
  if(count==1){
    cout << n;
  }
  if(count==3){
    cout << 9+n-99;
  }
  if(count==5){
    cout << 909+n-10000+1;
  }
}
    
  

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

int main() {
  int w, h, n, i, j, k, ans = 0;
  cin >> w >> h >> n;
  vector<int> x(n), y(n), a(n);
  for (i = 0; i < n; i++) {
    cin >> x[i] >> y[i] >> a[i];
  }
  vector<vector<int>> cnt(h, vector<int>(w, 0));
  for (i = 0; i < n; ++i) {
    if (a[i] == 1) {
      for (j = 0; j < h; ++j) {
        for (k = 0; k < x[i]; ++k) {
          cnt[j][k] = 1;
        }
      }
    }
    if (a[i] == 2) {
      for (j = 0; j < h; ++j) {
        for (k = x[i]; k < w; ++k) {
          cnt[j][k] = 1;
        }
      }
    }
    if (a[i] == 3) {
      for (j = 0; j < y[i]; ++j) {
        for (k = 0; k < w; ++k) {
          cnt[j][k] = 1;
        }
      }
    }
    if (a[i] == 4) {
      for (j = y[i]; j < h; ++j) {
        for (k = 0; k < w; ++k) {
          cnt[j][k] = 1;
        }
      }
    }
  }
  for (i = 0; i < h; ++i) {
    for (j = 0; j < w; ++j) {
      if (cnt[i][j] == 0) {
        ++ans;
      }
    }
  }
  cout << ans << "\n";
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

template <class T>
struct RangeSum {
  vector<T> vec;
  RangeSum() {}
  RangeSum(vector<T> elems) : vec(elems) {
    for (int i = 1; i < vec.size(); i++) { vec[i] += vec[i - 1]; }
  }
  T sum(int l, int r) {
    if (l > r) return T(0);
    if (l == 0)
      return vec[r];
    else
      return vec[r] - vec[l - 1];
  }
};

void solve() {
  int N;
  cin >> N;
  vector<int> a;

  a.push_back(0);
  for (int i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
  a.push_back(0);
  vector<int> b;
  for (int i = 1; i <= N + 1; i++) b.push_back(abs(a[i] - a[i - 1]));
  // dmp(b);
  RangeSum<int> rs(b);
  for (int i = 1; i <= N; i++) {
    cout << abs(a[i - 1] - a[i + 1]) + rs.sum(0, i - 2) + rs.sum(i + 1, N)
         << endl;
  }
  return;
}

signed main() {
  fastio();
  solve();
  //   int t;
  //   cin >> t;
  //   while (t--) solve();
  return 0;
}


Measured memory_bytes: 2544
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll;
template<class T>using vv = vector<vector<T>>; template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T1, class T2>bool chmax(T1& a, const T2& b) { return a < b ? a = b, 1 : 0; }
template<class T1, class T2>bool chmin(T1& a, const T2& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

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

    write(3 * r * r);
}

Measured memory_bytes: 892
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<iostream>
#include<cstdlib>
using namespace std;

int main()
{
	int sum = 0;
	int a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;
	if(a + b > 2 * c) {
		if(x <= y) {
			sum = x * c * 2;
			sum = sum + (y - x) * b;
		}
		else {
			sum = y * c * 2;
			sum = sum + (x - y) * a;
		}
		if(2*max(x, y)*c <= sum) sum = 2*max(x,y)*c;
	}
	else {
		sum = a * x + b * y;
	}
	cout << sum << endl;
}
		

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
  string s,res="No";
  cin >> s;
  if(s.substr(0,1)==s.substr(1,1)){
    if(s.substr(0,1)!=s.substr(2,1)
       && s.substr(2,1)==s.substr(3,1))
      res="Yes";
  } else if(s.substr(0,1)==s.substr(2,1)
          && s.substr(1,1)==s.substr(3,1)
          || s.substr(0,1)==s.substr(3,1)
          && s.substr(1,1)==s.substr(2,1))
    res="Yes";
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    int n;
    int k;
    cin >> n >> k;
    int g =(int) ceil(n/k*1.0);
    if(g*k==n)
        cout << 0;
     else
        cout << 1;

     //system("pause");
     return 0;
}



Measured memory_bytes: 256
using System;

namespace _0014
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string n = Console.ReadLine();
                if (n == null)
                {
                    break;
                }
                int d = int.Parse(n);
                int s = 0;
                for (int i = 0; i < 600 / d; i++)
                {
                    s += d * d * d * i * i;
                }
                Console.WriteLine(s);
            }
        }
    }
}

Measured memory_bytes: 9120
#python3
def main():
    k, n = map(int, input().split()) 
    a = [0] + [int(i) for i in input().split()]
    b = []
    for i in range(n):
        b.append(a[i+1]-a[i])
    b.append(k-a[n]+b[0])
    s = max(b)
    print(k-s)
main()

Measured memory_bytes: 26420
class UnionFind
    def initialize(size)
        @rank = Array.new(size, 0)
        @parent = Array.new(size, &:itself)
    end
  
    def unite(id_x, id_y)
        x_parent = get_parent(id_x)
        y_parent = get_parent(id_y)
        return if x_parent == y_parent
    
        if @rank[x_parent] > @rank[y_parent]
            @parent[y_parent] = x_parent
        else
            @parent[x_parent] = y_parent
            @rank[y_parent] += 1 if @rank[x_parent] == @rank[y_parent]
        end
    end
  
    def get_parent(id_x)
        @parent[id_x] == id_x ? id_x : (@parent[id_x] = get_parent(@parent[id_x]))
    end
  
    def same_parent?(id_x, id_y)
        get_parent(id_x) == get_parent(id_y)
    end
end

n, m = gets.chomp.split.map(&:to_i)
uf = UnionFind.new(n)
m.times do
    a, b = gets.chomp.split.map(&:to_i)
    uf.unite(a-1, b-1)
end

h = Hash.new(0)
hoge = []

n.times do |i|
    tmp = uf.get_parent(i)
    hoge << tmp
    h[tmp] += 1
end

puts h.size-1

Measured memory_bytes: 21088
#include<bits/stdc++.h>
#define int long long
#define REP(i,a,n) for(int i=a;i<(n);i++)
#define RE return
#define FILL(a,b) memset(a,b,sizeof(a))
#define SO(a) sort(all(a))
#define pb push_back
#define sz(a) a.size()
#define V vector
#define ld long double
#define viit(a) vector<int>::iterator a
#define IT iterater
#define FOR(i,a,n) for(int i=a;i<=(n);i++)
#define B(s) s.back()
#define all(a) a.begin(),a.end()
#define ER1(a) a.erase(a.begin())
#define ER0(a) a.erase(a.end())
#define pii pair<int,int>
#define pause system("PAUSE")
#define cls system("CLS")
using namespace std;
signed main()
{
    //ios::sync_with_stdio(0);
	//freopen("C:/Users/LENOVO/Desktop/文件操作/in.txt","r",stdin);
	//freopen("C:/Users/LENOVO/Desktop/文件操作/out.txt","w",stdout);
	int x,sum=9;
	cin>>x;
	for(int i=400;i<=1800;i+=200){
		sum--;
		if(x>=i&&x<(i+200)){
			break;
		}
	}
	cout<<sum<<endl;
	//fclose(stdin);
	//fclose(stdout);
    return 0;
}


Measured memory_bytes: 3616
#include "bits/stdc++.h"

#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
#define RREP(i, n ,N) for(ll i = (N-1); i >= (n); i--)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
ll inf = 1e18;

ll a, b, c;
string s, t;

int main(){
	cin >> s;
	REP(i,0,s.size()){
		cout << 'x';
	}
	cout << endl;
	return 0;
}

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

using namespace std;
int main(){
  int n;
  cin >> n;
   
  int  res=0;
  int small=1000;
  int s;
  for(int i=0;i<n;i++){
   cin >> s;
   res+=s;
    if(s%10!=0) small=min(small,s);
  }
  
  
 if(small==1000) cout << 0 << endl;
 else if(res%10==0) cout << res-small << endl; 
 else cout << res << endl; 
  
}

Measured memory_bytes: 256
count = gets.to_i
pos = Array.new
pos=gets.chomp.split(" ").map(&:to_i);
min = pos.min
max = pos.max
amount_min = nil
for i in min..max do
  amount = 0
  isBreak = false
  pos.each do |p|
    if amount_min != nil && amount_min < amount
      isBreak = true
      break
    end
    amount += (i - p)*(i - p)
  end
  break if isBreak
  if amount_min == nil || amount <= amount_min
    amount_min = amount
  end
end
print amount_min


Measured memory_bytes: 3836
//According to all known laws of aviation, there is no way that a bee should be able to fly.
//Its wings are too small to get its fat little body off the ground. The bee, of course, flies anyway.
//Because bees don't care what humans think is impossible.
#include <bits/stdc++.h>
#define FAST_IO ios_base::sync_with_stdio(false), cin.tie(nullptr)
#define mod 1000000007
using namespace std ;
using bigint = long long int ;
using vi = vector<int> ;
using vll = vector<long long int> ;
int cnt[1000001] ;
bool flag[1000001] ;
int main(){
    FAST_IO ;
    int N ; cin >> N ;
    for( int i = 0 ; i < N ; i++ ){
        int x ; cin >> x ;
        cnt[x]++ ;
    }
    int ans = 0 ;
    for( int i = 1 ; i <= 1000000 ; i++ ){
        if( cnt[i] > 0 ){
            for( int j = 2 * i ; j <= 1000000 ; j += i ){
                flag[j] = true ;
            }
        }
    }
    for( int i = 1 ; i <= 1000000 ; i++ ){
        if( cnt[i] > 1 )
            continue ;
        if( cnt[i] == 1 && flag[i] == 0 ){
            ans++ ;
        }
    }
    cout << ans << endl ;
    return 0 ;
    
}


Measured memory_bytes: 8520
#include <stdio.h>
int main(void){
  int n,i,j,Rmax,R[200000];

  scanf("%d",&n);
  for (i = 0; i < n; i++) {
    scanf("%d",&R[i]);
  }

  Rmax = R[n-1] - R[n-2];
  for (i = n-1; i >= 1; i--) {
    if (R[i] - R[i-1] > 0) {
      Rmax = R[i] - R[i-1];
      break;
    }else if (R[i] - R[i-1] > Rmax) {
      Rmax = R[i] - R[i-1];
    }
  }

  j = i;
  for (; i >= 1; i--) {
    if (R[i] > R[j]) {
      j = i;
    }
    if (R[j] - R[i-1] > Rmax) {
      Rmax = R[j] - R[i-1];
    }
  }

  printf("%d\n", Rmax);

  return 0;
}



Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define int long long

int32_t main() {
	ios::sync_with_stdio(0);cin.tie(0);
	int d, t, s;
	cin >> d >> t >> s;
	if(t*s >= d)
		cout << "Yes";
	else
		cout << "No";
}

Measured memory_bytes: 3644
N, K = gets.split.map(&:to_i)
X = gets.split.map(&:to_i)

positive = X.select { |x| x >= 0 }.sort
negative = X.select { |x| x < 0 }.map { |v| v.abs }.sort

ans_list = []

if positive.size >= K
  ans_list << positive[K - 1]
end

if negative.size >= K
  ans_list << negative[K - 1]
end

if K >= 2
  1.upto(K - 1) do |i|
    if negative.size >= i && positive.size >= K - i
      ans_list << negative[i - 1] * 2 + positive[K - i - 1]
    end

    if positive.size >= i && negative.size >= K - i
      ans_list << positive[i - 1] * 2 + negative[K - i - 1]
    end
  end
end

puts ans_list.min


Measured memory_bytes: 11664
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#define ALLRANGE(x) x.begin(), x.end()
using namespace std;

int main(){
  int A, B, C;
  cin >> A >> B >> C;
  if (A==B) cout << C << endl;
  else if (A==C) cout << B << endl;
  else cout << A << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
int main(){
  ll n; cin >> n;
  vector<int> a;
  while(n != 0){
    n--;
    a.push_back(n % 26);
    n /= 26;
  }
  for(int i = a.size()-1; i >= 0; --i){
    cout << (char)(a[i] + 97);
  }
  cout << endl;
  return 0;
}

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

int main() {
  int a,b;
  cin >> a >> b;
  a = a + b;
  if(a % 2 != 0) {
    a = a / 2 + 1;
  } else {
    a = a / 2;
  }
  cout << a << endl;
}

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

struct tr{
    ll x,y;
};

bool operator < (tr a, tr b){
    return a.x < b.x;
}


pair<ll,ll>  np(pair<int,int> a){
    ll x = a.first;
    ll y = a.second;
    ll mi = min(x,y);
    return {x-mi,y-mi};
}

ll h,w,n;
vector<tr> a;

main(){
    cin >> h >> w >> n;
    ll f1,f2;
    a.resize(n);
    for(int i=0;i<n;++i){
        cin >> f1 >> f2;
        a[i] = {f1,f2};
    }
    sort(a.begin(),a.end());

    set<pair<ll,ll>> no_points;
    ll ans = h;
    for(int i=0;i<n;++i){
        if(no_points.count(np({a[i].x,a[i].y})) == 0 && a[i].x-1>=a[i].y){
            ans = a[i].x-1;
            //cout << "ans_p" << a[i].x << ' ' << a[i].y << "\n";
            break;
        }
        else{
            no_points.insert(np({a[i].x+1,a[i].y}));
        }
    }

    cout << ans;

}


Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> p2;
void solve(){
	ll a;
	ld b;
	cin>>a>>b;
	ld res=a*b;
	cout<<ll(floor(res));
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	ll qc=1;
    for(ll i=1;i<=qc;i++)
    solve();
}


Measured memory_bytes: 3748
#include <bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<iomanip>
#include <cmath>

using std::cout;
using std::cin;
using std::endl;

int main(void){
  std::cout << std::fixed << std::setprecision(15);
  int N;
  int cnt;
  int kai;
  double distance = 0;
  
  cin >> N;
  int A[N][2];
  for(int i = 0; i < N; i++){
    for(int j = 0; j < 2; j++){
      cin >> A[i][j];
    }
  }
  switch(N){
    case 2:
      cnt = 2;
      kai = 2;
      break;
    case 3:
      cnt = 4;
      kai = 6;
      break;
    case 4:
      cnt = 12;
      kai = 24;
      break;
    case 5:
      cnt = 48;
      kai = 120;
      break;
    case 6:
      cnt = 240;
      kai = 720;
      break;
    case 7:
      cnt = 1440;
      kai = 5040;
      break;
    case 8:
      cnt = 10080;
      kai = 40320;
      break;
  }
  
  for(int i = 0; i < N-1; i++){
    for(int j = i+1; j < N; j++){
      distance += sqrt(((A[i][0]-A[j][0])*(A[i][0]-A[j][0])+(A[i][1]-A[j][1])*(A[i][1]-A[j][1])));
      
    }
  }
  cout << distance * cnt/kai;
}

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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)

/* データを互いに重複しない集合に分割して保持するデータ構造を
 * 素集合データ構造 (Disjoint-set Data Structure) という。
 * このデータ構造に対して
 *  ・Find:  特定の要素がどの集合に属しているかを求める
 *  ・Union: 2つの集合を統合する
 * のアルゴリズムを兼ね備えたデータ構造を Union Find データ構造と呼ぶ。
 */

class UnionFind
{
    private:
        std::vector<int> parent;  // parent[x]: x の根の番号
                                  //            x が根の場合はその連結成分の大きさ
        std::vector<int> rank;    // rank[x]  : x が属する木の高さ
        std::size_t sz;           // 連結成分の数

    public:
        // x が親の場合、parent[x] = -(その連結成分の大きさ)
        UnionFind( std::size_t n ): parent(n, -1), rank(n, 0), sz(n) {}

        // x が属する集合の親を返し、x を親に直接繋ぎ直す(経路圧縮)
        int find( int x )
        {
            if( parent[x] < 0 ) return x;
            else return parent[x] = find( parent[x] );
        }

        // x が属する集合と y が属する集合を統合する
        bool unite( int x, int y )
        {
            x = find( x );
            y = find( y );
            if( x == y ) return false;

            // 大きい方(x)に小さい方(y)を繋げる
            if( rank[x] < rank[y] ) std::swap( x, y );

            parent[x] += parent[y];  // x に連結している成分の大きさを更新する
            parent[y] = x;           // y を x に繋ぐ
            if( rank[x] == rank[y] ) rank[x]++;
            sz--;

            return true;
        }

        bool same( int x, int y ) { return find(x) == find(y); }
        std::size_t size()        { return sz; }
        std::size_t size( int x ) { return - parent[find(x)]; }
};



int main()
{
    int N, M;
    cin >> N >> M;
    UnionFind uni(N);
    REP(i, M){
        int A, B;
        cin >> A >> B;
        --A, --B;
        uni.unite(A, B);
    }
    
    cout << uni.size()-1 << endl;

    return 0;
}

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

int main(){
  int k;
  string s;
  cin >>k >>s;
  string t;
  rep(i,s.size()){
    if(i<k) t += s[i];
    else {
      t += "...";
      break;
    }
  }
  cout << t << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
int n,m;
int main()
{
	cin >>n>>m;
	int x=1,y=x+m;
	while (x<y) cout <<x<<" "<<y<<"\n",x++,y--;
	x=1+m+1,y=x+m-1;
	while (x<y) cout <<x<<" "<<y<<"\n",x++,y--;
	return 0;
}

Measured memory_bytes: 3624
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1257
// ?´???°????????????????????????????????¨????????§
#include <bits/stdc++.h>
using namespace std;
vector<int> prime;
int n, res;
int main() {
    int isPrime[10001];
    fill(isPrime, isPrime+10001, 1);
    isPrime[0] = isPrime[1] = 0;
    for (int i=2; i<=10000; i++) {
        if (isPrime[i]) {
            prime.push_back(i);
            for (int j=i*2; j<=10000; j+=i) isPrime[j] = 0;
        }
    }
    while(scanf("%d",&n)) {
        if (n == 0) break;
        res = 0;
        int lb = 0, rb = 0, sum = 0;
        while (lb < prime.size()) {
            while (sum<n && rb<prime.size()) sum += prime[rb++];
            if (sum == n) res++;
            sum -= prime[lb++];
        }
        printf("%d\n",res);
    }
}

Measured memory_bytes: 1264
import java.util.*;
public class Main {
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
	  int a = sc.nextInt();
      int b = sc.nextInt();
      int t=0;
      for(int i=1;i<=b-a-1;i++){
        t+=i;
      }
        System.out.println(t-a);    
    }
}

Measured memory_bytes: 35860