akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<algorithm>
int h,w;
std::vector<std::vector<bool>> map;
 
 
struct pairs
{
    int first;
    int second;
    int depth;
};
 
 
std::vector<std::pair<int,int>> dir = {{1,0},{0,1},{-1,0},{0,-1}};
inline int bfs(int start_h,int start_w){
    int aaa = 0;
    std::vector<std::vector<bool>> seen(h + 2,std::vector<bool>(w + 2));
    std::queue<pairs> que;
    seen[start_h][start_w] = true;
    que.push({start_h,start_w,0});
    while(que.size()){
        auto cur = que.front();
        que.pop();
        aaa = std::max(cur.depth,aaa);
        for(int i = 0; i < 4; i++){
            if(!seen[cur.first + dir[i].first][cur.second + dir[i].second] && map[cur.first + dir[i].first][cur.second + dir[i].second]){
                que.push({cur.first + dir[i].first, cur.second + dir[i].second,cur.depth + 1});
                seen[cur.first + dir[i].first][cur.second + dir[i].second] = true;
            }
        }
    }
    return aaa;
}
int main()
{
    std::cin >> h >> w;
    map.resize(h + 2,std::vector<bool>(w + 2));
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            char a;
            std::cin >> a;
            map[i][j] = a == '.';
        }
    }
    int max = 0;
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            if(map[i][j])max = std::max(bfs(i,j),max);
        }
    }
    std::cout << max << std::endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<stack>
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;
int n;
vector<int> G[MAX];
int color[MAX];


void dfs(int r, int c) {
	stack<int> S;
	S.push(r);
	color[r] = c;
	while (!S.empty()) {
		int u = S.top(); S.pop();
		for (int i = 0; i < G[u].size(); i++) {
			int v = G[u][i];
			if (color[v] == NIL) {
				color[v] = c;
				S.push(v);
			}
		}
	}
}

void assignColor() {
	int id = 1;
	for (int i = 0; i < n; i++)color[i] = NIL;
	for (int u = 0; u < n; u++) {
		if (color[u] == NIL)dfs(u, id++);
	}
}

int main()
{
	int s, t, m, q;
    
	cin >> n >> m;

	for (int i = 0; i < m; i++) {
		cin >> s >> t;
		G[s].push_back(t);
		G[t].push_back(s);
	}

	assignColor();

	cin >> q;
	for (int i = 0; i < q; i++) {
		cin >> s >> t;
		if (color[s] == color[t]) {
			cout << "yes" << endl;
		}else {
			cout << "no" << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 9020
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[][] A = new int[n][m];
        int[] B = new int[m];
        for(int i = 0; i < n; i++){
            for(int j = 0; j < m; j++){
                A[i][j] = sc.nextInt();
            }
        }
        for(int i = 0; i < m; i++){
            B[i] = sc.nextInt();
        }
        for(int i = 0; i < n; i++){
            int sum = 0;
            for(int j = 0; j < m; j++){
                sum += A[i][j] * B[j];
            }
            System.out.println(sum);
        }
    }
}



Measured memory_bytes: 40508
N = int(input())
List = list(map(int,input().split()))
List = sorted(List)[::-1]
L = 0
S = 0
temp = 0
for i in range(N-1):
  if List[i] == List[i+1]:
    L = List[i]
    temp =i+1
    break
for i in range(temp+1,N-1):
  if List[i] == List[i+1]:
    S = List[i]
    break
print(L*S)

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

using namespace std;

int main(){
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    if (s[k-1] == 'A') {
        s[k-1] = 'a';
    }else if (s[k-1] == 'B') {
        s[k-1] = 'b';
    }else{
        s[k-1] = 'c';
    }
    
    cout << s << endl;
    
}

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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> answers(n);
    for(int i = 0; i < n; ++i)
    {
        int t;
        cin >> t;
        a[i] = t;
        if(i%2==0)
        {
            answers[0] += t;
        }
        else
        {
            answers[0] -= t;
        }
    }

    for(int i = 1; i < n; ++i)
    {
        int t = answers[i-1] / 2;
        answers[i] = 2 * (a[i-1] - t);
    }

    for(int i = 0; i < n; ++i)
    {
        if(i != 0)
        {
            cout << " ";
        }
        cout << answers[i];
    }
    cout << endl;
}

Measured memory_bytes: 2048
n,k = map(int, input().split())
w = [int(input()) for _ in range(n)]

def check(p):
    c = t = 0
    for wi in w:
        t += wi
        if t > p:
            t = wi
            c += 1
            if c >= k:
                return False
    return True

s = max(w)
l = sum(w)
while s < l:
    m = (s+l)//2
    if check(m):
        l = m
    else:
        s = m+1
print(s)

Measured memory_bytes: 11596
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <string>
#include <typeinfo>
#include <random>
#include <vector>

using namespace std;
typedef long long ll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;
 
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define all(a) (a).begin(), (a).end()
#define cae cout<<ans<<endl
 
int main()
{
	int a,b,k;
	cin>>a>>b>>k;
	for(int i=a;i<=b;i++){
		if(i<a+k || b-k<i){
			cout<<i<<endl;
		}
	}
	
	return 0;
}

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

int main() {
  int N;
  bool f = false;
  
  cin >> N;

  for (int i=0; i < N; i++) {
    string S;
    cin >> S;
    if (S == "Y") f = true;
  }
  
  if (f) {
    cout << "Four" << endl;
  } else {
    cout << "Three" << endl;
  }
}


Measured memory_bytes: 3548
#include <stdio.h>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include<math.h>
#include<bitset>
#include<iomanip>
#include<queue>
using namespace std;

int main() {
	int N; cin >> N;
	vector<pair<long long,long long>> A(N);
	for (int i = 0; i < N; i++) {
		long long a, b;
		cin >> a>>b;
		A[i].first = b; A[i].second = a;
	}
	sort(A.begin(), A.end());
	long long t = 0;
	bool x = 1;
	for (int i = 0; i < N; i++) {
		t += A[i].second;
		if (t > A[i].first) { x = 0; break; }
	}
	if (x)cout << "Yes" << endl;
	else cout << "No" << endl;
}




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

using namespace std;

int n;
typedef pair<int, int> P;
const int N = 110;
vector<P> G[N];
int dis[N];
bool vis[N];

void dijkstra() {
    memset(vis, false, sizeof(vis));
    for (int i = 0; i < n; i++) dis[i] = INT_MAX;
    priority_queue<P, vector<P>, greater<P>> heap;
    heap.push({0, 0});
    dis[0] = 0;

    while (!heap.empty()) {
        int u = heap.top().second, cost = heap.top().first;
        heap.pop();
        if (vis[u]) continue;
        vis[u] = true;
        for (int i = 0; i < G[u].size(); i++) {
            int v = G[u][i].second, len = G[u][i].first;
            if (!vis[v] && dis[u] + len < dis[v]) {
                dis[v] = dis[u] + len;
                heap.push({dis[v], v});
            }
        }
    }
}

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        int u, k;
        cin >> u >> k;
        int v, c;
        for (int j = 0; j < k; j++) {
            cin >> v >> c;
            G[u].push_back({c, v});
        }
    }

    dijkstra();

    for (int u = 0; u < n; u++) {
        cout << u << " " << dis[u] << endl;
    }

    return 0;
}


Measured memory_bytes: 3144
#include<stdio.h>
int main ()
{
    int a,b,c,i,d;
    d=0;
    scanf("%d %d %d",&a,&b,&c);
    for(a;a<=b;a++)
    {
        i=c%a;
        if(i==0){
        d++;
    }

    }
    printf("%d\n",d);
    return 0;
}





Measured memory_bytes: 2140
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);i++)
#define per(i,b,a) for(int i=b;i>=a;i--)
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Forenska(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-x))
#define GREATER(x) x,vector<x>,greater<x>
#define randIn(L,R) (((LL)rand()*rand())%(R-L)+L)
#define __lcm(a,b) ((a)/__gcd(a,b)*(b))
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pLL;
typedef vector<int> vec;
typedef vector<LL> vecL;
typedef vector<pii> vecP;
typedef vector<pLL> vecPL;
typedef vector<string> vecS;
typedef vector<vec> mat;
typedef complex<double> point;
const long double PI=3.14159265358979323846264338327950288419716939937510582097;
const LL INFLL=0x3f3f3f3f3f3f3f3f;
const int INF=0x3f3f3f3f;
const long double EPS=1e-10;
int read()
{
    int x=0;
    char ch=' ';
    bool flag=false;
    while(ch<'0' || ch>'9')
    {
        if(ch=='-')flag=true;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
    {
        x=(x<<3)+(x<<1)+ch-'0';
        ch=getchar();
    }
    return flag?-x:x;
}
#define int LL
const string str="MARCH";
int rec[5];
signed main()
{
	int n;
	cin>>n;
	rep(i,0,n)
	{
		string s;
		cin>>s;
		if(str.find(s[0])!=string::npos)rec[str.find(s[0])]++;
	}
	int ans=0;
	rep(i,0,(1<<5))
	{
		if(__builtin_popcount(i)==3)
		{
			int cnt=1;
			rep(j,0,5)if(i&(1<<j))cnt*=rec[j];
			ans+=cnt;
		}
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep2(i,a,n) for(int i = (a);i < (n);i++)
#define rep(i,n) rep2(i,0,n)
#define INF (1LL << 60)
#define vec vector

int main(void){
    int a,b,c,k;
    cin >> a >> b >> c >>k;
    rep(i,k){
        if(b <= a)b *= 2;
        else if(c <= b)c *= 2;
    }
    if(b > a && c > b)cout << "Yes";
    else cout << "No";
    cout << endl;
}

Measured memory_bytes: 3628
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(unused_variables)]

use std::io::stdin;
use std::str::FromStr;
use std::cmp::min;

fn read<T: FromStr>() -> T {
    let mut str = String::new();
    stdin().read_line(&mut str).ok();
    str.trim().parse().ok().unwrap()
}

fn read_vec<T: FromStr>() -> Vec<T> {
    let mut str = String::new();
    stdin().read_line(&mut str).ok();
    str.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_n_vec<T: FromStr>(n: u32) -> Vec<Vec<T>> {
    let mut v_outer = Vec::new();
    for _ in 0..n {
        let v_inner = read_vec();
        v_outer.push(v_inner);
    }
    v_outer
}

fn main() {
    let mut line: Vec<u64> = read_vec();
    let k = line[0];
    let n = line[1];

    line = read_vec();
    line.sort();

    let mut part: Vec<u64> = Vec::new();
    for i in 0..line.len() - 1 {
        part.push(line[i + 1] - line[i]);
    }

    part.push((k - line[line.len() - 1]) + line[0]);

    part.sort();

    let mut ans = 0;
    for i in 0..part.len() - 1 {
        ans += part[i];
    }
    println!("{}", ans);
}

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

#define GO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int

const int maxr = 1e5 + 5;

int arr[maxr];
int32_t main()
{
	GO;
	int n, k;
	cin >> n >> k;
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	sort(arr, arr + n);
	int ans = 0;
	for (int i = 0; i < k; i++)
		ans += arr[i];
	cout << ans << endl;
	return 0;
}

//!

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

using ll = long long;
using G = vector<vector<int>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const ll MOD = 1000000007;

ll GCD(ll x, ll y){
	return y ? GCD(y, x%y) : x;	
}

int main() {
	ll n; cin >> n;
	ll a, b; cin >> a >> b;
	ll x = n/(a+b);
	ll y = n%(a+b);
	cout << x*a+min(y, a) << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.*;

class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		// ????????????
		String[] lbl=br.readLine().split(" ");
		Dice d1=new Dice(lbl);
		// ??????
		String ope=br.readLine();
		for (int i=0;i<ope.length();i++){
			switch(ope.charAt(i)){
			case 'N': d1.throwN(); break;
			case 'S': d1.throwS(); break;
			case 'E': d1.throwE(); break;
			case 'W': d1.throwW(); break;
			}
        }
		// ??????
		System.out.println(d1.getTop());
	}
	
	static class Dice {

		private String top;		//?????¢
		private String front;	//?????¢
		private String right;	//?????¢
		private String left;	//?????¢
		private String back;	//?????¢
		private String bottom;	//?????¢

		/**
		 * ?????????????????????
		 */
		public Dice(String[] lbl){
			this.top=lbl[0];
			this.front=lbl[1];
			this.right=lbl[2];
			this.left=lbl[3];
			this.back=lbl[4];
			this.bottom=lbl[5];
		}
		
		/**
		 * N???????????????
		 */
		public void throwN(){
            String tmp=top;
            top=front;
            front=bottom;
            bottom=back;
            back=tmp;
			// right,left??????????????????
		}
		
		/**
		 * S???????????????
		 */
		public void throwS(){
			String tmp=top;
			top=back;
			back=bottom;
			bottom=front;
			front=tmp;
			// right,left??????????????????
		}
		
		/**
		 * E???????????????
		 */
		public void throwE(){
            String tmp=top;
            top=left;
            left=bottom;
            bottom=right;
            right=tmp;
			// front,back??????????????????
		}
		
		/**
		 * W???????????????
		 */
		public void throwW(){
            String tmp=top;
            top=right;
            right=bottom;
            bottom=left;
            left=tmp;
			// front,back??????????????????
		}

		/**
		 * ?????¨????????¢?????????????????????
		 */
		public String getTop() {
	        return top;
	    }
	}
}

Measured memory_bytes: 17092
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int n,x,minn;
int main(){
	scanf("%d",&n);
	minn=1e6+5;
	int ans=0;
	for(int i=1;i<=n;i++){
		scanf("%d",&x);
		if(minn>x)ans++;
		minn=min(minn,x);
	}
	cout<<ans;
	return 0;
}


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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "{";
    rep(i, (int)v.size()) {
        if (i)
            os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
    for (auto val : array)
        std::cout << val << ", ";
    std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::setprecision(10);

    ll n; std::cin >> n;
    int a = 1;
    for (ll x = 1; x*x <= n; x++) {
        if (n%x) continue;
        a = x;
    }
    auto f = [](ll a, ll b) {
        int ad = 0, bd = 0;
        while (a) a /= 10, ad++;
        while (b) b /= 10, bd++;
        return max(ad, bd);
    };
    std::cout << f(a, n/a) << "\n";
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


ll INF = 1e9;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
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;}     //最小公倍数

void yes(){ cout << "yes" << endl;}
void no(){ cout << "no" << endl;}

//-----------------------------------------
//-----------------------------------------

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  ld r;
  cin >> r;
  cout << r * r * PI << " " << 2 * r * PI <<endl;



  return 0;
}






Measured memory_bytes: 3320
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
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() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int m, d;
  cin >> m >> d;

  int ans = 0;
  rep(i, 1, m + 1) {
    rep(j, 1, d + 1) {
      int d1 = j % 10;
      int d2 = (j / 10) % 10;
      if (d1 >= 2 && d2 >= 2 && d1 * d2 == i)
        ans++;
    }
  }

  cout << ans << endl;
}


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

int main(){
    string s; cin >> s;
    
    vector<string>Days={"SUN","MON","TUE","WED","THU",
    "FRI","SAT"};
    vector<int>cnt={0,1,2,3,4,5,6};
    
    for(int i=0;i<7;i++){
        if(s==Days.at(i)){
            cout << 7-cnt.at(i) << endl;
        }
    }
}

Measured memory_bytes: 256
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
  
A= input()
A= int(A)
X = 100000000000000000000000
for i in make_divisors(A):
  Y = A / i
  if Y + i < X:
    X = Y + i
print(int(X-2))

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

typedef long long ll;
typedef long double ld;

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

ll gcd(ll a, ll b){return b ? gcd(b, a % b) : a;}

int main(){

    ll N;

    cin >> N;

    cout << 2 * N / gcd(2, N) << endl;

    return 0;
}

Measured memory_bytes: 256
// Ninjo ~ khaledalam.net@gmail.com
#include <bits/stdc++.h>
using namespace std;
#define sz(A)      (int)(A).size()
#define all(B)     (B).begin(),(B).end()
#define file       freopen("input.txt", "r", stdin)
#define ios        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

set<char> s;

int main() {
//	file;
	s.insert('a');
	s.insert('e');
	s.insert('i');
	s.insert('o');
	s.insert('u');
	char c;
	cin >> c;
	cout << (s.count(c) ? "vowel" : "consonant") << endl;

}


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

int main(){
  string x;
  cin >> x;
  if(x == "A"){
    cout << "T" << endl;
  }
  else if(x == "T"){
    cout << "A" << endl;
  }
  else if(x == "G"){
    cout << "C" << endl;
  }
  else if(x == "C"){
    cout << "G" << endl;
  }
  
}
  
  


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const ll INF=1e18;
const int MOD=1e9+7;
const double pi=acos(-1);

int main(){
  string s;
  cin >> s;
  int n=s.size();
  vector<int>vec(n);
  int l=0,m,r;
  rep(i,n-1){
    if(s[i]=='R' && s[i+1]=='L')m=i;
    if(s[i]=='L' && s[i+1]=='R')r=i;
    else continue;
    if((m-l)%2==1){
      vec[m]=(r+1-l)/2;
      vec[m+1]=(r+1-l+1)/2;
    }	
    else{
      vec[m+1]=(r+1-l)/2;
      vec[m]=(r+1-l+1)/2;
    }
    l=r+1;
  }
  r=n-1;
  if((m-l)%2==1){
    vec[m]=(r+1-l)/2;
    vec[m+1]=(r+1-l+1)/2;
  }
  else{
    vec[m+1]=(r+1-l)/2;
    vec[m]=(r+1-l+1)/2;
  }
  rep(i,n){
    if(i!=0)cout<< " ";
    cout << vec[i];
  }
  return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(long long i=0;i<n;++i)
#define REPR(i,n) for(long long i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(v) {for(long long sitr=0;sitr<v.size();++sitr){cin>>v[sitr];}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  llong n, w, h;
  cin >> n >> w >> h;
  

  int wifi_x[100010] = {};
  int wifi_y[100010] = {};

  REP(i,n){
    int a, b, c;
    cin >> a >> b >> c;
    wifi_x[max(0, a - c)]++;
    wifi_x[min(100001, a + c)]--;
    wifi_y[max(0, b - c)]++;
    wifi_y[min(100001, b + c)]--;
  }

  REP(i,100001){

    wifi_x[i+1] += wifi_x[i];
    wifi_y[i+1] += wifi_y[i];
  }


  llong x = 0, y = 0;
  REP(i,w){
    if(wifi_x[i] > 0){
      x++;
    }
  }
  REP(i,h){
    if(wifi_y[i] > 0){
      y++;
    }
  }

  if(x == w || y == h){
    cout << "Yes\n";
  }else{
    cout << "No\n";
  }
  return 0;
}




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

using namespace std;

int main(){
  int n, m, a[109], total=0, cnt=0;
  cin >> n >> m;
  for(int i=0;i<n;i++){
    cin >> a[i];
    total+=a[i];
  };
  for(int i=0;i<n;i++){
    if(a[i]>=(total-1)/(4*m)+1){
      cnt++;
    }
  }
  cout << (cnt>=m?"Yes": "No") << endl;
}



Measured memory_bytes: 3640
/*
Hello don't you know me
I'm the dirt beneath your feet
The most important fool you forgot to see
I've seen how you give it
Now I want to receive
I know that you
Would do the same for me

I know I'm headed for the bottom
But I'm riding you all the way

For all of your kisses turned
To spit in my face
For all that reminds me
Which is my place
For all the times when
You made me disappear
This time I'm sure you will
Know that I'm here

I know I'm headed for the bottom
But I'm riding you all the way

My place was beneath you
But now I'm above
And now I send you a message
Of love
A simple reminder of what
You won't see
A future so holy without me

I know I'm headed for the bottom
But I'm riding you all the way
*/

#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd

#define eps 1e-11
#define M_PI 3.141592653589793
#define bsize 512

#define ldouble long double
using namespace std;

#define bs 1000000007

const int N = 100031;

int n,m,k,ans;

int main(){
	//freopen("tree.in","r",stdin);
	//freopen("tree.out","w",stdout);
	//freopen("input.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
	//cin.tie(0);

	cin>>n>>m>>k;
	for (int i=0;i<=n;i++)
	{
		for (int j=0;j<=m;j++)
		{
			if (i*m+j*n-2*i*j==k)
				ans=1;
		}
	}
	if (ans)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;

	cin.get(); cin.get();
	return 0;
}


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

int main(){
    int a=0,b=0,n;
    cin >> n;
    string str1,str2;

    for(int i=0; i<n; i++){
        cin >> str1 >> str2;
        if(str1 == str2){
            a++;
            b++;
        }else if(str1 > str2){
            a+=3;
        }else{
            b+=3;
        }
    }
    cout << a << " " << b << endl;
}


Measured memory_bytes: 3148
#include<iostream>
#include<vector>
using namespace std;
int main(int argc, char const *argv[])
{
   int n;
   cin >> n;
   vector<int> a(n);
   for (int i = 0; i < n; i++)
   {
      cin >> a[i];
   }
   
   double rev = 0.0;
   for (int i = 0; i < n; i++)
   {
      rev += 1.0/a[i];
   }
   double ans = 1/rev;
   printf("%0.5f", ans);
   return 0;
}


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

using namespace std;

int main(void)
{
    int n;
    scanf("%d", &n);
    long long mult = 1, a, M = 1000000000000000000;
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        if (a == 0)
        {
            printf("0");
            return 0;
        }
        if (mult != -1 && a <= M / mult)
        {
            mult *= a;
        }
        else
        {
            mult = -1;
        }
        
    }
    printf("%lld", mult);
    
}

Measured memory_bytes: 3796
H, W, K = map(int, input().split())
S = []
for _ in range(H):
  S.append(input())
hsummation = [[int(S[0][k])]for k in range(W)]
for k in range(W):
  for j in range(1, H):
    hsummation[k].append(hsummation[k][j-1] + int(S[j][k]))
#print(hsummation)
ans = float('inf')
anskouho = 0
h = 2**(H-1)
for j in range(2**(H-1)):
  h -= 1
  binh = "0"*(H-len(str(bin(h)))+1)+str(bin(h))[2:]
  hlist=[]
  for k in range(H-1):
    if binh[-k-1] == '1':
      hlist.append(k)
  hlist.append(-1)
  #print(hlist)
  anskouho = len(hlist)-1
  now = 0
  while now < W:
    counter = [0 for _ in range(len(hlist))]
    while now < W:
      for l in range(len(hlist)):
        if l == 0:
          counter[l] += hsummation[now][int(hlist[l])]
          continue
        else:
          counter[l] += - hsummation[now][hlist[l-1]] + hsummation[now][hlist[l]]
      if max(counter) > K:
        anskouho += 1
        break
      else:
        now += 1
    if anskouho > ans:
      break
  else:
    ans = min(ans, anskouho)
 
      #print(counter)
#print(anskouho)
print(ans)

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

int main(){
  int x;
  cin >> x;
  if(x <= 599){
    cout << "8" << endl;
  }else if(x <= 799){
    cout << "7" << endl;
  }else if(x <= 999){
    cout << "6" << endl;
  }else if(x <= 1199){
    cout << "5" << endl;
  }else if(x <= 1399){
    cout << "4" << endl;
  }else if(x <= 1599){
    cout << "3" << endl;
  }else if(x <= 1799){
    cout << "2" << endl;
  }else if(x <= 1999){
    cout << "1" << endl;
  }
}

Measured memory_bytes: 3628
#include<stdio.h>
#include<math.h>
int main()
{
    unsigned long long n,sum=0,i;
    scanf("%llu",&n);
    unsigned long long l[n],r[n];
    for(i=0;i<n;i++){
        scanf("%llu%llu",&l[i],&r[i]);
        sum=sum+(r[i]-l[i])+1;
    }
    printf("%llu\n",sum);

                return 0;
}





Measured memory_bytes: 1716
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int main()
{
	string s, t;
	cin >> s >> t;
	vector<vector<int> > ind(26);
	for(int i = 0; i < s.length(); i++){
		ind[s[i] - 'a'].push_back(i);
	}
	for(int i = 0; i < 26; i++){
		int nows = ind[i].size();
		for(int j = 0; j < nows; j++){
			ind[i].push_back(ind[i][j] + s.length());
		}
	}
	long long int anslen = 0;
	for(int i = 0; i < t.length(); i++){
		int now = t[i] - 'a';
		if(ind[now].size() == 0){
			cout << -1 << endl;
			return 0;
		}
		int lastind = (anslen % s.length()) - 1;
		int x = upper_bound(ind[now].begin(), ind[now].end(), lastind) - ind[now].begin();
		anslen += ind[now][x] - lastind;
	}
	cout << anslen << endl;
}

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


void solve(long long N, long long K, std::vector<long long> l){
    sort(l.begin(), l.end(), greater<long long>());
    long long ans = 0;
    for(long long i = 0; i < K; ++i){
        ans = ans + l[i];
    }
    cout << ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> l(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&l[i]);
    }
    solve(N, K, std::move(l));
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  
  int same = 0;
  
  for (int i = 0; i < N - 1; i++)
  {
    if (S.at(i) == S.at(i + 1))
    {
      same++;
    }
  }
  
  cout << N - same << endl;
  return 0;
}


Measured memory_bytes: 512
import java.io.*
import java.util.*

fun solve(n: Int, v: IntArray){
    if (v.distinct().size == 1){
        println(n / 2)
        return
    }
    val v1 = v.slice(0 until n step 2).groupBy{it}.toList().sortedByDescending{ it.second.size }
    val v2 = v.slice(1 until n step 2).groupBy{it}.toList().sortedByDescending{ it.second.size }
    if (v1[0].first == v2[0].first){
            val candidates = listOf(
                n - v1[0].second.size - v2[1].second.size,
                n - v1[1].second.size - v2[0].second.size
            )
            println(candidates.min())
    }else{
        println(n - v1[0].second.size - v2[0].second.size  )

    }
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val n = sc.next().toInt()
    val v = IntArray(n)
    for (i in 0 until n) {
        v[i] = sc.next().toInt()
    }
    solve(n, v)
}



Measured memory_bytes: 77508
#include<bits/stdc++.h>
using namespace std;
stack<int>st;
queue<int>q;
vector<int>v,v1,v2,v3;
set<int>stt;
set<int>::iterator set_it;
map<string,int>mp;
//initialy map er all index er value zero thake;
//map er jonno this pointer(->) use korte hoy
//akta value dakhar jonno staristics pointer(*) use  korte hoy
// one more value print korar jonno this pointer(->) use korte hoy (must be)
map<string,int>::iterator map_it;
int a[20007];
int i,j,k,l,m,n,flag=0,cnt=0,sum=0,mx=0,mn=0;
string s,s1,s2;
int main()
{
    cin>>n;

    for(i=0;i<n;i++)
    {
        cin>>s;
        mp[s]++;
        mx=max(mx,mp[s]);

    }
    for(map_it=mp.begin();map_it!=mp.end();map_it++)
    {
        if(map_it->second==mx)
        {
            cout<<map_it->first<<endl;
        }

   }
   return 0;

}


Measured memory_bytes: 25216
# cook your dish here
import sys
def file():
	sys.stdin = open('input.py', 'r')
	sys.stdout = open('output.py', 'w') 
#file()	
def main(N, arr):

	#initialising with positive infinity value
	maxi=float("inf")

	#initialising the answer variable
	ans=0

	#iterating linesrly
	for i in range(N):

		#finding minimum at each step
	    maxi=min(maxi,arr[i])
	    #increasing the final ans
	    ans+=maxi
	    print("dhh")

    #returning the answer
	return ans
        

if __name__ == '__main__':

	#length of the array
	'''N = 4

	#Maximum size of each individual bucket
	Arr = [4,3,2,1]

	#passing the values to the main function
	answer = main(N,Arr)

	#printing the result
	print(answer)'''

	a,b=map(int, input().split())
	d=a-(2*b)
	if(d<0):
		print(0)
	else:
		print(d)

Measured memory_bytes: 9072
/*
Author: CNYALI_LK
LANG: C++
PROG: b.cpp
*/
#include<bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define all(x) x.begin(),x.end()
using namespace std;
const double eps=1e-8;
const double PI=acos(-1.0);
typedef long long ll;
template<class T>int chkmin(T &a,T b){return a>b?a=b,1:0;}
template<class T>int chkmax(T &a,T b){return a<b?a=b,1:0;}
template<class T>T sqr(T a){return a*a;}
template<class T>T mmin(T a,T b){return a<b?a:b;}
template<class T>T mmax(T a,T b){return a>b?a:b;}
template<class T>T aabs(T a){return a<0?-a:a;}
#define min mmin
#define max mmax
#define abs aabs
int n,dis[100100],q[2333333],inq[100100];
void spfa(int x){
	for(int i=0;i<n;++i)dis[i]=0x3f3f3f3f;
	dis[x]=0;
	int l,r;
	q[l=r=1]=x;
	while(l<=r){
		if(dis[q[l]*10%n]>dis[q[l]]){
			dis[q[l]*10%n]=dis[q[l]];
			if(!inq[q[l]*10%n]){
				inq[q[l]*10%n]=1;
				q[++r]=q[l]*10%n;
			}
		}
		if(dis[(q[l]+1)%n]>dis[q[l]]+1){
			dis[(q[l]+1)%n]=dis[q[l]]+1;
			if(!inq[(q[l]+1)%n]){
				inq[(q[l]+1)%n]=1;
				q[++r]=(q[l]+1)%n;
			}
		}
		inq[q[l]]=0;
		++l;	
	}

}
int main(){
#ifdef cnyali_lk
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
	scanf("%d",&n);
	spfa(1);
	printf("%d\n",dis[0]+1);
	return 0;	
}



Measured memory_bytes: 4736
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vl vaector<long>
#define vll vector<long long int>
#define vC  vector<char>
#define FastIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
ll pow(ll x, ll y,ll m) { ll res = 1;x=x%m; while (y > 0) { if (y & 1) res = ((res%m) * (x%m))%m; y = y >> 1; x = ((x%m) * (x%m))%m; } return res%m; }
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
const ll INF = 0xFFFFFFFFFFFFFFFL;
clock_t time_p=clock();
void abhigyan10()
{time_p=clock()-time_p;cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";}
ll seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline ll rnd(ll l=0,ll r=INF){return uniform_int_distribution<ll>(l,r)(rng);}
#define clrbuf cin.ignore(numeric_limits<streamsize>::max(),'\n');
#define preciset(x) cout<<setprecision(x)<<fixed;
const ll mod =1000000007;
int main()
{

        FastIO
        ll k,x;
        cin>>k>>x;

        if(k*500 >=x)
        	cout<<"Yes\n";
        else
        	cout<<"No\n";
        return 0;
    }

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    string now;
    string log[100];
    char next;
    int n;
    cin>>n;
    bool cont=true;
    for(int i=0;i<n;i++){
        cin>>now;
        if(i>0&&next!=now[0]){
            cont=false;
            break;
        }
        for(int j=0;j<i;j++){
            if(now==log[j]){
                cont=false;
                break;
            }
        }
        next=now[now.size()-1];
        log[i]=now;
        if(!cont)break;
    }
    if(cont)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

using namespace std;

int main() {
    long long int n,a,b;
    cin >> n >> a >> b;
   
    if(a!=0||b!=0) 
    cout << (n/(a+b))*a + min(a,n%(a+b));
    else
    cout <<0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
#define X first
#define Y second
#define mod 1e9+7
#define pb push_back
#define mp make_pair
#define abs(x) ((x)>0?(x):(-(x)))
#define F(n) Fi(i,n)
#define Fi(i,n) Fl(i,0,n)
#define Fl(i,l,n) for(int i=l;i<n;i++)
#define memres(a) memset(a,0,sizeof(a))
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	ll a,b;
	cin>>a>>b;
	ll c=a*b/gcd(a,b);
	cout<<c<<endl;
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

const int maxn = 100002;

int n, m, K, p[maxn], direct[maxn], block[maxn];

int getP(int x) {
    if (p[x] < 0)
        return x;
    else {
        p[x] = getP(p[x]);
        return p[x];
    }
}

void unify(int x, int y) {
    int a = getP(x), b = getP(y);
    if (a != b) {
        p[a] += p[b];
        p[b] = a;
    }
}

int main() {

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

	memset(p, -1, sizeof(p));

    cin >> n >> m >> K;

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

    for (int i = 0; i < K; ++i) {
        int a, b;
        cin >> a >> b;
        int x = getP(a), y = getP(b);
        if (x == y) {
            ++block[a];
            ++block[b];
        }
    }

    for (int i = 1; i <= n; ++i) {
        int sz = -p[getP(i)];
        cout << sz - 1 - block[i] - direct[i];
        if (i < n)
            cout << " ";
        else
            cout << endl;
    }

	return 0;
}

Measured memory_bytes: 2688
import java.util.Scanner;
class Main {
	public static void main(String[] args){
		final int Number=100;
		try(Scanner sc = new Scanner(System.in)){
			int N = Integer.parseInt(sc.next());
			int[] p=new int[N];
			for(int i=0;i<N;i++) p[i] = Integer.parseInt(sc.next());
			int cnt=0;
			for(int i=0;i<N;i++){
				for(int j=N-1;j>i;j--){
					if(p[j]<p[j-1]){
						cnt++;
						int tmp=p[j-1];
						p[j-1]=p[j];
						p[j]=tmp;
					}
				}
			}
			
			
			System.out.print(p[0]);
			for(int i=1;i<N;i++)System.out.print(" "+p[i]);
			System.out.println();
			System.out.println(cnt);
		}
	}
}

Measured memory_bytes: 26172
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import string
import sys

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

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

W, H, X, Y = list(map(int, sys.stdin.readline().split()))

center = X * 2 == W and Y * 2 == H
print(W * H / 2, int(center))


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

//ライブラリ始まり

//定数

//円周率
const double PI = 3.1415926535897932384;

//天井
const int INF = 1000000000; // = 10^9
const ll LINF = 1000000000000000; // = 10^15

//ABC文字列
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZABC";
const string abc = "abcdefghijklmnopqrstuvwxyzabc";

//よくあるmodくん
const ll MOD = 1000000007; // = 10^9 + 7

//データ構造

//Union_Find木
struct UnionFind {
  vector<int> UF; // UF.at(i) : iの親の番号
  vector<int> SIZE; // SIZE.at(root(i)) : iと連結されてる要素の数
  UnionFind(int N) : UF(N), SIZE(N, 1) { // 最初は全てが根であるとして初期化
    for(int i = 0; i < N; i++) {
      UF.at(i) = i;
    }
  }
  int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    if (UF.at(x) == x) {
      return x;
    }
    return UF.at(x) = root(UF.at(x));
  }
  void unite(int x, int y) { // xとyの木を併合
    int rx = root(x); // xの根をrx
    int ry = root(y); // yの根をry
    if (rx == ry) {
      return; // xとyの根が同じ(=同じ木にある)時はそのまま
    }
    // xとyの根が同じでない(=同じ木にない)時：小さい方の根を大きい方の根につける
    if (SIZE.at(rx) < SIZE.at(ry)) {
      UF.at(rx) = ry;
      SIZE.at(ry) += SIZE.at(rx);
      SIZE.at(rx) = 0;
    }
    else {
      UF.at(ry) = rx;
      SIZE.at(rx) += SIZE.at(ry);
      SIZE.at(ry) = 0;
    }
  }
  bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
  int size(int x) { // xと連結されてる要素の数を返す
    return SIZE.at(root(x));
  }
};

//関数

//ctoi
int ctoi(char c){
  if (c == '0') {
    return 0;
  }
  if (c == '1') {
    return 1;
  } 
  if (c == '2') {
    return 2;
  } 
  if (c == '3') {
    return 3;
  }
  if (c == '4') {
    return 4;
  } 
  if (c == '5') {
    return 5;
  } 
  if (c == '6') {
    return 6;
  }
  if (c == '7') {
    return 7;
  } 
  if (c == '8') {
    return 8;
  } 
  if (c == '9') {
    return 9;
  }
  return -1;  
}

//素数判定
bool PN(int x) {
  if (x <= 1) {
    return false; // 1や0,-1は素数ではない
  }
  if (x == 2) {
    return true; // √2 + 1 > 2 なので下でやると 2 ％ 2 = 0 となり判定できない
  }
  for (int i = 2; i < sqrt(x) + 1; i++) {
    if (x % i == 0) {
      return false; // 割れたら素数じゃない
    }
  }
  return true;
}

//ライブラリ終わり

int main() {
  ll N, A, B;
  cin >> N >> A >> B;
  vector<ll> M(N, 0);
  vector<ll> X(N);
  for (int i = 0; i < N; i++) {
    cin >> X.at(i);
  }
  for (int i = 1; i < N; i++) {
    M.at(i) = min(M.at(i - 1) + B, 
                  M.at(i - 1) + A * (X.at(i) - X.at(i - 1)));
  }
  cout << M.at(N - 1) << endl;
}

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

int main(){
int n,m,l;
cin>>n>>m>>l;
int a[200][200];
int b[200][200];
long long c[200][200]={};

for(int i=1;i<=n;i++){
for(int g=1;g<=m;g++){
cin>>a[i][g];
}}
for(int i=1;i<=m;i++){
for(int g=1;g<=l;g++){
cin>>b[i][g];
}}

for(int h=1;h<=l;h++){
for(int i=1;i<=n;i++){
for(int g=1;g<=m;g++){
c[i][h]+=a[i][g]*b[g][h];
}}}

for(int i=1;i<=n;i++){
for(int g=1;g<=l;g++){
cout<<c[i][g];
if(g<l){cout<<" ";}
}
cout<<endl;
}

return 0;
}


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

int main(){
    double A, B;
    long long ans, A_l, B_l;

    std::cin >> A >> B;
    A_l = (long long)A;
    B_l = (long long)round(B * 100.0);
    // std::cout << A_l << " " << B_l << "\n";
    // std::cout << A_l * B_l << "\n";
    ans = (A_l*B_l - (A_l*B_l)%100)/100;
    //ans = (long long)round(floor(A * B));
    std::cout << dec << ans;

}

Measured memory_bytes: 3660
#include <iostream>

using namespace std;

int main(){
    int A, B, C, X;
    int ans = 0;

    cin >> A >> B >> C >> X;

    for(int i=0; i<=A; i++){
        for(int j=0; j<=B; j++){
            for(int k=0; k<=C; k++){
                int sum = 500*i + 100*j + 50*k;
                if(sum == X) ans += 1;
            }
        }
    }

    cout << ans << endl;
    
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string a, b, c;
  cin >> a;
  cin >> b;
  cin >> c;
  cout << a[0] << b[1] << c[2] << endl;
  return 0;
}

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

using namespace std;

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

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    
    sort(h.begin(), h.end());
    auto it = lower_bound(h.begin(), h.end(), k);
    int idx = it - h.begin();
    cout << n - idx << endl;
}


Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
using namespace std;
const int MOD=1000000007;
int n,k;
long long fac[1000001]={1},inv[1000001]={1};
inline long long power(long long a,long long b,long long P)
{
	long long res=1;
	while(b)
	{
		if(b&1) res=res*a%P;
		b>>=1,a=a*a%P;
	}
	return res;
}
long long C(long long n,long long m)
{
	if(n<m) return 0;
	if(m==0) return 1;
	return fac[n]*inv[n-m]%MOD*inv[m]%MOD;
}
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
		fac[i]=fac[i-1]*i%MOD;
	inv[n]=power(fac[n],MOD-2,MOD);
	for(int i=n-1;i>0;i--)
		inv[i]=inv[i+1]*(i+1)%MOD;
	for(int i=1;i<=k;i++)
		printf("%lld\n",C(k-1,i-1)*C(n-k+1,i)%MOD);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int X,Y,B[21][21],J,L,i,j,g,m[5]={0,1,0,-1,0};
char D;
int main()
{
	for(;scanf("%d",&J),J;)
	{
		memset(B,0,sizeof(B));
		for(i=0;i<J;B[Y][X]=1,i++)
			scanf("%d%d",&X,&Y);
		for(scanf("%d\n",&i),g=0,X=Y=10;i--;)
		{
			scanf("%c%d\n",&D,&L);
			switch(D)
			{
			case 'N':j=1;break;
			case 'E':j=0;break;
			case 'S':j=3;break;
			case 'W':j=2;break;
			}
			for(;L--;)
			{
				Y+=m[j];
				X+=m[j+1];
				if(B[Y][X])
				{
					g++;
					B[Y][X]=0;
				}
			}
		}
		puts(g==J?"Yes":"No");
	}
	return 0;
}

Measured memory_bytes: 588
#include <bits/stdc++.h>
using namespace std;
using ll =long long ;
ll gcd(ll p,ll q){
  if(p%q==0)return q;
  return gcd(q,p%q);
}
int main() {
  ll a;
  ll b=1;
  cin>>a;
  for(ll i=0;i<a;i++){
    ll c;
    cin>>c;
    if(c==b){
      b+=1;
    }
  }
  if(b==1){
    cout<<-1<<endl;
    return 0;
  }
  cout<<a-b+1<<endl;
  return 0;
}

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

#define iN(x) int x;cin>>x;
#define iNll(x) ll x;cin>>x;
#define iNl(x) long x;cin>>x;

#define reP2(i,start,end) for(int i=start;i<end;i++)
#define reP(i,end) reP(i,0,end)
#define iNv(X,n) reP(ijk,n)cin>>X.at(ijk);
#define ouT(x) cout<<x<<endl;



int main(){
  iN(a);
  iN(b);
  
  int x = b - a;
  int ans=0;
  
  for(int i=0;i<x;i++)ans += i;
  ans = ans - a;
  ouT(ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

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};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

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

  cin >> n;
  cout << (n - 1) / 2 << endl;
}


Measured memory_bytes: 256
#if defined _MSC_VER //if using Visual Studio
#include "std_lib_facilities.h" //include this local header file
#include <queue>
#else
#include<bits/stdc++.h> //include this non portable headerfile 
using namespace std; //and the standard namespace
#endif
#pragma warning(disable:4996)//necessary if we want to use freopen() 

using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vld = vector<ld>;
using pll = pair<ll, ll>;
using vpl = vector<pll>;

#define dx first
#define dy second
#define forx(n) for (ll x=1;x<=n;x++)
#define fory(n) for (ll y=1;y<=n;y++)
#define rall(v) (v).rbegin(),(v).rend()
#define all(v) (v).begin(),(v).end()
#define fork(n) for (ll k=0;k<n;k++)
#define forj(n) for (ll j=0;j<n;j++)
#define fori(n) for (ll i=0;i<n;i++)
#define in(t) ll t; cin >> t; while(t--)
#define fin(n) ll n; cin >> n; fori(n)
#define trav(v) for(auto &i:v)
#define pb(x) push_back(x)

template <class T>
void vb(vector<T>&v) {
	T a;
	cin >> a;
	v.pb(a);
}
int main() {
	ios::sync_with_stdio(false); cin.tie(0);
#if defined _MSC_VER 
	freopen("Text.txt", "r", stdin);//read all input form this local file 
#endif
	vll cost,dist;
	in(t) {
		vb(cost);
		dist.pb(1e9);
	}
	cost.pb(1e9);
	cost.pb(1e9);
	dist.pb(1e9);
	dist.pb(1e9);
	dist[0] = 0;
	fori(cost.size()-2){
		dist[i + 1] = min(dist[i + 1], dist[i] + abs(cost[i + 1] - cost[i]));
		dist[i + 2] = min(dist[i + 2], dist[i] + abs(cost[i + 2] - cost[i]));
	}
	cout << dist[dist.size() - 3];
}

Measured memory_bytes: 2036
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        double r = scan.nextDouble();
        double cir = (r * 2) * Math.PI;
        double area = r * r * Math.PI;

        System.out.printf("%6f %6f",area, cir);
    }
}

Measured memory_bytes: 28104