akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <climits>
#include <vector>
#include <stack>
#include <cstdio>
using namespace std;

void pops(stack<int> *st, int *op1, int *op2){
  *op1 = st->top();
  st->pop();
  *op2 = st->top();
  st->pop();
  return;
}

int main(int argc, char *argv[])
{
  string s;
  stack<int> st;
  int tmp_num;
  int op1;
  int op2;
  int answer;
  
  while (true) {
    cin >> s;
    if (cin.eof()) {
      break;
    }
    // cout << s << "\n";
    switch (s[0]) {
    case '+': {
      pops(&st, &op1, &op2);
      answer = op1 + op2;
      break;
    }
    case '-': {
      pops(&st, &op1, &op2);
      answer = op2 - op1;
      break;
    }
    case '*': {
      pops(&st, &op1, &op2);
      answer = op2 * op1;
      break;
    }
    default:
      sscanf(s.c_str(), "%d", &answer);

      break;
    }
    // cout << answer << "\n";
    st.push(answer);

  }
  cout << answer << "\n";
  return 0;
}


// int main(int argc, char *argv[])
// {
//   stack<int> st;
//   string input;
//   int stack_num = 1;
//   int ans_num = 0;
//   int right_num = 0;
//   int left_num = 0;
//   int temp = 0;
//   getline(cin, input); 
//   // cout << input << "\n";

//   for (int i = 0; i < input.size(); i++) {
//     stack_num = 1;
//     // cout << input[i] << "\n";
//     if ('0' <= input[i] && input[i] <='9' || ((input[i] == '-') && ('0' <= input[i] && input[i] <='9'))) {
//       if (input[i] == '-') {
// 	stack_num = 1*-1;
//       }else {
// 	stack_num = stack_num*(input[i] - '0');	
//       }

//       while (true) {
// 	i = i+1;
// 	if (!('0' <= input[i] && input[i] <='9')) {
// 	  break;
// 	}
// 	stack_num = stack_num*10+(input[i]-'0');
//       }
//       // cout <<"aa" <<stack_num << "\n";
      
//       st.push(stack_num);
//     }else if(input[i] == ' '){
      
//     }else {
//       right_num = st.top();
//       st.pop();
//       left_num = st.top();
//       st.pop();
//       switch (input[i]) {
//       case '+': {
// 	temp = left_num+right_num;
// 	break;
//       }
//       case '-': {
// 	temp = left_num - right_num;
// 	break;
//       }
//       case '*': {
// 	temp = left_num * right_num;
// 	break;
//       }
//       case '/': {
// 	temp = left_num / right_num;
// 	break;
//       }
// default:
// 	break;
//       }
//       // cout << ans_num << "\n";
//       ans_num = temp;
//       st.push(ans_num);
//     }


//   }
//   cout << ans_num << "\n";
//   return 0;
// }



Measured memory_bytes: 3280
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
    int K = Integer.parseInt(sc.next());
    int S = Integer.parseInt(sc.next());
    int count = 0;
    int z = 0;
    
    //K以下の自然数X,Y,Zの合計がSとなる組み合わせは何通りあるか
    for(int x = 0; x <=K; x++){
      for(int y = 0; y <=K; y++){
        z = S - x - y;
       if(z >= 0 && z <= K) count++;
      }
    }   
    System.out.println(count);      
  }
}

Measured memory_bytes: 21844
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
constexpr int inf=1e9+7;
constexpr ll longinf=1LL<<60 ;
constexpr ll mod=998244353 ;


vector<ll> p(202020),calc(202020);

template<typename T, typename S>
struct LazySegmentTree{
private:
    int n;
    vector<T> node;
    vector<S> lazy;
    T E0;
    S E1;

    inline void updatef(S& lazy,S& value){
        //lazy += value;
        lazy = value;
        //lazy = max(lazy, value);
        //lazy = min(lazy, value);
    }
    inline void calculatef(T& node,S& lazy,int len){
        //node += lazy * len; //区間sumはこっち
        // node += lazy ; //区間maxとか
        node.first = calc[node.second - 1] * lazy % mod ;
    }
    inline T queryf(T& x,T& y){
        //return x + y;
        //return x * y;
        //return max(x, y);
        return {(x.first * p[y.second] + y.first) % mod, x.second + y.second};
    }
public:
    LazySegmentTree(int sz,T nodeE,S lazyE ):E0(nodeE), E1(lazyE){
        n=1;
        while(n<sz)n<<=1;
        node.resize(2*n-1,E0);
        lazy.resize(2*n-1,E1);
    }

    LazySegmentTree(vector<T>& v,T E0,S E1 ):E0(E0),E1(E1){
        n=1;
        int sz=v.size();
        while(n<sz)n<<=1;
        node.resize(2*n-1,E0);
        lazy.resize(2*n-1,E1);
        rep(i,sz)node[i+n-1] = v[i];
        for(int i=n-2; i>=0; --i){
            node[i] = queryf(node[2*i+1],node[2*i+2]);
        }
    }

    void eval(int k,int l,int r){
        if(lazy[k]==E1)return ;
        calculatef(node[k], lazy[k], r-l);
        if(r-l>1){
            updatef(lazy[2*k+1], lazy[k]);
            updatef(lazy[2*k+2], lazy[k]);
        }
        lazy[k]=E1;
    }

    void update(int a, int b, S x,int k=0,int l=0,int r=-1){
        if(r<0)r=n;
        eval(k,l,r);
        if(r<=a||b<=l)return;
        if(a<=l&&r<=b){
            updatef(lazy[k], x);
            eval(k,l,r);
        }
        else {
            update(a,b,x,2*k+1,l,(l+r)/2);
            update(a,b,x,2*k+2,(l+r)/2,r);
            node[k]=queryf(node[2*k+1], node[2*k+2]);
        }
    }

    T query(int a,int b,int k=0,int l=0,int r=-1){
        if(r<0)r=n;
        eval(k,l,r);
        if(r<=a||b<=l)return E0;
        if(a<=l&&r<=b)return node[k];
        T xl=query(a,b,2*k+1,l,(l+r)/2);
        T xr=query(a,b,2*k+2,(l+r)/2,r);
        return queryf(xl, xr);
    }
};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,q;
    cin>>n>>q;
    p[0]=1;
    rep(i,n)p[i+1]=p[i]*10%mod;
    calc[0]=p[0];
    rep(i,n)calc[i+1]=(calc[i]+p[i+1])%mod;
    vector<pair<ll,ll>> a(n,{1,1});
    LazySegmentTree<pair<ll,ll>,int> sg(a,{0,0},0);
    while(q--){
        int l,r,d;
        cin>>l>>r>>d;
        --l;
        sg.update(l,r,d);
        cout<<sg.query(0,n).first<<endl;
    }
    return 0;
}

Measured memory_bytes: 19788
#include<stdio.h>
int main(void){
  int a,b,c,d,e,k;
  a<b;
  b<c;
  c<d;
  d<e;
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);
  scanf("%d",&d);
  scanf("%d",&e);
  scanf("%d",&k);
  if((e-a)>k){
    printf(":(");
  }
  if((e-a)<=k){
    printf("Yay!");
  }
}
    

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

using namespace std;

struct UnionFind {
  vector<int> p;
  vector<int> sz;
  UnionFind(int n) {
    p.resize(n, -1);
    sz.resize(n, 1);
  }

  int find(int x) {
    if (p[x] == -1)
      return x;
    else
      return p[x] = find(p[x]);
  }

  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    if (sz[x] > sz[y]) swap(x, y);
    sz[y] += sz[x];
    p[x] = y;
  }

  bool same(int x, int y) { return find(x) == find(y); }

  int size(int x) { return sz[find(x)]; }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> fb[n];
  UnionFind uf(n);
  while (m--) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    fb[a].emplace_back(b);
    fb[b].emplace_back(a);
    uf.unite(a, b);
  }
  while (k--) {
    int c, d;
    cin >> c >> d;
    c--;
    d--;
    fb[c].emplace_back(d);
    fb[d].emplace_back(c);
  }
  for (int i = 0; i < n; i++) {
    int ans = uf.size(i);
    for (const auto& f : fb[i]) {
      if (uf.same(i, f)) ans--;
    }
    ans--;
    cout << ans << ' ';
  }
  cout << '\n';
  return 0;
}

Measured memory_bytes: 10468
#include<iostream>
using namespace std;
int main(){
  int n;
  cin >> n;
  while(n > 10){
    n = n % 10;
  }
  
  if(n == 3){
    cout << "bon";
  }
  else if(n == 0 ||n == 1 ||n == 6 ||n == 8){
    cout << "pon";
  }
  else{
    cout << "hon";
  }
  
}

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


int main(){
  int n;
  cin >> n;
  int b[n-1];
  for (int i=0; i<n-1; i++){
    cin >> b[i];
  }
  int ans = 0;
  for (int i=0; i<n-2; i++){
    ans += min(b[i], b[i+1]);
  }
  cout << ans + b[0] + b[n-2] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define pp pop_back
#define mp make_pair
#define F first
#define S second
#define Need_for_speed ios_base::sync_with_stdio(0);
using namespace std;
//cout<<fixed<<setprecision()
vector<int>v;
int main(){
	Need_for_speed;
	int n, mn = 1e9, k = 0, b = 0, sum = 0, num = 0;
	cin>>n;
	for(int i = 1; i <= n/2; i++){
		k=i;
		b=n-i;
		while(k > 0){
			sum+=k % 10;
			k/=10;
		}
		while(b > 0){
			sum+=b % 10;
			b/=10;
		}
		mn=min(mn,sum);
		sum=0;
	}
	cout<<mn;
	exit(0);
}


Measured memory_bytes: 256
/* にぶたん二回 */
#include <bits/stdc++.h>
using namespace std;

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF             2e9
#define INF_LL          1LL<<60
#define ll              long long
#define Ceil(x, n)      (((((x))+((n)-1))/n))
#define CeilN(x, n)     (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)    ((x)-(x)%(n))
#define ALL(x)          (x).begin(),(x).end()
typedef pair<ll, ll>    P;

int main() {
    ll n, k;
    cin >> n >> k;
    vector<ll> array_(n);
    REP(i, n) cin >> array_[i];
    sort(ALL(array_));

    ll lb = -INF_LL;
    ll ub = INF_LL;

    while(ub - lb > 1) {
        ll mid = (ub + lb) / 2;
        ll a = 0, b = 0;    /* a: 2個選んだ時の積がmid以下になるものの個数 b: a[i]*a[i] <= xになるものの個数 */
        REP(i, n) {
            if(array_[i] > 0) {
                ll lb2 = -1, ub2 = n;
                while(ub2 - lb2 > 1) {
                    ll mid2 = (ub2 + lb2) / 2;
                    if(array_[i] * array_[mid2] <= mid) lb2 = mid2;
                    else ub2 = mid2;
                }
                a += ub2;
            } else if(array_[i] < 0) {
                ll lb2 = -1, ub2 = n;
                while(ub2 - lb2 > 1) {
                    ll mid2 = (ub2 + lb2) / 2;
                    if(array_[i] * array_[mid2] <= mid) ub2 = mid2;
                    else lb2 = mid2;
                }
                a += n - ub2;
            } else {
                if(mid >= 0) a += n;
            }

            if(array_[i] * array_[i] <= mid) b++;
        }
        ll num = (a - b) / 2;   /* かけ合わせた数がmid以下になるものの個数 */
        if(num >= k) ub = mid;
        else lb = mid;
    }

    cout << ub << endl;

    return 0;
}

Measured memory_bytes: 1792
#practical skill test
h,w,d=map(int,input().split())
lists=[0 for j in range(h)]
for j in range(h):
    lis=list(map(int,input().split()))
    lists[j]=lis
uselist=[0 for i in range(h*w)]
for i in range(h):
    for j in range(w):
        uselist[lists[i][j]-1]=(i+1,j+1)

distance=[[0]for i in range(d)]
for i in range(1,d+1):
    start=i
    nums=0
    #i=1,2,....,d
    while start<=h*w-d:
        a=abs(uselist[start+d-1][0]-uselist[start-1][0])+abs(uselist[start+d-1][1]-uselist[start-1][1])
        nums=nums+a
        distance[i-1].append(nums)
        start+=d

q=int(input())
for k in range(q):
    s,g=map(int,input().split())
    if s%d!=0:
      mod=s%d-1
    elif s%d==0:
      mod=d-1
    print(distance[mod][(g-1-mod)//d]-distance[mod][(s-1-mod)//d])
    

Measured memory_bytes: 23336
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
    ll H1, M1, H2, M2, K;

    cin >> H1 >> M1 >> H2 >> M2 >> K;

    if(H1>H2){
        H2+=24;
    }

    ll m1, m2;
    m1 = H1*60+M1;
    m2 = H2*60+M2;

    ll a = m2-K-m1;

    cout << a;
}

Measured memory_bytes: 3636
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		int k = sc.nextInt();
		int s = sc.nextInt();
		for(int x = 0; x <= k; x++) {
			for(int y = 0; y <= k; y++) {
				int z = s - x - y;
				if(0 <= z && z <= k) {
					count++;
				}
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 21460
from collections import defaultdict
blue = defaultdict(int)
red = defaultdict(int)

n = int(input())
for _ in range(n):
    s = input()
    blue[s] += 1

m = int(input())
for _ in range(m):
    s = input()
    red[s] += 1

ans = 0
for k, v in blue.items():
    w = v - red[k]

    ans = max(w, ans)
print(ans)


Measured memory_bytes: 3316
#include <iostream>
using namespace std;
   int a,b,c,yakusuu;
   int main(){
   cin>> a>>b>>c;
  
  for(int i=a; i<=b; i++){
   if(c%i==0){yakusuu++;}
  }
   cout<<yakusuu<<endl;
   return 0;
}
   
      

Measured memory_bytes: 1164
package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func main() {
	var N int
	fmt.Scan(&N)
	a := make([]int, N)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := range a {
		a[i] = nextInt(sc)
	}
	// fmt.Println("N", N, "a", a)
	var ans []int
	j := 1
	for i := 0; i < N; i++ {
		if a[i] == j {
			ans = append(ans, j)
			j++
		}
	}
	if len(ans) == 0 {
		fmt.Println(-1)
	} else {
		fmt.Println(N - len(ans))
	}
}


Measured memory_bytes: 8960
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>

using namespace std;

int main()
{
    int n, m, y[100010], p[100010];
    vector<int> vec[100010];
    cin>>n>>m;
    for (int i=1; i<=m; i++)
    {
        cin>>p[i]>>y[i];
        vec[p[i]].push_back(y[i]);
    }
    for (int i=1; i<=n; i++) if (!vec[i].empty()) sort(vec[i].begin(), vec[i].end());
    for (int i=1; i<=m; i++)
    {
        string s="";
        if (p[i]<=9) s+="00000"+to_string(p[i]);
        else if (p[i]<=99) s+="0000"+to_string(p[i]);
        else if (p[i]<=999) s+="000"+to_string(p[i]);
        else if (p[i]<=9999) s+="00"+to_string(p[i]);
        else if (p[i]<=99999) s+="0"+to_string(p[i]);
        else s+=to_string(p[i]);
        int idx=lower_bound(vec[p[i]].begin(), vec[p[i]].end(), y[i])-vec[p[i]].begin()+1;
        if (idx<=9) s+="00000"+to_string(idx);
        else if (idx<=99) s+="0000"+to_string(idx);
        else if (idx<=999) s+="000"+to_string(idx);
        else if (idx<=9999) s+="00"+to_string(idx);
        else if (idx<=99999) s+="0"+to_string(idx);
        else s+=to_string(idx);
        cout<<s<<endl;
    }

    return 0;
}


Measured memory_bytes: 7808
// F.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;

typedef long double LD;

int main(int argc, char* argv[]) {
	cout.precision(12);
	while (true) {
		int n = -1;
		cin >> n;
		if (n <= 0) break;
		vector<LD> x(n), y(n);
		vector<pair<LD, int>> v(n);
		for (int i = 0; i < n; ++i) {
			cin >> x[i] >> y[i];
			v[i] = {atan2(y[i], x[i]), i};
		}
		sort(v.begin(), v.end());
		LD ans = 0;
		for (int i = 0; i < n; ++i) {
			LD xs = 0, ys = 0;
			for (int j = 0; j < n; ++j) {
				int k = v[(i + j) % n].second;
				xs += x[k], ys += y[k];
				ans = max(ans, sqrt(xs * xs + ys * ys));
			}
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
	int x;
  cin >> x;
  for(long long int i=-1000;i<=1000;i++){
  	for(long long int j = -1000;j<=1000;j++){
    	if(((i*i*i*i*i) - (j*j*j*j*j))==x)
    	{
    	    cout << i <<' ' <<j;return 0;
    	    
    	}
    }
  }
	
}

Measured memory_bytes: 3584
#include <iostream>

int main() {
    int N;
    std::cin >> N;

    if (1 <= N && N <= 9) {
        std::cout << N << std::endl;
    } else if (10 <= N && N <= 99) {
        std::cout << 9 << std::endl;
    } else if (100 <= N && N <= 999) {
        std::cout << 9 + (N - 99) << std::endl;
    } else if (1000 <= N && N <= 9999) {
        std::cout << 909 << std::endl;
    } else if (10000 <= N && N <= 99999) {
        std::cout << 909 + (N - 9999) << std::endl;
    } else if (100000 == N) {
        std::cout << 90909 << std::endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int W,H,x,y,r,a,b;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	if(0<=x-r&&W>=x+r&&0<=y-r&&H>=y+r){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr double eps = 1e-9;
constexpr ll MOD = 1000000007LL;
template <typename T>
bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T>
bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for(int i = 0; i < v.size(); i++) {
        os << v[i] << (i + 1 == v.size() ? "\n" : " ");
    }
    return os;
}
template <typename T>
vector<T> make_v(size_t a) {
    return vector<T>(a);
}
template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T& t, const V& v) {
    t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T& t, const V& v) {
    for(auto& e : t) {
        fill_v(e, v);
    }
};
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w, n;
    cin >> h >> w >> n;
    int sy, sx;
    cin >> sy >> sx;
    string s, t;
    cin >> s >> t;
    int x, y;
    x = sx;
    for(int i = 0; i < n; i++) {
        if(s[i] == 'L') {
            x--;
        }
        if(x < 1) {
            cout << "NO" << endl;
            return 0;
        }
        if(t[i] == 'R') {
            if(x < w)
                x++;
        }
    }
    x = sx;
    for(int i = 0; i < n; i++) {
        if(s[i] == 'R') {
            x++;
        }
        if(x > w) {
            cout << "NO" << endl;
            return 0;
        }
        if(t[i] == 'L') {
            if(x > 1)
                x--;
        }
    }
    y = sy;
    for(int i = 0; i < n; i++) {
        if(s[i] == 'U') {
            y--;
        }
        if(y < 1) {
            cout << "NO" << endl;
            return 0;
        }
        if(t[i] == 'D') {
            if(y < h)
                y++;
        }
    }
    y = sy;
    for(int i = 0; i < n; i++) {
        if(s[i] == 'D') {
            y++;
        }
        if(y > h) {
            cout << "NO" << endl;
            return 0;
        }
        if(t[i] == 'U') {
            if(y > 1)
                y--;
        }
    }
    cout << "YES" << endl;
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


int main() {
    i64 A, B, T;
    cin >> A >> B >> T;
    i64 ans = floor((T + 0.5) / A) * B;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC_Training
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var sd = Console.ReadLine().Split(' ').Select(int.Parse).OrderBy(x=>x).Skip(n/2-1).Take(2).ToArray();
            Console.WriteLine(sd[1] - sd[0]);
        }
    }
}


Measured memory_bytes: 20704
import java.awt.*;
import java.util.*;

public class Main {
    public static void main(String args[])
    {
        Scanner s = new Scanner(System.in);
        String str = s.next();
        char[] arr=str.toCharArray();
        char[] arr1=new char[100000];
        if(arr[0]=='0') {
            for (int i = 0; i < str.length(); i+=2) {
                arr1[i]='0';
                arr1[i+1]='1';
            }
        }
        if(arr[0]=='1') {
            for (int i = 0; i < str.length(); i+=2) {
                arr1[i]='1';
                arr1[i+1]='0';
            }
        }
        int count=0;
        for(int i=0;i<str.length();i++)
        {
            if(arr[i]!=arr1[i])
                count++;
        }
        System.out.println(count);

    }
}


Measured memory_bytes: 26804
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
  int k; cin>>k;
  int a,b;
  cin>>a>>b;
  int rem = a%k;
  if(rem==0){
    cout<<"OK"<<endl;
  }else{
    if(a+k-rem<=b){
      cout<<"OK"<<endl;
    }else{
      cout<<"NG"<<endl;
    }
  }
  return 0;
}

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

bool check(int n){
  while(n%2==0){
    n/=2;
  }
  while(n%3==0){
    n/=3;
  }
  while(n%5==0){
    n/=5;
  }
  if(n==1){
    return true;
  }else{
    return false;
  }
}

int main(){
  int m,n;
  while(1){
    cin>>m;
    if(m==0)break;
    cin>>n;
    int ans=0;
    for(int i=m;i<=n;i++){
      if( check(i) ){
        ans++;
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}



Measured memory_bytes: 3092
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <cstdint>
#include <iomanip>
using ll = long long;

bool is_prime(const ll N){
    if(N<2) return false;
    for(int i=2; i*i<=N; ++i){
        if(N%i==0) return false;
    }
    return true;
}

int main(){
    ll x; std::cin>>x;
    while(is_prime(x)==false){
        ++x;
    }
    std::cout << x;
    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(){
  long long n,ans,k;cin>>n>>k;
  ans=k;
  REP(i,n-1) ans*=k-1;
  cout<<ans;
}

Measured memory_bytes: 256
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
// -------------------</optimizations>--------------------
#include<bits/stdc++.h>
#define ll long long
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> //lower_bound , upper_bound
// using namespace __gnu_pbds;//kth smallest : *pd.find_by_order(k-1) , no. of elem < X : pd.order_of_key(X) , delete X : pd.erase(X).
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define nl '\n'
#define pl pair<ll,ll>
#define all(v) v.begin(),v.end()
#define tc ll tc;cin>>tc;while(tc--)
const ll mod=(1e+9)+7;
const ll sz = 2e5+9;
ll gcd(ll a,ll b) {if(b==0)return a;return gcd(b,a%b);}
ll power(ll a,ll b,ll m = mod) {ll res = 1;while(b>0){if(b&1)res = (res*a)%m;b = b>>1;a = (a*a)%m;}return res;}

void solve()
{
    ll n;
    cin>>n;
    vector<ll> v(n),ans(n);
    for(auto &x:v) cin>>x;
    ans[0]=0;
    ans[1]=abs(v[1]-v[0]);
    f(i,2,n) ans[i]=min(ans[i-1]+abs(v[i]-v[i-1]),ans[i-2]+abs(v[i]-v[i-2]));
    cout<<ans[n-1]<<nl;
    
    
}
 
int main()
{
    #ifdef JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    clock_t beg = clock();
    solve();
    clock_t end = clock();
    fprintf(stderr, "%.3f sec, Copyright %c 2019 PyThor. \n", double(end - beg) / CLOCKS_PER_SEC , 184);
    return 0;
}

Measured memory_bytes: 1792
import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    import os, zlib, base64
    open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode("c${5PL2kn!5WHLRAEt*Sc1xnT$EfZ{QXc?Aiev-A^w7S(i%nyvdjV!=XLlAI+=#&ld75G{_6BK2??S|=#!1Dp(1{?w<EOJH&jTL@HQY%)aC=jklvR4;?)gb_s~ORZjk+vkuQcd-eLbh>;LBp^Q+bAC!>}aqjLG~crz;}Y^;(EQ@m_@lgV(U`W`;{yfWm0_EAQ}z^94c0uVBHK)Qq=(wdqwaiA+n#riW!1890MrFbt7Fmc{I(I_&yge_+@XXFrmPb^(T}@+K-OoQG<gI?wg5kYx8Fx996n97i-67Aq_^Fd5`{Y9X@l*7Q3aqT3`=MAG4pQ0gciq0}v|&@A`T&U#x^bc@>E@Z#6j>-vxWYSJk30!ifgSr*IRrv-diT7V=sza4$2?E")))
    os.system('cythonize -i -3 -b solve.pyx')
import solve

Measured memory_bytes: 9896
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
const int INF = 1e9;

int main() {
  string s, r, s1, s2;
  cin >> s;
  r = s;
  int n;
  n = s.size();
  reverse(r.begin(), r.end());
  if (s != r) {
    cout << "No" << endl;
    return 0;
  }
  s1 = s.substr(0, (n-1)/2);
  r = s1;
  reverse(r.begin(), r.end());
  if (s1 != r) {
    cout << "No" << endl;
    return 0;
  }
  s2 = s.substr((n+3)/2-1, n-(n+3)/2+1);
  r = s2;
  reverse(r.begin(), r.end());
  if (s2 != r) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define U 998244353
#define N 1000005
#define int long long
#define sz(c) (int)c.size()
#define fr first
#define ll long long 
#define sc second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a ; i<n ; i++)
#define r0 return 0;
#define endl '\n'
#define INF (int)1e15
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
signed main()
{
	ios_base::sync_with_stdio(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{   
		int n,k;
		cin >> n >> k;
		int a[n+1];
		rep(i,1,n+1) cin >> a[i];
		int dp[n+1][k+1]; // ith children distributed atmost j candies
		rep(i,0,n+1){
			rep(j,0,k+1) dp[i][j] = 0;
		}
		dp[0][0] = 1;
		rep(i,1,n+1){
			dp[i][0] = 1;
			rep(j,1,k+1){
				int t;
				if(j-a[i]-1>=0) t = dp[i-1][j-a[i]-1];
				else t = 0;
				dp[i][j] = (M+dp[i-1][j]-t)%M;
				dp[i][j] = (dp[i][j]+dp[i][j-1])%M;
				// cout<<dp[i][j]<<" ";
			}
			cout<<endl;
		}
		int ans = dp[n][k];
		cout<<ans;
	}
}

Measured memory_bytes: 79104
#include<iostream>
#include <string>
#include <cstdlib> //絶対値利用のため
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
#define fr(i,n) for(int i=0;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)

//const int INF = INT_MAX / 2;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if ((a < c && b > c) || (a > c && b < c)) cout << "Yes" << endl;
	else cout << "No" << endl;


	return 0;
}





Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args){
//        Scanner sc = new Scanner(System.in);
//        // 整数の入力
//        int a = sc.nextInt();
//        // スペース区切りの整数の入力
//        int b = sc.nextInt();
//        int c = sc.nextInt();
//        // 文字列の入力
//        String s = sc.next();
//        // 出力
//        System.out.println((a+b+c) + " " + s);

//        Scanner sc = new Scanner(System.in);
//        // 整数の入力
//        int a = sc.nextInt();
//        // スペース区切りの整数の入力
//        int b = sc.nextInt();
//        if((a*b)%2==0) {
//            // 出力
//            System.out.println("Even");
//        } else {
//            System.out.println("Odd");;
//        }

        Scanner sc = new Scanner(System.in);
        // 文字列の入力
        String s = sc.next();

        // 出力
        System.out.println(s.replace("0", "").length());
    }
}


Measured memory_bytes: 21204
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iterator>
#include <set>
#include <string>
#include <vector>

using namespace std;

int main() {
    int N, X;
    cin >> N >> X;

    int ans = 0;
    int cost = 9999;
    for (int i = 0; i < N; ++i) {
        int tmp;
        cin >> tmp;
        X -= tmp;
        ++ans;
        cost = min(cost, tmp);
    }
    while (X - cost >= 0) {
        X -= cost;
        ++ans;
    }
    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;

int main(){
	int n,k,q; scanf("%d%d%d",&n,&k,&q);
	vector<int> a(n);
	rep(i,n) scanf("%d",&a[i]);
	a.emplace_back(0);

	int ans=INT_MAX;
	rep(i,n){
		vector<int> b,tmp;
		rep(j,n+1) if(a[j]>=a[i]) {
			tmp.emplace_back(a[j]);

			if(j==n-1 || a[j+1]<a[i]){
				int width=tmp.size();
				if(width>=k){
					partial_sort(tmp.begin(),tmp.begin()+width-k+1,tmp.end());
					b.insert(b.end(),tmp.begin(),tmp.begin()+width-k+1);
				}
				tmp.clear();
			}
		}

		if(b.size()>=q){
			nth_element(b.begin(),b.begin()+q-1,b.end());
			ans=min(ans,b[q-1]-a[i]);
		}
	}
	printf("%d\n",ans);

	return 0;
}


Measured memory_bytes: 256
x = input()
a = int(x.split()[0])
b = int(x.split()[1])
k = int(x.split()[2])
a_result = ''
b_result = ''

if k >= a:
  a_result = '0'
  k = k -a
else:
  a_result = str(a - k)
  k = 0

if k >= b:
  b_result = '0'
else:
  b_result = str(b - k)
  
print(a_result + ' ' + b_result)

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <cstdio>
#include <new>
#include <vector>
#include <cstdlib>
#include <string>
#include <set>
#include <tuple>
#include<map>

using namespace std;
int main() {
	int N, M;
	cin >> N >> M;

	int ans = 0;

	while (N >= 2) {
		N--;
		ans += N;
	}

	while (M >= 2) {
		M--;
		ans += M;
	}

	cout << ans << endl; 

}

Measured memory_bytes: 3576
#include <algorithm>
#include <iostream>
#include <vector>
#include <cassert>
using namespace std;
#define rep(i, n) for (i = 0; i < n; ++i)

int a[4];
int expr(string &s, int &p) {
    if (isalpha(s[p])) return a[s[p++] - 'a'];
    assert(s[p++] == '[');
    char op = s[p++];
    int x = expr(s, p);
    int y = expr(s, p);
    assert(s[p++] == ']');
    if (op == '+') return x | y;
    if (op == '*') return x & y;
    if (op == '^') return x ^ y;
}

int main() {
    string s;
    while (cin >> s, s != ".") {
        string pass; cin >> pass;
        for (int i = 0; i < 4; i++) a[i] = pass[i] - '0';
        int p = 0, ans = expr(s, p);
        int cnt = 0;
        rep(a[0], 10) rep(a[1], 10) rep(a[2], 10) rep(a[3], 10) {
            int p = 0;
            if (ans == expr(s, p)) cnt++;
        }
        cout << ans << " " << cnt << endl;
    }
    return 0;
}


Measured memory_bytes: 3204
package main

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

func main() {
	S := nextBytes()
	T := nextBytes()

	c := 0

	for i := 0; i < len(S); i++ {
		if S[i] != T[i] {
			c++
		}
	}
	fmt.Println(c)
}

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024 // 1 MB
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextBytes() []byte {
	stdin.Scan()
	return stdin.Bytes()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextString())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)
	return i
}

func debug(args ...interface{}) {
	fmt.Fprintln(os.Stderr, args)
}


Measured memory_bytes: 2196
red = []
blue = []

N = int(input())
for i in range(N):
    red.append(input())
    
M = int(input())
for i in range(M):
    blue.append(input())

counts = [red.count(word) - blue.count(word) for word in red]
ans = max(max(counts), 0)
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <stack>
#include <queue>
using namespace std;
int main()
{
	int N, M;
	cin >> N >> M;
	int** arr = new int*[N];
	for (int i = 0; i < N; i++)
	{
		arr[i] = new int[M];
		for (int j = 0; j < M; j++)
		{
			int tmp;
			cin >> tmp;
			arr[i][j] = tmp;
		}
	}

	//init point
	int *point = new int[N];
	bool *deleted = new bool[M];
	for (int i = 0; i < N; i++)
		point[i] = 0;
	for (int i = 0; i < M; i++)
		deleted[i] = false;

	//compute
	int min_people = 0x0fffffff;
	int count = M;
	while (count > 0)
	{
		vector<int> people(M, 0);
		int max_people = -1;
		for (int j = 0; j < N; j++)
		{
			while (deleted[arr[j][point[j]] - 1])
				point[j]++;
			max_people = max(max_people, ++people[arr[j][point[j]] - 1]);
		}
		for (int i = 0; i < M; i++)
		{
			if (people[i] == max_people)
			{
				deleted[i] = true;
				count--;
			}
		}
		min_people = min(min_people, max_people);
	}
	cout << min_people << endl;

	delete[] deleted;
	delete[] point;

	for (int i = 0; i < N; i++)
	{
		delete[] arr[i];
	}
	delete[] arr;
}

Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
int n;
int p[20];
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> p[i];
    int count = 0;
    for (int i = 1; i < n - 1; i++)
    {
        if (p[i] > p[i - 1] && p[i] < p[i + 1])
        {
            count++;
        }
        if (p[i] < p[i - 1] && p[i] > p[i + 1])
        {
            count++;
        }
    }
    cout << count << "\n";
}

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

using namespace std;
using ll = long long int;
const int MOD = 998244353;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	int n, m; cin >> n >> m;
	cout << n*(n-1)/2 + m*(m-1)/2;
}

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



int main(){
    int L; cin >> L;
    int N;
    int memo[21];
    vector<pair<pair<int,int>, int> > ans;
    rep(i, 0, 21){
        if(i == 0)memo[i] = 1;
        else memo[i] = memo[i-1] << 1;
    }
    if(L <= 3){
        N = 2;
        rep(i, 0, L){
            ans.push_back({{1,2}, i});
        }
    }else{
        rep(i, 0, 21){
            if(L < memo[i]){
                N = i;
                break;
            } 
        }
        rep(i,0, 4) ans.push_back({{N-1,N},i} );
        rep(i, 2, N-1){
            ans.push_back({{i,i+1},memo[N-i]});
            ans.push_back({{i,i+1}, 0});
        }
        while(L > 3){
            int index = 0;
            while(L >= memo[index+1]) index++;
            ans.push_back({{1,N-index+1}, L - memo[index]});
            L -= memo[index];
        }
        rep(i, 0, L){
            ans.push_back({{1,N}, i});
        }
    }
    int M = ans.size();
    
    cout << N << " " << M << endl;
    rep(i, 0, M){
        cout << ans[i].first.first << " " <<  ans[i].first.second << " " << ans[i].second << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import collections

def judge(k):
  pos=[0]*n
  dic=collections.defaultdict(int)
  s=set()
  for i in range(n):
    dic[arr[i][0]]+=1
  while 1:
    key=list(dic.keys())
    for i in key:
      if dic[i]>k:
        s.add(i)
        del dic[i]
    flag=True
    for i in range(n):
      if arr[i][pos[i]] in s:
        flag=False
        pos[i]+=1
        if pos[i]==m:
          return False
        dic[arr[i][pos[i]]]+=1
    if flag==True:
      return True

n,m=map(int,input().split())
arr=[list(map(int,input().split())) for _ in range(n)]
l=0
r=n+1
while r-l!=1:
  mid=(l+r)//2
  if judge(mid)==True:
    r=mid
  else:
    l=mid
print(r)

Measured memory_bytes: 45404
#include<stdio.h>

#define N 16

int main(void)
{
    int a,b;

    scanf("%d %d",&a,&b);

    if(a+b > N || a > 8 || b > 8){
        puts(":(");
    } else {
        puts("Yay!");
    }

 return 0;
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  string s;cin>>s;
  vector<ll> c(26);
  rep(i, s.size()) c[s[i]-'a']++;

  ll result = s.size()*(s.size()+1)/2+1;
  rep(i, 26)result -= (c[i]*(c[i]-1)/2);
  cout<<result-s.size();

  return 0;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main() {
  int A, B, C, X, Y, ans{};
  cin >> A >> B >> C >> X >> Y;

  if (A >= 2 * C) {
    while (X > 0) {
      ans += C * 2;
      --X, --Y;
    }
  }
  if (B >= 2 * C) {
    while (Y > 0) {
      ans += C * 2;
      --X, --Y;
    }
  }
  if (A + B > 2 * C) {
    while (X > 0 && Y > 0) {
      ans += C * 2;
      --X, --Y;
    }
  }
  while (X > 0) {
    ans += A;
    --X;
  }
  while (Y > 0) {
    ans += B;
    --Y;
  }
  cout << ans << endl;
}


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

int main(){
    int n,x[100],y[100];
    cin>>n;
    for(int i=0;i<n;i++){cin>>x[i];}
    for(int i=0;i<n;i++){cin>>y[i];}
    double d1=0.0,d2=0.0,d3=0.0,d_inf=0.0;
    for (int i=0;i<n;i++){
        d1+=fabs(x[i]-y[i]);
    }
    for (int i=0;i<n;i++){
        d2+=pow(fabs(x[i]-y[i]),2.0);
    }
    for(int i=0;i<n;i++){
        d3+=pow(fabs(x[i]-y[i]),3.0);
    }
    d2 = pow(d2,1.0/2.0);
    d3 = pow(d3,1.0/3.0);

    d_inf=fabs(x[0]-y[0]);
    for(int i=0;i<n;i++){
        if(d_inf<fabs(x[i]-y[i])){
            d_inf=fabs(x[i]-y[i]);
        }
    }

    cout<<fixed<<setprecision(8)<<d1<<'\n';
    cout<<fixed<<setprecision(8)<<d2<<'\n';
    cout<<fixed<<setprecision(8)<<d3<<'\n';
    cout<<fixed<<setprecision(8)<<d_inf<<'\n';
}


Measured memory_bytes: 3484
n = int(input())
a = 0
li = list(map(int,input().split()))
lia = sorted(li,reverse=True)
a += lia[0]
if n % 2 == 0:
    for i in range((n-2)//2):
        a += lia[i+1]*2
else:
    for i in range((n-2)//2):
        a += lia[i+1]*2
        if i+1 == (n-2)//2:
            a += lia[i+2]
print(a)

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;


int main() {
    int n; cin >> n;
    set<string> S;
    REP(i,n){
        string s; cin >>s;
        S.insert(s);
    }
    cout << S.size() << endl;
    return 0;
}

Measured memory_bytes: 19212
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define U 998244353
#define N 1000005
#define int long long
#define sz(c) (int)c.size()
#define fr first
#define ll long long 
#define sc second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a ; i<n ; i++)
#define r0 return 0;
#define endl '\n'
#define INF (int)1e15
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
signed main()
{
    ios_base::sync_with_stdio(0);
    int TESTS=1;
    // cin>>TESTS;
    while(TESTS--)
    {   
         int a,b;
         cin>>a>>b;
         cout<<max(a+b,max(a-b,a*b));
    }   
}     

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep2(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(i,n) rep2(i,0,n)
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;
    vector<ll> x(n),y(n);
    vector<double> theta(n);
    rep(i,n){
        cin >> x[i] >> y[i];
        ll len=x[i]*x[i]+y[i]*y[i];
        if(len==0||(y[i]==0&&x[i]>0))theta[i]=0;
        else if(y[i]==0&&x[i]<0)theta[i]=M_PI;
        else theta[i]=(y[i]>0?1:-1)*acos(x[i]/sqrt(len));
    }
    ll ans_sq=0;
    rep(i,n)rep(j,n){
        double theta_min=min(theta[i],theta[j]), theta_max=max(theta[i],theta[j]);
        ll tmp_x=0,tmp_y=0;
        rep(k,n)if(theta_min<=theta[k]&&theta[k]<=theta_max){
            tmp_x+=x[k];
            tmp_y+=y[k];
        }
        ans_sq=max(ans_sq,tmp_x*tmp_x+tmp_y*tmp_y);
        tmp_x=0,tmp_y=0;
        rep(k,n)if(theta_min>=theta[k]||theta[k]>=theta_max){
            tmp_x+=x[k];
            tmp_y+=y[k];
        }
        ans_sq=max(ans_sq,tmp_x*tmp_x+tmp_y*tmp_y);
    }
    cout << setprecision(20) << sqrt((double)ans_sq) << endl;
    return 0;
}

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

using namespace std;
using ll = long long int;

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(auto &e: a) cin >> e;

    map<ll,ll> cnt;
    for(auto &e: a) cnt[e]++;

    ll s = 0;
    for(auto &t: cnt) {
        ll x, y;
        tie(x, y) = t;
        s += y*(y-1)/2;
    }
    for(auto &e: a) {
        ll y = cnt[e];
        cout << s - y*(y-1)/2 + (y-1)*(y-2)/2 << endl;
    }
}


Measured memory_bytes: 12032
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int x,a,b;
  cin>>x>>a>>b;
  int n;
  cin>>n;
  string s[1000];
  rep(i,n){
    cin>>s[i];
    if(s[i]=="nobiro"){
      x+=a;
      if(x<0) x=0;
    }else if(s[i]=="tidime"){
      x+=b;
      if(x<0) x=0;
    }else{
      x=0;
    }
  }
  cout<<x<<endl;

  return 0;
}



Measured memory_bytes: 3232
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define y1 zzz
#define fi first
#define se second
#define PII pair<int,int>
#define PII2 pair<int,PII >
#define PII3 pair<PII,int >
#define PII4 pair<PII,PII >
#define all(x) (x).begin(),(x).end()
#define pb push_back
void solve()
{
   string s,t;
   cin>>s>>t;
   t.pop_back();
   if(s==t)cout<<"Yes";
   else cout<<"No";
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    //freopen("CUBE.inp","r",stdin);
    //freopen("CUBE.out","w",stdout);
    //int t;cin>>t;while(t--)
    solve();
    return 0;
}


Measured memory_bytes: 3652
while True:
    a,b = map(int,input().split())
    if a == 0 and b == 0: break
    for i in range(1,a+1):
        for j in range(1,b+1):
            if i == 1 or i == a:
                if j == b:
                    print('#')
                else:
                    print('#', end="")
            else:
                if 2 <= j and j != b:
                    print('.', end="")
                elif j == b:
                    print('#')
                else:
                    print('#', end="")            
    print()


Measured memory_bytes: 6996
import java.util.HashMap;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String input = sc.next();
        HashMap<Character, Integer> count = new HashMap<>();
        for(Character c: input.toCharArray()){
            if(count.containsKey(c))
                count.replace(c, count.get(c) + 1);
            else
                count.put(c, 1);
        }
        for(Character c: count.keySet()){
            if(count.get(c) % 2 == 1){
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}


Measured memory_bytes: 21460
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<int(n);i++)
#define FOR(i,n,m) for(int i=n;i<int(m);i++)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
using namespace std;
 
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
 
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);}

int main(){
	int k,a,b;
	cin>>k>>a>>b;
	for(int i=a;i<=b;i++){
		if(i%k==0){
			cout<<"OK"<<endl;
			return 0;
		}
	}
	cout<<"NG"<<endl;
	return 0;
}

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

int main(){
    int a,b,c,k;
    int output;
    cin >> a >> b >> c >> k;
    output = min(k,a);
    k-=min(k,a);
    k-=min(k,b);
    output -=min(k,c);
    cout << output;
    return 0;
}

Measured memory_bytes: 3168