akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <algorithm>

using namespace std;


int main(){
	int n,minimum,tmp;
	scanf("%d",&n);
	int table[n][n];
	int data[n][2];

	for(int i=0;i<n;i++){
		for(int k=0;k<n;k++)table[i][k] = 0;
		scanf("%d %d",&data[i][0],&data[i][1]);
	}

	for(int i=n-2;i>=0;i--){
		for(int k=0;k<=i;k++){
			if(i==n-2){
				table[n-i-1][k] = data[k][0]*data[k][1]*data[k+1][1];
		}else{
				minimum = 2147483647;
				for(int p=0;p<=n-i-2;p++){
					tmp=(table[p][k]+table[n-i-p-2][k+p+1])+(data[k][0]*data[k+p][1]*data[k+n-i-1][1]);
					minimum = min(minimum,tmp);
				}
				table[n-i-1][k] = minimum;
			}
		}
	}

	printf("%d\n",table[n-1][0]);

    return 0;
}



Measured memory_bytes: 2668
import java.io.*;
import java.util.*;
import static java.lang.System.in;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        //BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        //String[] buf = reader.readLine().split(" ");
        int p = sc.nextInt(), q = sc.nextInt(), r = sc.nextInt();
        int ans = Math.min(p+q,Math.min(p+r,q+r));
        System.out.println(ans);
    }
}



Measured memory_bytes: 22740
import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def II(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def SI(): return input()
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')

import math

N, K = LI()

p = 0
for a in reversed(range(1,N+1)):
    if a >= K:
        p += 1/N
    else:
        p += (1/N) * (0.5)**math.ceil(math.log2(K/a))

print(p)


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

int main() 
{ int n,k,s,i;
 cin>>n;
      for (i = 0; i < n;i++) 
    {
        cin >> s;
        if (s%2==1){k++;}
    }
            if (k%2==0){
   cout<<"YES"<<endl;
  }
  else
  {
    cout<<"NO"<<endl;
  }
  
    return 0;
}


Measured memory_bytes: 384
N, M = map(int, input().split())

inf = 10 ** 10

dp = [inf] * (1 << N)
dp[0] = 0
#print(dp)


for _ in range(M):
    a, b = map(int, input().split())
    c = sum([2 ** (i - 1) for i in map(int, input().split())])
    #print(a, b)
    #print(c)

    for j in range(1 << N):
      dp[j | c] = min(dp[j] + a, dp[j | c])
      # print(j | c)
res = dp[-1] if dp[-1] != inf else -1
print(res)


Measured memory_bytes: 3188
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
using namespace std;

int main(){

	int N,M,left,right,ans = 0;
	scanf("%d %d",&N,&M);

	bool* table = new bool[N+1];
	for(int i = 0; i <= N; i++)table[i] = false;

	for(int i = 0; i < M; i++){
		scanf("%d %d",&left,&right);
		for(int k = left;k < right;k++)table[k] = true;
	}

	for(int i = 0; i <= N; i++){
		if(table[i])ans += 3;
		else{
			ans += 1;
		}
	}

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

	return 0;
}

Measured memory_bytes: 2724
#include <stdio.h>

int A[100000], M[100000];

void Do(int N){
  int i, d;
  long long S;
  S = 0;
  for(i = 0;i < N;i++){
    scanf("%d", &A[i]);
    S += A[i];
  }
  S *= 0.5;
  for(i = 1;i < N;i+=2) S -= A[i];
  d = S * 2;
  for(i = 0;i < N - 1;i++){
    printf("%d ", d);
    d = A[i] * 2 - d;
  }
  printf("%d\n", d);
}
  
int main(void){
  int N;
  scanf("%d", &N);
  Do(N);
  return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>


using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(ll i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

using Graph = vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;
const double PI = 3.1415926535897932;


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

	ll n, m;
	cin >> n >> m;
	ll k;
	cin >> k;
	vector<ll> a(n), b(m);
	rep(i, n)
	{
		cin >> a[i];
	}
	rep(i, m)
	{
		cin >> b[i];
	}
	rep(i, n - 1)
	{
		a[i + 1] += a[i];
	}
	rep(i, m-1)
	{
		b[i + 1] += b[i];
	}
	ll ans = 0;

	ll mid = INF;

	for (int i = m - 1; i >= 0; i--)
	{
		if (b[i] > k)
			continue;
		else
		{
			mid = i;
			break;
		}
	}

	ans = mid + 1LL;
	if (mid == INF)
	{
		ans = 0;
		mid = -1;
	}

	for (int i = 0; i < n; i++)
	{
		if (mid != -1)
		{
			while (a[i]+b[mid]>k)
			{
				mid--;
				if (mid == -1)
					break;
			}
			if (mid == -1)
			{
				if (a[i] <= k)
				{
					ans = max(ans,i + 1LL);
				}
			}
			else
			{
				if (a[i] + b[mid] <= k)
				{
					ans = max(ans,i + mid + 2LL);
				}
			}
		}
		else
		{
			if (a[i] <= k)
				ans = max(ans,i + 1LL);
			else
				break;
		}
	}
	cout << ans << endl;

	return 0;

}

Measured memory_bytes: 6308
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }
    
    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};

int main(){ 
    int n, m; cin >> n >> m;
    UnionFind uf(n);
    rep(i, m){
        int a, b; cin >> a >> b; a--, b--;
        uf.merge(a, b);
    }
    int res = 0;
    rep(i, n){
        chmax(res, uf.size(i));
    }
    cout << res << ln;
}



Measured memory_bytes: 4040
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<string, string> P;

int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    map<P, ll> mp;
    for(int b = 0; b < (1 << n); b++){
        string t, u;
        cin >> t >> u;
        for(int i = 0; i < n; i++){
            if((b >> i) & 1) t += s[i];
            else u += s[i];
        }
        mp[P(t, u)]++;
    }
    reverse(s.begin(), s.end());
    ll ans = 0;
    for(int b = 0; b < (1 << n); b++){
        string t, u;
        cin >> t >> u;
        for(int i = 0; i < n; i++){
            if((b >> i) & 1) t += s[i];
            else u += s[i];
        }
        ans += mp[P(t, u)];
    }
    cout << ans << endl;
}


Measured memory_bytes: 60960
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <cstdio>
typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define max3(x, y, z) max(x, max(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif
using namespace std;
int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if (a != 2 and b != 2) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}
/*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
for (int i = 0; i < N; i++) {
cin >> list[i];
}
// for文
for (int i = 0; i < N; i++) {
}
//配列
vector<int> list;
list.at(i)
vector<vector<int>> list(10, vector<int>(10));
sort(all(list));
sort(all(list), greater<int>());
//配列の内容表示
dout << "====listの内容====\n";
for (int i = 0; i < N; i++) dout << list[i] << endl;
dout << "====ここまで====\n";
*/


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int main(void){
	int i,k;
	ll a[2];
	cin >> a[0] >> a[1] >> k;
	for(i=0; i<k; ++i){
		a[i%2] -= a[i%2]%2;
		a[i%2] /= 2;
		a[(i+1)%2] += a[i%2];
	}
	cout << a[0] << " " << a[1] << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>


int main()
{
    char a,b;
    scanf("%c %c",&a,&b);

     if(a-'H'==0)
      {
          if(b-'H'==0)
        printf("H\n");
      else
        printf("D\n");
        }
      else
       {
           if(b-'H'==0)
            printf("D\n");
           else
            printf("H\n");
       }


    return 0;
}


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

int main(){
    int a,b,h;
    cin >> a >> b >> h;
    cout << (a+b)*h/2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define maxn 200010
using namespace std;
char s[maxn];
int visit[maxn];
int main()
{
	int n, a, b, c, d, flag = 0;
	scanf("%d%d%d%d%d", &n, &a, &b, &c, &d);
	scanf("%s", s + 1);
	for (int i = b - 1; i <= d - 1; i++)
		if (s[i] == '.' && s[i + 1] == '.' && s[i + 2] == '.') flag = 1;
	if (flag == 0 && c > d) {puts("No"); return 0;}
	visit[a] = 1;
	for (int i = a + 1; i <= c; i++)
	{
		if (s[i] == '#') continue;
		visit[i] = visit[i - 1] | visit[i - 2];
	}
	if (visit[c] == 0) {puts("No"); return 0;}
	for (int i = 1; i <= n; i++)
		visit[i] = 0;
	visit[b] = 1;
	for (int i = b + 1; i <= d; i++)
	{
		if (s[i] == '#') continue;
		visit[i] = visit[i - 1] | visit[i - 2];
	}
	if (visit[d] == 0) puts("No");
	else puts("Yes");
}

Measured memory_bytes: 1152
import sys
sys.setrecursionlimit(10**9)
n=int(input())
g=[[] for _ in range(n)]
for i in range(n-1):
  a,b=map(int,sys.stdin.readline().split())
  g[a-1].append([b-1,i])
  g[b-1].append([a-1,i])
print(max(len(v) for v in g))
l=[0]*(n-1)
def dfs(v,p=-1,c=-1):
  k=1
  for u,e in g[v]:
    if u==p: continue
    if k==c: k+=1
    l[e]=k
    dfs(u,v,k)
    k+=1
dfs(0)
for c in l: print(c)

Measured memory_bytes: 89264
#include<bits/stdc++.h>
using namespace std;
long long n;
long long a[1000111];
bool ok=false;
vector<long long> qq;
int main()
{
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        cin>>a[i];
        if(a[i]==1) ok=true;
    }
    if(ok==false) {cout<<-1; return 0;}
    for(int i=1; i<=n; i++)
        {
            if(a[i]-1==qq.size()) qq.push_back(a[i]);
        }
    cout<<n-qq.size();
}


Measured memory_bytes: 3956
# import sys
# import math #sqrt,gcd,pi
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,\
#     combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import itemgetter,mul
# from fractions import Fraction
# from functools import reduce

# mod = int(1e9+7)
mod = 998244353
INF = 1<<29
lINF = 1<<35

def readInt():
    return list(map(int,input().split()))

def main():
    k = int(input())
    s = input()
    t = s[:k]
    if s==t:
        print(t)
    else:
        print(t+"...")
    return

if __name__=='__main__':
    main()


Measured memory_bytes: 9172
import java.util.ArrayList;
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();
        Graph[] graphs = new Graph[m];
        for(int i = 0;i < m;++i){
            graphs[i] = new Graph(sc.nextInt(),sc.nextInt());
        }
        boolean flags[] = new boolean[n];
        flags[0] = true;
        System.out.println(search(graphs,flags,1));
    }

    public static int search(Graph[] graphs,boolean[] passed,int now){
        int se = 0;
        int k = 0;
        for (boolean b:passed){
            if(b)++k;
        }
        if(k == passed.length)return 1;
        for (Graph graph:graphs){
            if(graph.start == now){
                if(!passed[graph.end - 1]){
                    boolean ps[] = passed.clone();
                    ps[graph.end - 1] = true;
                    se += search(graphs,ps,graph.end);
                }
            }
            else if(graph.end == now){
                if(!passed[graph.start - 1]){
                    boolean ps[] = passed.clone();
                    ps[graph.start - 1] = true;
                    se += search(graphs,ps,graph.start);
                }
            }
        }
        return se;
    }

    public static class Graph{
        int start,end;
        public Graph(int start,int end){
            this.start = start;
            this.end = end;
        }
    }


}

Measured memory_bytes: 22716
package main

import (
	"fmt"
)

func main() {
	var num int
	fmt.Scan(&num)

	ary := make([]int, num)
	for i:=0; i<num; i++ {
		fmt.Scan(&ary[i])
	}

	var (
		isContinue bool = true
		count int
	)
	for isContinue {
		for i:=0; i<len(ary); i++ {
			if (ary[i] % 2 != 0) {
				isContinue = false
				break
			}
			ary[i] = ary[i]/2
		}
		if isContinue {
			count++
		}
	}
	fmt.Println(count)
}

Measured memory_bytes: 512
/**
*    created: 21.06.2020 02:47:04
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pcnt(bit) __builtin_popcount(bit)
#define mod 1000000007
#define pi acos(-1.0)
using namespace std;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;
    map<string, int> mp;
    string f;
    rep(i,n) {
        string w;
        cin >> w;
        if (mp[w] > 0) {
            cout << "No" << endl;
            return 0;
        }
        else if (i >= 1 && f[f.size()-1] != w[0]) {
            cout << "No" << endl;
            return 0;
        }
        else {
            mp[w]++;
            f = w;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

using namespace std;
#define all(x) (x).begin(), (x).end()
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long>> vvl;
typedef pair<int,int> pii;
typedef long long ll;
void debugF(ostream &os) {os << endl;}
template <typename Head, typename... Tail>
void debugF(ostream &os, Head H, Tail... T) { os << " " << H; debugF(os, T...); }
#define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debugF(cout, __VA_ARGS__)
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); os << (i>0 ? " ":"") << v[i++]); return os;}

double D(double a){
    return 360*(a/(2*M_PI));
}

void coord(double a, double &x, double &y, int r){
    x = cos(a)*r;
    y = sin(a)*r;
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, h, m;
    cin >> a >> b >> h >> m;
    cout << setprecision(20);

    double ha = (M_PI*(60*h + m))/360;
    double hx,hy;
    coord(ha, hx, hy, a);    
    double ma = (M_PI*m)/30;
    double mx,my;
    coord(ma, mx, my, b);
    double ans = hypot(hx - mx, hy - my);
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 4124
#include<stdio.h>
#define Last 4280
int main(){
  int w;
  while(1){
    scanf("%d",&w);
    int cost=1150;
    if (w==-1)
      break;
    if (w>=30)
      cost+=(w-30)*160+10*140+10*125;
    if ((30>w) && (w>=20))
      cost+=(w-20)*140+10*125;
    if ((20>w) && (w>=10))
      cost+=(w-10)*125;
    printf("%d\n",Last-cost);
  }

  return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <climits>
#include <cmath>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

template<class A, class B>
ostream& operator << (ostream& output, const pair<A, B>& p) {
    output << "(" << p.first << ", " << p.second << ")";
    return output;
}

template<class A>
ostream& operator << (ostream& output, const set<A>& s) {
    for(auto it = s.begin(); it != s.end(); ++it) {
        output << *it << endl;
    }
    return output;
}

template<class A, class B>
ostream& operator << (ostream& output, const map<A, B>& m) {
    for(auto it = m.begin(); it != m.end(); ++it) {
        output << "[" << it->first << ", " << it->second << "]" << endl;
    }
    return output;
}

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
//const int mx = 1e5 + 5;

double x[10], y[10];

double dis(int i, int j) {
    double dx = x[i] - x[j];
    double dy = y[i] - y[j];
    return pow(dx * dx + dy * dy, 0.5);
}


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif

    int n;
    cin >> n;
    for(int i = 1; i <= n; ++i) {
        cin >> x[i] >> y[i];
    }
    vector<int> v(n);
    for(int i = 0; i < n; ++i) {
        v[i] = i + 1;
    }
    double distance = 0;
    do {
        for(int i = 0; i < n - 1; ++i) {
            distance += dis(v[i], v[i + 1]);
        }
    } while(next_permutation(v.begin(), v.end()));
    double fact = 1;
    for(int i = 2; i <= n; ++i) {
        fact *= i;
    }
    cout << fixed << setprecision(12) << distance / fact << endl;
    return 0;
}

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

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

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

  int t, x;
  cin >> t >> x;

  cout << fixed << setprecision(10) << ((double)t / (double)x) << endl;

  return 0;
}


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

using namespace std;

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

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

   string N;
   cin>>N;
   ll ans = 0;
   for(int i=0;i<N.size();i++){
      if(N[i] == '2')ans++;
   }
   cout<<ans<<endl;
   return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll a, b;
    cin >> a >> b;

    if(a <= 2*b) {
        out(0);
    }
    else {
        out(a - 2*b);
    }
    
    re0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
S, C = [], []
for m in range(M):
    s, c = map(int, input().split())
    S.append(s)
    C.append(c)
if N == 1:
    if all([c == 0 for c in C]):
        print(0)
        exit()
for n in range(10**(N - 1), 10**N):
    if all([int(str(n)[S[m] - 1]) == C[m] for m in range(M)]):
        print(n)
        exit()
print(-1)

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

using namespace std;

int main(void) {
	char s[201];
	cin >> s;
	int a = strlen(s),b,flag=0;
	while (flag == 0) {
		a -= 1;
		b = a/2;
		for (int i=0;i<b;i++) {
			if (s[i] != s[i+b]) {
				break;
			}
			if (i == b-1) {
				flag = 1;
			}
		}
		if (flag == 1) {
			if (a % 2 == 1) {
				a -= 1;
			}
			cout << a;
		}
	}
	cout << endl;
}


Measured memory_bytes: 256
N=int(input())
B=list(map(int,input().split()))

M=0
for i in range(N):
    if B[i]<0:
        M+=1

C=[]
for i in range(N):
    C.append(abs(B[i]))
C.sort()
if M%2==1:
    print(sum(C)-2*C[0])
else:
    print(sum(C))

Measured memory_bytes: 14332
n,K=map(int,input().split())
xy=[]
x=[]
y=[]
for i in range(n):
    a,b=map(int,input().split())
    x.append(a)
    y.append(b)
    xy.append([a,b])
x.sort()
y.sort()
data=[[0]*(n+1) for i in range(n+1)]
for u in xy:
    a,b=u
    X=x.index(a)
    Y=y.index(b)
    data[X][Y]=1
for i in range(n):
    for j in range(1,n):
        data[i][n-1-j]+=data[i][n-j]
for i in range(1,n):
    for j in range(n):
        data[n-i-1][j]+=data[n-i][j]
ans=float("inf")
for i in range(n):
    for j in range(i+1,n):
        for k in range(n):
            for l in range(k+1,n):
                if data[i][k]+data[j+1][l+1]-data[i][l+1]-data[j+1][k]>=K:
                    ans=min(ans,(x[j]-x[i])*(y[l]-y[k]))
print(ans)

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

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

typedef struct vector{
  int64 x,y;
} vec;

int64 innerNorm(vec a,vec b){
  return a.x*b.x+a.y*b.y;
}

int64 norm(vec a){
  return a.x*a.x+a.y*a.y;
}

int64 isParallel(vec a,vec b){
  int64 in=innerNorm(a,b);
  int64 x=norm(a);
  int64 y=norm(b);
  return in*in==x*y;
}

void run(void){
  int a,b,c,d;
  scanf("%d%d%d%d",&a,&b,&c,&d);
  vec p;
  p.x=c-a;
  p.y=d-b;
  int query;
  scanf("%d",&query);
  while(query--){
    int x,y;
    scanf("%d%d",&x,&y);
    vec q;
    q.x=x-a;
    q.y=y-b;
    if(isParallel(p,q)){
      if(ABS(p.x+q.x)<ABS(p.x)+ABS(q.x) || ABS(p.y+q.y)<ABS(p.y)+ABS(q.y)){
	printf("ONLINE_BACK\n");
      } else {
	if(norm(p)<norm(q)){
	  printf("ONLINE_FRONT\n");
	} else {
	  printf("ON_SEGMENT\n");
	}
      }
    } else {
      int t=p.x*q.y-p.y*q.x;
      printf("%s\n",t>0?"COUNTER_CLOCKWISE":"CLOCKWISE");
    }
  }
}

int main(void){
  run();
  return 0;
}



Measured memory_bytes: 2100
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using boost::multiprecision::cpp_int;
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

typedef long long ll;
typedef pair<ll, ll> p;


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

  for (ll i = 1; i <= n; ++i) {
    ll count = 0;

    for (ll x = 1; x*x <= i; ++x) {
      ll val = x*x;
      for (ll y = 1; y*y <= i-val; ++y) {
        ll val2 = val + y*y+x*y;
        if(val2 > i) break;
        for (int z = 1; z*z <= i-val2; ++z) {
          ll val3 = val2 + z*z + z*x + z*y;
          if(val3 == i) count++;
          if(val3 >= i) break;
        }
      }
    }
    cout << count << endl;
  }
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
int n, m;
bool vis[N];
vector<int> adjList[N];

void dfs(int v) {
	vis[v] = true;
	for (int u : adjList[v]) {
		if (vis[u]) continue;
		dfs(u);
	}
}

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

	cin >> n >> m;

	int a, b;
	for (int i = 0; i < m; i++) {
		cin >> a >> b;
		adjList[a].emplace_back(b);
		adjList[b].emplace_back(a);
	}

	int ans = -1;
	for (int i = 1; i <= n; i++) {
		if (vis[i]) continue;
		ans += 1;
		dfs(i);
	}

	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 9708
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+7;
int i,j,k,m,n,x,y,tot,ans;
int a[N],b[N],ver[N],nxt[N],head[N],edge[N]; 
void add(int x,int y,int w)
{
	ver[++tot]=y,edge[tot]=w,nxt[tot]=head[x],head[x]=tot;
}
int main()
{
	tot=1;
	scanf("%d%d%d",&n,&x,&y);
	printf("%d",min(n*x,y));
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(void){
  int N;
  cin >> N;
  
  vector<int>a(N);
  for(int i=0;i<N;i++){
    cin >> a[i];
  }
  
  int count = 1;
  
  vector<int>b(N);
  for(int i=0;i<N;i++){
    b[a[i] - 1] = count;
    count++;
  }
  
  for(int i=0;i<N;i++){
    cout << b[i] << " ";
  }
  
  return 0;
}


Measured memory_bytes: 1536
import sys; sys.setrecursionlimit(2147483647); input = sys.stdin.readline
from math import floor, ceil, sqrt, factorial, log
from collections import Counter, defaultdict, deque
from operator import itemgetter
INF = float('inf'); MOD = 10**9+7
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(MI())
def LIR(n): return [LI() for i in range(n)]
def IS(): return input().rstrip()

def main():
    A, B, M = MI()
    a = LI()
    b = LI()
    xyc = LIR(M)
    
    m = min([a[i[0]-1] + b[i[1]-1] - i[2] for i in xyc])
    print(min([m, min(a)+min(b)]))

if __name__ == '__main__':
    main()

Measured memory_bytes: 42768
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    bool flg;
    flg = true;
    for(int i=0; i<n; i++){
        cin >> a.at(i);
        if(a.at(i)%2 == 0){
            if(a.at(i)%3==0 || a.at(i)%5==0){
                flg = true;
            }else{
                flg = false;
                break;
            }
        }
    }
    if(flg){
        cout << "APPROVED" << endl;
    }else{
        cout << "DENIED" << endl;
    }
}




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

using namespace std;

using ll = long long;

int main() {

  ll k, cur = 7; cin >> k;
  if(k % 2 == 0 || k % 5 == 0){
    cout << -1;
    return 0;
  }
  for(ll i = 1; i < 10000000; ++i){
    if(cur % k == 0){
        cout << i;
        return 0;
    }
    cur = cur * 10 + 7;
    cur %= k;

  }
  cout << -1;
}


Measured memory_bytes: 3560
S = gets.chomp.chars
n = S.size

ans = eval(S.join)

n.times do |k|
  [*1..(n - 1)].combination(k + 1).each do |list|
    t = S.dup
    list.each_with_index do |l, i|
      t.insert(l + i, '+')
    end

    ans += eval(t.join)
  end
end

puts ans


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

typedef long long s64;

inline s64 getint()
{
	static char c;
	while ((c = getchar()) < '0' || c > '9');

	s64 res = c - '0';
	while ((c = getchar()) >= '0' && c <= '9')
		res = res * 10 + c - '0';
	return res;
}

const int MaxN = 100000;
const int M = 1000000007;
const s64 INF = 1000000000000000000ll;

inline int add(int a, const int &b)
{
	a += b;
	return a >= M ? a - M : a;
}
inline int dec(int a, const int &b)
{
	a -= b;
	return a < 0 ? a - M : a;
}

int n;
s64 wA, wB;
s64 a[MaxN + 1];

struct fenwick_tree
{
	int cur_clock = 0;
	int sum[MaxN + 2], mark[MaxN + 2];

	inline void add(int x, int d)
	{
		for (int i = ++x; i <= n; i += i & -i)
		{
			if (mark[i] == cur_clock)
				sum[i] = ::add(sum[i], d);
			else
			{
				mark[i] = cur_clock;
				sum[i] = d;
			}
		}
	}

	inline int query(int x)
	{
		int res = 0;
		for (int i = ++x; i; i ^= i & -i)
			if (mark[i] == cur_clock)
				res = ::add(res, sum[i]);
		return res;
	}
};
fenwick_tree f, g;

inline int find(int x, s64 w)
{
	int l = 0, r = x - 2;
	while (l <= r)
	{
		int mid = l + r >> 1;
		if (a[x] - a[mid] >= w)
			l = mid + 1;
		else
			r = mid - 1;
	}
	return r;
}

int main()
{
	cin >> n >> wA >> wB;
	for (int i = 1; i <= n; ++i)
		a[i] = getint();

	a[0] = -INF;

	f.add(0, 1);
	g.add(0, 1);
	for (int i = 2; i <= n; ++i)
	{
		int vF = f.query(find(i, wB));
		int vG = g.query(find(i, wA));

		if (a[i] - a[i - 1] < wA)
			++f.cur_clock;
		if (a[i] - a[i - 1] < wB)
			++g.cur_clock;

		f.add(i - 1, vG);
		g.add(i - 1, vF);
	}

	int vF = f.query(n - 1);
	int vG = g.query(n - 1);
	cout << add(vF, vG) << endl;

	return 0;
}

Measured memory_bytes: 2560
import java.util.*

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

object Problem {
    fun solveMulti(sc: Scanner, pw: java.io.PrintWriter) {
        for (t in 1..sc.next().toInt()) {
            solve(sc, pw)
        }
    }

    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val K = sc.next().toInt()
        var S = sc.next()
        if (S.length > K) {
            S = S.substring(0, K) + "..."
        }
        pw.println(S)
    }
}


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

int main() {
int a,b;
cin >> a >> b;
int count=0;
for(int i=a;i<=b;i++){
string s=to_string(i);
int flag=0;
for(int j=0;j<(int)(s.length())/2;j++){
if(s[j]!=s[(int)(s.length())-1-j])flag=1;

}
if(flag==0)count++;
flag=0;
}
cout << count;
}

Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <vector>
#include <algorithm>

#define rep(i,n) for(int i=0; i < n; i++)
using namespace std;

int main()
{
    int N, K, keta = 0;
    stack<int> ans;
    cin >> N >> K;

    while (N)
    {
        ans.push(N % K);
        N /= K;
        keta++;
    }

    cout << keta << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int N;
    int INF = 1e9;
    cin >> N;
    vector<int> P(N); 
    for(int i = 0; i < N; i++) cin >> P[i];
    vector<int> cnt(N, INF);
    for(int i = 0; i < N; i++){
        if(P[i] - 2 >= 0 && cnt[P[i] - 2] != INF) cnt[P[i] - 1] = cnt[P[i] - 2] + 1;
        else if(cnt[P[i] - 1] == INF) cnt[P[i] - 1] = 1;
    }
    int mx = 0;
    for(int i = 0; i < N; i++) mx = max(mx, cnt[i]);
    cout << N - mx << endl;
}

Measured memory_bytes: 4852
# -*- coding: utf-8 -*-
def inpl(): return map(int, input().split())
N, M, Q = inpl()

imos2d = [[0]*(N+2) for _ in range(N+2)]
S = [[0]*(N+2) for _ in range(N+2)]
S2 = [[0]*(N+2) for _ in range(N+2)]

for _ in range(M):
    L, R = inpl()
    imos2d[0][R] += 1
    imos2d[L+1][R] -= 1


for i in range(N+2):
    S[i][0] = imos2d[i][0]
    for j in range(N+1):
        S[i][j+1] = S[i][j] + imos2d[i][j+1]

S2[0] = [s for s in S[0]]
for i in range(N+1):
    for j in range(N+2):
        S2[i+1][j] = S2[i][j] + S[i+1][j]

for _ in range(Q):
    p, q = inpl()
    print(S2[p][q])

Measured memory_bytes: 63448
#include<iostream>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<math.h>
using namespace std;

char input[102][102];

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

    for (auto&& y = 0; y < H; ++y ) {
        for (auto&& x = 0; x < W; ++x ) {
            cin >> input[y][x];
        }
    }

    for (auto&& y = 0; y < 2 * H; ++y ) {
        if( y != 0 )
            cout << endl;
        for (auto&& x = 0; x < W; ++x ) {
            cout << input[y/2][x];
        }
    }
}



Measured memory_bytes: 888
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<int(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define show(x) cout<< #x << " = " << x << endl
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

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

const ll mod=1e9+7;
const int INF=INT_MAX/2;
const int N_MAX=100010;

int main(){
	int n;
	cin>>n;
	vector<ll> a(n),b(n);
	REP(i,n)cin>>a[i];
	REP(i,n)cin>>b[i];
	ll ans=0;
	for(int k=28;k>=0;k--){
		REP(i,n)a[i]=a[i]%(1<<(k+1));
		REP(i,n)b[i]=b[i]%(1<<(k+1));
		sort(a.begin(),a.end());
		sort(b.begin(),b.end());
		int cnt=0;
		REP(i,n){
			int T=1<<k;
			cnt+=lower_bound(b.begin(),b.end(),2*T-a[i])-
				lower_bound(b.begin(),b.end(),T-a[i]);
			cnt+=lower_bound(b.begin(),b.end(),(4*T-a[i]))-
				lower_bound(b.begin(),b.end(),(3*T-a[i]));
		}
		if(cnt%2)ans|=(1<<k);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3328
#include<stdio.h>
int main(){
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if(a<=b&&b<=c){
		printf("%d %d %d",a,b,c);
	}
	else if(a<=c&&c<=b){
		printf("%d %d %d",a,c,b);
	}
	else if(b<=c&&c<=a){
		printf("%d %d %d",b,c,a);
	}
	else if(b<=a&&a<=c){
		printf("%d %d %d",b,a,c);
	}
	else if(c<=a&&a<=b){
		printf("%d %d %d",c,a,b);
	}
	else if(c<=b&&b<=a){
		printf("%d %d %d",c,b,a);
	}
        printf("\n");
	return 0;
}

Measured memory_bytes: 600
#include<cstdio>
#include<cstring>
#include<iostream>
#include<stdlib.h>
#include<ctime>
#include<string>
#include<cmath>
#include<algorithm>
#include<complex>
#include<vector>
#include<set>
#include<map>
#include<queue>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define LL long long
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef pair<int,int> pa;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
int T;
LL A,B,C,D,L,R,t;
bool doit(){
	cin>>A>>B>>C>>D;
	if (D<B || A<B) return 0;
	if (B<=C+1) return 1;
	A%=D;
	t=__gcd(B,D);
	A%=t;
	//%t=A
	//C+1~B-1 cunzai %t=A
	if (B-1-(C+1)+1>=t) return 0;
	L=(C+1)%t,R=(B-1)%t;
	if (L<=R){
		if (A>=L && A<=R) return 0;
		else return 1;
	}
	if (A>=L || A<=R) return 0;
	return 1;
}
int main(){
	cin>>T;
	while (T--) puts(doit()?"Yes":"No");
	return 0;
}

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

int main(void) {
	int X, N;
	scanf("%d",&X);
	scanf("%d",&N);
	vector<int> p(N);
	for (int i = 0; i < N; i++) {
		scanf("%d",&p[i]);
	}
	int ans = X;
	int loop = 0;
	while (1) {
		// cout << "loop: " << loop << endl;
		bool exists = false;
		for (int i = 0; i < N; i++) {
			if (p[i] == X - loop) {
				exists = true;
				break;
			}
		}
		if (!exists) {
			ans = X - loop;
			break;
		}
		exists = false;
		for (int i = 0; i < N; i++) {
			if (p[i] == X + loop) {
				exists = true;
				break;
			}
		}
		if (!exists) {
			ans = X + loop;
			break;
		}
		loop++;
	}
	printf("%d", ans);

	return 0;
}


Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k; cin >> k;
    cout << a[k-1] << endl;

    return 0;
}

Measured memory_bytes: 256
x, n = map(int, input().split())
if n == 0:
  print(x)
  exit()
else:
  p = list(map(int, input().split()))
  for i in range(101):
    if x - i not in p:
      print(x - i)
      exit()
    elif x + i not in p:
      print(x + i)
      exit()

Measured memory_bytes: 9184
import fractions
INF = 100000000000

N = int(input())
lists = list(map(int, input().split()))

min_gcd = INF

for a in range(len(lists) - 1):
  min_gcd = min(min_gcd, fractions.gcd(lists[a], lists[a+1]))

print(min_gcd)

Measured memory_bytes: 16408
#include<bits/stdc++.h>
#include<numeric>
#define int long long
#define f(i,n) for(int i=0;i<n;i++)
using namespace std;
int gcd(int a , int b){ return b ? gcd(b,a%b) : a;}
signed main(){
  string s;
  cin>>s;
  f(i,3)if(s.at(i)==s.at(i+1)){
    cout<<"Bad"<<endl;
    return 0;
  }
  cout<<"Good"<<endl;
}

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

int N, H, W;

int main() {
    cin >> N >> H >> W;
    
    int ans = 0;
    int height, width;
    for (int i = 0; i < N; i++) {
        cin >> height >> width;
        if (height >= H && width >= W) {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long int ll;
typedef vector<pair<ll,ll> > Q;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(int)(n);i++)

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

  rep(i,n)
  {
    if(s.at(k-1)!=s.at(i)) cout<<'*';
    else cout<<s.at(i);
  }
  cout<<endl;
  return 0;
}

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

int main(){
    int k, s;
    cin >> k >> s;
    int x, y, z;
    x=0;
    y=0;
    z=0; 
    int count=0;
    for(x=0; x<=k; x++){
        for(y=0; y<=k; y++){
            if(((x+y)<=s)&&((s-(x+y)<=k))) 
                count++;
                /*z=s-(x+y);
                cout << "OK " << "x=" << x << " y=" << y << " z=" << z << " sum is " << x+y+z << " count is " << count << endl;
                z=0;
                */
            /*
            for(int l=0; l<=k; l++){
                if((i+j+l)==s){
                    cout << "OK " << "x=" << i << " y=" << j << " z=" << l << " sum is " << i+j+l << " count is " << count << endl;
                }else{
                    cout << "NG " << "x=" << i << " y=" << j << " z=" << l << " sum is " << i+j+l << " count is " << count << endl;
                }
            }
            */
        }
    }
    cout << count << endl;
    /*
    cin >> k >> s;
    cout << k << s << endl;
    */
}

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

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int n = sc.nextInt();
        long[] a = new long[n];

        long sum = 0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextLong();
            sum += a[i];
        }

        long min = sum;
        long s = 0;
        for (int i = 0; i < n; i++) {
            s += a[i];
            min = Math.min(min, Math.abs(s - (sum - s)));
        }

        System.out.println(min);
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

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

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

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 55840
// ABC150A.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

//#include "pch.h"
#include <iostream>
using namespace std;
int main()
{
	int K, X;
	cin >> K >> X;
	if (500*K>=X)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
#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 BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) (int)(c.size())
#define all(c) c.begin(),c.end()
#define ms(a,v) memset(a,v,sizeof(a))
#define unq(v) v.erase(unique(v.begin(),v.end()),v.end());
#define mp make_pair
#define write(x) cout<<(x)<<endl
using namespace std; typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; }return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; }return 0; }
const int INF = 1 << 28; const ll LINF = 1ll << 60;
const int MAX = 1e5 + 5; const int MOD = 1e9 + 7; const double EPS = 1e-6;
const int dy[4] = { 0,1,0,-1 }; const int dx[4] = { 1,0,-1,0 };
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

int N, M, H, W;
int n, m, a, b, c, d, ans;
string s;

int L[110];

int main() {
    cin >> N;
    rep(i, N) cin >> L[i];
    sort(L, L + N);
    int cnt = 0;
    rep(i, N - 1) cnt += L[i];
    bool b = L[N - 1] < cnt;
    write(b ? "Yes" : "No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef pair<int,int> Pi;
typedef long long int ll;
const int INF=(ll)(1<<30)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

string s;

int main(){
	cin>>s;
	int ans=0;
	for(int i=0;i<s.size()-1;i++){
		if(s[i]!=s[i+1]){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

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

    vector<int> v1(n, 0), v2(n, 0);
    for (int i = 0; i < n; i++) {
        if (i == 0) {
            v1[i] = (s[i] == 'E' ? 1 : 0);
        } else {
            v1[i] += v1[i - 1] + (s[i] == 'E' ? 1 : 0);
        }
    }
    for (int i = n - 1; i >= 0; i--) {
        if (i == n - 1) {
            v2[i] = (s[i] == 'W' ? 1 : 0);
        } else {
            v2[i] += v2[i + 1] + (s[i] == 'W' ? 1 : 0);
        }
    }

    int res = n;
    for (int i = 0; i < n; i++) {
        res = min(res, (i > 0 ? i - v1[i - 1] : 0) + (i < n - 1 ? n - 1 - i - v2[i + 1] : 0));
    }
    cout << res << endl;
}


Measured memory_bytes: 6040
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MD 1000000007
#define INF 1ll<<60
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int prime[100010]; //i番目の素数
bool is_prime[100010]; //is_prime[i]がtrueならiは素数

//n以下の素数の数を返す
int prime_num(int n){
    int p=0;
    for(int i=0;i<=n;i++) is_prime[i]=true;
    is_prime[0]=false;
    is_prime[1]=false;
    for(int i=2;i<=n;i++){
        if(is_prime[i]){
            prime[p++]=i;
            for(int j=2*i;j<=n;j+=i) is_prime[j]=false;
        }
    }
    return p;
}

int main(){
    int q;
    cin>>q;
    vector<pair<int,int>> pa(q);
    for(int i=0;i<q;i++){
        int l,r;
        cin>>l>>r;
        pa[i]={l,r};
    }

    vector<int> v(100010);
    prime_num(100000);
    for(int i=3;i<=100000;i++){
        if(i%2==1 && is_prime[i] && is_prime[(i+1)/2])v[i]=v[i-1]+1;
        else v[i]=v[i-1];
    }

    for(int i=0;i<q;i++) cout<<v[pa[i].second]-v[pa[i].first-1]<<endl;
    return 0;
}

Measured memory_bytes: 1920
#include <stdio.h>
#include <math.h>
    
typedef struct point{
  double x;
  double y;
} point;
    
double distance(point p1,point p2){
  double temp;
  temp=(p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y);
  return sqrt(temp);
}
    
int main(void){
  point p1,p2;
  double d;
    
  scanf("%lf%lf%lf%lf",&p1.x,&p1.y,&p2.x,&p2.y);
  d=distance(p1,p2);
  printf("%f\n",d);
    
  return 0;
}

Measured memory_bytes: 652
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    int n,i,j,m=0;
    map<string,int> mp;
    map<string,int>::iterator it;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        cin>>s;
        mp[s]++;
        if(mp[s]>m)
        {
            m=mp[s];
        }
    }
    for(it=mp.begin();it!=mp.end();it++)
    {
        if(m==it->second)
        {
            cout<<it->first<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 25216
n=eval(input())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
def minkowski(p,x_1,x_2,n):
    if p==0:
        return float(max([abs(x_1[i]-x_2[i]) for i in range(n)]))
    else:
        return sum([(abs(x_1[i]-x_2[i]))**p for i in range(n)])**(1/p)
for i in range(4):
    print(minkowski((i+1)%4,x,y,n))

Measured memory_bytes: 7816
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#define fore(i,x,y) for(long long i=x;i<y;i++)
typedef long long ll;
using namespace std;
int main()
{
	int w,a,b,c,d;
	cin>>w>>a>>b;
	c=min(a,b);
	d=max(a,b);
	if(c+w<d){
		cout << d-c-w << endl;
	}
	else{
		cout << "0" << endl;
	}

}

Measured memory_bytes: 3564
#include<iostream>
#include<string>
using namespace std;
typedef long long ll;
string s;
ll n, a[30];
ll mod = 1e9 + 7;
int main() {
	cin >> n;
	cin >> s;
	for (ll i = 0; i < 26; ++i)a[i] = 1;
	for (ll i = 0; i < n; ++i) {
		++a[s[i] - 'a'];
	}
	ll ans = 1;
	for (int i = 0; i < 26; ++i) {
		ans = (ans * a[i]) % mod;
	}
	cout << ans - 1 << endl;
	return 0;
}

Measured memory_bytes: 3768
n = int(input())
al = list(map(int, input().split()))

ans = 0
i_plus_h_dic = {}

for i, a in enumerate(al):
    input_val = a+i
    i_plus_h_dic.setdefault(input_val,0)
    i_plus_h_dic[input_val] += 1

    comp_val = i - a
    if comp_val in i_plus_h_dic:
        ans += i_plus_h_dic[comp_val]


print(ans)

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

int main(){
	int n, k, q;
	cin >> n >> k >> q;
	vector<int> score(n);

	rep(i, q){
		int d;
		cin >> d;
		score.at(d-1)++;
	}

	vector<bool> ans(n);
	rep(i, n){
		int genten = q - score.at(i);
		if(k - genten > 0) ans.at(i) = true;
	}

	rep(i, n){
		if(ans.at(i)) cout << "Yes" << endl;
		else cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 1024