akhauriyash/Code-Regression huggingface dataset:
A, W = map(int,input().split())
B, V = map(int,input().split())
T = int(input())

a = A + W*T
b = B + V*T
c = A - W*T
d = B - V*T


if A < B:
    if a >= b:
        print("YES")
    else:
        print("NO")
else:
    if c <= d:
        print("YES")
    else:
        print("NO")

Measured memory_bytes: 9144
use std::io::*;
use std::str::FromStr;
 
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
 
#[allow(non_snake_case, unused_variables)]
fn main() {
    let s: Vec<char> = read::<String>().chars().collect();
    let mut flag = false;
    let mut ans = "No";
    for c in s {
        if c=='C' {
            flag = true;
        }
        if c=='F' && flag {
            ans = "Yes";
        }
    }
    println!("{}", ans);
}



Measured memory_bytes: 4352
import math
N=int(input())
a=int((math.sqrt(N)//1))
ans=0
if N==2:
  print(0)
  exit()
for i in range(1,a):
  b=(N-i)/i
  if b.is_integer():
    ans+=int(b)
c=N//a
d=N%a
if int(c)==d:
  ans+=a
a+=1
c=N//a
d=N%a
if int(c)==d:
  ans+=a
print(ans)

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

int a[200005];

int cmd(int x,int y)
{
	return x>y;
}

int main()
{
	int n,k;
	unsigned long long ans=0;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	scanf("%d",&a[i]);
	sort(a+1,a+n+1,cmd);
	for(int i=k+1;i<=n;i++)
	{
		ans+=a[i];
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>

#define DIV 1000000007

using namespace std;
using ll = long long;
using ldb = long double;

int degi(ll n) {
	int res = 0;
	while (n > 0) {
		n /= 10;
		res++;
	}
	return res;
}
int main() {
	ll a; cin >> a;
	ldb b; cin >> b;
	cout << (ll)(a * b) << endl;
}


Measured memory_bytes: 3732
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <bitset>
#include <fstream>

#define ll long long
#define scani(x) scanf("%i", &x)
#define scanll(x) scanf("%I64d", &x)
#define scanfl(x) scanf("%f", &x)
#define scanch(x) scanf("%c", &x)
#define scans(x) scanf("%s", x);
#define printi(x) printf("%i", x);
#define printll(x) printf("%I64d", x);
#define printfl(x) printf("%f", x);
#define printch(x) printf("%c", x);
#define prints(x) printf("%s", x);
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define INFI (1 << 29)
#define INFL (1LL << 62)
#define sz(x) int(x.size())
#define fi first
#define se second
#define forn(i, n) for(ll i = 0; i < n; i++)
#define for1(i, n) for(ll i = 1; i <= n; i++)
#define ford(i, n) for(ll i = (n - 1); i >= 0; i--)
#define fori(i, n) for(ll i = n; i >= 1; i--)
#define fore(i, l, r) for(ll i = l; i <= r; i++)
#define get_bit(mask, x) (bool)(mask & (1LL << x))
#define set_bit(mask, x) (mask |= (1LL << x))
#define reset_bit(mask, x) (mask &= ~(1LL << x))
#define toggle_bit(mask, x) (mask ^= (1LL << x))

using namespace std;

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

    ll n, r = 0, c = 0, uA = 1000000001;

    cin >> n;

    vector < ll > v(n);

    forn(i, n)
        cin >> v[i];

    forn(i, n)
    {
        if(uA >= v[i])
            c++;
        else
            c = 1;

        uA = v[i];

        r = max(r, c);
    }

    cout << (r - 1) << "\n";

    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>

/* constant */

#define MAX_N   (1000)

/* subroutines */

int comp_p(const void *a, const void *b) {
  return *(int *)b - *(int *)a;
}

/* main */

int main(int argc, char **argv) {
  int i, m, n, p, sum;
  static int ps[MAX_N];

  for (;;) {
    scanf("%d %d", &n, &m);
    if (n == 0 && m == 0) break;

    for (i = 0; i < n; i++) scanf("%d", &ps[i]);
    qsort(ps, n, sizeof(int), comp_p);

    sum = 0;

    for (i = 0; i < n; i++)
      if ((i + 1) % m != 0) sum += ps[i];
    /*
    for (i = 0; i < n; i++) printf("%d ", ps[i]);
    putchar('\n');
    */

    printf("%d\n", sum);
  }

  return 0;
}

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

const int N = 1e5 + 5;
int n;
long long d[N];
priority_queue <pair <long long, int> > pq;
int siz[N];
int fa[N];
map <long long, set <int> > mp;
vector <int> g[N];

#define NO() return puts("-1"), 0

long long dfs(int u) {
	long long ans = 0;
	for (int i = 0; i < g[u].size(); ++ i)
		ans += dfs(g[u][i]) + siz[g[u][i]];
	return ans;
}

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; ++ i)
		scanf("%lld", &d[i]), mp[d[i]].insert(i),
		siz[i] = 1, pq.push(make_pair(d[i], i));
	int rt;
	while (!pq.empty()) {
		int u = pq.top().second;
		pq.pop(); mp[d[u]].erase(u);
		if (!pq.empty()) {
			long long fa_d = (d[u] - (n - 2 * siz[u]));
//			printf("%d %lld %lld\n", u + 1, d[u], fa_d);
			if (!mp[fa_d].size()) NO();
			int v = *mp[fa_d].begin();
			fa[u] = v;
			g[v].push_back(u);
			siz[v] += siz[u];
		} else fa[u] = -1, rt = u;
	}
	if (dfs(rt) != d[rt]) NO();
	for (int i = 0; i < n; ++ i)
		if (~fa[i]) printf("%d %d\n", fa[i] + 1, i + 1);
	return 0;
}

Measured memory_bytes: 23408
/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Set<String> hash_Set = new HashSet<String>(); 
		int n;
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		String s;
		for(int i=0;i<n;i++) {
		    s = sc.next();
		    hash_Set.add(s);
		}
    //   Object[] objects = hash_Set.toArray(); 
  
    //     // Printing array of objects 
    //     for (Object obj : objects) 
    //         System.out.println(obj); 
    System.out.println(hash_Set.size());
	}
}


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  int N; cin >> N;
  int count = N%2 ? 2*(N/2*(N/2-1)) + N-1 : 2*(N/2*(N/2-1));
  cout << count << endl;
  int p = N-N%2;
  repr(i,1,p/2) {
    rep(j,p-i*2) cout << i << " " << i+j+1 << endl;
    rep(j,p-i*2) cout << p-(i-1) << " " << p-(i+j) << endl;
  }
  if (N%2) repr(i,1,N) cout << i << " " << N << endl;
  return 0;
}

Measured memory_bytes: 256
N, K = gets.chomp.split(" ").map(&:to_i)
A = gets.chomp.split(" ").map(&:to_i)

ans = 0
r = [A.max, K].min.bit_length
(0...r).each{|i|
  wk = A.count{|a| a[i] == 1}
  ans += (1 << i) if wk < (N - wk)
}
(r...K.bit_length).each{|i|
  ans += (1 << i)
}
if ans > K then
  (K.bit_length-1).downto(0).each{|i|
    break if K[i] == 1 && ans[i] == 0
    ans -= (1 << i) if K[i] == 0 && ans[i] == 1
  }
end

puts A.inject(0){|r, a| r + (a ^ ans)}


Measured memory_bytes: 10252
n,m=map(int,input().split())

ab=[[int(a) for a in input().split()]for _ in range(n)]

cd=[[int(a) for a in input().split()]for _ in range(m)]

#print(ab,cd)
INF=float("inf")
for (a,b) in ab:
  tmp=INF
  now=0
  for i,(c,d) in enumerate(cd):
    if tmp>abs(a-c)+abs(b-d):
      now=i+1
      tmp=abs(a-c)+abs(b-d)
    else:
      pass
    
  print(now)
  

Measured memory_bytes: 68344
#pragma GCC optimize(2)
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

const ll mod = 1e9 + 7;
const int N = 1e5 + 10, M = 1e6 + 10;
const ll INF = 1e18;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;

#define pi acos(-1)

int main()
{
    int k;
    cin >> k;
    while (k--)
    {
        printf("ACL");
    }
    return 0;
}

/*

*/

Measured memory_bytes: 3660
package main

import "fmt"

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	var a, b, c, x, y int
	fmt.Scan(&a, &b, &c, &x, &y)
	z := min(x, y)
	ans := min(a*x+b*y, min(2*c*z+a*(x-z)+b*(y-z), 2*c*max(x, y)))
	fmt.Println(ans)
}


Measured memory_bytes: 512
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>; 
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>;

ll disit(ll n){
    ll res = 0;
    while(n > 0){
        res += n % 10;
        n /= 10;
    }
    return res;
}

int main() {
    ll N, A, B;
    cin >> N >> A >> B;
    ll ans = 0;
    FOR(i, 1, N+1){
        if(disit(i) >= A && disit(i) <= B){
            ans += i;
        }
    }
    cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
 
void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
}
 int n,m;
 char arr[1002][1002];
 int dp[1002][1002];
 
int32_t main()
{
    c_p_c();
     
    cin>>n>>m;
    
    
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            cin>>arr[i][j];
        }
    }
     
    
    memset(dp,0,sizeof(dp));
    
     for(int i=0;i<n;i++)
     {
         if(arr[i][0]=='#')
         break;
         else
         {
             dp[i][0]=1;
         }
     }
       
     
       for(int i=0;i<m;i++)
     {
         if(arr[0][i]=='#')
         break;
         else
         {
             dp[0][i]=1;
         }
     }
      
    
     for(int i=1;i<n;i++)
     {
         for(int j=1;j<m;j++)
         {
             
             if(arr[i][j]=='#')
             dp[i][j]=0;
             else
             {
                 dp[i][j]=(dp[i-1][j]+dp[i][j-1])%1000000007;
             }
         }
     }
    cout<<dp[n-1][m-1];
    return 0;
}

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

using namespace std;

#define FOR(i,n) for(int i=0; i<n; i++)
#define FOR2(i, z, n) for(int i=z; i<n; i++)

int main() {
  int nbr_items, max_weight;
  cin >> nbr_items >> max_weight;
  vector<pair<int, int> > items(nbr_items);
  vector<int> weight_list(max_weight + 1, 0);

  FOR(i, nbr_items) {
    int we, val;
    cin >> val >> we;
    items[i] = make_pair(we, val);
  }

  weight_list[0] = 0;

  FOR2(i, 1, max_weight + 1) {
    weight_list[i] = weight_list[i - 1];
    FOR(j, nbr_items) {
      if (i >= items[j].first) {
        if (items[j].second + weight_list[i - items[j].first] > weight_list[i]) {
          weight_list[i] = items[j].second + weight_list[i - items[j].first];
        }
      }
    }
  }
  cout << weight_list[max_weight] << endl;
}


Measured memory_bytes: 3140
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
   
    if(X<=599){
    	System.out.println("8");
    }else if(X<=799) {	
       	System.out.println("7");   	
    }else if(X<=999) {	
       	System.out.println("6");     	
	}else if(X<=1199){	
		System.out.println("5");   	
	}else if(X<=1399) {	
		System.out.println("4");    	
	}else if(X<=1599) {	
		System.out.println("3");   	
	}else if(X<=1799) {	
		System.out.println("2");	
    }else{
    	System.out.println("1");
      }
}
}


Measured memory_bytes: 35696
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B;
  cin >> A >> B;
  
  if(A+B<24){
    cout << A+B << endl;
  }
  else if(A+B==24){
    cout << 0 << endl;
  }
  else{
    cout << A+B-24 << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int x, a, b;
    cin >> x >> a >> b;
    if(a >= b){
        cout << "delicious" << endl;
        return 0;
    }else if(b - a <= x){
        cout << "safe" << endl;
        return 0;
    }else{
        cout << "dangerous" << endl;
        return 0;
    }
}

Measured memory_bytes: 3604
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <locale>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <vector>

const long long int INF = 1e9;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define Rep(i, n) for(int i = 1; i <= (int)(n); i++)
#define llrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define llRep(i, n) for(ll i = 1; i <= (ll)(n); i++)

using namespace std;

struct Point{
	int x,y;
};

bool vector_finder(std::vector<ll> vec, ll number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return true;
    }
  else { // 発見できなかったとき
    return false;
    }
}

ll factorial(ll N){
    ll ans = 1;
    llRep(i,N){
        ans *= i;
    }
    return ans;
}

ll extended_factorial(ll N){
    ll ans = 1;
    llRep(i,N){
        ans *= i;
        ans %= (ll)(1e9+7);
    }
    return ans;
}

vector<ll> Eratosthenes(ll N){
    bool arr[N+1];
    //initialization
    arr[0] = false;
    arr[1] = false;
	for(ll i = 2; i < N+1; i++){
		arr[i] = true;
	}
    //eratosthenes
	for(ll i = 2; i <= sqrt(N); i++){
		if(arr[i]){
			for(ll j = 0; i * (j + 2) <= N; j++){
				arr[i *(j + 2)] = false;//not prime number
			}
		}
	}
    vector<ll> prime;
    llRep(i,N){
        if (arr[i]==true){
            prime.push_back(i);
        }
    }
    return prime;
}

ll gcd(ll a, ll b){
    ll temp;
	while (a % b != 0){
		temp = b;
		b = a % b;
		a = temp;
	}
	return b;
}

ll lcm(ll a, ll b){
  return a * b / gcd(a,b);
}

char alphabet[] = {
    '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'
};


int main(){
    string S;
    cin >> S;
    if (S== "SUN"){
        cout << 7 << endl;
    }else if(S=="MON"){
        cout << 6 << endl;
    }else if (S=="TUE"){
        cout << 5 << endl;
    }else if(S=="WED"){
        cout << 4 << endl;
    }else if (S=="THU"){
        cout << 3 << endl;
    }else if (S=="FRI"){
        cout << 2 << endl;
    }else if (S=="SAT"){
        cout << 1 << endl;
    }
    return 0;
}


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

// in-short-use macros

#define all(c) (c).begin(),(c).end()
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define PI 3.14159265
#define sizes 1000010



//main function here

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   
    int n,k;
    cin>>n>>k;
    int a[n+5];
    memset(a,0,sizeof(a));
    for(int i=0;i<k;i++)
    {
        int d,u;
        cin>>d;
        for(int j=0;j<d;j++)
        {
            cin>>u;
            a[u]++;
        }
    }
    ll c=0;
    for(int i=1;i<=n;i++)
        c+=(a[i]==0);
    cout<<c<<"\n";
    return 0;
}

Measured memory_bytes: 3652
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		char[] S = sc.next().toCharArray();
        int result = 0;
        for(int i=0; i<1000; i++){
            int[] a = {i/100, (i/10)%10, i%10};
            int count = 0;
            for(int m=0; m<N; m++){
                if(Character.getNumericValue(S[m])==a[count]){
                    count++;
                }
                if(count==3){
                    break;
                }
            }
            if(count==3){
                result++;
            }
        }
		System.out.println(result);
	}
}

Measured memory_bytes: 37900
using System;

class Program {
  static void Main() {
    var a = new int[5];
    for (int i = 0; i < 5; i++) {
      a[i] = int.Parse(Console.ReadLine());
    }
    var p = Math.Min(a[0], Math.Min(a[1], a[2]));
    var j = Math.Min(a[3], a[4]);
    Console.WriteLine(p + j - 50);
  }
}


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

using LL = long long;
using pii = pair<int, int>;

const int MAXN = 100001;
int type_eaten[MAXN];
vector<pii> sushis;

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int N, K, T, D;
    memset(type_eaten, 0, sizeof type_eaten);

	priority_queue<pii> yoink;
    priority_queue<pii, vector<pii>, greater<pii>> yeet;

	cin >> N >> K;
    for (int i = 0; i < N; ++i){
        cin >> T >> D;
        yoink.push({D, T});
    }

	LL answer, f = 0, g = 0;
    for (int i = 0; i < K; ++i){
		pii best = yoink.top();
		yoink.pop();
		yeet.push(best);
		if (not type_eaten[best.second]){
			g++;
		}
		type_eaten[best.second]++;
		f += best.first;
	}
	answer = f + g * g;
	
	while(not yoink.empty()){
		pii best = yoink.top();
		yoink.pop();
		if (type_eaten[best.second] == 0){
			yeet.push(best);
			type_eaten[best.second]++;
			while(not yeet.empty()){
				pii to_yeet = yeet.top();
				yeet.pop();
				if (type_eaten[to_yeet.second] > 1){
					type_eaten[to_yeet.second]--;
					f = f + best.first - to_yeet.first;
					g++;
					answer = max(answer, f + g * g);
					
					break;
				}
			}
		}
	}
	
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 2932
N = int(input())
*x, = map(int, input().split())
MOD = 10**9+7

m = 1
for i in range(1, N):
    m *= i
    m %= MOD

va, vb = 0, 1
ans = 0

for i in range(N-1):
    d = x[i+1]-x[i]
    va = ((i+1)*va+vb)%MOD
    vb = ((i+1)*vb)%MOD
    ans += (d*va*pow(vb, MOD-2, MOD)*m)
    ans %= MOD

print(ans)


Measured memory_bytes: 14224
#include <iostream>
using namespace std;
 
int n;
int a[300000];
long long ans = 0;
 
int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
 
    int Xor = 0;
    int Sum = 0;
    int r = 0;
    for (int l = 0; l < n; l++) {
        while (r < n && (Xor ^ a[r]) == Sum + a[r]) {
            Xor ^= a[r];
            Sum += a[r];
            r++;
        }
        ans += (r - l);
        Xor ^= a[l];
        Sum -= a[l];
    }
 
    cout << ans << endl;
 
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
int n, w;

int main() {
    std::cin >> n >> w;
    int weights[n];
    int values[n];
    int dp[n+1][w+1];

    for (int i = 0; i < n; i++) {
        std::cin >> values[i] >> weights[i];
    }
    
    for (int i = 0; i <= n; i++) {
        for (int p = 0; p <= w; p++) {
            dp[i][p] = 0;
        }
    }

    for (int i = 0; i <= w; i++) {
        dp[0][w] = 0;
    }

    for (int i = 1; i <= n; i++) {
        for (int p = 0; p <= w; p++) {
            if (p >= weights[i-1]) {
                dp[i][p] = std::max(dp[i-1][p-weights[i-1]]+values[i-1], dp[i-1][p]);
            }
            else {
                dp[i][p] = dp[i-1][p];
            }
        }
    }
    std::cout << dp[n][w] << std::endl;
}



Measured memory_bytes: 7032
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
      int N, X, sum=0;
	  cin >> N >> X;
      int m[N];
  
  	  for(int i=0;i<N;i++){
        cin >> m[i];
        sum += m[i];
      }
  
 	  sort(m, m+N);
      cout << (X-sum)/m[0]+N << endl;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(),x.end()

int main() {
    int A,B,C;
    cin >> A >> B >> C;
    cout << max(0,C-(A-B)) << endl;
}



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

#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i, m, n) for(int i = (int)m; i < (int)n; i++)
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;


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



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

    string s; cin >> s;
    if(s == "Sunny") cout << "Cloudy" << endl;
    else if(s =="Cloudy") cout << "Rainy" << endl;
    else cout << "Sunny" << endl;
}


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

using namespace std;

template< typename T >
struct BinaryIndexedTree {
    vector< T > data;

    BinaryIndexedTree(int sz) {
        data.assign(++sz, 0);
    }

    T sum(int k) {
        T ret = 0;
        for(++k; k > 0; k -= k & -k) ret += data[k];
        return (ret);
    }

    void add(int k, T x) {
        for(++k; k < data.size(); k += k & -k) data[k] += x;
    }
};

template< typename T >
struct Compress {
    vector< T > xs;

    Compress() = default;

    Compress(const vector< T > &vs) {
        add(vs);
    }

    Compress(const initializer_list< vector< T > > &vs) {
        for(auto &p : vs) add(p);
    }

    void add(const vector< T > &vs) {
        copy(begin(vs), end(vs), back_inserter(xs));
    }

    void add(const T &x) {
        xs.emplace_back(x);
    }

    void build() {
        sort(begin(xs), end(xs));
        xs.erase(unique(begin(xs), end(xs)), end(xs));
    }

    vector< int > get(const vector< T > &vs) const {
        vector< int > ret;
        transform(begin(vs), end(vs), back_inserter(ret), [&](const T &x) {
        return lower_bound(begin(xs), end(xs), x) - begin(xs);
        });
        return ret;
    }

    int get(const T &x) const {
        return lower_bound(begin(xs), end(xs), x) - begin(xs);
    }

    const T &operator[](int k) const {
        return xs[k];
    }
};

int main(void) {
    int64_t N, K;
    cin >> N >> K;
    vector<int64_t> a(N+1);
    for(int i=1; i<=N; i++) {
        cin >> a[i];
        a[i] -= K;
    }

    partial_sum(a.begin(), a.end(), a.begin());

    Compress<int64_t> comp;
    comp.add(a);
    comp.build();
    auto zart = comp.get(a);

    int64_t ans = N*(N+1)/2;
    BinaryIndexedTree<int64_t> bit(N+1);
    for(int i=0; i<=N; i++) {
        ans -= i - bit.sum(zart[i]);
        bit.add(zart[i], 1);
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6768
#include<stdio.h>

int main(void){
  char s[3];
  int i,cnta=0,cntb=0,cntc=0;
  
  for(i=0;i<3;i++){
    s[i] = getchar();
    if(s[i]=='a') cnta++;
    else if(s[i]=='b') cntb++;
    else if(s[i]=='c') cntc++;
  }
  
  if((cnta==1) && (cntb==1) && (cntc==1)){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;
public class Main {
static Scanner s = new Scanner(System.in);
public static void main(String[] args) {
	int n = s.nextInt();
	Node[] nodes = new Node[n];
	StringBuilder sb = new StringBuilder();

	for(int i = 0;i < n;i++) {
		nodes[i] = new Node(i);
	}
	for(int i = 0;i < n;i++) {
		Node node = nodes[s.nextInt()];
		int k = s.nextInt();
		if(k > 0) {
			Node[] c = new Node[k];
			for(int j = 0;j < k;j++) {
				c[j] = nodes[s.nextInt()];
			}
			node.setCP(c);
		}
	}

	Node root = null;
	for(int i = 0;i < n;i++) {
	if(nodes[i].parent == null) {
		root = nodes[i];
		break;
	}
	}
	root.setDepth(0);
	for(int i = 0;i < n;i++) {
	sb.append("node " + i + ": parent = ");
	if(nodes[i].parent == null) {
		sb.append(-1);
	}else {
		sb.append(nodes[i].parent.id);
	}
	sb.append(", depth = " + nodes[i].dep + ", ");
	if(nodes[i].parent == null) {
		sb.append("root");
	}else {
		if(nodes[i].children == null) {
			sb.append("leaf");
		}else {
			sb.append("internal node");
		}
	}
	sb.append(", [");
	if(nodes[i].children != null) {
		for(int j = 0;j < nodes[i].children.length;j++) {
			sb.append(nodes[i].children[j].id);
			if(j == nodes[i].children.length-1) {
			sb.append("]");
			}else {
				sb.append(", ");
			}
		}
	}else {
		sb.append("]");
	}
	sb.append("\n");
	}

	System.out.print(sb.toString());
	}
}

class Node{
	public int id;
	public int dep;
	public Node parent;
	public Node[] children;

	public Node(int id) {
	this.id = id;
	}

	void setCP(Node[] child) {
		this.children = child;
		for(int i = 0;i < children.length;i++) {
		this.children[i].parent = this;
		}
	}
	void setDepth(int d) {
		this.dep = d;
		if(this.children != null) {
		for(int i = 0;i < children.length;i++) {
			this.children[i].setDepth(d + 1);
		}
		}
	}


}



Measured memory_bytes: 149076
#include<bits/stdc++.h>
using namespace std;
long long n,sumv=0;
long long a[200005],num[200005],sum[200005];
int main() {
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		num[a[i]]++;
	}
	for(int i=1;i<=200000;i++){
		sumv=sumv+(num[i]*(num[i]-1))/2;
	}
	for(int i=1;i<=200000;i++){
		sum[i]=sumv-(num[i]-1);
	}
	for(int i=1;i<=n;i++){
		cout<<sum[a[i]]<<endl;
	}
	return 0;
}


Measured memory_bytes: 6912
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <iomanip>
#include <cmath>
using namespace std;

int main() {
    int h, w, k;
    cin >> h >> w >> k;
    char s[350][350];
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> s[i][j];
        }
    }

    int ans[350][350] = {0};
    int cnt = 1;
    bool r = false;
    for (int i = 0; i < h; i++) {
        bool f = true;
        bool u = true;
        for (int j = 0; j < w; j++) {
            ans[i][j] = cnt;
            if (s[i][j] == '#') {
                u = false;
                if (f) {
                    f = false;
                    continue;
                }
                cnt++;
                ans[i][j] = cnt;
            }
        }
        //末端
        //いちごが一つもない
        if (u) {
            for (int j = 0; j < w; j++) {
                ans[i][j] = -1;
            }
        }
        else cnt++;
    }

    //上から
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (ans[i][j] == -1 && i != 0) {
                for (int k = 0; k < w; k++) {
                    ans[i][k] = ans[i - 1][k];
                }
            }
        }
    }

    //下から
    for (int i = h - 1; i >= 0; i--) {
        for (int j = 0; j < w; j++) {
            if (ans[i][j] == -1) {
                for (int k = 0; k < w; k++) {
                    ans[i][k] = ans[i + 1][k];
                }
            }
        }
    }

    //出力
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cout << ans[i][j];
            if (j != w - 1) cout << " ";
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

bool check(int64_t b, int64_t n, int64_t s) {
    int64_t ans{0};
    while (n) {
        ans += n % b;
        n = n / b;
    }
    return ans == s;
}

int main(int argc, char** argv) {
    int64_t n, s;
    cin >> n >> s;
    if (s > n) {
        cout << -1 << endl;
        return 0;
    }
    if (s == n) {
        cout << n+1 << endl;
        return 0;
    }
    for (int64_t i=2; i<sqrt(n)+1; ++i) {
        if (check(i, n, s)) {
            cout << i << endl;
            return 0;
        }
    }
    for (int64_t i=sqrt(n)+1; i>0; --i) {
        if ((n-s) % i) continue;
        int64_t j = (n-s)/i + 1;
        if (check(j, n, s)) {
            cout << j << endl;
            return 0;
        }
    }

    cout << -1 << endl;

    return 0;
}


Measured memory_bytes: 256
user = str(input())
if user[-1] == '2' or user[-1] == '4' or user[-1] == '5' or user[-1] == '7' or user[-1] == '9':
    print("hon")
elif user[-1] == '0' or user[-1] == '1' or user[-1] == '6' or user[-1] == '8':
    print('pon')
else:
    print('bon')

Measured memory_bytes: 9056
def IsRightTriangle(tri):
	tri.sort()
	return tri[0]**2 + tri[1]**2 == tri[2]**2

N = eval(input())
for i in range(N):
	tri = [eval(item) for item in input().split()]
	print('YES' if IsRightTriangle(tri) else 'NO')

Measured memory_bytes: 7364
import numpy as np
import functools
import math
import scipy
import fractions
import itertools

def solve():
    n, h = map(int, input().split())
    a, b = [0]*n, [0]*n
    for i in range(n):
        a[i],b[i] = map(int, input().split())
    a.sort(reverse = True)
    b.sort(reverse = True)
    ans = 0
    m = max(a)
    bit = 0
    for i in range(n):
        if b[i] > m:
            h -= b[i]
            ans += 1
        if h <= 0:
            print(ans)
            bit = 1
            break
    if bit == 0:
        ans += math.ceil(h/m)
        print(ans)
    return 0
 
if __name__ == "__main__":
    solve()


Measured memory_bytes: 21560
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
map<ll,ll> mp;
bool isprime(ll n){
	if(n==1) return false;
	for(ll i=2;i*i<=n;i++){
		if(n%i==0){
			return false;
		}
	}
	return true;
}
int main(){
	ll n;
	cin>>n;
	ll nn = n;
	for(ll i=2;i*i<=nn;i++){
		while(n%i==0){
			n/=i;
			mp[i]++;
		}
	}
	//cout<<mp[2]<<mp[5];
	ll ans = 0;
	for(auto i:mp){
		//cout<<i.first<<" "<<i.second<<endl;
		ll tmp = i.second;
		ll cnt = 0;
		ll ct = 1;
		while(cnt<=tmp){
			cnt += ct++; 
		}
		ct -= 2;
		ans += ct;
	}
	if(isprime(n)) ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define rep1(i,n) for (ll i = 1; i <= (n); ++i)
#define rrep(i,n) for (ll i = (n)-1; i >=0; --i)
#define ALL(a) a.begin(),a.end()
#define pb push_back
#define dame { puts("-1"); return 0;}
#define show(x) cerr<<#x<<" = "<<x<<endl;

using namespace std;
using ll = long long;
using ld = long double;
using pl = pair<ll, ll>;

typedef vector<ll> vl;
typedef vector<pl> vp;
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 (a>b) { a=b; return 1; } return 0; }


// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const ll mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} c(200005);


int main() {
  ll a;
  ld b;
  cin >> a>>b;

  ld c = a*b;

  ll ans = floor(c);
  
  

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6208
#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 for1(i, m, n) for(int i = m;i < n;i++)
#define ll long long
#define endl '\n'
using namespace std;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    ll int n, a, b;
    cin >> n >> a >> b;
    if (a > b) {
        cout << 0 << endl;
        return 0;
    }
    if (n == 1) {
        if (a != b) {
            cout << 0 << endl;
            return 0;
        } else {
            cout << 1 << endl;
            return 0;
        }
    }
    cout << (n - 2) * (b - a) + 1 << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int i=0;
  char c;
  while(1){
    scanf("%c",&c);
      if(c>='A'&&'Z'>=c)c += 'a'-'A';
      else if(c>='a'&&'z'>=c)c += 'A' - 'a';
      printf("%c",c);
      if(c =='\n'){
	return(0);
      }
    }
  return(0);
}

Measured memory_bytes: 1788
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    a = LI()
    k = I()

    t = 0
    for i in range(2):
        while a[i+1] <= a[i]:
            t += 1
            a[i+1] *= 2

    if t <= k:
        return 'Yes'

    return 'No'

print(main())





Measured memory_bytes: 10828
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
//
struct edge{int to;int cap;int rev;};
struct Dinic{
	//
	int v;
	vector<edge> G[1000];
	vector<int> lel,ite;
	//
	Dinic(int n){
		v=n;
		lel.resize(v);
		ite.resize(v);
	}
	//
	void add_edge(int from,int to,int cap){
		G[from].push_back((edge){to,cap,(int)G[to].size()});
		G[to].push_back((edge){from,0,(int)G[from].size()-1});
	}
	//
	void BFS(int s){
		fill(lel.begin(),lel.end(),-1);
		queue<int> que;
		lel[s]=0;
		que.push(s);
		while(!que.empty()){
			int v=que.front();que.pop();
			for(int i=0;i<G[v].size();i++){
				edge &e=G[v][i];
				if(e.cap>0&&lel[e.to]<0){
					lel[e.to]=lel[v]+1;
					que.push(e.to);
				}
			}
		}
	}
	//
	int DFS(int v,int t,int f){
		if(v==t){
			return f;
		}
		for(int i=ite[v];i<G[v].size();i++){
			edge &e=G[v][i];
			if(e.cap>0&&lel[v]<lel[e.to]){
				int d=DFS(e.to,t,min(f,e.cap));
				if(d>0){
					e.cap-=d;
					G[e.to][e.rev].cap+=d;
					return d;
				}
			}
		}
		return 0;
	}
	//
	int max_flow(int s,int t){
		int flow=0;
		while(1){
			BFS(s);
			if(lel[t]<0){
				return flow;
			}else{
				fill(ite.begin(),ite.end(),0);
				int f;
				while((f=DFS(s,t,1e9+7))>0){
					flow+=f;
				}
			}
		}
	}
	//
};
//
int main(){
	int V,E;
	cin>>V>>E;
	Dinic DC(V);
	for(int i=0;i<E;i++){
		int s,t,c;
		cin>>s>>t>>c;
		DC.add_edge(s,t,c);
	}
	cout<<DC.max_flow(0,V-1)<<endl;
	return 0;
}


Measured memory_bytes: 3192
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;


struct cmp2{
    bool operator ()(long long &a,long long &b){
        return a<b;//最大值优先
    }
};

int n;
long long a[200010];

bool compare(const long long &a, const long long &b) {
	return a > b;
}


int main()
{
	scanf("%d", &n);
	for (int i = 0 ; i < n ; i++) {
		scanf("%d", &(a[i]));
	}
	
	sort(a, a + n, compare);
	
	std::priority_queue<long long,vector<long long>,cmp2> qGaps;//最大值优先
	
	qGaps.push(a[0]);

	int p = 1;
	
	long long count = 0;
	
	while (p < n) {
		long long curGap = qGaps.top();
		qGaps.pop();
		
		count = count + curGap;
		qGaps.push(a[p]);
		qGaps.push(a[p]);
		
		p++;
	}
	
	printf("%lld\n", count);
	
	return 0;
}



Measured memory_bytes: 6392
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


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

	int n, k;
	cin >> n >> k;
	vector<bool> ng(10);
	rep(i, k) {
		int d;
		cin >> d;
		ng[d] = true;
	}
	for (int i = n;; i++) {
		bool flag = true;
		string s = to_string(i);
		for (char c : s) {
			int x = c - '0';
			if (ng[x]) flag = false;
		}
		if (flag) {
			cout << i << '\n';
			return 0;
		}
	}
}

Measured memory_bytes: 256
N,X = gets.chomp.split(" ").map(&:to_i)
points= gets.chomp.split(" ").map(&:to_i)
points << X
points.sort!
dis=[]
points.each_with_index do |point,i|
  if i!=0
    dis << point - points[i-1]
  end
end


def gcd(n, m)

  n, m = m, n if m > n
  #p [n, m]

   loop {
    r = n % m
    break if r == 0
    n, m = m, r
  }
  m
end


dis = dis.inject{|a, b| gcd(a, b)}

if dis
  puts dis
else
  puts points[0]-X
end


Measured memory_bytes: 13176
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main() {
    int a,b,c;
    cin >> a >> b >>c;
    if (c >= a && c <= b) {
        cout << "Yes" << "\n";
    } else {
        cout << "No" << "\n";
    }
}


Measured memory_bytes: 256
#include <stdio.h>

int main () {
	int n;
	scanf("%d", &n);
	if (n%10 == 7 || (n/10) %10 == 7 || n/100 == 7) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
	return 0;
}

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

using namespace std;

int main() {
  int h, w;
  cin >> h >> w;

  int ans = max(h, w);

  vector<vector<int>> a(h, vector<int>(w));
  for (int i = 0; i < h; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < w; j++) {
      a[i][j] = s[j] == '#';
      if (i > 0 && j > 0) {
        a[i - 1][j - 1] ^= a[i][j] ^ a[i][j - 1] ^ a[i - 1][j];
      }
    }
  }

  vector<int> y(w, 1);
  vector<int> left(w);
  for (int i = 0; i < h - 1; i++) {
    vector<int> t;
    for (int j = 0; j < w; j++) {
      if (j == w - 1) {
        y[j] = 0;
      } else if (a[i][j] == 1) {
        y[j] = 1;
      } else {
        y[j]++;
      }
      while (!t.empty() && y[t.back()] >= y[j]) {
        ans = max(ans, (j - left[t.back()]) * y[t.back()]);
        t.pop_back();
      }
      left[j] = t.empty() ? -1 : t.back();
      t.push_back(j);
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 16000
#include <bits/stdc++.h>
#define MOD 1e9 + 7
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
typedef pair<ll, ll> P;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }
bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }


int main() {
    string r,b,u;
    cin >> r >> b;
    int x,y;
    cin >> x >> y;
    cin >> u;

    if (u == r){
        x -=1;    
    }else if(u == b){
        y -= 1;
    }

    cout << x << " " << y << endl;


  

    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(o) {cerr<<#o<<" "<<o<<endl;}
#define DUMPC(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	int p, s; char c;
	vector<pii> b;
	while (cin >> p >> c >> s&&p) {
		b.push_back(pii(s, p));
	}
	sort(ALL(b), greater<pii>());
	vector<int> r(b.size() + 1);

	r[b[0].second] = 1;
	FOR(i, 1, b.size()) {
		if (b[i].first == b[i - 1].first)r[b[i].second] = r[b[i - 1].second];
		else r[b[i].second] = r[b[i - 1].second] + 1;
	}
	for (int q; cin >> q;) {
		cout << r[q] << endl;
	}
	return 0;
}

Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
// typedef pair<int, int> P;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;

typedef complex<double> P;
const double EPS = 1e-10;
const double INF = 1e12;

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

    int N;
    cin >> N;
    VV d(N, V(N));
    rep(i, N) rep(j, N) cin >> d[i][j];
    int ans = 0;
    rep(i, N) rep(j, i) ans += min(d[i][j], d[j][i]);
    cout << ans << endl;

}

Measured memory_bytes: 3264
#include <bits/stdc++.h>
using namespace std;
signed main(){
  int a;
  cin>>a;
  if(a==25)
    cout<<"Christmas"<<endl;
  else if(a==24)
    cout<<"Christmas Eve"<<endl;
  else if(a==23)
    cout<<"Christmas Eve Eve"<<endl;
  else if(a==22)
    cout<<"Christmas Eve Eve Eve"<<endl;
  
  return(0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




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

    
    string S;
    cin >> S;
    rep(i,int(S.length())) if(S[i] == '?') S[i] = 'D';
    cout << S << endl;
    
    

    return 0;
}


Measured memory_bytes: 3744
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
// #define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

signed main(){
    string s;
    cin >> s;
    int n = s.size();
    int MIN = 114;
    rep(i, 0, 26){
        string t = s;
        char c = 'a' + i;
        rep(j, 0, n){
            string u;
            set<char> st;
            rep(k, 0, t.size()) st.insert(t[k]);
            if(st.size() == 1){
                MIN = min(MIN, j);
                break;
            }
            rep(k, 0, t.size() - 1){
                if(t[k] == c || t[k + 1] == c){
                    u += c;
                }else{
                    u += t[k];
                }
            }
            t = u;
            
        }
    }
    cout << MIN << endl;
}

Measured memory_bytes: 256