akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;

int main(){
    fastcin();

    string s, t;
    cin >> s >>t;
    int a, b;
    cin >> a >> b;
    string u;
    cin >> u;

    if(s == u) cout << a-1 << " " << b << endl;
    else cout << a << " " << b-1 << endl;
}

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

void Main() {
  long long N;
  cin >> N;
  long long A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  sort(A, A + N);
  long long ans = 1;
  for (int i = 0; i < N; i++) {
    if (A[i] != 0 && (long long)1e18 / A[i] < ans) {
      cout << -1 << endl;
      return;
    }
    ans *= A[i];
  }
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


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

int main() {
    int64_t X, N, ans, min;
    string S;
    cin >> X >> N;
    if (N == 0) {
        cin >> S;
        cout << X << endl;
        return 0;
    }
    vector<int64_t> p(N);
    for (int64_t i = 0; i < N; i++) {
        cin >> p[i];
    }
    sort(p.begin(), p.end());
    for (int64_t i = X; ; i--) {
        bool flag = true;
        for (int64_t j = 0; p[j] <= X && j < N; j++) {
            if (i == p[j]) {
                flag = false;
                break;
            }
            if (j == N - 1) {
                break;
            }
        }
        if (flag) {
            ans = i;
            min = abs(X - i);
            break;
        }
    }
    for (int64_t i = X + 1; ; i++) {
        bool flag = true;
        for (int64_t j = N - 1; p[j] > X && j >= 0; j--) {
            if (i == p[j]) {
                flag = false;
                break;
            }
            if (j == 0) {
                break;
            }
        }
        if (min <= abs(X - i)) {
            break;
        }
        if (flag) {
            ans = i;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;  // 2次元配列
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
//    cout << fixed << setprecision(15);

    string s, t;
    i32 n,m,x,y;
    cin >>   n >>  m;
    vi a(m);
    rep(i,m) cin >> a[i];
    i32 cnt = 0 ;
    rep(i,m) cnt += a[i];
    if(cnt > n) cout << -1 << '\n';
    else cout <<n- cnt    << '\n';

    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-START_TIME)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 3724
#include <iostream>
#include <cmath>
#include <climits>
#include <string>
#include <numeric>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <set>

using namespace std;
using ll = long long;

template<typename T> void print(T t) { cout << t << endl; }

int main() {
	ll K, A, B;
	cin >> K >> A >> B;
	if (B - A < 2 || A > K) {
		print(K+1);
	}
	else {
		ll ans = A;
		K -= A-1;
		if (K % 2 == 1) {
			ans++;
			K--;
		}

		ans += (B - A) * (K / 2);
		print(ans);
	}
}


Measured memory_bytes: 3624
import sys

cnt = [0]*26
for line in sys.stdin:
    for a in line:
        if(ord(a) >= 65 and ord(a) <= 90):
            cnt[ord(a) - 65] += 1
        if(ord(a) >= 97 and ord(a) <= 122):
            cnt[ord(a) - 97] += 1

for i in xrange(26):
    print unichr(97 + i) + " : " + str(cnt[i])

Measured memory_bytes: 6328
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7


#############
# Main Code #
#############

N, M = getNM()
query = [getList() for i in range(M)]

dist = [[float('inf')] * N for i in range(N)]
for i in range(N):
    dist[i][i] = 0
for i in range(M):
    a, b, c = query[i]
    dist[a - 1][b - 1] = c
    dist[b - 1][a - 1] = c

def warshall_floyd(dist):
    for k in range(N):
        # i:start j:goal k:中間地点でループ回す
        for i in range(N):
            for j in range(N):
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])
    return dist

warshall_floyd(dist)
ng_dist = [0] * M

for i in range(N):
    for j in range(M):
        s, t, c = query[j]
        if dist[i][s - 1] + c == dist[i][t - 1]:
            ng_dist[j] = 1

cnt = 0
for i in ng_dist:
    if i == 0:
        cnt += 1
print(cnt)

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N;
vint G[222222];

int dist[222222];

void dfs(int v,int p,int d){
	dist[v]=d;
	for(auto u:G[v]){
		if(u==p)continue;
		dfs(u,v,d+1);
	}
}

signed main(){
	cin>>N;
	rep(i,N-1){
		int a,b;
		cin>>a>>b;
		a--;b--;
		G[a].pb(b);G[b].pb(a);
	}

	dfs(0,-1,0);
	int ma=0;
	for(int i=1;i<N;i++)if(dist[ma]<dist[i])ma=i;
	dfs(ma,-1,0);

	int di=*max_element(dist,dist+N);

	if(di%3==1)cout<<"Second"<<endl;
	else cout<<"First"<<endl;
	return 0;
}

Measured memory_bytes: 22656
import java.util.*;

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

    public static void printArray(int[] array){
        for(int i=0; i<array.length; i++){
            if(i == array.length){
                System.out.println(array[i]);
            } else {
                System.out.print(String.format("%d ", array[i]));
            }
        }
    }
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;       //     ____   _   _  __   __
#define ll long long       //    / ___| | |_| |   / /
const ll INF = 0x3f3f3f3f; //   | |     |  _  |   V /
const ll N   = 1e5 + 5;    //   | |___  | | | |   | |
const ll MOD = 1e9 + 7;    //    ____| |_| |_|   |_|
ll read() {
  ll   x = 0, f = 1;
  char ch = getchar();

  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1; ch = getchar();
  }

  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0'; ch = getchar();
  }
  return x * f;
}

ll n, m;

const ll mod = 1e9 + 7; // 是素数
ll pow(ll a, ll i)
{
  ll ans = 1;

  while (i)
  {
    if (i & 1) ans = ans * a % mod;
    i >>= 1;
    a   = a * a % mod;
  }
  return ans;
}

ll jc(ll n)
{
  ll ans = 1;

  for (ll i = 1; i <= n; i++) ans = ans * i % mod;
  return ans;
}

ll C(ll n, ll m)
{
  ll ans = 1;

  ans = ans * jc(n) % mod;
  ans = ans * pow(jc(m), mod - 2) % mod;
  ans = ans * pow(jc(n - m), mod - 2) % mod;
  return ans;
}

int main() {
  n = read(), m = read();

  if (((2 * n - m) < 0) || ((2 * n - m) % 3 != 0)) {
    cout << 0 << endl;
  }
  else {
    ll x = (2 * n - m) / 3;
    ll y = n - 2 * x;

    if ((x < 0) || (y < 0)) {
      cout << 0 << endl;
    }
    else cout << C(x + y, y) << endl;
  }


  return 0;
}


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

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

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Random;
import java.util.Arrays;
import java.util.Comparator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Main {

	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s,t;
		
		s = sc.next().toCharArray();
	    t = sc.next().toCharArray();
	    
	    if (s[0] == t[2] && s[1]==t[1] && s[2]==t[0]) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
	
}

Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
#include <queue>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define print(x) cout<<(x)<<'\n'
#define print_vec(v) rep(i,v.size()){if(i!=0)cout<<" ";cout<<v[i];}cout<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<'\n'
#define pb push_back
#define mp make_pair
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pll=pair<ll,ll>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vstr=vector<string>;

ll N;

string s;
void solve() {
    cin >> N;
    if(N==1){
        print("Hello World");
    }else{
        ll a,b;
        cin >> a >> b;
        print(a+b);
    }
    
}
 
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
    //int q; cin >> q;
	//while (q--)
		solve();
    return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>
#include<stdlib.h>
int p,q,a,n,ans=0;

void dfs(int b,int s,int k,int now)
{
	int i;
	if(b*p==s*q){ans++;return;}
	if(k==n)return;
	if(p*b<q*s)return;
	for(i=now;i*b<=a;i++)
		dfs(i*b,s*i+b,k+1,i);
}

int main()
{
	for(;scanf("%d%d%d%d",&p,&q,&a,&n),p+q+a+n;)
	{
		ans=0;
		dfs(1,0,0,0);
		printf("%d\n",ans);
	}
}

Measured memory_bytes: 600
#include <iostream>
#include <algorithm>
#include <iomanip>

using namespace std;

const int MAX = 1e6;
const int INF = 2e9;
typedef long long ll;


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

    int L;
    cin >> L;

    double a = L/(double)3;
    cout << fixed << setprecision(6);
    cout << (a * a * ((double)L-(2*a)));

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int tab[105];
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

	int n,w,wynik=0;
	cin>>n>>w;
	for(int i=1;i<=n;i++)cin>>tab[i];
	sort(tab+1,tab+n+1);
	//for(int i=1;i<=n;i++)cout<<tab[i];
	for(int i=1;i<=n;i++)
	{
		if(w-tab[i]>=0)
		{
			w-=tab[i];
			wynik++;
		}
	}
	
	while(w-tab[1]>=0)
	{
		w-=tab[1];
		wynik++;
	}
	cout<<wynik;
}

Measured memory_bytes: 256
from math import pi,sin,cos

a,b,h,m = map(int, input().split())

#時針の角度
h = h + m/60
theta = 2*pi/12*h

#分針の角度
phi = 2*pi/60*m

dx = a * cos(theta) - b * cos(phi)
dy = a * sin(theta) - b * sin(phi)
dis = ((dx**2)+(dy**2))**0.5
print(dis)

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

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

int main(){
    string S;
    cin >> S;
    int N = (int)S.size();
    vector<int> count(N, 0);
    //Rの個数についての探索
    rep(i, N){
        if(S[i] == 'R'){
            int R_cnt = 0;
            while(S[i+1] != 'L'){
                R_cnt++;
                i++;
            }
            count[i] += (R_cnt/2);
            count[i+1] += (R_cnt + 2 - 1)/2;
            count[i]++;
            count[i+1]++;
        }
    }
    //Lの個数についての探索
    for(int i = N-1; i >= 0; i--){
        if(S[i] == 'L'){
            int L_cnt = 0;
            while(S[i-1] != 'R'){
                L_cnt++;
                i--;
            }
            count[i] += (L_cnt/2);
            count[i-1] += (L_cnt + 2 - 1)/2;
        }
    }
    rep(i, N) cout << count[i] << endl;
    return 0;
}

Measured memory_bytes: 3816
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int main()
{
  string str;
  cin>>str;
  int n=str.length();
  if(str[n-1]=='s')
  {
    str=str+"es";
  }
  else
  {
    str=str+"s";
  }
  cout<<str<<endl;
 return 0; 
}

Measured memory_bytes: 3636
def main():
    import sys
    import collections
    
    N, X, Y = map(int, sys.stdin.readline().split())
    
    dist_list = []
    
    if X == 1 and Y == N:
        for i in range(1, N):
            for j in range(i + 1, N + 1):
                dist = min(j - i, N - j + i)
                dist_list.append(dist)
        
        c = collections.Counter(dist_list)
        for i in range(1, N):
            print(c[i])
    
    else:
        for i in range(1, N):
            for j in range(i + 1, N + 1):
                if j <= X or i >= Y:
                    dist_list.append(j - i)
                else:
                    dist = min(j - i, abs(X - i) + abs(j - Y) + 1)
                    dist_list.append(dist)
                    
        
        c = collections.Counter(dist_list)
        for i in range(1, N):
            print(c[i])
            
if __name__ == '__main__':
    main()


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

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

using ll = long long;
using P = pair<int,int>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1<<30;
const ll mod = 1000000007LL;

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

int main(){
    ll N;
    cin>>N;
    ll ans = 0;
    for(ll i = 1;i*i<=N;i++){
        ans += i*i;
    }
    for(ll i = 1; i* i<N; i++){
        ll t = N/i;
        ans += i*(i+1+t)*(t-i);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3688
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#define fi first
#define se second
#define pb(i) push_back(i)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define mes(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 1e6+10;
const int INF = 0x3f3f3f3f;
const int inf = - INF;
const int mod = 1e9+7;
const double pi = acos(-1.0);


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

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

int main()
{ 
    int n; 
	cin >> n; 
	int a[n];

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

    int f,count=0;

    do {
      f = 0;
      for (int i=0; i<n; i++)
	  { 
	      if (a[i]%2==0)
		  {
              a[i] = a[i]/2;
          }
          else {
              f = 1; 
			  break;
          }
    }
        if (f==0) count++; 
	} while (f==0);

    cout << count << endl; 
	return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
    string week[7] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    string a;
    cin >> a;
    for (int i = 0; i < 7; ++i) {
        if (week[i] == a) {
            cout << (7 - i);
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

int main()
{
  char s[10],t[10],u[10];
  int a,b;
  scanf("%s %s %d %d %s",s,t,&a,&b,u);
  if(strcmp(s,u)==0)
    a-=1;
  else
    b-=1;
  printf("%d %d",a,b);
  return 0;
}

Measured memory_bytes: 128
lst = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
i = int(input())
print(lst[i - 1])

Measured memory_bytes: 3060
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN=(int)1e5+10;
int N,L,T,X,W;int a[MAXN],m;
int main (){
    scanf ("%d%d%d",&N,&L,&T);
    for (int tp=N-1;tp>=0;tp--){
        scanf ("%d%d",&X,&W);
        if (W==2) W=-1;
        int tpp=X+T*W;
        a[N-1-tp]=((tpp%L)+L)%L;
        m+=tpp/L;if (tpp%L<0)m--;
    }m=((m%N)+N)%N;sort(a,a+N);
    for (int i=m;i<N;i++){
        printf("%d\n",a[i]);
    }for (int i=0;i<m;i++){
        printf("%d\n",a[i]);
    }return 0;
}

Measured memory_bytes: 1536
n,m=map(int,input().split())
MOD=10**9+7 
from math import factorial as f 
ans=f(n)%MOD 
ans=ans*(f(m)%MOD)
ans=ans%MOD 
if n==m:
    ans=ans*2 
    ans%=MOD 
if abs(m-n)==1:
    ans=ans 
if abs(m-n)>1:
    ans=0 
print(ans)

Measured memory_bytes: 47324
#include<cstdio>
#include<algorithm>
struct Element{
    int id;
    long long value;
    Element(){}
    Element(int id,long long value):id(id),value(value){}
};
long long x[200005][2];
Element b[400005];
int vis[200005];

long long min(long long a,long long b){ return a>b?b:a; }

long long max(long long a,long long b){ return a>b?a:b; }

int main(){
    int n;
    scanf("%d",&n);
    long long minn = 1e13+7, maxn = -1;
    long long minn1 = 1e13+7, maxn0 = -1;
    int size = 0;
    for(int i = 1; i <= n; i++){ 
        scanf("%lld%lld",&x[i][0],&x[i][1]);
        if(x[i][0]>x[i][1]){
            long long cur = x[i][0];
            x[i][0] = x[i][1];
            x[i][1] = cur;
        }
        b[++size] = Element(i,x[i][0]);
        b[++size] = Element(i,x[i][1]);
        if(minn>x[i][0]) minn = x[i][0];
        if(maxn<x[i][1]) maxn = x[i][1];
        if(minn1>x[i][1]) minn1 = x[i][1];
        if(maxn0<x[i][0]) maxn0 = x[i][0];
    }
    long long ans = (maxn0-minn)*(maxn-minn1);
    //printf("ans = %lld\n",ans);
    //below is wrong
    std::sort(b+1,b+1+size,[&](Element& u,Element& v){
        return u.value<v.value;
    });
    long long curMaxn = maxn0;
    int p = 1;
    while(p<=size){
        long long offer = (curMaxn-b[p].value)*(maxn-minn);
        if(ans>offer) ans = offer;
        int np = p;
        while(np+1<=size && b[np+1].value==b[p].value) np++;
        int ok = 1;
        for(int i = p; i <= np ;i++){
            if(vis[b[i].id]) ok = 0;
            else{ 
                vis[b[i].id] = 1;
                curMaxn = max(curMaxn,x[b[i].id][1]);
            }
        }
        if(!ok) break;
        else p = np+1;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 11884
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VRSORT(v) sort(v.begin(), v.end(),greater<int>());
#define INF 999999999
#define MOD 1000000007
#define M_PI 3.14159265358979323846
#define ALL(X) (X).begin(),(X).end()

#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }


int N,Q;
map<int,vector<int> > toList;
map<int,vector<int> > subTree;
vector<int> P,X;
vector<int> TreeNum;

void input(){
  fast_io();
  #ifdef __LOCAL
    fs::path p = __FILE__;
    fs::path input,output;
    input = output = p.parent_path();
    input += string("/input/") + string(p.stem()) + string(".txt");
    output += string("/output/") + string(p.stem()) + string(".txt");
    freopen(input.c_str(), "r", stdin);
    freopen(output.c_str(), "w", stdout);
  #endif
  cin >> N >> Q;
  REP(_,N-1){
    int a,b;
    cin >> a >> b;
    a--,b--;
    toList[a].push_back(b);
    toList[b].push_back(a);
  }

  P.assign(Q,0);
  X.assign(Q,0);
  REP(i,Q){
    cin >> P[i] >> X[i];
    P[i]--;
  }

}

void addNum(int p, int x){
  TreeNum[p] += x;
  // for(auto y:toList[p]) addNum(y,x);
}

vector<bool> visited;

void bfs(int x){
  visited[x] = true;
  for(auto elem:toList[x]) {
    if(visited[elem]) continue;
    else{
      TreeNum[elem] += TreeNum[x];
      bfs(elem);
    }
  }
}

int solve(){
  input();
  visited.assign(N,false);
  TreeNum.assign(N,0);

  REP(i,Q){
    addNum(P[i],X[i]);
  }
  bfs(0);
  cout << TreeNum << endl;
  return 0;
}

int main()
{
  solve();
  return 0;
}


Measured memory_bytes: 42368
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

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

const int INF = 1 << 30;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int month[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

bool leap(int y)
{
	return ((y%4==0&&y%100!=0)||y%400==0);
}

#define debug(a, b, c) for(int i = 0; i < b; i++){for(int j = 0; j < c; j++){printf("%3d", a[i][j]);}puts("");}puts("-----------------------------------------");

int main()
{
	int month, day, res;
	string week[] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
	while(cin >> month >> day)
	{
		int year = 2004;
		if(!month && !day) break;
		if(month == 1 || month == 2)
		{
			year--;
			month += 12;
		}
		res = (5*year/4 - year/100 + year/400 + (26*month + 16)/10 + day) % 7;
		cout << week[res] << endl;
	}
}

Measured memory_bytes: 1196
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>  
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
	long long n, k;
	cin >> n >> k;
	if (n > k) {
		cout << 0 << endl;
	}
	else {
		long long ans = 1;
		for (long long i = 0; i < n; ++i) {
			ans *= (k - i);
			ans %= MAX_MOD;
		}
		cout << ans << endl;
	}
	return 0;
}



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

int main()
{
    ll n,a,b,c,cnt=0,m=0;
    cin>>n>>a;
    for(int i=1; i<n; i++)
    {
        cin>>b;
        if(a>=b)
            cnt++;
        else
            cnt=0;
        a=b;
        if(cnt>m)
            m=cnt;
    }
    cout<<m<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,double> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	ll n, l;
	cin>>n>>l;
	deque<P> q;
	double s = 0.0;
	cout.precision(20);
	rep(i, n){
		double t;
		ll v;
		cin>>t>>v;
		if(i){
			ll e = v;
			while(e>0){
				P p = q.front(); q.pop_front();
				ll d = min(e, p.fst);
				e -= d;
				s -= d*p.snd;
				if(p.fst-d>0) q.push_front(P(p.fst-d, p.snd));
			}
		}
		s += v*t;
		while(!q.empty() && q.back().snd>t){
			P p = q.back();
			ll v2 = v+p.fst;
			double t2 = (v*t+p.fst*p.snd)/v2;
			v = v2;
			t = t2;
			q.pop_back();
		} 
		q.push_back(P(v, t));
		cout<<s/l<<endl;
	}
	return 0;
}


Measured memory_bytes: 19088
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef complex<double> xy_t;

const lint mod = 1e9 + 7;

int main(){
    int h, w, d;
    scanf("%d%d%d", &h, &w, &d);
    pii pos[h*w];
    rep(i, h)rep(j, w){
        int a;
        scanf("%d", &a);
        pos[a-1] = pii(i, j);
    }
    int dist[h*w];
    rep(i, h*w){
        if(i < d) dist[i] = 0;
        if(i+d < h*w){
            dist[i+d] = abs(pos[i+d].fi - pos[i].fi) + abs(pos[i+d].se - pos[i].se) + dist[i];
        }
    }
    
    int q;
    scanf("%d", &q);
    while(q--){
        int l, r;
        scanf("%d%d", &l, &r);
        printf("%d\n", dist[r-1] - dist[l-1]);
    }
}

Measured memory_bytes: 2176
n = int(input())
a = []
temp = 0
temp_num = -1
ans = 0
t = []
for i in range(1, n+1):    
    k = int(input())
    if ((i - temp_num) <= 1) & (temp > 0):
        min_k = min(k, temp)
        ans += min_k
        temp = k - min_k
        ans += (temp // 2)
        temp -= (temp // 2) * 2
        temp_num = i
    else:
        temp = k
        temp_num = i
        ans += (temp // 2)
        temp -= (temp // 2) * 2
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    string s,t;
    cin>>s>>t;
    ll ans=t.size();
    for (ll i=0; i<=s.size()-t.size(); i++)
    {
        ll t_ans=0;

        for (ll j=0; j<t.size(); j++)
        {
            if (t[j]!=s[i+j]) t_ans++;
        }
        ans=min(t_ans,ans);
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 3540
#include<bits/stdc++.h>
using namespace std;
int a[200005];
int main()
{
	int n;
	int maxf=-1, maxt=-1;
	int cnt=0;
	cin >> n;
	for (int i=1;i<=n;i++){
		cin >> a[i];
		if (a[i]>maxf) maxt=maxf,maxf=a[i],cnt=1;
		else if (a[i]==maxf) cnt++;
		else if (a[i]>maxt) maxt=a[i];
	}
	for (int i=1;i<=n;i++){
		if (a[i]==maxf&&cnt==1) cout << maxt;
		else cout << maxf;
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 2432
#include<stdio.h>
#include<stdlib.h>
struct tree {
  int data;
  struct tree *left;
  struct tree *right;
};
struct tree *sentinel, *root;
int Search(struct tree*, int);
struct tree *Insert(struct tree*, int);
struct tree *Alsearch(struct tree**);
struct tree *Remove(struct tree**, int);
void Dispm(struct tree*);
void Dispp(struct tree*);
int main(void)
{
  int i, count, key;
  char command[7];
  sentinel = (struct tree*)malloc(sizeof(struct tree));
  root = sentinel;
  scanf("%d", &count);
  for (i = 0; i < count; i++) {
    scanf("%*c%s", command);
    switch (command[0]) {
    case 'f':
      scanf(" %d", &key);
      sentinel -> data = key;
      if (Search(root, key)) {
        printf("yes\n");
      } else {
        printf("no\n");
      }
      break;
    case 'i':
      scanf(" %d", &key);
      sentinel -> data = key;
      root = Insert(root, key);
      break;
    case 'd':
      scanf(" %d", &key);
      sentinel -> data = key;
      Remove(&root, key);
      break;
    case 'p':
      Dispm(root);
      putchar('\n');
      Dispp(root);
      putchar('\n');
      break;
    }
  }
  return 0;
}
int Search(struct tree *p, int key)
{
  if (p -> data > key) {
    return Search(p -> left, key);
  } else if (p -> data < key){
    return Search(p -> right, key);
  }
  if (p == sentinel) return 0;
  else return 1;
}
struct tree *Insert(struct tree *p, int key)
{
  struct tree *q;
  if (p -> data > key) {
    p -> left = Insert(p -> left, key);
  } else if (p -> data < key) {
    p -> right = Insert(p -> right, key);
  }
  else {
    q = (struct tree*)malloc(sizeof(struct tree));
    q -> data = key;
    q -> left = sentinel;
    q -> right = sentinel;
    return q;
  }
  return p;
}
struct tree *Alsearch(struct tree **p)
{
  if ((*p) -> left == sentinel) {
    struct tree *tmp = *p;
    *p = (*p) -> right;
    return tmp;
  } else {
    return Alsearch(&(*p) -> left);
  }
}

struct tree *Remove(struct tree **p, int key)
{
  if ((*p) -> data > key) {
    (*p) -> left = Remove(&(*p) -> left, key);
  } else if ((*p) -> data < key) {
    (*p) -> right = Remove(&(*p) -> right, key);
  } else {
    struct tree *tmp = *p;
    if (*p == sentinel) return sentinel;
    if ((*p) -> right == sentinel) {
      *p = (*p) -> left;
      free(tmp);
    }else if ((*p) -> left == sentinel) {
      *p = (*p) -> right;
      free(tmp);
    } else {
      struct tree *alter = Alsearch(&(*p) -> right);
      alter -> left = (*p) -> left;
      alter -> right = (*p) -> right;
      *p = alter;
      free(tmp);
    }
  }
  return *p;
}
void Dispm(struct tree *p)
{
  if (p != sentinel) {
    Dispm(p -> left);
    printf(" %d", p -> data);
    Dispm(p -> right);
  }
}
void Dispp(struct tree *p)
{
  if (p != sentinel) {
    printf(" %d", p -> data);
    Dispp(p -> left);
    Dispp(p -> right);
  }
}


Measured memory_bytes: 14280
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/irange.hpp>
#include "bits/stdc++.h"

namespace adaptor = boost::adaptors;

struct Node {
    int64_t key;
    Node *next, *prev;
};

Node *nil;

Node *listSearch(int64_t key) {
    Node *cur = nil->next;
    while (cur != nil && cur->key != key) {
        cur = cur->next;
    }
    return cur;
}

void init() {
    nil = (Node *)malloc(sizeof(Node));
    nil->next = nil;
    nil->prev = nil;
}

void printList() {
    Node *cur = nil->next;
    int64_t isf = 0;
    while (true) {
        if (cur == nil) break;
        if (isf > 0) std::cout << " ";
        std::cout << cur->key;
        cur = cur->next;
        isf++;
    }
    std::cout << std::endl;
}

void deleteNode(Node *t) {
    if (t == nil) return;
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst() { deleteNode(nil->next); }

void deleteLast() { deleteNode(nil->prev); }

void deleteKey(int64_t key) { deleteNode(listSearch(key)); }

void insert(int64_t key) {
    Node *x = (Node *)malloc(sizeof(Node));
    x->key = key;
    x->next = nil->next;
    nil->next->prev = x;
    nil->next = x;
    x->prev = nil;
}

void solve() {
    int64_t key, n;
    int64_t size = 0;
    char command[20];
    int64_t np = 0, nd = 0;
    std::cin >> n;
    init();
    for (int64_t i = 0; i < n; i++) {
        std::cin >> command;
        if (strlen(command) <= 6) std::cin >> key;
        if (command[0] == 'i') {
            insert(key);
            np++;
            size++;
        } else if (command[0] == 'd') {
            if (strlen(command) > 6) {
                if (command[6] == 'F') {
                    deleteFirst();
                } else if (command[6] == 'L') {
                    deleteLast();
                }
            } else {
                deleteKey(key);
                nd++;
            }
            size--;
        } else {
            std::cout << "Invalid command" << std::endl;
        }
    }

    printList();
    return;
}

int main() {
    std::cin.tie(0);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    solve();
}



Measured memory_bytes: 34364
#include <iostream>

using namespace std;

int main(){
	int a, b, c;

	cin >> a >> b >> c;

	bool poor = false;

	if(a == b && a != c)
		poor = true;
	else if(a != b && a == c)
		poor = true;
	else if(b == c && a != c)
		poor = true;

	if(poor)
		cout << "Yes\n";
	else
		cout << "No\n";
}

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

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    int weightL = A + B;
    int weightR = C + D;

    if(weightL > weightR) cout << "Left" << endl;
    else if(weightL < weightR) cout << "Right" << endl;
    else cout << "Balanced" << endl;

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)
int main(){
    string s;
    cin>>s;
    REP(i,s.size()){
        if(s[i]==',')s[i]=' ';
    }
    cout<<s<<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    int INF = Integer.MAX_VALUE;

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N=sc.nextInt();
        int[] L=new int[2*N];
        for(int i=0;i<2*N;i++){
            L[i]=sc.nextInt();
        }
        Arrays.sort(L);
        int ans=0;
        for(int i=0;i<2*N;i+=2){
            ans+=L[i];
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21076
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cstdio>
#include<cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define debug(output) cout<<#output<<"= "<<output<<endl
using lint=long long;
int MOD=1000000007;
int inf=1e9+7;
int calc(string const& sub,string const& t){
    int n=sub.length();
    int res=0;
    rep(i,n){
        if(sub[i]!=t[i])++res;
    }
    return res;
}
signed main(){
    string s,t;cin>>s;
    cin>>t;
    int res=inf;
    int sLen=s.length();
    int tLen=t.length();
    rep(i,sLen-tLen+1){
        string sub=s.substr(i,tLen);
        res=min(res,calc(sub,t));
    }
    cout<<res<<"\n";
    return 0;
}

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

#define ll long long int
#define mod 1000000007

#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;


int main()
{  
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    string s;
    cin>>n;
    cin>>s;
    //R..G..B
    //0..1..2
    vector<vector<int>> dp(n,vector<int>(3));
    for(int i=0;i<n;i++){
		for(int j=0;j<3;j++){
			dp[i][j]=(i==0)?0:dp[i-1][j];
		}
		if(s[i]=='R')dp[i][0]++;
		else if(s[i]=='G')dp[i][1]++;
		else dp[i][2]++;
	}
	
    ll ans=0;
    
    for(int i=2;i<n;i++){
		for(int j=1;j<i;j++){
			int k=j-(i-j);
			if(s[j]=='G' && s[i]=='B'){
				ans+=dp[j-1][0];
				if(k>=0 && s[k]=='R')ans-=1;
			}
			if(s[j]=='B' && s[i]=='G'){
				ans+=dp[j-1][0];
				if(k>=0 && s[k]=='R')ans-=1;
			}
			if(s[j]=='R' && s[i]=='B'){
				ans+=dp[j-1][1];
				if(k>=0 && s[k]=='G')ans-=1;
			}
			if(s[j]=='B' && s[i]=='R'){
				ans+=dp[j-1][1];
				if(k>=0 && s[k]=='G')ans-=1;
			}
			if(s[j]=='G' && s[i]=='R'){
				ans+=dp[j-1][2];
				if(k>=0 && s[k]=='B')ans-=1;
			}
			if(s[j]=='R' && s[i]=='G'){
				ans+=dp[j-1][2];
				if(k>=0 && s[k]=='B')ans-=1;
			}
		}
	}
	cout<<ans<<"\n";
}
    



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

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

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

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    lint A, B, C;
    cin >> A >> B >> C;
    if (C <= A + B) {
        cout << "No";
    } else {
        C -= A + B;
        C *= C;
        cout << (C > 4 * A * B ? "Yes" : "No");
    }
    cout << endl;
    return 0;
};

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<limits.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int> v(n*2);
	int min = INT_MAX;
	int max = INT_MIN;
	long sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> v[i];
		sum += v[i];
		if (max < v[i])
			max = v[i];
		if (min > v[i])
			min = v[i];
	}
	cout << min << " " << max << " " << sum << endl;



	//cin >> n;

	return 0;
}


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

vector<ll> po(19,1);

ll calc(int i,int j,ll e){
    if (j>i-1-j) return (e==0?1:0);
    ll res=0;
    int diff=(j==i-1-j?0:e/(po[i-1-j]-po[j]));
    for (ll d=diff-1;d<=diff+1;++d){
        if (j==i-1-j&&d!=0) continue;
        ll ne=e-(po[i-1-j]-po[j])*d;
        if (ne<-(po[i-1-j]-po[j])||po[i-1-j]-po[j]<ne) continue;
        for (int k=(!j?1:0),cnt=0;k<10;++k){
            if (k+d>=0&&k+d<10) ++cnt;
            if (k==9) res+=calc(i,j+1,ne)*cnt;
        }
    }
    return res;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    for (int i=0;i<18;++i) po[i+1]=po[i]*10;
    int D; cin >> D;
    ll ans=0;
    for (int i=2;i<=19;++i){
        ans+=calc(i,0,D);
    }
    cout << ans << '\n';
}

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



l = []

min_a = N + abs(L) * N * N + N


for i in range(N):
    a = L + i - 1 + 1

    if abs(a) < abs(min_a):
        min_a = abs(a)
        ans_i = i



    l.append(a)


ans = sum(l) - l[ans_i]

print(ans)


Measured memory_bytes: 3060
#include <algorithm>
#include<iostream>
#include<vector>
#include<string>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;
int main(){
  string s[3];
  for(int ii=0;ii<3;ii++){
	cin >> s[ii];
	cout << s[ii][ii];
  }
  cout << endl;
  
  return 0;
}


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

using namespace std;

const int N(1005);
const int dx[] {0,  0, 1, -1};
const int dy[] {1, -1, 0,  0};

int n, m, a, b, c, d, dp[N][N], x, y;
char mat[N][N];
priority_queue < tuple < int , int , int > > Q;

inline bool Inside (int X, int Y) {
  if (X < 1 || X > n || Y < 1 || Y > m)
    return false;
  return true;
}

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> n >> m >> a >> b >> c >> d;
  for (int i = 1; i <= n; ++i)
    cin >> (mat[i] + 1);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      dp[i][j] = 1e9;
  dp[a][b] = 0;
  Q.emplace (0, a, b);
  while (!Q.empty()) {
    tie (ignore, x, y) = Q.top();
    Q.pop();
    int xv, yv;
    for (int dir = 0; dir < 4; ++dir) {
      xv = x + dx[dir];
      yv = y + dy[dir];
      if (Inside(xv, yv) && mat[xv][yv] == '.' && dp[xv][yv] > dp[x][y]) {
        dp[xv][yv] = dp[x][y];
        Q.emplace(-dp[xv][yv], xv, yv);
      }
    }
    for (xv = x - 2; xv <= x + 2; ++xv)
      for (yv = y - 2; yv <= y + 2; ++yv)
        if (Inside(xv, yv) && mat[xv][yv] == '.' && dp[xv][yv] > dp[x][y] + 1) {
          dp[xv][yv] = dp[x][y] + 1;
          Q.emplace(-dp[xv][yv], xv, yv);
        }
    }
  if (dp[c][d] == 1e9)
    dp[c][d] = -1;
  cout << dp[c][d];
}


Measured memory_bytes: 8612
s = input()
y = int(s[:4])
m = int(s[5:7])
d = int(s[8:10])
if y > 2019:
  print("TBD")
elif y < 2019:
  print("Heisei")
else:
  if m > 4:
    print("TBD")
  else:
    print("Heisei")

Measured memory_bytes: 3060
import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    static long[] primeFactors;
    public static void main(String[]$) {
        int n = scanner.nextInt();
        primeFactors = new long[n];
        for (int i = 2; i <= n; i++) {
            for (int j = 2, c = i; j <= i && c != 1; j++) {
                while (c % j == 0) {
                    primeFactors[j - 1]++;
                    c /= j;
                }
            }
        }
        System.out.println(count(75) + count(25) * (count(3) - 1) + count(15) * (count(5) - 1) + count(5) * (count(5) - 1) * (count(3) - 2) / 2);
    }

    static long count(int n) {
        return Arrays.stream(primeFactors).filter(i -> i >= n - 1).count();
    }
}

Measured memory_bytes: 28756
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <numeric>
#include <vector>
#include <set>
#include <algorithm>
#include <queue>
#include <string>

using namespace std;

typedef long long ll;

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (int i = a; i < b; i++)
#define vec_all(vec) vec.begin(), vec.end()

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

    priority_queue<int, vector<int>, greater<int> > top_que;
    priority_queue<int> bottom_que;
    vector<int> middle(n);

    ll init_top_sum = 0;
    ll init_bottom_sum = 0;

    int tmp;
    rep(i, n) {
        cin >> tmp;
        top_que.push(tmp);
        init_top_sum += tmp;
    }

    rep(i, n) {
        cin >> tmp;
        middle[i] = tmp;
    }

    rep(i, n) {
        cin >> tmp;
        bottom_que.push(tmp);
        init_bottom_sum += tmp;
    }

    vector<ll> top_scores(n + 1);
    top_scores[0] = init_top_sum;
    
    rep(i, n) {
        top_que.push(middle[i]);
        tmp = top_que.top();
        top_que.pop();
        top_scores[i + 1] = top_scores[i] - tmp + middle[i];
    }

    vector<ll> bottom_scores(n + 1);
    bottom_scores[n] = init_bottom_sum;

    for (int i = n - 1; i >= 0; i--) {
        bottom_que.push(middle[i]);
        tmp = bottom_que.top();
        bottom_que.pop();
        bottom_scores[i] = bottom_scores[i + 1] - tmp + middle[i];
    }

    ll score = -(1LL<<60);
    ll diff;
    rep(i, n + 1) {
        diff = top_scores[i] - bottom_scores[i];
        if (diff > score) {
            score = diff;
        }
    }

    cout << score << endl;

    return 0;
}


Measured memory_bytes: 3064
#include <stdio.h>
int main(void){
    int a,b,c;
    int tem;
    int i;
    
    while( scanf("%d %d",&a,&b) !=EOF){
        c = a+b;
        tem=0;
        i=1000000;
        while(i>=10){
            if(c>=i){
                tem+=1;
            }
            i/=10;
        }
        printf("%d\n",tem+1);
        tem=0;
    }
 
   return 0;
}



Measured memory_bytes: 1976