akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define debug(x) cout <<"DEBUG"<<" "<<#x<<":"<<x<<'\n'

//↓0-originか1-originでn回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   //0-origin昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) //1-origin昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  //0-origin降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   //1-origin降順
//rep2 -> 第二引数 m から n 回繰り返し ex) m=5 n=3 なら i=5,i=6,i=7 まで
#define rep2(i,m,n) for(int i = ((int)(m)); i < ((int)(n))+((int)(m)); i++)
#define SIZE(x) ((int)((x).size()))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;
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;}


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


const ld pi = 3.14159265358979323846264338327950;

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

    long double a, b, x; cin >> a >> b >> x;
    if((a*a*b)/2 < x) {
        ld ans =  atan(2*(b*a*a - x)/(a*a*a));
        cout << ans*180./(pi) << '\n';
    }
    else if((a*a*b) == 2*x) {
        ld ans = (atan(b/a));
        cout << ans*180./(pi) << '\n';
    }
    else {
        ld ans=  atan((a*b*b)/(2*x));
        cout << ans*180./(pi) << '\n';
    }
}

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

void swlong(long *max, long *min)
{
    long mid;

    if (*max<*min){
        mid=*max;
        *max=*min;
        *min=mid;
    }
}
int main(void)
{
    long x,y,z;

    scanf("%ld", &x);
    scanf("%ld", &y);
    swlong(&x,&y);
    do {
        z = x % y;
        x = y;
        y = z;
    }while(z);
    printf("%ld\n", x);
    return 0;
}

Measured memory_bytes: 592
package main

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

var sc *bufio.Scanner

func nextString() string {
	sc.Scan()
	i := sc.Text()
	return i
}

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

const MaxQueue = 100001

type Process struct {
	name string
	time int
}

type Queue struct {
	q    [MaxQueue]Process
	head int
	tail int
}

func (a *Queue) isEmpty() (r bool) {
	if a.head == a.tail {
		r = true
	} else {
		r = false
	}
	return r
}

func (a *Queue) enqueue(name string, time int) {
	a.q[a.tail].name, a.q[a.tail].time = name, time
	a.tail++
	if a.tail == MaxQueue {
		a.tail = 0
	}
}

func (a *Queue) dequeue() (string, int) {
	name, time := a.q[a.head].name, a.q[a.head].time
	a.head++
	if a.head == MaxQueue {
		a.head = 0
	}
	return name, time
}

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n := nextInt()
	q := nextInt()
	var que Queue
	var now int
	for i := 0; i < n; i++ {
		name, time := nextString(), nextInt()
		que.enqueue(name, time)
	}

	for !(que.isEmpty()) {
		name, time := que.dequeue()
		if time <= q {
			now += time
			fmt.Println(name, now)
		} else {
			now += q
			time -= q
			que.enqueue(name, time)
		}
		// fmt.Println(now)
	}

}



Measured memory_bytes: 5280
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n;
  cin >> n;
  long long a[n],b[n];
  pair<long long, long long> p[n];
  for(int i=0;i<n;i++){
    cin >> a[i] >> b[i];
    p[i]=make_pair(b[i], a[i]);
  }
  sort(p,p+n);
  long long time=p[0].first;
  for(int i=0;i<n;i++){
    if(i>0){
      time+=p[i].first-p[i-1].first;
    }
    time-=p[i].second;
    if(time<0){
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
  return 0;
}

Measured memory_bytes: 6528
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		int M = scan.nextInt();
		int[] s = new int[M+1];
		int[] c = new int[M+1];
		boolean f = true;

		for (int i = 1; i < M+1; i++) {
			s[i] = scan.nextInt();
			c[i] = scan.nextInt();
		}

		if (N == 1) {
			for (int i = 1; i < M; i++) {
				if (c[i] != c[i+1]) {
					f = false;
				}
			}

			if (f && M == 0) System.out.println(0);
			else if (f) System.out.println(c[1]);
			else System.out.println(-1);

		} else {
			int[] ans = new int[N+1];
			boolean[] vst = new boolean[N+1];
			ans[1] = 1;

			for (int i = 1; i < M+1; i++) {
				if (!vst[s[i]]) {
					vst[s[i]] = true;
					ans[s[i]] = c[i];
				} else if (c[i] != ans[s[i]]) {
						f = false;
						break;
				}
			}

			if (!f || ans[1] == 0) {
				System.out.println(-1);
			} else {
				for (int i = 1; i < N+1; i++) {
					System.out.print(ans[i]);
				}
			}

		}

	}

}


Measured memory_bytes: 35664
n = int(input())
a = list(map(int, input().split()))
o, t, f = 0, 0, 0
for x in a:
	if (x & 1) == 1:
		o = o + 1
	elif (x & 3) == 2:
		t = t + 1
	else:
		f = f + 1

possible = (t == 0 and f >= o - 1) or (f >= o)
if possible:
	print("Yes")
else:
	print("No")



Measured memory_bytes: 14252
n,m,l =[int(i)for i in input().split()]

A=[]
B=[]
C=[]

for ni in range(n):
    A.append([int(i) for i in input().split()])

for mi in range(m):
    B.append([int(i)for i in input().split()])


for  i in range(n):
    C.append([])
    for j in range(l):
        C[i].append(0)
        for k in range(m):
            C[i][j] += A[i][k] * B[k][j]

for ni in range(n):
    print(" ".join([str(s) for s in C[ni]]))

Measured memory_bytes: 8888
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    int n;
    cin >> n;
    set<int> st;
    for(int i = 0;i < n;i++)
    {
        int a;
        cin >> a;
        st.insert(a);
    }
    if(st.size() == n)
    {
        cout << "YES\n";
    }
    else
    {
        cout << "NO\n";
    }
    
    return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353,INF=1e18;



int main() {
    string S;
    cin>>S;
    if(S=="ABC")cout<<"ARC"<<endl;
    if(S=="ARC")cout<<"ABC"<<endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vpii = vector<pair<int,int>>;
using vpll = vector<pair<ll,ll>>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int) n;i++)
#define rep1(i,m,n) for(int i=(int) m;i<(int) n;i++)
#define fix(n) cout << fixed << setprecision((int)n)

void absll(ll &x) {
    if(x>=0) return ;
    else x=-x; return;
}

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 ll INF = 1LL << 60;

int N;

//DPテーブル
vector<ll> dp(100010);

int main() {
    int S,W;
    cin >> S >> W;
    if(S<=W) cout << "unsafe" << endl;
    else cout << "safe" << endl;
}

Measured memory_bytes: 3900
q,h,s,d=map(int,input().split())
n=int(input())
if n==1:print(min(4*q,2*h,s))
elif n%2:print((n-1)//2*min(8*q,4*h,2*s,d)+min(4*q,2*h,s))
else:print(n//2*min(8*q,4*h,2*s,d))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,a;
    cin>>n;
    int all=pow(3,n);
    int tmp=1;
    for (int i=0;i<n;i++) {
        cin>>a;
        if (a%2==1) {
            tmp*=1;
        } else {
            tmp*=2;
        }
    }
    cout<<all-tmp<<endl;
}

Measured memory_bytes: 4056
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector
;
#define vvec(s) vector<vector
> ;
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define all(s) s.begin(),s.end()
void vout(vector<int> v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    lli n,a,b,ans=0;
    cin>>n>>a>>b;
    for(lli i=1;i<=n;i++){
        lli num=0;
        lli o,t,s,f,l;
        o=t=s=f=l=0;
        o=i%10;
        t=(i%100-o)/10;
        if(t<0) t=0;
        s=(i%1000-10*t-o)/100;
        if(s<0) s=0;
        f=(i%10000-100*s-10*t-o)/1000;
        if(f<0) f=0;
        l=i/10000;
        num=o+t+s+f+l;
        if(num>=a&&num<=b) ans+=i;
    }
    out(ans);
}

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

#define vec                vector<int>
#define vecll              vector<ll>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>> var(n, vector<int>(m, 0))
#define vecll2(var, n, m)  vector<vector<ll>> var(n, vector<ll>(m, 0))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define mp(v1, v2)       make_pair(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << var;
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "Yes" : "No");}
//----------------------------------------------------------------

int main(void) {
  double a, b, h, m;
  cin >> a >> b >> h >> m;

  double a_hour = h * 30. + m/2.;
  double a_min = (double) m * 6.;

  double ans = (double) a*a + b*b;
  ans -= 2*a*b*cos(abs(a_hour-a_min)/360.0*2*M_PI);
  ans = sqrt(ans);

  prtd(15, ans);

}


Measured memory_bytes: 4276
#include<bits/stdc++.h>
  
#define lol long long
#define gcd(x,y) __gcd(x,y)
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define fixed(x) fixed<<setprecision(x)
using namespace std;
using pii=pair<int,int>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
template <class A> inline A abs(A &a) { return (a < 0 ? -a : a); }
bool inLine(int x,int y,int mx,int my){return (x>=0&&y>=0&&x<mx&&y<my);}
const lol inf=(1LL<<62);
const lol MOD=(1e9)+7;
const lol mod=998244353;
const int dx[]={1,0,-1,0,1,1,-1,-1};
const int dy[]={0,1,0,-1,1,-1,1,-1};
lol n,m,k,r;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  lol a,b,c;
  cin >>a>>b>>c;
  cin >>k;
  bool yes=false;
  if((b>a)&&(c>b)) yes=true;
  for(int i=0;i<k;i++){
    if(c<=b) c*=2;
    else if(b<=a) b*=2;
    if((b>a)&&(c>b)) yes=true;
  }
  if(yes) cout <<"Yes\n";
  else cout <<"No\n";

  return(0);
}

Measured memory_bytes: 3648
#include<iostream>
#include<cstdio>
#include <map>
using namespace std;
int main(){
	int N;
	cin>>N;
	string s[101];
	for(int i=0;i<N;i++)
		cin >> s[i];
	int M;
	cin >>M;
	string t[101];
	for(int i=0;i<M;i++)
		cin>>t[i];
	map<string,int> count;
	for(int i=0;i<N;i++){
		count[s[i]]++;
	}
	for(int j=0;j<M;j++){
			count[t[j]]--;
	}
	int max=0;
	for(int i=0; i<N;i++){
		if(max <count[s[i]])
			max=count[s[i]];
  }
	printf("%d\n",max);
	return 0;
}

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

#define p_ary(ary,a,b,i) do { cout << "["; for (int i = a;i <= b;++i) cout << ary[i] << (b == i ? "]\n" : ", "); } while(0)
#define p_map(map,it) do {cout << "{";for (auto it = map.begin();;++it) {if (it == map.end()) {cout << "}\n";break;}else cout << "" << it->first << "=>" << it->second << ", ";}}while(0)

int main() {
    int n,a[200010];

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

    int min = 0,max = n,mid;
    while (max-min > 1) {
        mid = min+(max-min)/2;
        bool f = true;
        map<int,int> s;
        for (int i = 1;i < n;++i) {
            if (a[i-1] < a[i]) continue;
            if (mid == 1) {
                f = false;
                break;
            }
            s.erase(s.upper_bound(a[i]),s.end());
            //for (auto it = s.upper_bound(a[i]);it != s.end();++it) it->second = 0;
            for (int j = a[i];j > 0;--j) {
                if (s[j] < mid-1) {
                    s[j]++;
                    s.erase(s.upper_bound(j),s.end());
                    break;
                } else if (j == 1) f = false;
            }
            if (!f) break;
        }
        (f ? max : min) = mid;
    }
    cout << max << endl;
    return 0;
}

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



int main()
{
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    string S;
    cin >> S;
    vector<int> answer(0);
    int point = N;
    while(point > 0){
        int move = min(M, point);
        while(move > 0){
            if(S[point - move] == '0'){
                break;
            }
            move--;
        }
        if(move == 0){
            cout << -1 << endl;
            return 0;
        }
        answer.push_back(move);
        point -= move;
    }
    bool isFirst = true;
    for (auto i = answer.rbegin(), e = answer.rend(); i != e; ++i) {
        if(isFirst){
            isFirst = false;
        }else{
            cout << ' ';
        }
        cout << *i;
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 1096
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;

int main(){
    ll n,x=0,m=0;
    string s;
    cin>>n>>s;
    for(ll i=0;i<n;i++){
        if(s[i]=='I') x++;
        else x--;
        m=max(m,x);
    }
    cout<<m<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> pll;
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define pb push_back
const long double PI = acos(-1);
const long long INF = (1 << 30);
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}


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

  ll k, n;
  cin >> n >> k;
  vector<ll> a(n);
  for(ll i = 0; i < n; i++) cin >> a[i];

  ll cnt = 0;
  ll ans = 0;
  ll index = 0;
  while(1){
    if(index == 0) cnt += k;
    else{
      cnt += k-1;
    }
    ans++;
    index++;
    if(cnt >= n)break;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
S = input()
l = int(S[:2])
r = int(S[2:])
if l == 0 or 13 <= l <= 99:
	a = 0
else:
	a = 1
if r == 0 or 13 <= r <= 99:
	b = 0
else:
	b = 1
if a == 0 and b == 0:
	print('NA')
elif a == 0 and b == 1:
	print('YYMM')
elif a == 1 and b == 0:
	print('MMYY')
else:
	print('AMBIGUOUS')

Measured memory_bytes: 3064
import java.io.IOException;
import java.util.Scanner;

class Main {

	public static void main(String[] args) throws IOException {

		Scanner scane = new Scanner(System.in);

		int H =scane.nextInt();
		int W =scane.nextInt();;

		do {

			for(int i =0; i<H; i++){
				for (int j = 0; j < W; j++) {
					if(i ==0 && j >=0){
						System.out.print("#");
					}else if (i==(H-1) && j >= 0) {
						System.out.print("#");
					}else if (i >= 1 && j ==0) {
						System.out.print("#");
					}else if ( i>=1 && j == (W-1)) {
						System.out.print("#");
					}else {
						System.out.print(".");
					}
				}
				System.out.println();
			}
			System.out.println();

			H = scane.nextInt();

			W= scane.nextInt();


		} while (H !=0 && W !=0);
	}
}

Measured memory_bytes: 34204
#include <stdio.h>

int main()
{
	int i, j, N, C, D[32][32], c[502][502];
	scanf("%d %d", &N, &C);
	for (i = 1; i <= C; i++) {
		for (j = 1; j <= C; j++) scanf("%d", &(D[i][j]));
	}
	for (i = 1; i <= N; i++) {
		for (j = 1; j <= N; j++) scanf("%d", &(c[i][j]));
	}
	
	int count[3][31] = {};
	for (i = 1; i <= N; i++) {
		for (j = 1; j <= N; j++) count[(i+j)%3][c[i][j]]++;
	}
	
	int k, l, min = 1 << 30, tmp;
	for (i = 1; i <= C; i++) {
		for (j = 1; j <= C; j++) {
			if (j == i) continue;
			for (k = 1; k <= C; k++) {
				if (k == i || k == j) continue;
				for (l = 1, tmp = 0; l <= C; l++) tmp += D[l][i] * count[0][l] + D[l][j] * count[1][l] + D[l][k] * count[2][l];
				if (tmp < min) min = tmp;
			}
		}
	}
	
	printf("%d\n", min);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 2668
#include <stdio.h>
int main()
{
 int H,A,b;
 scanf("%d %d",&H,&A);
 if(H%A==0)
 {
 	printf("%d",H/A);
 }
 else 
 {
 	printf("%d",(H/A)+1	);
 }
	return 0;
}

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

int	main() {
	int N;
	cin >>N;
	vector<int> A(N);
	for (int i=0; i<N; i++)
		cin >>A.at(i);
	sort(A.begin(), A.end());
	int P=N/2;
	long S=1;
	if (1==N) {
		if (0==A.at(0))
			cout <<1 <<endl;
		else
			cout <<0 <<endl;
		return 0;
	}
	for (int i=0; i<P; i++) {
		S *=2;
		S %=1000000007;
	}
	if (0==N%2) {
		if (1!=A.at(0))
			S=0;
		if (1!=A.at(1))
			S=0;
	} else {
		if (0!=A.at(0))
			S=0;
		if (2!=A.at(1))
			S=0;
	}
	if (0!=S) {
		for (int i=2; i<N; i++)
			if (2!=A.at(i)-A.at(i-2)) {
				S=0;
				break;
			}
	}
	cout <<S <<endl;
	return 0;
};


Measured memory_bytes: 640
#include<stdio.h>

int main(void) {
	int r,D,x[200],i;
	scanf("%d %d %d", &r, &D, &x[0]);
	for (i = 0; i < 10; i++) {
		x[i + 1] = r * x[i] - D;
		printf("%d\n",x[i+1] );
	}
	return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int onePlace = -1;
        int[] a = new int[n];
        for (int i = 0 ; i < n ; i++) {
            a[i] = sc.nextInt();
            if (onePlace == -1 && a[i] == 1) onePlace = i;
        }

        int min = 100000;

        for (int i = 0 ; i < k ; i++) {
            if (onePlace >= i && onePlace <= n - k + i) {
                int tmp = 1;
                tmp += (onePlace - i) / (k - 1);
                if ((onePlace - i) % (k - 1) != 0) tmp++;

                tmp += (n - onePlace - k + i) / (k - 1);
                if ((n - onePlace - k + i) % (k - 1) != 0) tmp++;

                min = Math.min(tmp,min);
            }
        }
        System.out.println(min);
    }
}

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

int main(void)
{
  	char	s[11];
  	char	t[12];
  	int		i;
  	int		si;
  	int		ti;
  
  	scanf("%s\n", s);
  	scanf("%s", t);
  
  	si = strlen(s);
  	ti = strlen(t);
  
  	if (si + 1 != ti)
    {
        printf("No");
      	return (0);
    }
  	else
    {
      	for(i=0; i<ti - 1; i++)
        {
          	if(s[i] != t[i])
            {
              	printf("No");
              	return (0);
            }
        }
      	printf("Yes");
    }
  	return (0);
}

Measured memory_bytes: 1736
/*input
9
4 2 5 8 3 6 1 7 9
6 8 8 4 6 3 5 7 5
*/
#include<bits/stdc++.h>
using namespace std;
#define F           first
#define S           second
const int N = 2e5+5;
long int dp[N];
long int seg[4*N],lazy[4*N];

void build(int node,int st,int ed)
{
	lazy[node]=0;
	if(st==ed)
	{
		seg[node]=0;
		return ;
	}

	int mid = (st+ed)/2;
	build(2*node,st,mid);
	build(2*node+1,mid+1,ed);
	seg[node]=max(seg[2*node],seg[2*node+1]);
	return ;
}
//[l,r]
void update(int node,int st,int ed,int l,int r,long int val)
{
	if(lazy[node])
	{
		seg[node]=lazy[node];
		if(st!=ed)
		{
			lazy[2*node]=max(lazy[2*node],lazy[node]);
			lazy[2*node+1]=max(lazy[2*node+1],lazy[node]);
		}
		lazy[node]=0;
	}
	if(st>r || ed<l) return ;
	else if(st>=l && ed<=r)
	{
		seg[node]=val;
		if(st!=ed)
		{
			lazy[2*node]=max(lazy[2*node],val);
			lazy[2*node+1]=max(lazy[2*node+1],val);
		}
		return ;
	}
	else
	{
		int mid = (st+ed)/2;
		update(2*node,st,mid,l,r,val);
		update(2*node+1,mid+1,ed,l,r,val);
		seg[node]=max(seg[2*node],seg[2*node+1]);
		return ;
	}

	assert(0);
	return ;
}
//[l,r]
long int query(int node,int st,int ed,int l,int r)
{
	if(lazy[node])
	{
		seg[node]=lazy[node];
		if(st!=ed)
		{
			lazy[2*node]=max(lazy[2*node],lazy[node]);
			lazy[2*node+1]=max(lazy[2*node+1],lazy[node]);
		}
		lazy[node]=0;
	}
	if(st>r || ed<l) return -1;
	else if(st>=l && ed<=r) return seg[node];
	else
	{
		int mid = (st+ed)/2;
		long int v1 = query(2*node,st,mid,l,r);
		long int v2 = query(2*node+1,mid+1,ed,l,r);
		return max(v1,v2);
	}

	assert(0);
	return -1;
}



int main()
{
	int n;cin>>n;
	vector<pair<int,int>> a(n); // {height,beauty}
	for(int i=0;i<n;i++) cin>>a[i].F;
	for(int i=0;i<n;i++) cin>>a[i].S;

	int st=0,ed=N;
	build(1,st,ed);
	
	for(int i=0;i<n;i++)
	{
		long int mx = query(1,st,ed,0,a[i].F-1) + a[i].S;
		update(1,st,ed,a[i].F,a[i].F,mx);
	}

	long int mx = 0;
	for(int i=0;i<=n;i++) mx=max(mx,query(1,st,ed,i,i));
	cout<<mx<<"\n";
	return 0;
}


Measured memory_bytes: 12948
#include <iostream>
using namespace std;
int main() {
    int n, i, max, max2;
    bool t;
    cin>>n;
    int v[n], v2[n];
    max = 0;
    for(i=0;i<n;i++){
        cin>>v[i];
    }
    for(i=0;i<n;i++){
        if(v[i]>max){max = v[i];}
    }
    for(i=0;i<n;i++){
        if(v[i]>max/2){
            v[i] = max-v[i];
            v2[i] = 1;
        }
    }
    max2 = max;
    max = 0;
    for(i=0;i<n;i++){
        if(v[i]>max){max = v[i]; if(v2[i]== 1){t= true;} else{t=false;}}
    }
    if(t==false){
            cout<<max2<<' '<<max;
    }
    else{
        cout<<max2<<' '<<max2-max;
    }
}


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

int main() {
  int A,B;
  cin >> A >> B;
  if ((A-B)%2 == 0) {
    if (A>B) {
      cout << B+(A-B)/2 << endl;
    }
    if (A<B) {
      cout << A+(B-A)/2 << endl;
    }
  }
  else {
    cout << "IMPOSSIBLE" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
ll MOD=1000000007;
ll mod=998244353;
int inf=1000000000;
ll INF=10000000000000000;
int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    if (n>=3200) cout << s << endl;
    else cout << "red" << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
ll MOD = 1000000007;
//ll INF = 21474836470000000;
ll INF = 100000000000000000;
long double EPS = 1e-11;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

int main(){
    ll H,A;
    cin >> H >> A;
    cout << (H + A-1) / A << endl; 
}




Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		int X = sc.nextInt();
		int t = sc.nextInt();
		
		if(X >= t) {
			System.out.println(X-t);
		}else {
			System.out.println(0);
		}
		
	}

}


Measured memory_bytes: 23124
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>

using namespace std;

typedef long long ll;

int main()
{
    int x1,y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int vec1[2]={x2-x1, y2-y1};
    int vec2[2]={-vec1[1], vec1[0]};
    cout << x2+vec2[0] << ' ' << y2+vec2[1] << ' ';
    int vec3[2]={-vec2[1], vec2[0]};
    cout << x2+vec2[0]+vec3[0] << ' ' << y2+vec2[1]+vec3[1] << endl;



    return 0;
}

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

using namespace std;
int main() {

  int n, t, a, b, result,flg;
  cin >> n >> t;
  result = 1000;
  flg = 0;

  for(int i =0; i<n;i++){
    cin >>a >> b;
    if(b<=t){
      if(a<result)
      result = a;
      flg = 1;
    }
  } 

if(flg==0){

  cout<<"TLE";

}else{

  cout << result;
  

}
return 0;
}

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

using namespace std;

int main () {
  ios::sync_with_stdio(false);

  int n;
  cin >> n;

  vector<pair<int, int>> edges;
  int fsum = n;
  if (n % 2 == 0) fsum++;

  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (i + j != fsum) {
	edges.push_back(make_pair(i, j));
      }
    }
  }

  cout << (int) edges.size() << '\n';
  for (auto pr : edges) {
    cout << pr.first << " " << pr.second << '\n';
  }
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    array<int, 6> as{60, 80, 100, 120, 140, 160}, bs{2, 5, 10, 15, 20, 25}, ps{600, 800, 1000, 1200, 1400, 1600};
    int n;
    while(cin >> n, n){
        int ans = 0;
        for (int i = 0; i < n; ++i) {
            int a, b, c, d;
            cin >> a >> b >> c >> d;
            for (int j = 0; j < 6; ++j) {
                if(a+b+c <= as[j] && d <= bs[j]){
                    ans += ps[j];
                    break;
                }
            }
        }
        cout << ans << "\n";
    }
    return 0;
}


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

#define lb push_back
typedef long long ll;
using namespace std;
const int maxn = 1e6+5;

int k[4];
int main()
{
    int n, m; cin >> n >> m;
    int a, b;
    map<int,int> mp;
    for(int i = 1; i <= n; i++) k[i] = -1;
    for(int i = 1; i <= m; i++) {
        cin >> a >> b;
        if(mp[a]) {
            if(k[a]!=b) {
                cout << -1 << endl;
                return 0;
            }
        }
        else {
        k[a] = b;
        mp[a] = 1;
        }

    }
    if(n == 1) {
        if(k[1]<=0) {
            cout << 0 << endl;
            return 0;
        }
    }
     if(k[1]==0) {
        cout << -1 << endl;
        return 0;
     }
     if(k[1]==-1)k[1] = 1;
     for(int i = 1; i <= n; i++) {
        if(k[i]==-1) cout << 0;
        else cout << k[i];
     }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define VI vector<int>
#define VVI vector<vector<int>>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 1e9
#define All(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> ans(N, 0);
  for (int i = 1; i < N; i++) {
    int a;
    cin >> a;
    ans[a - 1]++;
  }
  REP(i, N) { 
    cout << ans[i] << endl; 
  }

  return 0;
}


Measured memory_bytes: 3972
#include<stdio.h>

#include<ctype.h>
#include<string.h>

int main()
{
 int i,k,a,b,c ;
 float x,y,d ;
 char s[34534] ;
 scanf("%d",&k) ;
scanf("%s",s) ;
 b=strlen(s) ;
 if(b<=k)
    printf("%s",s) ;
 else
 {
     
     for(i=0 ; i<k ; i++)
     {
         printf("%c",s[i]) ;
     }
    
         printf("...") ;
     
 }
 return 0 ;
}


Measured memory_bytes: 1744
XY = input().split()
X = int(XY[0])
Y = int(XY[1])
l = []
for i in range(X+1):
    for j in range (X+1):
        if i + j == X:
            if (4*i + 2*j) == Y:
                l.append("Yes")
            else:
                l.append("No")
if l.count("Yes") > 0:
    print("Yes")
else:
    print("No")
        #print(str(i) + "," + str(j))

Measured memory_bytes: 9096
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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 long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int a,b,c;
	int ans=0;
	cin >>a>>b>>c;
	int head=a;
	int sum=0;
	chmax(head,b);
	chmax(head,c);
	a-=head;
	b-=head;
	c-=head;
	sum=a+b+c;
	clog<<sum<<endl;
	if(sum%2==-1){
		sum-=3;
	}
	cout << -sum/2 << endl;
}
/*
2  5  4
-3 0 -1
0 3 2

2 6 3
-4 0 -3
-5 -1 -4

31 41 5
-10 0 -36  46 
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef int64_t Int;
typedef pair<int,int> P;

int main(){
    int N, T; cin >> N >> T;
    vector<P> AB(3010, P(0,0));
    rep(i, N) cin >> AB[i+1].first >> AB[i+1].second;
    sort(AB.begin()+1, AB.begin()+N+1);

    // dp[i][j] :料理iまで，時刻jまででの最大満足度
    vector<vector<int>> dp(3010, vector<int>(3010, 0));

    int ans = 0;
    rep(i, N){
        rep(j, T){
            if(j - AB[i+1].first >= 0){
                dp[i+1][j] = max(dp[i][j], dp[i][j-AB[i+1].first] + AB[i+1].second);
            } else {
                dp[i+1][j] = dp[i][j];
            }
        }
        ans = max(ans, dp[i+1][T-1]+AB[i+2].second);
    }

    cout << ans << endl;
}


Measured memory_bytes: 35712
#include <iostream>
#include <utility>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <queue>

using namespace std;
typedef long long ll;

bool used[405][405];
int d[4][2]={{-1,0},{1,0},{0,-1},{0,1}};
int H,W;
string str[400];

pair<int,int> dfs(int h,int w){
    pair<int,int> ret(0,0);
    if(str[h][w]=='#'){
        ret.first=1;
    }else{
        ret.second=1;
    }
    used[h][w]=true;
    for(int i = 0;i < 4;i++){
        int nh=h+d[i][0],nw=w+d[i][1];
        if(nh<0||nw<0||nh>=H||nw>=W||used[nh][nw])
            continue;
        if(str[h][w]!=str[nh][nw]){
            pair<int,int> temp=dfs(nh,nw);
            ret.first+=temp.first;
            ret.second+=temp.second;
        }
    }
    return ret;
}

int main() {
    ll ans=0;
    cin>>H>>W;
    for(int h = 0;h < H;h++){
        for(int w = 0;w < W;w++){
            used[h][w]=0;
        }
        cin>>str[h];
    }
    for(int h = 0;h < H;h++){
        for(int w = 0;w < W;w++){
            if(used[h][w])continue;
            pair<int,int> x = dfs(h,w);
            //            cout<<x.first<<" "<<x.second<<endl;
            ans += (ll)x.first*(ll)x.second;
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

int main()
{
	int n, m;
	cin.tie(0);
	cin >> n >> m;
		
	int a[100][1000];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}

	int b[1000];
	for (int i = 0; i < m; i++) cin >> b[i];

	int s;
	for (int i = 0; i < n; i++) {
		s = 0;
		for (int j = 0; j < m; j++) {
			s += a[i][j] * b[j];
		}
		cout << s << "\n";
	}
}



Measured memory_bytes: 3484
#include "bits/stdc++.h"
using namespace std;
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define N	    100001
#define rep(i,a,b)  for(int i=a;i<b;i++)
typedef long long ll;
int main() {
	string a, b;
	cin>>a>>b;
	a = "t" + a;
	b = "t" + b;
	int dp[a.size()][b.size()];
	memset(dp, 0, sizeof(dp));
	string ans = "";
	for(int i = 1; i < a.size(); i++) {
		for(int j = 1; j < b.size(); j++) {
			if(a[i] == b[j]) {
				dp[i][j] = max(dp[i-1][j-1] + 1, max(dp[i-1][j], dp[i][j-1]));
			}
			else
				dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
		}
	}
	int x = a.size() - 1, y = b.size() - 1;
	while(x && y) {
		if(dp[x][y] > dp[x - 1][y] && dp[x][y] > dp[x][y - 1]) {
			ans += a[x];
			x--;y--;
		}
		else if(dp[x][y] == dp[x][y - 1]) {
			y--;
		}
		else if(dp[x][y] == dp[x - 1][y]) {
			x--;
		}
	}
	reverse(all(ans));
	cout<<ans<<endl;
}


Measured memory_bytes: 35456
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
ans=0
for i in range(n):
    a=list(map(int,input().split()))
    k=0
    for i in range(m):
        k+=a[i]*b[i]
    ans+=(k+c>0)
print(ans)

Measured memory_bytes: 3060
n = int(input())
h = [int(x) for x in input().split()]
ans = 0
while sum(h) != 0:
    if max(h) == 0: break
    i = 0
    while i < n:
        if h[i] == 0: i += 1
        else:
            ans += 1
            while i < n and h[i] > 0:
                h[i] -= 1
                i += 1
print(ans)

Measured memory_bytes: 3060
import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)


def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X % n)
    return str(X % n)


N, K = map(int, input().split())
ans = Base_10_to_n(N, K)
print(len(ans))


Measured memory_bytes: 66156
import scala.io.StdIn.readLine

object Main extends App {
  val n = readLine.split(" ").map(_.toInt).sorted
  if(n(0)==n(1) && n(1) == n(2) && n(2)==n(3) &&
     n(4)==n(5) && n(5) == n(6) && n(6)==n(7) &&
     n(8)==n(9) && n(9) == n(10) && n(10)==n(11)) println("yes")
  else println("no")
}

Measured memory_bytes: 43976
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <queue>
using namespace std;
using ll = long long;

const int N = 1e5+1;

int main(){
	int n,m;
	scanf("%d%d", &n, &m);
	priority_queue<int> pq;
	for(int i=0,x;i<n;++i){
		scanf("%d", &x);
		pq.push(x);
	}
	while(m--){
		int x = pq.top(); pq.pop();
		x >>= 1;
		pq.push(x);
	}
	ll ans = 0;
	while(pq.size()){
		ans += pq.top();
		pq.pop();
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 892
def main():
    n, m = [int(x) for x in input().rstrip().split(" ")]
    
    lowest_id = 1
    highest_id = n
    for i in range(m):
        l, r = [int(x) for x in input().rstrip().split(" ")]
        lowest_id = max(lowest_id, l)
        highest_id = min(highest_id, r)
    if lowest_id > highest_id:
        print(0)
    else:
        print(highest_id - lowest_id + 1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include<iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <fstream>

using namespace std;
using ll=long long;
#define PRI(n) cout << n << endl;
#define PRI2(n, m) cout << n << " " << m << endl;

#define PRI3(n, m, o) cout << n << " " << m<< " " << o << endl;

#define REP(i, n)  for(int i = 0; i < (int)n; ++i)
#define REP1(i, n)  for(int i = 1; i <= (int)n; ++i)
#define REPT(i, t, n)  for(int i = t; i <= (int)n; ++i)
const char alphabet[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
                           's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
const ll MOD = 1e9 + 7;
typedef pair<int, int> Pi;


int main() {
    int A, B, T;
    cin >> A >> B >> T;

    cout << floor((T+0.5)/A) * B <<endl;
    return 0;
}







Measured memory_bytes: 256
def main():
    N, K = map(int, input().split())
    A = list(map(lambda x: int(x)-1, input().split()))

    visited = [0] * N
    way = []
    now = 0

    while True:
        if visited[now] == 1: break
        if K == 0: return print(now+1)
        visited[now] = 1
        way.append(now)
        destination = A[now]
        K -= 1
        now = destination

    loop = way[way.index(now):len(way)]
    # print(loop)
    # print(K)
    print(loop[K%len(loop)]+1)



if __name__ == '__main__':
    main()


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

int main() {
  int n;
  cin >> n;
  vector<int> an(n);
  rep(i, n) {
    cin >> an[i];
  }
  sort(an.begin(), an.end());
  reverse(an.begin(), an.end());
  int sum = 0;
  rep(i, n) {
    if (i % 2 == 0) {
      sum += an[i];
    } else {
      sum -= an[i];
    }
  }
  cout << sum;

}


Measured memory_bytes: 256
def main():
    import itertools
    a = tuple(map(int,input().split()))
    b = tuple(map(int,input().split()))
    c = tuple(map(int,input().split()))
    d = (a[0],b[0],c[0])
    e = (a[1],b[1],c[1])
    f = (a[2],b[2],c[2])
    g = (a[0],b[1],c[2])
    h = (a[2],b[1],c[0])
    n = int(input())
    listB = [int(input()) for x in range(n)]
    X = itertools.permutations(listB,3)
    R = list(X)
    if a in R or b in R or c in R or d in R or e in R or f in R or g in R or h in R:
      print("Yes")
    else:
      print("No")
main()


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

int main() {
int  H,N;
    cin >> H >> N ;
vector<int> A(N);
for (int i = 0; i < N; i++) {
  cin >> A.at(i);
}
int sum=0;
  for (int i = 0; i < N; i++) {
   sum+=A[i];
  }
 if (sum>=H)  cout << "Yes" << endl;  
  else cout << "No" << endl;
}


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

int main() {
  int N, sum;
  cin >> N;
  sum=0;
  int x=0;
  for (int i=0; i<N; i++) {
    int p;
    cin >>p;
    sum += p;
    x = max(x, p);
  }
  cout << sum-x/2 << endl;
}


Measured memory_bytes: 256
import java.util.Scanner

val sc = Scanner(System.`in`)

fun main(args : Array<String>) {
    val s = sc.next()!!
    val k = sc.nextLong()

    val count1 = s.takeWhile { it == '1' }.length

    if (k <= count1) {
        println(1)
        return
    }

    val nextChar = s.first { it != '1' }
    println(nextChar)
}

Measured memory_bytes: 31016
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        int H = Integer.parseInt(scanner.next());
        int W = Integer.parseInt(scanner.next());
        int h = Integer.parseInt(scanner.next());
        int w = Integer.parseInt(scanner.next());

        final int result = H * W - (h * W) - (w * (H - h));
        System.out.println(result);
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005
#define INF 1001001001

double x[MAX_N];
double y[MAX_N];

double calc_Minkowski_dist(int n, int p){
    double res = 0;
    if(p >= 10000){
        rep(i,n){
            res = max(res, abs(x[i] - y[i]));
        }
    }else{
        rep(i,n){
            res += pow(abs(x[i] - y[i]), p);
        }
        if(p == 2){
            res = sqrt(res);
        }else if(p == 3){
            res = cbrt(res);
        }else{
            res = pow(res, (double)1 / p);
        }
    }
    return res;
}

int main() {
    int n;
    cin >> n;
    rep(i,n)cin >> x[i];
    rep(i,n)cin >> y[i];

    double ans[3] = {};
    rep(i,3)ans[i] = calc_Minkowski_dist(n, i+1);
    double ansINF = calc_Minkowski_dist(n, INF);

    rep(i,3)cout << fixed << setprecision(10) << ans[i] << endl;
    cout << fixed << setprecision(10) << ansINF << endl;
    return 0;
}
 
 



Measured memory_bytes: 3492
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(),(x).end()
typedef long long int ll;
using namespace std;
int main()
{
  int n;
  cin >> n;
  int sum = 0;
  int mini = 0;
  int tmp;
  REP(i, n){
    cin >> tmp;
    mini = max(tmp, mini);
    sum += tmp;
  }
  cout << sum - mini/2 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}

int main()
{
    ll X; cin >> X;
    ll y = 100;
    ll ans = 0;
    while (y < X) {
        y = (ll)((double)y * 1.01);
        ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
 
using namespace std;
 
const int N = 1000 * 1000 + 17;
const int MOD = 1000 * 1000 * 1000 + 7;

long long n;

bool read() {
    if (!(cin >> n))
        return false;

    return true;
}

void solve() {
    vector<long long> ans;
    auto sum = 0ll;

    for (int t = 1; sum + t <= n; sum += t, ++t)
        ans.emplace_back(t);

    ans.back() += n - sum;

    for (int len = ans.size(), i = ans.size() - 2; len >= 2; i = (len + i - 2) % (len - 1)) {
        ++ans[i];
        --ans[len - 1];

        if (ans[len - 1] <= ans[len - 2]) {
            --ans[i];
            ++ans[len - 1];
            break;
        }
    }

    for (auto i : ans)
        cout << i << endl;
}
 
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    while (read())
        solve();
 
    return 0;
}
 


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int n;
int main(){
  cin >> n;
  typedef pair<double, double> p;
  vector<p> v(n);
  for(int i=0 ; i<n ; i++){
    double x,y;  cin >> x >> y;
    v[i].first = x; v[i].second = y;
  }
  double d[n][n];
  for(int i=0 ; i<n ; i++){
    for(int j=i+1 ; j<n ; j++){
      double xi = v[i].first, yi = v[i].second;
      double xj = v[j].first, yj = v[j].second;
      double powx = (xi-xj)*(xi-xj);
      double powy = (yi-yj)*(yi-yj);
      d[i][j] = d[j][i] = sqrt(powx + powy);
    }
  }
  vector<int> s(n);
  for(int i=0 ; i<n ; i++){
    s[i] = i;
  }
  double sum = 0;
  do{
    for(int i=0 ; i+1<n ; i++){
        sum += d[s[i]][s[i+1]];
    }
  }while(next_permutation(s.begin(), s.end()));
  int nkai = 1;
  for(int i=0 ; i<n ; i++){
    nkai *= (n-i);
  }
  printf("%.6f", sum/nkai);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll MOD=1000000007;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
long long gcd(long long a,long long b){
    ll gcdmax=max(a,b);
    ll gcdmin=min(a,b);
    while(true){
        if(gcdmax%gcdmin==0)break;
        else gcdmax%=gcdmin;
        swap(gcdmin,gcdmax);
    }
    return gcdmin;
}
ll powerup(ll N,ll P,ll M){
    if(P==0)return 1;
    else if(P%2==0){
        ll t=powerup(N,P/2,M);
        return t*t%M;
    }
    else return N*powerup(N,P-1,M)%M;
}
vector<ll> find_divisor(ll N){
  ll k=1;
  while(k*k<=N){
    k++;
  }
  vector<ll> A(1);
  rep(i,k){
    if(i==1)A.at(0)=1;
    else if(i>=2){
      if(N%i==0)A.push_back(i);
    }
  }
  ll t=0;
  t=A.size();
  rep(i,t){
    if(A.at(t-i-1)*A.at(t-i-1)!=N)A.push_back(N/A.at(t-1-i));
  }
  return A;
}

int main()
{
    ll Z=0;
    ll A,B,C,K;
    cin>>A>>B>>C>>K;
    cout<<min(A,K)+min(A+B-K,Z)<<endl;
}

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

#define ll long long
#define ar array

const int mxN=1e6;
int n;
string s;

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

	cin >> n >> s;
	int s1=0;
	for(int i=0; i<n; ++i)
		if((i&n-1)==i)
			s1+=s[i]-1-'0';
	if(s1&1) {
		cout << 1;
		return 0;
	}
	for(int i=0; i<n; ++i) {
		if(s[i]=='2') {
			cout << 0;
			return 0;
		}
	}
	int s2=0;
	for(int i=0; i<n; ++i)
		if((i&n-1)==i)
			s2+=(s[i]-1-'0')/2;
	if(s2&1)
		cout << 2;
	else
		cout << 0;
}

Measured memory_bytes: 1948
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "unroll-loops")
#define ll long long 
#define ull unsigned ll 
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define REP1(i,n) for (int i=1;i<=(n);i++)
#define RREP(i,n) for (int i=(n)-1; i>=0; i--)
#define pii pair<int,int>
#define f first
#define s second
#define SZ(x) x.size()
#define ALL(x) x.begin(), x.end()
#define ull unsigned ll 
#define pb push_back
#define SQ(x) (x)*(x)
#define endl '\n'
using namespace std;
ll mod=1e9+7;
int main() 
{ 
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	ll x,y; cin>>x>>y;
	if (abs(x-y)<=1) cout<<"Brown"<<endl;
	else cout<<"Alice"<<endl; 
} 

Measured memory_bytes: 256
n, x = list(map(int, input().split()))
arr = list(map(int, input().split()))
if x == 0:
    print(0)
    exit()
sum = 0
count = 1
i = 0
while i < n:
    sum += arr[i]
    i += 1
    if sum <= x:
        count += 1
    else:
        print(count)
        exit()
print(count)


Measured memory_bytes: 9184
a,b,c,d=map(int,input().split())
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
a_0=(a-1)//c
a_1=(a-1)//d
a_2=(a-1)//lcm(c,d)
n=a_0+a_1-a_2
#print(n)
b_0=b//c
b_1=b//d
b_2=b//lcm(c,d)
m=b_0+b_1-b_2
#print(m)
#b_1-b_2
print(b-a+1-(m-n))

Measured memory_bytes: 5076
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>
#include <deque>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;
ll llmax = 10000000000000000000ll;
using namespace std;
using Graph = vector<vector<int>>;
Graph G;
const int AMAX = 100000;
/*int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}



int n;
vll a;

ll solve(bool isp)
{
	ll sum = 0ll;
	ll ret = 0ll;

	for (int i = 0; i < n; i++)
	{
		sum += a[i];
		if (isp and sum <= 0)
		{
			ret += -sum + 1;
			sum = 1ll;
		}
		if (not isp and sum >= 0)
		{
			ret += sum + 1;
			sum = -1ll;
		}
		isp ^= 1;
	}
	return ret;
}

*/


/*
 * 最大公約数計算
 */
ll gcd(ll a, ll b)
{
	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a % b);
	}
}

ll lcm(ll a, ll b)
{
	ll g = gcd(a, b);

	return a / g * b;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int x,a,b;
	cin >> x>>a>>b;
	if (abs(x - a) < abs(x - b))
	{
		cout << "A" << endl;
	}
	else
	{
		cout << "B" << endl;
	}
	
	
	return 0;

	


}


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

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

  cin >> n >> a >> b;

  int ans1 = min(a, b);
  int ans2;
  if (a + b <= n) {
    ans2 = 0;
  }
  if (a + b > n) {
    ans2 = abs(n - a - b);
  }

  printf("%d %d\n", ans1, ans2);

  return 0;
}

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

using namespace std;

#define rep(i,a,b) for(int i = a; i<int(b);++i)
#define all(v) v.begin(),v.end()
#define sz(v) v.size()
#define trav(a,c) for(auto a: c)

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pii;

int main(){
	cin.sync_with_stdio(false);
	ll n,k;
	cin>>n>>k;
    map<ll,ll> m;
    rep(i,0,n) {
        ll a;
        cin>>a;
        m[a]++;
    }
    vi v;
    trav(a,m) v.push_back(a.second);
    ll ans = 0;
    sort(all(v));
    rep(i,0,v.size()-k){
        ans += v[i];
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 14964