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

// ?????¶???????????§???(????§°)????§£????????????????????????
// ??????: ?????????cost??\?????§??????????????????????????????
class ConditionalMaxFlow{
private:
  static const int inf = 1e9;
  struct edge{ int to, cap, cost, rev; };
  int V;
  vector<vector<edge> > G;
  vector<int> dist, prevv, preve;
public:
  // ?????????????????????
  ConditionalMaxFlow(int size){
    V = size;
    G = vector<vector<edge> >(size);
    dist = vector<int>(size);
    prevv = vector<int>(size);
    preve = vector<int>(size);
  }

  // ????????????
  void add_edge(int from, int to, int cap, int cost){
    G[from].push_back((edge){to, cap, cost, G[to].size()});
    G[to].push_back((edge){from, 0, -cost, G[from].size()-1});
  }

  // s??????t?????§?????????cost??\?????§?????????????????§???????±???????
  int flow(int s, int t, int cost){
    int res = 0, f = 0;
    
    while(res < cost){
      // ???????????????????????????????????????s-t????????????????±???????
      for(int i = 0; i < dist.size(); i++){ dist[i] = inf; }
      dist[s] = 0;

      bool update;
      do{
        update = false;
        for(int v = 0; v < V; v++){
          if(dist[v] == inf){ continue; }
          for(int i = 0; i < G[v].size(); i++){
            edge &e = G[v][i];
            if(e.cap > 0 && dist[e.to] > dist[v] + e.cost){
              dist[e.to] = dist[v] + e.cost;
              prevv[e.to] = v;
              preve[e.to] = i;
              update = true;
            }
          }
        }
      }while(update);

      // ??????????????????
      if(dist[t] == inf){ break; }

      // s-t????????????????????£??????????????????
      int d = 1e9;
      for(int v = t; v != s; v = prevv[v]){
        if(d > G[prevv[v]][preve[v]].cap){ d = G[prevv[v]][preve[v]].cap; }
      }

      // ???????????????????????????????????¢??????
      if(res + (d * dist[t]) > cost){ break; }
      res += d * dist[t];
      f += d;
      
      for(int v = t; v != s; v = prevv[v]){
        edge &e = G[prevv[v]][preve[v]];
        e.cap -= d;
        G[v][e.rev].cap += d;
      }
    }
    
    return f;
  }
};


int main(void){
  int A, B, K;
  string a, b;

  cin >> A >> B >> K;

  // ?????§???????????????????????????
  vector<vector<int> > compatible(A, vector<int>(B));
  for(int i = 0; i < A; i++){
    cin >> a;
    for(int j = 0; j < a.size(); j++){ compatible[i][j] = (a[j] != '1') ? 0 : 1; }
  }
  for(int i = 0; i < B; i++){
    cin >> b;
    for(int j = 0; j < b.size(); j++){ compatible[j][i] += (b[j] != '1') ? 0 : 1; }
  }
  
  // ?????§???????????????????????¨?????????????????????
  ConditionalMaxFlow cmf = ConditionalMaxFlow(A + B + 2);
  for(int i = 0; i < A; i++){ cmf.add_edge(A + B, i, 1, 0); }
  for(int i = 0; i < A; i++)
    for(int j = 0; j < B; j++)
      cmf.add_edge(i, A + j, 1, compatible[i][j]);
  for(int j = 0; j < B; j++){ cmf.add_edge(A + j, A + B + 1, 1, 0); }

  // ?????¶???????????§???(????§°)????§£????????????????????????
  cout << cmf.flow(A + B, A + B + 1, K) << endl;
  
  return 0;
}

Measured memory_bytes: 2856
#include<stdio.h>
#include<math.h>
int isprime(int x);
int main(void){
	
	int n;
	scanf("%d",&n);
	int a[n],i,c=0;
	
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	
	for(i=0;i<n;i++){
		c=c+isprime(a[i]);
	}
	
	printf("%d",c);
	printf("\n");
	
	return 0;
}

isprime(int x){
	int i=3;
	
	if(x==2){
		return 1;
	}
	
	else if(x<2||x%2==0){
		return 0;
	}
	
	while(i<=sqrt(x)){
		if(x%i==0){
			return 0;
		}
		i=i+2;
	}
	return 1;
	
}



Measured memory_bytes: 2100
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<set>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl

#define all(x) x.begin(),x.end()
typedef pair<int,int> P;
typedef pair<int,P> PP;
int n;
int a[100006];
int b[100006];
int v[100006];
int aa,bb;
int aax,aay,bbx,bby;
int main()
{
	cin>>n;
	rep(i,n)
	{
		cin>>v[i];
	}
	for(int i=0;i<n;i+=2)
	{
		a[v[i]]++;
	}
	for(int i=1;i<n;i+=2)
	{
		b[v[i]]++;
	}
	for(int i=1;i<100001;i++)
	{
		if(aax<=a[i])
		{
			aay=aax;
			aax=a[i];
			aa=i;
		}
		else if(aay<=a[i])
		{
			aay=a[i];
		}
		if(bbx<=b[i])
		{
			bby=bbx;
			bbx=b[i];
			bb=i;
		}
		else if(bby<=b[i])bby=b[i];
	}
	if(aay==0&&bby==0)
	{
		if(aa==bb)
		{
			cout<<n/2<<endl;
		}
		else
		{
			cout<<0<<endl;
		}
	}
	else if(aay==0)
	{
		if(aa==bb)
		{
			cout<<n-aax-bby<<endl;
		}
		else
		{
			cout<<n-aax-bbx<<endl;
		}
	}
	else if(aax==0)
	{
		if(aa==bb)
		{
			cout<<n-aay-bbx<<endl;
		}
		else cout<<n-aax-bbx<<endl;
	}
	else if(aa!=bb)
	{
		cout<<n-aax-bbx<<endl;
	}
	else 
	{
		cout<<min(n-aax-bby,n-aay-bbx)<<endl;
	}
	return 0;
}

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

sys.setrecursionlimit(10**7)
inf = 10**20
gosa = 1.0 / 10**10
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
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 main():
    n = I()
    a = [I() for _ in range(n)]
    t = 1
    r = a[0] - 1
    for c in a[1:]:
        if c > t+1:
            r += (c-t-2) // (t+1) + 1
        elif c == t+1:
            t = c

    return r


print(main())



Measured memory_bytes: 10304
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>

using namespace std;

#define int long long
#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll N=1e5+10,M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
const int INF=1e9+7;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}


int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}

int f[10000002];

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    int ans=0;
    for(int i=1; i<=n; i++){
        for(int j=1; j*i<=n; j++)
            f[i*j]++;
        ans+=i*f[i];
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 81772
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>

long long mod = 1e9+7;
class Mint {
public:
  long long x;
  Mint(){}; // 引数なしでも定義できるように引数なしコンストラクタも用意しておく
  Mint(long long a){
    x = a%mod;
    while(x<0){
      x += mod;
    }
  };
  Mint& operator += (const Mint &a){
    x+=a.x;
    x%=mod;
    return *this;
  }
  Mint& operator -= (const Mint &a){
    x += (mod - a.x);
    x%=mod;
    return *this;
  }
  Mint& operator *= (const Mint &a){
    x*=a.x;
    x%=mod;
    return *this;
  }

  // a^n mod を計算する
  // Useaeg: Mint z = y.pow(y, n);
  Mint pow(Mint a, long long n) const {
    Mint y(1);
    Mint b(a);
    while (n > 0) {
      if (n & 1) y *= b;
      b *= b;
      n >>= 1;
    }
    return y;
  }

  // a^{-1} mod を計算する
  Mint modinv(const Mint &a) const {
    return pow(a, mod-2);
  }

  Mint& operator /= (const Mint &a) {
    x *= modinv(a).x;
    x %= mod;
    return *this;
  }

  Mint operator + (Mint &a) const {
    Mint y(*this);
    y += a;
    return y;
  }

  Mint operator - (Mint &a) const {
    Mint y(*this);
    y -= a;
    return y;
  }

  Mint operator * (Mint &a) const {
    Mint y(*this);
    y *= a;
    return y;
  }

  Mint operator / (Mint &a) const {
    Mint y(*this);
    y/=a;
    return y.x;
  }

  // nCk @mod を計算する
  Mint nCk(Mint &n, const long long k) const {
    Mint y = Mint(1);
    for (Mint i(0); (i.x)<k; i.x++){
      y *= (n-i);
      y /= i;
    }
    return y;
  }

  // nPk @mod を計算する
  Mint nPk(Mint &n, long long k) const {
    Mint y(1);
    for (Mint i(0); (i.x)<k; i.x++){
      y *= (n-i);
    }
    return y;
  }
};

int getrate(int combo){
  return 100+combo/10*10;
}

int main(){
  int N, x;
  std::cin >> N >> x;
  if (x==1 || x==2*N-1) {
    printf("No\n");
  } else {
    std::vector<int > ans(2*N-1);
    ans[N-1]=x;
    ans[N-2]=x-1;
    ans[N]=x+1;
    int index = 0;
    for (int i=1; i<=2*N-1; i++){
      if (i>=x-1 && i<=x+1){
        continue;
      }
      ans[index]=i;
      //printf("ans[%d]=%d\n", index, i);
      index++;
      if (index==N-2) index+=3;
    }
    printf("Yes\n");
    for (int p : ans){
      printf("%d\n", p);
    }
  }
  return 0;
}

Measured memory_bytes: 3640
x1, y1, x2, y2 = map(int, input().split(' '))

dx = x2 - x1
dy = y2 - y1

x3 = x2 - dy
y3 = y2 + dx

x4 = x3 - dx
y4 = y3 - dy

print(' '.join(map(str, [x3, y3, x4, y4])))


Measured memory_bytes: 2940
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#ALDS1_1_B

def gcd(x, y):
    if x < y:
        x, y = y, x
    while y > 0:
        r = x % y
        x = y
        y = r
    return x

x, y = map(int, input().split())
print(gcd(x, y))


Measured memory_bytes: 5604
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s=sc.next();
    long count=0;
    boolean w=false,b=false;
    if(s.substring(0, 1).equals("W"))w=true;
    else b=true;
    for(int i=1;i<s.length();i++) {
    	if(s.substring(i, i+1).equals("W")) {
    		if(!w) {
    			count++;
    			w=true;
    		}
    		b=false;
    	}else {
    		if(!b) {
    			count++;
    			b=true;
    		}
    		w=false;
    	}
    }
    
    System.out.println(count);
  }
}


Measured memory_bytes: 30680
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    
    string s; cin >> s;
    s[3] = '8';
    print(s)
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define pb push_back
#define mp make_pair
#define F .first
#define S .second 
using ll=long long;
using ld=long double;
const ll INF = 1LL<<60;
const ll mod=1e9+7;
using namespace std;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
 

long long modpow(ll a, ll b) {
    ll res=1;
    while (b) {
        if (b&1)res=res*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return res;
}
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(){
    ll n,a,b,k,ans;
    cin>>n>>a>>b;
    ans=modpow(2,n)-1;
    ll tmp1=1,tmp2=1;
    rep(i,0,a){tmp1=tmp1*(n-i)%mod;tmp2=tmp2*(i+1)%mod;}
    ans=(ans-tmp1*modinv(tmp2,mod)%mod)%mod;
    tmp1=1,tmp2=1;
    rep(i,0,b){tmp1=tmp1*(n-i)%mod;tmp2=tmp2*(i+1)%mod;}
    ans=(ans-tmp1*modinv(tmp2,mod)%mod)%mod;

    cout<<(ans+mod)%mod;
}

Measured memory_bytes: 3624
#include<algorithm>
#include<iostream>
#include<stdio.h>
#include<iostream>
#include<stdio.h>
#include<vector>
#include<set>
#include<string>
#include<iomanip>
#include<queue>
#include<functional>
#include<cmath>
#include<map>
#include<tuple>
#define rep(i,n) for(int i=0; i<(int)n; i++)//n回繰り返す
#define rrep(i,n)for(int i=n-1;i>=0;i--)
#define REP(i,n) for (int i = 1; i <= (int)n; i++)//i=1からi=nまで
#define RREP(i,n)for(int i=n;i>=1;i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using graph = vector<vector<int>>;
const ll mod = pow(10, 9) + 7;
const int INF = 1e9;
const ll LINF = 1e18;
const double pi = 3.14159265358979323846;
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; }

int main() {
    int X, Y; cin >> X >> Y;
    if ((Y - 2 * X) >= 0) {
        if ((Y - 2 * X) / 2 <= X && (Y - 2 * X) % 2 == 0) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }
    else {
        cout << "No" << endl;
    }
}












Measured memory_bytes: 3632
#include<iostream>
using namespace std;
#define MAX 500000
#define SENTINEL 2000000000

int L[MAX/2+2],R[MAX/2+2];
int cnt;

void merge(int A[],int n,int left,int mid,int right)
{
	int n1=mid-left;
	int n2=right-mid;
	for(int i=0;i<n1;i++)
	{
		 L[i]= A[left+i];
	}
	for(int i=0;i<n2;i++)
	{
		 R[i]= A[mid+i];
	}
	L[n1]=R[n2]=SENTINEL;
	int i=0,j=0;
	for(int k=left;k<right;k++)
	{
		cnt++;
		if(L[i]<=R[j])
		{
			A[k]=L[i++];
		}
		else
		{
			A[k]=R[j++];
		}
	}
}

void mergeSort(int A[],int n,int left,int right)
{
	if(left+1<right)
	{
		int mid=(left + right)/2;
		mergeSort(A,n,left,mid);
		mergeSort(A,n,mid,right);
		merge(A,n,left,mid,right);
	}
}

int main()
{
	int A[MAX],n,i;
	cnt=0;
	
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>A[i];
	}
	
	mergeSort(A,n,0,n);
	
	for(i=0;i<n;i++)
	{
		if(i)cout<<" ";
		cout << A[i];
	}
	cout << endl;
	
	cout << cnt << endl;
	
	return 0;
}

Measured memory_bytes: 6908
n=int(input())
b=input().split()

a=[0]*n
a[0]=b[0]
a[n-1]=b[n-2]
ans=0

for i in range(n-2):
  if int(b[i+1])>=int(b[i]):
    a[i+1]=b[i]
  else:
    a[i+1]=b[i+1]

for j in range(n):
  ans+=int(a[j])

print(ans)


Measured memory_bytes: 3064
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 2*(10**6)
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

K = int(input())
S = input()
L = len(S)

ans = 0
for i in range(K+1):
    ans += cmb(K+L-i-1,K-i,mod)*pow(25,K-i,mod)*pow(26,i,mod)
    ans %= mod

print(ans)

Measured memory_bytes: 222388
#include<bits/stdc++.h>
using namespace std;
int n;
char change(char c)
{
	c+=n;
	if(c>'Z')
		c-=26;
	return c;
}
int main()
{

	string s;
	while(cin>>n)
	{
		cin>>s;
		for(int i=0; i<s.length(); i++)
		{
			cout<<change(s[i]);
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int gcd(int a, int b) {
	if (a < 0) return b;
	if (b < 0) return a;
	while (b > 0) {
		int r = a % b;
		a = b;
		b = r;
	}
	return a;
}

#define MAX (1 << 17) /* 131072 */

int ki[MAX * 2 - 1];

void ki_init(void) {
	int i;
	for (i = (MAX - 1) - 1; i >= 0; i--) {
		ki[i] = gcd(ki[i * 2 + 1], ki[i * 2 + 2]);
	}
}

int ki_get_i(int idx, int qmin, int qmax, int smin, int smax) {
	if (smax <= qmin || qmax <= smin) { /* セグメントがクエリから完全に外れている */
		return -1;
	} else if (qmin <= smin && smax <= qmax) { /* セグメントがクエリに完全に含まれる */
		return ki[idx];
	} else {
		int smid = smin + (smax - smin) / 2;
		int left = ki_get_i(idx * 2 + 1, qmin, qmax, smin, smid);
		int right = ki_get_i(idx * 2 + 2, qmin, qmax, smid, smax);
		return gcd(left, right);
	}
}

int ki_get(int min, int max) {
	if (min >= max) return -1;
	return ki_get_i(0, min, max, 0, MAX);
}

int main(void) {
	int N;
	int i;
	int uedayuuzi = 0;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &ki[(MAX - 1) + i]) != 1) return 1;
	}
	ki_init();
	for (i = 0; i < N; i++) {
		int tunodanarumi = gcd(ki_get(0, i), ki_get(i + 1, N));
		if (tunodanarumi > uedayuuzi) uedayuuzi = tunodanarumi;
	}
	printf("%d\n", uedayuuzi);
	return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <cctype>
using namespace std;
typedef long long ll;
void Read(ll &x){
    static char c;
    while(!isdigit(c=getchar()));
    x=(c^48);
    while(isdigit(c=getchar()))
        x=x*10+(c^48);
    return;
}
ll n;
int res=0LL;
int main(){
    Read(n);
    for(ll i=2;i*i<=n;++i)
        if(!(n%i)){
            int cnt=0;
            do{
                ++cnt;
                n/=i;
            }while(!(n%i));
            for(int j=1;cnt-j>j;++j){
                ++res;
                cnt-=j;
            }
            ++res;
        }
    if(n!=1)
        ++res;
    printf("%d\n",res);
    return 0;
}

Measured memory_bytes: 1604
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
template < typename T > string tost( const T& n ) {
    ostringstream stm;
    stm << n;
    return stm.str();
}


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

int N,M;
cin >> N >> M;

vector<int> s(M);
vector<char> c(M);
rep(i,M) {
    cin >> s[i] >> c[i];
    --s[i];
}

string ans = "1001";

rep(n,1000) {
    string str = tost(n);
    if(str.size() != N) continue; //N桁でないなら次へ
    bool ok = true;
    rep(i,M) {
        if(str[s[i]] != c[i]) ok = false;
    }
    if(ok) {
        ans = str;
        break;
    }
}

if(ans == "1001") cout << -1 << endl; //見つからなかった
else cout << ans << endl;

return 0;
}

Measured memory_bytes: 256
import sys

for s0 in sys.stdin:
  s=s0[:-1]
  i=s.find("+")
  j=s.find("=")
  A=[s[0:i],s[i+1:j],s[j+1:]]
  f=0
  for e in A:
    if e[0]=="X" and len(e)>1: f=1; break
  s="NA"
  for c in "0123456789"[f:]:
    x,y,z=map(int,[e.replace("X",c) for e in A])
    if x+y==z: s=c
  print s

Measured memory_bytes: 4260
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            String[] s = in.nextStringArray(n);

            int[] cnt = new int[26];
            for (int i = 0; i < s[0].length(); i++) {
                cnt[s[0].charAt(i) - 'a']++;
            }
            for (int i = 1; i < n; i++) {
                int[] tmp = new int[26];
                for (int j = 0; j < s[i].length(); j++) {
                    tmp[s[i].charAt(j) - 'a']++;
                }

                for (int j = 0; j < 26; j++) {
                    cnt[j] = Math.min(cnt[j], tmp[j]);
                }
            }

            String ans = "";
            for (int i = 0; i < 26; i++) {
                for (int j = 0; j < cnt[i]; j++) {
                    ans += (char) (i + 'a');
                }
            }

            out.println(ans);
        }

    }

    static class InputReader {
        private BufferedReader in;
        private StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public String[] nextStringArray(int n) {
            String[] res = new String[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextString();
            }
            return res;
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 21328
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
const int N = 3e5+ 2, mod = 1e9 + 7;

void solve() {
     int x;
     cin >> x;
     cout << !x;
}    


int main() {
	int tt = 1;
	// cin >> tt;
	for (int tc = 1; tc <= tt; tc++) {
		// cout << "Case #:" << tc << " ";
		solve();
	}
}

Measured memory_bytes: 3584
#include  <bits/stdc++.h>
using namespace std;
int main(){
   string s;
   cin >> s;
   bool left = true;
   bool right = true;
   for(int i=0;i<s.size();i++){
      if(i%2==0 && s[i] != 'R' && s[i] != 'U' && s[i] != 'D'){
         right = false;
      }
      if(i%2==1 && (s[i] != 'L' && s[i] != 'U' && s[i] != 'D')){
         left = false;
      }
   }
   if(left && right) cout << "Yes" << endl;
   else cout << "No" << endl;
}
//ctrl + shift + b

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
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;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

vll s = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    debug("debug test\n");
    ll n;cin>>n;
    vll ss(s.size(), 0);
    for(ll i = 2;i <= n;i++){
        ll t = i;
        rep(j, s.size()){
            while(t%s[j]==0){
                t /= s[j];
                ss[j]++;
            }
            if(t==1)break;
        }
    }
    ll ni = 0,yon = 0,juyon = 0,nijuyon = 0; 
    rep(i, s.size()){
        debug("s:%d ss:%d\n", s[i], ss[i]);
        if(ss[i]>=2)ni++;
        if(ss[i]>=4)yon++;
        if(ss[i]>=14)juyon++;
        if(ss[i]>=24)nijuyon++;
    }
    ll ans = 0;
    ans += (yon*(yon-1)/2)*(ni - 2);
    ans += juyon*(yon-1);
    ans += nijuyon*(ni-1);
    if(ss[0]>=74)ans++;
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
N = int(input())
S = []
for i in range(N):
  S.append(input())

key = "MARCH"
C = [0] * 5

for i in range(len(S)):
  for j in range(5):
    if S[i][0] == key[j]:
      C[j] += 1

ans = 0
for i in range(5):
  for j in range(i+1, 5):
    for k in range(j+1, 5):
      ans += C[i] * C[j] * C[k]

print(ans)

Measured memory_bytes: 9752
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace CSharp
{
    static class Program
    {
        static void Main(string[] args)
        {
            ReadString();
            string s = ReadString();

            int ans = 0;
            char last = default(char);
            foreach (var c in s)
            {
                if (last != c)
                {
                    ans++;
                }

                last = c;
            }

            Console.WriteLine(ans);
        }

        #region Helpers

        static int[] ReadIntArray() => Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        static long[] ReadLongArray() => Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();

        static int[] ReadLineIntArray(int count) => Enumerable.Repeat(0, count).Select(_ => int.Parse(Console.ReadLine())).ToArray();
        static long[] ReadLineLongArray(int count) => Enumerable.Repeat(0, count).Select(_ => long.Parse(Console.ReadLine())).ToArray();

        static string ReadString() => Console.ReadLine();
        static int ReadInt() => int.Parse(Console.ReadLine());
        static long ReadLong() => long.Parse(Console.ReadLine());

        static void ReadInt(out int first)
        {
            var array = ReadIntArray();
            first = array[0];
        }

        static void ReadInt(out int first, out int second)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
        }

        static void ReadInt(out int first, out int second, out int third)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadInt(out int first, out int second, out int third, out int fourth)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        static void ReadLong(out long first)
        {
            var array = ReadLongArray();
            first = array[0];
        }

        static void ReadLong(out long first, out long second)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
        }

        static void ReadLong(out long first, out long second, out long third)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadLong(out long first, out long second, out long third, out long fourth)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        static string YesNo(bool condition) => condition ? "Yes" : "No";
        static string YESNO(bool condition) => condition ? "YES" : "NO";

        #endregion
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 10;

int n, m, k, s, p;

vector<int> conn[N];
bitset<N> def, on;
ll ans;

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
		cin >> k;
		for (int j = 0; j < k; j++) {
			cin >> s;
			s--;
			conn[s].push_back(i);
		}
	}
	
	for (int i = 0; i < m; i++) {
		cin >> p; def[i] = (p == 1);
	}
	
	for (int i = 0; i < (1 << n); i++) {
		on.reset();
		for (int j = 0; j < n; j++) {
			if (i & (1 << j)) {
				for (auto& bulb : conn[j]) {
					on[bulb] = !on[bulb];
				}
			}
		}
		bool valid = true;
		for (int j = 0; j < m; j++) {
			if (on[j] != def[j]) valid = false;
		}
		if (valid) {
			// cout << i << "\n";
			ans++;
		}
	}
	cout << ans;
    return 0;
}


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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define REPRl(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < (int)n; i++)
#define FORl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define ALL(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
int main() {
  int n,T;cin>>n>>T;
  int mn=INT_MAX;
  REP(i,n){
    int c,t;cin>>c>>t;
    if(t<=T){
      mn=min(mn,c);
    }
  }
  if(mn!=INT_MAX){
    cout << mn << endl;
  }else{
    cout << "TLE" << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){

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

Measured memory_bytes: 584
#include <bits/stdc++.h>
using std::cout;
using std::endl;
using std::cin;

std::vector<long> A, B, C, D;
int a, b, c, d, e, f;

int main(){
	cin >> a >> b >> c >> d >> e >> f; a *= 100; b *= 100;
	for(int i = 0; a * i <= f; i++) A.push_back(a * i);
	for(int i = 0; b * i <= f; i++) B.push_back(b * i);
	for(int i = 0; c * i <= f; i++) C.push_back(c * i);
	for(int i = 0; d * i <= f; i++) D.push_back(d * i);
	
	long pos = 0, pot = 1e9;
	for(int i = 0; i < A.size(); i++){
		for(int j = 0; j < B.size(); j++){
			for(int k = 0; k < C.size(); k++){
				for(int l = 0; l < D.size(); l++){
					long X = A[i] + B[j], Y = C[k] + D[l];
					if(X / 100 * e < Y) continue;
					if(X + Y > f) continue;
					
					if(pos * (X + Y) < Y * pot){
						pos = Y;
						pot = X + Y;
					}
				}
			}
		}
	}
	
	if(pot == 1e9) cout << a << " " << 0 << endl;
	else cout << pot << " " << pos << endl;
	return 0;
}


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

int main()
{
    int A[4], B[4];
    int S = 0, T = 0;
    for (int i = 0; i < 4; i++){
       cin >> A[i];
       S += A[i];
    }

    for (int j = 0; j < 4; j++){
        cin >> B[j];
        T += B[j];
    }

    int big = max(S, T);

    cout << big << endl;

    return 0;

}

Measured memory_bytes: 3056
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  int N;
  cin >> N;
  
  for(int i=0; i<N; i++){
    string X;
    cin >> X;
    
    if(X=="Y"){
      cout << "Four" << endl;
      break;
    }
    
    if(i==N-1){
      cout << "Three" << endl;
    }
    
  }
}


Measured memory_bytes: 256
N = int(input())
t = [0] * (N+1)
x = [0] * (N+1)
y = [0] * (N+1)
for i in range(1,N+1):
    t[i], x[i], y[i] = map(int, input().split())

can = 'Yes'
for i in range(N):
    dt = t[i+1]-t[i]
    dist = abs(x[i+1]-x[i])+abs(y[i+1]-y[i])
    if (dt < dist) or (dt%2 != dist%2): #t=1でx+yが奇数でt=2でx+yが偶数
        can = 'No'

print(can)

Measured memory_bytes: 11636
#include <iostream>
#include <string>
using namespace std;
int main(void) {
	int N, R = 0, B = 0;
	string S, answer;
	cin >> N >> S;
	for (int i = 0; i<N; i++) {
		if (S.at(i) == 'R') {
			R++;
		}
		else {
			B++;
		}
	}
	if (R>B) {
		answer = "Yes";
	}
	else {
		answer = "No";
	}
	cout << answer << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner stdIn = new Scanner(System.in);
        int n =  stdIn.nextInt();
        int[] a = new int[n];
        double sumW = 0;
        double sumS = 1;
        for(int i = 0; i < n; i++){
            a[i] = stdIn.nextInt();
            sumS *= a[i];
        }
        for(int i = 0; i < n; i++){
            sumW += sumS/a[i] ;
        }
        System.out.println(sumS/sumW);
    }
}

Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;

vector<int> tonari[100010];

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

    vector<int> distf(N,-1),dists(N,-1);

    int a,b;
    for (int i = 0; i < N - 1; ++i) {
        cin>>a>>b; a--; b--;
        tonari[a].push_back(b);
        tonari[b].push_back(a);
    }
  

    //fennec
    queue<int> q;
    distf[0]=0;
    q.push(0);
    while(!q.empty()){
        int node=q.front();
        q.pop();
        for(auto tsugi:tonari[node]){
            if(distf[tsugi]>=0) continue;
            distf[tsugi]=distf[node]+1;
            q.push(tsugi);
        }
    }

    //sunuke
    dists[N-1]=0;
    q.push(N-1);
    while(!q.empty()){
        int node=q.front();
        q.pop();
        for(auto tsugi:tonari[node]){
            if(dists[tsugi]>=0) continue;
            dists[tsugi]=dists[node]+1;
            q.push(tsugi);
        }
    }

  
    int f=0,s=0;
    for (int i = 0; i < N; ++i) {
        //printf("%d : fennec %d, sunuke %d \n",i,distf[i],dists[i]);
        if(distf[i]<=dists[i]) {
            f++;
        }
        else s++;
    }
    //cout<<f<<" "<<s<<endl;
    cout<<((f>s)?"Fennec":"Snuke")<<endl;

    return 0;
}

Measured memory_bytes: 6656
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));


		  try{


			  while(true){
				  //????????\???
			     String ab = input.readLine();
		         String []strAry = ab.split(" ");
		         int  a=Integer.parseInt(strAry[0]);
	             int b=Integer.parseInt(strAry[1]);
	             int count=0;
	             int countb=0;
	              if(a==0&&b==0){
	        	      break;
	               }
	                  //a?????°?????????
	                  for(int i=0; i<a; i++){
	                	  //countb????????????????????¨??§else???????????????????????????
	                	  countb=0;
	        	          for(int j=0; j<b; j++){
	        	        	  //count???????????????a???????????????
	        	        	  if(count==a-1||count==0){
	        	        		  //????????????,??????????????¨??????????????????????????????????????????
	        	                 System.out.print('#');
	        	                 //count???????????\????????????????????¨??????????????\?????????
	        	        	  }else{
	        	        		  //countb??????????????¨????????????????????????????????????
	        	        		  countb++;
	        	        		  //countb???????????????????????????
	        	        		  if(countb==1||countb==b){
	        	        			  System.out.print('#');
	        	        			  //countb???????????\???
	        	        		  }else{
                                       System.out.print('.');
	        	        		  }
	        	        	  }


	        	           }
	        	          count++;
	        	          System.out.println("");

	                  }


	                  System.out.println("");
	              }



		    }catch(IOException e) {   System.out.println("Exception : " + e);
		    }

	}
}

Measured memory_bytes: 34716
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <math.h>
#include <map>
#include <time.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int n, k;
  cin >> n >> k;
  cout << n - k + 1 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
  string S;
  cin>>S;
  int i=S.size()-1;
  int judge=0;
  while(judge==0){
    if(i==-1) judge=1;
    else if(S[i]=='r'){
      if(i>=5&&S[i-3]=='a'&&S[i-1]=='e'){
        if(S[i-5]=='e'&&S[i-4]=='r'&&S[i-2]=='s') i-=6;
        else if(i>=6&&S[i-6]=='d'&&S[i-5]=='r'&&S[i-4]=='e'&&S[i-2]=='m'){
          i-=7;
        }
        else judge=1;
      }
      else judge=1;
    }
    else if(i>=4&&S[i-3]=='r'){
      if(S[i-4]=='d'&&S[i-2]=='e'&&S[i-1]=='a'&&S[i]=='m') i-=5;
      else if(S[i-4]=='e'&&S[i-2]=='a'&&S[i-1]=='s'&&S[i]=='e') i-=5;
      else judge=1;
    }
    else judge=1;
  }
  if(i==-1) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  
  return 0;
}

Measured memory_bytes: 3204
#include <iostream>

using namespace std;

int gcd(int a, int b) {
    while (a > 0 && b > 0) {
        a %= b;
        swap(a, b);
    }
    return a + b;
}

int main()
{
    int n, k, a, g, mx = 0;
    cin >> n >> k >> g;
    mx = g;
    for (int j = 1; j < n; j++) {
        cin >> a;
        mx = max(a, mx);
        g = gcd(a, g);
    }
    if (k % g || k > mx) {
        cout << "IMPOSSIBLE";
    }
    else {
        cout << "POSSIBLE";
    }
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("5 2");
            //18
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("3 -1");
            //0
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("30 -50");
            //-1044
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();

        int[] wkArr = InputList[0].Split(' ').Select(X => int.Parse(X)).ToArray();
        int N = wkArr[0];
        int L = wkArr[1];

        var AppleList = new List<int>();
        for (int I = 1; I <= N; I++) {
            AppleList.Add(L + I - 1);
        }
        int Sum = AppleList.Sum();

        int MinAbsVal = AppleList.OrderBy(X => Math.Abs(X)).First();
        Sum -= MinAbsVal;
        Console.WriteLine(Sum);
    }
}


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

using namespace std;
const int maxn=1e5+5;

int o[maxn],l[maxn],r[maxn];
long long w[maxn],s[maxn];


int sfind(int f)
{
    return f==o[f]?f:o[f]=sfind(o[f]);
}

int main()
{
    long long n,m,ans;
    while(cin>>n>>m)
    {
        ans=n*(n-1)/2;
        for(int i=0;i<=n;i++)
            o[i]=i,w[i]=1;
        for(int i=0;i<m;i++)
            cin>>l[i]>>r[i];
        for(int i=m-1;i>=0;i--)
        {
            s[i]=ans;
            int x=sfind(l[i]);
            int y=sfind(r[i]);
            if(x!=y)
            {
                o[x]=y;
                ans-=w[x]*w[y];
                //cout<<x<<' '<<y<<'*'<<ans<<endl;
                w[y]+=w[x];
            }
        }
        for(int i=0;i<m;i++)
            cout<<s[i]<<endl;
    }
    return 0;
}



Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {//解説動画の写し
  int X,Y,A,B,C;
  cin >>X>>Y>>A>>B>>C;
  vector<int>p(A),q(B),r(C);
  rep(i,A)cin>>p[i];
  rep(i,B)cin>>q[i];
  rep(i,C)cin>>r[i];
  sort(p.rbegin(),p.rend());
  sort(q.rbegin(),q.rend());
  vector<int> d;
  rep(i,X)d.push_back(p[i]);
  rep(i,Y)d.push_back(q[i]);
  rep(i,C)d.push_back(r[i]);
  sort(d.rbegin(),d.rend());
  long long kotae=0;
  rep(i,X+Y)kotae+=(d[i]);
  cout<<kotae<<endl;
  return 0;
}

Measured memory_bytes: 3572
import sys


N = int(input())
#print(N)
#a = list(map(int, input().split()))
t = []
x = []
y = []
flag = 0

for i in range(0,N):
    line = input().split()
    t0 = int(line[0])
    x0 = int(line[1])
    y0 = int(line[2])
    if len(t)>0:
        if ((t0-t[i-1])-(x0-x[i-1])-(y0-y[i-1])) % 2 != 0:
        #if ((t0-t[i-1])-(x0-x[i-1])-(y0-y[i-1])) % 2 != 0 or ((abs(t0-t[i-1])-abs(x0-x[i-1])-abs(y0-y[i-1])) > 0:
            flag = 1
        if (abs(t0-t[i-1])-abs(x0-x[i-1])-abs(y0-y[i-1])) < 0:
            flag = 1
    else:
        if t0 - x0 -y0 <0:
            flag = 1

    t.append(t0)
    x.append(x0)
    y.append(y0)
    #print(line[0])



if flag == 1:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 11804
import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
import  java.io.*;
import  java.math.*;
import java.nio.Buffer;
import java.sql.SQLSyntaxErrorException;
import  java.util.*;
import  java.text.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;


public class Main {
    public static boolean gcd(int a,int b){
        if(a==1||b==1){
            return false;
        }
        while(1>0){
            int t = a%b;
            if(t == 0){
                break;
            }
            else{
                a=b;
                b=t;
            }

        }
        if(b>1)	return true;
        else{
            return  false;
        }
    }

    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int n=cin.nextInt();
        int m=cin.nextInt();
        int num[]=new int[n];
        int sum=0;
        for(int i=0;i<n;i++){
            num[i]=cin.nextInt();
            sum+=num[i];
        }
        int vote=(sum)/(4*m);
        if(sum%(4*m)>0){
            vote++;
        }
        int m1=0;
        for(int i=0;i<n;i++){
            if(num[i]>=vote){
                m1++;
            }
        }
        if(m1>=m){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }

    }
}

Measured memory_bytes: 23124
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

using Weight = int;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(int s = 0, int d = 0, Weight w = 0)
    : src(s), dst(d), weight(w) {
  }
};

using Edges  = vector<Edge>;
using Graph  = vector<Edges>;
using Array  = vector<Weight>;
using Matrix = vector<Array>;

void addArc(Graph &g, const int &a, const int &b, const Weight &w = 1) {
  g[a].emplace_back(a, b, w);
}

void addEdge(Graph &g, const int &a, const int &b, const Weight &w = 1) {
  addArc(g, a, b, w);
  addArc(g, b, a, w);
}

// deps: graph-basic
bool operator<(const Edge &e, const Edge &f) {
  return e.weight > f.weight;
}

pair<Weight, Edges> prim(const Graph &g, const int &r = 0) {
  Edges T;
  Weight total = 0;
  vi vs(g.size());
  priority_queue<Edge> q;
  q.emplace(-1, r, 0);
  while (q.size()) {
    Edge e = q.top();
    q.pop();
    if (vs[e.dst]) continue;
    vs[e.dst] = true;
    total += e.weight;
    if (e.src != -1) T.emplace_back(e);
    for (auto &f : g[e.dst]) {
      if (!vs[f.dst]) q.emplace(f);
    }
  }
  return mp(total, T);
}

void solve() {
  int v, e;
  cin >> v >> e;
  Graph g(v);
  while (e--) {
    int s, t, w;
    cin >> s >> t >> w;
    addEdge(g, s, t, w);
  }
  cout << prim(g).first << endl;
}

Measured memory_bytes: 14184
"use strict"
function Main(input) {
  input = input.split('\n');
  let i1 = input[0].trim().split(' ').map(Number);
  let a = input[1].trim().split(' ').map(Number);
  let h = i1[0];
  let n = i1[1];
  let max = a.reduce((acc, val) => {
    return acc+=val;
  })
 
  console.log(h <= max ? 'Yes' : 'No')
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

using namespace std;

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

    long int n,m,num,sum=0;
    cin>>n>>m;

    //long int arr[m]={};

    for(int i=0;i<m;i++){
        cin>>num;
        sum+=num;
    }

    if(sum<=n){
        cout<<n-sum<<"\n";
    }
    else{
        cout<<-1<<"\n";
    }


    return 0;
}


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


int main() {
    int N, L;
    cin >> N >> L;
    vector<int> app(N);
    int ori;
    int real;
    for (int i = 0; i < N; i++) {
        app[i] = L + i;
    }
/*
    for (int i = 0; i < N; i++) {
        cout << app[i] << endl;
    }
*/    
    int ans = 0;
    if (app[N-1] < 0) {
        for (int i = 0; i < N-1; i++) {
            ans += app[i];
        }
        cout << ans << endl;
    }else if (app[0] > 0) {
        for (int i = 1; i < N; i++) {
            ans += app[i];
        }
        cout << ans << endl;
    }else{
        for (int i = 0; i < N; i++) {
            ans += app[i];
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef set<int> si;
const int inf = 1e9;
const int mod = 1e9+7;

int N, A[300000];

main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  FOR(i, 0, 3 * N){
    cin >> A[i];
  }
  sort(A, A + 3 * N);
  ll s = 0;
  FOR(i, 0, N){
    s += A[N + i * 2];
  }
  cout << s << endl;
}


Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>
#include <bitset>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

template<class T> inline bool chmin(T& a,T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if (a < b) {a = b; return true;} return false;}

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  ll H, W; cin >> H >> W;
  if (H == 1 || W == 1){
    cout << 1 << endl;
  }
  else {
    cout << (H * W + 1) / 2 << endl;
  }
}


Measured memory_bytes: 256